text
stringlengths
2
1.04M
meta
dict
angular.module('docsApp').constant('DEMOS', [ { "name": "autocomplete", "moduleName": "material.components.autocomplete", "label": "Autocomplete", "demos": [ { "ngModule": { "name": "autocompleteDemo", "module": "autocompleteDemo", "dependencies": [ "ngMaterial" ] }, "id": "autocompletedemoBasicUsage", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/autocomplete/demoBasicUsage/script.js" } ], "moduleName": "material.components.autocomplete", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/autocomplete/demoBasicUsage/index.html" } }, { "ngModule": { "name": "autocompleteCustomTemplateDemo", "module": "autocompleteCustomTemplateDemo", "dependencies": [ "ngMaterial" ] }, "id": "autocompletedemoCustomTemplate", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/autocomplete/demoCustomTemplate/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/autocomplete/demoCustomTemplate/script.js" } ], "moduleName": "material.components.autocomplete", "name": "demoCustomTemplate", "label": "Custom Template", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/autocomplete/demoCustomTemplate/index.html" } }, { "ngModule": { "name": "autocompleteFloatingLabelDemo", "module": "autocompleteFloatingLabelDemo", "dependencies": [ "ngMaterial", "ngMessages" ] }, "id": "autocompletedemoFloatingLabel", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/autocomplete/demoFloatingLabel/script.js" } ], "moduleName": "material.components.autocomplete", "name": "demoFloatingLabel", "label": "Floating Label", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/autocomplete/demoFloatingLabel/index.html" } }, { "ngModule": { "name": "autocompleteDemoInsideDialog", "module": "autocompleteDemoInsideDialog", "dependencies": [ "ngMaterial" ] }, "id": "autocompletedemoInsideDialog", "css": [], "html": [ { "name": "dialog.tmpl.html", "label": "dialog.tmpl.html", "fileType": "html", "outputPath": "demo-partials/autocomplete/demoInsideDialog/dialog.tmpl.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/autocomplete/demoInsideDialog/script.js" } ], "moduleName": "material.components.autocomplete", "name": "demoInsideDialog", "label": "Inside Dialog", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/autocomplete/demoInsideDialog/index.html" } } ], "url": "demo/autocomplete" }, { "name": "bottomSheet", "moduleName": "material.components.bottomSheet", "label": "Bottom Sheet", "demos": [ { "ngModule": { "name": "bottomSheetDemo1", "module": "bottomSheetDemo1", "dependencies": [ "ngMaterial" ] }, "id": "bottomSheetdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/bottomSheet/demoBasicUsage/style.css" } ], "html": [ { "name": "bottom-sheet-grid-template.html", "label": "bottom-sheet-grid-template.html", "fileType": "html", "outputPath": "demo-partials/bottomSheet/demoBasicUsage/bottom-sheet-grid-template.html" }, { "name": "bottom-sheet-list-template.html", "label": "bottom-sheet-list-template.html", "fileType": "html", "outputPath": "demo-partials/bottomSheet/demoBasicUsage/bottom-sheet-list-template.html" }, { "name": "readme.html", "label": "readme.html", "fileType": "html", "outputPath": "demo-partials/bottomSheet/demoBasicUsage/readme.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/bottomSheet/demoBasicUsage/script.js" } ], "moduleName": "material.components.bottomSheet", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/bottomSheet/demoBasicUsage/index.html" } } ], "url": "demo/bottomSheet" }, { "name": "button", "moduleName": "material.components.button", "label": "Button", "demos": [ { "ngModule": { "name": "buttonsDemo1", "module": "buttonsDemo1", "dependencies": [ "ngMaterial" ] }, "id": "buttondemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/button/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/button/demoBasicUsage/script.js" } ], "moduleName": "material.components.button", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/button/demoBasicUsage/index.html" } } ], "url": "demo/button" }, { "name": "card", "moduleName": "material.components.card", "label": "Card", "demos": [ { "ngModule": { "name": "cardDemo1", "module": "cardDemo1", "dependencies": [ "ngMaterial" ] }, "id": "carddemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/card/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/card/demoBasicUsage/script.js" } ], "moduleName": "material.components.card", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/card/demoBasicUsage/index.html" } }, { "ngModule": { "name": "cardDemo2", "module": "cardDemo2", "dependencies": [ "ngMaterial" ] }, "id": "carddemoCardActionButtons", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/card/demoCardActionButtons/script.js" } ], "moduleName": "material.components.card", "name": "demoCardActionButtons", "label": "Card Action Buttons", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/card/demoCardActionButtons/index.html" } }, { "ngModule": { "name": "cardDemo3", "module": "cardDemo3", "dependencies": [ "ngMaterial" ] }, "id": "carddemoInCardActions", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/card/demoInCardActions/script.js" } ], "moduleName": "material.components.card", "name": "demoInCardActions", "label": "In Card Actions", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/card/demoInCardActions/index.html" } } ], "url": "demo/card" }, { "name": "checkbox", "moduleName": "material.components.checkbox", "label": "Checkbox", "demos": [ { "ngModule": { "name": "checkboxDemo1", "module": "checkboxDemo1", "dependencies": [ "ngMaterial" ] }, "id": "checkboxdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/checkbox/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/checkbox/demoBasicUsage/script.js" } ], "moduleName": "material.components.checkbox", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/checkbox/demoBasicUsage/index.html" } }, { "ngModule": { "name": "checkboxDemo3", "module": "checkboxDemo3", "dependencies": [ "ngMaterial" ] }, "id": "checkboxdemoSelectAll", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/checkbox/demoSelectAll/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/checkbox/demoSelectAll/script.js" } ], "moduleName": "material.components.checkbox", "name": "demoSelectAll", "label": "Select All", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/checkbox/demoSelectAll/index.html" } }, { "ngModule": { "name": "checkboxDemo2", "module": "checkboxDemo2", "dependencies": [ "ngMaterial" ] }, "id": "checkboxdemoSyncing", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/checkbox/demoSyncing/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/checkbox/demoSyncing/script.js" } ], "moduleName": "material.components.checkbox", "name": "demoSyncing", "label": "Syncing", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/checkbox/demoSyncing/index.html" } } ], "url": "demo/checkbox" }, { "name": "chips", "moduleName": "material.components.chips", "label": "Chips", "demos": [ { "ngModule": { "name": "chipsDemo", "module": "chipsDemo", "dependencies": [ "ngMaterial", "ngMessages" ] }, "id": "chipsdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/chips/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/chips/demoBasicUsage/script.js" } ], "moduleName": "material.components.chips", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/chips/demoBasicUsage/index.html" } }, { "ngModule": { "name": "contactChipsDemo", "module": "contactChipsDemo", "dependencies": [ "ngMaterial" ] }, "id": "chipsdemoContactChips", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/chips/demoContactChips/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/chips/demoContactChips/script.js" } ], "moduleName": "material.components.chips", "name": "demoContactChips", "label": "Contact Chips", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/chips/demoContactChips/index.html" } }, { "ngModule": { "name": "chipsCustomInputDemo", "module": "chipsCustomInputDemo", "dependencies": [ "ngMaterial" ] }, "id": "chipsdemoCustomInputs", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/chips/demoCustomInputs/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/chips/demoCustomInputs/script.js" } ], "moduleName": "material.components.chips", "name": "demoCustomInputs", "label": "Custom Inputs", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/chips/demoCustomInputs/index.html" } }, { "ngModule": { "name": "chipsCustomSeparatorDemo", "module": "chipsCustomSeparatorDemo", "dependencies": [ "ngMaterial" ] }, "id": "chipsdemoCustomSeparatorKeys", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/chips/demoCustomSeparatorKeys/script.js" } ], "moduleName": "material.components.chips", "name": "demoCustomSeparatorKeys", "label": "Custom Separator Keys", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/chips/demoCustomSeparatorKeys/index.html" } }, { "ngModule": { "name": "staticChipsDemo", "module": "staticChipsDemo", "dependencies": [ "ngMaterial" ] }, "id": "chipsdemoStaticChips", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/chips/demoStaticChips/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/chips/demoStaticChips/script.js" } ], "moduleName": "material.components.chips", "name": "demoStaticChips", "label": "Static Chips", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/chips/demoStaticChips/index.html" } } ], "url": "demo/chips" }, { "name": "content", "moduleName": "material.components.content", "label": "Content", "demos": [ { "ngModule": { "name": "contentDemo1", "module": "contentDemo1", "dependencies": [ "ngMaterial" ] }, "id": "contentdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/content/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/content/demoBasicUsage/script.js" } ], "moduleName": "material.components.content", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/content/demoBasicUsage/index.html" } } ], "url": "demo/content" }, { "name": "datepicker", "moduleName": "material.components.datepicker", "label": "Datepicker", "demos": [ { "ngModule": { "name": "datepickerBasicUsage", "module": "datepickerBasicUsage", "dependencies": [ "ngMaterial", "ngMessages" ] }, "id": "datepickerdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/datepicker/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/datepicker/demoBasicUsage/script.js" } ], "moduleName": "material.components.datepicker", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/datepicker/demoBasicUsage/index.html" } } ], "url": "demo/datepicker" }, { "name": "dialog", "moduleName": "material.components.dialog", "label": "Dialog", "demos": [ { "ngModule": { "name": "dialogDemo1", "module": "dialogDemo1", "dependencies": [ "ngMaterial" ] }, "id": "dialogdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/dialog/demoBasicUsage/style.css" } ], "html": [ { "name": "dialog1.tmpl.html", "label": "dialog1.tmpl.html", "fileType": "html", "outputPath": "demo-partials/dialog/demoBasicUsage/dialog1.tmpl.html" }, { "name": "tabDialog.tmpl.html", "label": "tabDialog.tmpl.html", "fileType": "html", "outputPath": "demo-partials/dialog/demoBasicUsage/tabDialog.tmpl.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/dialog/demoBasicUsage/script.js" } ], "moduleName": "material.components.dialog", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/dialog/demoBasicUsage/index.html" } }, { "ngModule": { "name": "dialogDemo2", "module": "dialogDemo2", "dependencies": [ "ngMaterial" ] }, "id": "dialogdemoOpenFromCloseTo", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/dialog/demoOpenFromCloseTo/script.js" } ], "moduleName": "material.components.dialog", "name": "demoOpenFromCloseTo", "label": "Open From Close To", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/dialog/demoOpenFromCloseTo/index.html" } } ], "url": "demo/dialog" }, { "name": "divider", "moduleName": "material.components.divider", "label": "Divider", "demos": [ { "ngModule": { "name": "dividerDemo1", "module": "dividerDemo1", "dependencies": [ "ngMaterial" ] }, "id": "dividerdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/divider/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/divider/demoBasicUsage/script.js" } ], "moduleName": "material.components.divider", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/divider/demoBasicUsage/index.html" } } ], "url": "demo/divider" }, { "name": "fabSpeedDial", "moduleName": "material.components.fabSpeedDial", "label": "FAB Speed Dial", "demos": [ { "ngModule": { "name": "fabSpeedDialDemoBasicUsage", "module": "fabSpeedDialDemoBasicUsage", "dependencies": [ "ngMaterial" ] }, "id": "fabSpeedDialdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/fabSpeedDial/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/fabSpeedDial/demoBasicUsage/script.js" } ], "moduleName": "material.components.fabSpeedDial", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/fabSpeedDial/demoBasicUsage/index.html" } }, { "ngModule": { "name": "fabSpeedDialDemoMoreOptions", "module": "fabSpeedDialDemoMoreOptions", "dependencies": [ "ngMaterial" ] }, "id": "fabSpeedDialdemoMoreOptions", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/fabSpeedDial/demoMoreOptions/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/fabSpeedDial/demoMoreOptions/script.js" } ], "moduleName": "material.components.fabSpeedDial", "name": "demoMoreOptions", "label": "More Options", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/fabSpeedDial/demoMoreOptions/index.html" } } ], "url": "demo/fabSpeedDial" }, { "name": "fabToolbar", "moduleName": "material.components.fabToolbar", "label": "FAB Toolbar", "demos": [ { "ngModule": { "name": "fabToolbarBasicUsageDemo", "module": "fabToolbarBasicUsageDemo", "dependencies": [ "ngMaterial" ] }, "id": "fabToolbardemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/fabToolbar/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/fabToolbar/demoBasicUsage/script.js" } ], "moduleName": "material.components.fabToolbar", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/fabToolbar/demoBasicUsage/index.html" } } ], "url": "demo/fabToolbar" }, { "name": "gridList", "moduleName": "material.components.gridList", "label": "Grid List", "demos": [ { "ngModule": { "name": "gridListDemo1", "module": "gridListDemo1", "dependencies": [ "ngMaterial" ] }, "id": "gridListdemoBasicUsage", "css": [ { "name": "styles.css", "label": "styles.css", "fileType": "css", "outputPath": "demo-partials/gridList/demoBasicUsage/styles.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/gridList/demoBasicUsage/script.js" } ], "moduleName": "material.components.gridList", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/gridList/demoBasicUsage/index.html" } }, { "ngModule": { "name": "gridListDemoApp", "module": "gridListDemoApp", "dependencies": [ "ngMaterial" ] }, "id": "gridListdemoDynamicTiles", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/gridList/demoDynamicTiles/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/gridList/demoDynamicTiles/script.js" } ], "moduleName": "material.components.gridList", "name": "demoDynamicTiles", "label": "Dynamic Tiles", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/gridList/demoDynamicTiles/index.html" } }, { "ngModule": { "name": "gridListDemo1", "module": "gridListDemo1", "dependencies": [ "ngMaterial" ] }, "id": "gridListdemoResponsiveUsage", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/gridList/demoResponsiveUsage/script.js" } ], "moduleName": "material.components.gridList", "name": "demoResponsiveUsage", "label": "Responsive Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/gridList/demoResponsiveUsage/index.html" } } ], "url": "demo/gridList" }, { "name": "icon", "moduleName": "material.components.icon", "label": "Icon", "demos": [ { "ngModule": { "name": "appDemoFontIconsWithClassnames", "module": "appDemoFontIconsWithClassnames", "dependencies": [ "ngMaterial" ] }, "id": "icondemoFontIconsWithClassnames", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/icon/demoFontIconsWithClassnames/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/icon/demoFontIconsWithClassnames/script.js" } ], "moduleName": "material.components.icon", "name": "demoFontIconsWithClassnames", "label": "Font Icons With Classnames", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/icon/demoFontIconsWithClassnames/index.html" } }, { "ngModule": { "name": "appDemoFontIconsWithLigatures", "module": "appDemoFontIconsWithLigatures", "dependencies": [ "ngMaterial" ] }, "id": "icondemoFontIconsWithLigatures", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/icon/demoFontIconsWithLigatures/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/icon/demoFontIconsWithLigatures/script.js" } ], "moduleName": "material.components.icon", "name": "demoFontIconsWithLigatures", "label": "Font Icons With Ligatures", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/icon/demoFontIconsWithLigatures/index.html" } }, { "ngModule": { "name": "appDemoSvgIcons", "module": "appDemoSvgIcons", "dependencies": [ "ngMaterial" ] }, "id": "icondemoLoadSvgIconsFromUrl", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/icon/demoLoadSvgIconsFromUrl/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/icon/demoLoadSvgIconsFromUrl/script.js" } ], "moduleName": "material.components.icon", "name": "demoLoadSvgIconsFromUrl", "label": "Load Svg Icons From Url", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/icon/demoLoadSvgIconsFromUrl/index.html" } }, { "ngModule": { "name": "appSvgIconSets", "module": "appSvgIconSets", "dependencies": [ "ngMaterial" ] }, "id": "icondemoSvgIconSets", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/icon/demoSvgIconSets/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/icon/demoSvgIconSets/script.js" } ], "moduleName": "material.components.icon", "name": "demoSvgIconSets", "label": "Svg Icon Sets", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/icon/demoSvgIconSets/index.html" } }, { "ngModule": { "name": "appUsingTemplateCache", "module": "appUsingTemplateCache", "dependencies": [ "ngMaterial" ] }, "id": "icondemoUsingTemplateCache", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/icon/demoUsingTemplateCache/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/icon/demoUsingTemplateCache/script.js" } ], "moduleName": "material.components.icon", "name": "demoUsingTemplateCache", "label": "Using Template Cache", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/icon/demoUsingTemplateCache/index.html" } } ], "url": "demo/icon" }, { "name": "input", "moduleName": "material.components.input", "label": "Input", "demos": [ { "ngModule": { "name": "inputBasicDemo", "module": "inputBasicDemo", "dependencies": [ "ngMaterial", "ngMessages" ] }, "id": "inputdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/input/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/input/demoBasicUsage/script.js" } ], "moduleName": "material.components.input", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/input/demoBasicUsage/index.html" } }, { "ngModule": { "name": "inputErrorsApp", "module": "inputErrorsApp", "dependencies": [ "ngMaterial", "ngMessages" ] }, "id": "inputdemoErrors", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/input/demoErrors/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/input/demoErrors/script.js" } ], "moduleName": "material.components.input", "name": "demoErrors", "label": "Errors", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/input/demoErrors/index.html" } }, { "ngModule": { "name": "inputErrorsAdvancedApp", "module": "inputErrorsAdvancedApp", "dependencies": [ "ngMaterial", "ngMessages" ] }, "id": "inputdemoErrorsAdvanced", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/input/demoErrorsAdvanced/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/input/demoErrorsAdvanced/script.js" } ], "moduleName": "material.components.input", "name": "demoErrorsAdvanced", "label": "Errors Advanced", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/input/demoErrorsAdvanced/index.html" } }, { "ngModule": { "name": "inputIconDemo", "module": "inputIconDemo", "dependencies": [ "ngMaterial", "ngMessages" ] }, "id": "inputdemoIcons", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/input/demoIcons/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/input/demoIcons/script.js" } ], "moduleName": "material.components.input", "name": "demoIcons", "label": "Icons", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/input/demoIcons/index.html" } } ], "url": "demo/input" }, { "name": "list", "moduleName": "material.components.list", "label": "List", "demos": [ { "ngModule": { "name": "listDemo1", "module": "listDemo1", "dependencies": [ "ngMaterial" ] }, "id": "listdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/list/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/list/demoBasicUsage/script.js" } ], "moduleName": "material.components.list", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/list/demoBasicUsage/index.html" } }, { "ngModule": { "name": "listDemo2", "module": "listDemo2", "dependencies": [ "ngMaterial" ] }, "id": "listdemoListControls", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/list/demoListControls/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/list/demoListControls/script.js" } ], "moduleName": "material.components.list", "name": "demoListControls", "label": "List Controls", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/list/demoListControls/index.html" } } ], "url": "demo/list" }, { "name": "menu", "moduleName": "material.components.menu", "label": "Menu", "demos": [ { "ngModule": { "name": "menuDemoBasic", "module": "menuDemoBasic", "dependencies": [ "ngMaterial" ] }, "id": "menudemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/menu/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/menu/demoBasicUsage/script.js" } ], "moduleName": "material.components.menu", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/menu/demoBasicUsage/index.html" } }, { "ngModule": { "name": "menuDemoPosition", "module": "menuDemoPosition", "dependencies": [ "ngMaterial" ] }, "id": "menudemoMenuPositionModes", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/menu/demoMenuPositionModes/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/menu/demoMenuPositionModes/script.js" } ], "moduleName": "material.components.menu", "name": "demoMenuPositionModes", "label": "Menu Position Modes", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/menu/demoMenuPositionModes/index.html" } }, { "ngModule": { "name": "menuDemoWidth", "module": "menuDemoWidth", "dependencies": [ "ngMaterial" ] }, "id": "menudemoMenuWidth", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/menu/demoMenuWidth/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/menu/demoMenuWidth/script.js" } ], "moduleName": "material.components.menu", "name": "demoMenuWidth", "label": "Menu Width", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/menu/demoMenuWidth/index.html" } } ], "url": "demo/menu" }, { "name": "menuBar", "moduleName": "material.components.menuBar", "label": "Menu Bar", "demos": [ { "ngModule": { "name": "menuBarDemoBasic", "module": "menuBarDemoBasic", "dependencies": [ "ngMaterial" ] }, "id": "menuBardemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/menuBar/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/menuBar/demoBasicUsage/script.js" } ], "moduleName": "material.components.menuBar", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/menuBar/demoBasicUsage/index.html" } } ], "url": "demo/menuBar" }, { "name": "panel", "moduleName": "material.components.panel", "label": "Panel", "demos": [ { "ngModule": { "name": "panelDemo", "module": "panelDemo", "dependencies": [ "ngMaterial" ] }, "id": "paneldemoBasicUsage", "css": [ { "name": "style.global.css", "label": "style.global.css", "fileType": "css", "outputPath": "demo-partials/panel/demoBasicUsage/style.global.css" } ], "html": [ { "name": "panel.tmpl.html", "label": "panel.tmpl.html", "fileType": "html", "outputPath": "demo-partials/panel/demoBasicUsage/panel.tmpl.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/panel/demoBasicUsage/script.js" } ], "moduleName": "material.components.panel", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/panel/demoBasicUsage/index.html" } }, { "ngModule": { "name": "panelAnimationsDemo", "module": "panelAnimationsDemo", "dependencies": [ "ngMaterial" ] }, "id": "paneldemoPanelAnimations", "css": [ { "name": "style.global.css", "label": "style.global.css", "fileType": "css", "outputPath": "demo-partials/panel/demoPanelAnimations/style.global.css" } ], "html": [ { "name": "panel.tmpl.html", "label": "panel.tmpl.html", "fileType": "html", "outputPath": "demo-partials/panel/demoPanelAnimations/panel.tmpl.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/panel/demoPanelAnimations/script.js" } ], "moduleName": "material.components.panel", "name": "demoPanelAnimations", "label": "Panel Animations", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/panel/demoPanelAnimations/index.html" } } ], "url": "demo/panel" }, { "name": "progressCircular", "moduleName": "material.components.progressCircular", "label": "Progress Circular", "demos": [ { "ngModule": { "name": "progressCircularDemo1", "module": "progressCircularDemo1", "dependencies": [ "ngMaterial" ] }, "id": "progressCirculardemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/progressCircular/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/progressCircular/demoBasicUsage/script.js" } ], "moduleName": "material.components.progressCircular", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/progressCircular/demoBasicUsage/index.html" } } ], "url": "demo/progressCircular" }, { "name": "progressLinear", "moduleName": "material.components.progressLinear", "label": "Progress Linear", "demos": [ { "ngModule": { "name": "progressLinearDemo1", "module": "progressLinearDemo1", "dependencies": [ "ngMaterial" ] }, "id": "progressLineardemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/progressLinear/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/progressLinear/demoBasicUsage/script.js" } ], "moduleName": "material.components.progressLinear", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/progressLinear/demoBasicUsage/index.html" } } ], "url": "demo/progressLinear" }, { "name": "radioButton", "moduleName": "material.components.radioButton", "label": "Radio Button", "demos": [ { "ngModule": { "name": "radioDemo1", "module": "radioDemo1", "dependencies": [ "ngMaterial" ] }, "id": "radioButtondemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/radioButton/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/radioButton/demoBasicUsage/script.js" } ], "moduleName": "material.components.radioButton", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/radioButton/demoBasicUsage/index.html" } }, { "ngModule": { "name": "radioDemo2", "module": "radioDemo2", "dependencies": [ "ngMaterial" ] }, "id": "radioButtondemoMultiColumn", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/radioButton/demoMultiColumn/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/radioButton/demoMultiColumn/script.js" } ], "moduleName": "material.components.radioButton", "name": "demoMultiColumn", "label": "Multi Column", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/radioButton/demoMultiColumn/index.html" } } ], "url": "demo/radioButton" }, { "name": "select", "moduleName": "material.components.select", "label": "Select", "demos": [ { "ngModule": { "name": "selectDemoBasic", "module": "selectDemoBasic", "dependencies": [ "ngMaterial" ] }, "id": "selectdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/select/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/select/demoBasicUsage/script.js" } ], "moduleName": "material.components.select", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/select/demoBasicUsage/index.html" } }, { "ngModule": { "name": "selectDemoOptGroups", "module": "selectDemoOptGroups", "dependencies": [ "ngMaterial" ] }, "id": "selectdemoOptionGroups", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/select/demoOptionGroups/script.js" } ], "moduleName": "material.components.select", "name": "demoOptionGroups", "label": "Option Groups", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/select/demoOptionGroups/index.html" } }, { "ngModule": { "name": "selectDemoOptionsAsync", "module": "selectDemoOptionsAsync", "dependencies": [ "ngMaterial" ] }, "id": "selectdemoOptionsWithAsyncSearch", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/select/demoOptionsWithAsyncSearch/script.js" } ], "moduleName": "material.components.select", "name": "demoOptionsWithAsyncSearch", "label": "Options With Async Search", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/select/demoOptionsWithAsyncSearch/index.html" } }, { "ngModule": { "name": "selectDemoSelectHeader", "module": "selectDemoSelectHeader", "dependencies": [ "ngMaterial" ] }, "id": "selectdemoSelectHeader", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/select/demoSelectHeader/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/select/demoSelectHeader/script.js" } ], "moduleName": "material.components.select", "name": "demoSelectHeader", "label": "Select Header", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/select/demoSelectHeader/index.html" } }, { "ngModule": { "name": "selectDemoSelectedText", "module": "selectDemoSelectedText", "dependencies": [ "ngMaterial" ] }, "id": "selectdemoSelectedText", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/select/demoSelectedText/script.js" } ], "moduleName": "material.components.select", "name": "demoSelectedText", "label": "Selected Text", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/select/demoSelectedText/index.html" } }, { "ngModule": { "name": "selectDemoValidation", "module": "selectDemoValidation", "dependencies": [ "ngMaterial", "ngMessages" ] }, "id": "selectdemoValidations", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/select/demoValidations/script.js" } ], "moduleName": "material.components.select", "name": "demoValidations", "label": "Validations", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/select/demoValidations/index.html" } } ], "url": "demo/select" }, { "name": "sidenav", "moduleName": "material.components.sidenav", "label": "Sidenav", "demos": [ { "ngModule": { "name": "sidenavDemo1", "module": "sidenavDemo1", "dependencies": [ "ngMaterial" ] }, "id": "sidenavdemoBasicUsage", "css": [], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/sidenav/demoBasicUsage/script.js" } ], "moduleName": "material.components.sidenav", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/sidenav/demoBasicUsage/index.html" } } ], "url": "demo/sidenav" }, { "name": "slider", "moduleName": "material.components.slider", "label": "Slider", "demos": [ { "ngModule": { "name": "sliderDemo1", "module": "sliderDemo1", "dependencies": [ "ngMaterial" ] }, "id": "sliderdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/slider/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/slider/demoBasicUsage/script.js" } ], "moduleName": "material.components.slider", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/slider/demoBasicUsage/index.html" } } ], "url": "demo/slider" }, { "name": "subheader", "moduleName": "material.components.subheader", "label": "Subheader", "demos": [ { "ngModule": { "name": "subheaderBasicDemo", "module": "subheaderBasicDemo", "dependencies": [ "ngMaterial" ] }, "id": "subheaderdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/subheader/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/subheader/demoBasicUsage/script.js" } ], "moduleName": "material.components.subheader", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/subheader/demoBasicUsage/index.html" } } ], "url": "demo/subheader" }, { "name": "swipe", "moduleName": "material.components.swipe", "label": "Swipe", "demos": [ { "ngModule": { "name": "demoSwipe", "module": "demoSwipe", "dependencies": [ "ngMaterial" ] }, "id": "swipedemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/swipe/demoBasicUsage/style.css" } ], "html": [ { "name": "readme.html", "label": "readme.html", "fileType": "html", "outputPath": "demo-partials/swipe/demoBasicUsage/readme.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/swipe/demoBasicUsage/script.js" } ], "moduleName": "material.components.swipe", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/swipe/demoBasicUsage/index.html" } } ], "url": "demo/swipe" }, { "name": "switch", "moduleName": "material.components.switch", "label": "Switch", "demos": [ { "ngModule": { "name": "switchDemo1", "module": "switchDemo1", "dependencies": [ "ngMaterial" ] }, "id": "switchdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/switch/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/switch/demoBasicUsage/script.js" } ], "moduleName": "material.components.switch", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/switch/demoBasicUsage/index.html" } } ], "url": "demo/switch" }, { "name": "tabs", "moduleName": "material.components.tabs", "label": "Tabs", "demos": [ { "ngModule": { "name": "tabsDemoDynamicHeight", "module": "tabsDemoDynamicHeight", "dependencies": [ "ngMaterial" ] }, "id": "tabsdemoDynamicHeight", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/tabs/demoDynamicHeight/style.css" } ], "html": [ { "name": "readme.html", "label": "readme.html", "fileType": "html", "outputPath": "demo-partials/tabs/demoDynamicHeight/readme.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/tabs/demoDynamicHeight/script.js" } ], "moduleName": "material.components.tabs", "name": "demoDynamicHeight", "label": "Dynamic Height", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/tabs/demoDynamicHeight/index.html" } }, { "ngModule": { "name": "tabsDemoDynamicTabs", "module": "tabsDemoDynamicTabs", "dependencies": [ "ngMaterial" ] }, "id": "tabsdemoDynamicTabs", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/tabs/demoDynamicTabs/style.css" } ], "html": [ { "name": "readme.html", "label": "readme.html", "fileType": "html", "outputPath": "demo-partials/tabs/demoDynamicTabs/readme.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/tabs/demoDynamicTabs/script.js" } ], "moduleName": "material.components.tabs", "name": "demoDynamicTabs", "label": "Dynamic Tabs", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/tabs/demoDynamicTabs/index.html" } }, { "ngModule": { "name": "tabsDemoStaticTabs", "module": "tabsDemoStaticTabs", "dependencies": [ "ngMaterial" ] }, "id": "tabsdemoStaticTabs", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/tabs/demoStaticTabs/style.css" } ], "html": [ { "name": "readme.html", "label": "readme.html", "fileType": "html", "outputPath": "demo-partials/tabs/demoStaticTabs/readme.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/tabs/demoStaticTabs/script.js" } ], "moduleName": "material.components.tabs", "name": "demoStaticTabs", "label": "Static Tabs", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/tabs/demoStaticTabs/index.html" } } ], "url": "demo/tabs" }, { "name": "toast", "moduleName": "material.components.toast", "label": "Toast", "demos": [ { "ngModule": { "name": "toastDemo1", "module": "toastDemo1", "dependencies": [ "ngMaterial" ] }, "id": "toastdemoBasicUsage", "css": [], "html": [ { "name": "toast-template.html", "label": "toast-template.html", "fileType": "html", "outputPath": "demo-partials/toast/demoBasicUsage/toast-template.html" } ], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/toast/demoBasicUsage/script.js" } ], "moduleName": "material.components.toast", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/toast/demoBasicUsage/index.html" } } ], "url": "demo/toast" }, { "name": "toolbar", "moduleName": "material.components.toolbar", "label": "Toolbar", "demos": [ { "ngModule": { "name": "toolbarDemo1", "module": "toolbarDemo1", "dependencies": [ "ngMaterial" ] }, "id": "toolbardemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/toolbar/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/toolbar/demoBasicUsage/script.js" } ], "moduleName": "material.components.toolbar", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/toolbar/demoBasicUsage/index.html" } }, { "ngModule": { "name": "toolbarDemo2", "module": "toolbarDemo2", "dependencies": [ "ngMaterial" ] }, "id": "toolbardemoScrollShrink", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/toolbar/demoScrollShrink/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/toolbar/demoScrollShrink/script.js" } ], "moduleName": "material.components.toolbar", "name": "demoScrollShrink", "label": "Scroll Shrink", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/toolbar/demoScrollShrink/index.html" } } ], "url": "demo/toolbar" }, { "name": "tooltip", "moduleName": "material.components.tooltip", "label": "Tooltip", "demos": [ { "ngModule": { "name": "tooltipDemo1", "module": "tooltipDemo1", "dependencies": [ "ngMaterial" ] }, "id": "tooltipdemoBasicUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/tooltip/demoBasicUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/tooltip/demoBasicUsage/script.js" } ], "moduleName": "material.components.tooltip", "name": "demoBasicUsage", "label": "Basic Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/tooltip/demoBasicUsage/index.html" } } ], "url": "demo/tooltip" }, { "name": "virtualRepeat", "moduleName": "material.components.virtualRepeat", "label": "Virtual Repeat", "demos": [ { "ngModule": { "name": "virtualRepeatDeferredLoadingDemo", "module": "virtualRepeatDeferredLoadingDemo", "dependencies": [ "ngMaterial" ] }, "id": "virtualRepeatdemoDeferredLoading", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/virtualRepeat/demoDeferredLoading/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/virtualRepeat/demoDeferredLoading/script.js" } ], "moduleName": "material.components.virtualRepeat", "name": "demoDeferredLoading", "label": "Deferred Loading", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/virtualRepeat/demoDeferredLoading/index.html" } }, { "ngModule": { "name": "virtualRepeatHorizontalDemo", "module": "virtualRepeatHorizontalDemo", "dependencies": [ "ngMaterial" ] }, "id": "virtualRepeatdemoHorizontalUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/virtualRepeat/demoHorizontalUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/virtualRepeat/demoHorizontalUsage/script.js" } ], "moduleName": "material.components.virtualRepeat", "name": "demoHorizontalUsage", "label": "Horizontal Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/virtualRepeat/demoHorizontalUsage/index.html" } }, { "ngModule": { "name": "virtualRepeatInfiniteScrollDemo", "module": "virtualRepeatInfiniteScrollDemo", "dependencies": [ "ngMaterial" ] }, "id": "virtualRepeatdemoInfiniteScroll", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/virtualRepeat/demoInfiniteScroll/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/virtualRepeat/demoInfiniteScroll/script.js" } ], "moduleName": "material.components.virtualRepeat", "name": "demoInfiniteScroll", "label": "Infinite Scroll", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/virtualRepeat/demoInfiniteScroll/index.html" } }, { "ngModule": { "name": "virtualRepeatScrollToDemo", "module": "virtualRepeatScrollToDemo", "dependencies": [ "ngMaterial" ] }, "id": "virtualRepeatdemoScrollTo", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/virtualRepeat/demoScrollTo/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/virtualRepeat/demoScrollTo/script.js" } ], "moduleName": "material.components.virtualRepeat", "name": "demoScrollTo", "label": "Scroll To", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/virtualRepeat/demoScrollTo/index.html" } }, { "ngModule": { "name": "virtualRepeatVerticalDemo", "module": "virtualRepeatVerticalDemo", "dependencies": [ "ngMaterial" ] }, "id": "virtualRepeatdemoVerticalUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/virtualRepeat/demoVerticalUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/virtualRepeat/demoVerticalUsage/script.js" } ], "moduleName": "material.components.virtualRepeat", "name": "demoVerticalUsage", "label": "Vertical Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/virtualRepeat/demoVerticalUsage/index.html" } } ], "url": "demo/virtualRepeat" }, { "name": "whiteframe", "moduleName": "material.components.whiteframe", "label": "Whiteframe", "demos": [ { "ngModule": { "name": "whiteframeBasicUsage", "module": "whiteframeBasicUsage", "dependencies": [ "ngMaterial" ] }, "id": "whiteframedemoBasicClassUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/whiteframe/demoBasicClassUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/whiteframe/demoBasicClassUsage/script.js" } ], "moduleName": "material.components.whiteframe", "name": "demoBasicClassUsage", "label": "Basic Class Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/whiteframe/demoBasicClassUsage/index.html" } }, { "ngModule": { "name": "whiteframeDirectiveUsage", "module": "whiteframeDirectiveUsage", "dependencies": [ "ngMaterial" ] }, "id": "whiteframedemoDirectiveAttributeUsage", "css": [ { "name": "style.css", "label": "style.css", "fileType": "css", "outputPath": "demo-partials/whiteframe/demoDirectiveAttributeUsage/style.css" } ], "html": [], "js": [ { "name": "script.js", "label": "script.js", "fileType": "js", "outputPath": "demo-partials/whiteframe/demoDirectiveAttributeUsage/script.js" } ], "moduleName": "material.components.whiteframe", "name": "demoDirectiveAttributeUsage", "label": "Directive Attribute Usage", "index": { "name": "index.html", "label": "index.html", "fileType": "html", "outputPath": "demo-partials/whiteframe/demoDirectiveAttributeUsage/index.html" } } ], "url": "demo/whiteframe" } ]);
{ "content_hash": "e4dcc714bde0837016b37e0400a4964d", "timestamp": "", "source": "github", "line_count": 2936, "max_line_length": 100, "avg_line_length": 27.958446866485012, "alnum_prop": 0.4488585142411617, "repo_name": "angular/code.material.angularjs.org", "id": "f0db6ec8340c327baaa1b891f81926029e468330", "size": "82086", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "1.0.9/js/demo-data.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "33810102" }, { "name": "HTML", "bytes": "41451971" }, { "name": "JavaScript", "bytes": "27787154" }, { "name": "SCSS", "bytes": "461693" } ], "symlink_target": "" }
layout: api title: "v2.1.0 JavaScript Library: L.ICRS" categories: api version: v2.1.0 permalink: /api/v2.1.0/l-icrs --- <h2 id="icrs">ICRS</h2> <p>Defines coordinate reference systems for projecting geographical points into pixel (screen) coordinates and back (and to coordinates in other units for WMS services). See <a href="http://en.wikipedia.org/wiki/Coordinate_reference_system">Spatial reference system</a>.</p> <h3>Methods</h3> <table data-id='icrs'> <tr> <th>Method</th> <th>Returns</th> <th>Description</th> </tr> <tr> <td><code><b>latLngToPoint</b>( <nobr>&lt;<a href="/mapbox.js/api/v2.1.0/l-latlng">LatLng</a>&gt; <i>latlng</i></nobr>, <nobr>&lt;Number&gt; <i>zoom</i> )</nobr> </code></td> <td><code><a href="/mapbox.js/api/v2.1.0/l-point">Point</a></code></td> <td>Projects geographical coordinates on a given zoom into pixel coordinates.</td> </tr> <tr> <td><code><b>pointToLatLng</b>( <nobr>&lt;<a href="/mapbox.js/api/v2.1.0/l-point">Point</a>&gt; <i>point</i></nobr>, <nobr>&lt;Number&gt; <i>zoom</i> )</nobr> </code></td> <td><code><a href="/mapbox.js/api/v2.1.0/l-latlng">LatLng</a></code></td> <td>The inverse of <code>latLngToPoint</code>. Projects pixel coordinates on a given zoom into geographical coordinates.</td> </tr> <tr> <td><code><b>project</b>( <nobr>&lt;<a href="/mapbox.js/api/v2.1.0/l-latlng">LatLng</a>&gt; <i>latlng</i> )</nobr> </code></td> <td><code><a href="/mapbox.js/api/v2.1.0/l-point">Point</a></code></td> <td>Projects geographical coordinates into coordinates in units accepted for this CRS (e.g. meters for <code>EPSG:3857</code>, for passing it to WMS services).</td> </tr> <tr> <td><code><b>scale</b>( <nobr>&lt;Number&gt; <i>zoom</i> )</nobr> </code></td> <td><code>Number</code></td> <td>Returns the scale used when transforming projected coordinates into pixel coordinates for a particular zoom. For example, it returns <code>256 * 2^zoom</code> for Mercator-based CRS.</td> </tr> <tr> <td><code><b>getSize</b>( <nobr>&lt;Number&gt; <i>zoom</i> )</nobr> </code></td> <td><code><a href="/mapbox.js/api/v2.1.0/l-point">Point</a></code></td> <td>Returns the size of the world in pixels for a particular zoom.</td> </tr> </table> <h3>Properties</h3> <table data-id='icrs'> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> <tr> <td><code><b>projection</b></code></td> <td><code><a href="/mapbox.js/api/v2.1.0/l-iprojection">IProjection</a></code></td> <td>Projection that this CRS uses.</td> </tr> <tr> <td><code><b>transformation</b></code></td> <td><code><a href="/mapbox.js/api/v2.1.0/l-transformation">Transformation</a></code></td> <td>Transformation that this CRS uses to turn projected coordinates into screen coordinates for a particular tile service.</td> </tr> <tr> <td><code><b>code</b></code></td> <td><code>String</code></td> <td>Standard code name of the CRS passed into WMS services (e.g. <code><span class="string">'EPSG:3857'</span></code>).</td> </tr> </table> <h3>Defined CRS</h3> <p>Leaflet comes with a set of already defined CRS to use out of the box:</p> <table data-id='defined-crs'> <tr> <th>Projection</th> <th>Description</th> </tr> <tr> <td><code><b>L.CRS.EPSG3857</b></code></td> <td>The most common CRS for online maps, used by almost all free and commercial tile providers. Uses Spherical Mercator projection. Set in by default in Map's <code>crs</code> option.</td> </tr> <tr> <td><code><b>L.CRS.EPSG4326</b></code></td> <td>A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.</td> </tr> <tr> <td><code><b>L.CRS.EPSG3395</b></code></td> <td>Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.</td> </tr> <tr> <td><code><b>L.CRS.Simple</b></code></td> <td>A simple CRS that maps longitude and latitude into <code>x</code> and <code>y</code> directly. May be used for maps of flat surfaces (e.g. game maps). Note that the <code>y</code> axis should still be inverted (going from bottom to top).</td> </tr> </table> <p>If you want to use some obscure CRS not listed here, take a look at the <a href="https://github.com/kartena/Proj4Leaflet">Proj4Leaflet</a> plugin.</p>
{ "content_hash": "3b39bda06fa3f02d773b2b61173d61ae", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 274, "avg_line_length": 34.336, "alnum_prop": 0.6561043802423113, "repo_name": "thomjoy/turftest", "id": "53132c903529fd0dc7f94a0ba732c99bf08c2240", "size": "4296", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/jspm_packages/npm/mapbox.js@2.1.5/docs/_posts/api/v2.1.0/0200-01-01-l-icrs.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1843103" }, { "name": "CoffeeScript", "bytes": "13380" }, { "name": "Diff", "bytes": "46969" }, { "name": "HTML", "bytes": "9020822" }, { "name": "JavaScript", "bytes": "15655620" }, { "name": "Makefile", "bytes": "6596" }, { "name": "Python", "bytes": "745" }, { "name": "Ruby", "bytes": "5716" }, { "name": "Shell", "bytes": "7160" }, { "name": "TypeScript", "bytes": "13897" } ], "symlink_target": "" }
'use strict'; var _ = require('lodash'); var passport = require('passport'); var InstagramStrategy = require('passport-instagram').Strategy; var LocalStrategy = require('passport-local').Strategy; var FacebookStrategy = require('passport-facebook').Strategy; var TwitterStrategy = require('passport-twitter').Strategy; var GitHubStrategy = require('passport-github').Strategy; var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy; var LinkedInStrategy = require('passport-linkedin-oauth2').Strategy; var OAuthStrategy = require('passport-oauth').OAuthStrategy; // Tumblr var OAuth2Strategy = require('passport-oauth').OAuth2Strategy; // Venmo, Foursquare var User = require('../models/User'); var secrets = require('./secrets'); passport.serializeUser(function(user, done) { done(null, user.id); }); passport.deserializeUser(function(id, done) { User.findById(id, function(err, user) { done(err, user); }); }); // Sign in with Instagram. passport.use(new InstagramStrategy(secrets.instagram,function(req, accessToken, refreshToken, profile, done) { if (req.user) { User.findOne({ instagram: profile.id }, function(err, existingUser) { if (existingUser) { req.flash('errors', { msg: 'There is already an Instagram account that belongs to you. Sign in with that account or delete it, then link it with your current account.' }); done(err); } else { User.findById(req.user.id, function(err, user) { user.instagram = profile.id; user.tokens.push({ kind: 'instagram', accessToken: accessToken }); user.profile.name = user.profile.name || profile.displayName; user.profile.picture = user.profile.picture || profile._json.data.profile_picture; user.profile.website = user.profile.website || profile._json.data.website; user.save(function(err) { req.flash('info', { msg: 'Instagram account has been linked.' }); done(err, user); }); }); } }); } else { User.findOne({ instagram: profile.id }, function(err, existingUser) { if (existingUser) return done(null, existingUser); var user = new User(); user.instagram = profile.id; user.tokens.push({ kind: 'instagram', accessToken: accessToken }); user.profile.name = profile.displayName; // Similar to Twitter API, assigns a temporary e-mail address // to get on with the registration process. It can be changed later // to a valid e-mail address in Profile Management. user.email = profile.username + "@instagram.com"; user.profile.website = profile._json.data.website; user.profile.picture = profile._json.data.profile_picture; user.save(function(err) { done(err, user); }); }); } })); // Sign in using Email and Password. passport.use(new LocalStrategy({ usernameField: 'email' }, function(email, password, done) { User.findOne({ email: email }, function(err, user) { if (!user) return done(null, false, { message: 'Email ' + email + ' not found'}); user.comparePassword(password, function(err, isMatch) { if (isMatch) { return done(null, user); } else { return done(null, false, { message: 'Invalid email or password.' }); } }); }); })); /** * OAuth Strategy Overview * * - User is already logged in. * - Check if there is an existing account with a <provider> id. * - If there is, return an error message. (Account merging not supported) * - Else link new OAuth account with currently logged-in user. * - User is not logged in. * - Check if it's a returning user. * - If returning user, sign in and we are done. * - Else check if there is an existing account with user's email. * - If there is, return an error message. * - Else create a new account. */ // Sign in with Facebook. passport.use(new FacebookStrategy(secrets.facebook, function(req, accessToken, refreshToken, profile, done) { if (req.user) { User.findOne({ facebook: profile.id }, function(err, existingUser) { if (existingUser) { req.flash('errors', { msg: 'There is already a Facebook account that belongs to you. Sign in with that account or delete it, then link it with your current account.' }); done(err); } else { User.findById(req.user.id, function(err, user) { user.facebook = profile.id; user.tokens.push({ kind: 'facebook', accessToken: accessToken }); user.profile.name = user.profile.name || profile.displayName; user.profile.gender = user.profile.gender || profile._json.gender; user.profile.picture = user.profile.picture || 'https://graph.facebook.com/' + profile.id + '/picture?type=large'; user.save(function(err) { req.flash('info', { msg: 'Facebook account has been linked.' }); done(err, user); }); }); } }); } else { User.findOne({ facebook: profile.id }, function(err, existingUser) { if (existingUser) return done(null, existingUser); User.findOne({ email: profile._json.email }, function(err, existingEmailUser) { if (existingEmailUser) { req.flash('errors', { msg: 'There is already an account using this email address. Sign in to that account and link it with Facebook manually from Account Settings.' }); done(err); } else { var user = new User(); user.email = profile._json.email; user.facebook = profile.id; user.tokens.push({ kind: 'facebook', accessToken: accessToken }); user.profile.name = profile.displayName; user.profile.gender = profile._json.gender; user.profile.picture = 'https://graph.facebook.com/' + profile.id + '/picture?type=large'; user.profile.location = (profile._json.location) ? profile._json.location.name : ''; user.save(function(err) { done(err, user); }); } }); }); } })); // Sign in with GitHub. passport.use(new GitHubStrategy(secrets.github, function(req, accessToken, refreshToken, profile, done) { if (req.user) { User.findOne({ github: profile.id }, function(err, existingUser) { if (existingUser) { req.flash('errors', { msg: 'There is already a GitHub account that belongs to you. Sign in with that account or delete it, then link it with your current account.' }); done(err); } else { User.findById(req.user.id, function(err, user) { user.github = profile.id; user.tokens.push({ kind: 'github', accessToken: accessToken }); user.profile.name = user.profile.name || profile.displayName; user.profile.picture = user.profile.picture || profile._json.avatar_url; user.profile.location = user.profile.location || profile._json.location; user.profile.website = user.profile.website || profile._json.blog; user.save(function(err) { req.flash('info', { msg: 'GitHub account has been linked.' }); done(err, user); }); }); } }); } else { User.findOne({ github: profile.id }, function(err, existingUser) { if (existingUser) return done(null, existingUser); User.findOne({ email: profile._json.email }, function(err, existingEmailUser) { if (existingEmailUser) { req.flash('errors', { msg: 'There is already an account using this email address. Sign in to that account and link it with GitHub manually from Account Settings.' }); done(err); } else { var user = new User(); user.email = profile._json.email; user.github = profile.id; user.tokens.push({ kind: 'github', accessToken: accessToken }); user.profile.name = profile.displayName; user.profile.picture = profile._json.avatar_url; user.profile.location = profile._json.location; user.profile.website = profile._json.blog; user.save(function(err) { done(err, user); }); } }); }); } })); // Sign in with Twitter. passport.use(new TwitterStrategy(secrets.twitter, function(req, accessToken, tokenSecret, profile, done) { if (req.user) { User.findOne({ twitter: profile.id }, function(err, existingUser) { if (existingUser) { req.flash('errors', { msg: 'There is already a Twitter account that belongs to you. Sign in with that account or delete it, then link it with your current account.' }); done(err); } else { User.findById(req.user.id, function(err, user) { user.twitter = profile.id; user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret }); user.profile.name = user.profile.name || profile.displayName; user.profile.location = user.profile.location || profile._json.location; user.profile.picture = user.profile.picture || profile._json.profile_image_url; user.save(function(err) { req.flash('info', { msg: 'Twitter account has been linked.' }); done(err, user); }); }); } }); } else { User.findOne({ twitter: profile.id }, function(err, existingUser) { if (existingUser) return done(null, existingUser); var user = new User(); // Twitter will not provide an email address. Period. // But a person’s twitter username is guaranteed to be unique // so we can "fake" a twitter email address as follows: user.email = profile.username + "@twitter.com"; user.twitter = profile.id; user.tokens.push({ kind: 'twitter', accessToken: accessToken, tokenSecret: tokenSecret }); user.profile.name = profile.displayName; user.profile.location = profile._json.location; user.profile.picture = profile._json.profile_image_url; user.save(function(err) { done(err, user); }); }); } })); // Sign in with Google. passport.use(new GoogleStrategy(secrets.google, function(req, accessToken, refreshToken, profile, done) { if (req.user) { User.findOne({ google: profile.id }, function(err, existingUser) { if (existingUser) { req.flash('errors', { msg: 'There is already a Google account that belongs to you. Sign in with that account or delete it, then link it with your current account.' }); done(err); } else { User.findById(req.user.id, function(err, user) { user.google = profile.id; user.tokens.push({ kind: 'google', accessToken: accessToken }); user.profile.name = user.profile.name || profile.displayName; user.profile.gender = user.profile.gender || profile._json.gender; user.profile.picture = user.profile.picture || profile._json.picture; user.save(function(err) { req.flash('info', { msg: 'Google account has been linked.' }); done(err, user); }); }); } }); } else { User.findOne({ google: profile.id }, function(err, existingUser) { if (existingUser) return done(null, existingUser); User.findOne({ email: profile._json.email }, function(err, existingEmailUser) { if (existingEmailUser) { req.flash('errors', { msg: 'There is already an account using this email address. Sign in to that account and link it with Google manually from Account Settings.' }); done(err); } else { var user = new User(); user.email = profile._json.email; user.google = profile.id; user.tokens.push({ kind: 'google', accessToken: accessToken }); user.profile.name = profile.displayName; user.profile.gender = profile._json.gender; user.profile.picture = profile._json.picture; user.save(function(err) { done(err, user); }); } }); }); } })); // Sign in with LinkedIn. passport.use(new LinkedInStrategy(secrets.linkedin, function(req, accessToken, refreshToken, profile, done) { if (req.user) { User.findOne({ linkedin: profile.id }, function(err, existingUser) { if (existingUser) { req.flash('errors', { msg: 'There is already a LinkedIn account that belongs to you. Sign in with that account or delete it, then link it with your current account.' }); done(err); } else { User.findById(req.user.id, function(err, user) { user.linkedin = profile.id; user.tokens.push({ kind: 'linkedin', accessToken: accessToken }); user.profile.name = user.profile.name || profile.displayName; user.profile.location = user.profile.location || profile._json.location.name; user.profile.picture = user.profile.picture || profile._json.pictureUrl; user.profile.website = user.profile.website || profile._json.publicProfileUrl; user.save(function(err) { req.flash('info', { msg: 'LinkedIn account has been linked.' }); done(err, user); }); }); } }); } else { User.findOne({ linkedin: profile.id }, function(err, existingUser) { if (existingUser) return done(null, existingUser); User.findOne({ email: profile._json.emailAddress }, function(err, existingEmailUser) { if (existingEmailUser) { req.flash('errors', { msg: 'There is already an account using this email address. Sign in to that account and link it with LinkedIn manually from Account Settings.' }); done(err); } else { var user = new User(); user.linkedin = profile.id; user.tokens.push({ kind: 'linkedin', accessToken: accessToken }); user.email = profile._json.emailAddress; user.profile.name = profile.displayName; user.profile.location = profile._json.location.name; user.profile.picture = profile._json.pictureUrl; user.profile.website = profile._json.publicProfileUrl; user.save(function(err) { done(err, user); }); } }); }); } })); // Tumblr API setup. passport.use('tumblr', new OAuthStrategy({ requestTokenURL: 'http://www.tumblr.com/oauth/request_token', accessTokenURL: 'http://www.tumblr.com/oauth/access_token', userAuthorizationURL: 'http://www.tumblr.com/oauth/authorize', consumerKey: secrets.tumblr.consumerKey, consumerSecret: secrets.tumblr.consumerSecret, callbackURL: secrets.tumblr.callbackURL, passReqToCallback: true }, function(req, token, tokenSecret, profile, done) { User.findById(req.user._id, function(err, user) { user.tokens.push({ kind: 'tumblr', accessToken: token, tokenSecret: tokenSecret }); user.save(function(err) { done(err, user); }); }); } )); // Foursquare API setup. passport.use('foursquare', new OAuth2Strategy({ authorizationURL: 'https://foursquare.com/oauth2/authorize', tokenURL: 'https://foursquare.com/oauth2/access_token', clientID: secrets.foursquare.clientId, clientSecret: secrets.foursquare.clientSecret, callbackURL: secrets.foursquare.redirectUrl, passReqToCallback: true }, function(req, accessToken, refreshToken, profile, done) { User.findById(req.user._id, function(err, user) { user.tokens.push({ kind: 'foursquare', accessToken: accessToken }); user.save(function(err) { done(err, user); }); }); } )); // Venmo API setup. passport.use('venmo', new OAuth2Strategy({ authorizationURL: 'https://api.venmo.com/v1/oauth/authorize', tokenURL: 'https://api.venmo.com/v1/oauth/access_token', clientID: secrets.venmo.clientId, clientSecret: secrets.venmo.clientSecret, callbackURL: secrets.venmo.redirectUrl, passReqToCallback: true }, function(req, accessToken, refreshToken, profile, done) { User.findById(req.user._id, function(err, user) { user.tokens.push({ kind: 'venmo', accessToken: accessToken }); user.save(function(err) { done(err, user); }); }); } )); // Login Required middleware. exports.isAuthenticated = function(req, res, next) { if (req.isAuthenticated()) return next(); res.redirect('/login'); }; // Authorization Required middleware. exports.isAuthorized = function(req, res, next) { var provider = req.path.split('/').slice(-1)[0]; if (_.find(req.user.tokens, { kind: provider })) { next(); } else { res.redirect('/auth/' + provider); } };
{ "content_hash": "3e0680378bf2b5cb2048f98e43e625b9", "timestamp": "", "source": "github", "line_count": 410, "max_line_length": 179, "avg_line_length": 40.53658536585366, "alnum_prop": 0.6304452466907341, "repo_name": "ivanmayes/guild-maker", "id": "1fb10b64a13cac6ecbbbc30f08b331bce99a9e71", "size": "16622", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "web/app/config/passport.js", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "249739" }, { "name": "JavaScript", "bytes": "826888" }, { "name": "PHP", "bytes": "20" }, { "name": "Ruby", "bytes": "2205" } ], "symlink_target": "" }
package com.google.api.ads.adwords.jaxws.v201402.express; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.2.4-b01 * Generated source version: 2.1 * */ @WebServiceClient(name = "PromotionService", targetNamespace = "https://adwords.google.com/api/adwords/express/v201402", wsdlLocation = "https://adwords.google.com/api/adwords/express/v201402/PromotionService?wsdl") public class PromotionService extends Service { private final static URL PROMOTIONSERVICE_WSDL_LOCATION; private final static WebServiceException PROMOTIONSERVICE_EXCEPTION; private final static QName PROMOTIONSERVICE_QNAME = new QName("https://adwords.google.com/api/adwords/express/v201402", "PromotionService"); static { URL url = null; WebServiceException e = null; try { url = new URL("https://adwords.google.com/api/adwords/express/v201402/PromotionService?wsdl"); } catch (MalformedURLException ex) { e = new WebServiceException(ex); } PROMOTIONSERVICE_WSDL_LOCATION = url; PROMOTIONSERVICE_EXCEPTION = e; } public PromotionService() { super(__getWsdlLocation(), PROMOTIONSERVICE_QNAME); } public PromotionService(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } /** * * @return * returns PromotionServiceInterface */ @WebEndpoint(name = "PromotionServiceInterfacePort") public PromotionServiceInterface getPromotionServiceInterfacePort() { return super.getPort(new QName("https://adwords.google.com/api/adwords/express/v201402", "PromotionServiceInterfacePort"), PromotionServiceInterface.class); } /** * * @param features * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. * @return * returns PromotionServiceInterface */ @WebEndpoint(name = "PromotionServiceInterfacePort") public PromotionServiceInterface getPromotionServiceInterfacePort(WebServiceFeature... features) { return super.getPort(new QName("https://adwords.google.com/api/adwords/express/v201402", "PromotionServiceInterfacePort"), PromotionServiceInterface.class, features); } private static URL __getWsdlLocation() { if (PROMOTIONSERVICE_EXCEPTION!= null) { throw PROMOTIONSERVICE_EXCEPTION; } return PROMOTIONSERVICE_WSDL_LOCATION; } }
{ "content_hash": "6600e198109767b35280afe05bf4ecb9", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 215, "avg_line_length": 36.243589743589745, "alnum_prop": 0.7117085249380969, "repo_name": "nafae/developer", "id": "7478e6577622cd08aadb7066a8d9f3d4dec549d3", "size": "2827", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201402/express/PromotionService.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "127846798" }, { "name": "Perl", "bytes": "28418" } ], "symlink_target": "" }
Rails.application.routes.default_url_options[:host] = ENV['HOST'] || 'localhost'
{ "content_hash": "725bd50d78f195f7d46c4aa6ac02d73b", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 80, "avg_line_length": 81, "alnum_prop": 0.7283950617283951, "repo_name": "mxabierto/adela", "id": "09c31265b0eef674fceee303c72b66ed8c825821", "size": "81", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "config/initializers/default_url.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "12858" }, { "name": "CoffeeScript", "bytes": "1354" }, { "name": "Dockerfile", "bytes": "1080" }, { "name": "HTML", "bytes": "133829" }, { "name": "JavaScript", "bytes": "13871" }, { "name": "Ruby", "bytes": "234406" }, { "name": "Shell", "bytes": "1713" } ], "symlink_target": "" }
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title>statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_gamma &#8212; statsmodels v0.10.2 documentation</title> <link rel="stylesheet" href="../_static/nature.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" /> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/language_data.js"></script> <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> <link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="stylesheet" href="../_static/examples.css" type="text/css" /> <link rel="stylesheet" href="../_static/facebox.css" type="text/css" /> <script type="text/javascript" src="../_static/scripts.js"> </script> <script type="text/javascript" src="../_static/facebox.js"> </script> <script type="text/javascript"> $.facebox.settings.closeImage = "../_static/closelabel.png" $.facebox.settings.loadingImage = "../_static/loading.gif" </script> <script> $(document).ready(function() { $.getJSON("../../versions.json", function(versions) { var dropdown = document.createElement("div"); dropdown.className = "dropdown"; var button = document.createElement("button"); button.className = "dropbtn"; button.innerHTML = "Other Versions"; var content = document.createElement("div"); content.className = "dropdown-content"; dropdown.appendChild(button); dropdown.appendChild(content); $(".header").prepend(dropdown); for (var i = 0; i < versions.length; i++) { if (versions[i].substring(0, 1) == "v") { versions[i] = [versions[i], versions[i].substring(1)]; } else { versions[i] = [versions[i], versions[i]]; }; }; for (var i = 0; i < versions.length; i++) { var a = document.createElement("a"); a.innerHTML = versions[i][1]; a.href = "../../" + versions[i][0] + "/index.html"; a.title = versions[i][1]; $(".dropdown-content").append(a); }; }); }); </script> </head><body> <div class="headerwrap"> <div class = "header"> <a href = "../index.html"> <img src="../_static/statsmodels_hybi_banner.png" alt="Logo" style="padding-left: 15px"/></a> </div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li><a href ="../install.html">Install</a></li> &nbsp;|&nbsp; <li><a href="https://groups.google.com/forum/?hl=en#!forum/pystatsmodels">Support</a></li> &nbsp;|&nbsp; <li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> &nbsp;|&nbsp; <li><a href="../dev/index.html">Develop</a></li> &nbsp;|&nbsp; <li><a href="../examples/index.html">Examples</a></li> &nbsp;|&nbsp; <li><a href="../faq.html">FAQ</a></li> &nbsp;|&nbsp; </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="statsmodels-tsa-vector-ar-vecm-vecmresults-stderr-gamma"> <h1>statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_gamma<a class="headerlink" href="#statsmodels-tsa-vector-ar-vecm-vecmresults-stderr-gamma" title="Permalink to this headline">¶</a></h1> <p>method</p> <dl class="method"> <dt id="statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_gamma"> <code class="sig-prename descclassname">VECMResults.</code><code class="sig-name descname">stderr_gamma</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/statsmodels/tsa/vector_ar/vecm.html#VECMResults.stderr_gamma"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_gamma" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/generated/statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_gamma.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" /> <input type="submit" value="Go" /> </form> </div> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="footer" role="contentinfo"> &#169; Copyright 2009-2018, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.1. </div> </body> </html>
{ "content_hash": "40e5f1ababe0bfc046f59c848a137fbd", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 464, "avg_line_length": 41.48299319727891, "alnum_prop": 0.6308625778943916, "repo_name": "statsmodels/statsmodels.github.io", "id": "80ac4a235f49cc1f7ddd51d146022ac36d4d60bd", "size": "6102", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "v0.10.2/generated/statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_gamma.html", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
package org.apache.flex.swf.tags; import org.apache.flex.swf.TagType; /** * A RawTag is a wrapper for the raw bytes of an unimplemented SWF tag. * <p> * It is not an actual SWF tag. */ public final class RawTag extends Tag { /** * Constructor. * * @param tagType tag type */ public RawTag(TagType tagType) { super(tagType); } private byte[] tagBody; /** * Get tag body raw bytes. * * @return tag body raw bytes */ public byte[] getTagBody() { return tagBody; } /** * Set tag body raw bytes. * * @param tagBody raw bytes */ public void setTagBody(byte[] tagBody) { this.tagBody = tagBody; } @Override public String toString() { return String.format("#RAW TAG# type=%s, size=%d", this.getTagType(), tagBody.length); } }
{ "content_hash": "fa889b9f5e1e9e41733be66f468d08cf", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 71, "avg_line_length": 17.471698113207548, "alnum_prop": 0.5377969762419006, "repo_name": "greg-dove/flex-falcon", "id": "7b80f896f0a0a76acd0ea840081b1b5589684e64", "size": "1745", "binary": false, "copies": "2", "ref": "refs/heads/develop", "path": "compiler/src/main/java/org/apache/flex/swf/tags/RawTag.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "106801" }, { "name": "Batchfile", "bytes": "12393" }, { "name": "GAP", "bytes": "131951" }, { "name": "HTML", "bytes": "103352" }, { "name": "Java", "bytes": "15702614" }, { "name": "JavaScript", "bytes": "157084" }, { "name": "Lex", "bytes": "37784" }, { "name": "Shell", "bytes": "19121" } ], "symlink_target": "" }
FN="BSgenome.Hsapiens.UCSC.hg38.masked_1.3.993.tar.gz" URLS=( "https://bioconductor.org/packages/3.12/data/annotation/src/contrib/BSgenome.Hsapiens.UCSC.hg38.masked_1.3.993.tar.gz" "https://bioarchive.galaxyproject.org/BSgenome.Hsapiens.UCSC.hg38.masked_1.3.993.tar.gz" "https://depot.galaxyproject.org/software/bioconductor-bsgenome.hsapiens.ucsc.hg38.masked/bioconductor-bsgenome.hsapiens.ucsc.hg38.masked_1.3.993_src_all.tar.gz" ) MD5="127d48c58c0b12683435f0ea1767f24f" # Use a staging area in the conda dir rather than temp dirs, both to avoid # permission issues as well as to have things downloaded in a predictable # manner. STAGING=$PREFIX/share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM mkdir -p $STAGING TARBALL=$STAGING/$FN SUCCESS=0 for URL in ${URLS[@]}; do curl $URL > $TARBALL [[ $? == 0 ]] || continue # Platform-specific md5sum checks. if [[ $(uname -s) == "Linux" ]]; then if md5sum -c <<<"$MD5 $TARBALL"; then SUCCESS=1 break fi else if [[ $(uname -s) == "Darwin" ]]; then if [[ $(md5 $TARBALL | cut -f4 -d " ") == "$MD5" ]]; then SUCCESS=1 break fi fi fi done if [[ $SUCCESS != 1 ]]; then echo "ERROR: post-link.sh was unable to download any of the following URLs with the md5sum $MD5:" printf '%s\n' "${URLS[@]}" exit 1 fi # Install and clean up R CMD INSTALL --library=$PREFIX/lib/R/library $TARBALL rm $TARBALL rmdir $STAGING
{ "content_hash": "5fea5821a994accefc2719a321d27b5a", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 163, "avg_line_length": 31.42222222222222, "alnum_prop": 0.6824611032531824, "repo_name": "ostrokach/bioconda-recipes", "id": "ec29256a505022c846eae4c93de4ca01a52631df", "size": "1426", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "recipes/bioconductor-bsgenome.hsapiens.ucsc.hg38.masked/post-link.sh", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1805" }, { "name": "C", "bytes": "102655" }, { "name": "C++", "bytes": "486" }, { "name": "Fortran", "bytes": "1040" }, { "name": "Perl", "bytes": "88310" }, { "name": "Perl6", "bytes": "16" }, { "name": "Python", "bytes": "124959" }, { "name": "Shell", "bytes": "765144" } ], "symlink_target": "" }
package com.tam.cobol_interpreter.context import com.tam.cobol_interpreter.tools.ByteArrayTool import scala.collection.mutable /** * Created by tamu on 1/2/15. */ class DataContext extends mutable.HashMap[String, Array[Array[Byte]]]{ def getData(key:String): Array[Array[Byte]] = this.getOrElse(key, ContextTool.defaultData()) def add(key: String, value: String): Unit = this.add(key, ByteArrayTool.stringToByteArray(value)) def add(key: String, value: Array[Byte]): Unit = { // Append the value to the array at the passed key val oldArray = this.getOrElse(key, new Array[Array[Byte]](0)) val newArray = new Array[Array[Byte]](oldArray.length + 1) for(i <- 0 until oldArray.length) newArray(i) = oldArray(i) newArray(newArray.length - 1) = value this(key) = newArray } }
{ "content_hash": "e9fa0a43198832350c9b0b6152d2c07c", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 99, "avg_line_length": 35.43478260869565, "alnum_prop": 0.7067484662576687, "repo_name": "tamsanh/scala-cobol-interpreter", "id": "c3f2cdf19ffb08b0ed7bd711951ccd5463617794", "size": "815", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/scala/com/tam/cobol_interpreter/context/DataContext.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "COBOL", "bytes": "81" }, { "name": "Scala", "bytes": "110405" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using LanguageExt; using static LanguageExt.Prelude; using System.Diagnostics.Contracts; using LanguageExt.TypeClasses; namespace LanguageExt { /// <summary> /// Functional module for working with the Stck T type /// </summary> public static class Stack { /// <summary> /// Reverses the order of the items in the stack /// </summary> /// <returns></returns> [Pure] public static Stck<T> rev<T>(Stck<T> stack) => stack.Reverse(); /// <summary> /// True if the stack is empty /// </summary> [Pure] public static bool isEmpty<T>(Stck<T> stack) => stack.IsEmpty; /// <summary> /// Clear the stack (returns Empty) /// </summary> /// <returns>Stck.Empty of T</returns> [Pure] public static Stck<T> clear<T>(Stck<T> stack) => stack.Clear(); /// <summary> /// Return the item on the top of the stack without affecting the stack itself /// NOTE: Will throw an InvalidOperationException if the stack is empty /// </summary> /// <exception cref="InvalidOperationException">Stack is empty</exception> /// <returns>Top item value</returns> [Pure] public static T peek<T>(Stck<T> stack) => stack.Peek(); /// <summary> /// Peek and match /// </summary> /// <param name="Some">Handler if there is a value on the top of the stack</param> /// <param name="None">Handler if the stack is empty</param> /// <returns>Untouched stack</returns> [Pure] public static Stck<T> peek<T>(Stck<T> stack, Action<T> Some, Action None) => stack.Peek(Some, None); /// <summary> /// Peek and match /// </summary> /// <typeparam name="R">Return type</typeparam> /// <param name="Some">Handler if there is a value on the top of the stack</param> /// <param name="None">Handler if the stack is empty</param> /// <returns>Return value from Some or None</returns> [Pure] public static R peek<T, R>(Stck<T> stack, Func<T, R> Some, Func<R> None) => stack.Peek(Some, None); /// <summary> /// Safely return the item on the top of the stack without affecting the stack itself /// </summary> /// <returns>Returns the top item value, or None</returns> [Pure] public static Option<T> trypeek<T>(Stck<T> stack) => stack.TryPeek(); /// <summary> /// Pop an item off the top of the stack /// NOTE: Will throw an InvalidOperationException if the stack is empty /// </summary> /// <exception cref="InvalidOperationException">Stack is empty</exception> /// <returns>Stack with the top item popped</returns> [Pure] public static Stck<T> pop<T>(Stck<T> stack) => stack.Pop(); /// <summary> /// Safe pop /// </summary> /// <returns>Tuple of popped stack and optional top-of-stack value</returns> [Pure] public static (Stck<T>, Option<T>) trypop<T>(Stck<T> stack) => stack.TryPop(); /// <summary> /// Pop and match /// </summary> /// <param name="Some">Handler if there is a value on the top of the stack</param> /// <param name="None">Handler if the stack is empty</param> /// <returns>Popped stack</returns> [Pure] public static Stck<T> pop<T>(Stck<T> stack, Action<T> Some, Action None) => stack.Pop(Some, None); /// <summary> /// Pop and match /// </summary> /// <typeparam name="R">Return type</typeparam> /// <param name="Some">Handler if there is a value on the top of the stack</param> /// <param name="None">Handler if the stack is empty</param> /// <returns>Return value from Some or None</returns> [Pure] public static R pop<T, R>(Stck<T> stack, Func<Stck<T>, T, R> Some, Func<R> None) => stack.Pop(Some, None); /// <summary> /// Push an item onto the stack /// </summary> /// <param name="value">Item to push</param> /// <returns>New stack with the pushed item on top</returns> [Pure] public static Stck<T> push<T>(Stck<T> stack, T value) => stack.Push(value); /// <summary> /// Projects the values in the stack using a map function into a new enumerable (Select in LINQ). /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <typeparam name="R">Return enumerable item type</typeparam> /// <param name="stack">Stack to map</param> /// <param name="map">Map function</param> /// <returns>Mapped enumerable</returns> [Pure] public static Stck<R> map<T, R>(Stck<T> stack, Func<T, R> map) => toStackRev(List.map(stack, map)); /// <summary> /// Projects the values in the stack into a new enumerable using a map function, which is also given an index value /// (Select in LINQ - note that the order of the arguments of the map function are the other way around, here the index /// is the first argument). /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <typeparam name="R">Return enumerable item type</typeparam> /// <param name="stack">Stack to map</param> /// <param name="map">Map function</param> /// <returns>Mapped enumerable</returns> [Pure] public static Stck<R> map<T, R>(Stck<T> stack, Func<int, T, R> map) => toStackRev(List.map(stack, map)); /// <summary> /// Removes items from the stack that do not match the given predicate (Where in LINQ) /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to filter</param> /// <param name="predicate">Predicate function</param> /// <returns>Filtered stack</returns> [Pure] public static Stck<T> filter<T>(Stck<T> stack, Func<T, bool> predicate) => toStackRev(List.filter(stack, predicate)); /// <summary> /// Applies the given function 'selector' to each element of the stack. Returns an enumerable comprised of /// the results for each element where the function returns Some(f(x)). /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="selector">Selector function</param> /// <returns>Mapped and filtered enumerable</returns> [Pure] public static Stck<U> choose<T, U>(Stck<T> stack, Func<T, Option<U>> selector) => toStackRev(List.choose(stack, selector)); /// <summary> /// Applies the given function 'selector' to each element of the stack. Returns an enumerable comprised of /// the results for each element where the function returns Some(f(x)). /// An index value is passed through to the selector function also. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="selector">Selector function</param> /// <returns>Mapped and filtered enumerable</returns> [Pure] public static Stck<U> choose<T, U>(Stck<T> stack, Func<int, T, Option<U>> selector) => toStackRev(List.choose(stack, selector)); /// <summary> /// For each element of the stack, applies the given function. Concatenates all the results and /// returns the combined list. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <typeparam name="R">Return enumerable item type</typeparam> /// <param name="stack">Stack to map</param> /// <param name="map">Map function</param> /// <returns>Mapped enumerable</returns> [Pure] public static Stck<R> collect<T, R>(Stck<T> stack, Func<T, IEnumerable<R>> map) => toStackRev(List.collect(stack, map)); /// <summary> /// Append another stack to the top of this stack /// The rhs will be reversed and pushed onto 'this' stack. That will /// maintain the order of the items in the resulting stack. So the top /// of 'rhs' will be the top of the newly created stack. 'this' stack /// will be under the 'rhs' stack. /// </summary> /// <param name="rhs">Stack to append</param> /// <returns>Appended stacks</returns> [Pure] public static Stck<T> append<T>(Stck<T> lhs, IEnumerable<T> rhs) => toStackRev(List.append(lhs, rhs)); /// <summary> /// Applies a function 'folder' to each element of the collection, threading an accumulator /// argument through the computation. The fold function takes the state argument, and /// applies the function 'folder' to it and the first element of the stack. Then, it feeds this /// result into the function 'folder' along with the second element, and so on. It returns the /// final result. (Aggregate in LINQ) /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <returns>Aggregate value</returns> [Pure] public static S fold<S, T>(Stck<T> stack, S state, Func<S, T, S> folder) => List.fold(stack, state, folder); /// <summary> /// Applies a function 'folder' to each element of the collection (from last element to first), /// threading an aggregate state through the computation. The fold function takes the state /// argument, and applies the function 'folder' to it and the first element of the stack. Then, /// it feeds this result into the function 'folder' along with the second element, and so on. It /// returns the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <returns>Aggregate value</returns> [Pure] public static S foldBack<S, T>(Stck<T> stack, S state, Func<S, T, S> folder) => List.foldBack(stack, state, folder); /// <summary> /// Applies a function 'folder' to each element of the collection whilst the predicate function /// returns true for the item being processed, threading an aggregate state through the /// computation. The fold function takes the state argument, and applies the function 'folder' /// to it and the first element of the stack. Then, it feeds this result into the function 'folder' /// along with the second element, and so on. It returns the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <param name="preditem">Predicate function</param> /// <returns>Aggregate value</returns> [Pure] public static S foldWhile<S, T>(Stck<T> stack, S state, Func<S, T, S> folder, Func<T, bool> preditem) => List.foldWhile(stack, state, folder, preditem: preditem); /// <summary> /// Applies a function 'folder' to each element of the collection, threading an accumulator /// argument through the computation (and whilst the predicate function returns true when passed /// the aggregate state). The fold function takes the state argument, and applies the function /// 'folder' to it and the first element of the stack. Then, it feeds this result into the /// function 'folder' along with the second element, and so on. It returns the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <param name="predstate">Predicate function</param> /// <returns>Aggregate value</returns> [Pure] public static S foldWhile<S, T>(Stck<T> stack, S state, Func<S, T, S> folder, Func<S, bool> predstate) => List.foldWhile(stack, state, folder, predstate: predstate); /// <summary> /// Applies a function 'folder' to each element of the collection (from last element to first) /// whilst the predicate function returns true for the item being processed, threading an /// aggregate state through the computation. The fold function takes the state argument, and /// applies the function 'folder' to it and the first element of the stack. Then, it feeds this /// result into the function 'folder' along with the second element, and so on. It returns the /// final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <param name="preditem">Predicate function</param> /// <returns>Aggregate value</returns> [Pure] public static S foldBackWhile<S, T>(Stck<T> stack, S state, Func<S, T, S> folder, Func<T, bool> preditem) => List.foldBackWhile(stack, state, folder, preditem: preditem); /// <summary> /// Applies a function 'folder' to each element of the collection (from last element to first), /// threading an accumulator argument through the computation (and whilst the predicate function /// returns true when passed the aggregate state). The fold function takes the state argument, /// and applies the function 'folder' to it and the first element of the stack. Then, it feeds /// this result into the function 'folder' along with the second element, and so on. It returns /// the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <param name="predstate">Predicate function</param> /// <returns>Aggregate value</returns> [Pure] public static S foldBackWhile<S, T>(Stck<T> stack, S state, Func<S, T, S> folder, Func<S, bool> predstate) => List.foldBackWhile(stack, state, folder, predstate: predstate); /// <summary> /// Applies a function to each element of the collection (from last element to first), threading /// an accumulator argument through the computation. This function first applies the function /// to the first two elements of the stack. Then, it passes this result into the function along /// with the third element and so on. Finally, it returns the final result. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="reducer">Reduce function</param> /// <returns>Aggregate value</returns> [Pure] public static T reduce<T>(Stck<T> stack, Func<T, T, T> reducer) => List.reduce(stack, reducer); /// <summary> /// Applies a function to each element of the collection, threading an accumulator argument /// through the computation. This function first applies the function to the first two /// elements of the stack. Then, it passes this result into the function along with the third /// element and so on. Finally, it returns the final result. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="reducer">Reduce function</param> /// <returns>Aggregate value</returns> [Pure] public static T reduceBack<T>(Stck<T> stack, Func<T, T, T> reducer) => List.reduceBack(stack, reducer); /// <summary> /// Applies a function to each element of the collection, threading an accumulator argument /// through the computation. This function takes the state argument, and applies the function /// to it and the first element of the stack. Then, it passes this result into the function /// along with the second element, and so on. Finally, it returns the list of intermediate /// results and the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="state">Initial state</param> /// <param name="folder">Folding function</param> /// <returns>Aggregate state</returns> [Pure] public static Stck<S> scan<S, T>(Stck<T> stack, S state, Func<S, T, S> folder) => toStackRev(List.scan(stack, state, folder)); /// <summary> /// Applies a function to each element of the collection (from last element to first), /// threading an accumulator argument through the computation. This function takes the state /// argument, and applies the function to it and the first element of the stack. Then, it /// passes this result into the function along with the second element, and so on. Finally, /// it returns the list of intermediate results and the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="state">Initial state</param> /// <param name="folder">Folding function</param> /// <returns>Aggregate state</returns> [Pure] public static Stck<S> scanBack<S, T>(Stck<T> stack, S state, Func<S, T, S> folder) => toStackRev(List.scanBack(stack, state, folder)); /// <summary> /// Returns Some(x) for the first item in the stack that matches the predicate /// provided, None otherwise. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="pred">Predicate</param> /// <returns>Some(x) for the first item in the stack that matches the predicate /// provided, None otherwise.</returns> [Pure] public static Option<T> find<T>(Stck<T> stack, Func<T, bool> pred) => List.find(stack, pred); /// <summary> /// Joins a stack and and enumerable together either into a single enumerable /// using the join function provided /// </summary> /// <param name="stack">First stack to join</param> /// <param name="other">Second list to join</param> /// <param name="zipper">Join function</param> /// <returns>Joined enumerable</returns> [Pure] public static Stck<V> zip<T, U, V>(Stck<T> stack, IEnumerable<U> other, Func<T, U, V> zipper) => toStackRev(List.zip(stack, other, zipper)); /// <summary> /// Returns the number of items in the stack /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <returns>The number of items in the enumerable</returns> [Pure] public static int length<T>(Stck<T> stack) => List.length(stack); /// <summary> /// Invokes an action for each item in the stack in order /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to iterate</param> /// <param name="action">Action to invoke with each item</param> /// <returns>Unit</returns> public static Unit iter<T>(Stck<T> stack, Action<T> action) => List.iter(stack, action); /// <summary> /// Invokes an action for each item in the stack in order and supplies /// a running index value. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to iterate</param> /// <param name="action">Action to invoke with each item</param> /// <returns>Unit</returns> public static Unit iter<T>(Stck<T> stack, Action<int, T> action) => List.iter(stack, action); /// <summary> /// Returns true if all items in the stack match a predicate (Any in LINQ) /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to test</param> /// <param name="pred">Predicate</param> /// <returns>True if all items in the stack match the predicate</returns> [Pure] public static bool forall<T>(Stck<T> stack, Func<T, bool> pred) => List.forall(stack, pred); /// <summary> /// Return an enumerable with all duplicate values removed /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <returns>An enumerable with all duplicate values removed</returns> [Pure] public static Stck<T> distinct<T>(Stck<T> stack) => toStackRev(List.distinct(stack)); /// <summary> /// Return an enumerable with all duplicate values removed /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <returns>An enumerable with all duplicate values removed</returns> [Pure] public static Stck<T> distinct<EQ, T>(Stck<T> stack) where EQ : struct, Eq<T> => toStackRev(List.distinct<EQ,T>(stack)); /// <summary> /// Return an enumerable with all duplicate values removed /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <returns>An enumerable with all duplicate values removed</returns> [Pure] public static Stck<T> distinct<T, K>(Stck<T> stack, Func<T, K> keySelector, Option<Func<K, K, bool>> compare = default(Option<Func<K, K, bool>>)) => toStackRev(List.distinct(stack, keySelector, compare)); /// <summary> /// Returns a new enumerable with the first 'count' items from the stack /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="count">Number of items to take</param> /// <returns>A new enumerable with the first 'count' items from the enumerable provided</returns> [Pure] public static Stck<T> take<T>(Stck<T> stack, int count) => toStackRev(List.take(stack, count)); /// <summary> /// Iterate the stack, yielding items if they match the predicate provided, and stopping /// as soon as one doesn't /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="count">Number of items to take</param> /// <returns>A new enumerable with the first items that match the predicate</returns> [Pure] public static Stck<T> takeWhile<T>(Stck<T> stack, Func<T, bool> pred) => toStackRev(List.takeWhile(stack, pred)); /// <summary> /// Iterate the stack, yielding items if they match the predicate provided, and stopping /// as soon as one doesn't An index value is also provided to the predicate function. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="count">Number of items to take</param> /// <returns>A new enumerable with the first items that match the predicate</returns> [Pure] public static Stck<T> takeWhile<T>(Stck<T> stack, Func<T, int, bool> pred) => toStackRev(List.takeWhile(stack, pred)); /// <summary> /// Returns true if any item in the stack matches the predicate provided /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="pred">Predicate</param> /// <returns>True if any item in the stack matches the predicate provided</returns> [Pure] public static bool exists<T>(Stck<T> stack, Func<T, bool> pred) => List.exists(stack, pred); } } public static class StackExtensions { /// <summary> /// Projects the values in the stack using a map function into a new enumerable (Select in LINQ). /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <typeparam name="R">Return enumerable item type</typeparam> /// <param name="stack">Stack to map</param> /// <param name="map">Map function</param> /// <returns>Mapped enumerable</returns> [Pure] public static Stck<R> Map<T, R>(this Stck<T> stack, Func<T, R> map) => toStackRev(LanguageExt.List.map(stack, map)); /// <summary> /// Projects the values in the stack into a new stack using a map function, which is also given an index value /// (Select in LINQ - note that the order of the arguments of the map function are the other way around, here the index /// is the first argument). /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <typeparam name="R">Return enumerable item type</typeparam> /// <param name="stack">Stack to map</param> /// <param name="map">Map function</param> /// <returns>Mapped enumerable</returns> [Pure] public static Stck<R> Map<T, R>(this Stck<T> stack, Func<int, T, R> map) => toStackRev(LanguageExt.List.map(stack, map)); /// <summary> /// Removes items from the stack that do not match the given predicate (Where in LINQ) /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to filter</param> /// <param name="predicate">Predicate function</param> /// <returns>Filtered stack</returns> [Pure] public static Stck<T> Filter<T>(this Stck<T> stack, Func<T, bool> predicate) => toStackRev(LanguageExt.List.filter(stack, predicate)); /// <summary> /// Applies the given function 'selector' to each element of the stack. Returns an enumerable comprised of /// the results for each element where the function returns Some(f(x)). /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="selector">Selector function</param> /// <returns>Mapped and filtered enumerable</returns> [Pure] public static Stck<U> Choose<T, U>(this Stck<T> stack, Func<T, Option<U>> selector) => toStackRev(LanguageExt.List.choose(stack, selector)); /// <summary> /// Applies the given function 'selector' to each element of the stack. Returns an enumerable comprised of /// the results for each element where the function returns Some(f(x)). /// An index value is passed through to the selector function also. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="selector">Selector function</param> /// <returns>Mapped and filtered enumerable</returns> [Pure] public static Stck<U> Choose<T, U>(this Stck<T> stack, Func<int, T, Option<U>> selector) => toStackRev(LanguageExt.List.choose(stack, selector)); /// <summary> /// For each element of the stack, applies the given function. Concatenates all the results and /// returns the combined list. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <typeparam name="R">Return enumerable item type</typeparam> /// <param name="stack">Stack to map</param> /// <param name="map">Map function</param> /// <returns>Mapped enumerable</returns> [Pure] public static Stck<R> Collect<T, R>(this Stck<T> stack, Func<T, IEnumerable<R>> map) => toStackRev(LanguageExt.List.collect(stack, map)); /// <summary> /// Reverses the order of the items in the stack /// </summary> /// <returns></returns> [Pure] public static Stck<T> Rev<T>(this Stck<T> stack) => toStackRev(LanguageExt.List.rev(stack)); /// <summary> /// Applies a function 'folder' to each element of the collection, threading an accumulator /// argument through the computation. The fold function takes the state argument, and /// applies the function 'folder' to it and the first element of the stack. Then, it feeds this /// result into the function 'folder' along with the second element, and so on. It returns the /// final result. (Aggregate in LINQ) /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <returns>Aggregate value</returns> [Pure] public static S Fold<S, T>(this Stck<T> stack, S state, Func<S, T, S> folder) => LanguageExt.List.fold(stack, state, folder); /// <summary> /// Applies a function 'folder' to each element of the collection (from last element to first), /// threading an aggregate state through the computation. The fold function takes the state /// argument, and applies the function 'folder' to it and the first element of the stack. Then, /// it feeds this result into the function 'folder' along with the second element, and so on. It /// returns the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <returns>Aggregate value</returns> [Pure] public static S FoldBack<S, T>(this Stck<T> stack, S state, Func<S, T, S> folder) => LanguageExt.List.foldBack(stack, state, folder); /// <summary> /// Applies a function 'folder' to each element of the collection whilst the predicate function /// returns true for the item being processed, threading an aggregate state through the /// computation. The fold function takes the state argument, and applies the function 'folder' /// to it and the first element of the stack. Then, it feeds this result into the function 'folder' /// along with the second element, and so on. It returns the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <param name="preditem">Predicate function</param> /// <returns>Aggregate value</returns> [Pure] public static S FoldWhile<S, T>(this Stck<T> stack, S state, Func<S, T, S> folder, Func<T, bool> preditem) => LanguageExt.List.foldWhile(stack, state, folder, preditem: preditem); /// <summary> /// Applies a function 'folder' to each element of the collection, threading an accumulator /// argument through the computation (and whilst the predicate function returns true when passed /// the aggregate state). The fold function takes the state argument, and applies the function /// 'folder' to it and the first element of the stack. Then, it feeds this result into the /// function 'folder' along with the second element, and so on. It returns the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <param name="predstate">Predicate function</param> /// <returns>Aggregate value</returns> [Pure] public static S FoldWhile<S, T>(this Stck<T> stack, S state, Func<S, T, S> folder, Func<S, bool> predstate) => LanguageExt.List.foldWhile(stack, state, folder, predstate: predstate); /// <summary> /// Applies a function 'folder' to each element of the collection (from last element to first) /// whilst the predicate function returns true for the item being processed, threading an /// aggregate state through the computation. The fold function takes the state argument, and /// applies the function 'folder' to it and the first element of the stack. Then, it feeds this /// result into the function 'folder' along with the second element, and so on. It returns the /// final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <param name="preditem">Predicate function</param> /// <returns>Aggregate value</returns> [Pure] public static S FoldBackWhile<S, T>(this Stck<T> stack, S state, Func<S, T, S> folder, Func<T, bool> preditem) => LanguageExt.List.foldBackWhile(stack, state, folder, preditem: preditem); /// <summary> /// Applies a function 'folder' to each element of the collection (from last element to first), /// threading an accumulator argument through the computation (and whilst the predicate function /// returns true when passed the aggregate state). The fold function takes the state argument, /// and applies the function 'folder' to it and the first element of the stack. Then, it feeds /// this result into the function 'folder' along with the second element, and so on. It returns /// the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <param name="predstate">Predicate function</param> /// <returns>Aggregate value</returns> [Pure] public static S FoldBackWhile<S, T>(this Stck<T> stack, S state, Func<S, T, S> folder, Func<S, bool> predstate) => LanguageExt.List.foldBackWhile(stack, state, folder, predstate: predstate); /// <summary> /// Applies a function to each element of the collection, threading an accumulator argument /// through the computation. This function first applies the function to the first two /// elements of the stack. Then, it passes this result into the function along with the third /// element and so on. Finally, it returns the final result. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="reducer">Reduce function</param> /// <returns>Aggregate value</returns> [Pure] public static T ReduceBack<T>(Stck<T> stack, Func<T, T, T> reducer) => LanguageExt.List.reduceBack(stack, reducer); /// <summary> /// Applies a function to each element of the collection (from last element to first), threading /// an accumulator argument through the computation. This function first applies the function /// to the first two elements of the stack. Then, it passes this result into the function along /// with the third element and so on. Finally, it returns the final result. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to fold</param> /// <param name="reducer">Reduce function</param> /// <returns>Aggregate value</returns> [Pure] public static T Reduce<T>(this Stck<T> stack, Func<T, T, T> reducer) => LanguageExt.List.reduce(stack, reducer); /// <summary> /// Applies a function to each element of the collection, threading an accumulator argument /// through the computation. This function takes the state argument, and applies the function /// to it and the first element of the stack. Then, it passes this result into the function /// along with the second element, and so on. Finally, it returns the list of intermediate /// results and the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="state">Initial state</param> /// <param name="folder">Folding function</param> /// <returns>Aggregate state</returns> [Pure] public static Stck<S> Scan<S, T>(this Stck<T> stack, S state, Func<S, T, S> folder) => toStackRev(LanguageExt.List.scan(stack, state, folder)); /// <summary> /// Applies a function to each element of the collection (from last element to first), /// threading an accumulator argument through the computation. This function takes the state /// argument, and applies the function to it and the first element of the stack. Then, it /// passes this result into the function along with the second element, and so on. Finally, /// it returns the list of intermediate results and the final result. /// </summary> /// <typeparam name="S">State type</typeparam> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="state">Initial state</param> /// <param name="folder">Folding function</param> /// <returns>Aggregate state</returns> [Pure] public static Stck<S> ScanBack<S, T>(this Stck<T> stack, S state, Func<S, T, S> folder) => toStackRev(LanguageExt.List.scanBack(stack, state, folder)); /// <summary> /// Returns Some(x) for the first item in the stack that matches the predicate /// provided, None otherwise. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="pred">Predicate</param> /// <returns>Some(x) for the first item in the stack that matches the predicate /// provided, None otherwise.</returns> [Pure] public static Option<T> Find<T>(this Stck<T> stack, Func<T, bool> pred) => LanguageExt.List.find(stack, pred); /// <summary> /// Returns the number of items in the stack /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <returns>The number of items in the enumerable</returns> [Pure] public static int Length<T>(this Stck<T> stack) => LanguageExt.List.length(stack); /// <summary> /// Invokes an action for each item in the stack in order /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to iterate</param> /// <param name="action">Action to invoke with each item</param> /// <returns>Unit</returns> public static Unit Iter<T>(this Stck<T> stack, Action<T> action) => LanguageExt.List.iter(stack, action); /// <summary> /// Invokes an action for each item in the stack in order and supplies /// a running index value. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack to iterate</param> /// <param name="action">Action to invoke with each item</param> /// <returns>Unit</returns> public static Unit Iter<T>(this Stck<T> stack, Action<int, T> action) => LanguageExt.List.iter(stack, action); /// <summary> /// Return an enumerable with all duplicate values removed /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <returns>An enumerable with all duplicate values removed</returns> [Pure] public static bool ForAll<T>(this Stck<T> stack, Func<T, bool> pred) => LanguageExt.List.forall(stack, pred); /// <summary> /// Return an enumerable with all duplicate values removed /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <returns>An enumerable with all duplicate values removed</returns> [Pure] public static Stck<T> Distinct<T>(this Stck<T> stack) => toStackRev(LanguageExt.List.distinct(stack)); /// <summary> /// Return an enumerable with all duplicate values removed /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <returns>An enumerable with all duplicate values removed</returns> [Pure] public static Stck<T> Distinct<EQ,T>(this Stck<T> stack) where EQ : struct, Eq<T> => toStackRev(LanguageExt.List.distinct<EQ,T>(stack)); /// <summary> /// Return an enumerable with all duplicate values removed /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <returns>An enumerable with all duplicate values removed</returns> [Pure] public static Stck<T> Distinct<T, K>(this Stck<T> stack, Func<T, K> keySelector, Option<Func<K, K, bool>> compare = default(Option<Func<K, K, bool>>)) => toStackRev(LanguageExt.List.distinct(stack, keySelector, compare)); /// <summary> /// Returns a new enumerable with the first 'count' items from the stack /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="count">Number of items to take</param> /// <returns>A new enumerable with the first 'count' items from the enumerable provided</returns> [Pure] public static Stck<T> Take<T>(this Stck<T> stack, int count) => toStackRev(LanguageExt.List.take(stack, count)); /// <summary> /// Iterate the stack, yielding items if they match the predicate provided, and stopping /// as soon as one doesn't /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="count">Number of items to take</param> /// <returns>A new enumerable with the first items that match the predicate</returns> [Pure] public static Stck<T> TakeWhile<T>(this Stck<T> stack, Func<T, bool> pred) => toStackRev(LanguageExt.List.takeWhile(stack, pred)); /// <summary> /// Iterate the stack, yielding items if they match the predicate provided, and stopping /// as soon as one doesn't An index value is also provided to the predicate function. /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="count">Number of items to take</param> /// <returns>A new enumerable with the first items that match the predicate</returns> [Pure] public static Stck<T> TakeWhile<T>(this Stck<T> stack, Func<T, int, bool> pred) => toStackRev(LanguageExt.List.takeWhile(stack, pred)); /// <summary> /// Returns true if any item in the stack matches the predicate provided /// </summary> /// <typeparam name="T">Stack item type</typeparam> /// <param name="stack">Stack</param> /// <param name="pred">Predicate</param> /// <returns>True if any item in the stack matches the predicate provided</returns> [Pure] public static bool Exists<T>(this Stck<T> stack, Func<T, bool> pred) => LanguageExt.List.exists(stack, pred); }
{ "content_hash": "b050a6c9223047c7b276d2377e740e57", "timestamp": "", "source": "github", "line_count": 912, "max_line_length": 157, "avg_line_length": 49.52302631578947, "alnum_prop": 0.6207018709177461, "repo_name": "louthy/language-ext", "id": "a92ef0bd372881baf42d500aecb8ff4fa50c0f58", "size": "45167", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "LanguageExt.Core/Immutable Collections/Stack/Stack.Module.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1949" }, { "name": "C#", "bytes": "22665424" } ], "symlink_target": "" }
/****************************************************************************/ /* isprint v15.12.3 */ /* */ /* Copyright (c) 1993-2016 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /****************************************************************************/ #undef _INLINE #include <ctype.h> _CODE_ACCESS int isprint(int c) { return(_isprint(c)); }
{ "content_hash": "78c47187e9f26b03d41ab7745b0fa766", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 78, "avg_line_length": 66.86363636363636, "alnum_prop": 0.4449354180829368, "repo_name": "gexd7127/MIT-Pico-Grid", "id": "fd58801aa6bf60674035db10e6438a2fb103c94e", "size": "2942", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Project/New_MG/Firmware/EVAL/c2000_15.12.3.LTS/lib/src/isprint.c", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "1001480" }, { "name": "Batchfile", "bytes": "164952" }, { "name": "C", "bytes": "7516542" }, { "name": "C++", "bytes": "4682368" }, { "name": "D", "bytes": "249889" }, { "name": "Groff", "bytes": "21868" }, { "name": "HTML", "bytes": "39378" }, { "name": "Makefile", "bytes": "199949" }, { "name": "Objective-C", "bytes": "887900" }, { "name": "Pascal", "bytes": "4315" }, { "name": "Shell", "bytes": "4169" } ], "symlink_target": "" }
@extends('voyager::master') @section('page_title','媒体库') @section('css') <script type="text/javascript" src="{{ voyager_asset('js/vue1.min.js') }}"></script> <link rel="stylesheet" href="{{ voyager_asset('css/media/media.css') }}"/> <link rel="stylesheet" type="text/css" href="{{ voyager_asset('js/select2/select2.min.css') }}"> <link rel="stylesheet" href="{{ voyager_asset('css/media/dropzone.css') }}"/> @stop @section('head') <style> .modal-open .select2-container{ z-index: 100002!important; } </style> @stop @section('content') <div class="page-content container-fluid"> @include('voyager::alerts') <div class="row"> <div class="col-md-12"> <div class="admin-section-title"> <h3><i class="voyager-images"></i> 媒体</h3> </div> <div class="clear"></div> <div id="filemanager"> <div id="toolbar"> <div class="btn-group offset-right"> <button type="button" class="btn btn-primary" id="upload"><i class="voyager-upload"></i> 上传 </button> <button type="button" class="btn btn-primary" id="new_folder" onclick="jQuery('#new_folder_modal').modal('show');"><i class="voyager-folder"></i> 添加文件夹 </button> </div> <button type="button" class="btn btn-default" id="refresh"><i class="voyager-refresh"></i> </button> <div class="btn-group offset-right"> <button type="button" class="btn btn-default" id="move"><i class="voyager-move"></i> 移动 </button> <button type="button" class="btn btn-default" id="rename"><i class="voyager-character"></i> 重命名 </button> <button type="button" class="btn btn-default" id="delete"><i class="voyager-trash"></i> 删除 </button> </div> </div> <div id="uploadPreview" style="display:none;"></div> <div id="uploadProgress" class="progress active progress-striped"> <div class="progress-bar progress-bar-success" style="width: 0"></div> </div> <div id="content"> <div class="breadcrumb-container"> <ol class="breadcrumb filemanager"> <li data-folder="/" data-index="0"><span class="arrow"></span><strong>媒体库</strong></li> <template v-for="folder in folders"> <li data-folder="@{{folder}}" data-index="@{{ $index+1 }}"><span class="arrow"></span>@{{ folder }}</li> </template> </ol> <div class="toggle"><span>Close</span><i class="voyager-double-right"></i></div> </div> <div class="flex"> <div id="left"> <ul id="files"> <li v-for="file in files.items"> <div class="file_link" data-folder="@{{file.name}}" data-index="@{{ $index }}"> <div class="link_icon"> <template v-if="file.type.includes('image')"> <div class="img_icon" style="background-size: cover; background-image: url(@{{ encodeURI(file.path) }}); background-repeat:no-repeat; background-position:center center;display:inline-block; width:100%; height:100%;"></div> </template> <template v-if="file.type.includes('video')"> <i class="icon voyager-video"></i> </template> <template v-if="file.type.includes('audio')"> <i class="icon voyager-music"></i> </template> <template v-if="file.type == 'folder'"> <i class="icon voyager-folder"></i> </template> <template v-if="file.type != 'folder' && !file.type.includes('image') && !file.type.includes('video') && !file.type.includes('audio')"> <i class="icon voyager-file-text"></i> </template> </div> <div class="details @{{ file.type }}"><h4>@{{ file.name }}</h4> <small> <template v-if="file.type == 'folder'"> <!--span class="num_items">@{{ file.items }} file(s)</span--> </template> <template v-else> <span class="file_size">@{{ file.size }}</span> </template> </small> </div> </div> </li> </ul> <div id="file_loader"> <?php $admin_loader_img = Voyager::setting('admin_loader', ''); ?> @if($admin_loader_img == '') <img src="{{ voyager_asset('images/logo-icon.png') }}" alt="Voyager Loader"> @else <img src="{{ Voyager::image($admin_loader_img) }}" alt="Voyager Loader"> @endif <p>加载媒体中。。。。</p> </div> <div id="no_files"> <h3><i class="voyager-meh"></i> 这个文件夹是空的.</h3> </div> </div> <div id="right"> <div class="right_none_selected"> <i class="voyager-cursor"></i> <p>没有选择文件或者文件夹</p> </div> <div class="right_details"> <div class="detail_img @{{ selected_file.type }}"> <template v-if="selected_file.type.includes('image')"> <img src="@{{ selected_file.path }}"/> </template> <template v-if="selected_file.type.includes('video')"> <video width="100%" height="auto" controls> <source src="@{{selected_file.path}}" type="video/mp4"> <source src="@{{selected_file.path}}" type="video/ogg"> <source src="@{{selected_file.path}}" type="video/webm"> 你的浏览器不支持这个视频标签. </video> </template> <template v-if="selected_file.type.includes('audio')"> <audio controls style="width:100%; margin-top:5px;"> <source src="@{{selected_file.path}}" type="audio/ogg"> <source src="@{{selected_file.path}}" type="audio/mpeg"> 你的浏览器不支持这个音频元素. </audio> </template> <template v-if="selected_file.type == 'folder'"> <i class="voyager-folder"></i> </template> <template v-if="selected_file.type != 'folder' && !selected_file.type.includes('audio') && !selected_file.type.includes('video') && !selected_file.type.includes('image')"> <i class="voyager-file-text-o"></i> </template> </div> <div class="detail_info @{{selected_file.type}}"> <span><h4>标题:</h4> <p>@{{selected_file.name}}</p></span> <span><h4>类型:</h4> <p>@{{selected_file.type}}</p></span> <template v-if="selected_file.type != 'folder'"> <span><h4>大小:</h4> <p><span class="selected_file_count">@{{ selected_file.items }} item(s)</span><span class="selected_file_size">@{{selected_file.size}}</span></p></span> <span><h4>公共 URL:</h4> <p><a href="@{{ selected_file.path }}" target="_blank">点击这里</a></p></span> <span><h4>上次更改:</h4> <p>@{{selected_file.last_modified}}</p></span> </template> </div> </div> </div> </div> <div class="nothingfound"> <div class="nofiles"></div> <span>这里没有文件.</span> </div> </div> <!-- Move File Modal --> <div class="modal fade modal-warning" id="move_file_modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><i class="voyager-move"></i> 移动 文件/文件夹</h4> </div> <div class="modal-body"> <h4>目标文件夹</h4> <select id="move_folder_dropdown"> <template v-if="folders.length"> <option value="/../">../</option> </template> <template v-for="dir in directories"> <option value="@{{ dir }}">@{{ dir }}</option> </template> </select> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> <button type="button" class="btn btn-warning" id="move_btn">移动</button> </div> </div> </div> </div> <!-- End Move File Modal --> <!-- Rename File Modal --> <div class="modal fade modal-warning" id="rename_file_modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><i class="voyager-character"></i> 重命名 文件/文件夹</h4> </div> <div class="modal-body"> <h4>新 文件/文件夹 名字</h4> <input id="new_filename" class="form-control" type="text" value="@{{selected_file.name}}"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> <button type="button" class="btn btn-warning" id="rename_btn">重命名</button> </div> </div> </div> </div> <!-- End Move File Modal --> </div><!-- #filemanager --> <!-- New Folder Modal --> <div class="modal fade modal-info" id="new_folder_modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><i class="voyager-folder"></i> 添加新文件夹</h4> </div> <div class="modal-body"> <input name="new_folder_name" id="new_folder_name" placeholder="新的文件夹名字" class="form-control" value=""/> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-info" id="new_folder_submit">创建新文件夹 </button> </div> </div> </div> </div> <!-- End New Folder Modal --> <!-- Delete File Modal --> <div class="modal fade modal-danger" id="confirm_delete_modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><i class="voyager-warning"></i> 你确定?</h4> </div> <div class="modal-body"> <h4>你确定你想要删除这个 '<span class="confirm_delete_name"></span>'</h4> <h5 class="folder_warning"><i class="voyager-warning"></i> 删除这个文件夹将会删除里面的全部文件和文件夹</h5> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> <button type="button" class="btn btn-danger" id="confirm_delete">确定, 删除它! </button> </div> </div> </div> </div> <!-- End Delete File Modal --> <div id="dropzone"></div> <!-- Delete File Modal --> <div class="modal fade" id="upload_files_modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title"><i class="voyager-warning"></i> 拖放文件或单击 浏览上传</h4> </div> <div class="modal-body"> </div> <div class="modal-footer"> <button type="button" class="btn btn-success" data-dismiss="modal"> 全部完成</button> </div> </div> </div> </div> <!-- End Delete File Modal --> </div><!-- .row --> </div><!-- .col-md-12 --> </div><!-- .page-content container-fluid --> <input type="hidden" id="storage_path" value="{{ storage_path() }}"> @section('javascript') <script src="{{ voyager_asset('js/media/dropzone.js') }}"></script> <script src="{{ voyager_asset('js/media/media.js') }}"></script> <script type="text/javascript"> var media = new VoyagerMedia({ baseUrl: "{{ route('voyager.dashboard') }}" }); $(function () { media.init(); }); </script> @endsection @stop
{ "content_hash": "6bd9ecf80cb8b943f1fe1c6e9a17d60e", "timestamp": "", "source": "github", "line_count": 352, "max_line_length": 257, "avg_line_length": 52.63352272727273, "alnum_prop": 0.35110919199006857, "repo_name": "xusenlin/voyager", "id": "8fd317beb2326dbe1e3ec1ff322b3699e3dfc015", "size": "18953", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "resources/views/media/index.blade.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "491587" }, { "name": "HTML", "bytes": "90615" }, { "name": "PHP", "bytes": "1165490" } ], "symlink_target": "" }
(function(dicomParser) { module("dicomParser.util"); test("isPrivateTag true", function() { // Arrange // Act var isPrivateTag = dicomParser.isPrivateTag('x00190010'); // Assert ok(isPrivateTag, "is private tag"); }); test("isPrivateTag false", function() { // Arrange // Act var isPrivateTag = dicomParser.isPrivateTag('x00100010'); // Assert ok(isPrivateTag === false, "is private tag"); }); test("parsePN full", function() { // Arrange var pnString = 'F^G^M^P^S'; // Act var val = dicomParser.parsePN(pnString); // Assert equal(val.familyName, 'F', "personName returned wrong value for familyName"); equal(val.givenName, 'G', "personName returned wrong value for givenName"); equal(val.middleName, 'M', "personName returned wrong value for middleName"); equal(val.prefix, 'P', "personName returned wrong value for prefix"); equal(val.suffix, 'S', "personName returned wrong value for suffix"); }); test("parsePN partial", function() { // Arrange var pnString = 'F'; // Act var val = dicomParser.parsePN(pnString); // Assert equal(val.familyName, 'F', "personName returned wrong value for familyName"); equal(val.givenName, undefined, "personName returned wrong value for givenName"); equal(val.middleName, undefined, "personName returned wrong value for middleName"); equal(val.prefix, undefined, "personName returned wrong value for prefix"); equal(val.suffix, undefined, "personName returned wrong value for suffix"); }); test("parseTM", function() { // Arrange var tmString = '081236.531000'; // Act var val = dicomParser.parseTM(tmString); // Assert equal(val.hours, 8, "time returned wrong value for hours"); equal(val.minutes, 12, "time returned wrong value for minutes"); equal(val.seconds, 36, "time returned wrong value for seconds"); equal(val.fractionalSeconds, 531000, "time returned wrong value for fractionalSeconds"); }); test("parseTM partial", function() { // Arrange var tmString = '08'; // Act var val = dicomParser.parseTM(tmString); // Assert equal(val.hours, 8, "time returned wrong value for hours"); equal(val.minutes, undefined, "time returned wrong value for minutes"); equal(val.seconds, undefined, "time returned wrong value for seconds"); equal(val.fractionalSeconds, undefined, "time returned wrong value for fractionalSeconds"); }); test("parseTM partial fractional", function() { // Arrange var tmString = '081236.5'; // Act var val = dicomParser.parseTM(tmString); // Assert equal(val.hours, 8, "time returned wrong value for hours"); equal(val.minutes, 12, "time returned wrong value for minutes"); equal(val.seconds, 36, "time returned wrong value for seconds"); equal(val.fractionalSeconds, 5, "time returned wrong value for fractionalSeconds"); }); test("parseTM bad hours", function() { // Arrange var tmString = '241236.531000'; // Act throws(function() { dicomParser.parseTM(tmString, true); }); }); test("parseTM bad minutes", function() { // Arrange var tmString = '236036.531000'; // Act throws(function() { dicomParser.parseTM(tmString, true); }); }); test("parseTM bad seconds", function() { // Arrange var tmString = '232260.531000'; // Act throws(function() { dicomParser.parseTM(tmString, true); }); }); test("parseTM bad fractional", function() { // Arrange var tmString = '232259.AA'; // Act throws(function() { dicomParser.parseTM(tmString, true); }); }); test("parseDA", function() { // Arrange var daString = '20140329'; // Act var val = dicomParser.parseDA(daString); // Assert equal(val.year, 2014, "date returned wrong value"); equal(val.month, 3, "date returned wrong value"); equal(val.day, 29, "date returned wrong value"); }); test("parseDA bad month", function() { // Arrange var daString = '20150001'; // Act throws(function() { dicomParser.parseDA(daString, true); }); }); test("parseDA bad day", function() { // Arrange var daString = '20150100'; // Act throws(function() { dicomParser.parseDA(daString, true); }); }); test("parseDA not leap year", function() { // Arrange var daString = '20150229'; // Act throws(function() { dicomParser.parseDA(daString, true); }); }); test("parseDA leap year", function() { // Arrange var daString = '20160229'; // Act var val = dicomParser.parseDA(daString, true); // Assert equal(val.year, 2016, "date returned wrong value"); equal(val.month, 2, "date returned wrong value"); equal(val.day, 29, "date returned wrong value"); }); test("parseDA day not number", function() { // Arrange var daString = '201500AA'; // Act throws(function() { dicomParser.parseDA(daString, true); }); }); test("parseDA year not number", function() { // Arrange var daString = 'AAAA0102'; // Act throws(function() { dicomParser.parseDA(daString, true); }); }); test("parseDA month not number", function() { // Arrange var daString = '2015AA02'; // Act throws(function() { dicomParser.parseDA(daString, true); }); }); test("parseDA invalid date length", function() { // Arrange var daString = '201501'; // Act throws(function() { dicomParser.parseDA(daString, true); }); }); })(dicomParser);
{ "content_hash": "cc0b0321fe8efd0b2989d7a0d23aed17", "timestamp": "", "source": "github", "line_count": 244, "max_line_length": 99, "avg_line_length": 24.53688524590164, "alnum_prop": 0.591615166193419, "repo_name": "thiagoss/dicomParser", "id": "a5cc0bcc0632578f60119e8e2743f2392673aadd", "size": "5987", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/utilTest.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "1989" }, { "name": "JavaScript", "bytes": "244990" } ], "symlink_target": "" }
Write a program that prints the third command-line argument. You must write this program using constant arrays by defining a constant for the `argv` array before using it. ---------------------------------------------------------------------- ## HINTS You can define a constant for an array as following: ```php define('ITEMS', ['item1', 'item2', 'item3']); ``` Then you can use it as following for instance: ```php var_dump(ITEMS); ``` Documentation on constant arrays can be found by pointing your browser here: [http://php.net/manual/en/migration70.new-features.php]() ----------------------------------------------------------------------
{ "content_hash": "59452f4a0aa2ee7ff467ee58cb8f94a0", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 110, "avg_line_length": 32.5, "alnum_prop": 0.5753846153846154, "repo_name": "NastasiaSaby/php7-way", "id": "3b00d27ebf8f37fd62df74f64f56df8c24afaff6", "size": "650", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "exercises/make-constant-your-arrays/problem/problem.md", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "29127" } ], "symlink_target": "" }
export function noProject(project: string) { return `Unable to find project '${project}' in the workspace`; } export function unsupportedStyles(styleFilePath: string) { return `Project style file found has unsupported extension: '${styleFilePath}'\nAdding 'bootstrap.min.css' to 'angular.json'`; } export function noMainFile(projectName: string) { return `Unable to find 'build.options.main' file path for project "${projectName}"`; } export function noModuleFile(moduleFilePath: string) { return `File '${moduleFilePath}' does not exist.`; }
{ "content_hash": "7fdf25218869e522a16eb758bcd67762", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 128, "avg_line_length": 36.93333333333333, "alnum_prop": 0.7509025270758123, "repo_name": "fbasso/ng-bootstrap", "id": "dcbf5c52aa96ac7cee273ec09a819acf5bb5d0c6", "size": "554", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "schematics/ng-add/messages.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2096" }, { "name": "EJS", "bytes": "21493" }, { "name": "HTML", "bytes": "33829" }, { "name": "JavaScript", "bytes": "8229" }, { "name": "SCSS", "bytes": "4758" }, { "name": "Shell", "bytes": "2078" }, { "name": "TypeScript", "bytes": "1706122" } ], "symlink_target": "" }
package gameservers import ( "agones.dev/agones/pkg/apis/stable" "agones.dev/agones/pkg/apis/stable/v1alpha1" "agones.dev/agones/pkg/client/clientset/versioned" getterv1alpha1 "agones.dev/agones/pkg/client/clientset/versioned/typed/stable/v1alpha1" "agones.dev/agones/pkg/client/informers/externalversions" listerv1alpha1 "agones.dev/agones/pkg/client/listers/stable/v1alpha1" "agones.dev/agones/pkg/util/runtime" "agones.dev/agones/pkg/util/workerqueue" "github.com/pkg/errors" "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" corelisterv1 "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" ) // HealthController watches Pods, and applies // an Unhealthy state if the GameServer main container exits when in // a Ready state type HealthController struct { logger *logrus.Entry podSynced cache.InformerSynced podLister corelisterv1.PodLister gameServerGetter getterv1alpha1.GameServersGetter gameServerLister listerv1alpha1.GameServerLister workerqueue *workerqueue.WorkerQueue recorder record.EventRecorder } // NewHealthController returns a HealthController func NewHealthController(kubeClient kubernetes.Interface, agonesClient versioned.Interface, kubeInformerFactory informers.SharedInformerFactory, agonesInformerFactory externalversions.SharedInformerFactory) *HealthController { podInformer := kubeInformerFactory.Core().V1().Pods().Informer() hc := &HealthController{ podSynced: podInformer.HasSynced, podLister: kubeInformerFactory.Core().V1().Pods().Lister(), gameServerGetter: agonesClient.StableV1alpha1(), gameServerLister: agonesInformerFactory.Stable().V1alpha1().GameServers().Lister(), } hc.logger = runtime.NewLoggerWithType(hc) hc.workerqueue = workerqueue.NewWorkerQueue(hc.syncGameServer, hc.logger, stable.GroupName+".HealthController") eventBroadcaster := record.NewBroadcaster() eventBroadcaster.StartLogging(hc.logger.Infof) eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) hc.recorder = eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "health-controller"}) podInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ UpdateFunc: func(oldObj, newObj interface{}) { pod := newObj.(*corev1.Pod) if owner := metav1.GetControllerOf(pod); owner != nil && owner.Kind == "GameServer" { if v1alpha1.GameServerRolePodSelector.Matches(labels.Set(pod.Labels)) && hc.failedContainer(pod) { key := pod.ObjectMeta.Namespace + "/" + owner.Name hc.logger.WithField("key", key).Info("GameServer container has terminated") hc.workerqueue.Enqueue(cache.ExplicitKey(key)) } } }, }) return hc } // failedContainer checks each container, and determines if there was a failed // container func (hc *HealthController) failedContainer(pod *corev1.Pod) bool { container := pod.Annotations[v1alpha1.GameServerContainerAnnotation] for _, cs := range pod.Status.ContainerStatuses { if cs.Name == container && cs.State.Terminated != nil { return true } } return false } // Run processes the rate limited queue. // Will block until stop is closed func (hc *HealthController) Run(stop <-chan struct{}) { hc.workerqueue.Run(1, stop) } // syncGameServer sets the GameSerer to Unhealthy, if its state is Ready func (hc *HealthController) syncGameServer(key string) error { hc.logger.WithField("key", key).Info("Synchronising") // Convert the namespace/name string into a distinct namespace and name namespace, name, err := cache.SplitMetaNamespaceKey(key) if err != nil { // don't return an error, as we don't want this retried runtime.HandleError(hc.logger.WithField("key", key), errors.Wrapf(err, "invalid resource key")) return nil } gs, err := hc.gameServerLister.GameServers(namespace).Get(name) if err != nil { if k8serrors.IsNotFound(err) { hc.logger.WithField("key", key).Info("GameServer is no longer available for syncing") return nil } return errors.Wrapf(err, "error retrieving GameServer %s from namespace %s", name, namespace) } if gs.Status.State == v1alpha1.Ready { hc.logger.WithField("gs", gs).Infof("Marking GameServer as Unhealthy") gsCopy := gs.DeepCopy() gsCopy.Status.State = v1alpha1.Unhealthy if _, err := hc.gameServerGetter.GameServers(gs.ObjectMeta.Namespace).Update(gsCopy); err != nil { return errors.Wrapf(err, "error updating GameServer %s to unhealthy", gs.ObjectMeta.Name) } hc.recorder.Event(gs, corev1.EventTypeWarning, string(gsCopy.Status.State), "GameServer container terminated") } return nil }
{ "content_hash": "229bade62a6f548d59c3efcc7a99534a", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 144, "avg_line_length": 38.7109375, "alnum_prop": 0.7570131180625631, "repo_name": "nicedone/agones", "id": "451ffc4ad8b6008b3943e72d236fab19567d03b7", "size": "5565", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pkg/gameservers/health.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "29538" }, { "name": "Go", "bytes": "344428" }, { "name": "HTML", "bytes": "1633" }, { "name": "Makefile", "bytes": "24276" }, { "name": "Shell", "bytes": "3975" }, { "name": "Smarty", "bytes": "1632" } ], "symlink_target": "" }
 #include <aws/lex-models/model/Prompt.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace LexModelBuildingService { namespace Model { Prompt::Prompt() : m_messagesHasBeenSet(false), m_maxAttempts(0), m_maxAttemptsHasBeenSet(false), m_responseCardHasBeenSet(false) { } Prompt::Prompt(JsonView jsonValue) : m_messagesHasBeenSet(false), m_maxAttempts(0), m_maxAttemptsHasBeenSet(false), m_responseCardHasBeenSet(false) { *this = jsonValue; } Prompt& Prompt::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("messages")) { Array<JsonView> messagesJsonList = jsonValue.GetArray("messages"); for(unsigned messagesIndex = 0; messagesIndex < messagesJsonList.GetLength(); ++messagesIndex) { m_messages.push_back(messagesJsonList[messagesIndex].AsObject()); } m_messagesHasBeenSet = true; } if(jsonValue.ValueExists("maxAttempts")) { m_maxAttempts = jsonValue.GetInteger("maxAttempts"); m_maxAttemptsHasBeenSet = true; } if(jsonValue.ValueExists("responseCard")) { m_responseCard = jsonValue.GetString("responseCard"); m_responseCardHasBeenSet = true; } return *this; } JsonValue Prompt::Jsonize() const { JsonValue payload; if(m_messagesHasBeenSet) { Array<JsonValue> messagesJsonList(m_messages.size()); for(unsigned messagesIndex = 0; messagesIndex < messagesJsonList.GetLength(); ++messagesIndex) { messagesJsonList[messagesIndex].AsObject(m_messages[messagesIndex].Jsonize()); } payload.WithArray("messages", std::move(messagesJsonList)); } if(m_maxAttemptsHasBeenSet) { payload.WithInteger("maxAttempts", m_maxAttempts); } if(m_responseCardHasBeenSet) { payload.WithString("responseCard", m_responseCard); } return payload; } } // namespace Model } // namespace LexModelBuildingService } // namespace Aws
{ "content_hash": "088ebf08b1367ffdce494d54b309d02d", "timestamp": "", "source": "github", "line_count": 96, "max_line_length": 98, "avg_line_length": 20.6875, "alnum_prop": 0.7124874118831823, "repo_name": "JoyIfBam5/aws-sdk-cpp", "id": "120a8ce735bb8a5bac61c43d1144a668770a9962", "size": "2559", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aws-cpp-sdk-lex-models/source/model/Prompt.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "11868" }, { "name": "C++", "bytes": "167818064" }, { "name": "CMake", "bytes": "591577" }, { "name": "HTML", "bytes": "4471" }, { "name": "Java", "bytes": "271801" }, { "name": "Python", "bytes": "85650" }, { "name": "Shell", "bytes": "5277" } ], "symlink_target": "" }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ToyBox.UI.Tests")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ToyBox.UI.Tests")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("af3c9b02-3c32-4139-97b2-0a1b8dcb17e2")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{ "content_hash": "da2bf67794d61aead25e2beafbeaae6d", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 84, "avg_line_length": 39.97222222222222, "alnum_prop": 0.7248088950660181, "repo_name": "marceln/SSMS-ToyBox", "id": "4d58e801e97df9b48002bea59ab31ac3ca85996b", "size": "1442", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "ToyBox.UI/ToyBox.UI.Tests/Properties/AssemblyInfo.cs", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > <hibernate-mapping> <class name="com.jcommerce.core.model.Region" table="tis_region" > <id name="id" column="region_id" type="string" length="32"> <generator class="uuid.hex" /> </id> <property name="name" column="region_name" length="120"/> <property name="type" column="region_type" length="1"/> <many-to-one name="parent" column="parent_id" class="com.jcommerce.core.model.Region" cascade="save-update" /> <many-to-one name="agency" column="agency_id" class="com.jcommerce.core.model.Agency" cascade="none" /> <set name="areas" table="tis_area_region" inverse="true" cascade="save-update"> <key column="region_id"/> <many-to-many column="shipping_area_id" class="com.jcommerce.core.model.ShippingArea" /> </set> </class> </hibernate-mapping>
{ "content_hash": "a9ba6aed7f546095032600299cb755e8", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 112, "avg_line_length": 42.904761904761905, "alnum_prop": 0.6914539400665927, "repo_name": "jbosschina/jcommerce", "id": "5e5a5c8a33f1ddfd124d891c8e8ddb54aeff44f9", "size": "901", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sandbox/migration/pre-hbm.xml/Region.hbm.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "200608" }, { "name": "GAP", "bytes": "2286" }, { "name": "Java", "bytes": "4485563" } ], "symlink_target": "" }
package com.zlate87.fyberapp.base; import com.zlate87.fyberapp.feature.offers.controller.OffersActivity; /** * Dagger component interface. */ public interface Component { void inject(OffersActivity offersActivity); }
{ "content_hash": "14193a6e1798f1dde14494e18219101e", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 69, "avg_line_length": 22.2, "alnum_prop": 0.7927927927927928, "repo_name": "Zlate87/fyber-app", "id": "52f9e73d1e536c67312ddaaa6c9e335e6d5518ef", "size": "222", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/zlate87/fyberapp/base/Component.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "58661" } ], "symlink_target": "" }
module Azure::Kusto::Mgmt::V2018_09_07_privatepreview module Models # # Model object. # # class AzureCapacity include MsRestAzure # @return [AzureScaleType] Scale type. Possible values include: # 'automatic', 'manual', 'none' attr_accessor :scale_type # @return [Integer] Minimum allowed capacity. attr_accessor :minimum # @return [Integer] Maximum allowed capacity. attr_accessor :maximum # @return [Integer] The default capacity that would be used. attr_accessor :default # # Mapper for AzureCapacity class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'AzureCapacity', type: { name: 'Composite', class_name: 'AzureCapacity', model_properties: { scale_type: { client_side_validation: true, required: true, serialized_name: 'scaleType', type: { name: 'String' } }, minimum: { client_side_validation: true, required: true, serialized_name: 'minimum', type: { name: 'Number' } }, maximum: { client_side_validation: true, required: true, serialized_name: 'maximum', type: { name: 'Number' } }, default: { client_side_validation: true, required: true, serialized_name: 'default', type: { name: 'Number' } } } } } end end end end
{ "content_hash": "61deb48f8c088dc7771a866550085ebf", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 69, "avg_line_length": 26.105263157894736, "alnum_prop": 0.4566532258064516, "repo_name": "Azure/azure-sdk-for-ruby", "id": "65c780ce659b06b525cc53441cd64d315a3d71d3", "size": "2148", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "management/azure_mgmt_kusto/lib/2017-09-07-privatepreview/generated/azure_mgmt_kusto/models/azure_capacity.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "345216400" }, { "name": "Shell", "bytes": "305" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_80) on Thu Nov 24 15:09:46 IST 2016 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>A-Index</title> <meta name="date" content="2016-11-24"> <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="A-Index"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../file/package-summary.html">Package</a></li> <li>Class</li> <li>Use</li> <li><a href="../overview-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li class="navBarCell1Rev">Index</li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Letter</li> <li><a href="index-2.html">Next Letter</a></li> </ul> <ul class="navList"> <li><a href="../index.html?index-filesindex-1.html" target="_top">Frames</a></li> <li><a href="index-1.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="contentContainer"><a href="index-1.html">A</a>&nbsp;<a href="index-2.html">F</a>&nbsp;<a href="index-3.html">G</a>&nbsp;<a name="_A_"> <!-- --> </a> <h2 class="title">A</h2> <dl> <dt><a href="../file/AvatarFile.html" title="class in file"><span class="strong">AvatarFile</span></a> - Class in <a href="../file/package-summary.html">file</a></dt> <dd>&nbsp;</dd> <dt><span class="strong"><a href="../file/AvatarFile.html#AvatarFile(int,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)">AvatarFile(int, String, String, String, String)</a></span> - Constructor for class file.<a href="../file/AvatarFile.html" title="class in file">AvatarFile</a></dt> <dd>&nbsp;</dd> </dl> <a href="index-1.html">A</a>&nbsp;<a href="index-2.html">F</a>&nbsp;<a href="index-3.html">G</a>&nbsp;</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../file/package-summary.html">Package</a></li> <li>Class</li> <li>Use</li> <li><a href="../overview-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li class="navBarCell1Rev">Index</li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Letter</li> <li><a href="index-2.html">Next Letter</a></li> </ul> <ul class="navList"> <li><a href="../index.html?index-filesindex-1.html" target="_top">Frames</a></li> <li><a href="index-1.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "content_hash": "3dd172d59654892b409c7f4e5958ea2f", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 318, "avg_line_length": 34.289256198347104, "alnum_prop": 0.6240057845263919, "repo_name": "varunon9/Remote-Control-PC", "id": "c4477a0d5ff0e40cdabe398d4ff1cd1495657599", "size": "4149", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "RemoteControlPC-Libraries/dist/javadoc/index-files/index-1.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "69633" }, { "name": "Java", "bytes": "171797" } ], "symlink_target": "" }
<?xml version="1.0" ?><!DOCTYPE TS><TS language="ja" version="2.0"> <defaultcodec>UTF-8</defaultcodec> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About WorldAidCoin</source> <translation>WorldAidCoinについて</translation> </message> <message> <location line="+39"/> <source>&lt;b&gt;WorldAidCoin&lt;/b&gt; version</source> <translation>&lt;b&gt;WorldAidCoin&lt;/b&gt; バージョン</translation> </message> <message> <location line="+57"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source> <translation type="unfinished"/> </message> <message> <location filename="../aboutdialog.cpp" line="+14"/> <source>Copyright</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The WorldAidCoin developers</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation>アドレス帳</translation> </message> <message> <location line="+19"/> <source>Double-click to edit address or label</source> <translation>アドレスまたはラベルを編集するにはダブルクリック</translation> </message> <message> <location line="+27"/> <source>Create a new address</source> <translation>新規アドレスの作成</translation> </message> <message> <location line="+14"/> <source>Copy the currently selected address to the system clipboard</source> <translation>現在選択されているアドレスをシステムのクリップボードにコピーする</translation> </message> <message> <location line="-11"/> <source>&amp;New Address</source> <translation type="unfinished"/> </message> <message> <location filename="../addressbookpage.cpp" line="+63"/> <source>These are your WorldAidCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation type="unfinished"/> </message> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>&amp;Copy Address</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a WorldAidCoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Delete the currently selected address from the list</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Export the data in the current tab to a file</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Export</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Verify a message to ensure it was signed with a specified WorldAidCoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>&amp;Delete</source> <translation>削除(&amp;D)</translation> </message> <message> <location filename="../addressbookpage.cpp" line="-5"/> <source>These are your WorldAidCoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Copy &amp;Label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>&amp;Edit</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send &amp;Coins</source> <translation type="unfinished"/> </message> <message> <location line="+260"/> <source>Export Address Book Data</source> <translation>アドレス帳データをエクスポートする</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>CSVファイル (*.csv)</translation> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation>エクスポートエラー</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>%1のファイルに書き込めませんでした。</translation> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+144"/> <source>Label</source> <translation>ラベル</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>アドレス</translation> </message> <message> <location line="+36"/> <source>(no label)</source> <translation>(ラベル無し)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation>パスフレーズを入力</translation> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation>新しいパスフレーズ</translation> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation>新しいパスフレーズをもう一度</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+33"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>ウォレットの新しいパスフレーズを入力してください。&lt;br/&gt;&lt;b&gt;8個以上の単語か10個以上のランダムな文字&lt;/b&gt;を使ってください。</translation> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation>ウォレットを暗号化する</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>この操作はウォレットをアンロックするためにパスフレーズが必要です。</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>ウォレットをアンロックする</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>この操作はウォレットの暗号化解除のためにパスフレーズが必要です。</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>ウォレットの暗号化を解除する</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>パスフレーズの変更</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>新旧両方のパスフレーズを入力してください。</translation> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation>ウォレットの暗号化を確認する</translation> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR WorldAidCoinS&lt;/b&gt;!</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation type="unfinished"/> </message> <message> <location line="-130"/> <location line="+58"/> <source>Wallet encrypted</source> <translation>ウォレットは暗号化されました</translation> </message> <message> <location line="-56"/> <source>WorldAidCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your WorldAidCoins from being stolen by malware infecting your computer.</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+42"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation>ウォレットの暗号化に失敗しました</translation> </message> <message> <location line="-54"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>内部エラーによりウォレットの暗号化が失敗しました。ウォレットは暗号化されませんでした。</translation> </message> <message> <location line="+7"/> <location line="+48"/> <source>The supplied passphrases do not match.</source> <translation>パスフレーズが同じではありません。</translation> </message> <message> <location line="-37"/> <source>Wallet unlock failed</source> <translation>ウォレットのアンロックに失敗しました</translation> </message> <message> <location line="+1"/> <location line="+11"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>ウォレットの暗号化解除のパスフレーズが正しくありません。</translation> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation>ウォレットの暗号化解除に失敗しました</translation> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation type="unfinished"/> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="+233"/> <source>Sign &amp;message...</source> <translation type="unfinished"/> </message> <message> <location line="+280"/> <source>Synchronizing with network...</source> <translation>ネットワークに同期中……</translation> </message> <message> <location line="-349"/> <source>&amp;Overview</source> <translation>概要(&amp;O)</translation> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation>ウォレットの概要を見る</translation> </message> <message> <location line="+20"/> <source>&amp;Transactions</source> <translation>取引(&amp;T)</translation> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation>取引履歴を閲覧</translation> </message> <message> <location line="+7"/> <source>Edit the list of stored addresses and labels</source> <translation>保存されたアドレスとラベルのリストを編集</translation> </message> <message> <location line="-14"/> <source>Show the list of addresses for receiving payments</source> <translation>支払い受け取り用アドレスのリストを見る</translation> </message> <message> <location line="+31"/> <source>E&amp;xit</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Quit application</source> <translation>アプリケーションを終了</translation> </message> <message> <location line="+4"/> <source>Show information about WorldAidCoin</source> <translation>WorldAidCoinに関する情報を見る</translation> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>オプション(&amp;O)</translation> </message> <message> <location line="+6"/> <source>&amp;Encrypt Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation type="unfinished"/> </message> <message> <location line="+285"/> <source>Importing blocks from disk...</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Reindexing blocks on disk...</source> <translation type="unfinished"/> </message> <message> <location line="-347"/> <source>Send coins to a WorldAidCoin address</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Modify configuration options for WorldAidCoin</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Backup wallet to another location</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation>ウォレット暗号化用パスフレーズの変更</translation> </message> <message> <location line="+6"/> <source>&amp;Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation type="unfinished"/> </message> <message> <location line="-4"/> <source>&amp;Verify message...</source> <translation type="unfinished"/> </message> <message> <location line="-165"/> <location line="+530"/> <source>WorldAidCoin</source> <translation type="unfinished"/> </message> <message> <location line="-530"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+101"/> <source>&amp;Send</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Receive</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>&amp;Addresses</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>&amp;About WorldAidCoin</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show or hide the main Window</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Encrypt the private keys that belong to your wallet</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Sign messages with your WorldAidCoin addresses to prove you own them</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Verify messages to ensure they were signed with specified WorldAidCoin addresses</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>&amp;File</source> <translation>ファイル(&amp;F)</translation> </message> <message> <location line="+7"/> <source>&amp;Settings</source> <translation>設定(&amp;S)</translation> </message> <message> <location line="+6"/> <source>&amp;Help</source> <translation>ヘルプ(&amp;H)</translation> </message> <message> <location line="+9"/> <source>Tabs toolbar</source> <translation>タブツールバー</translation> </message> <message> <location line="+17"/> <location line="+10"/> <source>[testnet]</source> <translation>[testnet]</translation> </message> <message> <location line="+47"/> <source>WorldAidCoin client</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+141"/> <source>%n active connection(s) to WorldAidCoin network</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+22"/> <source>No block source available...</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Processed %1 of %2 (estimated) blocks of transaction history.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Processed %1 blocks of transaction history.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+20"/> <source>%n hour(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n week(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+4"/> <source>%1 behind</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Last received block was generated %1 ago.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Transactions after this will not yet be visible.</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location line="+70"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation type="unfinished"/> </message> <message> <location line="-140"/> <source>Up to date</source> <translation>バージョンは最新です</translation> </message> <message> <location line="+31"/> <source>Catching up...</source> <translation type="unfinished"/> </message> <message> <location line="+113"/> <source>Confirm transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Sent transaction</source> <translation>送金取引</translation> </message> <message> <location line="+0"/> <source>Incoming transaction</source> <translation>着金取引</translation> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation type="unfinished"/> </message> <message> <location line="+33"/> <location line="+23"/> <source>URI handling</source> <translation type="unfinished"/> </message> <message> <location line="-23"/> <location line="+23"/> <source>URI can not be parsed! This can be caused by an invalid WorldAidCoin address or malformed URI parameters.</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>ウォレットは&lt;b&gt;暗号化され、アンロックされています&lt;/b&gt;</translation> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>ウォレットは&lt;b&gt;暗号化され、ロックされています&lt;/b&gt;</translation> </message> <message> <location filename="../bitcoin.cpp" line="+111"/> <source>A fatal error occurred. WorldAidCoin can no longer continue safely and will quit.</source> <translation type="unfinished"/> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+104"/> <source>Network Alert</source> <translation type="unfinished"/> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>アドレスの編集</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation>ラベル(&amp;L)</translation> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation>このアドレス帳の入った事と関係のレーベル</translation> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>&amp;アドレス</translation> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation>アドレス帳の入った事の関係のアドレスです。これは遅れるのアドレスのためだけに編集出来ます。</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="+21"/> <source>New receiving address</source> <translation>新しいの受け入れのアドレス</translation> </message> <message> <location line="+4"/> <source>New sending address</source> <translation>新しいの送るのアドレス</translation> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation>受け入れのアドレスを編集する</translation> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation>送るのアドレスを編集する</translation> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>入ったのアドレス「%1」はもうアドレス帳にあります。</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid WorldAidCoin address.</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation>財布をアンロックするのは出来ませんでした。</translation> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation>新しいのキーの生成は失敗しました。</translation> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+424"/> <location line="+12"/> <source>WorldAidCoin-Qt</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>version</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>UI options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation type="unfinished"/> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation>オプションズ</translation> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Automatically start WorldAidCoin after logging in to the system.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Start WorldAidCoin on system login</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Reset all client options to default.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Reset Options</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>&amp;Network</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Automatically open the WorldAidCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Connect to the WorldAidCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation type="unfinished"/> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting WorldAidCoin.</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Whether to show WorldAidCoin addresses in the transaction list or not.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Display addresses in transaction list</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation type="unfinished"/> </message> <message> <location filename="../optionsdialog.cpp" line="+53"/> <source>default</source> <translation type="unfinished"/> </message> <message> <location line="+130"/> <source>Confirm options reset</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Some settings may require a client restart to take effect.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Do you want to proceed?</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <location line="+9"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting WorldAidCoin.</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation type="unfinished"/> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation>フォーム</translation> </message> <message> <location line="+50"/> <location line="+166"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the WorldAidCoin network after a connection is established, but this process has not completed yet.</source> <translation type="unfinished"/> </message> <message> <location line="-124"/> <source>Balance:</source> <translation>残高:</translation> </message> <message> <location line="+29"/> <source>Unconfirmed:</source> <translation>未確認:</translation> </message> <message> <location line="-78"/> <source>Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+107"/> <source>Immature:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation type="unfinished"/> </message> <message> <location line="+46"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;最近の取引&lt;/b&gt;</translation> </message> <message> <location line="-101"/> <source>Your current balance</source> <translation>今の残高</translation> </message> <message> <location line="+29"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location filename="../overviewpage.cpp" line="+116"/> <location line="+1"/> <source>out of sync</source> <translation type="unfinished"/> </message> </context> <context> <name>PaymentServer</name> <message> <location filename="../paymentserver.cpp" line="+107"/> <source>Cannot start WorldAidCoin: click-to-pay handler</source> <translation type="unfinished"/> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation type="unfinished"/> </message> <message> <location line="+56"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Label:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Message:</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation type="unfinished"/> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation type="unfinished"/> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <location line="+23"/> <location filename="../rpcconsole.cpp" line="+339"/> <source>N/A</source> <translation type="unfinished"/> </message> <message> <location line="-217"/> <source>Client version</source> <translation type="unfinished"/> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation type="unfinished"/> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>Startup time</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>Network</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>On testnet</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Block chain</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Last block time</source> <translation type="unfinished"/> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Show the WorldAidCoin-Qt help message to get a list with possible WorldAidCoin command-line options.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation type="unfinished"/> </message> <message> <location line="-260"/> <source>Build date</source> <translation type="unfinished"/> </message> <message> <location line="-104"/> <source>WorldAidCoin - Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>WorldAidCoin Core</source> <translation type="unfinished"/> </message> <message> <location line="+279"/> <source>Debug log file</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Open the WorldAidCoin debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation type="unfinished"/> </message> <message> <location line="+102"/> <source>Clear console</source> <translation type="unfinished"/> </message> <message> <location filename="../rpcconsole.cpp" line="-30"/> <source>Welcome to the WorldAidCoin RPC console.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+124"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation>コインを送る</translation> </message> <message> <location line="+50"/> <source>Send to multiple recipients at once</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation type="unfinished"/> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>Balance:</source> <translation>残高:</translation> </message> <message> <location line="+10"/> <source>123.456 BTC</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-59"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source> and </source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>The recipient address is not valid, please recheck.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed!</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation>フォーム</translation> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation type="unfinished"/> </message> <message> <location line="+34"/> <source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <location filename="../sendcoinsentry.cpp" line="+26"/> <source>Enter a label for this address to add it to your address book</source> <translation type="unfinished"/> </message> <message> <location line="-78"/> <source>&amp;Label:</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Choose address from address book</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a WorldAidCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation type="unfinished"/> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>&amp;Sign Message</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+213"/> <source>Choose an address from the address book</source> <translation type="unfinished"/> </message> <message> <location line="-203"/> <location line="+213"/> <source>Alt+A</source> <translation type="unfinished"/> </message> <message> <location line="-203"/> <source>Paste address from clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Signature</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Copy the current signature to the system clipboard</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this WorldAidCoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Reset all sign message fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation type="unfinished"/> </message> <message> <location line="-87"/> <source>&amp;Verify Message</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified WorldAidCoin address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Verify &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Reset all verify message fields</source> <translation type="unfinished"/> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a WorldAidCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Enter WorldAidCoin signature</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation type="unfinished"/> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation type="unfinished"/> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation type="unfinished"/> </message> </context> <context> <name>SplashScreen</name> <message> <location filename="../splashscreen.cpp" line="+22"/> <source>The WorldAidCoin developers</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>[testnet]</source> <translation>[testnet]</translation> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+20"/> <source>Open until %1</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>%1/offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation type="unfinished"/> </message> <message> <location line="+18"/> <source>Status</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Source</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Generated</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation type="unfinished"/> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>label</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation type="unfinished"/> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Net amount</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Message</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Comment</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Debug information</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Transaction</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Inputs</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>true</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>false</source> <translation type="unfinished"/> </message> <message> <location line="-209"/> <source>, has not been successfully broadcast yet</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="-35"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+70"/> <source>unknown</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+225"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Address</source> <translation>Helbidea</translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+57"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+3"/> <source>Open until %1</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Offline (%1 confirmations)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Unconfirmed (%1 of %2 confirmations)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Confirmed (%1 confirmations)</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+8"/> <source>Mined balance will be available when it matures in %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+5"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation type="unfinished"/> </message> <message> <location line="+43"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Received from</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation type="unfinished"/> </message> <message> <location line="+199"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+52"/> <location line="+16"/> <source>All</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <source>Today</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This week</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This month</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Last month</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This year</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Range...</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Received with</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Sent to</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>To yourself</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Mined</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Other</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Min amount</source> <translation type="unfinished"/> </message> <message> <location line="+34"/> <source>Copy address</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit label</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation type="unfinished"/> </message> <message> <location line="+139"/> <source>Export Transaction Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>テキスト CSV (*.csv)</translation> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Date</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Type</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Label</source> <translation>レーベル</translation> </message> <message> <location line="+1"/> <source>Address</source> <translation>Helbidea</translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>ID</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation>エラー輸出</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>%1のファイルに書き込めませんでした。</translation> </message> <message> <location line="+100"/> <source>Range:</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>to</source> <translation type="unfinished"/> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+193"/> <source>Send Coins</source> <translation type="unfinished"/> </message> </context> <context> <name>WalletView</name> <message> <location filename="../walletview.cpp" line="+42"/> <source>&amp;Export</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Export the data in the current tab to a file</source> <translation type="unfinished"/> </message> <message> <location line="+193"/> <source>Backup Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Backup Successful</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The wallet data was successfully saved to the new location.</source> <translation type="unfinished"/> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+94"/> <source>WorldAidCoin version</source> <translation>WorldAidCoin Bertsio</translation> </message> <message> <location line="+102"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>Send command to -server or WorldAidCoind</source> <translation type="unfinished"/> </message> <message> <location line="-23"/> <source>List commands</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>Get help for a command</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>Options:</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>Specify configuration file (default: WorldAidCoin.conf)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Specify pid file (default: WorldAidCoind.pid)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <source>Set database cache size in megabytes (default: 25)</source> <translation type="unfinished"/> </message> <message> <location line="-28"/> <source>Listen for connections on &lt;port&gt; (default: 9333 or testnet: 19333)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation type="unfinished"/> </message> <message> <location line="-48"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <source>Specify your own public address</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="-134"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation type="unfinished"/> </message> <message> <location line="-29"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 9332 or testnet: 19332)</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <source>Accept command line and JSON-RPC commands</source> <translation type="unfinished"/> </message> <message> <location line="+76"/> <source>Run in the background as a daemon and accept commands</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <source>Use the test network</source> <translation type="unfinished"/> </message> <message> <location line="-112"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation type="unfinished"/> </message> <message> <location line="-80"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=WorldAidCoinrpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. It is also recommended to set alertnotify so you are notified of problems; for example: alertnotify=echo %%s | mail -s &quot;WorldAidCoin Alert&quot; admin@foo.com </source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Cannot obtain a lock on data directory %s. WorldAidCoin is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong WorldAidCoin will not work properly.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Block creation options:</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Connect only to the specified node(s)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Corrupted block database detected</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Do you want to rebuild the block database now?</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error initializing block database</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error initializing wallet database environment %s!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading block database</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error opening block database</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error: Disk space is low!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error: Wallet locked, unable to create transaction!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error: system error: </source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to read block info</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to read block</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to sync block index</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write block index</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write block info</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write block</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write file info</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write to coin database</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write transaction index</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write undo data</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Find peers using DNS lookup (default: 1 unless -connect)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Generate coins (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 288, 0 = all)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-4, default: 3)</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Not enough file descriptors available.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Rebuild block chain index from current blk000??.dat files</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Set the number of threads to service RPC calls (default: 4)</source> <translation type="unfinished"/> </message> <message> <location line="+26"/> <source>Verifying blocks...</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Verifying wallet...</source> <translation type="unfinished"/> </message> <message> <location line="-69"/> <source>Imports blocks from external blk000??.dat file</source> <translation type="unfinished"/> </message> <message> <location line="-76"/> <source>Set the number of script verification threads (up to 16, 0 = auto, &lt;0 = leave that many cores free, default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+77"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Invalid amount for -minrelaytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Invalid amount for -mintxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Maintain a full transaction index (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Only accept block chain matching built-in checkpoints (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Prepend debug output with timestamp</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>SSL options: (see the WorldAidCoin Wiki for SSL setup instructions)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Signing transaction failed</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>System error: </source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Transaction amount too small</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transaction amounts must be positive</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transaction too large</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Username for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>You need to rebuild the databases using -reindex to change -txindex</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>wallet.dat corrupt, salvage failed</source> <translation type="unfinished"/> </message> <message> <location line="-50"/> <source>Password for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="-67"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation type="unfinished"/> </message> <message> <location line="+76"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="-120"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation type="unfinished"/> </message> <message> <location line="+147"/> <source>Upgrade wallet to latest format</source> <translation type="unfinished"/> </message> <message> <location line="-21"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>Rescan the block chain for missing wallet transactions</source> <translation type="unfinished"/> </message> <message> <location line="+35"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation type="unfinished"/> </message> <message> <location line="-26"/> <source>Server certificate file (default: server.cert)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation type="unfinished"/> </message> <message> <location line="-151"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation type="unfinished"/> </message> <message> <location line="+165"/> <source>This help message</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation type="unfinished"/> </message> <message> <location line="-91"/> <source>Connect through socks proxy</source> <translation type="unfinished"/> </message> <message> <location line="-10"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation type="unfinished"/> </message> <message> <location line="+55"/> <source>Loading addresses...</source> <translation type="unfinished"/> </message> <message> <location line="-35"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading wallet.dat: Wallet requires newer version of WorldAidCoin</source> <translation type="unfinished"/> </message> <message> <location line="+93"/> <source>Wallet needed to be rewritten: restart WorldAidCoin to complete</source> <translation type="unfinished"/> </message> <message> <location line="-95"/> <source>Error loading wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+56"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation type="unfinished"/> </message> <message> <location line="-96"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Invalid amount</source> <translation type="unfinished"/> </message> <message> <location line="-6"/> <source>Insufficient funds</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Loading block index...</source> <translation type="unfinished"/> </message> <message> <location line="-57"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation type="unfinished"/> </message> <message> <location line="-25"/> <source>Unable to bind to %s on this computer. WorldAidCoin is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="+64"/> <source>Fee per KB to add to transactions you send</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Loading wallet...</source> <translation type="unfinished"/> </message> <message> <location line="-52"/> <source>Cannot downgrade wallet</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Cannot write default address</source> <translation type="unfinished"/> </message> <message> <location line="+64"/> <source>Rescanning...</source> <translation type="unfinished"/> </message> <message> <location line="-57"/> <source>Done loading</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <source>To use the %s option</source> <translation type="unfinished"/> </message> <message> <location line="-74"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="-31"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation type="unfinished"/> </message> </context> </TS>
{ "content_hash": "09535fc016ce2da49765ed285b6f2ef2", "timestamp": "", "source": "github", "line_count": 2917, "max_line_length": 395, "avg_line_length": 33.35653068220775, "alnum_prop": 0.5895108991685594, "repo_name": "kolin182/WorldAidCoin", "id": "72b7a6bde862938dd0c31f3f06976d1d7b3dc202", "size": "99263", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/qt/locale/bitcoin_ja.ts", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "31413" }, { "name": "C++", "bytes": "2967018" }, { "name": "CSS", "bytes": "1127" }, { "name": "Makefile", "bytes": "32874" }, { "name": "Objective-C", "bytes": "858" }, { "name": "Objective-C++", "bytes": "5864" }, { "name": "Python", "bytes": "69710" }, { "name": "Shell", "bytes": "9755" } ], "symlink_target": "" }
package org.camelcookbook.routing.loadbalancer; import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.spring.CamelSpringTestSupport; import org.junit.Test; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class LoadBalancerStickySpringTest extends CamelSpringTestSupport { @Produce(uri = "direct:start") protected ProducerTemplate template; @EndpointInject(uri = "mock:first") private MockEndpoint first; @EndpointInject(uri = "mock:second") private MockEndpoint second; @EndpointInject(uri = "mock:third") private MockEndpoint third; @EndpointInject(uri = "mock:out") private MockEndpoint out; @Override protected AbstractApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("META-INF/spring/loadBalancer-sticky-context.xml"); } @Test public void testMessageLoadBalancedToStickyEndpoints() throws InterruptedException { final String messageBody = "Client has bought something"; first.setExpectedMessageCount(4); first.message(0).header("customerId").isEqualTo(0); first.message(1).header("customerId").isEqualTo(3); first.message(2).header("customerId").isEqualTo(0); first.message(3).header("customerId").isEqualTo(3); second.setExpectedMessageCount(2); second.message(0).header("customerId").isEqualTo(1); second.message(1).header("customerId").isEqualTo(1); third.setExpectedMessageCount(2); third.message(0).header("customerId").isEqualTo(2); third.message(1).header("customerId").isEqualTo(2); for (int messageCount = 0; messageCount < 2; messageCount++) { for (int customerCount = 0; customerCount < 4; customerCount++) { template.sendBodyAndHeader(messageBody, "customerId", customerCount); } } assertMockEndpointsSatisfied(); } }
{ "content_hash": "b6611c965b83811b7b3969afc970c91c", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 101, "avg_line_length": 35.016129032258064, "alnum_prop": 0.7181022570244127, "repo_name": "leandrosilvaferreira/camel-cookbook-examples", "id": "1993eca531702f9a398803c2106fb8c5fb4a4a01", "size": "2817", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "camel-cookbook-routing/src/test/java/org/camelcookbook/routing/loadbalancer/LoadBalancerStickySpringTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1073730" }, { "name": "XSLT", "bytes": "2548" } ], "symlink_target": "" }
// gcc,clang,icpc defines: // __GNUC__ Compiler is gcc, clang or icpc // __clang__ clang compiler // __INTEL_COMPILER Intel's icc and icpc compilers // _LP64 LP64 paradigm // __x86_64__ Intel/AMD 64 bit ISA // __ppc64__ PowerPC 64 bit ISA // __APPLE__ Defined on all apple platform compilers (along with __MACH__) // __ANDROID__ // #ifndef FGPLATFORM_HPP #define FGPLATFORM_HPP #include "FgStdLibs.hpp" // FaceGen defines: // FG_64 Targeting 64-bit ISA (there is no cross-compiler standard for this) #ifdef _WIN64 #define FG_64 #elif __x86_64__ #define FG_64 #endif // FG_SANDBOX Targeting a sandboxed platform (eg. Android, iOS, WebAssembly). No system() calls etc. #ifdef __ANDROID__ #define FG_SANDBOX #endif #if defined(__APPLE__) && defined(ENABLE_BITCODE) // Including "TargetConditionals.h" and testing TARGET_OS_IPHONE does not work because this file // is in sysroot/usr/include/ which doesn't compile with C++ (C only): #define FG_SANDBOX #endif #ifdef _MSC_VER // Too many false positives (avoid unnmaed objects with custom construction or destruction): # pragma warning(disable:26444) #endif namespace Fg { // handy for avoiding ugly macros when things compile cross-platform but we want conditional behaviour: bool constexpr isCompiledWithMsvc() { #ifdef _MSC_VER return true; #else return false; #endif } bool constexpr is64Bit() { #ifdef FG_64 return true; #else return false; #endif } bool constexpr is32Bit() {return !is64Bit(); } bool constexpr isDebug() { #ifdef _DEBUG return true; #else return false; #endif } bool constexpr isRelease() {return !isDebug(); } // Returns "32" if the current executable is 32-bit, "64" if 64-bit: std::string cBitsString(); } #endif
{ "content_hash": "1cb27072a3fd0e540d9fd4b7ca582f09", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 106, "avg_line_length": 25.285714285714285, "alnum_prop": 0.628145865434001, "repo_name": "SingularInversions/FaceGenBaseLibrary", "id": "60f8451648e49cc16880ad08051e3baed63708c2", "size": "2779", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "source/LibFgBase/src/FgPlatform.hpp", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "4794" }, { "name": "C", "bytes": "640422" }, { "name": "C++", "bytes": "53215766" }, { "name": "CMake", "bytes": "20742" }, { "name": "CSS", "bytes": "998" }, { "name": "HLSL", "bytes": "6773" }, { "name": "HTML", "bytes": "1040543" }, { "name": "Makefile", "bytes": "93806" }, { "name": "Mathematica", "bytes": "3776063" }, { "name": "Perl", "bytes": "5972" }, { "name": "Shell", "bytes": "6461" }, { "name": "XSLT", "bytes": "7464" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "079d136842b2a7dcf1d648154eb69029", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "f345d592364c6cd8942e44967f6bc6c2e83b6166", "size": "171", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Calanthe/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package vn.springdatajpa.sample.entities; // Generated 17 Apr, 2015 4:50:05 PM by Hibernate Tools 3.4.0.CR1 import static javax.persistence.GenerationType.IDENTITY; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import com.fasterxml.jackson.annotation.JsonIgnore; /** * Actor generated by hbm2java */ @SuppressWarnings("serial") @Entity @Table(name = "actor") public class Actor implements java.io.Serializable { private Short actorId; private String firstName; private String lastName; private Date lastUpdate; private Set<FilmActor> filmActors = new HashSet<FilmActor>(0); public Actor() { } public Actor(String firstName, String lastName, Date lastUpdate) { this.firstName = firstName; this.lastName = lastName; this.lastUpdate = lastUpdate; } public Actor(String firstName, String lastName, Date lastUpdate, Set<FilmActor> filmActors) { this.firstName = firstName; this.lastName = lastName; this.lastUpdate = lastUpdate; this.filmActors = filmActors; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "actor_id", unique = true, nullable = false) public Short getActorId() { return this.actorId; } public void setActorId(Short actorId) { this.actorId = actorId; } @Column(name = "first_name", nullable = false, length = 45) public String getFirstName() { return this.firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @Column(name = "last_name", nullable = false, length = 45) public String getLastName() { return this.lastName; } public void setLastName(String lastName) { this.lastName = lastName; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "last_update", nullable = false, length = 19) public Date getLastUpdate() { return this.lastUpdate; } public void setLastUpdate(Date lastUpdate) { this.lastUpdate = lastUpdate; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "actor") @JsonIgnore public Set<FilmActor> getFilmActors() { return this.filmActors; } public void setFilmActors(Set<FilmActor> filmActors) { this.filmActors = filmActors; } }
{ "content_hash": "a7ae1e4414e91edd633f042df80330d2", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 67, "avg_line_length": 24.66990291262136, "alnum_prop": 0.7174340810704447, "repo_name": "tung1404/gradle-jee", "id": "0f775cb928db7674884b5e37b158fd4e8d97c64f", "size": "2541", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gradle-petrikainulainen/spring-data-jpa-tutorial/src/main/java/vn/springdatajpa/sample/entities/Actor.java", "mode": "33188", "license": "mit", "language": [ { "name": "Groovy", "bytes": "750" }, { "name": "Java", "bytes": "191938" }, { "name": "Shell", "bytes": "178" } ], "symlink_target": "" }
<?php /* Safe sample input : execute a ls command using the function system, and put the last result in $tainted sanitize : cast via + = 0 construction : interpretation with simple quote */ /*Copyright 2015 Bertrand STIVALET Permission is hereby granted, without written agreement or royalty fee, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following three paragraphs appear in all copies of this software. IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.*/ $tainted = system('ls', $retval); $tainted = $tainted + 0; $query = "SELECT * FROM COURSE c WHERE c.id IN (SELECT idcourse FROM REGISTRATION WHERE idstudent=' $tainted ')"; $conn = mysql_connect('localhost', 'mysql_user', 'mysql_password'); // Connection to the database (address, user, password) mysql_select_db('dbname') ; echo "query : ". $query ."<br /><br />" ; $res = mysql_query($query); //execution while($data =mysql_fetch_array($res)){ print_r($data) ; echo "<br />" ; } mysql_close($conn); ?>
{ "content_hash": "03f417f2a1beff6ed451510bd18fcec7", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 123, "avg_line_length": 25.58730158730159, "alnum_prop": 0.7431761786600496, "repo_name": "stivalet/PHP-Vulnerability-test-suite", "id": "31883b4db91e6aaebce01dc568cd972568307fc5", "size": "1612", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Injection/CWE_89/safe/CWE_89__system__CAST-cast_int_sort_of2__multiple_select-interpretation_simple_quote.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "64184004" } ], "symlink_target": "" }
require File.dirname(__FILE__) + '/../spec_helper' describe HierarchyEntry do # ??? end
{ "content_hash": "d8b62d81af2db48c4f716750cf2e3a7d", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 50, "avg_line_length": 13.285714285714286, "alnum_prop": 0.6344086021505376, "repo_name": "agrimm/eol", "id": "59b6a5652dc43f75084b1ee8e526c9ed2067aff6", "size": "93", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "spec/models/hierarchy_entry_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "ActionScript", "bytes": "3299" }, { "name": "Java", "bytes": "81984" }, { "name": "JavaScript", "bytes": "263706" }, { "name": "Ruby", "bytes": "1006736" }, { "name": "Shell", "bytes": "5313" } ], "symlink_target": "" }
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.coolweather.app; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f080000; } public static final class layout { public static final int activity_main=0x7f030000; } public static final class menu { public static final int main=0x7f070000; } public static final class string { public static final int action_settings=0x7f050001; public static final int app_name=0x7f050000; public static final int hello_world=0x7f050002; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
{ "content_hash": "169cd9856b035f0e4db122b945b4153d", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 82, "avg_line_length": 35.6764705882353, "alnum_prop": 0.6764220939818631, "repo_name": "xuewj/coolweather", "id": "c26b0cba6a1fd26ae81d17e6bdfd1e14b283f593", "size": "2426", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gen/com/coolweather/app/R.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "10262" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>timelineTime property - AnimationPlayerEvent class - polymer_app_layout.behaviors library - Dart API</title> <!-- required because all the links are pseudo-absolute --> <base href="../.."> <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro|Roboto:500,400italic,300,400' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="static-assets/prettify.css"> <link rel="stylesheet" href="static-assets/css/bootstrap.min.css"> <link rel="stylesheet" href="static-assets/styles.css"> <meta name="description" content="API docs for the timelineTime property from the AnimationPlayerEvent class, for the Dart programming language."> <link rel="icon" href="static-assets/favicon.png"> <!-- Do not remove placeholder --> <!-- Header Placeholder --> </head> <body> <div id="overlay-under-drawer"></div> <header class="container-fluid" id="title"> <nav class="navbar navbar-fixed-top"> <div class="container"> <button id="sidenav-left-toggle" type="button">&nbsp;</button> <ol class="breadcrumbs gt-separated hidden-xs"> <li><a href="index.html">polymer_app_layout_template</a></li> <li><a href="polymer_app_layout.behaviors/polymer_app_layout.behaviors-library.html">polymer_app_layout.behaviors</a></li> <li><a href="polymer_app_layout.behaviors/AnimationPlayerEvent-class.html">AnimationPlayerEvent</a></li> <li class="self-crumb">timelineTime</li> </ol> <div class="self-name">timelineTime</div> </div> </nav> <div class="container masthead"> <ol class="breadcrumbs gt-separated visible-xs"> <li><a href="index.html">polymer_app_layout_template</a></li> <li><a href="polymer_app_layout.behaviors/polymer_app_layout.behaviors-library.html">polymer_app_layout.behaviors</a></li> <li><a href="polymer_app_layout.behaviors/AnimationPlayerEvent-class.html">AnimationPlayerEvent</a></li> <li class="self-crumb">timelineTime</li> </ol> <div class="title-description"> <h1 class="title"> <div class="kind">property</div> timelineTime </h1> <!-- p class="subtitle"> </p --> </div> <ul class="subnav"> </ul> </div> </header> <div class="container body"> <div class="col-xs-6 col-sm-3 sidebar sidebar-offcanvas-left"> <h5><a href="index.html">polymer_app_layout_template</a></h5> <h5><a href="polymer_app_layout.behaviors/polymer_app_layout.behaviors-library.html">polymer_app_layout.behaviors</a></h5> <h5><a href="polymer_app_layout.behaviors/AnimationPlayerEvent-class.html">AnimationPlayerEvent</a></h5> <ol> <li class="section-title"><a href="polymer_app_layout.behaviors/AnimationPlayerEvent-class.html#instance-properties">Properties</a></li> <li>bubbles </li> <li>cancelable </li> <li>clipboardData </li> <li>currentTarget </li> <li><a href="polymer_app_layout.behaviors/AnimationPlayerEvent/currentTime.html">currentTime</a> </li> <li>defaultPrevented </li> <li>eventPhase </li> <li>matchingTarget </li> <li>path </li> <li>target </li> <li><a href="polymer_app_layout.behaviors/AnimationPlayerEvent/timelineTime.html">timelineTime</a> </li> <li>timeStamp </li> <li>type </li> <li class="section-title"><a href="polymer_app_layout.behaviors/AnimationPlayerEvent-class.html#methods">Methods</a></li> <li>preventDefault </li> <li>stopImmediatePropagation </li> <li>stopPropagation </li> </ol> </div><!--/.sidebar-offcanvas--> <div class="col-xs-12 col-sm-9 col-md-6 main-content"> <section class="multi-line-signature"> <span class="returntype">double</span> <span class="name ">timelineTime</span> <div class="readable-writable"> read-only </div> </section> <section class="desc markdown"> <p class="no-docs">Not documented.</p> </section> </div> <!-- /.main-content --> </div> <!-- container --> <footer> <div class="container-fluid"> <div class="container"> <p class="text-center"> <span class="no-break"> polymer_app_layout_template 0.1.0 api docs </span> &bull; <span class="copyright no-break"> <a href="https://www.dartlang.org"> <img src="static-assets/favicon.png" alt="Dart" title="Dart"width="16" height="16"> </a> </span> &bull; <span class="copyright no-break"> <a href="http://creativecommons.org/licenses/by-sa/4.0/">cc license</a> </span> </p> </div> </div> </footer> <script src="static-assets/prettify.js"></script> <script src="static-assets/script.js"></script> <!-- Do not remove placeholder --> <!-- Footer Placeholder --> </body> </html>
{ "content_hash": "422358a7384723bbe8249c6ea3ad0f5e", "timestamp": "", "source": "github", "line_count": 160, "max_line_length": 150, "avg_line_length": 33.65, "alnum_prop": 0.5988112927191679, "repo_name": "lejard-h/polymer_app_layout_templates", "id": "9cdcfeaa6a2438b2e7350442b1b52cda0cb820cd", "size": "5384", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/api/polymer_app_layout.behaviors/AnimationPlayerEvent/timelineTime.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "2381" }, { "name": "Dart", "bytes": "25778" }, { "name": "HTML", "bytes": "17680" } ], "symlink_target": "" }
extern "C" JNIEXPORT void JNICALL Java_io_envoyproxy_envoymobile_engine_testing_QuicTestServer_nativeStartQuicTestServer( JNIEnv* env, jclass clazz) { jni_log("[QTS]", "starting server"); start_server(); } extern "C" JNIEXPORT jint JNICALL Java_io_envoyproxy_envoymobile_engine_testing_QuicTestServer_nativeGetServerPort(JNIEnv* env, jclass clazz) { jni_log("[QTS]", "getting server port"); return get_server_port(); } extern "C" JNIEXPORT void JNICALL Java_io_envoyproxy_envoymobile_engine_testing_QuicTestServer_nativeShutdownQuicTestServer( JNIEnv* env, jclass clazz) { jni_log("[QTS]", "shutting down server"); shutdown_server(); }
{ "content_hash": "464ff4fb2aa353751f7936197d7d7301", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 96, "avg_line_length": 36.95, "alnum_prop": 0.6698240866035182, "repo_name": "envoyproxy/envoy-mobile", "id": "f1c5581f2fc7affeb390b72cd30bfc0a319d9eb6", "size": "1014", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "test/common/jni/quic_test_server_jni_interface.cc", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "45954" }, { "name": "C++", "bytes": "865102" }, { "name": "HTML", "bytes": "513" }, { "name": "Java", "bytes": "1302889" }, { "name": "Kotlin", "bytes": "295246" }, { "name": "NASL", "bytes": "327095" }, { "name": "Objective-C", "bytes": "87555" }, { "name": "Python", "bytes": "53476" }, { "name": "Ruby", "bytes": "47" }, { "name": "Shell", "bytes": "10905" }, { "name": "Starlark", "bytes": "178188" }, { "name": "Swift", "bytes": "296398" } ], "symlink_target": "" }
// Code generated by injection-gen. DO NOT EDIT. package filtered import ( context "context" apisresolutionv1beta1 "github.com/tektoncd/pipeline/pkg/apis/resolution/v1beta1" versioned "github.com/tektoncd/pipeline/pkg/client/resolution/clientset/versioned" v1beta1 "github.com/tektoncd/pipeline/pkg/client/resolution/informers/externalversions/resolution/v1beta1" client "github.com/tektoncd/pipeline/pkg/client/resolution/injection/client" filtered "github.com/tektoncd/pipeline/pkg/client/resolution/injection/informers/factory/filtered" resolutionv1beta1 "github.com/tektoncd/pipeline/pkg/client/resolution/listers/resolution/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" cache "k8s.io/client-go/tools/cache" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" ) func init() { injection.Default.RegisterFilteredInformers(withInformer) injection.Dynamic.RegisterDynamicInformer(withDynamicInformer) } // Key is used for associating the Informer inside the context.Context. type Key struct { Selector string } func withInformer(ctx context.Context) (context.Context, []controller.Informer) { untyped := ctx.Value(filtered.LabelKey{}) if untyped == nil { logging.FromContext(ctx).Panic( "Unable to fetch labelkey from context.") } labelSelectors := untyped.([]string) infs := []controller.Informer{} for _, selector := range labelSelectors { f := filtered.Get(ctx, selector) inf := f.Resolution().V1beta1().ResolutionRequests() ctx = context.WithValue(ctx, Key{Selector: selector}, inf) infs = append(infs, inf.Informer()) } return ctx, infs } func withDynamicInformer(ctx context.Context) context.Context { untyped := ctx.Value(filtered.LabelKey{}) if untyped == nil { logging.FromContext(ctx).Panic( "Unable to fetch labelkey from context.") } labelSelectors := untyped.([]string) for _, selector := range labelSelectors { inf := &wrapper{client: client.Get(ctx), selector: selector} ctx = context.WithValue(ctx, Key{Selector: selector}, inf) } return ctx } // Get extracts the typed informer from the context. func Get(ctx context.Context, selector string) v1beta1.ResolutionRequestInformer { untyped := ctx.Value(Key{Selector: selector}) if untyped == nil { logging.FromContext(ctx).Panicf( "Unable to fetch github.com/tektoncd/pipeline/pkg/client/resolution/informers/externalversions/resolution/v1beta1.ResolutionRequestInformer with selector %s from context.", selector) } return untyped.(v1beta1.ResolutionRequestInformer) } type wrapper struct { client versioned.Interface namespace string selector string } var _ v1beta1.ResolutionRequestInformer = (*wrapper)(nil) var _ resolutionv1beta1.ResolutionRequestLister = (*wrapper)(nil) func (w *wrapper) Informer() cache.SharedIndexInformer { return cache.NewSharedIndexInformer(nil, &apisresolutionv1beta1.ResolutionRequest{}, 0, nil) } func (w *wrapper) Lister() resolutionv1beta1.ResolutionRequestLister { return w } func (w *wrapper) ResolutionRequests(namespace string) resolutionv1beta1.ResolutionRequestNamespaceLister { return &wrapper{client: w.client, namespace: namespace, selector: w.selector} } func (w *wrapper) List(selector labels.Selector) (ret []*apisresolutionv1beta1.ResolutionRequest, err error) { reqs, err := labels.ParseToRequirements(w.selector) if err != nil { return nil, err } selector = selector.Add(reqs...) lo, err := w.client.ResolutionV1beta1().ResolutionRequests(w.namespace).List(context.TODO(), v1.ListOptions{ LabelSelector: selector.String(), // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. }) if err != nil { return nil, err } for idx := range lo.Items { ret = append(ret, &lo.Items[idx]) } return ret, nil } func (w *wrapper) Get(name string) (*apisresolutionv1beta1.ResolutionRequest, error) { // TODO(mattmoor): Check that the fetched object matches the selector. return w.client.ResolutionV1beta1().ResolutionRequests(w.namespace).Get(context.TODO(), name, v1.GetOptions{ // TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria. }) }
{ "content_hash": "689b7fca9db3aca889537ba7bed796d0", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 185, "avg_line_length": 34.51639344262295, "alnum_prop": 0.7649014485870339, "repo_name": "tektoncd/pipeline", "id": "349589d6a16a852da0aac8f5379f909783f5c187", "size": "4775", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "pkg/client/resolution/injection/informers/resolution/v1beta1/resolutionrequest/filtered/resolutionrequest.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "282" }, { "name": "Go", "bytes": "5173860" }, { "name": "Makefile", "bytes": "5967" }, { "name": "Mustache", "bytes": "1078" }, { "name": "Shell", "bytes": "36398" }, { "name": "Smarty", "bytes": "3940" } ], "symlink_target": "" }
ALTER TABLE ATTRIBUTEVALUE DROP CONSTRAINT ATTVAL_ATT; ALTER TABLE ATTRIBUTEVALUE ADD CONSTRAINT ATTVAL_ATT FOREIGN KEY (ATTRIBUTE_ID) REFERENCES ATTRIBUTE(ID) ON DELETE CASCADE; ALTER TABLE ATTRIBUTEUSE DROP CONSTRAINT ATTUSE_SET; ALTER TABLE ATTRIBUTEUSE ADD CONSTRAINT ATTUSE_SET FOREIGN KEY (ATTRIBUTESET_ID) REFERENCES ATTRIBUTESET(ID) ON DELETE CASCADE; ALTER TABLE ATTRIBUTESETINSTANCE DROP CONSTRAINT ATTSETINST_SET; ALTER TABLE ATTRIBUTESETINSTANCE ADD CONSTRAINT ATTSETINST_SET FOREIGN KEY (ATTRIBUTESET_ID) REFERENCES ATTRIBUTESET(ID) ON DELETE CASCADE; ALTER TABLE ATTRIBUTEINSTANCE DROP CONSTRAINT ATTINST_SET; ALTER TABLE ATTRIBUTEINSTANCE ADD CONSTRAINT ATTINST_SET FOREIGN KEY (ATTRIBUTESETINSTANCE_ID) REFERENCES ATTRIBUTESETINSTANCE(ID) ON DELETE CASCADE; ALTER TABLE PRODUCTS ALTER COLUMN ISCOM DEFAULT 0; ALTER TABLE PRODUCTS ALTER COLUMN ISSCALE DEFAULT 0; ALTER TABLE TAXES ALTER COLUMN RATECASCADE DEFAULT 0; ALTER TABLE CUSTOMERS ALTER COLUMN VISIBLE DEFAULT 1; -- v2.30 - v2.30.1 ALTER TABLE TAXES ADD COLUMN VALIDFROM TIMESTAMP DEFAULT '2001-01-01 00:00:00' NOT NULL; -- v2.30.1 - v2.30.2 -- final script DELETE FROM SHAREDTICKETS; UPDATE APPLICATIONS SET NAME = $APP_NAME{}, VERSION = $APP_VERSION{} WHERE ID = $APP_ID{};
{ "content_hash": "954ce3f7f20e67fb8ac2d34fd7197334", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 149, "avg_line_length": 44.92857142857143, "alnum_prop": 0.809220985691574, "repo_name": "dante-mx/openbravopos", "id": "81025d48b4e1b5acee2bc6158372f9f39c2ddd97", "size": "2218", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src-pos/com/openbravo/pos/scripts/Derby-upgrade-2.30beta.sql", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "3681" }, { "name": "CSS", "bytes": "7138" }, { "name": "Groovy", "bytes": "7099" }, { "name": "HTML", "bytes": "3527" }, { "name": "Java", "bytes": "3597730" }, { "name": "JavaScript", "bytes": "30639" }, { "name": "Makefile", "bytes": "163" }, { "name": "PLSQL", "bytes": "122196" }, { "name": "Shell", "bytes": "55969" }, { "name": "XSLT", "bytes": "7153" } ], "symlink_target": "" }
#if defined(__APPLE__) || defined(__clang__) #import <Foundation/NSNumber_double_const_impl.h> #endif
{ "content_hash": "96f143f67f9d56f8e51aacfdd19ced7e", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 49, "avg_line_length": 20.8, "alnum_prop": 0.6826923076923077, "repo_name": "rafcabezas/glennganz-cocotron1-clang", "id": "760fc194d97c1d998636f0e7065569452f7f3a21", "size": "1169", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Foundation/NSNumber/NSNumber_double_const.m", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "45363" }, { "name": "C", "bytes": "1128538" }, { "name": "C++", "bytes": "104268" }, { "name": "D", "bytes": "13576236" }, { "name": "Matlab", "bytes": "41092" }, { "name": "Objective-C", "bytes": "8365414" }, { "name": "Shell", "bytes": "62271" } ], "symlink_target": "" }
package com.example.share.model; /** * * @author Xu * */ import java.io.Serializable; import java.util.ArrayList; import java.util.List; import android.graphics.Bitmap; public class User implements Serializable { /** * 用户名 */ private String mName; /** * 用户账号 */ private String mAccount; /** * 用户密码 */ private String mPassWord; /** * 用户头像 */ private Bitmap mLogo; /** * 用户性别 */ private String mSex; /** * 用户个人简介 */ private String mDescription; /** * 用户邮箱 */ private String mMail; /** * 用户发表过的文章 */ private List<ShareArticle> mArticles; /** * 用户发表过的评论 */ private List<Comment> mComments; private List<ShareArticle> mLikeArticles; public String getmName() { return mName; } public void setmName(String mName) { this.mName = mName; } public String getmAccount() { return mAccount; } public void setmAccount(String mAccount) { this.mAccount = mAccount; } public String getmPassWord() { return mPassWord; } public void setmPassWord(String mPassWord) { this.mPassWord = mPassWord; } public Bitmap getmLogo() { return mLogo; } public void setmLogo(Bitmap mLogo) { this.mLogo = mLogo; } public String getmSex() { return mSex; } public void setmSex(String mSex) { this.mSex = mSex; } public String getmDescription() { return mDescription; } public void setmDescription(String mDescription) { this.mDescription = mDescription; } public String getmMail() { return mMail; } public void setmMail(String mMail) { this.mMail = mMail; } public List<ShareArticle> getmArticles() { return mArticles; } public void setmArticles(List<ShareArticle> mArticles) { this.mArticles = mArticles; } public List<Comment> getmComments() { return mComments; } public void setmComments(List<Comment> mComments) { this.mComments = mComments; } public List<ShareArticle> getmLikeArticles() { return mLikeArticles; } public void setmLikeArticles(List<ShareArticle> mLikeArticles) { this.mLikeArticles = mLikeArticles; } }
{ "content_hash": "9f97d2c4f30ba09473b396e2c5c46f36", "timestamp": "", "source": "github", "line_count": 144, "max_line_length": 65, "avg_line_length": 14.32638888888889, "alnum_prop": 0.6820164808531265, "repo_name": "XuDeveloper/Share", "id": "d857b8536a89d99fb45e5ff4da79f457abd09145", "size": "2153", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/com/example/share/model/User.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "957" }, { "name": "Java", "bytes": "3988960" } ], "symlink_target": "" }
#ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdio.h> #ifdef HAVE_STRING_H #include <string.h> #endif #ifdef HAVE_STRINGS_H #include <strings.h> #endif #include <limits.h> #include "backendlib.h" #include "semantic.h" static int do_backups=1; void replace_char (char *s, char find, char replace) { while (*s != 0) { if (*s == find) *s = replace; s++; } } void rename_if_clash(char *origin) { char dest[PATH_MAX]; FILE *tmp; if (do_backups && (tmp = fopen(origin, "r")) != NULL) { fclose(tmp); printf("Warning: renaming file '%s' to '%s~'.\n", origin, origin); strncpy(dest, origin, PATH_MAX); strncat(dest, "~", PATH_MAX); rename(origin, dest); } } FILE *create_without_overwrite(char *origin) { FILE *tmp, *result; if (do_backups && (tmp = fopen(origin, "r")) != NULL) { fclose(tmp); printf("Warning: the file '%s' will not be overwritten.\n", origin); result = fopen("/dev/null", "w"); } else { result = fopen(origin, "w"); } return result; } char const *get_filename_base() { char *ext; static char name[PATH_MAX]; ext = strrchr(get_filename(), '.'); strncpy(name, get_filename(), ext - get_filename()); name[ext - get_filename()] = 0; return name; } void set_no_backups() { do_backups = 0; }
{ "content_hash": "5678501e21c5392d4f1339eafe82b51a", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 70, "avg_line_length": 16.08641975308642, "alnum_prop": 0.6062931696085956, "repo_name": "ElsevierSoftwareX/SOFTX-D-15-00010", "id": "b3c985c23905516ab0ef5908871e9f88c5dbac0c", "size": "1945", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "compss/compss-rt/bindings/c/src/gsstubgen/backendlib.c", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "2531" }, { "name": "Awk", "bytes": "1595" }, { "name": "Batchfile", "bytes": "1670" }, { "name": "C", "bytes": "4941504" }, { "name": "C++", "bytes": "408857" }, { "name": "CSS", "bytes": "891" }, { "name": "Cuda", "bytes": "6007" }, { "name": "FORTRAN", "bytes": "30067" }, { "name": "Groff", "bytes": "2711134" }, { "name": "HTML", "bytes": "697226" }, { "name": "Java", "bytes": "1521958" }, { "name": "LLVM", "bytes": "395" }, { "name": "Lex", "bytes": "1302" }, { "name": "Makefile", "bytes": "170603" }, { "name": "Objective-C", "bytes": "12681" }, { "name": "Perl", "bytes": "20596" }, { "name": "Perl6", "bytes": "1505" }, { "name": "Python", "bytes": "86044" }, { "name": "Shell", "bytes": "4004714" }, { "name": "TeX", "bytes": "67803" }, { "name": "XSLT", "bytes": "177323" }, { "name": "Yacc", "bytes": "3465" } ], "symlink_target": "" }
// // UIScrollView+JWGifRefresh.m // NewVipxox // // Created by Tian Wei You on 16/9/8. // Copyright © 2016年 WeiJiang. All rights reserved. // #import "UIScrollView+JWGifRefresh.h" @implementation UIScrollView (JWGifRefresh) /** * 下拉刷新动画 * @param imageName 图片名 * @param imageCount 图片数量 * * @return 刷新Header */ + (MJRefreshGifHeader *)scrollRefreshGifHeaderWithImgName:(NSString *)imageName withImageCount:(NSInteger)imageCount withRefreshBlock:(MJRefreshComponentRefreshingBlock)refreshBlock{ MJRefreshGifHeader * gifHeader = [[MJRefreshGifHeader alloc]init]; gifHeader.refreshingBlock = refreshBlock; gifHeader.lastUpdatedTimeLabel.hidden= YES; gifHeader.stateLabel.hidden = YES; NSMutableArray * headerImagesIdle = [NSMutableArray arrayWithCapacity:0]; NSMutableArray * headerImagesPulling = [NSMutableArray arrayWithCapacity:0]; NSMutableArray * headerImagesRefreshing = [NSMutableArray arrayWithCapacity:0]; for (int i = 0; i < imageCount; i++) { if (i<18) { [headerImagesIdle addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%@%zi",imageName,i]]]; }else if (i<38){ [headerImagesPulling addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%@%zi",imageName,i]]]; }else { [headerImagesRefreshing addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%@%zi",imageName,i]]]; } } [gifHeader setImages:headerImagesIdle duration:(headerImagesIdle.count*0.05) forState:MJRefreshStateIdle]; [gifHeader setImages:headerImagesPulling duration:(headerImagesPulling.count*0.05) forState:MJRefreshStatePulling]; [gifHeader setImages:headerImagesRefreshing duration:(headerImagesRefreshing.count*0.05) forState:MJRefreshStateRefreshing]; return gifHeader; } /** * 上拉刷新动画 * @param imageName 图片名 * @param imageCount 图片数量 * * @return 刷新Header */ + (MJRefreshAutoGifFooter *)scrollRefreshGifFooterWithImgName:(NSString *)imageName withImageCount:(NSInteger)imageCount withRefreshBlock:(MJRefreshComponentRefreshingBlock)refreshBlock{ MJRefreshAutoGifFooter * gifFooter = [[MJRefreshAutoGifFooter alloc]init]; gifFooter.refreshingBlock = refreshBlock; gifFooter.stateLabel.hidden = YES; gifFooter.refreshingTitleHidden = YES; NSMutableArray * footerImagesIdle = [NSMutableArray arrayWithCapacity:0]; NSMutableArray * footerImagesPulling = [NSMutableArray arrayWithCapacity:0]; NSMutableArray * footerImagesRefreshing = [NSMutableArray arrayWithCapacity:0]; for (int i = 0; i < imageCount; i++) { if (i>=16) { [footerImagesRefreshing addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%@%zi",imageName,i]]]; } } for (int i = 14; i >= 0; i--) { if (i < 8||i>10) { [footerImagesRefreshing addObject:[UIImage imageNamed:[NSString stringWithFormat:@"%@%zi",imageName,i]]]; } } [gifFooter setImages:footerImagesIdle duration:(footerImagesIdle.count*0.05) forState:MJRefreshStateIdle]; [gifFooter setImages:footerImagesPulling duration:(footerImagesPulling.count*0.05) forState:MJRefreshStatePulling]; [gifFooter setImages:footerImagesRefreshing duration:(footerImagesRefreshing.count*0.05) forState:MJRefreshStateRefreshing]; return gifFooter; } @end
{ "content_hash": "eacbf408bc26f837dbc3cc86f5b86ea3", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 186, "avg_line_length": 44.36, "alnum_prop": 0.7345957318905921, "repo_name": "ShangDuRuiORG/DuRuiYvWaShop", "id": "2e1cf21e48fdc7749f518b5dcfe1d781780f8a57", "size": "3390", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "YuWaShop/YuWaShop/Discover/RBTools/Category/UIScrollView+JWGifRefresh.m", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "6899" }, { "name": "Objective-C", "bytes": "3149049" } ], "symlink_target": "" }
nsjam is a tool to visualise namespaces on a running system. The name comes from (Name)Space Jam. ## Contributing nsjam is open to any contributions! ### Getting started `git clone https://github.com/williammartin/nsjam.git` ### Development guidelines nsjam is written in a BDD manner using the Ginkgo testing library for Go. It would be appreciated if any code contributions were well tested. ### Running the tests The `marley` (of the Bob) suite contains the acceptance tests for nsjam `ginkgo -r` and voila! ### Building nsjam `go build` and voila!
{ "content_hash": "88fe12f74513b08885e732288fa97332", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 141, "avg_line_length": 31, "alnum_prop": 0.7616487455197133, "repo_name": "williammartin/nsjam", "id": "d8521c48f82ba76b6456d67857ef7406f4022bf7", "size": "566", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "4424" }, { "name": "Shell", "bytes": "735" } ], "symlink_target": "" }
package com.zimbra.cs.service.admin; import java.util.Map; import com.zimbra.common.service.ServiceException; import com.zimbra.common.soap.AdminConstants; import com.zimbra.common.soap.Element; import com.zimbra.common.util.ZimbraLog; import com.zimbra.cs.memcached.MemcachedConnector; import com.zimbra.soap.ZimbraSoapContext; public class ReloadMemcachedClientConfig extends AdminDocumentHandler { @Override public Element handle(Element request, Map<String, Object> context) throws ServiceException { ZimbraLog.misc.info("Reloading memcached client configuration"); MemcachedConnector.reloadConfig(); ZimbraSoapContext zsc = getZimbraSoapContext(context); Element response = zsc.createElement(AdminConstants.RELOAD_MEMCACHED_CLIENT_CONFIG_RESPONSE); return response; } }
{ "content_hash": "f5c6bd8fd8919e50ce971c2f56f8a5f8", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 107, "avg_line_length": 36.04347826086956, "alnum_prop": 0.7852834740651388, "repo_name": "nico01f/z-pec", "id": "09db139229d1d6c7c60b4051b61239aa3ab8242d", "size": "1368", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ZimbraServer/src/java/com/zimbra/cs/service/admin/ReloadMemcachedClientConfig.java", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "18110" }, { "name": "C", "bytes": "61139" }, { "name": "C#", "bytes": "1461640" }, { "name": "C++", "bytes": "723279" }, { "name": "CSS", "bytes": "2648118" }, { "name": "Groff", "bytes": "15389" }, { "name": "HTML", "bytes": "83875860" }, { "name": "Java", "bytes": "49998455" }, { "name": "JavaScript", "bytes": "39307223" }, { "name": "Makefile", "bytes": "13060" }, { "name": "PHP", "bytes": "4263" }, { "name": "PLSQL", "bytes": "17047" }, { "name": "Perl", "bytes": "2030870" }, { "name": "PowerShell", "bytes": "1485" }, { "name": "Python", "bytes": "129210" }, { "name": "Shell", "bytes": "575209" }, { "name": "XSLT", "bytes": "20635" } ], "symlink_target": "" }
#ifndef __USBREDIRPARSER_H #define __USBREDIRPARSER_H #include "usbredirproto.h" #ifdef __cplusplus extern "C" { #endif struct usbredirparser; struct usbredirfilter_rule; /* Called by a usbredirparser to log various messages */ enum { usbredirparser_none, usbredirparser_error, usbredirparser_warning, usbredirparser_info, usbredirparser_debug, usbredirparser_debug_data }; typedef void (*usbredirparser_log)(void *priv, int level, const char *msg); /* Called by a usbredirparser to read/write data to its peer. Must return the amount of bytes read/written, 0 when the read/write would block (and this is undesirable) and -1 on error. If the usbredirparser_fl_write_cb_owns_buffer flag is passed to usbredirparser_init, then the usbredirparser_write callback becomes the owner of the buffer pointed to by data and should call usbredirparser_free_write_buffer() when it is done with the buffer. In this case the callback is not allowed to return any amount of bytes written, it must either accept the entire buffer (return count), or signal blocking (return 0) or error (return -1). Returning any other value will result in a call to abort(). */ typedef int (*usbredirparser_read)(void *priv, uint8_t *data, int count); typedef int (*usbredirparser_write)(void *priv, uint8_t *data, int count); /* Locking functions for use by multithread apps */ typedef void *(*usbredirparser_alloc_lock)(void); typedef void (*usbredirparser_lock)(void *lock); typedef void (*usbredirparser_unlock)(void *lock); typedef void (*usbredirparser_free_lock)(void *lock); /* The below callbacks are called when a complete packet of the relevant type has been received. Note that the passed in packet-type-specific-header's lifetime is only guarenteed to be that of the callback. Control packets: */ typedef void (*usbredirparser_hello)(void *priv, struct usb_redir_hello_header *hello); typedef void (*usbredirparser_device_connect)(void *priv, struct usb_redir_device_connect_header *device_connect); typedef void (*usbredirparser_device_disconnect)(void *priv); typedef void (*usbredirparser_reset)(void *priv); typedef void (*usbredirparser_interface_info)(void *priv, struct usb_redir_interface_info_header *interface_info); typedef void (*usbredirparser_ep_info)(void *priv, struct usb_redir_ep_info_header *ep_info); typedef void (*usbredirparser_set_configuration)(void *priv, uint64_t id, struct usb_redir_set_configuration_header *set_configuration); typedef void (*usbredirparser_get_configuration)(void *priv, uint64_t id); typedef void (*usbredirparser_configuration_status)(void *priv, uint64_t id, struct usb_redir_configuration_status_header *configuration_status); typedef void (*usbredirparser_set_alt_setting)(void *priv, uint64_t id, struct usb_redir_set_alt_setting_header *set_alt_setting); typedef void (*usbredirparser_get_alt_setting)(void *priv, uint64_t id, struct usb_redir_get_alt_setting_header *get_alt_setting); typedef void (*usbredirparser_alt_setting_status)(void *priv, uint64_t id, struct usb_redir_alt_setting_status_header *alt_setting_status); typedef void (*usbredirparser_start_iso_stream)(void *priv, uint64_t id, struct usb_redir_start_iso_stream_header *start_iso_stream); typedef void (*usbredirparser_stop_iso_stream)(void *priv, uint64_t id, struct usb_redir_stop_iso_stream_header *stop_iso_stream); typedef void (*usbredirparser_iso_stream_status)(void *priv, uint64_t id, struct usb_redir_iso_stream_status_header *iso_stream_status); typedef void (*usbredirparser_start_interrupt_receiving)(void *priv, uint64_t id, struct usb_redir_start_interrupt_receiving_header *start_interrupt_receiving); typedef void (*usbredirparser_stop_interrupt_receiving)(void *priv, uint64_t id, struct usb_redir_stop_interrupt_receiving_header *stop_interrupt_receiving); typedef void (*usbredirparser_interrupt_receiving_status)(void *priv, uint64_t id, struct usb_redir_interrupt_receiving_status_header *interrupt_receiving_status); typedef void (*usbredirparser_alloc_bulk_streams)(void *priv, uint64_t id, struct usb_redir_alloc_bulk_streams_header *alloc_bulk_streams); typedef void (*usbredirparser_free_bulk_streams)(void *priv, uint64_t id, struct usb_redir_free_bulk_streams_header *free_bulk_streams); typedef void (*usbredirparser_bulk_streams_status)(void *priv, uint64_t id, struct usb_redir_bulk_streams_status_header *bulk_streams_status); typedef void (*usbredirparser_cancel_data_packet)(void *priv, uint64_t id); typedef void (*usbredirparser_filter_reject)(void *priv); /* Note that the ownership of the rules array is passed on to the callback. */ typedef void (*usbredirparser_filter_filter)(void *priv, struct usbredirfilter_rule *rules, int rules_count); typedef void (*usbredirparser_device_disconnect_ack)(void *priv); typedef void (*usbredirparser_start_bulk_receiving)(void *priv, uint64_t id, struct usb_redir_start_bulk_receiving_header *start_bulk_receiving); typedef void (*usbredirparser_stop_bulk_receiving)(void *priv, uint64_t id, struct usb_redir_stop_bulk_receiving_header *stop_bulk_receiving); typedef void (*usbredirparser_bulk_receiving_status)(void *priv, uint64_t id, struct usb_redir_bulk_receiving_status_header *bulk_receiving_status); /* Data packets: Note that ownership of the the data buffer (if not NULL) is passed on to the callback. The callback should free it by calling usbredirparser_free_packet_data when it is done with it. */ typedef void (*usbredirparser_control_packet)(void *priv, uint64_t id, struct usb_redir_control_packet_header *control_header, uint8_t *data, int data_len); typedef void (*usbredirparser_bulk_packet)(void *priv, uint64_t id, struct usb_redir_bulk_packet_header *bulk_header, uint8_t *data, int data_len); typedef void (*usbredirparser_iso_packet)(void *priv, uint64_t id, struct usb_redir_iso_packet_header *iso_header, uint8_t *data, int data_len); typedef void (*usbredirparser_interrupt_packet)(void *priv, uint64_t id, struct usb_redir_interrupt_packet_header *interrupt_header, uint8_t *data, int data_len); typedef void (*usbredirparser_buffered_bulk_packet)(void *priv, uint64_t id, struct usb_redir_buffered_bulk_packet_header *buffered_bulk_header, uint8_t *data, int data_len); /* Public part of the data allocated by usbredirparser_alloc, *never* allocate a usbredirparser struct yourself, it may be extended in the future to add callbacks for new packet types (which will then get added at the end), *and* usbredirparser_alloc will also alloc some space behind it for private data */ struct usbredirparser { /* app private data passed into all callbacks as the priv argument */ void *priv; /* non packet callbacks */ usbredirparser_log log_func; usbredirparser_read read_func; usbredirparser_write write_func; /* usb-redir-protocol v0.3 control packet complete callbacks */ usbredirparser_device_connect device_connect_func; usbredirparser_device_disconnect device_disconnect_func; usbredirparser_reset reset_func; usbredirparser_interface_info interface_info_func; usbredirparser_ep_info ep_info_func; usbredirparser_set_configuration set_configuration_func; usbredirparser_get_configuration get_configuration_func; usbredirparser_configuration_status configuration_status_func; usbredirparser_set_alt_setting set_alt_setting_func; usbredirparser_get_alt_setting get_alt_setting_func; usbredirparser_alt_setting_status alt_setting_status_func; usbredirparser_start_iso_stream start_iso_stream_func; usbredirparser_stop_iso_stream stop_iso_stream_func; usbredirparser_iso_stream_status iso_stream_status_func; usbredirparser_start_interrupt_receiving start_interrupt_receiving_func; usbredirparser_stop_interrupt_receiving stop_interrupt_receiving_func; usbredirparser_interrupt_receiving_status interrupt_receiving_status_func; usbredirparser_alloc_bulk_streams alloc_bulk_streams_func; usbredirparser_free_bulk_streams free_bulk_streams_func; usbredirparser_bulk_streams_status bulk_streams_status_func; usbredirparser_cancel_data_packet cancel_data_packet_func; /* usb-redir-protocol v0.3 data packet complete callbacks */ usbredirparser_control_packet control_packet_func; usbredirparser_bulk_packet bulk_packet_func; usbredirparser_iso_packet iso_packet_func; usbredirparser_interrupt_packet interrupt_packet_func; /* usbredir 0.3.2 new non packet callbacks (for multi-thread locking) */ usbredirparser_alloc_lock alloc_lock_func; usbredirparser_lock lock_func; usbredirparser_unlock unlock_func; usbredirparser_free_lock free_lock_func; /* usbredir 0.3.2 new control packet complete callbacks */ usbredirparser_hello hello_func; /* usbredir 0.4 new control packet complete callbacks */ usbredirparser_filter_reject filter_reject_func; usbredirparser_filter_filter filter_filter_func; usbredirparser_device_disconnect_ack device_disconnect_ack_func; /* usbredir 0.6 new control packet complete callbacks */ usbredirparser_start_bulk_receiving start_bulk_receiving_func; usbredirparser_stop_bulk_receiving stop_bulk_receiving_func; usbredirparser_bulk_receiving_status bulk_receiving_status_func; /* usbredir 0.6 new data packet complete callbacks */ usbredirparser_buffered_bulk_packet buffered_bulk_packet_func; }; /* Allocate a usbredirparser, after this the app should set the callback app private data and all the callbacks it needs, before calling usbredirparser_init */ struct usbredirparser *usbredirparser_create(void); /* Set capability cap in the USB_REDIR_CAPS_SIZE sized caps array, this is a helper function to set capabilities in the caps array passed to usbredirparser_init(). */ void usbredirparser_caps_set_cap(uint32_t *caps, int cap); /* Init the parser, this will queue an initial usb_redir_hello packet, sending the version and caps to the peer, as well as configure the parsing according to the passed in flags. */ enum { usbredirparser_fl_usb_host = 0x01, usbredirparser_fl_write_cb_owns_buffer = 0x02, usbredirparser_fl_no_hello = 0x04, }; void usbredirparser_init(struct usbredirparser *parser, const char *version, uint32_t *caps, int caps_len, int flags); void usbredirparser_destroy(struct usbredirparser *parser); /* See if our side has a certain cap (checks the caps passed into _init) */ int usbredirparser_have_cap(struct usbredirparser *parser, int cap); /* Check if we've received the caps from the peer */ int usbredirparser_have_peer_caps(struct usbredirparser *parser); /* Check if our peer has a certain capability. Note this function should not be used before the hello_func callback has been called. */ int usbredirparser_peer_has_cap(struct usbredirparser *parser, int cap); /* Call this whenever there is data ready from the otherside to parse On an usbredirparser_read_io_error this function will continue where it left of the last time on the next call. On an usbredirparser_read_parse_error it will skip to the next packet (*). *) As determined by the faulty's package headers length field */ enum { usbredirparser_read_io_error = -1, usbredirparser_read_parse_error = -2, }; int usbredirparser_do_read(struct usbredirparser *parser); /* This returns the number of usbredir packets queued up for writing */ int usbredirparser_has_data_to_write(struct usbredirparser *parser); /* Call this when usbredirparser_has_data_to_write returns > 0 returns 0 on success, -1 if a write error happened. If a write error happened, this function will retry writing any queued data on the next call, and will continue doing so until it has succeeded! */ enum { usbredirparser_write_io_error = -1, }; int usbredirparser_do_write(struct usbredirparser *parser); /* See usbredirparser_write documentation */ void usbredirparser_free_write_buffer(struct usbredirparser *parser, uint8_t *data); /* See the data packet callbacks documentation */ void usbredirparser_free_packet_data(struct usbredirparser *parser, uint8_t *data); /* Functions to marshall and queue a packet for sending to its peer. Note: 1) it will not be actually send until usbredirparser_do_write is called 2) if their is not enough memory for buffers the packet will be dropped (and an error message will be logged */ /* Control packets: */ /* Note this function should not be used before the hello_func callback has been called (as it checks the usb_redir_cap_connect_device_version cap). */ void usbredirparser_send_device_connect(struct usbredirparser *parser, struct usb_redir_device_connect_header *device_connect); void usbredirparser_send_device_disconnect(struct usbredirparser *parser); void usbredirparser_send_reset(struct usbredirparser *parser); void usbredirparser_send_interface_info(struct usbredirparser *parser, struct usb_redir_interface_info_header *interface_info); void usbredirparser_send_ep_info(struct usbredirparser *parser, struct usb_redir_ep_info_header *ep_info); void usbredirparser_send_set_configuration(struct usbredirparser *parser, uint64_t id, struct usb_redir_set_configuration_header *set_configuration); void usbredirparser_send_get_configuration(struct usbredirparser *parser, uint64_t id); void usbredirparser_send_configuration_status(struct usbredirparser *parser, uint64_t id, struct usb_redir_configuration_status_header *configuration_status); void usbredirparser_send_set_alt_setting(struct usbredirparser *parser, uint64_t id, struct usb_redir_set_alt_setting_header *set_alt_setting); void usbredirparser_send_get_alt_setting(struct usbredirparser *parser, uint64_t id, struct usb_redir_get_alt_setting_header *get_alt_setting); void usbredirparser_send_alt_setting_status(struct usbredirparser *parser, uint64_t id, struct usb_redir_alt_setting_status_header *alt_setting_status); void usbredirparser_send_start_iso_stream(struct usbredirparser *parser, uint64_t id, struct usb_redir_start_iso_stream_header *start_iso_stream); void usbredirparser_send_stop_iso_stream(struct usbredirparser *parser, uint64_t id, struct usb_redir_stop_iso_stream_header *stop_iso_stream); void usbredirparser_send_iso_stream_status(struct usbredirparser *parser, uint64_t id, struct usb_redir_iso_stream_status_header *iso_stream_status); void usbredirparser_send_start_interrupt_receiving(struct usbredirparser *parser, uint64_t id, struct usb_redir_start_interrupt_receiving_header *start_interrupt_receiving); void usbredirparser_send_stop_interrupt_receiving(struct usbredirparser *parser, uint64_t id, struct usb_redir_stop_interrupt_receiving_header *stop_interrupt_receiving); void usbredirparser_send_interrupt_receiving_status(struct usbredirparser *parser, uint64_t id, struct usb_redir_interrupt_receiving_status_header *interrupt_receiving_status); void usbredirparser_send_alloc_bulk_streams(struct usbredirparser *parser, uint64_t id, struct usb_redir_alloc_bulk_streams_header *alloc_bulk_streams); void usbredirparser_send_free_bulk_streams(struct usbredirparser *parser, uint64_t id, struct usb_redir_free_bulk_streams_header *free_bulk_streams); void usbredirparser_send_bulk_streams_status(struct usbredirparser *parser, uint64_t id, struct usb_redir_bulk_streams_status_header *bulk_streams_status); void usbredirparser_send_cancel_data_packet(struct usbredirparser *parser, uint64_t id); void usbredirparser_send_filter_reject(struct usbredirparser *parser); void usbredirparser_send_filter_filter(struct usbredirparser *parser, const struct usbredirfilter_rule *rules, int rules_count); void usbredirparser_send_start_bulk_receiving(struct usbredirparser *parser, uint64_t id, struct usb_redir_start_bulk_receiving_header *start_bulk_receiving); void usbredirparser_send_stop_bulk_receiving(struct usbredirparser *parser, uint64_t id, struct usb_redir_stop_bulk_receiving_header *stop_bulk_receiving); void usbredirparser_send_bulk_receiving_status(struct usbredirparser *parser, uint64_t id, struct usb_redir_bulk_receiving_status_header *bulk_receiving_status); /* Data packets: */ void usbredirparser_send_control_packet(struct usbredirparser *parser, uint64_t id, struct usb_redir_control_packet_header *control_header, uint8_t *data, int data_len); void usbredirparser_send_bulk_packet(struct usbredirparser *parser, uint64_t id, struct usb_redir_bulk_packet_header *bulk_header, uint8_t *data, int data_len); void usbredirparser_send_iso_packet(struct usbredirparser *parser, uint64_t id, struct usb_redir_iso_packet_header *iso_header, uint8_t *data, int data_len); void usbredirparser_send_interrupt_packet(struct usbredirparser *parser, uint64_t id, struct usb_redir_interrupt_packet_header *interrupt_header, uint8_t *data, int data_len); void usbredirparser_send_buffered_bulk_packet(struct usbredirparser *parser, uint64_t id, struct usb_redir_buffered_bulk_packet_header *buffered_bulk_header, uint8_t *data, int data_len); /* Serialization */ /* This function serializes the current usbredirparser state. It will allocate a large enough buffer for this itself and store this in state_dest, it will store the size of this buffer in state_len. Return value: 0 on success, -1 on error (out of memory). The buffer should be free-ed by the caller using free(). */ int usbredirparser_serialize(struct usbredirparser *parser, uint8_t **state_dest, int *state_len); /* This function sets the current usbredirparser state from a serialized state. This function assumes that the parser has just been initialized with the usbredirparser_fl_no_hello flag. Return value: 0 on success, -1 on error (out of memory, or invalid state data). */ int usbredirparser_unserialize(struct usbredirparser *parser_pub, uint8_t *state, int len); #ifdef __cplusplus } #endif #endif
{ "content_hash": "77a5d0eb61fb53e32d70399e904478a4", "timestamp": "", "source": "github", "line_count": 367, "max_line_length": 97, "avg_line_length": 49.89645776566758, "alnum_prop": 0.7590104849279161, "repo_name": "x-hansong/aSpice", "id": "ffeb1d7b156978d928b519fad45646e4dffded5d", "size": "19136", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "jni/libs/deps/include/usbredirparser/usbredirparser.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "4282962" }, { "name": "C++", "bytes": "121539" }, { "name": "Java", "bytes": "1519371" }, { "name": "Makefile", "bytes": "5040" }, { "name": "Objective-C", "bytes": "30362" }, { "name": "Perl", "bytes": "12169" }, { "name": "Shell", "bytes": "213" } ], "symlink_target": "" }
from __future__ import unicode_literals from django.db import migrations from django.db import models class Migration(migrations.Migration): dependencies = [ ('orchestra', '0020_auto_20151028_1559'), ('orchestra', '0020_auto_20151022_1553'), ] operations = [ ]
{ "content_hash": "afaa4bbeb29194ff76a4732f14f4428e", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 49, "avg_line_length": 19.866666666666667, "alnum_prop": 0.6577181208053692, "repo_name": "b12io/orchestra", "id": "4dd2ae4ac20343962ccdea8b785a59d8d962afa2", "size": "322", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "orchestra/migrations/0021_merge.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "50496" }, { "name": "HTML", "bytes": "101830" }, { "name": "JavaScript", "bytes": "353673" }, { "name": "Makefile", "bytes": "1234" }, { "name": "Python", "bytes": "975395" }, { "name": "SCSS", "bytes": "32860" }, { "name": "Shell", "bytes": "26" }, { "name": "TypeScript", "bytes": "20983" } ], "symlink_target": "" }
package org.wso2.carbon.user.mgt.ui; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.identity.core.model.IdentityEventListenerConfig; import org.wso2.carbon.identity.core.util.IdentityUtil; import org.wso2.carbon.user.core.listener.UserOperationEventListener; import org.wso2.carbon.user.mgt.stub.types.carbon.FlaggedName; import org.wso2.carbon.user.mgt.stub.types.carbon.UserRealmInfo; import org.wso2.carbon.user.mgt.stub.types.carbon.UserStoreInfo; import org.wso2.carbon.utils.DataPaginator; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Properties; import javax.activation.DataHandler; import javax.mail.util.ByteArrayDataSource; public class Util { public static final String ALL = "ALL"; private static final Log log = LogFactory.getLog(Util.class); private static boolean isAskPasswordEnabled = true; static { InputStream is = null; try { boolean identityMgtListenerEnabled = true; IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty( UserOperationEventListener.class.getName(), "org.wso2.carbon.identity.mgt.IdentityMgtEventListener"); if (identityEventListenerConfig != null) { identityMgtListenerEnabled = Boolean.parseBoolean(identityEventListenerConfig.getEnable()); } if(identityMgtListenerEnabled){ File file = new File(IdentityUtil.getIdentityConfigDirPath() + "/identity-mgt.properties"); if(file.exists() && file.isFile()) { is = new FileInputStream(file); Properties identityMgtProperties = new Properties(); identityMgtProperties.load(is); boolean tempPasswordEnabled = Boolean.parseBoolean(identityMgtProperties.getProperty("Temporary" + ".Password.Enable")); boolean acctVerificationEnabled = Boolean.parseBoolean(identityMgtProperties.getProperty ("UserAccount.Verification.Enable")); if(!tempPasswordEnabled || !acctVerificationEnabled){ isAskPasswordEnabled = false; } } else { isAskPasswordEnabled = false; } } else { isAskPasswordEnabled = false; } } catch (FileNotFoundException e) { if(log.isDebugEnabled()){ log.debug("identity-mgt.properties file not found in " + IdentityUtil.getIdentityConfigDirPath()); } isAskPasswordEnabled = false; } catch (IOException e) { log.error("Error while reading identity-mgt.properties file"); } finally { if(is != null){ try { is.close(); } catch (IOException e) { log.error("Error occurred while closing the FileInputStream for identity-mgt.properties"); } } } } private Util() { } public static String getDN(String roleName, int index, FlaggedName[] names) { if (names != null && names.length > index) { return names[index].getDn(); } return null; } public static UserStoreInfo getUserStoreInfo(String domainName, UserRealmInfo realmInfo) { for (UserStoreInfo info : realmInfo.getUserStoresInfo()) { if (domainName != null && domainName.equalsIgnoreCase(info.getDomainName())) { return info; } } return null; } public static UserStoreInfo getUserStoreInfoForUser(String userName, UserRealmInfo realmInfo) { if (userName.contains("/")) { String domainName = userName.substring(0, userName.indexOf("/")); for (UserStoreInfo info : realmInfo.getUserStoresInfo()) { if (domainName != null && domainName.equalsIgnoreCase(info.getDomainName())) { return info; } } } return realmInfo.getPrimaryUserStoreInfo(); } public static DataHandler buildDataHandler(byte[] content) { DataHandler dataHandler = new DataHandler(new ByteArrayDataSource(content, "application/octet-stream")); return dataHandler; } public static PaginatedNamesBean retrievePaginatedFlaggedName(int pageNumber, String[] names) { List<FlaggedName> list = new ArrayList<>(); FlaggedName flaggedName; for (String name : names) { flaggedName = new FlaggedName(); flaggedName.setItemName(name); list.add(flaggedName); } return retrievePaginatedFlaggedName(pageNumber, list); } public static PaginatedNamesBean retrievePaginatedFlaggedName(int pageNumber, List<FlaggedName> names) { PaginatedNamesBean bean = new PaginatedNamesBean(); DataPaginator.doPaging(pageNumber, names, bean); return bean; } public static void updateCheckboxStateMap(Map<String, Boolean> checkBoxMap, Map<Integer, PaginatedNamesBean> flaggedNamesMap, String selectedBoxesStr, String unselectedBoxesStr, String regex) { if (selectedBoxesStr != null || unselectedBoxesStr != null) { if (selectedBoxesStr != null && ALL.equals(selectedBoxesStr) || unselectedBoxesStr != null && ALL.equals(unselectedBoxesStr)) { if (selectedBoxesStr != null && ALL.equals(selectedBoxesStr) && flaggedNamesMap != null) { for (int key : flaggedNamesMap.keySet()) { FlaggedName[] flaggedNames = flaggedNamesMap.get(key).getNames(); for (FlaggedName flaggedName : flaggedNames) { if (flaggedName.getEditable()) { checkBoxMap.put(flaggedName.getItemName(), true); } } } } if (unselectedBoxesStr != null && ALL.equals(unselectedBoxesStr) && flaggedNamesMap != null) { for (int key : flaggedNamesMap.keySet()) { FlaggedName[] flaggedNames = flaggedNamesMap.get(key).getNames(); for (FlaggedName flaggedName : flaggedNames) { if (flaggedName.getEditable()) { checkBoxMap.put(flaggedName.getItemName(), false); } } } } return; } if (selectedBoxesStr != null && !"".equals(selectedBoxesStr)) { String[] selectedBoxes = selectedBoxesStr.split(regex); for (String selectedBox : selectedBoxes) { checkBoxMap.put(selectedBox, true); } } if (unselectedBoxesStr != null && !"".equals(unselectedBoxesStr)) { String[] unselectedBoxes = unselectedBoxesStr.split(regex); for (String unselectedBox : unselectedBoxes) { checkBoxMap.put(unselectedBox, false); } } } } public static boolean isAskPasswordEnabled(){ return isAskPasswordEnabled; } }
{ "content_hash": "d2c325ec3b96b9026a85c65ab2109158", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 139, "avg_line_length": 40.65079365079365, "alnum_prop": 0.5939086294416244, "repo_name": "nuwandi-is/identity-framework", "id": "e4a18fefa78028ac2c0bdefa3f0b5d67691e2a38", "size": "8363", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "components/user-mgt/org.wso2.carbon.user.mgt.ui/src/main/java/org/wso2/carbon/user/mgt/ui/Util.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "117871" }, { "name": "HTML", "bytes": "78224" }, { "name": "Java", "bytes": "9456745" }, { "name": "JavaScript", "bytes": "473754" }, { "name": "PLSQL", "bytes": "70461" }, { "name": "Thrift", "bytes": "338" }, { "name": "XSLT", "bytes": "1030" } ], "symlink_target": "" }
layout: page title: Now --- This page contains a quick overview of what I'm doing right now. I try to update it every couple of months. Last updated: October 5, 2022. You can see the full history of this page [here](https://github.com/clintonboys/clintonboys.github.io/commits/master/now/index.md). --- ### Work I've been working at [Via](http://ridewithvia.com) since August 2018, doing all sorts of different stuff: algorithms, data science, and lately a lot more software engineering and web development, even some front-end stuff with React in Typescript. ### Digital garden Like I wrote last time, my [digital garden](https://mtsolitary.com) continues to grow into something I am proud of. ### ECS and game development As a bit of a distraction from my usual set of side projects focussed on data and elections that are documented on this site, I have been dipping my toe in the world of game development, specifically in Rust because I think it is a very interesting language to learn, and specifically using the Entity Component System paradigm, which is a neat way to reprogram one's object-oriented-brainwashed brain. ### Life - My daughter was born in June and we have been spending a lot of quiet time together at home. - We spent ten days in Nice, France over the late summer. A beautiful part of the world. - Overall I am spending very little time hacking away at side projects lately, trying to take a bit more care of myself and take things slowly. Productivity is important and interesting but it can also be addictive and consuming and it's important to remember that living your life is enough. #### Books - *Why Smart People Hurt* by Eric Maisel. - *The Rust Programming Language* by Kablik and Nichols. #### Music - *High School* by Tim Heidecker. - *A Light for Attracting Attention* by The Smile. - *Boat Songs* by MJ Lenderman.
{ "content_hash": "0fd68bf7f943c632628324523c5e0413", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 403, "avg_line_length": 49.39473684210526, "alnum_prop": 0.7613212573255195, "repo_name": "clintonboys/clintonboys.github.io", "id": "88f7894dd3d26486d91ce00438316f69dc6b8130", "size": "1881", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "now/index.md", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "20716" }, { "name": "JavaScript", "bytes": "53389" }, { "name": "Python", "bytes": "283" }, { "name": "Ruby", "bytes": "141" }, { "name": "SCSS", "bytes": "50123" } ], "symlink_target": "" }
<?php namespace Magento\Quote\Test\Unit\Model\ResourceModel\Quote\Item; use Magento\Quote\Model\ResourceModel\Quote\Item\Collection; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; /** * Class CollectionTest */ class CollectionTest extends \PHPUnit_Framework_TestCase { /** * @var Collection */ private $collection; /** * @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $connectionMock; /** * @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $eventManagerMock; /** * @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject */ protected $selectMock; /** * @var \Magento\Framework\Model\ResourceModel\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject */ protected $resourceMock; /** * @var \Magento\Framework\Data\Collection\Db\FetchStrategyInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $fetchStrategyMock; /** * @var \Magento\Framework\Data\Collection\EntityFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $entityFactoryMock; /** * @var \Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot|\PHPUnit_Framework_MockObject_MockObject */ protected $entitySnapshotMock; /** * Mock class dependencies */ protected function setUp() { $this->entityFactoryMock = $this->getMock('Magento\Framework\Data\Collection\EntityFactory', [], [], '', false); $this->fetchStrategyMock = $this->getMockForAbstractClass( 'Magento\Framework\Data\Collection\Db\FetchStrategyInterface' ); $this->eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface', [], [], '', false); $this->selectMock = $this->getMock('Magento\Framework\DB\Select', [], [], '', false); $this->connectionMock = $this->getMock('Magento\Framework\DB\Adapter\Pdo\Mysql', [], [], '', false); $this->connectionMock->expects($this->atLeastOnce()) ->method('select') ->will($this->returnValue($this->selectMock)); $this->resourceMock = $this->getMock('Magento\Framework\Model\ResourceModel\Db\AbstractDb', [], [], '', false); $this->resourceMock->expects($this->any())->method('getConnection')->will( $this->returnValue($this->connectionMock) ); $objectManager = new ObjectManager($this); $this->collection = $objectManager->getObject( 'Magento\Quote\Model\ResourceModel\Quote\Item\Collection', [ 'entityFactory' => $this->entityFactoryMock, 'fetchStrategy' => $this->fetchStrategyMock, 'eventManager' => $this->eventManagerMock, 'resource' => $this->resourceMock ] ); } public function testInstanceOf() { $this->assertInstanceOf( 'Magento\Framework\Model\ResourceModel\Db\VersionControl\Collection', $this->collection ); } }
{ "content_hash": "a5c464101c1221126934a7453d4aeff2", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 120, "avg_line_length": 33.734042553191486, "alnum_prop": 0.6433301797540208, "repo_name": "enettolima/magento-training", "id": "a948072e96d5f30bc81e7da894cd6c21f2075a0d", "size": "3269", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "magento2ce/app/code/Magento/Quote/Test/Unit/Model/ResourceModel/Quote/Item/CollectionTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "22648" }, { "name": "CSS", "bytes": "3382928" }, { "name": "HTML", "bytes": "8749335" }, { "name": "JavaScript", "bytes": "7355635" }, { "name": "PHP", "bytes": "58607662" }, { "name": "Perl", "bytes": "10258" }, { "name": "Shell", "bytes": "41887" }, { "name": "XSLT", "bytes": "19889" } ], "symlink_target": "" }
<?php require('includes/init.php'); require('config.php'); require('includes/db-core.php'); require('includes/helper-functions.php'); ob_clean(); //clean the output buffer //get query string and parse it, query string is base64 encoded $query_string = trim($_GET['q']); parse_str(base64_decode($query_string),$params); $form_id = (int) $params['form_id']; $id = (int) $params['id']; $field_name = str_replace(array("`","'",';'), '', $params['el']); $file_hash = $params['hash']; $dbh = mf_connect_db(); $mf_settings = mf_get_settings($dbh); //get filename $query = "select `{$field_name}` from `".MF_TABLE_PREFIX."form_{$form_id}` where id=?"; $params = array($id); $sth = mf_do_query($query,$params,$dbh); $row = mf_do_fetch_result($sth); $filename_array = array(); $filename_array = explode('|',$row[$field_name]); $filename_md5_array = array(); foreach ($filename_array as $value) { $filename_md5_array[] = md5($value); } $file_key = array_keys($filename_md5_array,$file_hash); if(empty($file_key)){ die("Error. File Not Found!"); }else{ $file_key = $file_key[0]; } $complete_filename = $filename_array[$file_key]; //remove the element_x-xx- suffix we added to all uploaded files $file_1 = substr($complete_filename,strpos($complete_filename,'-')+1); $filename_only = substr($file_1,strpos($file_1,'-')+1); $target_file = $mf_settings['upload_dir']."/form_{$form_id}/files/{$complete_filename}"; if(file_exists($target_file)){ //prompt user to download the file // Get extension of requested file $extension = strtolower(substr(strrchr($filename_only, "."), 1)); // Determine correct MIME type switch($extension){ case "asf": $type = "video/x-ms-asf"; break; case "avi": $type = "video/x-msvideo"; break; case "bin": $type = "application/octet-stream"; break; case "bmp": $type = "image/bmp"; break; case "cgi": $type = "magnus-internal/cgi"; break; case "css": $type = "text/css"; break; case "dcr": $type = "application/x-director"; break; case "dxr": $type = "application/x-director"; break; case "dll": $type = "application/octet-stream"; break; case "doc": $type = "application/msword"; break; case "exe": $type = "application/octet-stream"; break; case "gif": $type = "image/gif"; break; case "gtar": $type = "application/x-gtar"; break; case "gz": $type = "application/gzip"; break; case "htm": $type = "text/html"; break; case "html": $type = "text/html"; break; case "iso": $type = "application/octet-stream"; break; case "jar": $type = "application/java-archive"; break; case "java": $type = "text/x-java-source"; break; case "jnlp": $type = "application/x-java-jnlp-file"; break; case "js": $type = "application/x-javascript"; break; case "jpg": $type = "image/jpeg"; break; case "jpe": $type = "image/jpeg"; break; case "jpeg": $type = "image/jpeg"; break; case "lzh": $type = "application/octet-stream"; break; case "mdb": $type = "application/mdb"; break; case "mid": $type = "audio/x-midi"; break; case "midi": $type = "audio/x-midi"; break; case "mov": $type = "video/quicktime"; break; case "mp2": $type = "audio/x-mpeg"; break; case "mp3": $type = "audio/mpeg"; break; case "mpg": $type = "video/mpeg"; break; case "mpe": $type = "video/mpeg"; break; case "mpeg": $type = "video/mpeg"; break; case "pdf": $type = "application/pdf"; break; case "php": $type = "application/x-httpd-php"; break; case "php3": $type = "application/x-httpd-php3"; break; case "php4": $type = "application/x-httpd-php"; break; case "png": $type = "image/png"; break; case "ppt": $type = "application/mspowerpoint"; break; case "qt": $type = "video/quicktime"; break; case "qti": $type = "image/x-quicktime"; break; case "rar": $type = "encoding/x-compress"; break; case "ra": $type = "audio/x-pn-realaudio"; break; case "rm": $type = "audio/x-pn-realaudio"; break; case "ram": $type = "audio/x-pn-realaudio"; break; case "rtf": $type = "application/rtf"; break; case "swa": $type = "application/x-director"; break; case "swf": $type = "application/x-shockwave-flash"; break; case "tar": $type = "application/x-tar"; break; case "tgz": $type = "application/gzip"; break; case "tif": $type = "image/tiff"; break; case "tiff": $type = "image/tiff"; break; case "torrent": $type = "application/x-bittorrent"; break; case "txt": $type = "text/plain"; break; case "wav": $type = "audio/wav"; break; case "wma": $type = "audio/x-ms-wma"; break; case "wmv": $type = "video/x-ms-wmv"; break; case "xls": $type = "application/vnd.ms-excel"; break; case "xml": $type = "application/xml"; break; case "7z": $type = "application/x-compress"; break; case "zip": $type = "application/x-zip-compressed"; break; default: $type = "application/force-download"; break; } // Fix IE bug [0] $header_file = (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? preg_replace('/\./', '%2e', $filename_only, substr_count($filename_only, '.') - 1) : $filename_only; //Prepare headers header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public", false); header("Content-Description: File Transfer"); header("Content-Type: " . $type); header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=\"" . addslashes($header_file) . "\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . filesize($target_file)); // Send file for download if ($stream = fopen($target_file, 'rb')){ while(!feof($stream) && connection_status() == 0){ //reset time limit for big files @set_time_limit(0); print(fread($stream,1024*8)); flush(); } fclose($stream); } }else{ echo 'File not found!'; } ?>
{ "content_hash": "3df5b7827615de15da31a8a8ab5c50f9", "timestamp": "", "source": "github", "line_count": 156, "max_line_length": 172, "avg_line_length": 47.35897435897436, "alnum_prop": 0.4982403898213319, "repo_name": "pro251/wphelp", "id": "9c5e96bf38f2b6ac9d29fbb2640fb708fb524401", "size": "7731", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "html/forms/download.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "527" }, { "name": "CSS", "bytes": "455929" }, { "name": "HTML", "bytes": "5547293" }, { "name": "JavaScript", "bytes": "1093684" }, { "name": "PHP", "bytes": "6112896" } ], "symlink_target": "" }
package com.google.javascript.jscomp; import static com.google.common.truth.Truth.assertThat; import static com.google.javascript.jscomp.TypeValidator.TYPE_MISMATCH_WARNING; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.primitives.Chars; import com.google.javascript.jscomp.CompilerOptions.DisposalCheckingPolicy; import com.google.javascript.jscomp.CompilerOptions.J2clPassMode; import com.google.javascript.jscomp.CompilerOptions.LanguageMode; import com.google.javascript.jscomp.CompilerOptions.Reach; import com.google.javascript.jscomp.deps.ModuleLoader; import com.google.javascript.jscomp.deps.ModuleLoader.ResolutionMode; import com.google.javascript.jscomp.testing.NodeSubject; import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; /** * Integration tests for the compiler. * * @author nicksantos@google.com (Nick Santos) */ public final class IntegrationTest extends IntegrationTestCase { private static final String CLOSURE_BOILERPLATE = "/** @define {boolean} */ var COMPILED = false; var goog = {};" + "goog.exportSymbol = function() {};"; private static final String CLOSURE_COMPILED = "var COMPILED = true; var goog$exportSymbol = function() {};"; public void testConstructorCycle() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); test( options, "/** @return {function()} */ var AsyncTestCase = function() {};\n" + "/**\n" + " * @constructor\n" + " */ Foo = /** @type {function(new:Foo)} */ (AyncTestCase());", RhinoErrorReporter.PARSE_ERROR); } // b/27531865 public void testLetInSwitch() { CompilerOptions options = createCompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT3); options.setWarningLevel(DiagnosticGroups.CHECK_VARIABLES, CheckLevel.ERROR); String before = LINE_JOINER.join( "var a = 0;", "switch (a) {", " case 0:", " let x = 1;", " case 1:", " x = 2;", "}"); String after = LINE_JOINER.join( "var a = 0;", "switch (a) {", " case 0:", " var x = 1;", " case 1:", " x = 2;", "}"); test(options, before, after); before = LINE_JOINER.join( "var a = 0;", "switch (a) {", " case 0:", " default:", " let x = 1;", "}"); after = LINE_JOINER.join( "var a = 0;", "switch (a) {", " case 0:", " default:", " var x = 1;", "}"); test(options, before, after); } public void testExplicitBlocksInSwitch() { CompilerOptions options = createCompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT3); options.setWarningLevel(DiagnosticGroups.CHECK_VARIABLES, CheckLevel.ERROR); String before = LINE_JOINER.join( "var a = 0;", "switch (a) {", " case 0:", " { const x = 3; break; }", " case 1:", " { const x = 5; break; }", "}"); String after = LINE_JOINER.join( "var a = 0;", "switch (a) {", " case 0:", " { var x = 3; break; }", " case 1:", " { var x$0 = 5; break; }", "}"); test(options, before, after); } public void testMultipleAliasesInlined_bug31437418() { CompilerOptions options = createCompilerOptions(); options.setCollapseProperties(true); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT3); test( options, LINE_JOINER.join( "class A { static z() {} }", "const B = {};", " B.A = A;", " const C = {};", " C.A = B.A; ", "const D = {};", " D.A = C.A;", " D.A.z();"), LINE_JOINER.join( "var A = function(){};", "var A$z = function(){};", "var B$A = null;", "var C$A = null;", "var D$A = null;", "A$z();")); } public void testBug1949424() { CompilerOptions options = createCompilerOptions(); options.setCollapseProperties(true); options.setClosurePass(true); test(options, CLOSURE_BOILERPLATE + "goog.provide('FOO'); FOO.bar = 3;", CLOSURE_COMPILED + "var FOO$bar = 3;"); } public void testBug1949424_v2() { CompilerOptions options = createCompilerOptions(); options.setCollapseProperties(true); options.setClosurePass(true); test( options, LINE_JOINER.join( CLOSURE_BOILERPLATE, "goog.provide('FOO.BAR');", "FOO.BAR = 3;"), LINE_JOINER.join( CLOSURE_COMPILED, "var FOO$BAR = 3;")); } public void testUnresolvedDefine() { CompilerOptions options = new CompilerOptions(); options.setClosurePass(true); options.setCheckTypes(true); DiagnosticType[] warnings = { ProcessDefines.INVALID_DEFINE_TYPE_ERROR, RhinoErrorReporter.TYPE_PARSE_ERROR}; String[] input = { "var goog = {};" + "goog.provide('foo.bar');" + "/** @define{foo.bar} */ foo.bar = {};" }; String[] output = { "var goog = {};" + "var foo = {};" + "/** @define{foo.bar} */ foo.bar = {};"}; test(options, input, output, warnings); } public void testBug1956277() { CompilerOptions options = createCompilerOptions(); options.setCollapseProperties(true); options.setInlineVariables(true); test( options, "var CONST = {}; CONST.bar = null;" + "function f(url) { CONST.bar = url; }", "var CONST$bar = null; function f(url) { CONST$bar = url; }"); } public void testBug1962380() { CompilerOptions options = createCompilerOptions(); options.setCollapseProperties(true); options.setInlineVariables(true); options.setGenerateExports(true); test( options, CLOSURE_BOILERPLATE + "/** @export */ goog.CONSTANT = 1;" + "var x = goog.CONSTANT;", "(function() {})('goog.CONSTANT', 1);"); } /** * Tests that calls to goog.string.Const.from() with non-constant arguments * are detected with and without collapsed properties. */ public void testBug22684459() { String source = "" + "var goog = {};" + "goog.string = {};" + "goog.string.Const = {};" + "goog.string.Const.from = function(x) {};" + "var x = window.document.location;" + "goog.string.Const.from(x);"; // Without collapsed properties. CompilerOptions options = createCompilerOptions(); test(options, source, ConstParamCheck.CONST_NOT_ASSIGNED_STRING_LITERAL_ERROR); // With collapsed properties. options.setCollapseProperties(true); test(options, source, ConstParamCheck.CONST_NOT_ASSIGNED_STRING_LITERAL_ERROR); } /** * Tests that calls to goog.string.Const.from() with non-constant arguments * are detected with and without collapsed properties, even when * goog.string.Const.from has been aliased. */ public void testBug22684459_aliased() { String source = "" + "var goog = {};" + "goog.string = {};" + "goog.string.Const = {};" + "goog.string.Const.from = function(x) {};" + "var mkConst = goog.string.Const.from;" + "var x = window.document.location;" + "mkConst(x);"; // Without collapsed properties. CompilerOptions options = createCompilerOptions(); test(options, source, ConstParamCheck.CONST_NOT_ASSIGNED_STRING_LITERAL_ERROR); // With collapsed properties. options.setCollapseProperties(true); test(options, source, ConstParamCheck.CONST_NOT_ASSIGNED_STRING_LITERAL_ERROR); } public void testBug31301233() { String source = LINE_JOINER.join( "function Foo() {", " var x = window.document.location;", " goog.string.Const.from(x);", "};"); CompilerOptions options = createCompilerOptions(); options.setSmartNameRemoval(true); options.setExtraSmartNameRemoval(true); test(options, source, ConstParamCheck.CONST_NOT_ASSIGNED_STRING_LITERAL_ERROR); } public void testAdvancedModeIncludesExtraSmartNameRemoval() { CompilerOptions options = new CompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); test( options, LINE_JOINER.join( "(function() {", " /** @constructor} */", " function Bar() {}", " var y = Bar;", " new y();", "})();"), ""); } public void testBug2410122() { CompilerOptions options = createCompilerOptions(); options.setGenerateExports(true); options.setClosurePass(true); test( options, "var goog = {};" + "function F() {}" + "/** @export */ function G() { goog.base(this); } " + "goog.inherits(G, F);", "var goog = {};" + "function F() {}" + "function G() { F.call(this); } " + "goog.inherits(G, F); goog.exportSymbol('G', G);"); } public void testBug18078936() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); WarningLevel.VERBOSE.setOptionsForWarningLevel(options); test(options, "var goog = {};" + "goog.inherits = function(a,b) {};" + "goog.defineClass = function(a,b) {};" + "/** @template T */\n" + "var ClassA = goog.defineClass(null, {\n" + " constructor: function() {},\n" + "" + " /** @param {T} x */\n" + " fn: function(x) {}\n" + "});\n" + "" + "/** @extends {ClassA.<string>} */\n" + "var ClassB = goog.defineClass(ClassA, {\n" + " constructor: function() {},\n" + "" + " /** @override */\n" + " fn: function(x) {}\n" + "});\n" + "" + "(new ClassB).fn(3);\n" + "", TypeValidator.TYPE_MISMATCH_WARNING); } // http://b/31448683 public void testBug31448683() { CompilerOptions options = createCompilerOptions(); WarningLevel.QUIET.setOptionsForWarningLevel(options); options.setInlineFunctions(true); test( options, LINE_JOINER.join( "function f() {", " x = x || 1", " var x;", " console.log(x);", "}", "for (var _ in [1]) {", " f();", "}"), LINE_JOINER.join( "for(var _ in[1]) {", " {", " var x$jscomp$inline_0 = void 0;", " x$jscomp$inline_0 = x$jscomp$inline_0 || 1;", " console.log(x$jscomp$inline_0);", " }", "}")); } public void testBug32660578() { testSame(createCompilerOptions(), "function f() { alert(x); for (var x in []) {} }"); } public void testWindowIsTypedEs6() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT5); options.setCheckTypes(true); options.setWarningLevel(DiagnosticGroups.MISSING_PROPERTIES, CheckLevel.OFF); test( options, LINE_JOINER.join( "for (var x of []);", // Force injection of es6_runtime.js "var /** number */ y = window;"), TypeValidator.TYPE_MISMATCH_WARNING); } public void testConstPolymerNotAllowed() { CompilerOptions options = createCompilerOptions(); options.setPolymerVersion(1); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT5); externs = ImmutableList.of(SourceFile.fromCode("<externs>", "var Polymer = function() {}; var PolymerElement = function() {};")); test( options, "const Foo = Polymer({ is: 'x-foo' });", PolymerPassErrors.POLYMER_INVALID_DECLARATION); } public void testForwardDeclaredTypeInTemplate() { CompilerOptions options = createCompilerOptions(); WarningLevel.VERBOSE.setOptionsForWarningLevel(options); options.setClosurePass(true); options.setWarningLevel(DiagnosticGroups.LINT_CHECKS, CheckLevel.WARNING); test( options, LINE_JOINER.join( "var goog = {};", "goog.forwardDeclare = function(/** string */ typeName) {};", "goog.forwardDeclare('fwd.declared.Type');", "", "/** @type {!fwd.declared.Type<string>} */", "var x;", "", "/** @type {!fwd.declared.Type<string, number>} */", "var y;"), "var goog={};goog.forwardDeclare=function(typeName){};var x;var y"); } public void testIssue90() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); options.setInlineVariables(true); options.setRemoveDeadCode(true); test(options, "var x; x && alert(1);", ""); } public void testClosurePassOff() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(false); testSame(options, "var goog = {}; goog.require = function(x) {}; goog.require('foo');"); testSame( options, "var goog = {}; goog.getCssName = function(x) {};" + "goog.getCssName('foo');"); } public void testClosurePassOn() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); test(options, "var goog = {}; goog.require = function(x) {}; goog.require('foo');", ProcessClosurePrimitives.MISSING_PROVIDE_ERROR); test( options, "/** @define {boolean} */ var COMPILED = false;" + "var goog = {}; goog.getCssName = function(x) {};" + "goog.getCssName('foo');", "var COMPILED = true;" + "var goog = {}; goog.getCssName = function(x) {};" + "'foo';"); } public void testCssNameCheck() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setCheckMissingGetCssNameLevel(CheckLevel.ERROR); options.setCheckMissingGetCssNameBlacklist("foo"); test(options, "var x = 'foo';", CheckMissingGetCssName.MISSING_GETCSSNAME); } public void testCheckEventfulDisposalWarningLevels() { CompilerOptions options = createCompilerOptions(); options.setCheckEventfulObjectDisposalPolicy(DisposalCheckingPolicy.ON); String js = "var goog = {};" + "goog.inherits = function(x, y) {};" + "goog.dispose = function(x) {};" + "goog.disposeAll = function(var_args) {};" + "/** @return {*} */ goog.asserts.assert = function(x) { return x; };" + "goog.disposable = {};" + "/** @interface */\n" + "goog.disposable.IDisposable = function() {};" + "goog.disposable.IDisposable.prototype.dispose;" + "/** @implements {goog.disposable.IDisposable}\n * @constructor */\n" + "goog.Disposable = goog.abstractMethod;" + "/** @override */" + "goog.Disposable.prototype.dispose = goog.abstractMethod;" + "/** @param {goog.Disposable} fn */" + "goog.Disposable.prototype.registerDisposable = goog.abstractMethod;" + "goog.events = {};" + "/** @extends {goog.Disposable}\n * @constructor */" + "goog.events.EventHandler = function() {};" + "/** @extends {goog.Disposable}\n * @constructor */" + "var test = function() { this.eh = new goog.events.EventHandler(); };" + "goog.inherits(test, goog.Disposable);" + "var testObj = new test();"; test(options, js, CheckEventfulObjectDisposal.EVENTFUL_OBJECT_NOT_DISPOSED); options.setWarningLevel(DiagnosticGroups.CHECK_EVENTFUL_OBJECT_DISPOSAL, CheckLevel.OFF); testSame(options, js); } public void testBug2592659() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setCheckTypes(true); options.setCheckMissingGetCssNameLevel(CheckLevel.WARNING); options.setCheckMissingGetCssNameBlacklist("foo"); test( options, "var goog = {};\n" + "/**\n" + " * @param {string} className\n" + " * @param {string=} opt_modifier\n" + " * @return {string}\n" + "*/\n" + "goog.getCssName = function(className, opt_modifier) {}\n" + "var x = goog.getCssName(123, 'a');", TypeValidator.TYPE_MISMATCH_WARNING); } public void testTypedefBeforeOwner1() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); test( options, LINE_JOINER.join( "goog.provide('foo.Bar.Type');", "goog.provide('foo.Bar');", "/** @typedef {number} */ foo.Bar.Type;", "foo.Bar = function() {};"), LINE_JOINER.join( "var foo = {};", "foo.Bar.Type;", "foo.Bar = function() {};")); } public void testTypedefBeforeOwner2() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setCollapseProperties(true); test( options, LINE_JOINER.join( "goog.provide('foo.Bar.Type');", "goog.provide('foo.Bar');", "/** @typedef {number} */ foo.Bar.Type;", "foo.Bar = function() {};"), LINE_JOINER.join( "var foo$Bar$Type;", "var foo$Bar = function() {};")); } public void testExportedNames() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setVariableRenaming(VariableRenamingPolicy.ALL); test( options, "/** @define {boolean} */ var COMPILED = false;" + "var goog = {}; goog.exportSymbol('b', goog);", "var a = true; var c = {}; c.exportSymbol('b', c);"); test(options, "/** @define {boolean} */ var COMPILED = false;" + "var goog = {}; goog.exportSymbol('a', goog);", "var b = true; var c = {}; c.exportSymbol('a', c);"); } public void testCheckGlobalThisOn() { CompilerOptions options = createCompilerOptions(); options.setCheckSuspiciousCode(true); options.setCheckGlobalThisLevel(CheckLevel.ERROR); test(options, "function f() { this.y = 3; }", CheckGlobalThis.GLOBAL_THIS); } public void testSusiciousCodeOff() { CompilerOptions options = createCompilerOptions(); options.setCheckSuspiciousCode(false); options.setCheckGlobalThisLevel(CheckLevel.ERROR); test(options, "function f() { this.y = 3; }", CheckGlobalThis.GLOBAL_THIS); } public void testCheckGlobalThisOff() { CompilerOptions options = createCompilerOptions(); options.setCheckSuspiciousCode(true); options.setCheckGlobalThisLevel(CheckLevel.OFF); testSame(options, "function f() { this.y = 3; }"); } public void testCheckRequiresAndCheckProvidesOff() { testSame(createCompilerOptions(), new String[] { "/** @constructor */ function Foo() {}", "new Foo();" }); } public void testCheckProvidesOn() { CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.MISSING_PROVIDE, CheckLevel.ERROR); test( options, new String[] {"goog.require('x'); /** @constructor */ function Foo() {}", "new Foo();"}, CheckProvides.MISSING_PROVIDE_WARNING); } public void testGenerateExportsOff() { testSame(createCompilerOptions(), "/** @export */ function f() {}"); } public void testExportTestFunctionsOn1() { CompilerOptions options = createCompilerOptions(); options.exportTestFunctions = true; test(options, "function testFoo() {}", "/** @export */ function testFoo() {}" + "goog.exportSymbol('testFoo', testFoo);"); } public void testExportTestFunctionsOn2() { CompilerOptions options = createCompilerOptions(); options.setExportTestFunctions(true); options.setClosurePass(true); options.setRenamingPolicy( VariableRenamingPolicy.ALL, PropertyRenamingPolicy.ALL_UNQUOTED); options.setGeneratePseudoNames(true); options.setCollapseProperties(true); test(options, new String[] { LINE_JOINER.join( "var goog = {};", "goog.provide('goog.testing.testSuite');", "goog.testing.testSuite = function(a) {};"), LINE_JOINER.join( "goog.module('testing');", "var testSuite = goog.require('goog.testing.testSuite');", "testSuite({testMethod:function(){}});") }, new String[] { "var $goog$testing$testSuite$$ = function($a$$) {};", "$goog$testing$testSuite$$({'testMethod':function(){}})" }); } /** * Check that valid ES6 modules compile to valid goog.require()/goog.provide() statements. */ public void testES6Modules() { CompilerOptions options = createCompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT5); options.setModuleResolutionMode(ResolutionMode.LEGACY); test( options, new String[] { "import {x} from './i1'; alert(x);", "export var x = 5;", }, new String[] { "goog.require('module$i1'); alert(module$i1.x);", "goog.provide('module$i1'); var x$$module$i1 = 5; module$i1.x = x$$module$i1;", }); } /** * Check that the expected warning is reported when an ES6 module tries to import a nonexistent * module. */ public void testES6Modules_missing() { CompilerOptions options = createCompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT5); options.setModuleResolutionMode(ResolutionMode.LEGACY); test( options, new String[] { "import {x} from './i2'; alert(x);", "export var x = 5;", }, ModuleLoader.LOAD_WARNING); } public void testAngularPassOff() { testSame(createCompilerOptions(), "/** @ngInject */ function f() {} " + "/** @ngInject */ function g(a){} " + "/** @ngInject */ var b = function f(a) {} "); } public void testAngularPassOn() { CompilerOptions options = createCompilerOptions(); options.angularPass = true; test(options, "/** @ngInject */ function f() {} " + "/** @ngInject */ function g(a){} " + "/** @ngInject */ var b = function f(a, b, c) {} ", "function f() {} " + "function g(a) {} g['$inject']=['a'];" + "var b = function f(a, b, c) {}; b['$inject']=['a', 'b', 'c']"); } public void testExportTestFunctionsOff() { testSame(createCompilerOptions(), "function testFoo() {}"); } public void testExportTestFunctionsOn() { CompilerOptions options = createCompilerOptions(); options.exportTestFunctions = true; test(options, "function testFoo() {}", "/** @export */ function testFoo() {}" + "goog.exportSymbol('testFoo', testFoo);"); } public void testExpose() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); test(options, new String[] {"var x = {eeny: 1, /** @expose */ meeny: 2};" + "/** @constructor */ var Foo = function() {};" + "/** @expose */ Foo.prototype.miny = 3;" + "Foo.prototype.moe = 4;" + "/** @expose */ Foo.prototype.tiger;" + "function moe(a, b) { return a.meeny + b.miny + a.tiger; }" + "window['x'] = x;" + "window['Foo'] = Foo;" + "window['moe'] = moe;"}, new String[] {"function a(){}" + "a.prototype.miny=3;" + "window.x={a:1,meeny:2};" + "window.Foo=a;" + "window.moe=function(b,c){" + " return b.meeny+c.miny+b.tiger" + "}"}, new DiagnosticType[]{ CheckJSDoc.ANNOTATION_DEPRECATED, CheckJSDoc.ANNOTATION_DEPRECATED, CheckJSDoc.ANNOTATION_DEPRECATED}); } public void testCheckSymbolsOff() { CompilerOptions options = createCompilerOptions(); testSame(options, "x = 3;"); } public void testCheckSymbolsOn() { CompilerOptions options = createCompilerOptions(); options.setCheckSymbols(true); test(options, "x = 3;", VarCheck.UNDEFINED_VAR_ERROR); } public void testNoTypeWarningForDupExternNamespace() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); externs = ImmutableList.of(SourceFile.fromCode( "externs", LINE_JOINER.join( "/** @const */", "var ns = {};", "/** @type {number} */", "ns.prop1;", "/** @const */", "var ns = {};", "/** @type {number} */", "ns.prop2;"))); testSame(options, ""); } public void testCheckReferencesOff() { CompilerOptions options = createCompilerOptions(); testSame(options, "x = 3; var x = 5;"); } public void testCheckReferencesOn() { CompilerOptions options = createCompilerOptions(); options.setCheckSymbols(true); test(options, "x = 3; var x = 5;", VariableReferenceCheck.EARLY_REFERENCE); } public void testInferTypes() { CompilerOptions options = createCompilerOptions(); options.inferTypes = true; options.setCheckTypes(false); options.setClosurePass(true); test(options, CLOSURE_BOILERPLATE + "goog.provide('Foo'); /** @enum */ Foo = {a: 3};", "var COMPILED=true;var goog={};goog.exportSymbol=function(){};var Foo={a:3}"); assertThat(lastCompiler.getErrorManager().getTypedPercent()).isEqualTo(0.0); // This does not generate a warning. test(options, "/** @type {number} */ var n = window.name;", "var n = window.name;"); assertThat(lastCompiler.getErrorManager().getTypedPercent()).isEqualTo(0.0); } public void testTypeCheckAndInference() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); test( options, "/** @type {number} */ var n = window.name;", TypeValidator.TYPE_MISMATCH_WARNING); assertThat(lastCompiler.getErrorManager().getTypedPercent()).isGreaterThan(0.0); } public void testTypeNameParser() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); test(options, "/** @type {n} */ var n = window.name;", RhinoErrorReporter.UNRECOGNIZED_TYPE_ERROR); } // This tests that the TypedScopeCreator is memoized so that it only creates a // Scope object once for each scope. If, when type inference requests a scope, // it creates a new one, then multiple JSType objects end up getting created // for the same local type, and ambiguate will rename the last statement to // o.a(o.a, o.a), which is bad. public void testMemoizedTypedScopeCreator() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); options.setAmbiguateProperties(true); options.setPropertyRenaming(PropertyRenamingPolicy.ALL_UNQUOTED); test( options, "function someTest() {\n" + " /** @constructor */\n" + " function Foo() { this.instProp = 3; }\n" + " Foo.prototype.protoProp = function(a, b) {};\n" + " /** @constructor\n @extends Foo */\n" + " function Bar() {}\n" + " goog.inherits(Bar, Foo);\n" + " var o = new Bar();\n" + " o.protoProp(o.protoProp, o.instProp);\n" + "}", "function someTest() {\n" + " function Foo() { this.b = 3; }\n" + " function Bar() {}\n" + " Foo.prototype.a = function(a, b) {};\n" + " goog.c(Bar, Foo);\n" + " var o = new Bar();\n" + " o.a(o.a, o.b);\n" + "}"); } public void testCheckTypes() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); test(options, "var x = x || {}; x.f = function() {}; x.f(3);", TypeCheck.WRONG_ARGUMENT_COUNT); } public void testBothTypeCheckersRunNoDupWarning() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); options.setNewTypeInference(true); test( options, LINE_JOINER.join( "/** @return {number} */", "function f() {", " return 'asdf';", "}"), NewTypeInference.RETURN_NONDECLARED_TYPE); test( options, "/** @type {ASDF} */ var x;", GlobalTypeInfo.UNRECOGNIZED_TYPE_NAME); options.setWarningLevel( DiagnosticGroups.REPORT_UNKNOWN_TYPES, CheckLevel.WARNING); test( options, "function f(/** ? */ x) { var y = x; }", NewTypeInference.UNKNOWN_EXPR_TYPE); options.setWarningLevel( DiagnosticGroups.REPORT_UNKNOWN_TYPES, CheckLevel.OFF); testSame( options, LINE_JOINER.join( "(function() {", " /** @constructor */", " var Boolean = function() {};", "})();")); } public void testSilenceUnknownTypeWarningFromOTI() { CompilerOptions options = new CompilerOptions(); options.setCheckTypes(true); options.setNewTypeInference(true); test(options, LINE_JOINER.join( "/**", " * @param {T} x", " * @template T", " */", "function f(x) {", " function g(y) {", " var w = /** @type {T} */ (y);", " var /** T */ z = x;", " };", "}"), LINE_JOINER.join( "/**", " * @param {T} x", " * @template T", " */", "function f(x) {", " function g(y) {", " var w = y;", " var /** T */ z = x;", " };", "}")); } public void testNTIConstWarningsOverrideAccessControls() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); String js = LINE_JOINER.join( "/** @constructor */ function Foo(name) {}", "/** @const */ Foo.prop = 1;", "Foo.prop = 2;"); test(options, js, CheckAccessControls.CONST_PROPERTY_REASSIGNED_VALUE); options.setNewTypeInference(true); test(options, js, NewTypeInference.CONST_PROPERTY_REASSIGNED); } public void testNTInoMaskTypeParseError() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); options.setNewTypeInference(true); test(options, LINE_JOINER.join( "/** @param {(boolean|number} x */", "function f(x) {}"), RhinoErrorReporter.TYPE_PARSE_ERROR); } public void testLegacyCompileOverridesStrict() { CompilerOptions options = new CompilerOptions(); options.setCheckTypes(true); options.addWarningsGuard(new StrictWarningsGuard()); options.setLegacyCodeCompile(true); Compiler compiler = compile(options, "123();"); assertThat(compiler.getErrors()).isEmpty(); assertThat(compiler.getWarnings()).hasLength(1); } public void testLegacyCompileOverridesExplicitPromotionToError() { CompilerOptions options = new CompilerOptions(); options.setCheckTypes(true); options.addWarningsGuard(new DiagnosticGroupWarningsGuard( DiagnosticGroups.CHECK_TYPES, CheckLevel.ERROR)); options.setLegacyCodeCompile(true); Compiler compiler = compile(options, "123();"); assertThat(compiler.getErrors()).isEmpty(); assertThat(compiler.getWarnings()).hasLength(1); } public void testLegacyCompileTurnsOffDisambiguateProperties() { CompilerOptions options = new CompilerOptions(); options.setCheckTypes(true); options.setDisambiguateProperties(true); options.setLegacyCodeCompile(true); testSame(options, LINE_JOINER.join( "/** @constructor */", "function Foo() {", " this.p = 123;", "}", "/** @constructor */", "function Bar() {", " this.p = 234;", "}")); } public void testReplaceCssNames() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setGatherCssNames(true); test( options, "/** @define {boolean} */\n" + "var COMPILED = false;\n" + "goog.setCssNameMapping({'foo':'bar'});\n" + "function getCss() {\n" + " return goog.getCssName('foo');\n" + "}", "var COMPILED = true;\n" + "function getCss() {\n" + " return \"bar\";" + "}"); assertEquals( ImmutableMap.of("foo", 1), lastCompiler.getPassConfig().getIntermediateState().cssNames); } public void testReplaceIdGeneratorsTest() { CompilerOptions options = createCompilerOptions(); options.replaceIdGenerators = true; options.setIdGenerators(ImmutableMap.<String, RenamingMap>of( "xid", new RenamingMap() { @Override public String get(String value) { return ":" + value + ":"; } })); test(options, "/** @idGenerator {mapped} */" + "var xid = function() {};\n" + "function f() {\n" + " return xid('foo');\n" + "}", "var xid = function() {};\n" + "function f() {\n" + " return ':foo:';\n" + "}"); } public void testRemoveClosureAsserts() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); testSame( options, "var goog = {};" + "goog.asserts.assert(goog);"); options.removeClosureAsserts = true; test(options, "var goog = {};" + "goog.asserts.assert(goog);", "var goog = {};"); } public void testDeprecation() { String code = "/** @deprecated */ function f() { } function g() { f(); }"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setWarningLevel(DiagnosticGroups.DEPRECATED, CheckLevel.ERROR); testSame(options, code); options.setCheckTypes(true); test(options, code, CheckAccessControls.DEPRECATED_NAME); } public void testVisibility() { String[] code = { "/** @private */ function f() { }", "function g() { f(); }" }; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setWarningLevel(DiagnosticGroups.VISIBILITY, CheckLevel.ERROR); testSame(options, code); options.setCheckTypes(true); test(options, code, CheckAccessControls.BAD_PRIVATE_GLOBAL_ACCESS); } public void testUnreachableCode() { String code = "function f() { return \n x(); }"; CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.OFF); testSame(options, code); options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.ERROR); test(options, code, CheckUnreachableCode.UNREACHABLE_CODE); } public void testMissingReturn() { String code = "/** @return {number} */ function f() { if (f) { return 3; } }"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setWarningLevel(DiagnosticGroups.MISSING_RETURN, CheckLevel.ERROR); testSame(options, code); options.setCheckTypes(true); test(options, code, CheckMissingReturn.MISSING_RETURN_STATEMENT); } public void testIdGenerators() { String code = "function f() {} f('id');"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setIdGenerators(ImmutableSet.of("f")); test(options, code, "function f() {} 'a';"); } public void testOptimizeArgumentsArray() { String code = "function f() { return arguments[0]; }"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setOptimizeArgumentsArray(true); String argName = "JSCompiler_OptimizeArgumentsArray_p0"; test(options, code, "function f(" + argName + ") { return " + argName + "; }"); } public void testOptimizeParameters() { String code = "function f(a) { return a; } f(true);"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.optimizeParameters = true; test(options, code, "function f() { var a = true; return a;} f();"); } public void testOptimizeReturns() { String code = "function f(a) { return a; } f(true);"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.optimizeReturns = true; test(options, code, "function f(a) {return;} f(true);"); } public void testRemoveAbstractMethods() { String code = CLOSURE_BOILERPLATE + "var x = {}; x.foo = goog.abstractMethod; x.bar = 3;"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setClosurePass(true); options.setCollapseProperties(true); options.setRemoveAbstractMethods(true); test(options, code, CLOSURE_COMPILED + " var x$bar = 3;"); } public void testGoogDefine1() { String code = CLOSURE_BOILERPLATE + "/** @define {boolean} */ goog.define('FLAG', true);"; CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setCollapseProperties(true); options.setDefineToBooleanLiteral("FLAG", false); test(options, code, CLOSURE_COMPILED + " var FLAG = false;"); } public void testGoogDefine2() { String code = CLOSURE_BOILERPLATE + "goog.provide('ns');" + "/** @define {boolean} */ goog.define('ns.FLAG', true);"; CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setCollapseProperties(true); options.setDefineToBooleanLiteral("ns.FLAG", false); test(options, code, CLOSURE_COMPILED + "var ns$FLAG = false;"); } public void testCollapseProperties1() { String code = "var x = {}; x.FOO = 5; x.bar = 3;"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setCollapseProperties(true); test(options, code, "var x$FOO = 5; var x$bar = 3;"); } public void testCollapseProperties2() { String code = "var x = {}; x.FOO = 5; x.bar = 3;"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setCollapseProperties(true); options.collapseObjectLiterals = true; test(options, code, "var x$FOO = 5; var x$bar = 3;"); } public void testCollapseObjectLiteral1() { // Verify collapseObjectLiterals does nothing in global scope String code = "var x = {}; x.FOO = 5; x.bar = 3;"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.collapseObjectLiterals = true; testSame(options, code); } public void testCollapseObjectLiteral2() { String code = "function f() {var x = {}; x.FOO = 5; x.bar = 3;}"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.collapseObjectLiterals = true; test( options, code, LINE_JOINER.join( "function f() {", " var JSCompiler_object_inline_FOO_0 = 5;", " var JSCompiler_object_inline_bar_1 = 3;", "}")); } public void testDisambiguateProperties() { String code = "/** @constructor */ function Foo(){} Foo.prototype.bar = 3;" + "/** @constructor */ function Baz(){} Baz.prototype.bar = 3;"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setDisambiguateProperties(true); options.setCheckTypes(true); test(options, code, "function Foo(){} Foo.prototype.Foo_prototype$bar = 3;" + "function Baz(){} Baz.prototype.Baz_prototype$bar = 3;"); } // When closure-code-removal runs before disambiguate-properties, make sure // that removing abstract methods doesn't mess up disambiguation. public void testDisambiguateProperties2() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setCheckTypes(true); options.setDisambiguateProperties(true); options.setRemoveDeadCode(true); options.setRemoveAbstractMethods(true); test(options, LINE_JOINER.join( "/** @const */ var goog = {};", "goog.abstractMethod = function() {};", "/** @interface */ function I() {}", "I.prototype.a = function(x) {};", "/** @constructor @implements {I} */ function Foo() {}", "/** @override */ Foo.prototype.a = goog.abstractMethod;", "/** @constructor @extends Foo */ function Bar() {}", "/** @override */ Bar.prototype.a = function(x) {};"), LINE_JOINER.join( "var goog={};", "goog.abstractMethod = function() {};", "function I(){}", "I.prototype.a=function(x){};", "function Foo(){}", "function Bar(){}", "Bar.prototype.a=function(x){};")); } public void testMarkPureCalls() { String testCode = "function foo() {} foo();"; CompilerOptions options = createCompilerOptions(); options.setRemoveDeadCode(true); testSame(options, testCode); options.setComputeFunctionSideEffects(true); test(options, testCode, "function foo() {}"); } public void testMarkNoSideEffects() { String testCode = "noSideEffects();"; CompilerOptions options = createCompilerOptions(); options.setRemoveDeadCode(true); testSame(options, testCode); options.markNoSideEffectCalls = true; test(options, testCode, ""); } public void testChainedCalls() { CompilerOptions options = createCompilerOptions(); options.chainCalls = true; test( options, "/** @constructor */ function Foo() {} " + "Foo.prototype.bar = function() { return this; }; " + "var f = new Foo();" + "f.bar(); " + "f.bar(); ", "function Foo() {} " + "Foo.prototype.bar = function() { return this; }; " + "var f = new Foo();" + "f.bar().bar();"); } public void testExtraAnnotationNames() { CompilerOptions options = createCompilerOptions(); options.setExtraAnnotationNames(ImmutableSet.of("TagA", "TagB")); test( options, "/** @TagA */ var f = new Foo(); /** @TagB */ f.bar();", "var f = new Foo(); f.bar();"); } public void testDevirtualizePrototypeMethods() { CompilerOptions options = createCompilerOptions(); options.setDevirtualizePrototypeMethods(true); test( options, "/** @constructor */ var Foo = function() {}; " + "Foo.prototype.bar = function() {};" + "(new Foo()).bar();", "var Foo = function() {};" + "var JSCompiler_StaticMethods_bar = " + " function(JSCompiler_StaticMethods_bar$self) {};" + "JSCompiler_StaticMethods_bar(new Foo());"); } public void testCheckConsts() { CompilerOptions options = createCompilerOptions(); options.setInlineConstantVars(true); test(options, "var FOO = true; FOO = false", ConstCheck.CONST_REASSIGNED_VALUE_ERROR); } public void testAllChecksOn() { CompilerOptions options = createCompilerOptions(); options.setCheckSuspiciousCode(true); options.setWarningLevel(DiagnosticGroups.MISSING_PROVIDE, CheckLevel.ERROR); options.setGenerateExports(true); options.exportTestFunctions = true; options.setClosurePass(true); options.setCheckMissingGetCssNameLevel(CheckLevel.ERROR); options.setCheckMissingGetCssNameBlacklist("goog"); options.syntheticBlockStartMarker = "synStart"; options.syntheticBlockEndMarker = "synEnd"; options.setCheckSymbols(true); options.processObjectPropertyString = true; options.setCollapseProperties(true); test(options, CLOSURE_BOILERPLATE, CLOSURE_COMPILED); } public void testTypeCheckingWithSyntheticBlocks() { CompilerOptions options = createCompilerOptions(); options.syntheticBlockStartMarker = "synStart"; options.syntheticBlockEndMarker = "synEnd"; options.setCheckTypes(true); // We used to have a bug where the CFG drew an // edge straight from synStart to f(progress). // If that happens, then progress will get type {number|undefined}. testSame( options, "/** @param {number} x */ function f(x) {}" + "function g() {" + " synStart('foo');" + " var progress = 1;" + " f(progress);" + " synEnd('foo');" + "}"); } public void testCompilerDoesNotBlowUpIfUndefinedSymbols() { CompilerOptions options = createCompilerOptions(); options.setCheckSymbols(true); // Disable the undefined variable check. options.setWarningLevel( DiagnosticGroup.forType(VarCheck.UNDEFINED_VAR_ERROR), CheckLevel.OFF); // The compiler used to throw an IllegalStateException on this. testSame(options, "var x = {foo: y};"); } // Make sure that if we change variables which are constant to have // $$constant appended to their names, we remove that tag before // we finish. public void testConstantTagsMustAlwaysBeRemoved() { CompilerOptions options = createCompilerOptions(); options.setVariableRenaming(VariableRenamingPolicy.LOCAL); String originalText = "var G_GEO_UNKNOWN_ADDRESS=1;\n" + "function foo() {" + " var localVar = 2;\n" + " if (G_GEO_UNKNOWN_ADDRESS == localVar) {\n" + " alert(\"A\"); }}"; String expectedText = "var G_GEO_UNKNOWN_ADDRESS=1;" + "function foo(){var a=2;if(G_GEO_UNKNOWN_ADDRESS==a){alert(\"A\")}}"; test(options, originalText, expectedText); } public void testClosurePassPreservesJsDoc() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); options.setClosurePass(true); test( options, LINE_JOINER.join( CLOSURE_BOILERPLATE, "goog.provide('Foo');", "/** @constructor */ Foo = function() {};", "var x = new Foo();"), LINE_JOINER.join( "var COMPILED=true;", "var goog = {};", "goog.exportSymbol=function() {};", "var Foo = function() {};", "var x = new Foo;")); test(options, CLOSURE_BOILERPLATE + "goog.provide('Foo'); /** @enum */ Foo = {a: 3};", "var COMPILED=true;var goog={};goog.exportSymbol=function(){};var Foo={a:3}"); } public void testProvidedNamespaceIsConst() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setInlineConstantVars(true); options.setCollapseProperties(true); test( options, LINE_JOINER.join( "var goog = {};", "goog.provide('foo');", "function f() { foo = {};}"), LINE_JOINER.join( "var foo = {};", "function f() { foo = {}; }"), ConstCheck.CONST_REASSIGNED_VALUE_ERROR); } public void testProvidedNamespaceIsConst3() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setInlineConstantVars(true); options.setCollapseProperties(true); test( options, "var goog = {}; " + "goog.provide('foo.bar'); goog.provide('foo.bar.baz'); " + "/** @constructor */ foo.bar = function() {};" + "/** @constructor */ foo.bar.baz = function() {};", "var foo$bar = function(){};" + "var foo$bar$baz = function(){};"); } public void testProvidedNamespaceIsConst4() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setInlineConstantVars(true); options.setCollapseProperties(true); test( options, "var goog = {}; goog.provide('foo.Bar'); " + "var foo = {}; foo.Bar = {};", "var foo = {}; foo = {}; foo.Bar = {};"); } public void testProvidedNamespaceIsConst5() { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setInlineConstantVars(true); options.setCollapseProperties(true); test( options, "var goog = {}; goog.provide('foo.Bar'); " + "foo = {}; foo.Bar = {};", "var foo = {}; foo = {}; foo.Bar = {};"); } public void testAtDefineReassigned() { test(createCompilerOptions(), "/** @define {boolean} */ var HI = true; HI = false;", ConstCheck.CONST_REASSIGNED_VALUE_ERROR); } public void testProcessDefinesAdditionalReplacements() { CompilerOptions options = createCompilerOptions(); options.setDefineToBooleanLiteral("HI", false); test(options, "/** @define {boolean} */ var HI = true;", "var HI = false;"); } public void testReplaceMessages() { CompilerOptions options = createCompilerOptions(); String prefix = "var goog = {}; goog.getMsg = function() {};"; testSame(options, prefix + "var MSG_HI = goog.getMsg('hi');"); options.setMessageBundle(new EmptyMessageBundle()); test(options, prefix + "/** @desc xyz */ var MSG_HI = goog.getMsg('hi');", prefix + "var MSG_HI = 'hi';"); } public void testCheckGlobalNames() { CompilerOptions options = createCompilerOptions(); options.setCheckGlobalNamesLevel(CheckLevel.ERROR); test(options, "var x = {}; var y = x.z;", CheckGlobalNames.UNDEFINED_NAME_WARNING); } public void testInlineGetters() { CompilerOptions options = createCompilerOptions(); String code = "function Foo() {} Foo.prototype.bar = function() { return 3; };" + "var x = new Foo(); x.bar();"; testSame(options, code); options.inlineGetters = true; test(options, code, "function Foo() {} Foo.prototype.bar = function() { return 3 };" + "var x = new Foo(); 3;"); } public void testInlineGettersWithAmbiguate() { CompilerOptions options = createCompilerOptions(); String code = "/** @constructor */" + "function Foo() {}" + "/** @type {number} */ Foo.prototype.field;" + "Foo.prototype.getField = function() { return this.field; };" + "/** @constructor */" + "function Bar() {}" + "/** @type {string} */ Bar.prototype.field;" + "Bar.prototype.getField = function() { return this.field; };" + "new Foo().getField();" + "new Bar().getField();"; testSame(options, code); options.inlineGetters = true; test(options, code, "function Foo() {}" + "Foo.prototype.field;" + "Foo.prototype.getField = function() { return this.field; };" + "function Bar() {}" + "Bar.prototype.field;" + "Bar.prototype.getField = function() { return this.field; };" + "new Foo().field;" + "new Bar().field;"); options.setCheckTypes(true); options.setAmbiguateProperties(true); // Propagating the wrong type information may cause ambiguate properties // to generate bad code. testSame(options, code); } public void testInlineVariables() { CompilerOptions options = createCompilerOptions(); String code = "function foo() {} var x = 3; foo(x);"; testSame(options, code); options.setInlineVariables(true); test(options, code, "(function foo() {})(3);"); } public void testInlineConstants() { CompilerOptions options = createCompilerOptions(); String code = "function foo() {} var x = 3; foo(x); var YYY = 4; foo(YYY);"; testSame(options, code); options.setInlineConstantVars(true); test(options, code, "function foo() {} foo(3); foo(4);"); } public void testMinimizeExits() { CompilerOptions options = createCompilerOptions(); String code = "function f() {" + " if (window.foo) return; window.h(); " + "}"; testSame(options, code); options.setFoldConstants(true); test(options, code, "function f() {" + " window.foo || window.h(); " + "}"); } public void testFoldConstants() { CompilerOptions options = createCompilerOptions(); String code = "if (true) { window.foo(); }"; testSame(options, code); options.setFoldConstants(true); test(options, code, "window.foo();"); } public void testRemoveUnreachableCode() { CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.OFF); String code = "function f() { return; f(); }"; testSame(options, code); options.setRemoveDeadCode(true); test(options, code, "function f() {}"); } public void testRemoveUnusedPrototypeProperties1() { CompilerOptions options = createCompilerOptions(); String code = "function Foo() {} " + "Foo.prototype.bar = function() { return new Foo(); };"; testSame(options, code); options.setRemoveUnusedPrototypeProperties(true); test(options, code, "function Foo() {}"); } public void testRemoveUnusedPrototypeProperties2() { CompilerOptions options = createCompilerOptions(); String code = "function Foo() {} " + "Foo.prototype.bar = function() { return new Foo(); };" + "function f(x) { x.bar(); }"; testSame(options, code); options.setRemoveUnusedPrototypeProperties(true); testSame(options, code); options.setRemoveUnusedVariables(Reach.ALL); test(options, code, ""); } public void testSmartNamePass() { CompilerOptions options = createCompilerOptions(); String code = "function Foo() { this.bar(); } " + "Foo.prototype.bar = function() { return Foo(); };"; testSame(options, code); options.setSmartNameRemoval(true); test(options, code, ""); } public void testClassWithGettersIsRemoved() { CompilerOptions options = createCompilerOptions(); String code = "class Foo { get xx() {}; set yy(v) {}; static get init() {}; static set prop(v) {} }"; // TODO(radokirov): The compiler should be removing statics too, but in this case they are // kept. A similar unittest in RemoveUnusedClassPropertiesTest removes everything. // Investigate why are they kept when ran together with other passes. String expected = LINE_JOINER.join( "('undefined'!=typeof window&&window===this?this:'undefined'!=typeof ", "global&&null!=global?global:this).", "c.defineProperties(function() {},", "{e:{a:!0,b:!0,d:function(){}},", // renamed from init "f:{a:!0,b:!0,g:function(){}}})"); // renamed from prop options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT5); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setExtraSmartNameRemoval(false); test(options, code, expected); } public void testSmartNamePassBug11163486() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); options.setDisambiguateProperties(true); options.setRemoveDeadCode(true); options.setRemoveUnusedPrototypeProperties(true); options.setSmartNameRemoval(true); options.extraSmartNameRemoval = true; options.setWarningLevel(DiagnosticGroups.MISSING_PROPERTIES, CheckLevel.OFF); String code = "/** @constructor */ function A() {} " + "A.prototype.foo = function() { " + " window.console.log('A'); " + "}; " + "/** @constructor */ function B() {} " + "B.prototype.foo = function() { " + " window.console.log('B'); " + "};" + "window['main'] = function() { " + " var a = window['a'] = new A; " + " a.foo(); " + " window['b'] = new B; " + "}; " + "function notCalled() { " + " var something = {}; " + " something.foo(); " + "}"; String expected = "function A() {} " + "A.prototype.A_prototype$foo = function() { " + " window.console.log('A'); " + "}; " + "function B() {} " + "window['main'] = function() { " + " var a = window['a'] = new A; " + " a.A_prototype$foo(); " + " window['b'] = new B; " + "}"; test(options, code, expected); } public void testDeadCodeHasNoDisambiguationSideEffects() { // This test case asserts that unreachable code does not // confuse the disambigation process and type inferencing. CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); options.setDisambiguateProperties(true); options.setRemoveDeadCode(true); options.setRemoveUnusedPrototypeProperties(true); options.setSmartNameRemoval(true); options.extraSmartNameRemoval = true; options.setFoldConstants(true); options.setInlineVariables(true); options.setWarningLevel(DiagnosticGroups.MISSING_PROPERTIES, CheckLevel.OFF); String code = "/** @constructor */ function A() {} " + "A.prototype.always = function() { " + " window.console.log('AA'); " + "}; " + "A.prototype.sometimes = function() { " + " window.console.log('SA'); " + "}; " + "/** @constructor */ function B() {} " + "B.prototype.always = function() { " + " window.console.log('AB'); " + "};" + "B.prototype.sometimes = function() { " + " window.console.log('SB'); " + "};" + "/** @constructor @struct @template T */ function C() {} " + "/** @param {!T} x */ C.prototype.touch = function(x) { " + " return x.sometimes(); " + "}; " + "window['main'] = function() { " + " var a = window['a'] = new A; " + " a.always(); " + " a.sometimes(); " + " var b = window['b'] = new B; " + " b.always(); " + "};" + "function notCalled() { " + " var something = {}; " + " something.always(); " + " var c = new C; " + " c.touch(something);" + "}"; // B.prototype.sometimes should be stripped out, as it is not used, and the // type ambiguity in function notCalled is unreachable. String expected = "function A() {} " + "A.prototype.A_prototype$always = function() { " + " window.console.log('AA'); " + "}; " + "A.prototype.A_prototype$sometimes = function(){ " + " window.console.log('SA'); " + "}; " + "function B() {} " + "B.prototype.B_prototype$always=function(){ " + " window.console.log('AB'); " + "};" + "window['main'] = function() { " + " var a = window['a'] = new A; " + " a.A_prototype$always(); " + " a.A_prototype$sometimes(); " + " (window['b'] = new B).B_prototype$always(); " + "}"; test(options, code, expected); } public void testQMarkTIsNullable() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); String code = LINE_JOINER.join( "/** @constructor @template T */", "function F() {}", "", "/** @return {?T} */", "F.prototype.foo = function() {", " return null;", "}", "", "/** @type {F<string>} */", "var f = new F;", "/** @type {string} */", "var s = f.foo(); // Type error: f.foo() has type {?string}."); test(options, code, TYPE_MISMATCH_WARNING); } public void testTIsNotNullable() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); String code = LINE_JOINER.join("/** @constructor @template T */", "function F() {}", "", "/** @param {T} t */", "F.prototype.foo = function(t) {", "}", "", "/** @type {F<string>} */", "var f = new F;", "/** @type {?string} */", "var s = null;", "f.foo(s); // Type error: f.foo() takes a {string}, not a {?string}"); test(options, code, TYPE_MISMATCH_WARNING); } public void testDeadAssignmentsElimination() { CompilerOptions options = createCompilerOptions(); String code = "function f() { var x = 3; 4; x = 5; return x; } f(); "; testSame(options, code); options.setDeadAssignmentElimination(true); testSame(options, code); options.setRemoveUnusedVariables(Reach.ALL); test(options, code, "function f() { 3; 4; var x = 5; return x; } f();"); } public void testPreservesCastInformation() { // Only set the suffix instead of both prefix and suffix, because J2CL pass // looks for that exact suffix, and IntegrationTestCase adds an input // id number between prefix and suffix. inputFileNameSuffix = "vmbootstrap/Arrays.impl.java.js"; CompilerOptions options = new CompilerOptions(); String code = LINE_JOINER.join( "/** @constructor */", "var Arrays = function() {};", "Arrays.$create = function() { return {}; }", "/** @constructor */", "function Foo() { this.myprop = 1; }", "/** @constructor */", "function Bar() { this.myprop = 2; }", "var x = /** @type {!Foo} */ (Arrays.$create()).myprop;"); options.setCheckTypes(true); options.setJ2clPass(J2clPassMode.TRUE); options.setDisambiguateProperties(true); test(options, code, LINE_JOINER.join( "/** @constructor */", "var Arrays = function() {};", "Arrays.$create = function() { return {}; }", "/** @constructor */", "function Foo() { this.Foo$myprop = 1; }", "/** @constructor */", "function Bar() { this.Bar$myprop = 2; }", "var x = {}.Foo$myprop;")); } public void testInliningLocalVarsPreservesCasts() { String code = LINE_JOINER.join( "/** @constructor */", "function Foo() { this.myprop = 1; }", "/** @constructor */", "function Bar() { this.myprop = 2; }", "/** @return {Object} */", "function getSomething() {", " var x = new Bar();", " return new Foo();", "}", "(function someMethod() {", " var x = getSomething();", " var y = /** @type {Foo} */ (x).myprop;", " return 1 != y;", "})()"); CompilerOptions options = new CompilerOptions(); options.setCheckTypes(true); options.setSmartNameRemoval(true); options.setFoldConstants(true); options.setExtraSmartNameRemoval(true); options.setInlineVariables(true); options.setDisambiguateProperties(true); // Verify that property disambiguation continues to work after the local // var and cast have been removed by inlining. test(options, code, LINE_JOINER.join( "/** @constructor */", "function Foo() { this.Foo$myprop = 1; }", "/** @constructor */", "function Bar() { this.Bar$myprop = 2; }", "/** @return {Object} */", "function getSomething() {", " var x = new Bar();", " return new Foo();", "}", "(function someMethod() {", " return 1 != getSomething().Foo$myprop;", "})()")); } /** * Tests that inlining of local variables doesn't destroy type information * when the cast is from a non-nullable type to a nullable type. */ public void testInliningLocalVarsPreservesCastsNullable() { String code = LINE_JOINER.join( "/** @constructor */", "function Foo() { this.myprop = 1; }", "/** @constructor */", "function Bar() { this.myprop = 2; }", // Note that this method return a non-nullable type. "/** @return {!Object} */", "function getSomething() {", " var x = new Bar();", " return new Foo();", "}", "(function someMethod() {", " var x = getSomething();", // Note that this casts from !Object to ?Foo. " var y = /** @type {Foo} */ (x).myprop;", " return 1 != y;", "})()"); CompilerOptions options = new CompilerOptions(); options.setCheckTypes(true); options.setSmartNameRemoval(true); options.setFoldConstants(true); options.setExtraSmartNameRemoval(true); options.setInlineVariables(true); options.setDisambiguateProperties(true); // Verify that property disambiguation continues to work after the local // var and cast have been removed by inlining. test(options, code, LINE_JOINER.join( "/** @constructor */", "function Foo() { this.Foo$myprop = 1; }", "/** @constructor */", "function Bar() { this.Bar$myprop = 2; }", "/** @return {Object} */", "function getSomething() {", " var x = new Bar();", " return new Foo();", "}", "(function someMethod() {", " return 1 != getSomething().Foo$myprop;", "})()")); } public void testInlineFunctions() { CompilerOptions options = createCompilerOptions(); String code = "function f() { return 3; } f(); "; testSame(options, code); options.setInlineFunctions(true); test(options, code, "3;"); } public void testRemoveUnusedVars1() { CompilerOptions options = createCompilerOptions(); String code = "function f(x) {} f();"; testSame(options, code); options.setRemoveUnusedVariables(Reach.ALL); test(options, code, "function f() {} f();"); } public void testRemoveUnusedVars2() { CompilerOptions options = createCompilerOptions(); String code = "(function f(x) {})();var g = function() {}; g();"; testSame(options, code); options.setRemoveUnusedVariables(Reach.ALL); test(options, code, "(function() {})();var g = function() {}; g();"); options.setAnonymousFunctionNaming(AnonymousFunctionNamingPolicy.UNMAPPED); test(options, code, "(function f() {})();var g = function $g$() {}; g();"); } public void testCrossModuleCodeMotion() { CompilerOptions options = createCompilerOptions(); String[] code = new String[] { "var x = 1;", "x;", }; testSame(options, code); options.setCrossModuleCodeMotion(true); test(options, code, new String[] { "", "var x = 1; x;", }); } public void testCrossModuleMethodMotion() { CompilerOptions options = createCompilerOptions(); String[] code = new String[] { "var Foo = function() {}; Foo.prototype.bar = function() {};" + "var x = new Foo();", "x.bar();", }; testSame(options, code); options.setCrossModuleMethodMotion(true); test(options, code, new String[] { CrossModuleMethodMotion.STUB_DECLARATIONS + "var Foo = function() {};" + "Foo.prototype.bar=JSCompiler_stubMethod(0); var x=new Foo;", "Foo.prototype.bar=JSCompiler_unstubMethod(0,function(){}); x.bar()", }); } public void testCrossModuleDepCheck() { CompilerOptions options = createCompilerOptions(); String[] code = new String[] { "var goog = {}; new goog.Foo();", "/** @constructor */ goog.Foo = function() {};", }; testSame(options, code); WarningLevel.VERBOSE.setOptionsForWarningLevel(options); test(options, code, code, CheckGlobalNames.STRICT_MODULE_DEP_QNAME); } public void testFlowSensitiveInlineVariables1() { CompilerOptions options = createCompilerOptions(); String code = "function f() { var x = 3; x = 5; return x; }"; testSame(options, code); options.setInlineVariables(true); test(options, code, "function f() { var x = 3; return 5; }"); String unusedVar = "function f() { var x; x = 5; return x; } f()"; test(options, unusedVar, "(function f() { var x; return 5; })()"); options.setRemoveUnusedVariables(Reach.ALL); test(options, unusedVar, "(function () { return 5; })()"); } public void testFlowSensitiveInlineVariables2() { CompilerOptions options = createCompilerOptions(); CompilationLevel.SIMPLE_OPTIMIZATIONS .setOptionsForCompilationLevel(options); test(options, "function f () {\n" + " var ab = 0;\n" + " ab += '-';\n" + " alert(ab);\n" + "}", "function f () {\n" + " alert('0-');\n" + "}"); } // Github issue #1540: https://github.com/google/closure-compiler/issues/1540 public void testFlowSensitiveInlineVariablesUnderAdvanced() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.ADVANCED_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); options.setCheckSymbols(false); test(options, LINE_JOINER.join( "function f(x) {", " var a = x + 1;", " var b = x + 1;", " window.c = x > 5 ? a : b;", "}", "f(g);"), "window.a = g + 1;"); } public void testCollapseAnonymousFunctions() { CompilerOptions options = createCompilerOptions(); String code = "var f = function() {};"; testSame(options, code); options.setCollapseAnonymousFunctions(true); test(options, code, "function f() {}"); } public void testMoveFunctionDeclarations() { CompilerOptions options = createCompilerOptions(); String code = "var x = f(); function f() { return 3; }"; testSame(options, code); options.moveFunctionDeclarations = true; test(options, code, "var f = function() { return 3; }; var x = f();"); } public void testNameAnonymousFunctions() { CompilerOptions options = createCompilerOptions(); String code = "var f = function() {};"; testSame(options, code); options.setAnonymousFunctionNaming(AnonymousFunctionNamingPolicy.MAPPED); test(options, code, "var f = function $() {}"); assertNotNull(lastCompiler.getResult().namedAnonFunctionMap); options.setAnonymousFunctionNaming(AnonymousFunctionNamingPolicy.UNMAPPED); test(options, code, "var f = function $f$() {}"); assertNull(lastCompiler.getResult().namedAnonFunctionMap); } public void testNameAnonymousFunctionsWithVarRemoval() { CompilerOptions options = createCompilerOptions(); options.setRemoveUnusedVariables(CompilerOptions.Reach.LOCAL_ONLY); options.setInlineVariables(true); String code = "var f = function longName() {}; var g = function() {};" + "function longerName() {} var i = longerName;"; test(options, code, "var f = function() {}; var g = function() {}; " + "var i = function() {};"); options.setAnonymousFunctionNaming(AnonymousFunctionNamingPolicy.MAPPED); test(options, code, "var f = function longName() {}; var g = function $() {};" + "var i = function longerName(){};"); assertNotNull(lastCompiler.getResult().namedAnonFunctionMap); options.setAnonymousFunctionNaming(AnonymousFunctionNamingPolicy.UNMAPPED); test(options, code, "var f = function longName() {}; var g = function $g$() {};" + "var i = function longerName(){};"); assertNull(lastCompiler.getResult().namedAnonFunctionMap); } public void testExtractPrototypeMemberDeclarations() { CompilerOptions options = createCompilerOptions(); String code = "var f = function() {};"; String expected = "var a; var b = function() {}; a = b.prototype;"; for (int i = 0; i < 10; i++) { code += "f.prototype.a = " + i + ";"; expected += "a.a = " + i + ";"; } testSame(options, code); options.setExtractPrototypeMemberDeclarations(true); options.setVariableRenaming(VariableRenamingPolicy.ALL); test(options, code, expected); } public void testDevirtualizationAndExtractPrototypeMemberDeclarations() { CompilerOptions options = createCompilerOptions(); options.setDevirtualizePrototypeMethods(true); options.setCollapseAnonymousFunctions(true); options.setExtractPrototypeMemberDeclarations(true); options.setVariableRenaming(VariableRenamingPolicy.ALL); String code = "var f = function() {};"; String expected = "var a; function b() {} a = b.prototype;"; for (int i = 0; i < 10; i++) { code += "f.prototype.argz = function() {arguments};"; code += "f.prototype.devir" + i + " = function() {};"; char letter = (char) ('d' + i); // skip i,j,o (reserved) if (letter >= 'i') { letter++; } if (letter >= 'j') { letter++; } if (letter >= 'o') { letter++; } expected += "a.argz = function() {arguments};"; expected += "function " + letter + "(c){}"; } code += "var F = new f(); F.argz();"; expected += "var q = new b(); q.argz();"; for (int i = 0; i < 10; i++) { code += "F.devir" + i + "();"; char letter = (char) ('d' + i); // skip i,j,o (reserved) if (letter >= 'i') { letter++; } if (letter >= 'j') { letter++; } if (letter >= 'o') { letter++; } expected += letter + "(q);"; } test(options, code, expected); } public void testPropertyRenaming() { CompilerOptions options = createCompilerOptions(); String code = "function f() { return this.foo + this['bar'] + this.Baz; }" + "f.prototype.bar = 3; f.prototype.Baz = 3;"; String all = "function f() { return this.c + this['bar'] + this.a; }" + "f.prototype.b = 3; f.prototype.a = 3;"; testSame(options, code); options.setPropertyRenaming(PropertyRenamingPolicy.ALL_UNQUOTED); test(options, code, all); } public void testConvertToDottedProperties() { CompilerOptions options = createCompilerOptions(); String code = "function f() { return this['bar']; } f.prototype.bar = 3;"; String expected = "function f() { return this.bar; } f.prototype.a = 3;"; testSame(options, code); options.convertToDottedProperties = true; options.setPropertyRenaming(PropertyRenamingPolicy.ALL_UNQUOTED); test(options, code, expected); } public void testRewriteFunctionExpressions() { CompilerOptions options = createCompilerOptions(); String code = "var a = function() {};"; String expected = "function JSCompiler_emptyFn(){return function(){}} " + "var a = JSCompiler_emptyFn();"; for (int i = 0; i < 10; i++) { code += "a = function() {};"; expected += "a = JSCompiler_emptyFn();"; } testSame(options, code); options.setRewriteFunctionExpressions(true); test(options, code, expected); } public void testAliasAllStrings() { CompilerOptions options = createCompilerOptions(); String code = "function f() {" + " return 'aaaaaaaaaaaaaaaaaaaa' + 'aaaaaaaaaaaaaaaaaaaa';" + "}"; String expected = "var $$S_aaaaaaaaaaaaaaaaaaaa = 'aaaaaaaaaaaaaaaaaaaa';" + "function f() {" + " return $$S_aaaaaaaaaaaaaaaaaaaa + $$S_aaaaaaaaaaaaaaaaaaaa;" + "}"; testSame(options, code); options.setAliasAllStrings(true); test(options, code, expected); } public void testRenameVars1() { CompilerOptions options = createCompilerOptions(); String code = "var abc = 3; function f() { var xyz = 5; return abc + xyz; }"; String local = "var abc = 3; function f() { var a = 5; return abc + a; }"; String all = "var a = 3; function c() { var b = 5; return a + b; }"; testSame(options, code); options.setVariableRenaming(VariableRenamingPolicy.LOCAL); test(options, code, local); options.setVariableRenaming(VariableRenamingPolicy.ALL); test(options, code, all); options.reserveRawExports = true; } public void testRenameVars2() { CompilerOptions options = createCompilerOptions(); options.setVariableRenaming(VariableRenamingPolicy.ALL); String code = "var abc = 3; function f() { window['a'] = 5; }"; String noexport = "var a = 3; function b() { window['a'] = 5; }"; String export = "var b = 3; function c() { window['a'] = 5; }"; options.reserveRawExports = false; test(options, code, noexport); options.reserveRawExports = true; test(options, code, export); } public void testShadowVaribles() { CompilerOptions options = createCompilerOptions(); options.setVariableRenaming(VariableRenamingPolicy.LOCAL); options.shadowVariables = true; String code = "var f = function(x) { return function(y) {}}"; String expected = "var f = function(a) { return function(a) {}}"; test(options, code, expected); } public void testRenameLabels() { CompilerOptions options = createCompilerOptions(); String code = "longLabel: for(;true;) { break longLabel; }"; String expected = "a: for(;true;) { break a; }"; testSame(options, code); options.labelRenaming = true; test(options, code, expected); } public void testBadBreakStatementInIdeMode() { // Ensure that type-checking doesn't crash, even if the CFG is malformed. // This can happen in IDE mode. CompilerOptions options = createCompilerOptions(); options.setIdeMode(true); options.setCheckTypes(true); options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.OFF); test(options, "function f() { try { } catch(e) { break; } }", RhinoErrorReporter.PARSE_ERROR); } // https://github.com/google/closure-compiler/issues/2388 public void testNoCrash_varInCatch() { CompilerOptions options = createCompilerOptions(); options.setInlineFunctions(true); test( options, LINE_JOINER.join( "(function() {", " try {", " x = 2;", " } catch (e) {", " var x = 1;", " }", "})();"), LINE_JOINER.join( "{", " var x$jscomp$inline_0;", " try {", " x$jscomp$inline_0 = 2;", " } catch (e) {", " x$jscomp$inline_0 = 1;", " }", "}")); } // https://github.com/google/closure-compiler/issues/2364 public void testNoCrash_varInCatch2() { CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.OFF); test( options, LINE_JOINER.join( "function foo() {", " var msg;", "}", "", "function bar() {", " msg;", " try {}", " catch(err) {", " var msg;", " }", "}"), LINE_JOINER.join( "function foo() {", " var msg;", "}", "function bar(){", " var msg;", " msg;", " try{}", " catch(err){}", "}")); } public void testIssue63SourceMap() { CompilerOptions options = createCompilerOptions(); String code = "var a;"; options.skipNonTranspilationPasses = true; options.sourceMapOutputPath = "./src.map"; Compiler compiler = compile(options, code); compiler.toSource(); } public void testRegExp1() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); String code = "/(a)/.test(\"a\");"; testSame(options, code); options.setComputeFunctionSideEffects(true); String expected = ""; test(options, code, expected); } public void testRegExp2() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); String code = "/(a)/.test(\"a\");var a = RegExp.$1"; testSame(options, code); options.setComputeFunctionSideEffects(true); test(options, code, CheckRegExp.REGEXP_REFERENCE); options.setWarningLevel(DiagnosticGroups.CHECK_REGEXP, CheckLevel.OFF); testSame(options, code); } public void testFoldLocals1() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); // An external object, whose constructor has no side-effects, // and whose method "go" only modifies the object. String code = "new Widget().go();"; testSame(options, code); options.setComputeFunctionSideEffects(true); test(options, code, ""); } public void testFoldLocals2() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); options.setCheckTypes(true); options.setWarningLevel(DiagnosticGroups.MISSING_PROPERTIES, CheckLevel.OFF); // An external function that returns a local object that the // method "go" that only modifies the object. String code = "widgetToken().go();"; testSame(options, code); options.setComputeFunctionSideEffects(true); test(options, code, "widgetToken()"); } public void testFoldLocals3() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); // A function "f" who returns a known local object, and a method that // modifies only modifies that. String definition = "function f(){return new Widget()}"; String call = "f().go();"; String code = definition + call; testSame(options, code); options.setComputeFunctionSideEffects(true); // BROKEN //test(options, code, definition); testSame(options, code); } public void testFoldLocals4() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); String code = "/** @constructor */\n" + "function InternalWidget(){this.x = 1;}" + "InternalWidget.prototype.internalGo = function (){this.x = 2};" + "new InternalWidget().internalGo();"; testSame(options, code); options.setComputeFunctionSideEffects(true); String optimized = "" + "function InternalWidget(){this.x = 1;}" + "InternalWidget.prototype.internalGo = function (){this.x = 2};"; test(options, code, optimized); } public void testFoldLocals5() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); String code = "" + "function fn(){var a={};a.x={};return a}" + "fn().x.y = 1;"; // "fn" returns a unescaped local object, we should be able to fold it, // but we don't currently. String result = "" + "function fn(){var a={x:{}};return a}" + "fn().x.y = 1;"; test(options, code, result); options.setComputeFunctionSideEffects(true); test(options, code, result); } public void testFoldLocals6() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); String code = "" + "function fn(){return {}}" + "fn().x.y = 1;"; testSame(options, code); options.setComputeFunctionSideEffects(true); testSame(options, code); } public void testFoldLocals7() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); String code = "" + "function InternalWidget(){return [];}" + "Array.prototype.internalGo = function (){this.x = 2};" + "InternalWidget().internalGo();"; testSame(options, code); options.setComputeFunctionSideEffects(true); String optimized = "" + "function InternalWidget(){return [];}" + "Array.prototype.internalGo = function (){this.x = 2};"; test(options, code, optimized); } public void testVarDeclarationsIntoFor() { CompilerOptions options = createCompilerOptions(); options.setCollapseVariableDeclarations(false); String code = "var a = 1; for (var b = 2; ;) {}"; testSame(options, code); options.setCollapseVariableDeclarations(true); test(options, code, "for (var a = 1, b = 2; ;) {}"); } public void testExploitAssigns() { CompilerOptions options = createCompilerOptions(); options.setCollapseVariableDeclarations(false); String code = "a = 1; b = a; c = b"; testSame(options, code); options.setCollapseVariableDeclarations(true); test(options, code, "c=b=a=1"); } public void testRecoverOnBadExterns() throws Exception { // This test is for a bug in a very narrow set of circumstances: // 1) externs validation has to be off. // 2) aliasExternals has to be on. // 3) The user has to reference a "normal" variable in externs. // This case is handled at checking time by injecting a // synthetic extern variable, and adding a "@suppress {duplicate}" to // the normal code at compile time. But optimizations may remove that // annotation, so we need to make sure that the variable declarations // are de-duped before that happens. CompilerOptions options = createCompilerOptions(); externs = ImmutableList.of(SourceFile.fromCode("externs", "extern.foo")); test(options, "var extern; " + "function f() { return extern + extern + extern + extern; }", "var extern; " + "function f() { return extern + extern + extern + extern; }", VarCheck.UNDEFINED_EXTERN_VAR_ERROR); } public void testDuplicateVariablesInExterns() { CompilerOptions options = createCompilerOptions(); options.setCheckSymbols(true); externs = ImmutableList.of(SourceFile.fromCode( "externs", "var externs = {}; /** @suppress {duplicate} */ var externs = {};")); testSame(options, ""); } public void testLanguageMode() { CompilerOptions options = createCompilerOptions(); String code = "var a = {get f(){}}"; options.setLanguageIn(LanguageMode.ECMASCRIPT3); Compiler compiler = compile(options, code); checkUnexpectedErrorsOrWarnings(compiler, 1); assertEquals( "JSC_PARSE_ERROR. Parse error." + " getters are not supported in older versions of JavaScript." + " If you are targeting newer versions of JavaScript," + " set the appropriate language_in option." + " at i0.js line 1 : 0", compiler.getErrors()[0].toString()); options.setLanguageIn(LanguageMode.ECMASCRIPT5); testSame(options, code); options.setLanguageIn(LanguageMode.ECMASCRIPT5_STRICT); testSame(options, code); } public void testLanguageMode2() { CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.ES5_STRICT, CheckLevel.OFF); String code = "var a = 2; delete a;"; options.setLanguageIn(LanguageMode.ECMASCRIPT3); testSame(options, code); options.setLanguageIn(LanguageMode.ECMASCRIPT5); testSame(options, code); options.setLanguageIn(LanguageMode.ECMASCRIPT5_STRICT); test(options, code, code, StrictModeCheck.DELETE_VARIABLE); } public void testIssue598() { CompilerOptions options = createCompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT5_STRICT); WarningLevel.VERBOSE.setOptionsForWarningLevel(options); options.setLanguageIn(LanguageMode.ECMASCRIPT5); options.setLanguageOut(LanguageMode.ECMASCRIPT5); String code = "'use strict';\n" + "function App() {}\n" + "App.prototype = {\n" + " get appData() { return this.appData_; },\n" + " set appData(data) { this.appData_ = data; }\n" + "};"; testSame(options, code); } public void testCheckStrictMode() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); WarningLevel.VERBOSE.setOptionsForWarningLevel(options); externs = ImmutableList.of( SourceFile.fromCode( "externs", "var use; var arguments; arguments.callee;")); String code = "function App() {}\n" + "App.prototype.method = function(){\n" + " use(arguments.callee)\n" + "};"; test(options, code, "", StrictModeCheck.ARGUMENTS_CALLEE_FORBIDDEN); } public void testIssue701() { // Check ASCII art in license comments. String ascii = "/**\n" + " * @preserve\n" + " This\n" + " is\n" + " ASCII ART\n" + "*/"; String result = "/*\n\n" + " This\n" + " is\n" + " ASCII ART\n" + "*/\n"; testSame(createCompilerOptions(), ascii); assertEquals(result, lastCompiler.toSource()); } public void testIssue724() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setCheckSymbols(false); options.setCheckTypes(false); String code = "isFunction = function(functionToCheck) {" + " var getType = {};" + " return functionToCheck && " + " getType.toString.apply(functionToCheck) === " + " '[object Function]';" + "};"; String result = "isFunction=function(a){var b={};" + "return a&&\"[object Function]\"===b.b.a(a)}"; test(options, code, result); } public void testIssue730() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); String code = "/** @constructor */function A() {this.foo = 0; Object.seal(this);}\n" + "/** @constructor */function B() {this.a = new A();}\n" + "B.prototype.dostuff = function() {this.a.foo++;alert('hi');}\n" + "new B().dostuff();\n"; test(options, code, "function a(){this.b=0;Object.seal(this)}" + "(new function(){this.a=new a}).a.b++;" + "alert(\"hi\")"); options.setRemoveUnusedClassProperties(true); // This is still not a problem when removeUnusedClassProperties is enabled. test(options, code, "function a(){this.b=0;Object.seal(this)}" + "(new function(){this.a=new a}).a.b++;" + "alert(\"hi\")"); } public void testAddFunctionProperties1() throws Exception { String source = "var Foo = {};" + "var addFuncProp = function(o) {" + " o.f = function() {}" + "};" + "addFuncProp(Foo);" + "alert(Foo.f());"; String expected = "alert(void 0);"; CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); options.setRenamingPolicy( VariableRenamingPolicy.OFF, PropertyRenamingPolicy.OFF); test(options, source, expected); } public void testAddFunctionProperties2() throws Exception { String source = "/** @constructor */ function F() {}" + "var x = new F();" + "/** @this {F} */" + "function g() { this.bar = function() { alert(3); }; }" + "g.call(x);" + "x.bar();"; String expected = "var x = new function() {};" + "/** @this {F} */" + "(function () { this.bar = function() { alert(3); }; }).call(x);" + "x.bar();"; CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); options.setRenamingPolicy( VariableRenamingPolicy.OFF, PropertyRenamingPolicy.OFF); test(options, source, expected); } public void testAddFunctionProperties3() throws Exception { String source = "/** @constructor */ function F() {}" + "var x = new F();" + "/** @this {F} */" + "function g(y) { y.bar = function() { alert(3); }; }" + "g(x);" + "x.bar();"; String expected = "var x = new function() {};" + "/** @this {F} */" + "(function (y) { y.bar = function() { alert(3); }; })(x);" + "x.bar();"; CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); options.setRenamingPolicy( VariableRenamingPolicy.OFF, PropertyRenamingPolicy.OFF); options.setCheckTypes(false); test(options, source, expected); } public void testAddFunctionProperties4() throws Exception { String source = "/** @constructor */" + "var Foo = function() {};" + "var goog = {};" + "goog.addSingletonGetter = function(o) {" + " o.f = function() {" + " o.i = new o;" + " };" + "};" + "goog.addSingletonGetter(Foo);" + "alert(Foo.f());"; String expected = "function Foo(){} Foo.f=function(){Foo.i=new Foo}; alert(Foo.f());"; CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setRenamingPolicy(VariableRenamingPolicy.OFF, PropertyRenamingPolicy.OFF); test(options, source, expected); } public void testCoalesceVariableNames() { CompilerOptions options = createCompilerOptions(); String code = "function f() {var x = 3; var y = x; var z = y; return z;}"; testSame(options, code); options.setCoalesceVariableNames(true); test(options, code, "function f() {var x = 3; x = x; x = x; return x;}"); } public void testCoalesceVariables() { CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.OFF); options.setFoldConstants(false); options.setCoalesceVariableNames(true); String code = "function f(a) {" + " if (a) {" + " return a;" + " } else {" + " var b = a;" + " return b;" + " }" + " return a;" + "}"; String expected = "function f(a) {" + " if (a) {" + " return a;" + " } else {" + " a = a;" + " return a;" + " }" + " return a;" + "}"; test(options, code, expected); options.setFoldConstants(true); options.setCoalesceVariableNames(false); code = "function f(a) {" + " if (a) {" + " return a;" + " } else {" + " var b = a;" + " return b;" + " }" + " return a;" + "}"; expected = "function f(a) {" + " if (!a) {" + " var b = a;" + " return b;" + " }" + " return a;" + "}"; test(options, code, expected); options.setFoldConstants(true); options.setCoalesceVariableNames(true); expected = "function f(a) {" + " return a;" + "}"; test(options, code, expected); } public void testLateStatementFusion() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); test(options, "while(a){a();if(b){b();b()}}", "for(;a;)a(),b&&(b(),b())"); } public void testLateConstantReordering() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); test(options, "if (((x < 1 || x > 1) || 1 < x) || 1 > x) { alert(x) }", " (((1 > x || 1 < x) || 1 < x) || 1 > x) && alert(x) "); } public void testsyntheticBlockOnDeadAssignments() { CompilerOptions options = createCompilerOptions(); options.setDeadAssignmentElimination(true); options.setRemoveUnusedVariables(Reach.ALL); options.syntheticBlockStartMarker = "START"; options.syntheticBlockEndMarker = "END"; test(options, "var x; x = 1; START(); x = 1;END();x()", "var x; x = 1;{START();{x = 1}END()}x()"); } public void testBug4152835() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); options.syntheticBlockStartMarker = "START"; options.syntheticBlockEndMarker = "END"; test(options, "START();END()", "{START();{}END()}"); } public void testNoFuseIntoSyntheticBlock() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); options.syntheticBlockStartMarker = "START"; options.syntheticBlockEndMarker = "END"; options.aggressiveFusion = false; testSame(options, "for(;;) { x = 1; {START(); {z = 3} END()} }"); testSame(options, "x = 1; y = 2; {START(); {z = 3} END()} f()"); options.aggressiveFusion = true; testSame(options, "x = 1; {START(); {z = 3} END()} f()"); test(options, "x = 1; y = 3; {START(); {z = 3} END()} f()", "x = 1, y = 3; {START(); {z = 3} END()} f()"); } public void testBug5786871() { CompilerOptions options = createCompilerOptions(); options.setIdeMode(true); testParseError(options, "function () {}"); } public void testIssue378() { CompilerOptions options = createCompilerOptions(); options.setInlineVariables(true); testSame( options, "function f(c) {var f = c; arguments[0] = this;" + " f.apply(this, arguments); return this;}"); } public void testIssue550() { CompilerOptions options = createCompilerOptions(); CompilationLevel.SIMPLE_OPTIMIZATIONS .setOptionsForCompilationLevel(options); options.setFoldConstants(true); options.setInlineVariables(true); test( options, "function f(h) {\n" + " var a = h;\n" + " a = a + 'x';\n" + " a = a + 'y';\n" + " return a;\n" + "}", "function f(a) { return a += 'xy'; }"); } public void testIssue1168() { CompilerOptions options = createCompilerOptions(); CompilationLevel.SIMPLE_OPTIMIZATIONS .setOptionsForCompilationLevel(options); options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.OFF); test( options, "while (function () {\n" + " function f(){};\n" + " L: while (void(f += 3)) {}\n" + "}) {}", "for( ; ; );"); } public void testIssue1198() throws Exception { CompilerOptions options = createCompilerOptions(); CompilationLevel.SIMPLE_OPTIMIZATIONS .setOptionsForCompilationLevel(options); options.setWarningLevel(DiagnosticGroups.CHECK_USELESS_CODE, CheckLevel.OFF); test(options, "function f(x) { return 1; do { x(); } while (true); }", "function f(a) { return 1; }"); } public void testIssue1131() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); test(options, "function f(k) { return k(k); } alert(f(f));", "function a(b) { return b(b); } alert(a(a));"); } public void testIssue284() { CompilerOptions options = createCompilerOptions(); options.setSmartNameRemoval(true); test( options, "var goog = {};" + "goog.inherits = function(x, y) {};" + "var ns = {};" + "/** @constructor */" + "ns.PageSelectionModel = function() {};" + "/** @constructor */" + "ns.PageSelectionModel.FooEvent = function() {};" + "/** @constructor */" + "ns.PageSelectionModel.SelectEvent = function() {};" + "goog.inherits(ns.PageSelectionModel.ChangeEvent," + " ns.PageSelectionModel.FooEvent);", ""); } public void testIssue772() throws Exception { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setCheckTypes(true); test( options, "/** @const */ var a = {};" + "/** @const */ a.b = {};" + "/** @const */ a.b.c = {};" + "goog.scope(function() {" + " var b = a.b;" + " var c = b.c;" + " /** @typedef {string} */" + " c.MyType;" + " /** @param {c.MyType} x The variable. */" + " c.myFunc = function(x) {};" + "});", "/** @const */ var a = {};" + "/** @const */ a.b = {};" + "/** @const */ a.b.c = {};" + "a.b.c.MyType;" + "a.b.c.myFunc = function(x) {};"); } public void testSuppressBadGoogRequire() throws Exception { CompilerOptions options = createCompilerOptions(); options.setClosurePass(true); options.setCheckTypes(true); test( options, "/** @suppress {closureDepMethodUsageChecks} */\n" + "function f() { goog.require('foo'); }\n" + "f();", "function f() { goog.require('foo'); }\n" + "f();"); } public void testIssue1204() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); WarningLevel.VERBOSE .setOptionsForWarningLevel(options); test(options, "goog.scope(function () {" + " /** @constructor */ function F(x) { this.x = x; }" + " alert(new F(1));" + "});", "alert(new function(){}(1));"); } public void testCodingConvention() { Compiler compiler = new Compiler(); compiler.initOptions(new CompilerOptions()); assertEquals( compiler.getCodingConvention().getClass().toString(), ClosureCodingConvention.class.toString()); } public void testJQueryStringSplitLoops() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); test(options, "var x=['1','2','3','4','5','6','7']", "var x='1234567'.split('')"); options = createCompilerOptions(); options.setFoldConstants(true); options.setComputeFunctionSideEffects(false); options.setRemoveUnusedVariables(Reach.ALL); // If we do splits too early, it would add a side-effect to x. test(options, "var x=['1','2','3','4','5','6','7']", ""); } public void testAlwaysRunSafetyCheck() { CompilerOptions options = createCompilerOptions(); options.setCheckSymbols(false); options.addCustomPass( CustomPassExecutionTime.BEFORE_OPTIMIZATIONS, new CompilerPass() { @Override public void process(Node externs, Node root) { Node var = root.getLastChild().getFirstChild(); assertEquals(Token.VAR, var.getToken()); var.detach(); } }); try { test(options, "var x = 3; function f() { return x + z; }", "function f() { return x + z; }"); fail("Expected run-time exception"); } catch (RuntimeException e) { assertThat(e.getMessage()).contains("Unexpected variable x"); } } public void testSuppressEs5StrictWarning() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setWarningLevel(DiagnosticGroups.ES5_STRICT, CheckLevel.WARNING); test(options, "/** @suppress{es5Strict} */ function f() { var arguments; }", ""); } public void testCheckProvidesWarning() { CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.MISSING_PROVIDE, CheckLevel.WARNING); options.setWarningLevel(DiagnosticGroups.ES5_STRICT, CheckLevel.OFF); test(options, "goog.require('x'); /** @constructor */ function f() { var arguments; }", CheckProvides.MISSING_PROVIDE_WARNING); } public void testSuppressCheckProvidesWarning() { CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.MISSING_PROVIDE, CheckLevel.WARNING); options.setWarningLevel(DiagnosticGroups.MISSING_PROVIDE, CheckLevel.WARNING); testSame(options, "/** @constructor\n" + " * @suppress{missingProvide} */\n" + "function f() {}"); } public void testSuppressCastWarning() { CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.CHECK_TYPES, CheckLevel.WARNING); normalizeResults = true; test(options, "function f() { var xyz = /** @type {string} */ (0); }", DiagnosticType.warning( "JSC_INVALID_CAST", "invalid cast")); testSame(options, "/** @suppress {invalidCasts} */\n" + "function f() { var xyz = /** @type {string} */ (0); }"); testSame(options, "/** @const */ var g = {};" + "/** @suppress {invalidCasts} */" + "g.a = g.b = function() { var xyz = /** @type {string} */ (0); }"); } public void testLhsCast() { CompilerOptions options = createCompilerOptions(); test( options, "/** @const */ var g = {};" + "/** @type {number} */ (g.foo) = 3;", "/** @const */ var g = {};" + "g.foo = 3;"); } public void testRenamePrefix() { String code = "var x = {}; function f(y) {}"; CompilerOptions options = createCompilerOptions(); options.setRenamePrefix("G_"); options.setVariableRenaming(VariableRenamingPolicy.ALL); test(options, code, "var G_={}; function G_a(a) {}"); } public void testRenamePrefixNamespace() { String code = "var x = {}; x.FOO = 5; x.bar = 3;"; CompilerOptions options = createCompilerOptions(); testSame(options, code); options.setCollapseProperties(true); options.setRenamePrefixNamespace("_"); test(options, code, "_.x$FOO = 5; _.x$bar = 3;"); } public void testRenamePrefixNamespaceProtectSideEffects() { String code = "var x = null; try { +x.FOO; } catch (e) {}"; CompilerOptions options = createCompilerOptions(); testSame(options, code); CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel( options); options.setRenamePrefixNamespace("_"); test(options, code, "_.x = null; try { +_.x.FOO; } catch (a) {}"); } // https://github.com/google/closure-compiler/issues/1875 public void testNoProtectSideEffectsInChecksOnly() { String code = "x;"; CompilerOptions options = createCompilerOptions(); options.setChecksOnly(true); options.setProtectHiddenSideEffects(true); testSame(options, code); } public void testRenameCollision() { String code = "" + "/**\n" + " * @fileoverview\n" + " * @suppress {uselessCode}\n" + " */" + "var x = {};\ntry {\n(0,use)(x.FOO);\n} catch (e) {}"; CompilerOptions options = createCompilerOptions(); testSame(options, code); CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel( options); options.setRenamePrefixNamespace("a"); options.setVariableRenaming(VariableRenamingPolicy.ALL); options.setRenamePrefixNamespaceAssumeCrossModuleNames(false); WarningLevel.DEFAULT.setOptionsForWarningLevel(options); test(options, code, "var b = {}; try { (0,window.use)(b.FOO); } catch (c) {}"); } public void testRenamePrefixNamespaceActivatesMoveFunctionDeclarations() { CompilerOptions options = createCompilerOptions(); String code = "var x = f; function f() { return 3; }"; testSame(options, code); assertFalse(options.moveFunctionDeclarations); options.setRenamePrefixNamespace("_"); test(options, code, "_.f = function() { return 3; }; _.x = _.f;"); } public void testBrokenNameSpace() { CompilerOptions options = createCompilerOptions(); String code = "var goog; goog.provide('i.am.on.a.Horse');" + "i.am.on.a.Horse = function() {};" + "i.am.on.a.Horse.prototype.x = function() {};" + "i.am.on.a.Boat.prototype.y = function() {}"; options.setClosurePass(true); options.setCollapseProperties(true); options.setSmartNameRemoval(true); test(options, code, ""); } public void testNamelessParameter() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setCheckTypes(false); String code = "var impl_0;" + "$load($init());" + "function $load(){" + " window['f'] = impl_0;" + "}" + "function $init() {" + " impl_0 = {};" + "}"; String result = "window.f = {};"; test(options, code, result); } public void testHiddenSideEffect() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); String code = "window.offsetWidth;"; String result = "window.offsetWidth;"; test(options, code, result); } public void testNegativeZero() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setCheckSymbols(false); test(options, "function bar(x) { return x; }\n" + "function foo(x) { print(x / bar(0));\n" + " print(x / bar(-0)); }\n" + "foo(3);", "print(3/0);print(3/-0);"); } public void testSingletonGetter1() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS .setOptionsForCompilationLevel(options); options.setCodingConvention(new ClosureCodingConvention()); test(options, "/** @const */\n" + "var goog = goog || {};\n" + "goog.addSingletonGetter = function(ctor) {\n" + " ctor.getInstance = function() {\n" + " return ctor.instance_ || (ctor.instance_ = new ctor());\n" + " };\n" + "};" + "function Foo() {}\n" + "goog.addSingletonGetter(Foo);" + "Foo.prototype.bar = 1;" + "function Bar() {}\n" + "goog.addSingletonGetter(Bar);" + "Bar.prototype.bar = 1;", ""); } public void testIncompleteFunction1() { CompilerOptions options = createCompilerOptions(); options.setIdeMode(true); DiagnosticType[] warnings = new DiagnosticType[] {RhinoErrorReporter.PARSE_ERROR, RhinoErrorReporter.PARSE_ERROR}; test(options, new String[] { "var foo = {bar: function(e) }" }, new String[] { "var foo = {bar: function(e){}};" }, warnings ); } public void testIncompleteFunction2() { CompilerOptions options = createCompilerOptions(); options.setIdeMode(true); testParseError(options, "function hi", "function hi() {}"); } public void testSortingOff() { CompilerOptions options = new CompilerOptions(); options.setClosurePass(true); options.setCodingConvention(new ClosureCodingConvention()); test(options, new String[] { "goog.require('goog.beer');", "goog.provide('goog.beer');" }, ProcessClosurePrimitives.LATE_PROVIDE_ERROR); } public void testGoogModuleOuterLegacyInner() { CompilerOptions options = new CompilerOptions(); options.setClosurePass(true); options.setCodingConvention(new ClosureCodingConvention()); test( options, new String[] { // googModuleOuter LINE_JOINER.join( "goog.module('foo.Outer');", "/** @constructor */ function Outer() {}", "exports = Outer;"), // legacyInner LINE_JOINER.join( "goog.module('foo.Outer.Inner');", "goog.module.declareLegacyNamespace();", "/** @constructor */ function Inner() {}", "exports = Inner;"), // legacyUse LINE_JOINER.join( "goog.provide('legacy.Use');", "goog.require('foo.Outer');", "goog.require('foo.Outer.Inner');", "goog.scope(function() {", "var Outer = goog.module.get('foo.Outer');", "new Outer;", "new foo.Outer.Inner;", "});") }, ClosureRewriteModule.QUALIFIED_REFERENCE_TO_GOOG_MODULE); } public void testLegacyGoogModuleExport() { CompilerOptions options = new CompilerOptions(); options.setClosurePass(true); options.setCodingConvention(new ClosureCodingConvention()); options.setGenerateExports(true); test( options, new String[] { LINE_JOINER.join( "var goog = {};", "goog.exportSymbol = function(path, symbol) {};"), LINE_JOINER.join( "goog.module('foo.example.ClassName');", "goog.module.declareLegacyNamespace();", "", "/** @constructor */ function ClassName() {}", "", "/** @export */", "exports = ClassName;"), }, new String[] { LINE_JOINER.join( "var goog = {};", "goog.exportSymbol = function(path, symbol) {};"), LINE_JOINER.join( "var foo = {};", "foo.example = {};", "function module$contents$foo$example$ClassName_ClassName() {}", "foo.example.ClassName = module$contents$foo$example$ClassName_ClassName;", "goog.exportSymbol('foo.example.ClassName', foo.example.ClassName);"), }); test( options, new String[] { LINE_JOINER.join( "var goog = {};", "goog.exportSymbol = function(path, symbol) {};"), LINE_JOINER.join( "goog.module('foo.ns');", "goog.module.declareLegacyNamespace();", "", "/** @constructor */ function ClassName() {}", "", "/** @export */", "exports.ExportedName = ClassName;"), }, new String[] { LINE_JOINER.join( "var goog = {};", "goog.exportSymbol = function(path, symbol) {};"), LINE_JOINER.join( "var foo = {};", "foo.ns = {};", "function module$contents$foo$ns_ClassName() {}", "foo.ns.ExportedName = module$contents$foo$ns_ClassName;", "goog.exportSymbol('foo.ns.ExportedName', foo.ns.ExportedName);"), }); } public void testUnboundedArrayLiteralInfiniteLoop() { CompilerOptions options = createCompilerOptions(); options.setIdeMode(true); testParseError(options, "var x = [1, 2", "var x = [1, 2]"); } public void testProvideRequireSameFile() throws Exception { CompilerOptions options = createCompilerOptions(); options.setDependencyOptions( new DependencyOptions() .setDependencySorting(true)); options.setClosurePass(true); test( options, "goog.provide('x'); goog.require('x');", "var x = {};"); } public void testDependencySorting() throws Exception { CompilerOptions options = createCompilerOptions(); options.setDependencyOptions( new DependencyOptions() .setDependencySorting(true)); test( options, new String[] { "goog.require('x');", "goog.provide('x');", }, new String[] { "goog.provide('x');", "goog.require('x');", // For complicated reasons involving modules, // the compiler creates a synthetic source file. "", }); } public void testStrictWarningsGuard() throws Exception { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); options.addWarningsGuard(new StrictWarningsGuard()); Compiler compiler = compile(options, "/** @return {number} */ function f() { return true; }"); assertThat(compiler.getErrors()).hasLength(1); assertThat(compiler.getWarnings()).isEmpty(); } public void testStrictWarningsGuardEmergencyMode() throws Exception { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); options.addWarningsGuard(new StrictWarningsGuard()); options.useEmergencyFailSafe(); Compiler compiler = compile(options, "/** @return {number} */ function f() { return true; }"); assertThat(compiler.getErrors()).isEmpty(); assertThat(compiler.getWarnings()).hasLength(1); } public void testInlineProperties() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.ADVANCED_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); level.setTypeBasedOptimizationOptions(options); String code = "" + "var ns = {};\n" + "/** @constructor */\n" + "ns.C = function () {this.someProperty = 1}\n" + "alert(new ns.C().someProperty + new ns.C().someProperty);\n"; assertTrue(options.shouldInlineProperties()); assertTrue(options.collapseProperties); // CollapseProperties used to prevent inlining this property. test(options, code, "alert(2);"); } public void testGoogDefineClass1() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.ADVANCED_OPTIMIZATIONS; options.setCheckTypes(true); level.setOptionsForCompilationLevel(options); level.setTypeBasedOptimizationOptions(options); String code = "" + "var ns = {};\n" + "ns.C = goog.defineClass(null, {\n" + " /** @constructor */\n" + " constructor: function () {this.someProperty = 1}\n" + "});\n" + "alert(new ns.C().someProperty + new ns.C().someProperty);\n"; assertTrue(options.shouldInlineProperties()); assertTrue(options.collapseProperties); // CollapseProperties used to prevent inlining this property. test(options, code, "alert(2);"); } public void testGoogDefineClass2() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.ADVANCED_OPTIMIZATIONS; options.setCheckTypes(true); level.setOptionsForCompilationLevel(options); level.setTypeBasedOptimizationOptions(options); String code = "" + "var C = goog.defineClass(null, {\n" + " /** @constructor */\n" + " constructor: function () {this.someProperty = 1}\n" + "});\n" + "alert(new C().someProperty + new C().someProperty);\n"; assertTrue(options.shouldInlineProperties()); assertTrue(options.collapseProperties); // CollapseProperties used to prevent inlining this property. test(options, code, "alert(2);"); } public void testGoogDefineClass3() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.ADVANCED_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); level.setTypeBasedOptimizationOptions(options); WarningLevel warnings = WarningLevel.VERBOSE; warnings.setOptionsForWarningLevel(options); String code = "" + "var C = goog.defineClass(null, {\n" + " /** @constructor */\n" + " constructor: function () {\n" + " /** @type {number} */\n" + " this.someProperty = 1},\n" + " /** @param {string} a */\n" + " someMethod: function (a) {}\n" + "});" + "var x = new C();\n" + "x.someMethod(x.someProperty);\n"; assertTrue(options.shouldInlineProperties()); assertTrue(options.collapseProperties); // CollapseProperties used to prevent inlining this property. test(options, code, TypeValidator.TYPE_MISMATCH_WARNING); } public void testGoogDefineClass4() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.ADVANCED_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); WarningLevel warnings = WarningLevel.VERBOSE; warnings.setOptionsForWarningLevel(options); options.setWarningLevel( DiagnosticGroups.GLOBAL_THIS, CheckLevel.WARNING); String code = "" + "var C = goog.defineClass(null, {\n" + " /** @param {string} a */\n" + " constructor: function (a) {this.someProperty = 1}\n" + "});\n"; test(options, code, ""); } public void testCheckConstants1() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.SIMPLE_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); WarningLevel warnings = WarningLevel.QUIET; warnings.setOptionsForWarningLevel(options); String code = "" + "var foo; foo();\n" + "/** @const */\n" + "var x = 1; foo(); x = 2;\n"; test(options, code, code); } public void testCheckConstants2() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.SIMPLE_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); WarningLevel warnings = WarningLevel.DEFAULT; warnings.setOptionsForWarningLevel(options); String code = "" + "var foo;\n" + "/** @const */\n" + "var x = 1; foo(); x = 2;\n"; test(options, code, ConstCheck.CONST_REASSIGNED_VALUE_ERROR); } public void testIssue937() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.SIMPLE_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); WarningLevel warnings = WarningLevel.DEFAULT; warnings.setOptionsForWarningLevel(options); String code = "" + "console.log(" + "/** @type {function():!string} */ ((new x())['abc'])());"; String result = "" + "console.log((new x()).abc());"; test(options, code, result); } public void testES5toES6() throws Exception { CompilerOptions options = createCompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT5_STRICT); options.setLanguageOut(LanguageMode.ECMASCRIPT_2015); options.setSkipTranspilationAndCrash(true); CompilationLevel.SIMPLE_OPTIMIZATIONS .setOptionsForCompilationLevel(options); String code = "f = function(c) { for (var i = 0; i < c.length; i++) {} };"; compile(options, code); } // Tests that unused classes are removed, even if they are passed to $jscomp.inherits. private void testES6UnusedClassesAreRemoved(CodingConvention convention) { CompilerOptions options = createCompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT3); options.setCodingConvention(convention); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); Compiler compiler = compile(options, LINE_JOINER.join( "class Base {}", "class Sub extends Base {}", "alert(1);")); String result = compiler.toSource(compiler.getJsRoot()); assertThat(result).isEqualTo("alert(1)"); } public void testES6UnusedClassesAreRemoved() { testES6UnusedClassesAreRemoved(CodingConventions.getDefault()); testES6UnusedClassesAreRemoved(new ClosureCodingConvention()); testES6UnusedClassesAreRemoved(new GoogleCodingConvention()); } /** * @param js A snippet of JavaScript in which alert('No one ever calls me'); is called * in a method which is never called. Verifies that the method is stripped out by * asserting that the result does not contain the string 'No one ever calls me'. */ private void testES6StaticsAreRemoved(String js) { CompilerOptions options = createCompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setLanguageOut(LanguageMode.ECMASCRIPT3); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); Compiler compiler = compile(options, js); assertThat(compiler.getErrors()).isEmpty(); String result = compiler.toSource(compiler.getJsRoot()); assertThat(result).isNotEmpty(); assertThat(result).doesNotContain("No one ever calls me"); } public void testES6StaticsAreRemoved1() { testES6StaticsAreRemoved(LINE_JOINER.join( "class Base {", " static called() { alert('I am called'); }", " static notCalled() { alert('No one ever calls me'); }", "}", "class Sub extends Base {", " static called() { super.called(); alert('I am called too'); }", " static notCalled() { alert('No one ever calls me'); }", "}", "Sub.called();")); } public void failing_testES6StaticsAreRemoved2() { testES6StaticsAreRemoved(LINE_JOINER.join( "class Base {", " static calledInSubclassOnly() { alert('No one ever calls me'); }", "}", "class Sub extends Base {", " static calledInSubclassOnly() { alert('I am called'); }", "}", "Sub.calledInSubclassOnly();")); } public void testIssue787() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.SIMPLE_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); WarningLevel warnings = WarningLevel.DEFAULT; warnings.setOptionsForWarningLevel(options); String code = LINE_JOINER.join( "function some_function() {", " var fn1;", " var fn2;", "", " if (any_expression) {", " fn2 = external_ref;", " fn1 = function (content) {", " return fn2();", " }", " }", "", " return {", " method1: function () {", " if (fn1) fn1();", " return true;", " },", " method2: function () {", " return false;", " }", " }", "}"); String result = LINE_JOINER.join( "function some_function() {", " if (any_expression) {", " var b = external_ref;", " var a = function(a) {", " return b()", " };", " }", " return {", " method1:function() {", " a && a();", " return !0", " },", " method2: function() {", " return !1", " }", " }", "}"); test(options, code, result); } public void testClosureDefines() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.SIMPLE_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); WarningLevel warnings = WarningLevel.DEFAULT; warnings.setOptionsForWarningLevel(options); String code = "" + "var CLOSURE_DEFINES = {\n" + " 'FOO': 1,\n" + " 'BAR': true\n" + "};\n" + "\n" + "/** @define {number} */ var FOO = 0;\n" + "/** @define {boolean} */ var BAR = false;\n" + ""; String result = "" + "var CLOSURE_DEFINES = {\n" + " FOO: 1,\n" + " BAR: !0\n" + "}," + "FOO = 1," + "BAR = !0" + ""; test(options, code, result); } public void testExports() { CompilerOptions options = createCompilerOptions(); CompilationLevel level = CompilationLevel.ADVANCED_OPTIMIZATIONS; level.setOptionsForCompilationLevel(options); WarningLevel warnings = WarningLevel.DEFAULT; warnings.setOptionsForWarningLevel(options); options.setRemoveUnusedPrototypePropertiesInExterns(true); String code = "" + "/** @constructor */ var X = function() {" + "/** @export */ this.abc = 1;};\n" + "/** @constructor */ var Y = function() {" + "/** @export */ this.abc = 1;};\n" + "alert(new X().abc + new Y().abc);"; // no export enabled, property name not preserved test(options, code, "alert((new function(){this.a = 1}).a + " + "(new function(){this.a = 1}).a);"); options.setGenerateExports(true); // exports enabled, but not local exports test(options, "/** @constructor */ var X = function() {" + "/** @export */ this.abc = 1;};\n", FindExportableNodes.NON_GLOBAL_ERROR); options.exportLocalPropertyDefinitions = true; options.setRemoveUnusedPrototypePropertiesInExterns(false); // property name preserved due to export test(options, code, "alert((new function(){this.abc = 1}).abc + " + "(new function(){this.abc = 1}).abc);"); // unreferenced property not removed due to export. test(options, "" + "/** @constructor */ var X = function() {" + "/** @export */ this.abc = 1;};\n" + "/** @constructor */ var Y = function() {" + "/** @export */ this.abc = 1;};\n" + "alert(new X() + new Y());", "alert((new function(){this.abc = 1}) + " + "(new function(){this.abc = 1}));"); // disambiguate and ambiguate properties respect the exports. options.setCheckTypes(true); options.setDisambiguateProperties(true); options.setAmbiguateProperties(true); options.propertyInvalidationErrors = ImmutableMap.of("abc", CheckLevel.ERROR); test(options, code, "alert((new function(){this.abc = 1}).abc + " + "(new function(){this.abc = 1}).abc);"); // unreferenced property not removed due to export. test(options, "" + "/** @constructor */ var X = function() {" + "/** @export */ this.abc = 1;};\n" + "/** @constructor */ var Y = function() {" + "/** @export */ this.abc = 1;};\n" + "alert(new X() + new Y());", "alert((new function(){this.abc = 1}) + " + "(new function(){this.abc = 1}));"); } public void testGatherExternPropsWithNTI() { CompilerOptions options = new CompilerOptions(); options.setNewTypeInference(true); options.setGenerateExports(true); options.setExportLocalPropertyDefinitions(true); options.setPropertyRenaming(PropertyRenamingPolicy.ALL_UNQUOTED); testSame(options, LINE_JOINER.join( "(function exportedTokensFromTemplate() {", " function unusedFn(a) {}", " var UNUSED = 1;", " unusedFn({ /** @export */ foo: UNUSED });", "})();", "/** @constructor */", "function Bar() {", " // Should not be renamed", " this.foo = 1;", "}")); } public void testRmUnusedProtoPropsInExternsUsage() { CompilerOptions options = new CompilerOptions(); options.setRemoveUnusedPrototypePropertiesInExterns(true); options.setRemoveUnusedPrototypeProperties(false); try { test(options, "", ""); fail("Expected CompilerOptionsPreprocessor.InvalidOptionsException"); } catch (RuntimeException e) { Throwable t = e.getCause(); if (!(t instanceof CompilerOptionsPreprocessor.InvalidOptionsException)) { fail("Expected CompilerOptionsPreprocessor.InvalidOptionsException"); } } } public void testMaxFunSizeAfterInliningUsage() { CompilerOptions options = new CompilerOptions(); options.setInlineFunctions(false); options.setMaxFunctionSizeAfterInlining(1); try { test(options, "", ""); fail("Expected CompilerOptionsPreprocessor.InvalidOptionsException"); } catch (RuntimeException e) { Throwable t = e.getCause(); if (!(t instanceof CompilerOptionsPreprocessor.InvalidOptionsException)) { fail("Expected CompilerOptionsPreprocessor.InvalidOptionsException"); } } } // isEquivalentTo returns false for alpha-equivalent nodes public void testIsEquivalentTo() { String[] input1 = {"function f(z) { return z; }"}; String[] input2 = {"function f(y) { return y; }"}; CompilerOptions options = new CompilerOptions(); Node out1 = parse(input1, options, false); Node out2 = parse(input2, options, false); assertFalse(out1.isEquivalentTo(out2)); } public void testEs6OutDoesntCrash() { CompilerOptions options = new CompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT_2015); options.setSkipTranspilationAndCrash(true); test(options, "function f(x) { if (x) var x=5; }", "function f(x) { if (x) x=5; }"); } public void testExternsProvideIsAllowed() { CompilerOptions options = createCompilerOptions(); options.setIncrementalChecks(CompilerOptions.IncrementalCheckMode.CHECK_IJS); options.setClosurePass(true); options.setCheckTypes(true); externs = ImmutableList.of(SourceFile.fromCode("<externs>", "goog.provide('foo.bar'); /** @type {!Array<number>} */ foo.bar;")); test(options, "", ""); } // GitHub issue #250: https://github.com/google/closure-compiler/issues/250 public void testInlineStringConcat() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); test(options, LINE_JOINER.join( "function f() {", " var x = '';", " x += '1';", " x += '2';", " x += '3';", " x += '4';", " x += '5';", " x += '6';", " x += '7';", " return x;", "}", "window.f = f;"), "window.a = function() { return '1234567'; }"); } // GitHub issue #1234: https://github.com/google/closure-compiler/issues/1234 public void testOptimizeSwitchGithubIssue1234() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setCheckSymbols(false); test( options, LINE_JOINER.join( "var exit;", "switch ('a') {", " case 'a':", " break;", " default:", " exit = 21;", " break;", "}", "switch(exit) {", " case 21: throw 'x';", " default : console.log('good');", "}"), "console.a('good');"); } // GitHub issue #2079: https://github.com/google/closure-compiler/issues/2079 public void testStrictEqualityComparisonAgainstUndefined() { CompilerOptions options = createCompilerOptions(); options.setFoldConstants(true); options.setCheckTypes(true); options.setUseTypesForLocalOptimization(true); test( options, LINE_JOINER.join( "if (/** @type {Array|undefined} */ (window['c']) === null) {", " window['d'] = 12;", "}"), "null===window['c']&&(window['d']=12)"); } // GitHub issue #2122: https://github.com/google/closure-compiler/issues/2122 public void testNoRemoveSuperCallWithWrongArgumentCount() { CompilerOptions options = createCompilerOptions(); options.setCheckTypes(true); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); test(options, LINE_JOINER.join( "var goog = {}", "goog.inherits = function(childCtor, parentCtor) {", " childCtor.superClass_ = parentCtor.prototype;", "};", "/** @constructor */", "var Foo = function() {}", "/**", " * @param {number=} width", " * @param {number=} height", " */", "Foo.prototype.resize = function(width, height) {", " window.size = width * height;", "}", "/**", " * @constructor", " * @extends {Foo}", " */", "var Bar = function() {}", "goog.inherits(Bar, Foo);", "/** @override */", "Bar.prototype.resize = function(width, height) {", " goog.base(this, 'resize', width);", "};", "(new Bar).resize(100, 200);"), LINE_JOINER.join( "function a(){}a.prototype.a=function(b,e){window.c=b*e};", "function d(){}d.b=a.prototype;d.prototype.a=function(b){d.b.a.call(this,b)};", "(new d).a(100, 200);")); } // GitHub issue #2203: https://github.com/google/closure-compiler/issues/2203 public void testPureFunctionIdentifierWorksWithMultipleNames() { CompilerOptions options = createCompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); test(options, LINE_JOINER.join( "var SetCustomData1 = function SetCustomData2(element, dataName, dataValue) {", " var x = element['_customData'];", " x[dataName] = dataValue;", "}", "SetCustomData1(window, \"foo\", \"bar\");"), "window._customData.foo=\"bar\";"); } public void testUnnecessaryBackslashInStringLiteral() { CompilerOptions options = createCompilerOptions(); test(options, "var str = '\\q';", "var str = 'q';"); } public void testWarnUnnecessaryBackslashInStringLiteral() { CompilerOptions options = createCompilerOptions(); options.setWarningLevel(DiagnosticGroups.LINT_CHECKS, CheckLevel.WARNING); test(options, "var str = '\\q';", "var str = 'q';", RhinoErrorReporter.UNNECESSARY_ESCAPE); } public void testAngularPropertyNameRestrictions() { CompilerOptions options = createCompilerOptions(); options.setLanguageIn(LanguageMode.ECMASCRIPT5); options.setLanguageOut(LanguageMode.ECMASCRIPT5); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setAngularPass(true); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 250; i++) { sb.append("window.foo").append(i).append("=true;\n"); } Compiler compiler = compile(options, sb.toString()); assertEquals( "Expected no warnings or errors\n" + "Errors: \n" + Joiner.on("\n").join(compiler.getErrors()) + "\n" + "Warnings: \n" + Joiner.on("\n").join(compiler.getWarnings()), 0, compiler.getErrors().length + compiler.getWarnings().length); Node root = compiler.getRoot().getLastChild(); assertNotNull(root); Node script = root.getFirstChild(); assertNotNull(script); ImmutableSet<Character> restrictedChars = ImmutableSet.copyOf(Chars.asList(CompilerOptions.ANGULAR_PROPERTY_RESERVED_FIRST_CHARS)); for (Node expr : script.children()) { NodeSubject.assertNode(expr).hasType(Token.EXPR_RESULT); NodeSubject.assertNode(expr.getFirstChild()).hasType(Token.ASSIGN); NodeSubject.assertNode(expr.getFirstFirstChild()).hasType(Token.GETPROP); Node getProp = expr.getFirstFirstChild(); NodeSubject.assertNode(getProp.getSecondChild()).hasType(Token.STRING); String propName = getProp.getSecondChild().getString(); assertThat(restrictedChars).doesNotContain(propName.charAt(0)); } } public void testCheckVarsOnInAdvancedMode() { CompilerOptions options = new CompilerOptions(); CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options); test(options, "var x = foobar;", VarCheck.UNDEFINED_VAR_ERROR); } /** Creates a CompilerOptions object with google coding conventions. */ @Override protected CompilerOptions createCompilerOptions() { CompilerOptions options = new CompilerOptions(); options.setCodingConvention(new GoogleCodingConvention()); options.setRenamePrefixNamespaceAssumeCrossModuleNames(true); options.declaredGlobalExternsOnWindow = false; return options; } }
{ "content_hash": "b701b62861fde2e9745a3b9029144d35", "timestamp": "", "source": "github", "line_count": 4147, "max_line_length": 100, "avg_line_length": 33.874849288642395, "alnum_prop": 0.595498259526335, "repo_name": "brad4d/closure-compiler", "id": "a1972a2716d1232df8c9456b0dc8447a25c3fb59", "size": "141091", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/com/google/javascript/jscomp/IntegrationTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "1765" }, { "name": "Java", "bytes": "14356644" }, { "name": "JavaScript", "bytes": "6085206" }, { "name": "Protocol Buffer", "bytes": "8474" } ], "symlink_target": "" }
package com.farm.rest; import com.farm.database.entities.documents.Document; import com.farm.database.utilits.FarmEntityValidator; import com.farm.executors.documents.DocumentExecutionResult; import com.farm.processes.DocumentProcess; import lombok.AllArgsConstructor; import org.apache.commons.collections4.MapUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Slice; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.ws.rs.Consumes; import java.math.BigDecimal; import java.util.Map; import java.util.Optional; @RestController @RequestMapping("/rest/document") @AllArgsConstructor(onConstructor = @__(@Autowired)) public class DocumentRestEndpoint { private DocumentProcess documentProcess; @PostMapping @CrossOrigin @Consumes(MediaType.APPLICATION_JSON_VALUE) public ResponseEntity createDocument(@RequestBody Document document){ Map<String, String> errorsMap = FarmEntityValidator.getValidationErrors(document); if (MapUtils.isNotEmpty(errorsMap)) return ResponseEntity.badRequest().body(errorsMap); DocumentExecutionResult result = documentProcess.createExternalDocument(document); if (result.hasNoErrors()){ return ResponseEntity.ok(result.getDocument()); } else { return ResponseEntity.badRequest().body(result.getErrors()); } } @GetMapping("/{id}") @CrossOrigin public ResponseEntity getById(@PathVariable Long id){ return Optional.ofNullable(documentProcess.findById(id)) .map(ResponseEntity::ok) .orElse(ResponseEntity.noContent().build()); } @GetMapping("/recent") @CrossOrigin public ResponseEntity getLastFiveByDate() { return Optional.of(documentProcess.getLastFiveByDate()) .filter(Slice::hasContent) .map(ResponseEntity::ok) .orElse(ResponseEntity.noContent().build()); } @GetMapping("/amount/{amount}/{pageNumber}") @CrossOrigin public ResponseEntity getFiveByAmount(@PathVariable double amount, @PathVariable int pageNumber) { return Optional.of(documentProcess.findFiveByAmount(pageNumber, BigDecimal.valueOf(amount))) .filter(Slice::hasContent) .map(ResponseEntity::ok) .orElse(ResponseEntity.noContent().build()); } }
{ "content_hash": "ed7e89533a4fcc7a48e0e015d0f3abdc", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 102, "avg_line_length": 36, "alnum_prop": 0.7166666666666667, "repo_name": "PolexRufous/Farm", "id": "283bcaab372dbe578b57eb6c803e8dcc87fed6c2", "size": "2520", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/src/main/java/com/farm/rest/DocumentRestEndpoint.java", "mode": "33188", "license": "mit", "language": [ { "name": "Groovy", "bytes": "29307" }, { "name": "Java", "bytes": "93044" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "1e1d4538a55d7d366898f82200436d23", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "5e43264f056296bcd47f8a446bce90f8724350e7", "size": "173", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Solanales/Solanaceae/Alona/Alona glandulosa/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
@extends('core::admin.master') @section('title', $model->present()->title) @section('content') <div class="header"> @include('core::admin._button-back', ['module' => 'users']) <h1 class="header-title @if (!$model->present()->title)text-muted @endif"> {{ $model->present()->title ?: __('Untitled') }} </h1> </div> {!! BootForm::open()->put()->action(route('admin::update-user', $model->id))->multipart()->role('form') !!} {!! BootForm::bind($model) !!} @include('users::admin._form') {!! BootForm::close() !!} @endsection
{ "content_hash": "3d8ec70feba54b048444d63871e906b9", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 111, "avg_line_length": 31.05263157894737, "alnum_prop": 0.5474576271186441, "repo_name": "TypiCMS/Users", "id": "daa9018fd0d5746656300ea5a7dabd9cb23734df", "size": "590", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "resources/views/admin/edit.blade.php", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "11908" }, { "name": "PHP", "bytes": "33682" } ], "symlink_target": "" }
package test.findtemplate; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Proxy; import java.lang.reflect.Type; public class TestTemplateFinder { public static void main(String[] args) { Class<?> testy = StringValue.class; System.out.println( getTemplateCanonicalName(testy, 0) ); System.out.println( getTemplateCanonicalName(testy, 1) ); System.out.println( getTemplateCanonicalName( new Template<Integer>().getClass(), 0 ) ); System.out.println( getTemplateCanonicalName( (new Template<Integer>() {}).getClass(), 0 ) ); System.out.println( getTemplateCanonicalName(String.class, 0) ); } // https://stackoverflow.com/questions/3437897/how-to-get-a-class-instance-of-generics-type-t#3437930 private static String getTemplateCanonicalName(Class<?> clazz, int index) { Type mySuperclass = clazz.getGenericSuperclass(); if (mySuperclass instanceof ParameterizedType) { Type[] templates = ((ParameterizedType)mySuperclass).getActualTypeArguments(); if (index >= templates.length) return null; Type tType = templates[index]; String templName = tType.getTypeName(); return templName; } return null; } }
{ "content_hash": "60b9abb781097f1a378ce298bbbbef13", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 102, "avg_line_length": 37.60606060606061, "alnum_prop": 0.7566478646253022, "repo_name": "mhus/mhus-inka", "id": "93128bdf1d3bf9dc2767c62bd44336b8a0728e22", "size": "1241", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "MiscJavaStuff/src/test/findtemplate/TestTemplateFinder.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "8955" }, { "name": "C", "bytes": "263130" }, { "name": "C#", "bytes": "38133" }, { "name": "C++", "bytes": "17764" }, { "name": "CSS", "bytes": "88949" }, { "name": "CoffeeScript", "bytes": "32741" }, { "name": "DTrace", "bytes": "174" }, { "name": "HTML", "bytes": "105741" }, { "name": "Java", "bytes": "3036024" }, { "name": "JavaScript", "bytes": "736367" }, { "name": "NSIS", "bytes": "25217" }, { "name": "Objective-C", "bytes": "80664" }, { "name": "PLSQL", "bytes": "7" }, { "name": "Smarty", "bytes": "33096" }, { "name": "Visual Basic .NET", "bytes": "8645" } ], "symlink_target": "" }
""" This function provides functions for parallel execution of loops and function mappings, using the builtin Python module multiprocessing. """ __all__ = ['parfor', 'parallel_map', 'serial_map'] from scipy import array from multiprocessing import Pool from functools import partial import os import sys import signal import qutip.settings as qset from qutip.ui.progressbar import BaseProgressBar, TextProgressBar def _task_wrapper(args): try: return args[0](*args[1]) except KeyboardInterrupt: os.kill(args[2], signal.SIGINT) sys.exit(1) def _task_wrapper_with_args(args, user_args): try: return args[0](*args[1], **user_args) except KeyboardInterrupt: os.kill(args[2], signal.SIGINT) sys.exit(1) def parfor(func, *args, **kwargs): """Executes a multi-variable function in parallel on the local machine. Parallel execution of a for-loop over function `func` for multiple input arguments and keyword arguments. .. note:: From QuTiP 3.1.0, we recommend to use :func:`qutip.parallel_map` instead of this function. Parameters ---------- func : function_type A function to run in parallel on the local machine. The function 'func' accepts a series of arguments that are passed to the function as variables. In general, the function can have multiple input variables, and these arguments must be passed in the same order as they are defined in the function definition. In addition, the user can pass multiple keyword arguments to the function. The following keyword argument is reserved: num_cpus : int Number of CPU's to use. Default uses maximum number of CPU's. Performance degrades if num_cpus is larger than the physical CPU count of your machine. Returns ------- result : list A ``list`` with length equal to number of input parameters containing the output from `func`. """ kw = _default_kwargs() if 'num_cpus' in kwargs.keys(): kw['num_cpus'] = kwargs['num_cpus'] del kwargs['num_cpus'] if len(kwargs) != 0: task_func = partial(_task_wrapper_with_args, user_args=kwargs) else: task_func = _task_wrapper if kw['num_cpus'] > qset.num_cpus: print("Requested number of CPUs (%s) " % kw['num_cpus'] + "is larger than physical number (%s)." % qset.num_cpus) print("Reduce 'num_cpus' for greater performance.") pool = Pool(processes=kw['num_cpus']) args = [list(arg) for arg in args] var = [[args[j][i] for j in range(len(args))] for i in range(len(list(args[0])))] try: map_args = ((func, v, os.getpid()) for v in var) par_return = list(pool.map(task_func, map_args)) pool.terminate() pool.join() if isinstance(par_return[0], tuple): par_return = [elem for elem in par_return] num_elems = len(par_return[0]) dt = [type(ii) for ii in par_return[0]] return [array([elem[ii] for elem in par_return], dtype=dt[ii]) for ii in range(num_elems)] else: return list(par_return) except KeyboardInterrupt: pool.terminate() def serial_map(task, values, task_args=tuple(), task_kwargs={}, **kwargs): """ Serial mapping function with the same call signature as parallel_map, for easy switching between serial and parallel execution. This is functionally equivalent to: result = [task(value, *task_args, **task_kwargs) for value in values] This function work as a drop-in replacement of :func:`qutip.parallel_map`. Parameters ---------- task: a Python function The function that is to be called for each value in ``task_vec``. values: array / list The list or array of values for which the ``task`` function is to be evaluated. task_args: list / dictionary The optional additional argument to the ``task`` function. task_kwargs: list / dictionary The optional additional keyword argument to the ``task`` function. progress_bar: ProgressBar Progress bar class instance for showing progress. Returns -------- result : list The result list contains the value of ``task(value, *task_args, **task_kwargs)`` for each value in ``values``. """ try: progress_bar = kwargs['progress_bar'] if progress_bar is True: progress_bar = TextProgressBar() except: progress_bar = BaseProgressBar() progress_bar.start(len(values)) results = [] for n, value in enumerate(values): progress_bar.update(n) result = task(value, *task_args, **task_kwargs) results.append(result) progress_bar.finished() return results def parallel_map(task, values, task_args=tuple(), task_kwargs={}, **kwargs): """ Parallel execution of a mapping of `values` to the function `task`. This is functionally equivalent to: result = [task(value, *task_args, **task_kwargs) for value in values] Parameters ---------- task: a Python function The function that is to be called for each value in ``task_vec``. values: array / list The list or array of values for which the ``task`` function is to be evaluated. task_args: list / dictionary The optional additional argument to the ``task`` function. task_kwargs: list / dictionary The optional additional keyword argument to the ``task`` function. progress_bar: ProgressBar Progress bar class instance for showing progress. Returns -------- result : list The result list contains the value of ``task(value, *task_args, **task_kwargs)`` for each value in ``values``. """ kw = _default_kwargs() if 'num_cpus' in kwargs: kw['num_cpus'] = kwargs['num_cpus'] try: progress_bar = kwargs['progress_bar'] if progress_bar is True: progress_bar = TextProgressBar() except: progress_bar = BaseProgressBar() progress_bar.start(len(values)) nfinished = [0] def _update_progress_bar(x): nfinished[0] += 1 progress_bar.update(nfinished[0]) try: pool = Pool(processes=kw['num_cpus']) async_res = [pool.apply_async(task, (value,) + task_args, task_kwargs, _update_progress_bar) for value in values] while not all([ar.ready() for ar in async_res]): for ar in async_res: ar.wait(timeout=0.1) pool.terminate() pool.join() except KeyboardInterrupt as e: pool.terminate() pool.join() raise e progress_bar.finished() return [ar.get() for ar in async_res] def _default_kwargs(): settings = {'num_cpus': qset.num_cpus} return settings
{ "content_hash": "8af7565e64e2bdc313d1eef4b80920e1", "timestamp": "", "source": "github", "line_count": 239, "max_line_length": 79, "avg_line_length": 29.489539748953973, "alnum_prop": 0.6157775255391601, "repo_name": "zasdfgbnm/qutip", "id": "417dda0d2c7fd9a72565f51e58bfeabeec4ac03c", "size": "8863", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "qutip/parallel.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "FORTRAN", "bytes": "259707" }, { "name": "Makefile", "bytes": "3079" }, { "name": "Python", "bytes": "1733190" }, { "name": "Shell", "bytes": "2931" } ], "symlink_target": "" }
module DockerizeRails module DockerCommands class DockerOptions def initialize @options = { 'Image' => '', 'name' => '', 'Hostname' => '0.0.0.0', 'ExposedPorts' => {}, 'Env' => [], 'HostConfig' => { 'PortBindings' => {}, 'Links' => [] } } end def image(image) @options['Image'] = image end def name(name) @options['name'] = name end def hostname(hostname) @options['Hostname'] = hostname end def expose(port) @options['ExposedPorts']["#{port}/tcp"] = {} @options['HostConfig']['PortBindings']["#{port}/tcp"] = [{ 'HostPort' => port }] end def add_port_binds(container, host) @options['HostConfig']['PortBindings']["#{container}/tcp"] = [{ 'HostPort' => host }] end def add_env(env) @options['Env'] << env end def add_links(container, alias_name) @options['HostConfig']['Links'] << "#{container}:#{alias_name}" end def options Marshal.load(Marshal.dump(@options)) end end end end
{ "content_hash": "d687e1a8daa05ac14e060029bb106498", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 93, "avg_line_length": 22.865384615384617, "alnum_prop": 0.48444070647603027, "repo_name": "eendroroy/dockerize_rails", "id": "8bd7aa0e6930874ab9f230a124305023fc411b4d", "size": "1189", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/dockerize_rails/docker_commands/docker_options.rb", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "4850" }, { "name": "Ruby", "bytes": "45410" }, { "name": "Shell", "bytes": "13545" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>plugin-utils: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.11.1 / plugin-utils - 1.1.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> plugin-utils <small> 1.1.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-04-13 21:39:51 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-04-13 21:39:51 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.11.1 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.11.2 The OCaml compiler (virtual package) ocaml-base-compiler 4.11.2 Official release 4.11.2 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;gmalecha@gmail.com&quot; homepage: &quot;https://github.com/gmalecha/coq-plugin-utils&quot; bug-reports: &quot;https://github.com/gmalecha/coq-plugin-utils/issues&quot; license: &quot;MIT&quot; build: [ [make] ] install: [make &quot;install&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.5&quot; &amp; &lt; &quot;8.6~&quot;} ] tags: [ &quot;logpath:PluginUtils&quot; ] synopsis: &quot;Utility functions for implementing Coq plugins&quot; authors: &quot;Gregory Malecha&quot; url { src: &quot;https://github.com/gmalecha/coq-plugin-utils/archive/v1.1.0-8.5.tar.gz&quot; checksum: &quot;md5=9a4d59877f6eee9b4a8d0342b075d8b6&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-plugin-utils.1.1.0 coq.8.11.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.11.1). The following dependencies couldn&#39;t be met: - coq-plugin-utils -&gt; coq &lt; 8.6~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-plugin-utils.1.1.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "2468847c390c5a4a0c7f27875676d7f8", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 159, "avg_line_length": 38.93167701863354, "alnum_prop": 0.5226547543075941, "repo_name": "coq-bench/coq-bench.github.io", "id": "3c35163b567bd0720e4a4b08b7f37f91d8c57f1f", "size": "6293", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.11.2-2.0.7/released/8.11.1/plugin-utils/1.1.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<?php /** * JComponentRouterRules interface for Joomla * * @since 3.4 */ interface JComponentRouterRulesInterface { /** * Prepares a query set to be handed over to the build() method. * This should complete a partial query set to work as a complete non-SEFed * URL and in general make sure that all information is present and properly * formatted. For example, the Itemid should be retrieved and set here. * * @param array &$query The query array to process * * @return void * * @since 3.4 */ public function preprocess(&$query); /** * Parses a URI to retrieve informations for the right route through * the component. * This method should retrieve all its input from its method arguments. * * @param array &$segments The URL segments to parse * @param array &$vars The vars that result from the segments * * @return void * * @since 3.4 */ public function parse(&$segments, &$vars); /** * Builds URI segments from a query to encode the necessary informations * for a route in a human-readable URL. * This method should retrieve all its input from its method arguments. * * @param array &$query The vars that should be converted * @param array &$segments The URL segments to create * * @return void * * @since 3.4 */ public function build(&$query, &$segments); }
{ "content_hash": "6a8d6a99f4cbf670c4dc4e0e55ea6f45", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 77, "avg_line_length": 26.576923076923077, "alnum_prop": 0.6700434153400868, "repo_name": "yaelduckwen/lo_imaginario", "id": "439829d6d9af3af78c980093542138801e8a5920", "size": "1615", "binary": false, "copies": "106", "ref": "refs/heads/master", "path": "web2/libraries/cms/component/router/rules/interface.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "468" }, { "name": "CSS", "bytes": "6260484" }, { "name": "HTML", "bytes": "104589" }, { "name": "Java", "bytes": "14870" }, { "name": "JavaScript", "bytes": "3918522" }, { "name": "PHP", "bytes": "27434460" }, { "name": "PLpgSQL", "bytes": "2393" }, { "name": "SQLPL", "bytes": "17688" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "442fcfcba349b9f8b5fb4f078f6e72ee", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "b8c7f7c5f35cbada4b664052bc4ea7837dc4585a", "size": "206", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Cassia/Cassia nemophila/Cassia nemophila zygophylla/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package coretest import ( "github.com/coreos/mantle/kola/cluster" ) // run various native functions that only require a single machine func LocalTests(c cluster.TestCluster) { tests := c.ListNativeFunctions() for _, name := range tests { c.RunNative(name, c.Machines()[0]) } } // run internet based tests func InternetTests(c cluster.TestCluster) { tests := c.ListNativeFunctions() for _, name := range tests { c.RunNative(name, c.Machines()[0]) } }
{ "content_hash": "443d6085a340a39f7f78c0d91e4afcad", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 66, "avg_line_length": 22.095238095238095, "alnum_prop": 0.709051724137931, "repo_name": "dm0-/mantle", "id": "7117890efc5b31d65308f7c577958305a73a31bd", "size": "464", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "kola/tests/coretest/testgroupglue.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "1271363" }, { "name": "Makefile", "bytes": "178" }, { "name": "Shell", "bytes": "2533" } ], "symlink_target": "" }
// This file was generated by gir (b7f5189) from gir-files (71d73f0) // DO NOT EDIT use StateFlags; use StyleProvider; use SymbolicColor; use ffi; use glib; use glib::translate::*; glib_wrapper! { pub struct StyleProperties(Object<ffi::GtkStyleProperties>): StyleProvider; match fn { get_type => || ffi::gtk_style_properties_get_type(), } } impl StyleProperties { pub fn new() -> StyleProperties { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_style_properties_new()) } } pub fn clear(&self) { unsafe { ffi::gtk_style_properties_clear(self.to_glib_none().0); } } //pub fn get(&self, state: StateFlags, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { // unsafe { TODO: call ffi::gtk_style_properties_get() } //} pub fn get_property(&self, property: &str, state: StateFlags) -> Option<glib::Value> { unsafe { let mut value = glib::Value::uninitialized(); let ret = from_glib(ffi::gtk_style_properties_get_property(self.to_glib_none().0, property.to_glib_none().0, state.to_glib(), value.to_glib_none_mut().0)); if ret { Some(value) } else { None } } } //pub fn get_valist(&self, state: StateFlags, args: /*Unknown conversion*//*Unimplemented*/Unsupported) { // unsafe { TODO: call ffi::gtk_style_properties_get_valist() } //} pub fn lookup_color(&self, name: &str) -> Option<SymbolicColor> { unsafe { from_glib_none(ffi::gtk_style_properties_lookup_color(self.to_glib_none().0, name.to_glib_none().0)) } } pub fn map_color(&self, name: &str, color: &SymbolicColor) { unsafe { ffi::gtk_style_properties_map_color(self.to_glib_none().0, name.to_glib_none().0, color.to_glib_none().0); } } pub fn merge(&self, props_to_merge: &StyleProperties, replace: bool) { unsafe { ffi::gtk_style_properties_merge(self.to_glib_none().0, props_to_merge.to_glib_none().0, replace.to_glib()); } } //pub fn set(&self, state: StateFlags, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { // unsafe { TODO: call ffi::gtk_style_properties_set() } //} pub fn set_property(&self, property: &str, state: StateFlags, value: &glib::Value) { unsafe { ffi::gtk_style_properties_set_property(self.to_glib_none().0, property.to_glib_none().0, state.to_glib(), value.to_glib_none().0); } } //pub fn set_valist(&self, state: StateFlags, args: /*Unknown conversion*//*Unimplemented*/Unsupported) { // unsafe { TODO: call ffi::gtk_style_properties_set_valist() } //} pub fn unset_property(&self, property: &str, state: StateFlags) { unsafe { ffi::gtk_style_properties_unset_property(self.to_glib_none().0, property.to_glib_none().0, state.to_glib()); } } //pub fn lookup_property(property_name: &str, parse_func: /*Unknown conversion*//*Unimplemented*/StylePropertyParser, pspec: /*Ignored*/glib::ParamSpec) -> bool { // unsafe { TODO: call ffi::gtk_style_properties_lookup_property() } //} //pub fn register_property<T: IsA</*Ignored*/glib::ParamSpec>>(parse_func: /*Unknown conversion*//*Unimplemented*/StylePropertyParser, pspec: &T) { // unsafe { TODO: call ffi::gtk_style_properties_register_property() } //} }
{ "content_hash": "d0da08da7f77953106b31dc47edbce7e", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 167, "avg_line_length": 37.02127659574468, "alnum_prop": 0.6123563218390805, "repo_name": "Susurrus/gtk", "id": "24b2890b2001f7d228fd020416dfd9e67fd187b7", "size": "3480", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/auto/style_properties.rs", "mode": "33188", "license": "mit", "language": [ { "name": "Makefile", "bytes": "452" }, { "name": "Rust", "bytes": "1519305" }, { "name": "Shell", "bytes": "558" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> <link href="{{ static_url("css/bootstrap.css") }}" rel="stylesheet"> <link href="{{ static_url("css/main.css") }}" rel="stylesheet"> <script src="{{ static_url("js/jquery-1.12.0.js") }}"></script> <script src="{{ static_url("js/cat.js") }}"></script> <script src="{{ static_url("js/bootstrap.js") }}"></script> </head> <body> <div class="container"> <form action="" method="post" class="form-que"> <div class="link"> <ul class="nav nav-pills"> <li role="presentation"><a href="/">回到首页</a></li> <li role="presentation"><a href="/cat/{{ q_id }}">重做测验</a></li> </ul> </div> <div class="progress progress-item"> <div class="progress-bar item-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: {{ current_progress }}%"> <span class="current">第{{ current_step }}题</span> </div> </div> <div class="well"> {{ que.question }} </div> {% module xsrf_form_html() %} <div> <ul class="list-choice-group"> {% for i, choice in enumerate(que.choice_text.split("|")) %} <li class="list-choice" id={{ i }}> {{ choice }} </li> {% end %} <input type="hidden" name="question"> </ul> </div> <div class="que-btn"> <button type="button" class="btn btn-primary btn-block"> 提交 </button> </div> <div class="progress progress-time"> <div class="progress-bar progress-bar-striped active time-bar" role="progressbar" aria-valuenow="{{ second }}" aria-valuemin="0" aria-valuemax="{{ second }}" style="width: 100%"> <span class="time">{{ second }}秒</span> </div> </div> </form> </div> <div id="count-down">{{ second }}</div> <div id="total">{{ total_step_count }}</div> <div id="current">{{ current_step }}</div> {% if que.thresholds %} <div id="que">当前试题的区分度为{{ round(que.slop, 2) }}, 难度为{{ que.thresholds }}</div> {% else %} <div id="que">当前试题的区分度为{{ round(que.slop, 2) }}, 难度为{{ round(que.threshold, 2) }}</div> {% end %} <div id="choice"> {% for i, value in enumerate(que.choice_value.split("|")) %} 第{{ i + 1 }}个选项的得分是{{ value }}分; {% end %} </div> <div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="SmallModalLabel"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-body"> 时间到,请点击确定转到下一题 </div> <div class="modal-footer"> <button class="btn btn-primary btn-sm" type="button">确定</button> </div> </div> </div> </div> </body> </html>
{ "content_hash": "ab5be0303691a91eca885ada68b61b16", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 112, "avg_line_length": 36.97530864197531, "alnum_prop": 0.5028380634390651, "repo_name": "inuyasha2012/tornado-cat-example", "id": "ba7ffc669627520acbdea0dd2266386082a3ced0", "size": "3117", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "example/templates/cat.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1412" }, { "name": "HTML", "bytes": "5423" }, { "name": "JavaScript", "bytes": "2090" }, { "name": "Python", "bytes": "48063" } ], "symlink_target": "" }
<?php // autoload.php @generated by Composer require_once __DIR__ . '/composer' . '/autoload_real.php'; return ComposerAutoloaderInit8fc38d188d1d17b5413e25ce27600ae0::getLoader();
{ "content_hash": "f78ae1f2b79508c6a78c8a510c365887", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 75, "avg_line_length": 26.142857142857142, "alnum_prop": 0.7595628415300546, "repo_name": "atgomes/note-app", "id": "3fb240a3e56b175d89b98f26eb467b9afbd43da9", "size": "183", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "vendor/autoload.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "553" }, { "name": "HTML", "bytes": "2127" }, { "name": "JavaScript", "bytes": "503" }, { "name": "PHP", "bytes": "69615" } ], "symlink_target": "" }
int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }
{ "content_hash": "edd04ff1188c78655043a3844c53e5b8", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 90, "avg_line_length": 31.6, "alnum_prop": 0.6582278481012658, "repo_name": "kkdai/PhotoViewer", "id": "30980ad4c6240881cb81dfe0d4444329a0a60df1", "size": "266", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "photoviewer/main.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "251" }, { "name": "Objective-C", "bytes": "31264" }, { "name": "Ruby", "bytes": "168" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="ro"> <head> <!-- Generated by javadoc (version 1.7.0_07) on Tue May 27 14:37:23 EEST 2014 --> <title>Uses of Interface net.sf.jasperreports.charts.JRGanttDataset (JasperReports 5.6.0 API)</title> <meta name="date" content="2014-05-27"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Interface net.sf.jasperreports.charts.JRGanttDataset (JasperReports 5.6.0 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?net/sf/jasperreports/charts/class-use/JRGanttDataset.html" target="_top">Frames</a></li> <li><a href="JRGanttDataset.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Interface net.sf.jasperreports.charts.JRGanttDataset" class="title">Uses of Interface<br>net.sf.jasperreports.charts.JRGanttDataset</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#net.sf.jasperreports.charts.base">net.sf.jasperreports.charts.base</a></td> <td class="colLast"> <div class="block">Contains base implementations for chart related interfaces.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#net.sf.jasperreports.charts.design">net.sf.jasperreports.charts.design</a></td> <td class="colLast"> <div class="block">Contains design time implementations for chart related interfaces.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#net.sf.jasperreports.charts.fill">net.sf.jasperreports.charts.fill</a></td> <td class="colLast"> <div class="block">Contains fill time implementations for chart related interfaces.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#net.sf.jasperreports.engine">net.sf.jasperreports.engine</a></td> <td class="colLast"> <div class="block">Provides access to the library's main functionality through facade classes for compiling, filling and exporting reports and also publishes the library's main interfaces and classes.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#net.sf.jasperreports.engine.base">net.sf.jasperreports.engine.base</a></td> <td class="colLast"> <div class="block">Contains base implementations for the library's main interfaces.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#net.sf.jasperreports.engine.design">net.sf.jasperreports.engine.design</a></td> <td class="colLast"> <div class="block">Contains design time implementations for the library's main interfaces as well as report compiling tools.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#net.sf.jasperreports.engine.fill">net.sf.jasperreports.engine.fill</a></td> <td class="colLast"> <div class="block">Contains fill time implementations for the library's main interfaces and the entire engine used in the filling process (the actual core of JasperReports).</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="net.sf.jasperreports.charts.base"> <!-- --> </a> <h3>Uses of <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a> in <a href="../../../../../net/sf/jasperreports/charts/base/package-summary.html">net.sf.jasperreports.charts.base</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../net/sf/jasperreports/charts/base/package-summary.html">net.sf.jasperreports.charts.base</a> that implement <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../net/sf/jasperreports/charts/base/JRBaseGanttDataset.html" title="class in net.sf.jasperreports.charts.base">JRBaseGanttDataset</a></strong></code>&nbsp;</td> </tr> </tbody> </table> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation"> <caption><span>Constructors in <a href="../../../../../net/sf/jasperreports/charts/base/package-summary.html">net.sf.jasperreports.charts.base</a> with parameters of type <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colLast"><code><strong><a href="../../../../../net/sf/jasperreports/charts/base/JRBaseGanttDataset.html#JRBaseGanttDataset(net.sf.jasperreports.charts.JRGanttDataset, net.sf.jasperreports.engine.base.JRBaseObjectFactory)">JRBaseGanttDataset</a></strong>(<a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a>&nbsp;dataset, <a href="../../../../../net/sf/jasperreports/engine/base/JRBaseObjectFactory.html" title="class in net.sf.jasperreports.engine.base">JRBaseObjectFactory</a>&nbsp;factory)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="net.sf.jasperreports.charts.design"> <!-- --> </a> <h3>Uses of <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a> in <a href="../../../../../net/sf/jasperreports/charts/design/package-summary.html">net.sf.jasperreports.charts.design</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../net/sf/jasperreports/charts/design/package-summary.html">net.sf.jasperreports.charts.design</a> that implement <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../net/sf/jasperreports/charts/design/JRDesignGanttDataset.html" title="class in net.sf.jasperreports.charts.design">JRDesignGanttDataset</a></strong></code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="net.sf.jasperreports.charts.fill"> <!-- --> </a> <h3>Uses of <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a> in <a href="../../../../../net/sf/jasperreports/charts/fill/package-summary.html">net.sf.jasperreports.charts.fill</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../net/sf/jasperreports/charts/fill/package-summary.html">net.sf.jasperreports.charts.fill</a> that implement <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../net/sf/jasperreports/charts/fill/JRFillGanttDataset.html" title="class in net.sf.jasperreports.charts.fill">JRFillGanttDataset</a></strong></code>&nbsp;</td> </tr> </tbody> </table> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation"> <caption><span>Constructors in <a href="../../../../../net/sf/jasperreports/charts/fill/package-summary.html">net.sf.jasperreports.charts.fill</a> with parameters of type <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colLast"><code><strong><a href="../../../../../net/sf/jasperreports/charts/fill/JRFillGanttDataset.html#JRFillGanttDataset(net.sf.jasperreports.charts.JRGanttDataset, net.sf.jasperreports.engine.fill.JRFillObjectFactory)">JRFillGanttDataset</a></strong>(<a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a>&nbsp;ganttDataset, <a href="../../../../../net/sf/jasperreports/engine/fill/JRFillObjectFactory.html" title="class in net.sf.jasperreports.engine.fill">JRFillObjectFactory</a>&nbsp;factory)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="net.sf.jasperreports.engine"> <!-- --> </a> <h3>Uses of <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a> in <a href="../../../../../net/sf/jasperreports/engine/package-summary.html">net.sf.jasperreports.engine</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../net/sf/jasperreports/engine/package-summary.html">net.sf.jasperreports.engine</a> with parameters of type <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="strong">JRExpressionCollector.</span><code><strong><a href="../../../../../net/sf/jasperreports/engine/JRExpressionCollector.html#collect(net.sf.jasperreports.charts.JRGanttDataset)">collect</a></strong>(<a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a>&nbsp;ganttDataset)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="net.sf.jasperreports.engine.base"> <!-- --> </a> <h3>Uses of <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a> in <a href="../../../../../net/sf/jasperreports/engine/base/package-summary.html">net.sf.jasperreports.engine.base</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../net/sf/jasperreports/engine/base/package-summary.html">net.sf.jasperreports.engine.base</a> that return <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></code></td> <td class="colLast"><span class="strong">JRBaseObjectFactory.</span><code><strong><a href="../../../../../net/sf/jasperreports/engine/base/JRBaseObjectFactory.html#getGanttDataset(net.sf.jasperreports.charts.JRGanttDataset)">getGanttDataset</a></strong>(<a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a>&nbsp;ganttDataset)</code>&nbsp;</td> </tr> </tbody> </table> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../net/sf/jasperreports/engine/base/package-summary.html">net.sf.jasperreports.engine.base</a> with parameters of type <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></code></td> <td class="colLast"><span class="strong">JRBaseObjectFactory.</span><code><strong><a href="../../../../../net/sf/jasperreports/engine/base/JRBaseObjectFactory.html#getGanttDataset(net.sf.jasperreports.charts.JRGanttDataset)">getGanttDataset</a></strong>(<a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a>&nbsp;ganttDataset)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="net.sf.jasperreports.engine.design"> <!-- --> </a> <h3>Uses of <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a> in <a href="../../../../../net/sf/jasperreports/engine/design/package-summary.html">net.sf.jasperreports.engine.design</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../net/sf/jasperreports/engine/design/package-summary.html">net.sf.jasperreports.engine.design</a> with parameters of type <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="strong">JRVerifier.</span><code><strong><a href="../../../../../net/sf/jasperreports/engine/design/JRVerifier.html#verify(net.sf.jasperreports.charts.JRGanttDataset)">verify</a></strong>(<a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a>&nbsp;dataset)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="net.sf.jasperreports.engine.fill"> <!-- --> </a> <h3>Uses of <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a> in <a href="../../../../../net/sf/jasperreports/engine/fill/package-summary.html">net.sf.jasperreports.engine.fill</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../net/sf/jasperreports/engine/fill/package-summary.html">net.sf.jasperreports.engine.fill</a> that return <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></code></td> <td class="colLast"><span class="strong">JRFillObjectFactory.</span><code><strong><a href="../../../../../net/sf/jasperreports/engine/fill/JRFillObjectFactory.html#getGanttDataset(net.sf.jasperreports.charts.JRGanttDataset)">getGanttDataset</a></strong>(<a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a>&nbsp;ganttDataset)</code>&nbsp;</td> </tr> </tbody> </table> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../net/sf/jasperreports/engine/fill/package-summary.html">net.sf.jasperreports.engine.fill</a> with parameters of type <a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a></code></td> <td class="colLast"><span class="strong">JRFillObjectFactory.</span><code><strong><a href="../../../../../net/sf/jasperreports/engine/fill/JRFillObjectFactory.html#getGanttDataset(net.sf.jasperreports.charts.JRGanttDataset)">getGanttDataset</a></strong>(<a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">JRGanttDataset</a>&nbsp;ganttDataset)</code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../net/sf/jasperreports/charts/JRGanttDataset.html" title="interface in net.sf.jasperreports.charts">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?net/sf/jasperreports/charts/class-use/JRGanttDataset.html" target="_top">Frames</a></li> <li><a href="JRGanttDataset.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small> <span style="font-decoration:none;font-family:Arial,Helvetica,sans-serif;font-size:8pt;font-style:normal;color:#000000;">&copy; 2001-2010 Jaspersoft Corporation <a href="http://www.jaspersoft.com" target="_blank" style="color:#000000;">www.jaspersoft.com</a></span> </small></p> </body> </html>
{ "content_hash": "7a6bc6234c455117572ed279f1fa25ab", "timestamp": "", "source": "github", "line_count": 358, "max_line_length": 431, "avg_line_length": 61.614525139664806, "alnum_prop": 0.6935352253150784, "repo_name": "phurtado1112/cnaemvc", "id": "4af9cb9a95ac8c2cebe5b37aa2b5a7dd81c1347a", "size": "22058", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/JasperReport__5.6/docs/api/net/sf/jasperreports/charts/class-use/JRGanttDataset.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "11139" }, { "name": "HTML", "bytes": "112926414" }, { "name": "Java", "bytes": "532942" } ], "symlink_target": "" }
require File.expand_path('../../test_helper', __FILE__) class IssueRankTest < ActionController::IntegrationTest fixtures :projects, :trackers, :issue_statuses, :issues, :enumerations, :users, :issue_categories, :projects_trackers, :roles, :member_roles, :members, :enabled_modules def test_issue_rank_update_ranks_with_display_orders_with_id_order Setting.plugin_redmine_issue_rank['rank_custom_field_name'] = 'Rank' project1 = projects(:projects_001) tracker1 = trackers(:trackers_001) tracker2 = trackers(:trackers_002) field = IssueCustomField.create!( :name => 'Rank', :type => 'IssueCustomField', :field_format => 'int', :projects => [project1], :trackers => [tracker1]) log_user('jsmith', 'jsmith') get "/projects/#{project1.identifier}/issues", { :set_filter => '1', :'f[]' => ['subproject_id', ''], :'op[subproject_id]' => '!*', :sort => 'id,cf_1' } assert_response :success assert_template 'issues/index' post "/projects/#{project1.identifier}/issue_rank/update_ranks_with_display_orders", { :sort => 'id,cf_1' } assert_response 302 assert_equal nil, flash[:error] assert_equal I18n.t('issue_rank.finished_renumbering_issue_ranks'), flash[:notice] follow_redirect! issues = Issue.where(:project_id => project1.id).order('id') issues = issues.select {|issue| issue.tracker.custom_fields.include?(field)} issues.each_with_index do |issue, i| assert_equal i + 1, issue.custom_value_for(field).value.to_i end end def test_issue_rank_update_ranks_with_display_orders_with_id_desc_order Setting.plugin_redmine_issue_rank['rank_custom_field_name'] = 'Rank' project1 = projects(:projects_001) tracker1 = trackers(:trackers_001) tracker2 = trackers(:trackers_002) field = IssueCustomField.create!( :name => 'Rank', :type => 'IssueCustomField', :field_format => 'int', :projects => [project1], :trackers => [tracker1, tracker2]) log_user('jsmith', 'jsmith') get "/projects/#{project1.identifier}/issues", { :set_filter => '1', :'f[]' => ['subproject_id', ''], :'op[subproject_id]' => '!*', :sort => 'id:desc,cf_1' } assert_response :success assert_template 'issues/index' post "/projects/#{project1.identifier}/issue_rank/update_ranks_with_display_orders" assert_response 302 assert_equal nil, flash[:error] assert_equal I18n.t('issue_rank.finished_renumbering_issue_ranks'), flash[:notice] follow_redirect! issues = Issue.where(:project_id => project1.id).order('id DESC') issues = issues.select {|issue| issue.tracker.custom_fields.include?(field)} issues.each_with_index do |issue, i| assert_equal i + 1, issue.custom_value_for(field).value.to_i end end def test_issue_rank_update_ranks_without_status_open_filter Setting.plugin_redmine_issue_rank['rank_custom_field_name'] = 'Rank' project1 = projects(:projects_001) tracker1 = trackers(:trackers_001) tracker2 = trackers(:trackers_002) field = IssueCustomField.create!( :name => 'Rank', :type => 'IssueCustomField', :field_format => 'int', :projects => [project1], :trackers => [tracker1]) log_user('jsmith', 'jsmith') get "/projects/#{project1.identifier}/issues" assert_response :success assert_template 'issues/index' post "/projects/#{project1.identifier}/issue_rank/update_ranks_with_display_orders" assert_response 302 assert_equal I18n.t('issue_rank.please_use_no_subject_filter'), flash[:error] assert_equal nil, flash[:notice] end end
{ "content_hash": "a6982347393d3862859df94ec0dbda92", "timestamp": "", "source": "github", "line_count": 111, "max_line_length": 88, "avg_line_length": 34.108108108108105, "alnum_prop": 0.6341785525620708, "repo_name": "hnakamur/redmine_issue_rank", "id": "55d3995d049d008b96d9fff4e054fae8ac06ff13", "size": "3786", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/integration/issue_rank_test.rb", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "713" }, { "name": "Ruby", "bytes": "16719" } ], "symlink_target": "" }
typedef CGAL::Polygon_2<Kernel> Linear_polygon; int main(int argc, char* argv[]) { // Open the input file and read a polygon. const char* filename = (argc > 1) ? argv[1] : "spiked.dat"; std::ifstream in_file(filename); if (! in_file.is_open()) { std::cerr << "Failed to open the input file." << std::endl; return -1; } Linear_polygon P; in_file >> P; in_file.close(); std::cout << "Read an input polygon with " << P.size() << " vertices." << std::endl; // Approximate the offset polygon with radius 5 and error bound 0.00001. boost::timer timer; Polygon_with_holes_2 offset = CGAL::approximated_offset_2(P, 5, 0.00001); double secs = timer.elapsed(); std::cout << "The offset polygon has " << offset.outer_boundary().size() << " vertices, " << offset.number_of_holes() << " holes." << std::endl; std::cout << "Offset computation took " << secs << " seconds." << std::endl; return 0; }
{ "content_hash": "67457c27344197b34b7e122309ee30e7", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 78, "avg_line_length": 35.32142857142857, "alnum_prop": 0.5874620829120324, "repo_name": "hlzz/dotfiles", "id": "8694b85ba72b27108de014c14450b29bacd32be7", "size": "1234", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "graphics/cgal/Minkowski_sum_2/examples/Minkowski_sum_2/approx_offset.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "AppleScript", "bytes": "1240" }, { "name": "Arc", "bytes": "38" }, { "name": "Assembly", "bytes": "449468" }, { "name": "Batchfile", "bytes": "16152" }, { "name": "C", "bytes": "102303195" }, { "name": "C++", "bytes": "155056606" }, { "name": "CMake", "bytes": "7200627" }, { "name": "CSS", "bytes": "179330" }, { "name": "Cuda", "bytes": "30026" }, { "name": "D", "bytes": "2152" }, { "name": "Emacs Lisp", "bytes": "14892" }, { "name": "FORTRAN", "bytes": "5276" }, { "name": "Forth", "bytes": "3637" }, { "name": "GAP", "bytes": "14495" }, { "name": "GLSL", "bytes": "438205" }, { "name": "Gnuplot", "bytes": "327" }, { "name": "Groff", "bytes": "518260" }, { "name": "HLSL", "bytes": "965" }, { "name": "HTML", "bytes": "2003175" }, { "name": "Haskell", "bytes": "10370" }, { "name": "IDL", "bytes": "2466" }, { "name": "Java", "bytes": "219109" }, { "name": "JavaScript", "bytes": "1618007" }, { "name": "Lex", "bytes": "119058" }, { "name": "Lua", "bytes": "23167" }, { "name": "M", "bytes": "1080" }, { "name": "M4", "bytes": "292475" }, { "name": "Makefile", "bytes": "7112810" }, { "name": "Matlab", "bytes": "1582" }, { "name": "NSIS", "bytes": "34176" }, { "name": "Objective-C", "bytes": "65312" }, { "name": "Objective-C++", "bytes": "269995" }, { "name": "PAWN", "bytes": "4107117" }, { "name": "PHP", "bytes": "2690" }, { "name": "Pascal", "bytes": "5054" }, { "name": "Perl", "bytes": "485508" }, { "name": "Pike", "bytes": "1338" }, { "name": "Prolog", "bytes": "5284" }, { "name": "Python", "bytes": "16799659" }, { "name": "QMake", "bytes": "89858" }, { "name": "Rebol", "bytes": "291" }, { "name": "Ruby", "bytes": "21590" }, { "name": "Scilab", "bytes": "120244" }, { "name": "Shell", "bytes": "2266191" }, { "name": "Slash", "bytes": "1536" }, { "name": "Smarty", "bytes": "1368" }, { "name": "Swift", "bytes": "331" }, { "name": "Tcl", "bytes": "1911873" }, { "name": "TeX", "bytes": "11981" }, { "name": "Verilog", "bytes": "3893" }, { "name": "VimL", "bytes": "595114" }, { "name": "XSLT", "bytes": "62675" }, { "name": "Yacc", "bytes": "307000" }, { "name": "eC", "bytes": "366863" } ], "symlink_target": "" }
namespace streamflowc { template <typename T, bool BIG> struct fastarg_traits; template <typename T> struct fastarg_traits<T,false> { typedef T type; }; template <typename T> struct fastarg_traits<T,true > { typedef const T& type; }; template <typename T> struct fastarg : fastarg_traits<T,(sizeof(T)>8)> {}; template <typename T> struct port { typedef typename fastarg<T>::type arg_type; void (*m_proc)(void *, arg_type); void operator()(arg_type x) { return m_proc(this, x); } }; struct portref_base { __SIZE_TYPE__ m_ptr; portref_base() : m_ptr(0) {} void chain(portref_base *src); void assign(void *dst); void *get() const { return reinterpret_cast<void *>(m_ptr); } }; template <typename T> struct portref : private portref_base { void operator=(port<T>& dst) { assign(&dst); } void operator=(portref<T>& src) { chain(&src); } void operator()(typename port<T>::arg_type x) { (*static_cast<port<T>*>(get()))(x); } }; template <typename T0, typename T1> struct issame { static const int val = 0; }; template <typename T> struct issame<T,T> { static const int val = 1; }; template <int N> struct garbage { template <typename T> garbage(const T&) {} }; struct nil {}; template <typename T00=nil, typename T01=nil, typename T02=nil, typename T03=nil, typename T04=nil, typename T05=nil, typename T06=nil, typename T07=nil, typename T08=nil, typename T09=nil, typename T10=nil, typename T11=nil, typename T12=nil, typename T13=nil, typename T14=nil, typename T15=nil, typename T16=nil, typename T17=nil, typename T18=nil, typename T19=nil, typename T20=nil, typename T21=nil, typename T22=nil, typename T23=nil, typename T24=nil, typename T25=nil, typename T26=nil, typename T27=nil, typename T28=nil, typename T29=nil> struct outtypes { template <typename T> struct dupcnt { static const int val = (issame<T,T00>::val+issame<T,T01>::val+issame<T,T02>::val+issame<T,T03>::val+issame<T,T04>::val +issame<T,T05>::val+issame<T,T06>::val+issame<T,T07>::val+issame<T,T08>::val+issame<T,T09>::val +issame<T,T10>::val+issame<T,T11>::val+issame<T,T12>::val+issame<T,T13>::val+issame<T,T14>::val +issame<T,T15>::val+issame<T,T16>::val+issame<T,T17>::val+issame<T,T18>::val+issame<T,T19>::val +issame<T,T20>::val+issame<T,T21>::val+issame<T,T22>::val+issame<T,T23>::val+issame<T,T24>::val +issame<T,T25>::val+issame<T,T26>::val+issame<T,T27>::val+issame<T,T28>::val+issame<T,T29>::val); }; template <typename T, int N, bool DUP> struct nth_judge; template <typename T, int N> struct nth_judge<T,N,false> { typedef portref<T>& type; }; template <typename T, int N> struct nth_judge<T,N,true> { typedef const garbage<N> type; }; template <typename T, int N> struct nth : nth_judge<T,N,(dupcnt<T>::val>1)> {}; }; namespace simcontext { void push_modulename(const char *name); void pop_modulename(); const char *get_current_basename(); const char *get_current_name(); } // namespace simcontext struct module_name { module_name(const char *name) { simcontext::push_modulename(name); } ~module_name() { simcontext::pop_modulename(); } private: // disabled module_name(); module_name(const module_name&); module_name& operator=(const module_name&); }; } // namespace streamflowc #endif
{ "content_hash": "0519f510c3f9edb575971ebb53fa5369", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 122, "avg_line_length": 44.74324324324324, "alnum_prop": 0.6771368166717004, "repo_name": "hhonda68/handy-eda-utils", "id": "f849a4d788f7cd7d12050a4a51f85c97c3474001", "size": "3665", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "systemc-utils/streamflowc/src/streamflowc.h", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "4836" }, { "name": "C", "bytes": "77647" }, { "name": "C++", "bytes": "458792" }, { "name": "Coq", "bytes": "19" }, { "name": "Makefile", "bytes": "31760" }, { "name": "Objective-C", "bytes": "1726" }, { "name": "Ruby", "bytes": "68834" }, { "name": "Shell", "bytes": "6300" }, { "name": "Verilog", "bytes": "27267" } ], "symlink_target": "" }
void cfib(int n, double *x); #endif
{ "content_hash": "c36c3545dc80e9f9e713d495b445b1c4", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 28, "avg_line_length": 18, "alnum_prop": 0.6666666666666666, "repo_name": "sympy/scipy-2017-codegen-tutorial", "id": "aa10a7db32e3283bca1751152c2901657bc1dc68", "size": "68", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scipy2017codegen/cfib/cfib.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "22025" }, { "name": "C++", "bytes": "6523" }, { "name": "HTML", "bytes": "4266" }, { "name": "Jupyter Notebook", "bytes": "215815" }, { "name": "Python", "bytes": "29241" }, { "name": "Shell", "bytes": "3055" } ], "symlink_target": "" }
"""Base GCP client which uses the discovery API. """ # modifications (c7n) # - flight recorder support # - env creds sourcing # - various minor bug fixes # todo: # - consider forking googleapiclient to get rid of httplib2 import http.client import logging import threading import os import socket import ssl from urllib.error import URLError from googleapiclient import discovery, errors # NOQA from googleapiclient.http import set_user_agent from google.auth.credentials import with_scopes_if_required import google.oauth2.credentials import google_auth_httplib2 import httplib2 from ratelimiter import RateLimiter from retrying import retry HTTPLIB_CA_BUNDLE = os.environ.get('HTTPLIB_CA_BUNDLE') CLOUD_SCOPES = frozenset(['https://www.googleapis.com/auth/cloud-platform']) # Per request max wait timeout. HTTP_REQUEST_TIMEOUT = 30.0 # Per thread storage. LOCAL_THREAD = threading.local() log = logging.getLogger('c7n_gcp.client') # Default value num_retries within HttpRequest execute method NUM_HTTP_RETRIES = 5 RETRYABLE_EXCEPTIONS = ( http.client.ResponseNotReady, http.client.IncompleteRead, httplib2.ServerNotFoundError, socket.error, ssl.SSLError, URLError, # include "no network connection" ) def get_default_project(): for k in ('GCP_PROJECT', 'GOOGLE_PROJECT', 'GCLOUD_PROJECT', 'GOOGLE_CLOUD_PROJECT', 'CLOUDSDK_CORE_PROJECT'): if k in os.environ: return os.environ[k] class PaginationNotSupported(Exception): """Pagination not supported on this api.""" def is_retryable_exception(e): """Whether exception should be retried. Args: e (Exception): Exception object. Returns: bool: True for exceptions to retry. False otherwise. """ return isinstance(e, RETRYABLE_EXCEPTIONS) @retry(retry_on_exception=is_retryable_exception, wait_exponential_multiplier=1000, wait_exponential_max=10000, stop_max_attempt_number=5) def _create_service_api(credentials, service_name, version, developer_key=None, cache_discovery=False, http=None): """Builds and returns a cloud API service object. Args: credentials (OAuth2Credentials): Credentials that will be used to authenticate the API calls. service_name (str): The name of the API. version (str): The version of the API to use. developer_key (str): The api key to use to determine the project associated with the API call, most API services do not require this to be set. cache_discovery (bool): Whether or not to cache the discovery doc. Returns: object: A Resource object with methods for interacting with the service. """ # The default logging of the discovery obj is very noisy in recent versions. # Lower the default logging level of just this module to WARNING unless # debug is enabled. if log.getEffectiveLevel() > logging.DEBUG: logging.getLogger(discovery.__name__).setLevel(logging.WARNING) discovery_kwargs = { 'serviceName': service_name, 'version': version, 'developerKey': developer_key, 'cache_discovery': cache_discovery, } if http: discovery_kwargs['http'] = http else: discovery_kwargs['credentials'] = credentials return discovery.build(**discovery_kwargs) def _build_http(http=None): """Construct an http client suitable for googleapiclient usage w/ user agent. """ if not http: http = httplib2.Http( timeout=HTTP_REQUEST_TIMEOUT, ca_certs=HTTPLIB_CA_BUNDLE) user_agent = 'Python-httplib2/{} (gzip), {}/{}'.format( httplib2.__version__, 'custodian-gcp', '0.1') return set_user_agent(http, user_agent) class Session: """Base class for API repository for a specified Cloud API.""" def __init__(self, credentials=None, quota_max_calls=None, quota_period=None, use_rate_limiter=False, http=None, project_id=None, **kwargs): """Constructor. Args: api_name (str): The API name to wrap. More details here: https://developers.google.com/api-client-library/python/apis/ versions (list): A list of version strings to initialize. credentials (object): GoogleCredentials. quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track requests over. use_rate_limiter (bool): Set to false to disable the use of a rate limiter for this service. **kwargs (dict): Additional args such as version. """ self._use_cached_http = False if not credentials: # Only share the http object when using the default credentials. self._use_cached_http = True credentials, _ = google.auth.default(quota_project_id=project_id or get_default_project()) self._credentials = with_scopes_if_required(credentials, list(CLOUD_SCOPES)) if use_rate_limiter: self._rate_limiter = RateLimiter(max_calls=quota_max_calls, period=quota_period) else: self._rate_limiter = None self._http = http self.project_id = project_id def __repr__(self): """The object representation. Returns: str: The object representation. """ return '<gcp-session: http=%s>' % (self._http,) def get_default_project(self): if self.project_id: return self.project_id default_project = get_default_project() if default_project: return default_project raise ValueError("No GCP Project ID set - set CLOUDSDK_CORE_PROJECT") def get_default_region(self): for k in ('GOOGLE_REGION', 'GCLOUD_REGION', 'CLOUDSDK_COMPUTE_REGION'): if k in os.environ: return os.environ[k] def get_default_zone(self): for k in ('GOOGLE_ZONE', 'GCLOUD_ZONE', 'CLOUDSDK_COMPUTE_ZONE'): if k in os.environ: return os.environ[k] def client(self, service_name, version, component, **kw): """Safely initialize a repository class to a property. Args: repository_class (class): The class to initialize. version (str): The gcp service version for the repository. Returns: object: An instance of repository_class. """ service = _create_service_api( self._credentials, service_name, version, kw.get('developer_key'), kw.get('cache_discovery', False), self._http or _build_http()) return ServiceClient( gcp_service=service, component=component, credentials=self._credentials, rate_limiter=self._rate_limiter, use_cached_http=self._use_cached_http, http=self._http) # pylint: disable=too-many-instance-attributes, too-many-arguments class ServiceClient: """Base class for GCP APIs.""" def __init__(self, gcp_service, credentials, component=None, num_retries=NUM_HTTP_RETRIES, key_field='project', entity_field=None, list_key_field=None, get_key_field=None, max_results_field='maxResults', search_query_field='query', rate_limiter=None, use_cached_http=True, http=None): """Constructor. Args: gcp_service (object): A Resource object with methods for interacting with the service. credentials (OAuth2Credentials): A Credentials object component (str): The subcomponent of the gcp service for this repository instance. E.g. 'instances' for compute.instances().* APIs num_retries (int): The number of http retriable errors to retry on before hard failing. key_field (str): The field name representing the project to query in the API. entity_field (str): The API entity returned generally by the .get() api. E.g. 'instance' for compute.instances().get() list_key_field (str): Optional override of key field for calls to list methods. get_key_field (str): Optional override of key field for calls to get methods. max_results_field (str): The field name that represents the maximum number of results to return in one page. search_query_field (str): The field name used to filter search results. rate_limiter (object): A RateLimiter object to manage API quota. use_cached_http (bool): If set to true, calls to the API will use a thread local shared http object. When false a new http object is used for each request. """ self.gcp_service = gcp_service self._credentials = credentials self._component = None if component: component_api = gcp_service for c in component.split('.'): component_api = getattr(component_api, c)() self._component = component_api self._entity_field = entity_field self._num_retries = num_retries if list_key_field: self._list_key_field = list_key_field else: self._list_key_field = key_field if get_key_field: self._get_key_field = get_key_field else: self._get_key_field = key_field self._max_results_field = max_results_field self._search_query_field = search_query_field self._rate_limiter = rate_limiter self._use_cached_http = use_cached_http self._local = LOCAL_THREAD self._http_replay = http @property def http(self): """A thread local instance of httplib2.Http. Returns: httplib2.Http: An Http instance authorized by the credentials. """ if self._use_cached_http and hasattr(self._local, 'http'): return self._local.http if self._http_replay is not None: # httplib2 instance is not thread safe http = self._http_replay else: http = _build_http() authorized_http = google_auth_httplib2.AuthorizedHttp( self._credentials, http=http) if self._use_cached_http: self._local.http = authorized_http return authorized_http def get_http(self): """Return an http instance sans credentials""" if self._http_replay: return self._http_replay return _build_http() def _build_request(self, verb, verb_arguments): """Builds HttpRequest object. Args: verb (str): Request verb (ex. insert, update, delete). verb_arguments (dict): Arguments to be passed with the request. Returns: httplib2.HttpRequest: HttpRequest to be sent to the API. """ method = getattr(self._component, verb) # Python insists that keys in **kwargs be strings (not variables). # Since we initially build our kwargs as a dictionary where one of the # keys is a variable (target), we need to convert keys to strings, # even though the variable in question is of type str. method_args = {str(k): v for k, v in verb_arguments.items()} return method(**method_args) def _build_next_request(self, verb, prior_request, prior_response): """Builds pagination-aware request object. More details: https://developers.google.com/api-client-library/python/guide/pagination Args: verb (str): Request verb (ex. insert, update, delete). prior_request (httplib2.HttpRequest): Request that may trigger paging. prior_response (dict): Potentially partial response. Returns: httplib2.HttpRequest: HttpRequest or None. None is returned when there is nothing more to fetch - request completed. """ method = getattr(self._component, verb + '_next') return method(prior_request, prior_response) def supports_pagination(self, verb): """Determines if the API action supports pagination. Args: verb (str): Request verb (ex. insert, update, delete). Returns: bool: True when API supports pagination, False otherwise. """ return getattr(self._component, verb + '_next', None) def execute_command(self, verb, verb_arguments): """Executes command (ex. add) via a dedicated http object. Async APIs may take minutes to complete. Therefore, callers are encouraged to leverage concurrent.futures (or similar) to place long running commands on a separate threads. Args: verb (str): Method to execute on the component (ex. get, list). verb_arguments (dict): key-value pairs to be passed to _build_request. Returns: dict: An async operation Service Response. """ request = self._build_request(verb, verb_arguments) return self._execute(request) def execute_paged_query(self, verb, verb_arguments): """Executes query (ex. list) via a dedicated http object. Args: verb (str): Method to execute on the component (ex. get, list). verb_arguments (dict): key-value pairs to be passed to _BuildRequest. Yields: dict: Service Response. Raises: PaginationNotSupportedError: When an API does not support paging. """ if not self.supports_pagination(verb=verb): raise PaginationNotSupported('{} does not support pagination') request = self._build_request(verb, verb_arguments) number_of_pages_processed = 0 while request is not None: response = self._execute(request) number_of_pages_processed += 1 log.debug('Executing paged request #%s', number_of_pages_processed) request = self._build_next_request(verb, request, response) yield response def execute_search_query(self, verb, verb_arguments): """Executes query (ex. search) via a dedicated http object. Args: verb (str): Method to execute on the component (ex. search). verb_arguments (dict): key-value pairs to be passed to _BuildRequest. Yields: dict: Service Response. """ # Implementation of search does not follow the standard API pattern. # Fields need to be in the body rather than sent seperately. next_page_token = None number_of_pages_processed = 0 while True: req_body = verb_arguments.get('body', dict()) if next_page_token: req_body['pageToken'] = next_page_token request = self._build_request(verb, verb_arguments) response = self._execute(request) number_of_pages_processed += 1 log.debug('Executing paged request #%s', number_of_pages_processed) next_page_token = response.get('nextPageToken') yield response if not next_page_token: break def execute_query(self, verb, verb_arguments): """Executes query (ex. get) via a dedicated http object. Args: verb (str): Method to execute on the component (ex. get, list). verb_arguments (dict): key-value pairs to be passed to _BuildRequest. Returns: dict: Service Response. """ request = self._build_request(verb, verb_arguments) return self._execute(request) @retry(retry_on_exception=is_retryable_exception, wait_exponential_multiplier=1000, wait_exponential_max=10000, stop_max_attempt_number=5) def _execute(self, request): """Run execute with retries and rate limiting. Args: request (object): The HttpRequest object to execute. Returns: dict: The response from the API. """ if self._rate_limiter: # Since the ratelimiter library only exposes a context manager # interface the code has to be duplicated to handle the case where # no rate limiter is defined. with self._rate_limiter: return request.execute(http=self.http, num_retries=self._num_retries) return request.execute(http=self.http, num_retries=self._num_retries)
{ "content_hash": "5dc2500adf00287ac1f5ad7aed9619d0", "timestamp": "", "source": "github", "line_count": 475, "max_line_length": 84, "avg_line_length": 35.91368421052631, "alnum_prop": 0.6080661234538953, "repo_name": "alfredgamulo/cloud-custodian", "id": "07eaf12989f2b4172d9363e31abeaf6acea4c422", "size": "17751", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tools/c7n_gcp/c7n_gcp/client.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "2126" }, { "name": "Go", "bytes": "146637" }, { "name": "HCL", "bytes": "33977" }, { "name": "Jinja", "bytes": "19775" }, { "name": "Makefile", "bytes": "14242" }, { "name": "PowerShell", "bytes": "1804" }, { "name": "Python", "bytes": "6579430" }, { "name": "Shell", "bytes": "15323" }, { "name": "Smarty", "bytes": "359" } ], "symlink_target": "" }
<?php /* Version Checker*/ $locale['vup100'] = "Din versjon er den siste versjonen"; $locale['vup101'] = "Din versjon er utdatert, vennligst oppdater"; $locale['vup102'] = "Last ned oppdatering"; $locale['vup103'] = "Vi beklager, men versjon-serveren er nede for øyeblikket.<br>Vennligst prvø igjen senere. Hvis du har sprsmål angående dette, vennligst kontat utvikleren av denne infusjonen for assistanse."; $locale['vup104'] = "Ny versjon:"; $locale['vup105'] = "Din server har ikke callow_url_fopen aktivert, vennligst kontakt dun host og be de skru det på."; $locale['vup106'] = "Du kan alltid sjekke for oppdateringer manuelt ved å gå til"; ?>
{ "content_hash": "05e3e6709542d706ef56d6c5d6216e27", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 212, "avg_line_length": 59, "alnum_prop": 0.7334360554699538, "repo_name": "simplyianm/clububer", "id": "07e671b35cde44bd17ecc29932dcf10d1561407f", "size": "649", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "infusions/sf_gift_system/locale/Norwegian/version_checker.php", "mode": "33261", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "5150" }, { "name": "CSS", "bytes": "87528" }, { "name": "HTML", "bytes": "16744" }, { "name": "JavaScript", "bytes": "189460" }, { "name": "PHP", "bytes": "5429227" } ], "symlink_target": "" }
@interface AddMemoController() @property AddMemoView *addMemoView; @end @implementation AddMemoController -(void)addToView:(UIView *)view{ self.addMemoView = [[AddMemoView alloc] initWithFrame:view.bounds]; self.addMemoView.dataDelegate = self; [view addSubview: self.addMemoView]; } -(void)textWasAccepted:(NSString *)text{ [self.addMemoView remove]; [self.delegate addMemo:text]; } -(void)dataEntryWasExited{ [self.addMemoView remove]; } @end
{ "content_hash": "e144e71c593b40979d9f8de65019b182", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 71, "avg_line_length": 13.3, "alnum_prop": 0.6541353383458647, "repo_name": "cmancushman/StackBase", "id": "2be8ce5034fdf3d727aa5e03059a1b0910c7777f", "size": "713", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "StackBase/AddMemoController.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "51846" }, { "name": "Ruby", "bytes": "921" } ], "symlink_target": "" }
package es.bsc.compss.scheduler.loadbalancing; import es.bsc.compss.components.impl.ResourceScheduler; import es.bsc.compss.scheduler.loadbalancing.types.LoadBalancingScore; import es.bsc.compss.scheduler.ready.ReadyScheduler; import es.bsc.compss.scheduler.types.AllocatableAction; import es.bsc.compss.scheduler.types.Score; import es.bsc.compss.types.resources.Worker; import es.bsc.compss.types.resources.WorkerResourceDescription; import java.util.List; import org.json.JSONObject; /** * Representation of a Scheduler that considers only ready tasks and uses resource empty policy. */ public class LoadBalancingScheduler extends ReadyScheduler { /** * Constructs a new LoadBalancingScheduler instance. */ public LoadBalancingScheduler() { super(); } /* * ********************************************************************************************************* * ********************************************************************************************************* * ***************************** UPDATE STRUCTURES OPERATIONS ********************************************** * ********************************************************************************************************* * ********************************************************************************************************* */ @Override public <T extends WorkerResourceDescription> LoadBalancingResourceScheduler<T> generateSchedulerForResource(Worker<T> w, Long appId, JSONObject resJSON, JSONObject implJSON) { // LOGGER.debug("[LoadBalancingScheduler] Generate scheduler for resource " + w.getName()); return new LoadBalancingResourceScheduler<>(w, appId, resJSON, implJSON); } @Override public Score generateActionScore(AllocatableAction action) { // LOGGER.debug("[LoadBalancingScheduler] Generate Action Score for " + action); return new LoadBalancingScore(action.getPriority(), action.getGroupPriority(), 0, -action.getId(), -100); } /* * ********************************************************************************************************* * ********************************************************************************************************* * ********************************* SCHEDULING OPERATIONS ************************************************* * ********************************************************************************************************* * ********************************************************************************************************* */ @Override public <T extends WorkerResourceDescription> void purgeFreeActions(List<AllocatableAction> dataFreeActions, List<AllocatableAction> resourceFreeActions, List<AllocatableAction> blockedCandidates, ResourceScheduler<T> resource) { List<AllocatableAction> unassignedReadyActions = this.unassignedReadyActions.removeAllActions(); dataFreeActions.addAll(unassignedReadyActions); } }
{ "content_hash": "ba2128b45e98bd51ee7262fe1e68e487", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 113, "avg_line_length": 46.515151515151516, "alnum_prop": 0.4866449511400652, "repo_name": "mF2C/COMPSs", "id": "a482214da83e224892d3f13bc708380666491ce1", "size": "3715", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "compss/runtime/scheduler/loadBalancingScheduler/src/main/java/es/bsc/compss/scheduler/loadbalancing/LoadBalancingScheduler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Awk", "bytes": "1595" }, { "name": "C", "bytes": "222477" }, { "name": "C++", "bytes": "200186" }, { "name": "Dockerfile", "bytes": "901" }, { "name": "Gnuplot", "bytes": "4195" }, { "name": "Java", "bytes": "4213323" }, { "name": "JavaScript", "bytes": "16906" }, { "name": "Jupyter Notebook", "bytes": "10514" }, { "name": "Lex", "bytes": "1356" }, { "name": "M4", "bytes": "5538" }, { "name": "Makefile", "bytes": "14740" }, { "name": "Python", "bytes": "635267" }, { "name": "Shell", "bytes": "1241476" }, { "name": "XSLT", "bytes": "177323" }, { "name": "Yacc", "bytes": "3655" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_67) on Wed Jul 26 11:35:20 CDT 2017 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>Uses of Class org.octoprint.api.ConnectionState (OctoPrint Java Lib 0.0.2 API)</title> <meta name="date" content="2017-07-26"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.octoprint.api.ConnectionState (OctoPrint Java Lib 0.0.2 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../org/octoprint/api/ConnectionState.html" title="class in org.octoprint.api">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/octoprint/api/class-use/ConnectionState.html" target="_top">Frames</a></li> <li><a href="ConnectionState.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.octoprint.api.ConnectionState" class="title">Uses of Class<br>org.octoprint.api.ConnectionState</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../org/octoprint/api/ConnectionState.html" title="class in org.octoprint.api">ConnectionState</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.octoprint.api">org.octoprint.api</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.octoprint.api"> <!-- --> </a> <h3>Uses of <a href="../../../../org/octoprint/api/ConnectionState.html" title="class in org.octoprint.api">ConnectionState</a> in <a href="../../../../org/octoprint/api/package-summary.html">org.octoprint.api</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../org/octoprint/api/package-summary.html">org.octoprint.api</a> that return <a href="../../../../org/octoprint/api/ConnectionState.html" title="class in org.octoprint.api">ConnectionState</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/octoprint/api/ConnectionState.html" title="class in org.octoprint.api">ConnectionState</a></code></td> <td class="colLast"><span class="strong">ConnectionCommand.</span><code><strong><a href="../../../../org/octoprint/api/ConnectionCommand.html#getCurrentState()">getCurrentState</a></strong>()</code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../org/octoprint/api/ConnectionState.html" title="class in org.octoprint.api">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/octoprint/api/class-use/ConnectionState.html" target="_top">Frames</a></li> <li><a href="ConnectionState.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2017. All rights reserved.</small></p> </body> </html>
{ "content_hash": "d5d57053ec5731fe527a8abd7e6f1f66", "timestamp": "", "source": "github", "line_count": 157, "max_line_length": 287, "avg_line_length": 39.12101910828026, "alnum_prop": 0.6388798436991208, "repo_name": "robweber/octoprint-java-lib", "id": "c9dfbb840a478bb34dc1b5e84e2ea7897a0b82dc", "size": "6142", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/org/octoprint/api/class-use/ConnectionState.html", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "63804" } ], "symlink_target": "" }
/* globals module */ /** * @module companyClient * @description Company Client provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use Baasic Company Route Service to obtain needed routes while other routes will be obtained through HAL. By convention, all route services use the same function names as their corresponding services. */ import { injectable, inject } from "inversify"; import { IGetRequestOptions, IOptions, IQueryModel } from '../../../common/contracts';; import { ApiClient, IHttpResponse, httpTYPES } from '../../../httpApi'; import { CompanyBatchClient, CompanyRoute, TYPES as userProfileTypes } from './'; import { ICompany } from './contracts'; @injectable() export class CompanyClient { get routeDefinition(): CompanyRoute { return this.companyRoute; } get batch(): CompanyBatchClient { return this.companyBatchClient; } constructor( @inject(userProfileTypes.CompanyBatchClient) protected companyBatchClient: CompanyBatchClient, @inject(userProfileTypes.CompanyRoute) protected companyRoute: CompanyRoute, @inject(httpTYPES.ApiClient) protected apiClient: ApiClient ) { } /** * Returns a promise that is resolved once the find action has been performed. Success response returns a list of company resources matching the given criteria. * @method * @param options Query resource options object. * @returns A promise that is resolved once the find action has been performed. * @example companyClient.find({ pageNumber : 1, pageSize : 10, orderBy : '<field>', orderDirection : '<asc|desc>', search : '<search-phrase>' }) .then(function (collection) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ find(options?: IOptions): PromiseLike<IHttpResponse<IQueryModel<ICompany>>> { return this.apiClient.get<IQueryModel<ICompany>>(this.routeDefinition.find(options)); } /** * Returns a promise that is resolved once the get action has been performed. Success response returns the company resource. * @method * @param id Company id which uniquely identifies resource that needs to be retrieved. * @returns A promise that is resolved once the get action has been performed. * @param options Query resource options object. * @example companyClient.get() .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ get(id: string, options?: IGetRequestOptions): PromiseLike<IHttpResponse<ICompany>> { return this.apiClient.get<ICompany>(this.companyRoute.get(id, options)); } /** * Returns a promise that is resolved once the create company action has been performed; this action creates a new company resource. * @method * @param data A company object that needs to be inserted into the system. * @returns A promise that is resolved once the create company action has been performed. * @example companyClient.create({ description : '<description>', name : '<name>', slug: '<slug>' }) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ create(data: ICompany): PromiseLike<IHttpResponse<ICompany>> { return this.apiClient.post<ICompany>(this.routeDefinition.create(), this.routeDefinition.createParams(data)); } /** * Returns a promise that is resolved once the update company action has been performed; this action updates a company resource. This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `companyRoute` route template. Here is an example of how a route can be obtained from HAL enabled objects: * ``` * let params = modelMapper.removeParams(company); * let uri = params['model'].links('put').href; * ``` * @method * @param data A company object used to update specified company resource. * @returns A promise that is resolved once the update company action has been performed. * @example // company is a resource previously fetched using get action. company.description = '<description>'; baasicCompanyService.update(company) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ update(data: ICompany): PromiseLike<IHttpResponse<void>> { return this.apiClient.put<void>(this.routeDefinition.update(data), this.routeDefinition.updateParams(data)); } /** * Returns a promise that is resolved once the remove action has been performed. This action will remove a company resource from the system if successfully completed. This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `companyRoute` route template. Here is an example of how a route can be obtained from HAL enabled objects: * ``` * let params = modelMapper.removeParams(company); * let uri = params['model'].links('delete').href; * ``` * @method * @param data A company object used to delete specified company resource. * @returns A promise that is resolved once the remove action has been performed. * @example // company is a resource previously fetched using get action. companyClient.remove(company) .then(function (data) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ remove(data: ICompany): PromiseLike<IHttpResponse<void>> { return this.apiClient.delete<void>(this.routeDefinition.delete(data)); } } /** * @overview ***Notes:** - Refer to the [REST API documentation](https://github.com/Baasic/baasic-rest-api/wiki) for detailed information about available Baasic REST API end-points. - All end-point objects are transformed by the associated route service. */
{ "content_hash": "522c6aab9882076779242ae1967d4f22", "timestamp": "", "source": "github", "line_count": 143, "max_line_length": 362, "avg_line_length": 51.83216783216783, "alnum_prop": 0.5825688073394495, "repo_name": "Baasic/baasic-sdk-javascript", "id": "88f6d903ec4a6dee9c6147d414fdb3f406ccedbc", "size": "7412", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/platform/modules/userProfile/CompanyClient.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "4158" }, { "name": "TypeScript", "bytes": "2287115" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "ab921a2f881b9c271162eb3d8fe31032", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "01e614076d1c8c994fc9f76310e0bc733dbddee5", "size": "189", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Trisetaria/Trisetaria linearis/ Syn. Avena arenaria/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
This package will insert a comment with name and timestamp. Use `cmd-alt-/` to insert a comment with name and timestamp. Go to package settings to configure the comment prefix.
{ "content_hash": "47df0c3e70e2abc4e7e8c607165b7e35", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 60, "avg_line_length": 35.8, "alnum_prop": 0.7821229050279329, "repo_name": "jaichandra/comment-timestamp", "id": "3999dc7bed11d2eab7206d447bb1096928cd98a1", "size": "200", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "245" }, { "name": "CoffeeScript", "bytes": "5947" } ], "symlink_target": "" }
<?php class EvaluationHelper extends AppHelper { public $helpers = array('Html'); /** * array_avg * calculate the average of the numbers in an array * * @param mixed $arr * * @access public * @return the average of the array */ function array_avg($arr) { if (empty($arr)) { return 0; } if (!($count = count(array_filter($arr, 'is_numeric')))) { return 0; } return array_sum($arr) / $count; } /** * getSummaryTableHeader * * @param mixed $totalMark * @param mixed $questions * * @access public * @return array of table headers */ function getSummaryTableHeader($totalMark, $questions) { $header = array(__('Evaluatee', true)); $num = 1; foreach ($questions as $ques) { if ($ques['self_eval']) { continue; } else if (!$ques['required']) { $num++; continue; } if (in_array($ques['mixeval_question_type_id'], array(1, 4))) { $header[] = sprintf('%d (/%.1f)', $num, $ques['multiplier']); } $num++; } $header[] = __("Total", true) . ' (/' . number_format($totalMark, 2) . ')'; return $header; } /** * getSummaryTable * * @param mixed $memberList * @param mixed $scoreRecords * @param mixed $numberQuestions * @param mixed $mixeval * @param mixed $penalties * @param mixed $notInGroup * * @access public * @return array for generating summary table */ function getSummaryTable($memberList, $scoreRecords, $numberQuestions, $mixeval, $penalties, $notInGroup) { $totalScore = 0; $totalCounter = 0; $table = array(); $required = Set::combine($numberQuestions, '{n}.question_num', '{n}.required'); $peerQues = Set::combine($numberQuestions, '{n}.question_num', '{n}.self_eval'); // only required peer evaluation questions are counted toward the averages $required = array_intersect(array_keys($required, 1), array_keys($peerQues, 0)); foreach ($scoreRecords as $evaluteeId => $scores) { $tr = array(); (in_array($evaluteeId, Set::extract($notInGroup, '/User/id'))) ? $class=array('class'=>'blue') : $class=array(); $tr[] = array($memberList[$evaluteeId], $class); foreach ($numberQuestions as $question) { if (!in_array($question['question_num'], $required)) { unset($scores[$question['question_num']]); continue; } $tr[] = isset($scores[$question['question_num']]) ? number_format($scores[$question['question_num']], 2) : __('N/A', true); } // find out penalties for total column $filteredScore = array_filter($scores, 'is_numeric'); if (empty($filteredScore)) { $tr[] = __('N/A', true); } else { $total = array_sum($filteredScore); $penalty = ($penalties[$evaluteeId] / 100) * $total; if ($penalty > 0) { $tr[] = sprintf('%.2f - <font color="red">%.2f</font> = %.2f (%.2f%%)', $total, $penalty, $total-$penalty, ($total-$penalty)/$mixeval['Mixeval']['total_marks']*100); } else { $tr[] = sprintf('%.2f (%.2f%%)', $total, $total/$mixeval['Mixeval']['total_marks']*100); } $totalScore += $total-$penalty; $totalCounter ++; } $table[$evaluteeId] = $tr; } // group average row $tr = array(array(__('Group Average', true), array())); foreach ($numberQuestions as $question) { if (!in_array($question['question_num'], $required)) { continue; } if ($totalCounter) { $avg = $this->array_avg(Set::classicExtract($scoreRecords, '{n}.'.($question['question_num']))); $tr[] = number_format($avg, 2); } else { // no values in the table $tr[] = __('N/A', true); } } $tr[] = $totalCounter ? number_format($totalScore/$totalCounter, 2) : __('N/A', true); $table[] = $tr; return $table; } /** * getRubricSummaryTableHeader * * @param mixed $total * @param mixed $criteria * * @access public * @return array for generating table header */ function getRubricSummaryTableHeader($total, $criteria) { $header = array(__('Evaluatee', true)); foreach ($criteria as $key => $criterion) { $header[] = sprintf('%d (/%.1f)', $key+1, $criterion['multiplier']); } $header[] = __("Total", true) . ' (/' . number_format($total, 2) . ')'; return $header; } /** * getRubricSummaryTable * * @param mixed $memberList list of members as id => name * @param mixed $notInGroup users not in group * @param mixed $scores scores * @param mixed $penalties penalties * @param mixed $total total * * @access public * @return array for generate summary table */ function getRubricSummaryTable($memberList, $notInGroup, $scores, $penalties, $total) { $average = array_pop($scores); $totalAve = 0; $numMembers = 0; $table = array(); foreach ($scores as $userId => $score) { $user = array(); in_array($userId, $notInGroup) ? $class=array('class' => 'blue') : $class=array(); $user[] = array($memberList[$userId], $class); foreach ($score['grades'] as $criterion) { $user[] = is_numeric($criterion) ? number_format($criterion, 2) : 'N/A'; } if (!isset($scores[$userId]['total'])) { $user[] = sprintf('%.2 (%.2f%%)', 0, 0); $totalAve += 0; } else if ($penalties[$userId] > 0) { $penalty = number_format($penalties[$userId]/100 * $scores[$userId]['total'], 2); $diff = number_format($scores[$userId]['total'] - $penalty, 2); $user[] = sprintf('%.2f - <font color="red">%.2f</font> = %.2f (%.2f%%)', number_format($scores[$userId]['total'], 2), $penalty, $diff, number_format($diff/$total*100, 2)); $totalAve += $diff; } else { $user[] = sprintf('%.2f (%.2f%%)', $scores[$userId]['total'], number_format($scores[$userId]['total']/$total*100, 2)); $totalAve += $scores[$userId]['total']; } $numMembers++; $table[] = $user; } $user = array(); $user[] = __('Group Average', true); foreach ($average as $ave) { $user[] = number_format($ave, 2); } $user[] = number_format($totalAve/$numMembers, 2); $table[] = $user; return $table; } /** * getIndividualRubricHeader * * @param mixed $criteria * * @access public * @return void */ function getIndividualRubricHeader($criteria) { $header = array(__('Evaluator', true)); foreach ($criteria as $criterion) { $header[$criterion['criteria_num']] = '('.$criterion['criteria_num'].') '.$criterion['criteria']; } return $header; } /** * getReviewButton * * @param mixed $event * @param mixed $displayFormat * * @access public * @return review button for evaluation results */ function getReviewButton($event, $displayFormat) { $button = '<form name="evalForm" id="evalForm" method="POST" action="'.$this->Html->url('markEventReviewed').'">'. '<input type="hidden" name="event_id" value="'.$event['Event']['id'].'" />'. '<input type="hidden" name="group_id" value="'.$event['Group']['id'].'" />'. '<input type="hidden" name="course_id" value="'.$event['Event']['course_id'].'" />'. '<input type="hidden" name="group_event_id" value="'.$event['GroupEvent']['id'].'" />'. '<input type="hidden" name="display_format" value="'.$displayFormat.'" />'; if ($event['GroupEvent']['marked'] == "reviewed") { $button .= '<input class="reviewed" type="submit" name="mark_not_reviewed" value="'.__('Mark Peer Evaluations as Not Reviewed', true).'" />'; } else { $button .= '<input class="reviewed" type="submit" name="mark_reviewed" value="'.__('Mark Peer Evaluations as Reviewed', true).'" />'; } $button .= '</form>'; return $button; } /** * getReleaseStatusTableHeader * * @access public * @return array for header */ function getReleaseStatusTableHeader() { $header = array(__('Evaluatee', true)); $header[] = __('Grades', true); $header[] = __('Comments', true); return $header; } /** * getReleaseStatusButtons * * @param mixed $evaluatees * @param mixed $notInGroup * @param mixed $grpEventId * @param mixed $status * * @access public * @return array for body of table */ function getReleaseStatusTableButtons($evaluatees, $notInGroup, $grpEventId, $status) { $body = array(); unset($status['grades']); $button = '<form name="evalForm" id="evalForm" method="POST" action="'.$this->Html->url('markCommentRelease').'">'. '<input type="hidden" name="group_event_id" value="'.$grpEventId.'" />'; foreach ($status as $id => $details) { $row = array(); $class = in_array($id, $notInGroup) ? array('class' => 'blue') : array(); $row[] = array($evaluatees[$id], $class); if ($details['release_status']['gradeRelease']) { $row[] = '<input type="button" name="UnreleaseGrades" value="'.__('Unrelease Grades', true).'" onClick="location.href=\''.$this->webroot.$this->theme.'evaluations/markGradeRelease/'.$grpEventId.'/0/'.$id.'\'">'; } else { $row[] = '<input type="button" name="ReleaseGrades" value="'.__('Release Grades', true).'" onClick="location.href=\''.$this->webroot.$this->theme.'evaluations/markGradeRelease/'.$grpEventId.'/1/'.$id.'\'">'; } $comment = $button.'<input type="hidden" name="evaluatee" value="'.$id.'" />'; if ($details['release_status']['commentRelease']) { $comment .= '<input name="submit" type="submit" value="'.__('Unrelease Comments', true).'" /></form>'; } else { $comment .= '<input name="submit" type="submit" value="'.__('Release Comments', true).'" /></form>'; } $row[] = $comment; $body[] = $row; } $all = array(''); $allCommentStatus = array_product(Set::classicExtract($status, '{n}.release_status.commentRelease')); $allGradeStatus = array_product(Set::classicExtract($status, '{n}.release_status.gradeRelease')); if ($allGradeStatus) { $all[] = '<input type="button" name="UnreleaseGrades" value="'.__('Unrelease All Grades', true).'" onClick="location.href=\''.$this->webroot.$this->theme.'evaluations/markGradeRelease/'.$grpEventId.'/0\'">'; } else { $all[] = '<input type="button" name="ReleaseGrades" value="'.__('Release All Grades', true).'" onClick="location.href=\''.$this->webroot.$this->theme.'evaluations/markGradeRelease/'.$grpEventId.'/1\'">'; } if ($allCommentStatus) { $comment = $button.'<input name="submit" type="submit" value="'.__('Unrelease All Comments', true).'" /></form>'; } else { $comment = $button.'<input name="submit" type="submit" value="'.__('Release All Comments', true).'" /></form>'; } $all[] = $comment; $body[] = $all; return $body; } }
{ "content_hash": "00ddb8b4576a31ffe9b82317bda56657", "timestamp": "", "source": "github", "line_count": 322, "max_line_length": 227, "avg_line_length": 38.30124223602485, "alnum_prop": 0.5082299521608692, "repo_name": "eecian/Team08-iPeer", "id": "d19846e97026408bd49a8952d8488f67dfbc94c7", "size": "12551", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/views/helpers/evaluation.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "981" }, { "name": "Batchfile", "bytes": "1013" }, { "name": "C++", "bytes": "31017" }, { "name": "CSS", "bytes": "68615" }, { "name": "Groff", "bytes": "39434" }, { "name": "JavaScript", "bytes": "224724" }, { "name": "Makefile", "bytes": "492" }, { "name": "PHP", "bytes": "9211154" }, { "name": "Puppet", "bytes": "916" }, { "name": "Shell", "bytes": "1259" } ], "symlink_target": "" }
<?php namespace Certiz\Bundle\UserBundle\Entity; use FOS\UserBundle\Entity\User as BaseUser; use Doctrine\ORM\Mapping as ORM; /** * User */ class User extends BaseUser { /** * @var string */ protected $id; /** * @var \DateTime */ private $createdAt; /** * @var \DateTime */ private $updatedAt; /** * Constructor */ public function __construct() { parent::__construct(); } /** * Set id * * @param string $id * @return User */ public function setId($id) { $this->id = $id; return $this; } /** * Get id * * @return string */ public function getId() { return $this->id; } /** * Set createdAt * * @param \DateTime $createdAt * @return User */ public function setCreatedAt($createdAt) { $this->createdAt = $createdAt; return $this; } /** * Get createdAt * * @return \DateTime */ public function getCreatedAt() { return $this->createdAt; } /** * Set updatedAt * * @param \DateTime $updatedAt * @return User */ public function setUpdatedAt($updatedAt) { $this->updatedAt = $updatedAt; return $this; } /** * Get updatedAt * * @return \DateTime */ public function getUpdatedAt() { return $this->updatedAt; } }
{ "content_hash": "bf3e40c9a0da801829725ef6c6990836", "timestamp": "", "source": "github", "line_count": 106, "max_line_length": 44, "avg_line_length": 14.245283018867925, "alnum_prop": 0.4847682119205298, "repo_name": "jbouzekri/certiz", "id": "4c416b423e657525d12beb64047988267e7e4e70", "size": "1768", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Certiz/Bundle/UserBundle/Entity/User.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1347" }, { "name": "JavaScript", "bytes": "26668" }, { "name": "PHP", "bytes": "149902" } ], "symlink_target": "" }
install_dir=/Users/Shared/fb_installers log_location="/var/log/firstbootpackageinstall.log" archive_log_location="/var/log/firstbootpackageinstall-`date +%Y-%m-%d-%H-%M-%S`.log" LoginLogLaunchAgent="/Library/LaunchAgents/com.company.LoginLog.plist" LoginLogApp="/Library/PrivilegedHelperTools/LoginLog.app" # Function to provide logging of the script's actions to # the log file defined by the log_location variable ScriptLogging(){ DATE=`date +%Y-%m-%d\ %H:%M:%S` LOG="$log_location" echo "$DATE" " $1" >> $LOG } # Function that determines if the network is up by # looking for any non-loopback network interfaces. CheckForNetwork(){ local test if [[ -z "${NETWORKUP:=}" ]]; then test=$(ifconfig -a inet 2>/dev/null | sed -n -e '/127.0.0.1/d' -e '/0.0.0.0/d' -e '/inet/p' | wc -l) if [[ "${test}" -gt 0 ]]; then NETWORKUP="-YES-" else NETWORKUP="-NO-" fi fi } # Delay the login window by unloading the com.apple.loginwindow # LaunchDaemon in /System/Library/LaunchDaemons/ /bin/launchctl unload /System/Library/LaunchDaemons/com.apple.loginwindow.plist # # If the installers directory is not found, the # com.apple.loginwindow LaunchDaemon is loaded and # this script and associated parts self-destruct # if [[ ! -d "$install_dir" ]]; then ScriptLogging "Firstboot installer directory not present. Cleaning up." /bin/launchctl unload -S loginwindow $LoginLogLaunchAgent /bin/rm $LoginLogLaunchAgent /bin/rm -rf $LoginLogApp /bin/launchctl load /System/Library/LaunchDaemons/com.apple.loginwindow.plist /bin/rm -rf /Library/LaunchDaemons/com.company.firstbootpackageinstall.plist # Rename logfile so that a # fresh log is generated for # each run. if [[ -f "$log_location" ]]; then /bin/mv $log_location $archive_log_location fi /bin/rm $0 fi # # If the installers directory is found, the # script installs the packages found in # the subdirectories, using the numbered # subdirectories to set the order of # installation. # if [[ -d "$install_dir" ]]; then /bin/launchctl load /System/Library/LaunchDaemons/com.apple.loginwindow.plist # Wait up to 60 minutes for a network connection to become # available which doesn't use a loopback address. This # condition which may occur if this script is run by a # LaunchDaemon at boot time. # # The network connection check will occur every 5 seconds # until the 60 minute limit is reached. # # Detect unregistered network services prior # to beginning the network connection check /usr/sbin/networksetup -detectnewhardware ScriptLogging "Checking for active network connection." ScriptLogging "=========================================" ScriptLogging "This check will automatically run every five" ScriptLogging "seconds until an active network connection is" ScriptLogging "detected or until sixty minutes have passed." ScriptLogging "=========================================" CheckForNetwork i=1 while [[ "${NETWORKUP}" != "-YES-" ]] && [[ $i -ne 720 ]] do /bin/sleep 5 NETWORKUP= CheckForNetwork echo $i i=$(( $i + 1 )) done if [[ "${NETWORKUP}" != "-YES-" ]]; then ScriptLogging "Network connection appears to be offline." ScriptLogging "Removing $install_dir from this Mac and restarting." /bin/rm -rf $install_dir # Sleeping for 10 seconds to allow folks to read the last message /bin/sleep 10 /sbin/reboot fi if [[ "${NETWORKUP}" == "-YES-" ]]; then ScriptLogging "Active network connection detected. Proceeding." fi ScriptLogging "$install_dir present on Mac" # Installing the packages found in # the installers directory using # an array # Save current IFS state OLDIFS=$IFS # Change IFS to # create newline IFS=$'\n' # read all installer names into an array install=($(/usr/bin/find -s "$install_dir" -maxdepth 2 \( -iname \*\.pkg -o -iname \*\.mpkg \))) # restore IFS to previous state IFS=$OLDIFS # Get length of the array tLen=${#install[@]} # Use for loop to read all filenames # and install the corresponding installer # packages ScriptLogging "Found ${tLen} packages to install." ScriptLogging "Please be patient. This process may take a while to complete." ScriptLogging "Once all installations are finished, this machine will automatically reboot." for (( i=0; i<${tLen}; i++ )); do /bin/echo "`date +%Y-%m-%d\ %H:%M:%S` Installing "${install[$i]}" on this Mac." >> $log_location /usr/sbin/installer -dumplog -verbose -pkg "${install[$i]}" -target / # Check for installation success. If an installation did not return # an exit status of 0, add a note to the log that the installation # had problems and should be checked. if [ $? != "0" ] then INSTALLRESULT="FAILURE: "${install[$i]}" did not install correctly." else INSTALLRESULT="SUCCESS: "${install[$i]}" has been successfully installed." fi /bin/echo "`date +%Y-%m-%d\ %H:%M:%S` $INSTALLRESULT" >> $log_location done # Remove the installers ScriptLogging "Finished with all installations." ScriptLogging "If any installations were reported as not installing correctly," ScriptLogging "please check /var/log/install.log on this Mac for details." ScriptLogging "Removing $install_dir from this Mac." /bin/rm -rf $install_dir # To accomodate packages needing # a restart, the Mac is restarted # at this point. ScriptLogging "Restarting Mac." # Sleeping for 10 seconds to allow folks to read # the last message /bin/sleep 10 /sbin/reboot fi
{ "content_hash": "e388a70dd36a41e8870457bfc99ba36b", "timestamp": "", "source": "github", "line_count": 194, "max_line_length": 108, "avg_line_length": 29.190721649484537, "alnum_prop": 0.6761433868974042, "repo_name": "rtrouton/First-Boot-Package-Install", "id": "5451da74f96fc45b35a939a4b085ccd1f9c9e824", "size": "5676", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "scripts/firstbootpackageinstall.sh", "mode": "33261", "license": "mit", "language": [ { "name": "Shell", "bytes": "5772" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>ActiveModel::Validations::Callbacks::ClassMethods</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" /> <link rel="stylesheet" href="../../../../css/github.css" type="text/css" media="screen" /> <script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script> <script src="../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script> </head> <body> <div class="banner"> <span>Ruby on Rails 4.2.2</span><br /> <h1> <span class="type">Module</span> ActiveModel::Validations::Callbacks::ClassMethods </h1> <ul class="files"> <li><a href="../../../../files/__/_rvm/gems/ruby-2_2_2/gems/activemodel-4_2_2/lib/active_model/validations/callbacks_rb.html">/Users/benfreeman/.rvm/gems/ruby-2.2.2/gems/activemodel-4.2.2/lib/active_model/validations/callbacks.rb</a></li> </ul> </div> <div id="bodyContent"> <div id="content"> <!-- Method ref --> <div class="sectiontitle">Methods</div> <dl class="methods"> <dt>A</dt> <dd> <ul> <li> <a href="#method-i-after_validation">after_validation</a> </li> </ul> </dd> <dt>B</dt> <dd> <ul> <li> <a href="#method-i-before_validation">before_validation</a> </li> </ul> </dd> </dl> <!-- Methods --> <div class="sectiontitle">Instance Public methods</div> <div class="method"> <div class="title method-title" id="method-i-after_validation"> <b>after_validation</b>(*args, &amp;block) <a href="../../../../classes/ActiveModel/Validations/Callbacks/ClassMethods.html#method-i-after_validation" name="method-i-after_validation" class="permalink">Link</a> </div> <div class="description"> <p>Defines a callback that will get called right after validation happens.</p> <pre><code>class Person include ActiveModel::Validations include ActiveModel::Validations::Callbacks attr_accessor :name, :status validates_presence_of :name after_validation :set_status private def set_status self.status = errors.empty? end end person = Person.new person.name = &#39;&#39; person.valid? # =&gt; false person.status # =&gt; false person.name = &#39;bob&#39; person.valid? # =&gt; true person.status # =&gt; true </code></pre> </div> <div class="sourcecode"> <p class="source-link"> Source: <a href="javascript:toggleSource('method-i-after_validation_source')" id="l_method-i-after_validation_source">show</a> </p> <div id="method-i-after_validation_source" class="dyn-source"> <pre><span class="ruby-comment"># File ../.rvm/gems/ruby-2.2.2/gems/activemodel-4.2.2/lib/active_model/validations/callbacks.rb, line 95</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">after_validation</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:prepend</span>] = <span class="ruby-keyword">true</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:if</span>] = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:if</span>]) <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:on</span>] <span class="ruby-identifier">options</span>[<span class="ruby-value">:on</span>] = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:on</span>]) <span class="ruby-identifier">options</span>[<span class="ruby-value">:if</span>].<span class="ruby-identifier">unshift</span> <span class="ruby-operator">-</span><span class="ruby-operator">&gt;</span>(<span class="ruby-identifier">o</span>) { <span class="ruby-identifier">options</span>[<span class="ruby-value">:on</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">validation_context</span> } <span class="ruby-keyword">end</span> <span class="ruby-identifier">set_callback</span>(<span class="ruby-value">:validation</span>, <span class="ruby-value">:after</span>, <span class="ruby-operator">*</span>(<span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">options</span>), <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> <div class="method"> <div class="title method-title" id="method-i-before_validation"> <b>before_validation</b>(*args, &amp;block) <a href="../../../../classes/ActiveModel/Validations/Callbacks/ClassMethods.html#method-i-before_validation" name="method-i-before_validation" class="permalink">Link</a> </div> <div class="description"> <p>Defines a callback that will get called right before validation happens.</p> <pre><code>class Person include ActiveModel::Validations include ActiveModel::Validations::Callbacks attr_accessor :name validates_length_of :name, maximum: 6 before_validation :remove_whitespaces private def remove_whitespaces name.strip! end end person = Person.new person.name = &#39; bob &#39; person.valid? # =&gt; true person.name # =&gt; &quot;bob&quot; </code></pre> </div> <div class="sourcecode"> <p class="source-link"> Source: <a href="javascript:toggleSource('method-i-before_validation_source')" id="l_method-i-before_validation_source">show</a> </p> <div id="method-i-before_validation_source" class="dyn-source"> <pre><span class="ruby-comment"># File ../.rvm/gems/ruby-2.2.2/gems/activemodel-4.2.2/lib/active_model/validations/callbacks.rb, line 56</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">before_validation</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:on</span>] <span class="ruby-identifier">options</span>[<span class="ruby-value">:if</span>] = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:if</span>]) <span class="ruby-identifier">options</span>[<span class="ruby-value">:on</span>] = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:on</span>]) <span class="ruby-identifier">options</span>[<span class="ruby-value">:if</span>].<span class="ruby-identifier">unshift</span> <span class="ruby-operator">-</span><span class="ruby-operator">&gt;</span>(<span class="ruby-identifier">o</span>) { <span class="ruby-identifier">options</span>[<span class="ruby-value">:on</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">validation_context</span> } <span class="ruby-keyword">end</span> <span class="ruby-identifier">set_callback</span>(<span class="ruby-value">:validation</span>, <span class="ruby-value">:before</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword">end</span></pre> </div> </div> </div> </div> </div> </body> </html>
{ "content_hash": "3eb44e72cd6a92dc18ac9bb67b8a5171", "timestamp": "", "source": "github", "line_count": 244, "max_line_length": 390, "avg_line_length": 40.442622950819676, "alnum_prop": 0.5949533846777463, "repo_name": "benfreeman/yammer_training", "id": "9545435b628ff18ad410ba7fc85b5b7ab2420a2e", "size": "9868", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/api/classes/ActiveModel/Validations/Callbacks/ClassMethods.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2393" }, { "name": "CoffeeScript", "bytes": "633" }, { "name": "HTML", "bytes": "20790" }, { "name": "JavaScript", "bytes": "699" }, { "name": "Ruby", "bytes": "49589" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="jp.morimotor.example" > <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
{ "content_hash": "8e20aeef3d7e09b003abfd51abb53ca5", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 76, "avg_line_length": 33.2, "alnum_prop": 0.6099397590361446, "repo_name": "morimotor/EndRollView", "id": "1dfddd3cd8cf96c7fd5fd776746e1884c6adea07", "size": "664", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/AndroidManifest.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "13513" } ], "symlink_target": "" }
CIFXMaterialResourceEncoder::CIFXMaterialResourceEncoder() { m_bInitialized = FALSE; m_pBitStream = NULL; m_pCoreServices = NULL; m_pObject = NULL; m_uRefCount = 0; } // destructor CIFXMaterialResourceEncoder::~CIFXMaterialResourceEncoder() { IFXRELEASE( m_pBitStream ); IFXRELEASE( m_pCoreServices ); IFXRELEASE( m_pObject ); } // IFXUnknown U32 CIFXMaterialResourceEncoder::AddRef() { return ++m_uRefCount; } U32 CIFXMaterialResourceEncoder::Release() { if ( !( --m_uRefCount ) ) { delete this; // This second return point is used so that the deleted object's // reference count isn't referenced after the memory is released. return 0; } return m_uRefCount; } IFXRESULT CIFXMaterialResourceEncoder::QueryInterface( IFXREFIID interfaceId, void** ppInterface ) { IFXRESULT rc = IFX_OK; if ( ppInterface ) { if ( interfaceId == IID_IFXEncoderX ) { *ppInterface = ( IFXEncoderX* ) this; this->AddRef(); } else if ( interfaceId == IID_IFXUnknown ) { *ppInterface = ( IFXUnknown* ) this; this->AddRef(); } else { *ppInterface = NULL; rc = IFX_E_UNSUPPORTED; } } else rc = IFX_E_INVALID_POINTER; IFXRETURN(rc); } // IFXEncoderX void CIFXMaterialResourceEncoder::EncodeX( IFXString& rName, IFXDataBlockQueueX& rDataBlockQueue, F64 units ) { IFXDataBlockX* pDataBlock = NULL; IFXMaterialResource* pMaterialResource = NULL; try { // check for initialization if ( FALSE == m_bInitialized ) throw IFXException( IFX_E_NOT_INITIALIZED ); if ( NULL == m_pObject ) throw IFXException( IFX_E_CANNOT_FIND ); IFXCHECKX( m_pObject->QueryInterface( IID_IFXMaterialResource, (void**)&pMaterialResource ) ); // The material resource block has the following sections: // 1. MaterialName (ICHAR) // 2. MaterialAttributes (U32) // 3. Ambient color (3*F32) // 4. Diffuse color (3*F32) // 5. Specular color (3*F32) // 6. Emissive color (3*F32) // 7. Reflectivity (F32) // 8. Opacity (F32) // 1. Write the material name m_pBitStream->WriteIFXStringX( rName ); // 2. MaterialAttributes (U32) U32 uAttributes = pMaterialResource->GetAttributes(); uAttributes &= 0x0000003F; // Not using Attributes enum since it could get out of sync with the spec. m_pBitStream->WriteU32X(uAttributes); // 3. Ambient color (3*F32) IFXVector4 vColor; IFXCHECKX( pMaterialResource->GetAmbient(&vColor) ); m_pBitStream->WriteF32X(vColor.R()); m_pBitStream->WriteF32X(vColor.G()); m_pBitStream->WriteF32X(vColor.B()); // 4. Diffuse color (3*F32) IFXCHECKX( pMaterialResource->GetDiffuse(&vColor) ); m_pBitStream->WriteF32X(vColor.R()); m_pBitStream->WriteF32X(vColor.G()); m_pBitStream->WriteF32X(vColor.B()); // 5. Specular color (3*F32) IFXCHECKX( pMaterialResource->GetSpecular(&vColor) ); m_pBitStream->WriteF32X(vColor.R()); m_pBitStream->WriteF32X(vColor.G()); m_pBitStream->WriteF32X(vColor.B()); // 6. Emissive color (3*F32) IFXCHECKX( pMaterialResource->GetEmission(&vColor) ); m_pBitStream->WriteF32X(vColor.R()); m_pBitStream->WriteF32X(vColor.G()); m_pBitStream->WriteF32X(vColor.B()); // 7. Reflectivity (F32) F32 fReflectivity; IFXCHECKX( pMaterialResource->GetReflectivity(&fReflectivity) ); m_pBitStream->WriteF32X(fReflectivity); // 8. Opacity (F32) F32 fOpacity; IFXCHECKX( pMaterialResource->GetOpacity(&fOpacity) ); m_pBitStream->WriteF32X(fOpacity); // get the block m_pBitStream->GetDataBlockX( pDataBlock ); // set the data block type pDataBlock->SetBlockTypeX( BlockType_ResourceMaterialU3D ); // set the priority on the datablock pDataBlock->SetPriorityX( 0 ); // returns void // set metadata IFXDECLARELOCAL(IFXMetaDataX, pBlockMD); IFXDECLARELOCAL(IFXMetaDataX, pObjectMD); pDataBlock->QueryInterface(IID_IFXMetaDataX, (void**)&pBlockMD); m_pObject->QueryInterface(IID_IFXMetaDataX, (void**)&pObjectMD); pBlockMD->AppendX(pObjectMD); // Put the data block on the list rDataBlockQueue.AppendBlockX( *pDataBlock ); // clean up IFXRELEASE( pDataBlock ); IFXRELEASE( pMaterialResource ); return; } catch ( ... ) { IFXRELEASE( pDataBlock ); IFXRELEASE( pMaterialResource ); throw; } } void CIFXMaterialResourceEncoder::InitializeX( IFXCoreServices& rCoreServices ) { try { // latch onto the core services object passed in IFXRELEASE( m_pCoreServices ) m_pCoreServices = &rCoreServices; m_pCoreServices->AddRef(); // create a bitstream IFXRELEASE( m_pBitStream ); IFXCHECKX( IFXCreateComponent( CID_IFXBitStreamX, IID_IFXBitStreamX, (void**)&m_pBitStream ) ); m_bInitialized = TRUE; return; } catch ( ... ) { IFXRELEASE( m_pCoreServices ); throw; } } void CIFXMaterialResourceEncoder::SetObjectX( IFXUnknown& rObject ) { try { // set the object IFXRELEASE( m_pObject ); m_pObject = &rObject; m_pObject->AddRef(); return; } catch ( ... ) { throw; } } // Factory friend IFXRESULT IFXAPI_CALLTYPE CIFXMaterialResourceEncoder_Factory( IFXREFIID interfaceId, void** ppInterface ) { IFXRESULT rc = IFX_OK; if ( ppInterface ) { // Create the CIFXLoadManager component. CIFXMaterialResourceEncoder *pComponent = new CIFXMaterialResourceEncoder; if ( pComponent ) { // Perform a temporary AddRef for our usage of the component. pComponent->AddRef(); // Attempt to obtain a pointer to the requested interface. rc = pComponent->QueryInterface( interfaceId, ppInterface ); // Perform a Release since our usage of the component is now // complete. Note: If the QI fails, this will cause the // component to be destroyed. pComponent->Release(); } else rc = IFX_E_OUT_OF_MEMORY; } else rc = IFX_E_INVALID_POINTER; IFXRETURN( rc ); }
{ "content_hash": "41493341f1f3afd08291193b7667bc3a", "timestamp": "", "source": "github", "line_count": 272, "max_line_length": 109, "avg_line_length": 21.540441176470587, "alnum_prop": 0.6864652671104284, "repo_name": "ningfei/u3d", "id": "1324bc9437fe5b866a46aff86441ae20b6bcf2f6", "size": "7207", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "RTL/Component/Exporting/CIFXMaterialResourceEncoder.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "3254612" }, { "name": "C++", "bytes": "8129490" }, { "name": "CMake", "bytes": "78293" }, { "name": "Groff", "bytes": "2611840" }, { "name": "HTML", "bytes": "86667" }, { "name": "M4", "bytes": "2599" }, { "name": "Makefile", "bytes": "1750600" }, { "name": "Objective-C", "bytes": "4252" }, { "name": "Shell", "bytes": "326493" } ], "symlink_target": "" }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_alloca_memcpy_74b.cpp Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE806.label.xml Template File: sources-sink-74b.tmpl.cpp */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Initialize data as a large string * GoodSource: Initialize data as a small string * Sinks: memcpy * BadSink : Copy data to string using memcpy * Flow Variant: 74 Data flow: data passed in a map from one function to another in different source files * * */ #include "std_testcase.h" #include <map> #include <wchar.h> using namespace std; namespace CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_alloca_memcpy_74 { #ifndef OMITBAD void badSink(map<int, wchar_t *> dataMap) { /* copy data out of dataMap */ wchar_t * data = dataMap[2]; { wchar_t dest[50] = L""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memcpy(dest, data, wcslen(data)*sizeof(wchar_t)); dest[50-1] = L'\0'; /* Ensure the destination buffer is null terminated */ printWLine(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void goodG2BSink(map<int, wchar_t *> dataMap) { wchar_t * data = dataMap[2]; { wchar_t dest[50] = L""; /* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */ memcpy(dest, data, wcslen(data)*sizeof(wchar_t)); dest[50-1] = L'\0'; /* Ensure the destination buffer is null terminated */ printWLine(data); } } #endif /* OMITGOOD */ } /* close namespace */
{ "content_hash": "b411cd1097975c386e8faa2861158136", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 106, "avg_line_length": 28.639344262295083, "alnum_prop": 0.6451058958214081, "repo_name": "maurer/tiamat", "id": "378477cb275b607b4c920c04d9290d70d2336eda", "size": "1747", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "samples/Juliet/testcases/CWE121_Stack_Based_Buffer_Overflow/s07/CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_alloca_memcpy_74b.cpp", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false config.action_controller.asset_host = "http://#{ENV.fetch('LOCALHOST_AKA', 'localhost')}:3000" # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.delivery_method = :letter_opener config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews" config.action_mailer.default_url_options = { host: "#{ENV.fetch('LOCALHOST_AKA', 'localhost')}:3000" } config.action_mailer.asset_host = config.action_controller.asset_host # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Adds additional error checking when serving assets at runtime. # Checks for improperly declared sprockets dependencies. # Raises helpful error messages. config.assets.raise_runtime_errors = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true end
{ "content_hash": "3c94ee0c5441efb0334960429138e12f", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 104, "avg_line_length": 43.523809523809526, "alnum_prop": 0.7571115973741794, "repo_name": "heatherm/homebrewswap", "id": "bc2dd097c157a64a2294067d0aca440828373b3b", "size": "1828", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "config/environments/development.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "68567" }, { "name": "CoffeeScript", "bytes": "211" }, { "name": "HTML", "bytes": "7328" }, { "name": "JavaScript", "bytes": "1265" }, { "name": "Ruby", "bytes": "124089" }, { "name": "Shell", "bytes": "245" } ], "symlink_target": "" }
<?php namespace Psr7Middlewares\Transformers; use Psr\Http\Message\StreamInterface; use JSMinPlus; use CSSmin; use Minify_HTML; /** * Generic resolver to minify responses. */ class Minifier extends Resolver { protected $transformers = [ 'text/javascript' => [__CLASS__, 'js'], 'text/css' => [__CLASS__, 'css'], 'text/html' => [__CLASS__, 'html'], ]; /** * Javascript minifier. * * @param StreamInterface $input * @param StreamInterface $output * * @return StreamInterface */ public static function js(StreamInterface $input, StreamInterface $output) { $output->write(JSMinPlus::minify((string) $input)); return $output; } /** * CSS minifier. * * @param StreamInterface $input * @param StreamInterface $output * * @return StreamInterface */ public static function css(StreamInterface $input, StreamInterface $output) { $output->write((new CSSmin())->run((string) $input)); return $output; } /** * HTML minifier. * * @param StreamInterface $input * @param StreamInterface $output * * @return StreamInterface */ public static function html(StreamInterface $input, StreamInterface $output) { $output->write(Minify_HTML::minify((string) $input, ['jsCleanComments' => true])); return $output; } }
{ "content_hash": "3f5733a4eefb5e038fc7d573cb0862a6", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 90, "avg_line_length": 22.076923076923077, "alnum_prop": 0.5937282229965157, "repo_name": "oscarotero/psr7-middlewares", "id": "13916e2d14ea752cf160b1442cc97689ac92a544", "size": "1435", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/Transformers/Minifier.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "267967" } ], "symlink_target": "" }
""" Wavefront REST API Documentation <p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST API documentation you must add the header \"Authorization: Bearer &lt;&lt;API-TOKEN&gt;&gt;\" to your HTTP requests.</p> # noqa: E501 OpenAPI spec version: v2 Contact: chitimba@wavefront.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import copy import logging import multiprocessing import sys import urllib3 import six from six.moves import http_client as httplib class Configuration(object): """NOTE: This class is auto generated by the swagger code generator program. Ref: https://github.com/swagger-api/swagger-codegen Do not edit the class manually. """ _default = None def __init__(self): """Constructor""" if self._default: for key in self._default.__dict__.keys(): self.__dict__[key] = copy.copy(self._default.__dict__[key]) return # Default Base url self.host = "https://localhost" # Temp file folder for downloading files self.temp_folder_path = None # Authentication Settings # dict to store API key(s) self.api_key = {} # dict to store API prefix (e.g. Bearer) self.api_key_prefix = {} # function to refresh API key if expired self.refresh_api_key_hook = None # Username for HTTP basic authentication self.username = "" # Password for HTTP basic authentication self.password = "" # Logging Settings self.logger = {} self.logger["package_logger"] = logging.getLogger("wavefront_api_client") self.logger["urllib3_logger"] = logging.getLogger("urllib3") # Log format self.logger_format = '%(asctime)s %(levelname)s %(message)s' # Log stream handler self.logger_stream_handler = None # Log file handler self.logger_file_handler = None # Debug file location self.logger_file = None # Debug switch self.debug = False # SSL/TLS verification # Set this to false to skip verifying SSL certificate when calling API # from https server. self.verify_ssl = True # Set this to customize the certificate file to verify the peer. self.ssl_ca_cert = None # client certificate file self.cert_file = None # client key file self.key_file = None # Set this to True/False to enable/disable SSL hostname verification. self.assert_hostname = None # urllib3 connection pool's maximum number of connections saved # per pool. urllib3 uses 1 connection as default value, but this is # not the best value when you are making a lot of possibly parallel # requests to the same host, which is often the case here. # cpu_count * 5 is used as default value to increase performance. self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 # Proxy URL self.proxy = None # Safe chars for path_param self.safe_chars_for_path_param = '' # Disable client side validation self.client_side_validation = True @classmethod def set_default(cls, default): cls._default = default @property def logger_file(self): """The logger file. If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler. :param value: The logger_file path. :type: str """ return self.__logger_file @logger_file.setter def logger_file(self, value): """The logger file. If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler. :param value: The logger_file path. :type: str """ self.__logger_file = value if self.__logger_file: # If set logging file, # then add file handler and remove stream handler. self.logger_file_handler = logging.FileHandler(self.__logger_file) self.logger_file_handler.setFormatter(self.logger_formatter) for _, logger in six.iteritems(self.logger): logger.addHandler(self.logger_file_handler) if self.logger_stream_handler: logger.removeHandler(self.logger_stream_handler) else: # If not set logging file, # then add stream handler and remove file handler. self.logger_stream_handler = logging.StreamHandler() self.logger_stream_handler.setFormatter(self.logger_formatter) for _, logger in six.iteritems(self.logger): logger.addHandler(self.logger_stream_handler) if self.logger_file_handler: logger.removeHandler(self.logger_file_handler) @property def debug(self): """Debug status :param value: The debug status, True or False. :type: bool """ return self.__debug @debug.setter def debug(self, value): """Debug status :param value: The debug status, True or False. :type: bool """ self.__debug = value if self.__debug: # if debug status is True, turn on debug logging for _, logger in six.iteritems(self.logger): logger.setLevel(logging.DEBUG) # turn on httplib debug httplib.HTTPConnection.debuglevel = 1 else: # if debug status is False, turn off debug logging, # setting log level to default `logging.WARNING` for _, logger in six.iteritems(self.logger): logger.setLevel(logging.WARNING) # turn off httplib debug httplib.HTTPConnection.debuglevel = 0 @property def logger_format(self): """The logger format. The logger_formatter will be updated when sets logger_format. :param value: The format string. :type: str """ return self.__logger_format @logger_format.setter def logger_format(self, value): """The logger format. The logger_formatter will be updated when sets logger_format. :param value: The format string. :type: str """ self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) def get_api_key_with_prefix(self, identifier): """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. :return: The token for api key authentication. """ if self.refresh_api_key_hook: self.refresh_api_key_hook(self) key = self.api_key.get(identifier) if key: prefix = self.api_key_prefix.get(identifier) if prefix: return "%s %s" % (prefix, key) else: return key def get_basic_auth_token(self): """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. """ return urllib3.util.make_headers( basic_auth=self.username + ':' + self.password ).get('authorization') def auth_settings(self): """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ return { 'api_key': { 'type': 'api_key', 'in': 'header', 'key': 'X-AUTH-TOKEN', 'value': self.get_api_key_with_prefix('X-AUTH-TOKEN') }, } def to_debug_report(self): """Gets the essential information for debugging. :return: The report for debugging. """ return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: v2\n"\ "SDK Package Version: 2.159.0".\ format(env=sys.platform, pyversion=sys.version)
{ "content_hash": "59ebfebba03f731a2660ca38255fe304", "timestamp": "", "source": "github", "line_count": 253, "max_line_length": 409, "avg_line_length": 33.66403162055336, "alnum_prop": 0.5949277914758718, "repo_name": "wavefrontHQ/python-client", "id": "fcaa17422c2441f4c4ca2bbe4c989e29d1749ad9", "size": "8534", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "wavefront_api_client/configuration.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "4642252" }, { "name": "Shell", "bytes": "3458" } ], "symlink_target": "" }
// Type definitions for human-number 1.0 // Project: https://nicedoc.io/Kikobeats/human-number // Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** * Convert number to a human readable string: 13500 → 13.5K. */ declare function humanNumber(n: number, mapper?: (n: number) => string): string; export = humanNumber;
{ "content_hash": "f21d9cdbb18c1056087e0cbc4ce4c5d4", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 80, "avg_line_length": 37.36363636363637, "alnum_prop": 0.7420924574209246, "repo_name": "georgemarshall/DefinitelyTyped", "id": "b89d59c050d8e2b66be94ebfa168c25ffcf0de8a", "size": "415", "binary": false, "copies": "26", "ref": "refs/heads/master", "path": "types/human-number/index.d.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "16338312" }, { "name": "Ruby", "bytes": "40" }, { "name": "Shell", "bytes": "73" }, { "name": "TypeScript", "bytes": "17728346" } ], "symlink_target": "" }
#pragma once #include "service_holder.h" #include "mechanism.h" namespace rrc { class service_mechanism : protected mechanism<service_holder, 3> { public: enum { CHANGE_KEY_LISTENERS_PRIORITY, CHANGE_SERVICES_PRIORITY, SERVICE_CALL_PRIORITY }; service_mechanism(abstract_launcher& launcher); void add_service(std::string key, service_callback callback, result_callback result = result_callback()); void remove_service(service_callback callback, result_callback result = result_callback()); void add_key_listener(key_callback callback, bool get_exists_keys = true, result_callback result = result_callback()); void remove_key_listener(key_callback callback, result_callback result = result_callback()); void call(const std::string& key, string input, service_result_callback listener); }; }
{ "content_hash": "c9b0980ed30cb46f3aae8cc01c5f7645", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 77, "avg_line_length": 27.390243902439025, "alnum_prop": 0.5503116651825467, "repo_name": "arssivka/rrc", "id": "201eda158fed5c99aa9b3a2f99ad4402f9b3c38b", "size": "1780", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "include/rrc/service_mechanism.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "40173" }, { "name": "Batchfile", "bytes": "2906" }, { "name": "C", "bytes": "355695" }, { "name": "C++", "bytes": "13228443" }, { "name": "CMake", "bytes": "32615" }, { "name": "M4", "bytes": "25387" }, { "name": "Makefile", "bytes": "30885" }, { "name": "Objective-C", "bytes": "3143" }, { "name": "Objective-C++", "bytes": "1176" }, { "name": "Python", "bytes": "455829" }, { "name": "Shell", "bytes": "27933" } ], "symlink_target": "" }
lightlist ========= A lightweight contactlist Installation ------------ AngularJS makes a cross-origin request, so you need a server for Chrome testing, though it should work in FireFox. Unit tests ---------- A karma config file is included for unit testing. More info at http://karma-runner.github.io/0.10/index.html
{ "content_hash": "8b4e72bd76628fd6a80c5bdac3eba7bb", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 108, "avg_line_length": 21.466666666666665, "alnum_prop": 0.7142857142857143, "repo_name": "kvintessents/lightlist", "id": "515de001003d9892b77af8192dc4e6a8f75b9c72", "size": "322", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "140255" }, { "name": "CoffeeScript", "bytes": "5232" }, { "name": "JavaScript", "bytes": "234261" } ], "symlink_target": "" }
package org.sagebionetworks.repo.model.dbo.dao; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.sagebionetworks.ids.IdGenerator; import org.sagebionetworks.ids.IdType; import org.sagebionetworks.repo.model.ActivityDAO; import org.sagebionetworks.repo.model.ConflictingUpdateException; import org.sagebionetworks.repo.model.dbo.DBOBasicDao; import org.sagebionetworks.repo.model.dbo.persistence.DBOActivity; import org.sagebionetworks.repo.model.message.ChangeType; import org.sagebionetworks.repo.model.message.TransactionalMessenger; import org.sagebionetworks.repo.model.provenance.Activity; import org.sagebionetworks.repo.web.NotFoundException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.core.namedparam.SqlParameterSource; import org.springframework.test.util.ReflectionTestUtils; /** * Tests non-database related business logic in the DAO * This is more efficient than the Autowired test * @author dburdick * */ public class DBOActivityDAOImplTest { private ActivityDAO activityDao; @Mock private TransactionalMessenger mockMessenger; @Mock private DBOBasicDao mockBasicDao; @Mock private NamedParameterJdbcTemplate mockNamedJdbcTemplate; @Mock private JdbcTemplate mockJdbcTemplate; @Mock private IdGenerator mockIdGenerator; @Before public void before() { MockitoAnnotations.initMocks(this); activityDao = new DBOActivityDAOImpl(); ReflectionTestUtils.setField(activityDao, "basicDao", mockBasicDao); ReflectionTestUtils.setField(activityDao, "transactionalMessenger", mockMessenger); ReflectionTestUtils.setField(activityDao, "namedJdbcTemplate", mockNamedJdbcTemplate); ReflectionTestUtils.setField(activityDao, "jdbcTemplate", mockJdbcTemplate); } @Test(expected=NotFoundException.class) public void testUpdateNotFound() throws Exception { when(mockIdGenerator.generateNewId(IdType.ACTIVITY_ID)).thenReturn((long)123); when(mockNamedJdbcTemplate.queryForObject(anyString(), any(SqlParameterSource.class), any(Class.class))).thenReturn((Long)0L); when(mockBasicDao.getObjectByPrimaryKey(eq(DBOActivity.class), any(MapSqlParameterSource.class))).thenThrow(new NotFoundException()); Activity act = new Activity(); act.setId(mockIdGenerator.generateNewId(IdType.ACTIVITY_ID).toString()); activityDao.update(act); } @Test(expected=NotFoundException.class) public void testGetNotFound() throws Exception { when(mockIdGenerator.generateNewId(IdType.ACTIVITY_ID)).thenReturn((long)123); when(mockNamedJdbcTemplate.queryForObject(anyString(), any(SqlParameterSource.class), any(Class.class))).thenReturn((Long)0L); when(mockBasicDao.getObjectByPrimaryKey(eq(DBOActivity.class), any(MapSqlParameterSource.class))).thenThrow(new NotFoundException()); activityDao.get(mockIdGenerator.generateNewId(IdType.ACTIVITY_ID).toString()); } @Test public void testLockActivityAndIncrementEtag() throws Exception { String oldEtag = "oldEtag"; String newEtag = "newEtag"; Long id = 123L; DBOActivity mockDbo = mock(DBOActivity.class); when(mockDbo.getId()).thenReturn(id); when(mockDbo.getEtag()).thenReturn(newEtag); when(mockIdGenerator.generateNewId(IdType.ACTIVITY_ID)).thenReturn(id); when(mockJdbcTemplate.queryForObject(anyString(), any(Class.class), any())).thenReturn(oldEtag); when(mockBasicDao.getObjectByPrimaryKey(eq(DBOActivity.class), any(MapSqlParameterSource.class))).thenReturn(mockDbo); ChangeType type = ChangeType.UPDATE; String returnedNewEtag = activityDao.lockActivityAndGenerateEtag(id.toString(), oldEtag, type); verify(mockMessenger).sendMessageAfterCommit(eq(mockDbo), eq(type)); assertEquals(newEtag, returnedNewEtag); } @Test(expected=NotFoundException.class) public void testLockActivityAndIncrementEtagNotFound() throws Exception { String oldEtag = "oldEtag"; Long id = 123L; when(mockIdGenerator.generateNewId(IdType.ACTIVITY_ID)).thenReturn(id); when(mockJdbcTemplate.queryForObject(anyString(), any(Class.class), any())).thenReturn(oldEtag); when(mockBasicDao.getObjectByPrimaryKey(eq(DBOActivity.class), any(MapSqlParameterSource.class))).thenThrow(new NotFoundException()); activityDao.lockActivityAndGenerateEtag(id.toString(), oldEtag, ChangeType.UPDATE); } @Test(expected=ConflictingUpdateException.class) public void testLockActivityAndIncrementEtagConflictingUpdate() throws Exception { when(mockIdGenerator.generateNewId(IdType.ACTIVITY_ID)).thenReturn((long)123); when(mockJdbcTemplate.queryForObject(anyString(), any(Class.class), any())).thenReturn("newEtag"); activityDao.lockActivityAndGenerateEtag("1234", "oldEtag", ChangeType.UPDATE); } }
{ "content_hash": "33257d23ad0964591db993d2c0f631c3", "timestamp": "", "source": "github", "line_count": 118, "max_line_length": 135, "avg_line_length": 43.82203389830509, "alnum_prop": 0.8091278282730613, "repo_name": "hhu94/Synapse-Repository-Services", "id": "15c369c14f91e14432e93a99389cf676f5ac6f47", "size": "5171", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "lib/jdomodels/src/test/java/org/sagebionetworks/repo/model/dbo/dao/DBOActivityDAOImplTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "92059" }, { "name": "Java", "bytes": "12751256" }, { "name": "Python", "bytes": "2379" }, { "name": "Roff", "bytes": "54" }, { "name": "SQLPL", "bytes": "2483" }, { "name": "Shell", "bytes": "31144" } ], "symlink_target": "" }
package com.ullink.slack.simpleslackapi.listeners; import com.ullink.slack.simpleslackapi.events.SlackChannelCreated; public interface SlackChannelCreatedListener extends SlackEventListener<SlackChannelCreated> { }
{ "content_hash": "3caaaecfef3fcc39606a052b93a1f96d", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 92, "avg_line_length": 31, "alnum_prop": 0.8709677419354839, "repo_name": "danilkuznetsov/microservices", "id": "f899b62c2aeeeea819c874c95e9470872ae9112d", "size": "217", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "simple-slack-api/src/main/java/com/ullink/slack/simpleslackapi/listeners/SlackChannelCreatedListener.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "HTML", "bytes": "8990" }, { "name": "Java", "bytes": "257612" }, { "name": "JavaScript", "bytes": "27709" } ], "symlink_target": "" }
import sys from jiraauth import jclient as jira ''' Usage example -- to create version 3.2.2 after 3.2.1 in all relevant projects: newversion.py EUCA,DOC,VNX,SAN,BROKER,INST 3.2.2 3.2.1 ''' projects = sys.argv[1].split(',') new_version = sys.argv[2] after_version = None if len(sys.argv) > 2: after_version = sys.argv[3] for proj in projects: prev_ver_id = None this_ver_id = None proj_ver = jira.project_versions(proj) for v in proj_ver: if after_version and v.name == after_version: prev_ver_id = v.id elif v.name == new_version: this_ver_id = v.id if not this_ver_id: # version does not exist yet; create it this_ver_id = jira.create_version(name=new_version, project=proj).id if prev_ver_id: jira.move_version(this_ver_id, after=prev_ver_id)
{ "content_hash": "c74966ee48799f3d8ddbae34e9512cd1", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 79, "avg_line_length": 28.5, "alnum_prop": 0.6729323308270677, "repo_name": "eucalyptus/jira-scripts", "id": "076b77ba4fcb84caeca2e6a1e3bb5470bea061a5", "size": "818", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "newversion.py", "mode": "33261", "license": "bsd-2-clause", "language": [ { "name": "Python", "bytes": "17417" } ], "symlink_target": "" }
Information-Retrieval-System ============================ Student project Autumn 2014 - [ETH Zurich](http://www.ethz.ch/en) The project consists of two main parts detailed respectively in this file: * Query engine * Document classifier --- #Query Engine ##Usage ```bash Usage: <root path> <use language model> <only last 10 queries> <document number> <queries>(optional) <root path> : String, path to the tipster data folder <use language model> : Boolean, true = language-based model / false = term-based model <only last 10 queries> : Boolean, true = only use the last test queries / false = use all the provided topics queries <document number> : Int, number of document in the stream to process, -1 for all <queries> : String, possibility to input custom queries such as "query1" "query2" ... "queryN" / if not defined the topics queries are used as input ``` ##Architecture ``` com.tonybeltramelli.desktop. core. perf. PerformanceAssessor.scala : wrapper used to assess precision, recall and mean average precision PrecisionRecallAssessor.scala : extends ch.ethz.dal.tinyir.lectures.PrecisionRecall, used by PerformanceAssessor to assess performance scoring. AScoring.scala : trait use to encapsulate scoring logic LanguageBasedScoring.scala : extends AScoring, use of maximum likelihood estimation and Jelinek-Mercer smoothing to score TermBasedScoring.scala : extends AScoring, use of square root linear transformation on term frequencies util. Helper.scala : contains constants value and utils functions Main.scala : entry point, algorithm flow and topic loading ``` ##Miscellaneous Optimizations : - Stemming using a cache system to increase performance and space consumption - Compute collection frequency, collection frequencies sums, term frequency and term frequencies sums for all documents first (method "feed" in AScoring.scala) and compute score for specific query on demand afterwards (overriden method "getScore" in LanguageBasedScoring.scala and TermBasedScoring.scala) - For term frequency computation, logarithmic transformation and augmented term frequency have also been experimented (see TermBasedScoring.scala) but square root linear transformation have been prefered for performance / precision reasons - For Jelinek-Mercer smoothing, a lambda value of 0.1 have been chosen according to Chengxiang Zhai and John Lafferty, A Study of Smoothing Methods for Language Models Applied to Information Retrieval. (2004) ACM Transactions on Information Systems (TOIS) Run with VM arguments : -Xss200m -Xmx2048m ##Dependencies Implemented and tested for Scala 2.11.2, JavaSE-1.7, jvm-1.6 Library TinyIR.jar : ``` ch.ethz.dal.tinyir. processing. StringDocument.scala Document.scala Tokenizer.scala XMLDocument.scala SaxParsing.scala StopWords.scala TipsterParse.scala io. ZipDirStream.scala DirStream.scala ParsedXMLStream.scala TipsterStream.scala ZipStream.scala DocStream.scala lectures. PrecisionRecall.scala TipsterGroundTruth.scala alerts. AlertsTipster.scala Alerts.scala Query.scala util. StopWatch.scala indexing. FreqIndex.scala SimpleIndex.scala InvertedIndex.scala ``` Stemmer class : ``` com.github.aztek.porterstemmer.PorterStemmer.scala ``` --- #Document Classifier Document classifiers implemented : - Naive Bayes - Logistic Regression - Support Vector Machines ##Usage ```bash Usage: <root path> <classifier> <document number> <root path> : String, path to the root folder <classifier> : Int, 1 => Naive Bayes / 2 => Logistic Regression / 3 => Support Vector Machines <document number> : Int, number of document to process, -1 for all ``` ##Classifiers Package com.tonybeltramelli.desktop.core.classifier - binary.ABinaryLinearClassifier : trait to encapsulate behavior of binary linear classifiers such as training method, vector operations and sigmoid function which are common to both Logistic Regression and Support Vector Machines. - binary.LogisticRegressionBinary : extends ABinaryLinearClassifier and override the gradient method. - binary.SupportVectorMachinesBinary : extends ABinaryLinearClassifier and override the gradient method with the Pegasos algorithm. - multiclass.AClassifier : trait to encapsulate data preprocessing (compute tf-idf, map classes to documents), interface to main class (train and apply methods), result sorting and pruning. - multiclass.AMultinomialLinearClassifier : extends AClassifier and add features to support multiclass classification for binary linear classifiers implementing ABinaryLinearClassifier. The document features are the term frequency-inverse document frequency of the most important terms of the documents. Please refer to the Optimizations section for how such important terms are selected. - LogisticRegression : extends AMultinomialLinearClassifier and pass LogisticRegressionBinary instances to its super class. - NaiveBayes : extends AClassifier because the implementation directly support multiclass classification (implementation inspired by Manning et al. "Introduction to Information Retrieval" multinomial Naive Bayes pseudocode). Naive Bayes implementation using term frequency and Laplace smoothing to improve classification. - SupportVectorMachines : extends AMultinomialLinearClassifier and pass SupportVectorMachinesBinary instances to its super class. ##Optimizations - Stemming using a cache system to increase performance and space consumption and remove stop words from document before stemming to eliminate semantically non-selective words : StopWordStemmer. - Only the n most important terms of each document are kept to minimize memory usage. That is, the terms with the highest term frequency _getTermFreq in AClassifier. - Use of 2 linked mutable Map data structure classesToDoc and documents in AClassifier for fast class to document mapping, fast tf tf-idf computation (_computeTermFreqInverseDocumentFreq) and fast document feature retrieving. Int keys are used instead of String to save space. - The binary classifiers are trained with a subset of documents in order to attenuate the effect of imbalanced classes and speeding up the running time. Method getRandomDocuments in AMultinomialLinearClassifier, the documents are chosen as follows : * All the positive documents of the classifier's class. * The n randomly selected negative documents with n = 3 x (number of positive documents for the class) 3 times was found to give good results by training the classifiers with a reasonable amount of negative documents. - The results are normalized and pruned to improve the precision and f1 score by _getNormalizedAndPrunedResults in AClassifier. - In order to improve performaces, the results are written to a file using a buffer writer in Printer class.
{ "content_hash": "548fd946d3a8d446c88bb672be08a3af", "timestamp": "", "source": "github", "line_count": 158, "max_line_length": 304, "avg_line_length": 45.84177215189873, "alnum_prop": 0.7484467761977082, "repo_name": "tonybeltramelli/Information-Retrieval-System", "id": "ca4d779717eea335653c5fa83826c9929397d4d4", "size": "7244", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "161" }, { "name": "Scala", "bytes": "29795" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_02) on Tue Apr 29 11:29:42 CEST 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>TaskState (Gradle API 1.12)</title> <meta name="date" content="2014-04-29"> <link rel="stylesheet" type="text/css" href="../../../../javadoc.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="TaskState (Gradle API 1.12)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/gradle/api/tasks/TaskOutputs.html" title="interface in org.gradle.api.tasks"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/gradle/api/tasks/TaskValidationException.html" title="class in org.gradle.api.tasks"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/gradle/api/tasks/TaskState.html" target="_top">Frames</a></li> <li><a href="TaskState.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.gradle.api.tasks</div> <h2 title="Interface TaskState" class="title">Interface TaskState</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public interface <span class="strong">TaskState</span></pre> <div class="block"><code>TaskState</code> provides information about the execution state of a <a href="../../../../org/gradle/api/Task.html" title="interface in org.gradle.api"><code>Task</code></a>. You can obtain a <code>TaskState</code> instance by calling <a href="../../../../org/gradle/api/Task.html#getState()"><code>Task.getState()</code></a>.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../../org/gradle/api/tasks/TaskState.html#getDidWork()">getDidWork</a></strong>()</code> <div class="block">Checks if the task actually did any work.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../../org/gradle/api/tasks/TaskState.html#getExecuted()">getExecuted</a></strong>()</code> <div class="block">Returns true if this task has been executed.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a></code></td> <td class="colLast"><code><strong><a href="../../../../org/gradle/api/tasks/TaskState.html#getFailure()">getFailure</a></strong>()</code> <div class="block">Returns the exception describing the task failure, if any.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> <td class="colLast"><code><strong><a href="../../../../org/gradle/api/tasks/TaskState.html#getSkipMessage()">getSkipMessage</a></strong>()</code> <div class="block">Returns a message describing why the task was skipped.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../../org/gradle/api/tasks/TaskState.html#getSkipped()">getSkipped</a></strong>()</code> <div class="block">Returns true if the execution of this task was skipped for some reason.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../org/gradle/api/tasks/TaskState.html#rethrowFailure()">rethrowFailure</a></strong>()</code> <div class="block">Throws the task failure, if any.</div> </td> </tr> </table> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getExecuted()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getExecuted</h4> <pre>boolean&nbsp;getExecuted()</pre> <div class="block"><p>Returns true if this task has been executed.</p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>true if this task has been executed.</dd></dl> </li> </ul> <a name="getFailure()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getFailure</h4> <pre><a href="../../../../org/gradle/api/Nullable.html" title="annotation in org.gradle.api">@Nullable</a> <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;getFailure()</pre> <div class="block">Returns the exception describing the task failure, if any.</div> <dl><dt><span class="strong">Returns:</span></dt><dd>The exception, or null if the task did not fail.</dd></dl> </li> </ul> <a name="rethrowFailure()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>rethrowFailure</h4> <pre>void&nbsp;rethrowFailure()</pre> <div class="block">Throws the task failure, if any. Does nothing if the task did not fail.</div> </li> </ul> <a name="getDidWork()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getDidWork</h4> <pre>boolean&nbsp;getDidWork()</pre> <div class="block"><p>Checks if the task actually did any work. Even if a task executes, it may determine that it has nothing to do. For example, the Compile task may determine that source files have not changed since the last time a the task was run.</p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>true if this task has been executed and did any work.</dd></dl> </li> </ul> <a name="getSkipped()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getSkipped</h4> <pre>boolean&nbsp;getSkipped()</pre> <div class="block">Returns true if the execution of this task was skipped for some reason.</div> <dl><dt><span class="strong">Returns:</span></dt><dd>true if this task has been executed and skipped.</dd></dl> </li> </ul> <a name="getSkipMessage()"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>getSkipMessage</h4> <pre><a href="../../../../org/gradle/api/Nullable.html" title="annotation in org.gradle.api">@Nullable</a> <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getSkipMessage()</pre> <div class="block">Returns a message describing why the task was skipped.</div> <dl><dt><span class="strong">Returns:</span></dt><dd>the message. returns null if the task was not skipped.</dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/gradle/api/tasks/TaskOutputs.html" title="interface in org.gradle.api.tasks"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/gradle/api/tasks/TaskValidationException.html" title="class in org.gradle.api.tasks"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/gradle/api/tasks/TaskState.html" target="_top">Frames</a></li> <li><a href="TaskState.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "content_hash": "44805602cfb60fea8b535464c2d3ebd6", "timestamp": "", "source": "github", "line_count": 299, "max_line_length": 216, "avg_line_length": 37.709030100334445, "alnum_prop": 0.6435476718403548, "repo_name": "Pushjet/Pushjet-Android", "id": "7d3a8f1a5028f51ad06d0eb9859e2b6e83e23330", "size": "11275", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gradle/wrapper/dists/gradle-1.12-all/4ff8jj5a73a7zgj5nnzv1ubq0/gradle-1.12/docs/javadoc/org/gradle/api/tasks/TaskState.html", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Java", "bytes": "92331" } ], "symlink_target": "" }
package com.zacharee1.modcontrol; /** * Created by Zacha on 3/1/2017. */ import android.app.Activity; import android.app.DialogFragment; import android.app.Fragment; import android.bluetooth.BluetoothA2dp; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.AssetManager; import android.content.res.ColorStateList; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.os.Looper; import android.provider.CalendarContract; import android.provider.Settings; import android.support.design.widget.BaseTransientBottomBar; import android.support.design.widget.TextInputEditText; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.SeekBar; import android.widget.Spinner; import android.widget.TextView; import com.jrummyapps.android.colorpicker.ColorPickerDialog; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Field; import static android.content.Context.MODE_PRIVATE; public class NoModsFragment extends Fragment { public View view; MainActivity activity; public boolean enabled; public boolean isV20; public SharedPreferences sharedPrefs; // public TextInputEditText RedQT; // public TextInputEditText GreenQT; // public TextInputEditText BlueQT; // public TextInputEditText RedSig; // public TextInputEditText GreenSig; // public TextInputEditText BlueSig; // public TextInputEditText RedSigAOD; // public TextInputEditText GreenSigAOD; // public TextInputEditText BlueSigAOD; // public int redIntQT_0; // public int greenIntQT_0; // public int blueIntQT_0; // public int redIntQT_1; // public int greenIntQT_1; // public int blueIntQT_1; // public int redIntQT_2; // public int greenIntQT_2; // public int blueIntQT_2; // public int redIntQT_3; // public int greenIntQT_3; // public int blueIntQT_3; // public int redIntQT_4; // public int greenIntQT_4; // public int blueIntQT_4; // public int redIntQT_5; // public int greenIntQT_5; // public int blueIntQT_5; // public int redIntSig; // public int greenIntSig; // public int blueIntSig; // public int redIntAODSig; // public int greenIntAODSig; // public int blueIntAODSig; public Spinner qtIndexSpinner; // public SeekBar redQTSeek; // public SeekBar greenQTSeek; // public SeekBar blueQTSeek; // public SeekBar redSigSeek; // public SeekBar greenSigSeek; // public SeekBar blueSigSeek; // public SeekBar redAODSigSeek; // public SeekBar greenAODSigSeek; // public SeekBar blueAODSigSeek; public ImageView QTPreviewOn; public ImageView QTPreviewOff; public ImageView SigPreview; public ImageView AODSigPreview; public Button QTPreviewOnB; public Button QTPreviewOffB; public Button SigPreviewB; public Button SigAodPreviewB; public Button NavPreviewB; public int QTColor; public int SigColor; public int AODSigColor; public int NavColor; public Button applyQT; public Button applySig; public Button applyAODSig; public Button applyNav; public int qtIndex; // public RadioGroup qtGroup1; // public RadioGroup qtGroup2; // public RadioGroup qtGroup3; // public RadioGroup sigGroup1; // public RadioGroup sigGroup2; // public RadioGroup sigGroup3; // public RadioGroup aodSigGroup1; // public RadioGroup aodSigGroup2; // public RadioGroup aodSigGroup3; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if ( getActivity() instanceof MainActivity){ activity = (MainActivity) getActivity(); } view = inflater.inflate(R.layout.fragment_nomods, container, false); try { // qtOption(); // sigOption(); // aodSigOption(); setStuffUp(); applyQT(); buttons(applySig, "redsig", "greensig", "bluesig", "Signature"); buttons(applyAODSig, "redsigaod", "greensigaod", "bluesigaod", "\"AOD Signature\""); buttons(applyNav, "rednav_0", "greennav_0", "bluenav_0", "NavBar"); colorPick((Button)view.findViewById(R.id.color_pick_qt)); colorPick((Button)view.findViewById(R.id.color_pick_qt_1)); colorPick((Button)view.findViewById(R.id.color_pick_qt_2)); colorPick((Button)view.findViewById(R.id.color_pick_sig)); colorPick((Button)view.findViewById(R.id.color_pick_sig_aod)); colorPick((Button)view.findViewById(R.id.color_pick_sig_1)); colorPick((Button)view.findViewById(R.id.color_pick_sig_aod_1)); colorPick(NavPreviewB); handleQTPage(); // sliders(redQTSeek, RedQT); // sliders(greenQTSeek, GreenQT); // sliders(blueQTSeek, BlueQT); // sliders(redSigSeek, RedSig); // sliders(greenSigSeek, GreenSig); // sliders(blueSigSeek, BlueSig); // sliders(redAODSigSeek, RedSigAOD); // sliders(greenAODSigSeek, GreenSigAOD); // sliders(blueAODSigSeek, BlueSigAOD); // textListeners(RedQT, redQTSeek); // textListeners(GreenQT, greenQTSeek); // textListeners(BlueQT, blueQTSeek); // textListeners(RedSig, redSigSeek); // textListeners(GreenSig, greenSigSeek); // textListeners(BlueSig, blueSigSeek); // textListeners(RedSigAOD, redAODSigSeek); // textListeners(GreenSigAOD, greenAODSigSeek); // textListeners(BlueSigAOD, blueAODSigSeek); } catch (Exception e) { Log.e("ModControl/E", e.getMessage()); sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); } return view; } // public void clearAll() { // try { // clearQTRad(qtGroup1); // clearQTRad(qtGroup2); // clearQTRad(qtGroup3); // } catch (Exception e) {} // } public void colorPick(final Button button) throws IOException { button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { new Thread(new Runnable() { @Override public void run() { int dialogID = -1; int color = Color.argb(255, 255, 255, 255); if (button == view.findViewById(R.id.color_pick_qt) || button == view.findViewById(R.id.color_pick_qt_1) || button == view.findViewById(R.id.color_pick_qt_2)) { switch (qtIndex) { case 0: dialogID = activity.DIALOG_ID_0; color = Color.argb(255, sharedPrefs.getInt("redqt_0", 255), sharedPrefs.getInt("greenqt_0", 255), sharedPrefs.getInt("blueqt_0", 255)); break; case 1: dialogID = activity.DIALOG_ID_1; color = Color.argb(255, sharedPrefs.getInt("redqt_1", 255), sharedPrefs.getInt("greenqt_1", 255), sharedPrefs.getInt("blueqt_1", 255)); break; case 2: dialogID = activity.DIALOG_ID_2; color = Color.argb(255, sharedPrefs.getInt("redqt_2", 255), sharedPrefs.getInt("greenqt_2", 255), sharedPrefs.getInt("blueqt_2", 255)); break; case 3: dialogID = activity.DIALOG_ID_3; color = Color.argb(255, sharedPrefs.getInt("redqt_3", 255), sharedPrefs.getInt("greenqt_3", 255), sharedPrefs.getInt("blueqt_3", 255)); break; case 4: dialogID = activity.DIALOG_ID_4; color = Color.argb(255, sharedPrefs.getInt("redqt_4", 255), sharedPrefs.getInt("greenqt_4", 255), sharedPrefs.getInt("blueqt_4", 255)); break; case 5: dialogID = activity.DIALOG_ID_5; color = Color.argb(255, sharedPrefs.getInt("redqt_5", 255), sharedPrefs.getInt("greenqt_5", 255), sharedPrefs.getInt("blueqt_5", 255)); break; } } else if (button == view.findViewById(R.id.color_pick_sig) || button == view.findViewById(R.id.color_pick_sig_1)) { dialogID = activity.DIALOG_ID_6; color = Color.argb(255, sharedPrefs.getInt("redsig", 255), sharedPrefs.getInt("greensig", 255), sharedPrefs.getInt("bluesig", 255)); } else if (button == view.findViewById(R.id.color_pick_sig_aod) || button == view.findViewById(R.id.color_pick_sig_aod_1)) { dialogID = activity.DIALOG_ID_7; color = Color.argb(255, sharedPrefs.getInt("redsigaod", 255), sharedPrefs.getInt("greensigaod", 255), sharedPrefs.getInt("bluesigaod", 255)); } else if (button == NavPreviewB) { dialogID = activity.DIALOG_ID_8; color = Color.argb(255, sharedPrefs.getInt("rednav_0", 255), sharedPrefs.getInt("greennav_0", 255), sharedPrefs.getInt("bluenav_0", 255)); } ColorPickerDialog.newBuilder() .setDialogType(ColorPickerDialog.TYPE_CUSTOM) .setAllowPresets(true) .setDialogId(dialogID) .setColor(color) .setShowAlphaSlider(false) .show(activity); } }).start(); } catch (Exception e) { Log.e("err", e.getMessage()); } } }); } @Override public void onDetach() { super.onDetach(); try { Field childFragmentManager = Fragment.class.getDeclaredField("mChildFragmentManager"); childFragmentManager.setAccessible(true); childFragmentManager.set(this, null); } catch (NoSuchFieldException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } public void handleQTPage() { qtIndexSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) { qtIndex = position; Log.i("ModControl/I: ", String.valueOf(qtIndex)); SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); editor.putInt("qtIndex", qtIndex); editor.apply(); switch (qtIndex) { case 0: // RedQT.setText(String.valueOf(sharedPrefs.getInt("redqt_0", 255) + sharedPrefs.getInt("greenqt_0", 255), sharedPrefs.getInt("blueqt_0", 255))); // GreenQT.setText(String.valueOf(greenIntQT_0)); // BlueQT.setText(String.valueOf(blueIntQT_0)); // // redQTSeek.setProgress(redIntQT_0); // greenQTSeek.setProgress(greenIntQT_0); // blueQTSeek.setProgress(blueIntQT_0); QTColor = Color.argb(255, sharedPrefs.getInt("redqt_0", 255), sharedPrefs.getInt("greenqt_0", 255), sharedPrefs.getInt("blueqt_0", 255)); break; case 1: // RedQT.setText(String.valueOf(redIntQT_1)); // GreenQT.setText(String.valueOf(greenIntQT_1)); // BlueQT.setText(String.valueOf(blueIntQT_1)); // // redQTSeek.setProgress(redIntQT_1); // greenQTSeek.setProgress(greenIntQT_1); // blueQTSeek.setProgress(blueIntQT_1); QTColor = Color.argb(255, sharedPrefs.getInt("redqt_1", 255), sharedPrefs.getInt("greenqt_1", 255), sharedPrefs.getInt("blueqt_1", 255)); break; case 2: // RedQT.setText(String.valueOf(redIntQT_2)); // GreenQT.setText(String.valueOf(greenIntQT_2)); // BlueQT.setText(String.valueOf(blueIntQT_2)); // // redQTSeek.setProgress(redIntQT_2); // greenQTSeek.setProgress(greenIntQT_2); // blueQTSeek.setProgress(blueIntQT_2); QTColor = Color.argb(255, sharedPrefs.getInt("redqt_2", 255), sharedPrefs.getInt("greenqt_2", 255), sharedPrefs.getInt("blueqt_2", 255)); break; case 3: // RedQT.setText(String.valueOf(redIntQT_3)); // GreenQT.setText(String.valueOf(greenIntQT_3)); // BlueQT.setText(String.valueOf(blueIntQT_3)); // // redQTSeek.setProgress(redIntQT_3); // greenQTSeek.setProgress(greenIntQT_3); // blueQTSeek.setProgress(blueIntQT_3); QTColor = Color.argb(255, sharedPrefs.getInt("redqt_3", 255), sharedPrefs.getInt("greenqt_3", 255), sharedPrefs.getInt("blueqt_3", 255)); break; case 4: // RedQT.setText(String.valueOf(redIntQT_4)); // GreenQT.setText(String.valueOf(greenIntQT_4)); // BlueQT.setText(String.valueOf(blueIntQT_4)); // // redQTSeek.setProgress(redIntQT_4); // greenQTSeek.setProgress(greenIntQT_4); // blueQTSeek.setProgress(blueIntQT_4); QTColor = Color.argb(255, sharedPrefs.getInt("redqt_4", 255), sharedPrefs.getInt("greenqt_4", 255), sharedPrefs.getInt("blueqt_4", 255)); break; case 5: // RedQT.setText(String.valueOf(redIntQT_5)); // GreenQT.setText(String.valueOf(greenIntQT_5)); // BlueQT.setText(String.valueOf(blueIntQT_5)); // // redQTSeek.setProgress(redIntQT_5); // greenQTSeek.setProgress(greenIntQT_5); // blueQTSeek.setProgress(blueIntQT_5); QTColor = Color.argb(255, sharedPrefs.getInt("redqt_5", 255), sharedPrefs.getInt("greenqt_5", 255), sharedPrefs.getInt("blueqt_5", 255)); break; } QTPreviewOn.setColorFilter(QTColor); QTPreviewOnB.setBackgroundTintList(ColorStateList.valueOf(QTColor)); QTPreviewOff.setColorFilter(QTColor); QTPreviewOffB.setBackgroundTintList(ColorStateList.valueOf(QTColor)); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); } public void applyQT() { applyQT.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { new Thread(new Runnable() { @Override public void run() { ContentResolver cr = activity.getContentResolver(); SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); int redQT_0 = sharedPrefs.getInt("redqt_0", 255); int greenQT_0 = sharedPrefs.getInt("greenqt_0", 255); int blueQT_0 = sharedPrefs.getInt("blueqt_0", 255); int redQT_1 = sharedPrefs.getInt("redqt_1", 255); int greenQT_1 = sharedPrefs.getInt("greenqt_1", 255); int blueQT_1 = sharedPrefs.getInt("blueqt_1", 255); int redQT_2 = sharedPrefs.getInt("redqt_2", 255); int greenQT_2 = sharedPrefs.getInt("greenqt_2", 255); int blueQT_2 = sharedPrefs.getInt("blueqt_2", 255); int redQT_3 = sharedPrefs.getInt("redqt_3", 255); int greenQT_3 = sharedPrefs.getInt("greenqt_3", 255); int blueQT_3 = sharedPrefs.getInt("blueqt_3", 255); int redQT_4 = sharedPrefs.getInt("redqt_4", 255); int greenQT_4 = sharedPrefs.getInt("greenqt_4", 255); int blueQT_4 = sharedPrefs.getInt("blueqt_4", 255); int redQT_5 = sharedPrefs.getInt("redqt_5", 255); int greenQT_5 = sharedPrefs.getInt("greenqt_5", 255); int blueQT_5 = sharedPrefs.getInt("blueqt_5", 255); switch (qtIndex) { case 0: Settings.System.putInt(cr, "redqt_0", redQT_0); Settings.System.putInt(cr, "greenqt_0", greenQT_0); Settings.System.putInt(cr, "blueqt_0", blueQT_0); // editor.putInt("redqt_0", redIntQT_0); // editor.putInt("greenqt_0", greenIntQT_0); // editor.putInt("blueqt_0", blueIntQT_0); logger("redqt_0", "greenqt_0", "blueqt_0", redQT_0, greenQT_0, blueQT_0, "QuickTools"); break; case 1: Settings.System.putInt(cr, "redqt_1", redQT_1); Settings.System.putInt(cr, "greenqt_1", greenQT_1); Settings.System.putInt(cr, "blueqt_1", blueQT_1); // editor.putInt("redqt_1", redIntQT_1); // editor.putInt("greenqt_1", greenIntQT_1); // editor.putInt("blueqt_1", blueIntQT_1); logger("redqt_1", "greenqt_1", "blueqt_1", redQT_1, greenQT_1, blueQT_1, "QuickTools"); break; case 2: Settings.System.putInt(cr, "redqt_2", redQT_2); Settings.System.putInt(cr, "greenqt_2", greenQT_2); Settings.System.putInt(cr, "blueqt_2", blueQT_2); // editor.putInt("redqt_2", redIntQT_2); // editor.putInt("greenqt_2", greenIntQT_2); // editor.putInt("blueqt_2", blueIntQT_2); logger("redqt_2", "greenqt_2", "blueqt_2", redQT_2, greenQT_2, blueQT_2, "QuickTools"); break; case 3: Settings.System.putInt(cr, "redqt_3", redQT_3); Settings.System.putInt(cr, "greenqt_3", greenQT_3); Settings.System.putInt(cr, "blueqt_3", blueQT_3); // editor.putInt("redqt_3", redIntQT_3); // editor.putInt("greenqt_3", greenIntQT_3); // editor.putInt("blueqt_3", blueIntQT_3); logger("redqt_3", "greenqt_3", "blueqt_3", redQT_3, greenQT_3, blueQT_3, "QuickTools"); break; case 4: Settings.System.putInt(cr, "redqt_4", redQT_4); Settings.System.putInt(cr, "greenqt_4", greenQT_4); Settings.System.putInt(cr, "blueqt_4", blueQT_4); // editor.putInt("redqt_4", redIntQT_4); // editor.putInt("greenqt_4", greenIntQT_4); // editor.putInt("blueqt_4", blueIntQT_4); logger("redqt_4", "greenqt_4", "blueqt_4", redQT_4, greenQT_4, blueQT_4, "QuickTools"); break; case 5: Settings.System.putInt(cr, "redqt_0", redQT_5); Settings.System.putInt(cr, "greenqt_0", greenQT_5); Settings.System.putInt(cr, "blueqt_0", blueQT_5); // editor.putInt("redqt_0", redIntQT_5); // editor.putInt("greenqt_0", greenIntQT_5); // editor.putInt("blueqt_0", blueIntQT_5); logger("redqt_0", "greenqt_0", "blueqt_0", redQT_5, greenQT_5, blueQT_5, "QuickTools"); Settings.System.putInt(cr, "redqt_1", redQT_5); Settings.System.putInt(cr, "greenqt_1", greenQT_5); Settings.System.putInt(cr, "blueqt_1", blueQT_5); // editor.putInt("redqt_1", redIntQT_5); // editor.putInt("greenqt_1", greenIntQT_5); // editor.putInt("blueqt_1", blueIntQT_5); logger("redqt_1", "greenqt_1", "blueqt_1", redQT_5, greenQT_5, blueQT_5, "QuickTools"); Settings.System.putInt(cr, "redqt_2", redQT_5); Settings.System.putInt(cr, "greenqt_2", greenQT_5); Settings.System.putInt(cr, "blueqt_2", blueQT_5); // editor.putInt("redqt_2", redIntQT_5); // editor.putInt("greenqt_2", greenIntQT_5); // editor.putInt("blueqt_2", blueIntQT_5); logger("redqt_2", "greenqt_2", "blueqt_2", redQT_5, greenQT_5, blueQT_5, "QuickTools"); Settings.System.putInt(cr, "redqt_3", redQT_5); Settings.System.putInt(cr, "greenqt_3", greenQT_5); Settings.System.putInt(cr, "blueqt_3", blueQT_5); // editor.putInt("redqt_3", redIntQT_5); // editor.putInt("greenqt_3", greenIntQT_5); // editor.putInt("blueqt_3", blueIntQT_5); logger("redqt_3", "greenqt_3", "blueqt_3", redQT_5, greenQT_5, blueQT_5, "QuickTools"); Settings.System.putInt(cr, "redqt_4", redQT_5); Settings.System.putInt(cr, "greenqt_4", greenQT_5); Settings.System.putInt(cr, "blueqt_4", blueQT_5); // editor.putInt("redqt_4", redIntQT_5); // editor.putInt("greenqt_4", greenIntQT_5); // editor.putInt("blueqt_4", blueIntQT_5); logger("redqt_4", "greenqt_4", "blueqt_4", redQT_5, greenQT_5, blueQT_5, "QuickTools"); break; } editor.apply(); sudo("killall com.lge.quicktools"); } }).start(); } }); } public void setStuffUp() { sharedPrefs = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE); if (sharedPrefs.getBoolean("enabled", true)) { enabled = true; } if (activity.isDark) { view.findViewById(R.id.qtools).setBackground(activity.getDrawable(R.drawable.layout_bg_dark)); view.findViewById(R.id.sig).setBackground(activity.getDrawable(R.drawable.layout_bg_dark)); view.findViewById(R.id.sig_aod).setBackground(activity.getDrawable(R.drawable.layout_bg_dark)); view.findViewById(R.id.navbar).setBackground(activity.getDrawable(R.drawable.layout_bg_dark)); } else { view.findViewById(R.id.qtools).setBackground(activity.getDrawable(R.drawable.layout_bg_light)); view.findViewById(R.id.sig).setBackground(activity.getDrawable(R.drawable.layout_bg_light)); view.findViewById(R.id.sig_aod).setBackground(activity.getDrawable(R.drawable.layout_bg_light)); view.findViewById(R.id.navbar).setBackground(activity.getDrawable(R.drawable.layout_bg_light)); } view.findViewById(R.id.qtools).setPadding(4, 10, 4, 10); view.findViewById(R.id.sig).setPadding(4, 10, 4, 10); view.findViewById(R.id.sig_aod).setPadding(4, 10, 4, 10); view.findViewById(R.id.navbar).setPadding(4, 10,4,10); // qtGroup1 = (RadioGroup) view.findViewById(R.id.color_tool1); // qtGroup2 = (RadioGroup) view.findViewById(R.id.color_tool2); // qtGroup3 = (RadioGroup) view.findViewById(R.id.color_tool3); // sigGroup1 = (RadioGroup) view.findViewById(R.id.color_sig1); // sigGroup2 = (RadioGroup) view.findViewById(R.id.color_sig2); // sigGroup3 = (RadioGroup) view.findViewById(R.id.color_sig3); // aodSigGroup1 = (RadioGroup) view.findViewById(R.id.color_aod_sig1); // aodSigGroup2 = (RadioGroup) view.findViewById(R.id.color_aod_sig2); // aodSigGroup3 = (RadioGroup) view.findViewById(R.id.color_aod_sig3); // RedQT = (TextInputEditText) view.findViewById(R.id.red_qt_val); // GreenQT = (TextInputEditText) view.findViewById(R.id.green_qt_val); // BlueQT = (TextInputEditText) view.findViewById(R.id.blue_qt_val); // RedSig = (TextInputEditText) view.findViewById(R.id.red_sig_val); // GreenSig = (TextInputEditText) view.findViewById(R.id.green_sig_val); // BlueSig = (TextInputEditText) view.findViewById(R.id.blue_sig_val); // RedSigAOD = (TextInputEditText) view.findViewById(R.id.red_aodsig_val); // GreenSigAOD = (TextInputEditText) view.findViewById(R.id.green_aodsig_val); // BlueSigAOD = (TextInputEditText) view.findViewById(R.id.blue_aodsig_val); qtIndexSpinner = (Spinner) view.findViewById(R.id.qt_index); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(), R.array.qt_index_options, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); qtIndexSpinner.setAdapter(adapter); // redQTSeek = (SeekBar) view.findViewById(R.id.redqt_seek); // greenQTSeek = (SeekBar) view.findViewById(R.id.greenqt_seek); // blueQTSeek = (SeekBar) view.findViewById(R.id.blueqt_seek); // redSigSeek = (SeekBar) view.findViewById(R.id.redsig_seek); // greenSigSeek = (SeekBar) view.findViewById(R.id.greensig_seek); // blueSigSeek = (SeekBar) view.findViewById(R.id.bluesig_seek); // redAODSigSeek = (SeekBar) view.findViewById(R.id.redaodsig_seek); // greenAODSigSeek = (SeekBar) view.findViewById(R.id.greenaodsig_seek); // blueAODSigSeek = (SeekBar) view.findViewById(R.id.blueaodsig_seek); QTPreviewOn = (ImageView) view.findViewById(R.id.colorqt_preview_on); QTPreviewOff = (ImageView) view.findViewById(R.id.colorqt_preview_off); SigPreview = (ImageView) view.findViewById(R.id.colorsig_preview); AODSigPreview = (ImageView) view.findViewById(R.id.coloraodsig_preview); QTPreviewOnB = (Button) view.findViewById(R.id.color_pick_qt_1); QTPreviewOffB = (Button) view.findViewById(R.id.color_pick_qt_2); SigPreviewB = (Button) view.findViewById(R.id.color_pick_sig_1); SigAodPreviewB = (Button) view.findViewById(R.id.color_pick_sig_aod_1); NavPreviewB = (Button) view.findViewById(R.id.navbar_pick_1); applyQT = (Button) view.findViewById(R.id.apply_qt_color); applySig = (Button) view.findViewById(R.id.apply_sig_color); applyAODSig = (Button) view.findViewById(R.id.apply_aod_sig_color); applyNav = (Button) view.findViewById(R.id.apply_navbar_color); // redQTSeek.setProgress(sharedPrefs.getInt("red", 255)); // greenQTSeek.setProgress(sharedPrefs.getInt("green", 255)); // blueQTSeek.setProgress(sharedPrefs.getInt("blue", 255)); // redSigSeek.setProgress(sharedPrefs.getInt("redsig", 255)); // greenSigSeek.setProgress(sharedPrefs.getInt("greensig", 255)); // blueSigSeek.setProgress(sharedPrefs.getInt("bluesig", 255)); // redAODSigSeek.setProgress(sharedPrefs.getInt("redsigaod", 255)); // greenAODSigSeek.setProgress(sharedPrefs.getInt("greensigaod", 255)); // blueAODSigSeek.setProgress(sharedPrefs.getInt("bluesigaod", 255)); // redIntQT_0 = sharedPrefs.getInt("redqt_0", 255); // greenIntQT_0 = sharedPrefs.getInt("greenqt_0", 255); // blueIntQT_0 = sharedPrefs.getInt("blueqt_0", 255); // redIntQT_1 = sharedPrefs.getInt("redqt_1", 255); // greenIntQT_1 = sharedPrefs.getInt("greenqt_1", 255); // blueIntQT_1 = sharedPrefs.getInt("blueqt_1", 255); // redIntQT_2 = sharedPrefs.getInt("redqt_2", 255); // greenIntQT_2 = sharedPrefs.getInt("greenqt_2", 255); // blueIntQT_2 = sharedPrefs.getInt("blueqt_2", 255); // redIntQT_3 = sharedPrefs.getInt("redqt_3", 255); // greenIntQT_3 = sharedPrefs.getInt("greenqt_3", 255); // blueIntQT_3 = sharedPrefs.getInt("blueqt_3", 255); // redIntQT_4 = sharedPrefs.getInt("redqt_4", 255); // greenIntQT_4 = sharedPrefs.getInt("greenqt_4", 255); // blueIntQT_4 = sharedPrefs.getInt("blueqt_4", 255); // redIntQT_5 = sharedPrefs.getInt("redqt_5", 255); // greenIntQT_5 = sharedPrefs.getInt("greenqt_5", 255); // blueIntQT_5 = sharedPrefs.getInt("blueqt_5", 255); // redIntSig = sharedPrefs.getInt("redsig", 255); // greenIntSig = sharedPrefs.getInt("greensig", 255); // blueIntSig = sharedPrefs.getInt("bluesig", 255); // redIntAODSig = sharedPrefs.getInt("redsigaod", 255); // greenIntAODSig = sharedPrefs.getInt("greensigaod", 255); // blueIntAODSig = sharedPrefs.getInt("bluesigaod", 255); qtIndex = sharedPrefs.getInt("qtIndex", 5); qtIndexSpinner.setSelection(qtIndex); switch (qtIndex) { case 0: QTColor = Color.argb(255, sharedPrefs.getInt("redqt_0", 255), sharedPrefs.getInt("greenqt_0", 255), sharedPrefs.getInt("blueqt_0", 255)); break; case 1: QTColor = Color.argb(255, sharedPrefs.getInt("redqt_1", 255), sharedPrefs.getInt("greenqt_1", 255), sharedPrefs.getInt("blueqt_1", 255)); break; case 2: QTColor = Color.argb(255, sharedPrefs.getInt("redqt_2", 255), sharedPrefs.getInt("greenqt_2", 255), sharedPrefs.getInt("blueqt_2", 255)); break; case 3: QTColor = Color.argb(255, sharedPrefs.getInt("redqt_3", 255), sharedPrefs.getInt("greenqt_3", 255), sharedPrefs.getInt("blueqt_3", 255)); break; case 4: QTColor = Color.argb(255, sharedPrefs.getInt("redqt_4", 255), sharedPrefs.getInt("greenqt_4", 255), sharedPrefs.getInt("blueqt_4", 255)); break; case 5: QTColor = Color.argb(255, sharedPrefs.getInt("redqt_5", 255), sharedPrefs.getInt("greenqt_5", 255), sharedPrefs.getInt("blueqt_5", 255)); break; } SigColor = Color.argb(255, sharedPrefs.getInt("redsig", 255), sharedPrefs.getInt("greensig", 255), sharedPrefs.getInt("bluesig", 255)); AODSigColor = Color.argb(255, sharedPrefs.getInt("redsigaod", 255), sharedPrefs.getInt("greensigaod", 255), sharedPrefs.getInt("bluesigaod", 255)); NavColor = Color.argb(255, sharedPrefs.getInt("rednav_0", 255), sharedPrefs.getInt("greennav_0", 255), sharedPrefs.getInt("bluenav_0", 255)); QTPreviewOn.setColorFilter(QTColor); QTPreviewOnB.setBackgroundTintList(ColorStateList.valueOf(QTColor)); QTPreviewOff.setColorFilter(QTColor); QTPreviewOffB.setBackgroundTintList(ColorStateList.valueOf(QTColor)); SigPreview.setColorFilter(SigColor); SigPreviewB.setBackgroundTintList(ColorStateList.valueOf(SigColor)); AODSigPreview.setColorFilter(AODSigColor); SigAodPreviewB.setBackgroundTintList(ColorStateList.valueOf(AODSigColor)); NavPreviewB.setBackgroundTintList(ColorStateList.valueOf(NavColor)); // RedQT.setText(String.valueOf(sharedPrefs.getInt("red", 255))); // GreenQT.setText(String.valueOf(sharedPrefs.getInt("green", 255))); // BlueQT.setText(String.valueOf(sharedPrefs.getInt("blue", 255))); // RedSig.setText(String.valueOf(sharedPrefs.getInt("redsig", 255))); // GreenSig.setText(String.valueOf(sharedPrefs.getInt("greensig", 255))); // BlueSig.setText(String.valueOf(sharedPrefs.getInt("bluesig", 255))); // RedSigAOD.setText(String.valueOf(sharedPrefs.getInt("redsigaod", 255))); // GreenSigAOD.setText(String.valueOf(sharedPrefs.getInt("greensigaod", 255))); // BlueSigAOD.setText(String.valueOf(sharedPrefs.getInt("bluesigaod", 255))); if (sharedPrefs.getBoolean("isv20", true)) { isV20 = true; } else { isV20 = false; view.findViewById(R.id.qtools).setVisibility(View.GONE); view.findViewById(R.id.sig).setVisibility(View.GONE); } } // public void textListeners(final TextInputEditText text, final SeekBar seekBar) throws IOException { // text.addTextChangedListener(new TextWatcher() { // @Override // public void beforeTextChanged(CharSequence s, int start, int count, int after) { // // } // // @Override // public void onTextChanged(CharSequence s, int start, int before, int count) { // // } // // @Override // public void afterTextChanged(Editable s) { // String val = text.getText().toString(); // if (val.length() > 0); { // try { // int valInt = Integer.decode(val); // if (text == RedQT) { // switch (qtIndex) { // case 0: //// redIntQT_0 = valInt; // break; // // case 1: //// redIntQT_1 = valInt; // break; // // case 2: //// redIntQT_2 = valInt; // break; // // case 3: //// redIntQT_3 = valInt; // break; // // case 4: //// redIntQT_4 = valInt; // break; // // case 5: //// redIntQT_5 = valInt; // break; // } // } else if (text == GreenQT) { // switch (qtIndex) { // case 0: //// greenIntQT_0 = valInt; // break; // // case 1: //// greenIntQT_1 = valInt; // break; // // case 2: //// greenIntQT_2 = valInt; // break; // // case 3: //// greenIntQT_3 = valInt; // break; // // case 4: //// greenIntQT_4 = valInt; // break; // // case 5: //// greenIntQT_5 = valInt; // break; // } // } else if (text == BlueQT) { // switch (qtIndex) { // case 0: //// blueIntQT_0 = valInt; // break; // // case 1: //// blueIntQT_1 = valInt; // break; // // case 2: //// blueIntQT_2 = valInt; // break; // // case 3: //// blueIntQT_3 = valInt; // break; // // case 4: //// blueIntQT_4 = valInt; // break; // // case 5: //// blueIntQT_5 = valInt; // break; // } // } else if (text == RedSig) { // redIntSig = valInt; // } else if (text == GreenSig) { // greenIntSig = valInt; // } else if (text == BlueSig) { // blueIntSig = valInt; // } else if (text == RedSigAOD) { // redIntAODSig = valInt; // } else if (text == GreenSigAOD) { // greenIntAODSig = valInt; // } else if (text == BlueSigAOD) { // blueIntAODSig = valInt; // } // // seekBar.setProgress(valInt); // // if (text.isFocused()) text.setSelection(text.getText().length()); // // switch (qtIndex) { // case 0: // QTColor = Color.argb(255, sharedPrefs.getInt("redqt_0", 255), sharedPrefs.getInt("greenqt_0", 255), sharedPrefs.getInt("blueqt_0", 255)); // break; // case 1: // QTColor = Color.argb(255, sharedPrefs.getInt("redqt_1", 255), sharedPrefs.getInt("greenqt_1", 255), sharedPrefs.getInt("blueqt_1", 255)); // break; // case 2: // QTColor = Color.argb(255, sharedPrefs.getInt("redqt_2", 255), sharedPrefs.getInt("greenqt_2", 255), sharedPrefs.getInt("blueqt_2", 255)); // break; // case 3: // QTColor = Color.argb(255, sharedPrefs.getInt("redqt_3", 255), sharedPrefs.getInt("greenqt_3", 255), sharedPrefs.getInt("blueqt_3", 255)); // break; // case 4: // QTColor = Color.argb(255, sharedPrefs.getInt("redqt_4", 255), sharedPrefs.getInt("greenqt_4", 255), sharedPrefs.getInt("blueqt_4", 255)); // break; // case 5: // QTColor = Color.argb(255, sharedPrefs.getInt("redqt_5", 255), sharedPrefs.getInt("greenqt_5", 255), sharedPrefs.getInt("blueqt_5", 255)); // break; // } // QTPreviewOn.setColorFilter(QTColor); // QTPreviewOff.setColorFilter(QTColor); // SigColor = Color.argb(255, redIntSig, greenIntSig, blueIntSig); // SigPreview.setColorFilter(SigColor); // AODSigColor = Color.argb(255, redIntAODSig, greenIntAODSig, blueIntAODSig); // AODSigPreview.setColorFilter(AODSigColor); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); // } // } // } // }); // //// RedQT.addTextChangedListener(new TextWatcher() { //// @Override //// public void beforeTextChanged(CharSequence s, int start, int count, int after) { //// //// } //// //// @Override //// public void onTextChanged(CharSequence s, int start, int before, int count) { //// } //// //// @Override //// public void afterTextChanged(Editable s) { //// if (RedQT.getText().toString().length() > 0) { //// try { //// redIntQT = Integer.decode(RedQT.getText().toString()); //// ////// Settings.System.putInt(cr, "red", redIntQT); ////// SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); ////// editor.putInt("red", redIntQT); ////// editor.apply(); //// //// redQTSeek.setProgress(redIntQT); //// //// if (RedQT.isFocused()) { //// RedQT.setSelection(RedQT.getText().length()); //// } //// //// QTColor = Color.argb(255, redIntQT, greenIntQT, blueIntQT); //// QTPreviewOn.setColorFilter(QTColor); //// QTPreviewOff.setColorFilter(QTColor); //// } catch (NumberFormatException e) { //// Log.e("ModControl/E", e.getMessage()); //// sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); //// } //// } //// } //// }); //// //// GreenQT.addTextChangedListener(new TextWatcher() { //// @Override //// public void beforeTextChanged(CharSequence s, int start, int count, int after) { //// //// } //// //// @Override //// public void onTextChanged(CharSequence s, int start, int before, int count) { //// //// } //// //// @Override //// public void afterTextChanged(Editable s) { //// if (GreenQT.getText().toString().length() > 0) { //// try { //// greenIntQT = Integer.decode(GreenQT.getText().toString()); //// ////// Settings.System.putInt(cr, "green", greenIntQT); ////// SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); ////// editor.putInt("green", greenIntQT); ////// editor.apply(); //// //// greenQTSeek.setProgress(greenIntQT); //// //// if (GreenQT.isFocused()) { //// GreenQT.setSelection(GreenQT.getText().length()); //// } //// //// QTColor = Color.argb(255, redIntQT, greenIntQT, blueIntQT); //// QTPreviewOn.setColorFilter(QTColor); //// QTPreviewOff.setColorFilter(QTColor); //// } catch (NumberFormatException e) { //// Log.e("ModControl/E", e.getMessage()); //// sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); //// } //// } //// } //// }); //// //// BlueQT.addTextChangedListener(new TextWatcher() { //// @Override //// public void beforeTextChanged(CharSequence s, int start, int count, int after) { //// //// } //// //// @Override //// public void onTextChanged(CharSequence s, int start, int before, int count) { //// //// } //// //// @Override //// public void afterTextChanged(Editable s) { //// if (BlueQT.getText().toString().length() > 0) { //// try { //// blueIntQT = Integer.decode(BlueQT.getText().toString()); //// ////// Settings.System.putInt(cr, "blue", blueIntQT); ////// SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); ////// editor.putInt("blue", blueIntQT); ////// editor.apply(); //// //// blueQTSeek.setProgress(blueIntQT); //// //// if (BlueQT.isFocused()) { //// BlueQT.setSelection(BlueQT.getText().length()); //// } //// //// QTColor = Color.argb(255, redIntQT, greenIntQT, blueIntQT); //// QTPreviewOn.setColorFilter(QTColor); //// QTPreviewOff.setColorFilter(QTColor); //// } catch (NumberFormatException e) { //// Log.e("ModControl/E", e.getMessage()); //// sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); //// } //// } //// } //// }); //// //// RedSig.addTextChangedListener(new TextWatcher() { //// @Override //// public void beforeTextChanged(CharSequence s, int start, int count, int after) { //// //// } //// //// @Override //// public void onTextChanged(CharSequence s, int start, int before, int count) { //// //// } //// //// @Override //// public void afterTextChanged(Editable s) { //// if (RedSig.getText().toString().length() > 0) { //// try { //// redIntSig = Integer.decode(RedSig.getText().toString()); ////// ////// Settings.System.putInt(cr, "redsig", redIntSig); ////// SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); ////// editor.putInt("redsig", redIntSig); ////// editor.apply(); //// //// redSigSeek.setProgress(redIntSig); //// //// if (RedSig.isFocused()) { //// RedSig.setSelection(RedSig.getText().length()); //// } //// //// SigColor = Color.argb(255, redIntSig, greenIntSig, blueIntSig); //// SigPreview.setColorFilter(SigColor); //// } catch (NumberFormatException e) { //// Log.e("ModControl/E", e.getMessage()); //// sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); //// } //// } //// } //// }); //// //// GreenSig.addTextChangedListener(new TextWatcher() { //// @Override //// public void beforeTextChanged(CharSequence s, int start, int count, int after) { //// //// } //// //// @Override //// public void onTextChanged(CharSequence s, int start, int before, int count) { //// //// } //// //// @Override //// public void afterTextChanged(Editable s) { //// if (GreenSig.getText().toString().length() > 0) { //// try { //// greenIntSig = Integer.decode(GreenSig.getText().toString()); //// ////// Settings.System.putInt(cr, "greensig", greenIntSig); ////// SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); ////// editor.putInt("greensig", greenIntSig); ////// editor.apply(); //// //// greenSigSeek.setProgress(greenIntSig); //// //// if (GreenSig.isFocused()) { //// GreenSig.setSelection(GreenSig.getText().length()); //// } //// //// SigColor = Color.argb(255, redIntSig, greenIntSig, blueIntSig); //// SigPreview.setColorFilter(SigColor); //// } catch (NumberFormatException e) { //// Log.e("ModControl/E", e.getMessage()); //// sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); //// } //// } //// } //// }); //// //// BlueSig.addTextChangedListener(new TextWatcher() { //// @Override //// public void beforeTextChanged(CharSequence s, int start, int count, int after) { //// //// } //// //// @Override //// public void onTextChanged(CharSequence s, int start, int before, int count) { //// //// } //// //// @Override //// public void afterTextChanged(Editable s) { //// if (BlueSig.getText().toString().length() > 0) { //// try { //// blueIntSig = Integer.decode(BlueSig.getText().toString()); //// ////// Settings.System.putInt(cr, "bluesig", blueIntSig); ////// SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); ////// editor.putInt("bluesig", blueIntSig); ////// editor.apply(); //// //// blueSigSeek.setProgress(blueIntSig); //// //// if (BlueSig.isFocused()) { //// BlueSig.setSelection(BlueSig.getText().length()); //// } //// //// SigColor = Color.argb(255, redIntSig, greenIntSig, blueIntSig); //// SigPreview.setColorFilter(SigColor); //// } catch (NumberFormatException e) { //// Log.e("ModControl/E", e.getMessage()); //// sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); //// } //// } //// } //// }); //// //// RedSigAOD.addTextChangedListener(new TextWatcher() { //// @Override //// public void beforeTextChanged(CharSequence s, int start, int count, int after) { //// //// } //// //// @Override //// public void onTextChanged(CharSequence s, int start, int before, int count) { //// //// } //// //// @Override //// public void afterTextChanged(Editable s) { //// if (RedSigAOD.getText().toString().length() > 0) { //// try { //// redIntAODSig = Integer.decode(RedSigAOD.getText().toString()); //// ////// Settings.System.putInt(cr, "redsigaod", redIntAODSig); ////// SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); ////// editor.putInt("redsigaod", redIntAODSig); ////// editor.apply(); //// //// redAODSigSeek.setProgress(redIntAODSig); //// //// if (RedSigAOD.isFocused()) { //// RedSigAOD.setSelection(RedSigAOD.getText().length()); //// } //// //// AODSigColor = Color.argb(255, redIntAODSig, greenIntAODSig, blueIntAODSig); //// AODSigPreview.setColorFilter(AODSigColor); //// } catch (NumberFormatException e) { //// Log.e("ModControl/E", e.getMessage()); //// sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); //// } //// } //// } //// }); //// //// GreenSigAOD.addTextChangedListener(new TextWatcher() { //// @Override //// public void beforeTextChanged(CharSequence s, int start, int count, int after) { //// //// } //// //// @Override //// public void onTextChanged(CharSequence s, int start, int before, int count) { //// //// } //// //// @Override //// public void afterTextChanged(Editable s) { //// if (GreenSigAOD.getText().toString().length() > 0) { //// try { //// greenIntAODSig = Integer.decode(GreenSigAOD.getText().toString()); //// ////// Settings.System.putInt(cr, "greensigaod", greenIntAODSig); ////// SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); ////// editor.putInt("greensigaod", greenIntAODSig); ////// editor.apply(); //// //// greenAODSigSeek.setProgress(greenIntAODSig); //// //// if (GreenSigAOD.isFocused()) { //// GreenSigAOD.setSelection(GreenSigAOD.getText().length()); //// } //// //// AODSigColor = Color.argb(255, redIntAODSig, greenIntAODSig, blueIntAODSig); //// AODSigPreview.setColorFilter(AODSigColor); //// } catch (NumberFormatException e) { //// Log.e("ModControl/E", e.getMessage()); //// sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); //// } //// } //// } //// }); //// //// BlueSigAOD.addTextChangedListener(new TextWatcher() { //// @Override //// public void beforeTextChanged(CharSequence s, int start, int count, int after) { //// //// } //// //// @Override //// public void onTextChanged(CharSequence s, int start, int before, int count) { //// //// } //// //// @Override //// public void afterTextChanged(Editable s) { //// if (BlueSigAOD.getText().toString().length() > 0) { //// try { //// blueIntAODSig = Integer.decode(BlueSigAOD.getText().toString()); //// ////// Settings.System.putInt(cr, "bluesigaod", blueIntAODSig); ////// SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); ////// editor.putInt("bluesigaod", blueIntAODSig); ////// editor.apply(); //// //// blueAODSigSeek.setProgress(blueIntAODSig); //// //// if (BlueSigAOD.isFocused()) { //// BlueSigAOD.setSelection(BlueSigAOD.getText().length()); //// } //// //// AODSigColor = Color.argb(255, redIntAODSig, greenIntAODSig, blueIntAODSig); //// AODSigPreview.setColorFilter(AODSigColor); //// } catch (NumberFormatException e) { //// Log.e("ModControl/E", e.getMessage()); //// sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); //// } //// } //// } //// }); // } // public void sliders(SeekBar seekBar, final TextInputEditText inputEditText) throws IOException { // // seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { // @Override // public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // inputEditText.setText(String.valueOf(progress)); // } // // @Override // public void onStartTrackingTouch(SeekBar seekBar) { // // } // // @Override // public void onStopTrackingTouch(SeekBar seekBar) { // // } // }); // //// redQTSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //// @Override //// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //// RedQT.setText(String.valueOf(progress)); //// } //// //// @Override //// public void onStartTrackingTouch(SeekBar seekBar) { //// //// } //// //// @Override //// public void onStopTrackingTouch(SeekBar seekBar) { //// //// } //// }); //// //// greenQTSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //// @Override //// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //// GreenQT.setText(String.valueOf(progress)); //// } //// //// @Override //// public void onStartTrackingTouch(SeekBar seekBar) { //// //// } //// //// @Override //// public void onStopTrackingTouch(SeekBar seekBar) { //// //// } //// }); //// //// blueQTSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //// @Override //// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //// BlueQT.setText(String.valueOf(progress)); //// } //// //// @Override //// public void onStartTrackingTouch(SeekBar seekBar) { //// //// } //// //// @Override //// public void onStopTrackingTouch(SeekBar seekBar) { //// //// } //// }); //// //// redSigSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //// @Override //// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //// RedSig.setText(String.valueOf(progress)); //// } //// //// @Override //// public void onStartTrackingTouch(SeekBar seekBar) { //// //// } //// //// @Override //// public void onStopTrackingTouch(SeekBar seekBar) { //// //// } //// }); //// //// greenSigSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //// @Override //// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //// GreenSig.setText(String.valueOf(progress)); //// } //// //// @Override //// public void onStartTrackingTouch(SeekBar seekBar) { //// //// } //// //// @Override //// public void onStopTrackingTouch(SeekBar seekBar) { //// //// } //// }); //// //// blueSigSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //// @Override //// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //// BlueSig.setText(String.valueOf(progress)); //// } //// //// @Override //// public void onStartTrackingTouch(SeekBar seekBar) { //// //// } //// //// @Override //// public void onStopTrackingTouch(SeekBar seekBar) { //// //// } //// }); //// //// redAODSigSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //// @Override //// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //// RedSigAOD.setText(String.valueOf(progress)); //// } //// //// @Override //// public void onStartTrackingTouch(SeekBar seekBar) { //// //// } //// //// @Override //// public void onStopTrackingTouch(SeekBar seekBar) { //// //// } //// }); //// //// greenAODSigSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //// @Override //// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //// GreenSigAOD.setText(String.valueOf(progress)); //// } //// //// @Override //// public void onStartTrackingTouch(SeekBar seekBar) { //// //// } //// //// @Override //// public void onStopTrackingTouch(SeekBar seekBar) { //// //// } //// }); //// //// blueAODSigSeek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //// @Override //// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //// BlueSigAOD.setText(String.valueOf(progress)); //// } //// //// @Override //// public void onStartTrackingTouch(SeekBar seekBar) { //// //// } //// //// @Override //// public void onStopTrackingTouch(SeekBar seekBar) { //// //// } //// }); // } public void buttons(final Button button, final String prefR, final String prefG, final String prefB, final String name) throws IOException { button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Runnable runnable = new Runnable() { @Override public void run() { int red = sharedPrefs.getInt(prefR, 255); int green = sharedPrefs.getInt(prefG, 255); int blue = sharedPrefs.getInt(prefB, 255); ContentResolver cr = activity.getContentResolver(); Settings.System.putInt(cr, prefR, red); Settings.System.putInt(cr, prefG, green); Settings.System.putInt(cr, prefB, blue); SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); editor.putInt(prefR, red); editor.putInt(prefG, green); editor.putInt(prefB, blue); editor.apply(); logger(prefR, prefG, prefB, red, green, blue, name); if (button == applySig || button == applyAODSig) { sudo("killall com.lge.signboard"); } else if (button == applyNav) { sudo("killall com.android.systemui"); } else { sudo("killall com.lge.quicktools ; killall com.lge.signboard"); } } }; new Thread(runnable).start(); // new Thread(new Runnable() { // @Override // public void run() { // int red = 255; // int green = 255; // int blue = 255; // if (button == applyQT) { // red = redIntQT; // green = greenIntQT; // blue = blueIntQT; // } else if (button == applySig) { // red = redIntSig; // green = greenIntSig; // blue = blueIntSig; // } else if (button == applyAODSig) { // red = redIntAODSig; // green = greenIntAODSig; // blue = blueIntAODSig; // } // // ContentResolver cr = activity.getContentResolver(); // // Settings.System.putInt(cr, prefR, red); // Settings.System.putInt(cr, prefG, green); // Settings.System.putInt(cr, prefB, blue); // // SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); // editor.putInt(prefR, red); // editor.putInt(prefG, green); // editor.putInt(prefB, blue); // editor.apply(); // // logger(prefR, prefG, prefB, red, green, blue, name); // // try { // if (button == applyQT) { // sudo("killall com.lge.quicktools"); // } else if (button == applySig) { // sudo("killall com.lge.signboard"); ////// Intent intent = new Intent("com.lge.signboard.intent.action.SET_WIDGET_SIGNATURE"); ////// String flag = "flag_set_widget_signature"; ////// ////// intent = intent.putExtra(flag, true); ////// ////// activity.startActivity(intent); //// //// String test = "content://com.lge.provider.signboard/signature?notify=true"; //// //// Uri uri = Uri.parse(test); //// //// ContentValues cv = new ContentValues(); //// //// String value = "value"; //// //// cv.put(value, "TEST"); //// //// String item = "item"; //// String[] on = {"screen_on_sharing"}; //// //// cr.update(uri, cv, item, null); //// // } else if (button == applyAODSig) { // sudo("killall com.lge.signboard"); // } else { // sudo("killall com.lge.quicktools ; killall com.lge.signboard"); // } // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // }).start(); } }); // applyQT.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // new Thread(new Runnable() { // public void run() { // ContentResolver cr = activity.getContentResolver(); // // Settings.System.putInt(cr, "red", redIntQT); // Settings.System.putInt(cr, "green", greenIntQT); // Settings.System.putInt(cr, "blue", blueIntQT); // // SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); // editor.putInt("red", redIntQT); // editor.putInt("green", greenIntQT); // editor.putInt("blue", blueIntQT); // editor.apply(); // // try { // sudo("killall com.lge.signboard"); // sudo("killall com.lge.appwidget.signature"); // sudo("killall com.lge.quicktools"); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); // } // } // }).start(); // } // }); // // applySig.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new Thread(new Runnable () { // public void run() { // ContentResolver cr = activity.getContentResolver(); // // Settings.System.putInt(cr, "redsig", redIntSig); // Settings.System.putInt(cr, "greensig", greenIntSig); // Settings.System.putInt(cr, "bluesig", blueIntSig); // // SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); // editor.putInt("redsig", redIntSig); // editor.putInt("greensig", greenIntSig); // editor.putInt("bluesig", blueIntSig); // editor.apply(); // // try { // sudo("killall com.lge.signboard"); // sudo("killall com.lge.appwidget.signature"); // sudo("killall com.lge.quicktools"); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); // } // } // }).start(); // } // }); // // applyAODSig.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // new Thread(new Runnable () { // public void run() { // ContentResolver cr = activity.getContentResolver(); // // Settings.System.putInt(cr, "redsigaod", redIntAODSig); // Settings.System.putInt(cr, "greensigaod", greenIntAODSig); // Settings.System.putInt(cr, "bluesigaod", blueIntAODSig); // // SharedPreferences.Editor editor = activity.getSharedPreferences("com.zacharee1.modcontrol", MODE_PRIVATE).edit(); // editor.putInt("redsigaod", redIntAODSig); // editor.putInt("greensigaod", greenIntAODSig); // editor.putInt("bluesigaod", blueIntAODSig); // editor.apply(); // // try { // sudo("killall com.lge.signboard"); // sudo("killall com.lge.appwidget.signature"); // sudo("killall com.lge.quicktools"); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // sudo("echo \"ModControl/E" + e.getMessage() + "\" >> " + Environment.getExternalStorageDirectory() + "/Zacharee1Mods/output.log"); // } // } // }).start(); // } // }); } // public void qtOption() throws IOException { // qtGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // try { // clearQTRad(qtGroup2); // clearQTRad(qtGroup3); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // final String installqt = "installqt"; // if (checkedId == R.id.red_tool) { // if (enabled) { // Settings.System.putInt(activity.getContentResolver(), "red", 0xff); // Settings.System.putInt(activity.getContentResolver(), "green", 0x0); // Settings.System.putInt(activity.getContentResolver(), "blue", 0x0); // final String file = "qtred.zip"; // try { // copyZip(file); // copyFile2(installqt, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // else if (checkedId == R.id.white_tool) { // if (enabled) { // final String file = "qtwhite.zip"; // try { // copyZip(file); // copyFile2(installqt, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // else if (checkedId == R.id.green_tool) { // if (enabled) { // // Settings.System.putInt(activity.getContentResolver(), "red", 0x0); // Settings.System.putInt(activity.getContentResolver(), "green", 0xff); // Settings.System.putInt(activity.getContentResolver(), "blue", 0x0); // final String file = "qtgreen.zip"; // try { // copyZip(file); // copyFile2(installqt, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // if (!enabled) { // try { // clearQTRad(group); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // } // }); // qtGroup2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // try { // clearQTRad(qtGroup1); // clearQTRad(qtGroup3); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // final String installqt = "installqt"; // if (checkedId == R.id.purple_tool) { // if (enabled) { // final String file = "qtpurple.zip"; // try { // copyZip(file); // copyFile2(installqt, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.multi_tool) { // if (enabled) { // final String file = "qtmulti.zip"; // try { // copyZip(file); // copyFile2(installqt, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.blue_tool) { // if (enabled) { // final String file = "qtblue.zip"; // try { // copyZip(file); // copyFile2(installqt, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // if (!enabled) { // try { // clearQTRad(group); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // } // }); // // qtGroup3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // try { // clearQTRad(qtGroup1); // clearQTRad(qtGroup2); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // final String installqt = "installqt"; // if (checkedId == R.id.orange_tool) { // if (enabled) { // final String file = "qtorange.zip"; // try { // copyZip(file); // copyFile2(installqt, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.yellow_tool) { // if (enabled) { // final String file = "qtyellow.zip"; // try { // copyZip(file); // copyFile2(installqt, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // if (!enabled) { // try { // clearQTRad(group); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // } // }); // } // public void sigOption() throws IOException { // sigGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // try { // clearSigRad(sigGroup2); // clearSigRad(sigGroup3); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // final String installsig = "installsig"; // if (checkedId == R.id.red_sig) { // if (enabled) { // final String file = "sigred.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.white_sig) { // if (enabled) { // final String file = "sigwhite.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.green_sig) { // if (enabled) { // final String file = "siggreen.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // if (!enabled) { // try { // clearSigRad(group); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // } // }); // // sigGroup2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // try { // clearSigRad(sigGroup1); // clearSigRad(sigGroup3); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // final String installsig = "installsig"; // if (checkedId == R.id.purple_sig) { // if (enabled) { // final String file = "sigpurple.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.orange_sig) { // if (enabled) { // final String file = "sigorange.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.blue_sig) { // if (enabled) { // final String file = "sigblue.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // if (!enabled) { // try { // clearSigRad(group); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // } // }); // // sigGroup3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // try { // clearSigRad(sigGroup2); // clearSigRad(sigGroup1); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // final String installsig = "installsig"; // if (checkedId == R.id.yellow_sig) { // if (enabled) { // final String file = "sigyellow.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // if (!enabled) { // try { // clearSigRad(group); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // } // }); // } // public void aodSigOption() throws IOException { // aodSigGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // try { // clearAODSigRad(aodSigGroup2); // clearAODSigRad(aodSigGroup3); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // final String installsig = "installsigaod"; // if (checkedId == R.id.red_aod_sig) { // if (enabled) { // final String file = "aodsigred.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.white_aod_sig) { // if (enabled) { // final String file = "aodsigwhite.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.green_aod_sig) { // if (enabled) { // final String file = "aodsiggreen.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // if (!enabled) { // try { // clearAODSigRad(group); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // } // }); // // aodSigGroup2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // try { // clearAODSigRad(aodSigGroup1); // clearAODSigRad(aodSigGroup3); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // final String installsig = "installsigaod"; // if (checkedId == R.id.purple_aod_sig) { // if (enabled) { // final String file = "aodsigpurple.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.orange_aod_sig) { // if (enabled) { // final String file = "aodsigorange.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } else if (checkedId == R.id.blue_aod_sig) { // if (enabled) { // final String file = "aodsigblue.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // if (!enabled) { // try { // clearAODSigRad(group); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // } // }); // // aodSigGroup3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { // @Override // public void onCheckedChanged(RadioGroup group, int checkedId) { // try { // clearAODSigRad(aodSigGroup2); // clearAODSigRad(aodSigGroup1); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // final String installsig = "installsigaod"; // if (checkedId == R.id.purple_aod_sig) { // if (enabled) { // final String file = "aodsigyellow.zip"; // try { // copyZip(file); // copyFile2(installsig, file); // } catch (Exception e) { // Toast.makeText(activity.getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); // Log.e("ModControl/E", e.getMessage()); // } // } // } // if (!enabled) { // try { // clearAODSigRad(group); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // } // }); // } // public void clearQTRad(RadioGroup group) throws IOException { // group.setOnCheckedChangeListener(null); // group.clearCheck(); // qtOption(); // } // public void clearSigRad(RadioGroup group) throws IOException { // group.setOnCheckedChangeListener(null); // group.clearCheck(); // sigOption(); // } // public void clearAODSigRad(RadioGroup group) throws IOException { // group.setOnCheckedChangeListener(null); // group.clearCheck(); // aodSigOption(); // } // public void copyZip(String targetFile) throws IOException { // String targetDirectory = Environment.getExternalStorageDirectory().toString() + "/Zacharee1Mods/"; // AssetManager assetManager = activity.getAssets1(); // File modFolder = new File(targetDirectory); // // if (!modFolder.isDirectory()) { // boolean result = modFolder.mkdir(); // if (!result) { // throw new IOException("Could not create nonexistent mod folder. Abort."); // } // } // try ( // InputStream in = assetManager.open(targetFile); // OutputStream out = new FileOutputStream(targetDirectory + targetFile) // ) { // copyFile(in, out); // } // try ( // InputStream in = assetManager.open("zip"); // OutputStream out = new FileOutputStream(targetDirectory + "zip") // ) { // copyFile(in, out); // } // } // public void copyFile2(final String targetFile, final String zipFile) throws IOException { // final String targetDirectory = Environment.getExternalStorageDirectory().toString() + "/Zacharee1Mods/"; // final AssetManager assetManager = activity.getAssets1(); // File modFolder = new File(targetDirectory); // // if (!modFolder.isDirectory()) { // boolean result = modFolder.mkdir(); // if (!result) { // throw new IOException("Could not create nonexistent mod folder. Abort."); // } // } // new Thread(new Runnable() { // public void run() { // try ( // InputStream in = assetManager.open(targetFile); // OutputStream out = new FileOutputStream(targetDirectory + targetFile) // ) { // copyFile(in, out); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // try ( // InputStream in = assetManager.open("zip"); // OutputStream out = new FileOutputStream(targetDirectory + "zip") // ) { // copyFile(in, out); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // }).start(); // // if (!targetFile.contains("restore")) { // new Thread(new Runnable() { // public void run() { // try { // runScript(targetDirectory, targetFile, zipFile); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // }).start(); // } // } // public void copyFile(InputStream in, OutputStream out) throws IOException { // byte[] buffer = new byte[10240]; // int read; // while((read = in.read(buffer)) != -1){ // out.write(buffer, 0, read); // } // } // public void runScript(final String targetDirectory, final String targetFile, final String zip) throws IOException{ // new Thread(new Runnable() { // public void run() { // try { // sudo("chmod +x /data/media/0/Zacharee1Mods/" + targetFile); // sudo("chmod 777 /data/media/0/Zacharee1Mods/" + targetFile); // sudo("sh /data/media/0/Zacharee1Mods/" + targetFile + " " + zip); // } catch (Exception e) { // Log.e("ModControl/E", e.getMessage()); // } // } // }).start(); // } public void logger(final String prefR, final String prefG, final String prefB, final int red, final int green, final int blue, final String name) { try { copyFile2("logcolor"); sudo("busybox sh /data/media/0/Zacharee1Mods/logcolor " + prefR + " " + prefG + " " + prefB + " " + red + " " + green + " " + blue + " " + name + " >> /data/media/0/Zacharee1Mods/output.log 2>&1"); } catch (Exception e) { Log.e("ModControl/E", e.getMessage()); } } public void copyFile2(final String targetFile) throws IOException { final String targetDirectory = Environment.getExternalStorageDirectory().toString() + "/Zacharee1Mods/"; final AssetManager assetManager = activity.getAssets(); File modFolder = new File(targetDirectory); if (!modFolder.isDirectory()) { boolean result = modFolder.mkdir(); if (!result) { throw new IOException("Could not create nonexistent mod folder. Abort."); } } try ( InputStream in = assetManager.open(targetFile); OutputStream out = new FileOutputStream(targetDirectory + targetFile) ) { copyFile(in, out); } catch (Exception e) { Log.e("ModControl/E", e.getMessage()); } } public void copyFile(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[10240]; int read; while((read = in.read(buffer)) != -1){ out.write(buffer, 0, read); } } public void sudo(String...strings) { try{ Process su = Runtime.getRuntime().exec("su"); DataOutputStream outputStream = new DataOutputStream(su.getOutputStream()); for (String s : strings) { outputStream.writeBytes(s+"\n"); outputStream.flush(); } outputStream.writeBytes("exit\n"); outputStream.flush(); try { su.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } outputStream.close(); } catch(IOException e){ e.printStackTrace(); } } }
{ "content_hash": "2b8dc818ec6e549e3df4ab8ec12ac286", "timestamp": "", "source": "github", "line_count": 2173, "max_line_length": 209, "avg_line_length": 47.015646571560055, "alnum_prop": 0.46659815005138744, "repo_name": "zacharee/ModControl", "id": "93e5c75a9e3761f02e7c83c69419934ff74d3acb", "size": "102165", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/zacharee1/modcontrol/NoModsFragment.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "183984" }, { "name": "Shell", "bytes": "1938" } ], "symlink_target": "" }
@class BlockValueTransformer; @interface TransformerAgent : NSObject @property (nonatomic, copy, readonly) NSString *name; @property (nonatomic, copy, readonly) BlockValueTransformer *transformer; - (instancetype)initWithName:(NSString *) name transformer:(BlockValueTransformer *) transformer; + (instancetype)agentWithName:(NSString *) name transformer:(BlockValueTransformer *) transformer; @end
{ "content_hash": "15f30677a6b07ab64cde375e1e4d784d", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 98, "avg_line_length": 33.583333333333336, "alnum_prop": 0.8014888337468983, "repo_name": "azu/BlockValueTransformer", "id": "86eae28a78f7429cddd04d2590972f523ae6d0e3", "size": "513", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Example/TransformerAgent.h", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "7577" }, { "name": "Ruby", "bytes": "524" } ], "symlink_target": "" }
<?php class La_Controller_Action_Helper_Delete extends Zend_Controller_Action_Helper_Abstract { /** * * @param La_Db_Table $table */ public function direct(La_Db_Table $table = null, $redirectUrl = null) { $controller = $this->getActionController(); $data = $this->getRequest()->getParams(); $table = $table ?: $controller->table; $url = sprintf('%s/%s/index/parent_id/%s/table/%s', $data['module'], $data['controller'], $data['parent_id'], $table->getName()); if (!$table) { $table = $controller->table; } if ($redirectUrl) { $url = $redirectUrl; } $id = $data['id']; if ($id) { $ids = (array) $id; try{ foreach ($ids as $id) { $where = array('id = ?' => Zend_Filter::filterStatic($id, 'int')); $table->logicDelete($where); } $controller->getHelper('flashMessenger')->addMessage([ 'type' => 'success', 'msg' => 'Registro(s) deletado(s) com sucesso.' ]); $controller->redirect($url); } catch (Exception $e) { $controller->getHelper('flashMessenger')->addMessage([ 'type' => 'error', 'msg' => 'O registro não foi excluído.' . ' Verifique os dados e tente novamente.' ]); $controller->redirect($url); } } $controller->getHelper('flashMessenger')->addMessage([ 'type' => 'error', 'msg' => 'O registro não foi excluído.' . ' Verifique os dados e tente novamente.' ]); $controller->redirect($url); } }
{ "content_hash": "0e59b3c5b0fab481b2e6830ad38b19cb", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 88, "avg_line_length": 35.7, "alnum_prop": 0.3968253968253968, "repo_name": "Alustau/la", "id": "2408163c28bbc9a94c69c0ddb60eeeb2c6027c22", "size": "2146", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/La/Controller/Action/Helper/Delete.php", "mode": "33261", "license": "mit", "language": [ { "name": "PHP", "bytes": "162683" } ], "symlink_target": "" }
package main import ( "encoding/json" "fmt" "gopkg.in/mgo.v2/bson" ) type CacheUpdater interface { Update(*DB) *json.RawMessage } type UsersCacheUpdater int func (c UsersCacheUpdater) Update(db *DB) *json.RawMessage { users, err := db.Users() if err != nil { fmt.Println(err) return nil } ret, err := json.Marshal(users) if err != nil { fmt.Println(err) return nil } j := new(json.RawMessage) j.UnmarshalJSON(ret) return j } type RecentCacheUpdater int type recentItem struct { UserID bson.ObjectId `json:"user_id"` RouteIDs []bson.ObjectId `json:"route_ids"` } func (c RecentCacheUpdater) Update(db *DB) *json.RawMessage { users, err := db.RecentlyUpdatedUsers(12) if err != nil { return nil } items := make([]recentItem, len(users)) for index, user := range users { logs, err := db.ClimbingLogs(user.ID) if err != nil { continue } routeIDs := make([]bson.ObjectId, 0) for _, log := range logs { if !log.Pending { routeIDs = append(routeIDs, log.Route) } } items[index] = recentItem{UserID: user.ID, RouteIDs: routeIDs} } ret, err := json.Marshal(items) if err != nil { fmt.Println(err) return nil } j := new(json.RawMessage) j.UnmarshalJSON(ret) return j } type RoutesCacheUpdater int func (c RoutesCacheUpdater) Update(db *DB) *json.RawMessage { routes, err := db.Routes() if err != nil { fmt.Println(err) return nil } ret, err := json.Marshal(routes) if err != nil { fmt.Println(err) return nil } j := new(json.RawMessage) j.UnmarshalJSON(ret) return j }
{ "content_hash": "4d4d6abfd77990822cbebc04857134e7", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 64, "avg_line_length": 18.547619047619047, "alnum_prop": 0.6643132220795892, "repo_name": "songgao/HalfDomeChallenge", "id": "1643b3522709453c68eb12f2018c6d4dc34eb79a", "size": "1558", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cacheUpdaters.go", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "6330" }, { "name": "Go", "bytes": "33000" }, { "name": "HTML", "bytes": "768" }, { "name": "JavaScript", "bytes": "91926" }, { "name": "Makefile", "bytes": "538" } ], "symlink_target": "" }
<?php declare(strict_types=1); namespace Asm\Data; use Asm\Exception\InvalidParameterException; use Asm\Exception\InvalidParameterSetException; /** * DataTrait for easier inclusion in other objects without direct inheritance * * @package Asm\Data * @author Marc Aschmann <maschmann@gmail.com> */ trait DataTrait { /** * Internal data storage. * * @var array */ private $data = []; /** * Clears the data(!) content of the object. * * @return $this */ public function clear() { $this->data = []; return $this; } /** * Generic set method for multidimensional storage. * * $this->set( $key1, $key2, $key3, ..., $val ) * * @throws InvalidParameterSetException * @return $this */ public function set() { $args = func_get_args(); $replace = null; if (1 < count($args)) { // get last array element == value to set! $val = array_pop($args); // iterate arguments reversed to build replacement array foreach (array_reverse($args) as $key) { if (null === $replace) { $replace = [$key => $val]; } else { $replace = [$key => $replace]; } } // add our data to storage $this->data = array_replace_recursive($this->data, $replace); } else { throw new InvalidParameterSetException( "Data::set() - You just provided one param and need at least another param." ); } return $this; } /** * Set list of key/value pairs via one dimensional array. * Careful: An empty array will just overwrite your internal storage. * * @param array $param * @return $this */ public function setByArray(array $param) { if (!empty($param)) { // reset array to explicitly start at beginning reset($param); foreach ($param as $key => $value) { $this->set($key, $value); } } else { // will overwrite content with an empty array $this->data = $param; } return $this; } /** * Adds given object's properties to self. * * @param object $param * @return $this * @throws InvalidParameterException */ public function setByObject($param) { // check for DataContainer instances - because otherwise you can't easily access virtual properties if (is_object($param)) { if (is_a($param, DataInterface::class, true)) { foreach ($param->toArray() as $key => $value) { $this->set($key, $value); } } else { // handle as "normal" object foreach ($param as $property => $value) { $this->set($property, $value); } } } else { throw new InvalidParameterException( "Data::setByObject() - param is a {gettype($param)},no object!" ); } return $this; } /** * Fill datastore from json string. * * @param string $json * @return $this */ public function setByJson(string $json) { $this->setByArray( json_decode($json, true) ); return $this; } /** * Return stored data array. * * @return array */ public function toArray() : array { return $this->data; } /** * Convert internal data to json. * * @return string */ public function toJson() : string { return json_encode($this->data); } /** * Multidimensional getter. * * Find a key structure in a multidimensional array and return the value * params are stackable -> get( $k1, $k2, $k3, ... ). * * @return bool|mixed */ public function get() { return self::searchArray( func_get_args(), $this->data ); } /** * Return all keys of internal array's first level. * * @return array keylist */ public function getKeys() : array { return array_keys($this->data); } /** * Remove key from container. * * @param string $key * @return $this */ public function remove(string $key) { if (array_key_exists($key, $this->data)) { unset($this->data[$key]); } return $this; } /** * Return count of all firstlevel elements. * * @return int */ public function count() : int { return count($this->data); } /** * Find a key in an array. * example self::findInArray(array(), key1, key2, key3, ..., default_return) * * @return array|bool|mixed */ public static function findInArray() { $args = func_get_args(); $data = array_shift($args); return self::searchArray( $args, $data ); } /** * Search an array for keys (args) and provide a default value if * last arg is some kind of empty or not numeric. * * @param array $args * @param array $data * @param bool $default * @return array|mixed */ private static function searchArray(array $args, array $data, $default = false) { // check for default return value if (1 < count($args)) { $lastElm = array_pop($args); if (empty($lastElm) && !is_numeric($lastElm)) { $default = $lastElm; } else { // push the last element back into array array_push($args, $lastElm); } } foreach ($args as $key) { if ((is_array($data)) && (array_key_exists($key, $data))) { $data = $data[$key]; } else { $data = $default; break; } } return $data; } }
{ "content_hash": "219555ca16d4dffb1ccde1f8a33beabb", "timestamp": "", "source": "github", "line_count": 262, "max_line_length": 107, "avg_line_length": 23.637404580152673, "alnum_prop": 0.49297594057807204, "repo_name": "maschmann/php-utilities", "id": "c7b69ee4ecc2e1aae62eddb6aef7e0b0cfe7df32", "size": "6426", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/Data/DataTrait.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "73841" } ], "symlink_target": "" }
namespace swift { namespace reflection { template <typename Runtime> struct ConformanceNode { typename Runtime::StoredPointer Left, Right; typename Runtime::StoredPointer Type; typename Runtime::StoredPointer Proto; typename Runtime::StoredPointer Description; typename Runtime::StoredSize FailureGeneration; }; template <typename Runtime> struct MetadataAllocation { uint16_t Tag; typename Runtime::StoredPointer Ptr; unsigned Size; }; template <typename Runtime> struct MetadataCacheNode { typename Runtime::StoredPointer Left; typename Runtime::StoredPointer Right; }; } // end namespace reflection } // end namespace swift #endif // SWIFT_REFLECTION_RUNTIME_INTERNALS_H
{ "content_hash": "260ae9618b84a454fc21609d48412270", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 54, "avg_line_length": 24.137931034482758, "alnum_prop": 0.7814285714285715, "repo_name": "allevato/swift", "id": "11b6027242aafc9bd6eee85c197b05d5bd7f91c2", "size": "1639", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "include/swift/Reflection/RuntimeInternals.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "13584" }, { "name": "C", "bytes": "272029" }, { "name": "C++", "bytes": "38686827" }, { "name": "CMake", "bytes": "556052" }, { "name": "D", "bytes": "1107" }, { "name": "DTrace", "bytes": "2593" }, { "name": "Emacs Lisp", "bytes": "57338" }, { "name": "LLVM", "bytes": "70652" }, { "name": "MATLAB", "bytes": "2576" }, { "name": "Makefile", "bytes": "1841" }, { "name": "Objective-C", "bytes": "427480" }, { "name": "Objective-C++", "bytes": "243545" }, { "name": "Python", "bytes": "1788396" }, { "name": "Roff", "bytes": "3495" }, { "name": "Ruby", "bytes": "2117" }, { "name": "Shell", "bytes": "179656" }, { "name": "Swift", "bytes": "33700469" }, { "name": "Vim Script", "bytes": "19900" }, { "name": "sed", "bytes": "1050" } ], "symlink_target": "" }
layout: page title: Omega Software Trade Fair date: 2016-05-24 author: Jonathan Warner tags: weekly links, java status: published summary: Pellentesque bibendum odio magna, quis faucibus quam elementum a. banner: images/banner/leisure-03.jpg booking: startDate: 11/19/2019 endDate: 11/21/2019 ctyhocn: ROGERHX groupCode: OSTF published: true --- Etiam vel nisi molestie, ultricies massa eu, malesuada ipsum. Integer id ornare nunc, sit amet luctus massa. Sed augue elit, porttitor id nulla vel, pulvinar consectetur nunc. Quisque iaculis pellentesque neque. Quisque eget scelerisque felis. Duis id interdum sem, eget maximus tortor. Duis mollis non lectus ac vestibulum. * Nam vitae tortor iaculis, consectetur felis quis, eleifend metus * Curabitur bibendum massa ut posuere tempor * Mauris tincidunt neque vitae leo ornare, non vestibulum risus luctus * Cras sodales lorem at urna luctus egestas * Praesent maximus dolor id magna lobortis, a dignissim nisl elementum * Integer tempus neque a sem volutpat scelerisque. Vivamus cursus varius lorem, vel auctor neque rhoncus a. Duis nec mi orci. Ut ac egestas lectus. Nulla interdum ullamcorper urna, non egestas tortor imperdiet consectetur. Sed et ante nisi. Mauris et urna ut nulla sollicitudin accumsan non ut sem. Maecenas sagittis eu turpis eu scelerisque. Etiam eleifend suscipit pellentesque. Nunc faucibus ultrices massa, non molestie orci sollicitudin id. In hac habitasse platea dictumst. Ut pretium arcu eget nisl porta, vitae sagittis lorem lacinia. Nulla vulputate leo at nulla fermentum porta. Pellentesque non fermentum lacus, eget auctor est. Praesent mattis sit amet nunc sit amet varius. Proin accumsan, diam eget vulputate dignissim, mi libero ullamcorper velit, sit amet blandit nisi odio nec est. Etiam semper libero id gravida sagittis. Sed congue, orci ut aliquet aliquam, dui enim ornare lacus, vel vehicula nisl leo a velit. In vel egestas ex, iaculis bibendum odio. In lectus nisi, rutrum non ullamcorper eu, tristique id enim. Proin a dolor mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec pretium pellentesque metus at gravida. Suspendisse porta, quam eu hendrerit elementum, massa nunc fringilla ante, at scelerisque orci neque eu tellus. Phasellus volutpat libero vel dolor dignissim, sit amet sagittis urna volutpat. In non metus posuere, sagittis elit id, tempor nunc. Sed ornare a tortor quis ullamcorper. Nullam cursus suscipit odio at maximus. Nulla suscipit lectus non turpis consectetur congue.
{ "content_hash": "a1370b8d0aa8ead89bc7c717172dda15", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 766, "avg_line_length": 97.88461538461539, "alnum_prop": 0.8082514734774067, "repo_name": "KlishGroup/prose-pogs", "id": "5795ea7c9dba394686704234dc9f9e755ef3f268", "size": "2549", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "pogs/R/ROGERHX/OSTF/index.md", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
#region License // Copyright (c) 2007 James Newton-King // // 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. #endregion using System.Collections.Generic; using uWebshop.Newtonsoft.Json.Linq; using uWebshop.Newtonsoft.Json.Utilities; namespace uWebshop.Newtonsoft.Json.Schema { /// <summary> /// Contains the JSON schema extension methods. /// </summary> public static class Extensions { /// <summary> /// Determines whether the <see cref="JToken"/> is valid. /// </summary> /// <param name="source">The source <see cref="JToken"/> to test.</param> /// <param name="schema">The schema to test with.</param> /// <returns> /// <c>true</c> if the specified <see cref="JToken"/> is valid; otherwise, <c>false</c>. /// </returns> public static bool IsValid(this JToken source, JsonSchema schema) { bool valid = true; source.Validate(schema, (sender, args) => { valid = false; }); return valid; } /// <summary> /// Determines whether the <see cref="JToken"/> is valid. /// </summary> /// <param name="source">The source <see cref="JToken"/> to test.</param> /// <param name="schema">The schema to test with.</param> /// <param name="errorMessages">When this method returns, contains any error messages generated while validating. </param> /// <returns> /// <c>true</c> if the specified <see cref="JToken"/> is valid; otherwise, <c>false</c>. /// </returns> public static bool IsValid(this JToken source, JsonSchema schema, out IList<string> errorMessages) { IList<string> errors = new List<string>(); source.Validate(schema, (sender, args) => errors.Add(args.Message)); errorMessages = errors; return (errorMessages.Count == 0); } /// <summary> /// Validates the specified <see cref="JToken"/>. /// </summary> /// <param name="source">The source <see cref="JToken"/> to test.</param> /// <param name="schema">The schema to test with.</param> public static void Validate(this JToken source, JsonSchema schema) { source.Validate(schema, null); } /// <summary> /// Validates the specified <see cref="JToken"/>. /// </summary> /// <param name="source">The source <see cref="JToken"/> to test.</param> /// <param name="schema">The schema to test with.</param> /// <param name="validationEventHandler">The validation event handler.</param> public static void Validate(this JToken source, JsonSchema schema, ValidationEventHandler validationEventHandler) { ValidationUtils.ArgumentNotNull(source, "source"); ValidationUtils.ArgumentNotNull(schema, "schema"); using (var reader = new JsonValidatingReader(source.CreateReader())) { reader.Schema = schema; if (validationEventHandler != null) reader.ValidationEventHandler += validationEventHandler; while (reader.Read()) { } } } } }
{ "content_hash": "e7fc9a68dd0f8e24ab55736700a3eea6", "timestamp": "", "source": "github", "line_count": 106, "max_line_length": 124, "avg_line_length": 36.424528301886795, "alnum_prop": 0.6972286972286972, "repo_name": "uWebshop/uWebshop-Releases", "id": "923f18bd2009db6f9a06427b7e0ed6a3df173ad8", "size": "3863", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Core/uWebshop.Domain/NewtonsoftJsonNet/Schema/Extensions.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "6945" }, { "name": "C#", "bytes": "3966875" }, { "name": "CSS", "bytes": "3285" }, { "name": "HTML", "bytes": "18439" }, { "name": "JavaScript", "bytes": "50632" }, { "name": "XSLT", "bytes": "16095" } ], "symlink_target": "" }