Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ArrowInvalid
Message:      JSON parse error: Missing a closing quotation mark in string. in row 523
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
                  dataset = json.load(f)
                File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
                  return loads(fp.read(),
                File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
                  return _default_decoder.decode(s)
                File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
                  raise JSONDecodeError("Extra data", s, end)
              json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 1210)
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
                  for _, table in generator:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
                  raise e
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
                  pa_table = paj.read_json(
                File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
                File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
              pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 523
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

text
string
meta
dict
package com.velocity.gson; /** * Strategy for excluding anonymous and local classes. * * @author Ranjitk */ final class AnonymousAndLocalClassExclusionStrategy implements ExclusionStrategy { public boolean shouldSkipField(FieldAttributes f) { return isAnonymousOrLocal(f.getDeclaredClass()); } public boolean shouldSkipClass(Class<?> clazz) { return isAnonymousOrLocal(clazz); } private boolean isAnonymousOrLocal(Class<?> clazz) { return !Enum.class.isAssignableFrom(clazz) && (clazz.isAnonymousClass() || clazz.isLocalClass()); } }
{ "content_hash": "fe0b06ad87320e107f0be8735300dc8e", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 82, "avg_line_length": 27.09090909090909, "alnum_prop": 0.709731543624161, "repo_name": "nab-velocity/android-sdk", "id": "902ce632512e5fc52c39425e4dbd7507d2b703fe", "size": "596", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "VelocityLibrary/src/com/velocity/gson/AnonymousAndLocalClassExclusionStrategy.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "888677" } ] }
package etcdv3 import ( "sync" "testing" "time" "github.com/coreos/etcd/etcdserver/api/v3client" "github.com/ligato/cn-infra/datasync" "github.com/ligato/cn-infra/db/keyval" "github.com/ligato/cn-infra/db/keyval/etcdv3/mocks" "github.com/ligato/cn-infra/logging/logroot" "github.com/onsi/gomega" ) const ( prefix = "/my/prefix/" key = "key" watchKey = "vals/" ) var ( broker *BytesConnectionEtcd prefixedBroker keyval.BytesBroker prefixedWatcher keyval.BytesWatcher embd mocks.Embedded ) func TestDataBroker(t *testing.T) { //setup embd.Start(t) defer embd.Stop() gomega.RegisterTestingT(t) t.Run("putGetValue", testPutGetValuePrefixed) embd.CleanDs() t.Run("simpleWatcher", testPrefixedWatcher) embd.CleanDs() t.Run("listValues", testPrefixedListValues) embd.CleanDs() t.Run("txn", testPrefixedTxn) embd.CleanDs() t.Run("testDelWithPrefix", testDelWithPrefix) } func teardownBrokers() { broker.Close() broker = nil prefixedBroker = nil prefixedWatcher = nil } func testPutGetValuePrefixed(t *testing.T) { setupBrokers(t) defer teardownBrokers() data := []byte{1, 2, 3} // insert key-value pair using databroker err := broker.Put(prefix+key, data) gomega.Expect(err).To(gomega.BeNil()) returnedData, found, _, err := prefixedBroker.GetValue(key) gomega.Expect(returnedData).NotTo(gomega.BeNil()) gomega.Expect(found).To(gomega.BeTrue()) gomega.Expect(err).To(gomega.BeNil()) // not existing value returnedData, found, _, err = prefixedBroker.GetValue("unknown") gomega.Expect(returnedData).To(gomega.BeNil()) gomega.Expect(found).To(gomega.BeFalse()) gomega.Expect(err).To(gomega.BeNil()) } func testPrefixedWatcher(t *testing.T) { setupBrokers(t) defer teardownBrokers() watchCh := make(chan keyval.BytesWatchResp) err := prefixedWatcher.Watch(keyval.ToChan(watchCh), watchKey) gomega.Expect(err).To(gomega.BeNil()) wg := sync.WaitGroup{} wg.Add(1) go expectWatchEvent(t, &wg, watchCh, watchKey+"val1") // insert kv that doesn't match the watcher subscription broker.Put(prefix+"/something/else/val1", []byte{0, 0, 7}) // insert kv for watcher broker.Put(prefix+watchKey+"val1", []byte{0, 0, 7}) wg.Wait() } func testPrefixedTxn(t *testing.T) { setupBrokers(t) defer teardownBrokers() tx := prefixedBroker.NewTxn() gomega.Expect(tx).NotTo(gomega.BeNil()) tx.Put("b/val1", []byte{0, 1}) tx.Put("b/val2", []byte{0, 1}) tx.Put("b/val3", []byte{0, 1}) tx.Commit() kvi, err := broker.ListValues(prefix + "b") gomega.Expect(err).To(gomega.BeNil()) gomega.Expect(kvi).NotTo(gomega.BeNil()) expectedKeys := []string{prefix + "b/val1", prefix + "b/val2", prefix + "b/val3"} for i := 0; i < 3; i++ { kv, all := kvi.GetNext() gomega.Expect(kv).NotTo(gomega.BeNil()) gomega.Expect(all).To(gomega.BeFalse()) gomega.Expect(kv.GetKey()).To(gomega.BeEquivalentTo(expectedKeys[i])) } } func testPrefixedListValues(t *testing.T) { setupBrokers(t) defer teardownBrokers() var err error // insert values using databroker err = broker.Put(prefix+"a/val1", []byte{0, 0, 7}) gomega.Expect(err).To(gomega.BeNil()) err = broker.Put(prefix+"a/val2", []byte{0, 0, 7}) gomega.Expect(err).To(gomega.BeNil()) err = broker.Put(prefix+"a/val3", []byte{0, 0, 7}) gomega.Expect(err).To(gomega.BeNil()) // list values using pluginDatabroker kvi, err := prefixedBroker.ListValues("a") gomega.Expect(err).To(gomega.BeNil()) gomega.Expect(kvi).NotTo(gomega.BeNil()) expectedKeys := []string{"a/val1", "a/val2", "a/val3"} for i := 0; i < 3; i++ { kv, all := kvi.GetNext() gomega.Expect(kv).NotTo(gomega.BeNil()) gomega.Expect(all).To(gomega.BeFalse()) // verify that prefix of BytesBrokerWatcherEtcd is trimmed gomega.Expect(kv.GetKey()).To(gomega.BeEquivalentTo(expectedKeys[i])) } } func testDelWithPrefix(t *testing.T) { setupBrokers(t) defer teardownBrokers() err := broker.Put("something/a/val1", []byte{0, 0, 7}) gomega.Expect(err).To(gomega.BeNil()) err = broker.Put("something/a/val2", []byte{0, 0, 7}) gomega.Expect(err).To(gomega.BeNil()) err = broker.Put("something/a/val3", []byte{0, 0, 7}) gomega.Expect(err).To(gomega.BeNil()) _, found, _, err := broker.GetValue("something/a/val1") gomega.Expect(found).To(gomega.BeTrue()) gomega.Expect(err).To(gomega.BeNil()) _, found, _, err = broker.GetValue("something/a/val2") gomega.Expect(found).To(gomega.BeTrue()) gomega.Expect(err).To(gomega.BeNil()) _, found, _, err = broker.GetValue("something/a/val3") gomega.Expect(found).To(gomega.BeTrue()) gomega.Expect(err).To(gomega.BeNil()) _, err = broker.Delete("something/a", datasync.WithPrefix()) gomega.Expect(err).To(gomega.BeNil()) _, found, _, err = broker.GetValue("something/a/val1") gomega.Expect(found).To(gomega.BeFalse()) gomega.Expect(err).To(gomega.BeNil()) _, found, _, err = broker.GetValue("something/a/val2") gomega.Expect(found).To(gomega.BeFalse()) gomega.Expect(err).To(gomega.BeNil()) _, found, _, err = broker.GetValue("something/a/val3") gomega.Expect(found).To(gomega.BeFalse()) gomega.Expect(err).To(gomega.BeNil()) } func expectWatchEvent(t *testing.T, wg *sync.WaitGroup, watchCh chan keyval.BytesWatchResp, expectedKey string) { select { case resp := <-watchCh: gomega.Expect(resp).NotTo(gomega.BeNil()) gomega.Expect(resp.GetKey()).To(gomega.BeEquivalentTo(expectedKey)) case <-time.After(1 * time.Second): t.Error("Watch resp not received") t.FailNow() } wg.Done() } func setupBrokers(t *testing.T) { var err error broker, err = NewEtcdConnectionUsingClient(v3client.New(embd.ETCD.Server), logroot.StandardLogger()) gomega.Expect(err).To(gomega.BeNil()) gomega.Expect(broker).NotTo(gomega.BeNil()) // create BytesBrokerWatcherEtcd with prefix prefixedBroker = broker.NewBroker(prefix) prefixedWatcher = broker.NewWatcher(prefix) gomega.Expect(prefixedBroker).NotTo(gomega.BeNil()) gomega.Expect(prefixedWatcher).NotTo(gomega.BeNil()) }
{ "content_hash": "9c7cdb18339b0a0f2bfa3cf5c277b822", "timestamp": "", "source": "github", "line_count": 216, "max_line_length": 113, "avg_line_length": 27.625, "alnum_prop": 0.702530584883526, "repo_name": "jozef-slezak/cn-infra", "id": "56a12d6a4473175190b70c63e53078a33551d664", "size": "6578", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "db/keyval/etcdv3/etcdv3_integration_test.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "704697" }, { "name": "Makefile", "bytes": "7144" }, { "name": "Shell", "bytes": "25606" } ] }
esn_kernel ========== ESN Kernel Application
{ "content_hash": "1d4be0978c0785ba3f7d26ae17841f6e", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 22, "avg_line_length": 11.5, "alnum_prop": 0.6304347826086957, "repo_name": "zincwombat/esn_kernel", "id": "2737ed337940b17dcae802ff7de21756d3a6de24", "size": "46", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Erlang", "bytes": "26161" } ] }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <title>summernote</title> <!-- include jquery --> <script src="//code.jquery.com/jquery-1.9.1.min.js"></script> <!-- include libraries BS2 --> <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> <script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script> <link href="//netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.min.css" rel="stylesheet"> <!-- include summernote --> <link rel="stylesheet" href="../dist/summernote.css"> <script type="text/javascript" src="../dist/summernote.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.summernote').summernote({height: 300}); }); </script> </head> <body> <div class="summernote"></div> </body> </html>
{ "content_hash": "0d6d3743ac1e38e0c21a48f9157e85b4", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 123, "avg_line_length": 36.25, "alnum_prop": 0.6669950738916256, "repo_name": "bradbernard/LCSHub", "id": "3260f40c1a34fbbfd261a4a7efce6fde406f0cf7", "size": "1015", "binary": false, "copies": "12", "ref": "refs/heads/master", "path": "public/js/bootstrap.summernote/examples/bs2.html", "mode": "33261", "license": "mit", "language": [ { "name": "ActionScript", "bytes": "15982" }, { "name": "ApacheConf", "bytes": "356" }, { "name": "CSS", "bytes": "1565053" }, { "name": "CoffeeScript", "bytes": "11578" }, { "name": "Erlang", "bytes": "2144" }, { "name": "Go", "bytes": "7075" }, { "name": "HTML", "bytes": "5176761" }, { "name": "Handlebars", "bytes": "8278" }, { "name": "JavaScript", "bytes": "7236006" }, { "name": "LiveScript", "bytes": "6103" }, { "name": "Makefile", "bytes": "343" }, { "name": "PHP", "bytes": "885407" }, { "name": "Python", "bytes": "22125" }, { "name": "Shell", "bytes": "10826" } ] }
var version = require('./version'); var Helpers = require('./helpers'); var PostMessage = require('./postmessage'); module.exports = (function () { function ChildWindow() { this.eventObject = Helpers.addEventObject(this, wrapEventInNamespace); this.message = null; } function wrapEventInNamespace(eventName) { return ChildWindow._NAMESPACE + '_' + eventName; } var DEFAULT_OPTIONS = { target: '_blank' }; /** Private Members **/ ChildWindow.prototype.eventObject = null; ChildWindow.prototype.childWindow = null; ChildWindow.prototype.triggerEvent = function (event, data) { this.eventObject.trigger(event, data); }; /** Public Members **/ ChildWindow.prototype.open = function (url, options) { options = Object.assign({}, DEFAULT_OPTIONS, options); if (this.childWindow && !this.childWindow.closed) { this.childWindow.location.href = url; } var that = this; var addHandlers = function () { that.on('close', function handleClose() { if (timer) { global.clearTimeout(timer); } if (that.childWindow) { that.childWindow.close(); } that.off('close', handleClose) }); // Cross-window communication that.message = new PostMessage(that.childWindow); that.message.on('dimensions widget-detection', function handleWidgetDetection() { that.triggerEvent('load'); that.message.off('dimensions widget-detection', handleWidgetDetection); }); that.message.on('widget-detection', function handleWidgetDetection() { that.message.send('widget-detected', {version: version, childWindowOptions: options}); that.message.off('widget-detection', handleWidgetDetection); }); that.message.on('status', function (event) { that.triggerEvent('status', event.detail); }); that.on('close', function handleClose() { that.message.off(); that.off('close', handleClose); }); that.message.on('user-country', function (event) { that.triggerEvent('user-country', event.detail); }); }; switch (options.target) { case '_self': this.childWindow = global.window; addHandlers(); this.childWindow.location.href = url; break; case '_parent': this.childWindow = global.window.parent; addHandlers(); this.childWindow.location.href = url; break; case '_blank': default: this.childWindow = global.window.open(url); this.childWindow.focus(); addHandlers(); var checkWindow = (function () { if (this.childWindow) { if (this.childWindow.closed) { this.triggerEvent('close'); } else { timer = global.setTimeout(checkWindow, 100); } } }).bind(this); var timer = global.setTimeout(checkWindow, 100); break; } this.triggerEvent('open'); }; ChildWindow.prototype.close = function () { this.triggerEvent('close'); }; ChildWindow.prototype.on = function (event, handler, options) { if (typeof handler !== 'function') { return; } this.eventObject.on(event, handler, options); }; ChildWindow.prototype.off = function (event, handler, options) { this.eventObject.off(event, handler, options); }; ChildWindow.prototype.getPostMessage = function () { return this.message; }; ChildWindow._NAMESPACE = 'CHILD_WINDOW'; return ChildWindow; })();
{ "content_hash": "b39100570fc1b41594c1c676406805e9", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 102, "avg_line_length": 32.94444444444444, "alnum_prop": 0.5283064321850156, "repo_name": "xsolla/paystation-embed", "id": "7f73a7e981f7bad73140d5ebcd88158424d59f87", "size": "4151", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/childwindow.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "6746" }, { "name": "JavaScript", "bytes": "40477" }, { "name": "SCSS", "bytes": "2759" } ] }
module.exports = { method: function (object, methodName, tempBehavior) { var isDeclaredInPrototype = !object.hasOwnProperty(methodName); var realMethod = !isDeclaredInPrototype ? object[methodName] : null; var deferredCalls = { callsList: [], // Array of call arguments arrays execAll: function () { var callsList = deferredCalls.callsList; if (isDeclaredInPrototype) delete object[methodName]; else object[methodName] = realMethod; deferredCalls.execAll = function () {}; deferredCalls.callsList = []; return callsList.map(function (args) { return object[methodName].apply(object, args); }); } }; object[methodName] = function () { deferredCalls.callsList.push(arguments); return typeof (tempBehavior) === 'function' ? tempBehavior.apply(object, arguments) : tempBehavior; }; return deferredCalls; } };
{ "content_hash": "7ddec4030db2a2b006cbd5626cf349f1", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 105, "avg_line_length": 38.833333333333336, "alnum_prop": 0.6534334763948498, "repo_name": "guillaumervls/defer-calls", "id": "81be1692070b00aa18c9f4909fcef8b1cfa3fbcd", "size": "932", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "index.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "932" } ] }
[cmdletbinding()] param() # Arrange. . $PSScriptRoot\..\..\..\..\Tests\lib\Initialize-Test.ps1 Microsoft.PowerShell.Core\Import-Module $PSScriptRoot\.. Register-Mock Write-Warning Register-Mock Get-MSBuildPath { 'Some resolved location' } -- -Version '14.0' -Architecture 'Some architecture' # Act. $actual = Select-MSBuildPath -Method 'Version' -Location '' -PreferredVersion '15.0' -Architecture 'Some architecture' # Assert. Assert-WasCalled Write-Warning Assert-WasCalled Get-MSBuildPath -Times 4 Assert-AreEqual -Expected 'Some resolved location' -Actual $actual
{ "content_hash": "756273dea3b9fc3fb7d3f6fa3fc83e2a", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 118, "avg_line_length": 35.6875, "alnum_prop": 0.7583187390542907, "repo_name": "Microsoft/vso-agent-tasks", "id": "c6655e8ce758465c9de037be00890cfb4ce3b055", "size": "571", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Tasks/Common/MSBuildHelpers/Tests/Select-MSBuildPath.FallsBackFrom15.ps1", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "40335" }, { "name": "PowerShell", "bytes": "967657" }, { "name": "Shell", "bytes": "7002" }, { "name": "TypeScript", "bytes": "253674" } ] }
import ma = require('azure-pipelines-task-lib/mock-answer'); import tmrm = require('azure-pipelines-task-lib/mock-run'); import path = require('path'); import util = require('../NugetMockHelper'); let taskPath = path.join(__dirname, '../..', 'nugetcommandmain.js'); let tmr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); let nmh: util.NugetMockHelper = new util.NugetMockHelper(tmr); nmh.setNugetVersionInputDefault(); tmr.setInput('command', 'restore'); tmr.setInput('solution', 'packages.config'); tmr.setInput('selectOrConfig', 'select'); tmr.setInput('includeNuGetOrg', 'True'); let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{ "osType": {}, "checkPath": { "c:\\agent\\home\\directory\\packages.config": true }, "which": {}, "exec": { "c:\\from\\tool\\installer\\nuget.exe restore c:\\agent\\home\\directory\\packages.config -NonInteractive -ConfigFile c:\\agent\\home\\directory\\tempNuGet_.config": { "code": 0, "stdout": "NuGet output here", "stderr": "" } }, "exist": {}, "stats": { "c:\\agent\\home\\directory\\packages.config": { "isFile": true } }, "rmRF": { "c:\\agent\\home\\directory\\tempNuGet_.config": { success: true } }, "findMatch": { "packages.config" : ["c:\\agent\\home\\directory\\packages.config"] } }; nmh.setAnswers(a); process.env["NuGet_ForceEnableCredentialConfig"] = "false"; nmh.registerNugetUtilityMock(["c:\\agent\\home\\directory\\packages.config"]); nmh.registerDefaultNugetVersionMock(); nmh.registerToolRunnerMock(); nmh.registerNugetConfigMock(); tmr.run();
{ "content_hash": "5dbc652fc4d5007305b4d4db819907c7", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 175, "avg_line_length": 32.745098039215684, "alnum_prop": 0.6365269461077845, "repo_name": "dylan-smith/vso-agent-tasks", "id": "68fa42b95bf26cb275e448fe0e661a69ea5b3b35", "size": "1670", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "Tasks/NuGetCommandV2/Tests/RestoreTests/selectSourceNuGetOrg.ts", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1636" }, { "name": "CSS", "bytes": "3780" }, { "name": "HTML", "bytes": "46009" }, { "name": "Java", "bytes": "1575" }, { "name": "JavaScript", "bytes": "142044" }, { "name": "PowerShell", "bytes": "2502976" }, { "name": "Shell", "bytes": "39518" }, { "name": "TSQL", "bytes": "7822" }, { "name": "TypeScript", "bytes": "7982928" } ] }
use utf8; package Brainbase::Schema::Result::User; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE =head1 NAME Brainbase::Schema::Result::User =cut use strict; use warnings; use Moose; use MooseX::NonMoose; use MooseX::MarkAsMethods autoclean => 1; extends 'DBIx::Class::Core'; =head1 COMPONENTS LOADED =over 4 =item * L<DBIx::Class::InflateColumn::DateTime> =item * L<DBIx::Class::TimeStamp> =item * L<DBIx::Class::PassphraseColumn> =back =cut __PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "PassphraseColumn"); =head1 TABLE: C<users> =cut __PACKAGE__->table("users"); =head1 ACCESSORS =head2 id data_type: 'integer' is_nullable: 0 =head2 username data_type: 'text' is_nullable: 1 =head2 password data_type: 'text' is_nullable: 1 =head2 email_address data_type: 'text' is_nullable: 1 =head2 first_name data_type: 'text' is_nullable: 1 =head2 last_name data_type: 'text' is_nullable: 1 =head2 active data_type: 'integer' is_nullable: 1 =cut __PACKAGE__->add_columns( "id", { data_type => "integer", is_nullable => 0 }, "username", { data_type => "text", is_nullable => 1 }, "password", { data_type => "text", is_nullable => 1 }, "email_address", { data_type => "text", is_nullable => 1 }, "first_name", { data_type => "text", is_nullable => 1 }, "last_name", { data_type => "text", is_nullable => 1 }, "active", { data_type => "integer", is_nullable => 1 }, ); =head1 PRIMARY KEY =over 4 =item * L</id> =back =cut __PACKAGE__->set_primary_key("id"); =head1 RELATIONS =head2 user_roles Type: has_many Related object: L<Brainbase::Schema::Result::UserRole> =cut __PACKAGE__->has_many( "user_roles", "Brainbase::Schema::Result::UserRole", { "foreign.user_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); =head2 roles Type: many_to_many Composing rels: L</user_roles> -> role =cut __PACKAGE__->many_to_many("roles", "user_roles", "role"); # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-01-03 15:46:59 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7ITSBuBg1WNRrJpj37HfbA # You can replace this text with custom code or comments, and it will be preserved on regeneration # many_to_many # Have the "password" column use a SHA-1 hash and 20-byte salt # with RFC 2307 encoding; Generate the 'check_password' method __PACKAGE__->add_columns( 'password' => { passphrase => 'rfc2307', passphrase_class => 'SaltedDigest', passphrase_args => { algorithm => 'SHA-1', salt_random => 20. }, passphrase_check_method => 'check_password', }, ); __PACKAGE__->many_to_many(roles => 'user_roles', 'role'); __PACKAGE__->meta->make_immutable; 1;
{ "content_hash": "879ff5e6f9dab0e7b0b14c486f48ec54", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 98, "avg_line_length": 17.074534161490682, "alnum_prop": 0.6515096398690433, "repo_name": "Paciorkowski-Lab/BrainBase", "id": "2f992e4a2a8880d537cfce87f9bc281a7caf1da5", "size": "2749", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/Brainbase/Schema/Result/User.pm", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4682" }, { "name": "Perl", "bytes": "46091" }, { "name": "Perl6", "bytes": "26206" } ] }
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /* |-------------------------------------------------------------------------- | Base Site URL |-------------------------------------------------------------------------- | | URL to your CodeIgniter root. Typically this will be your base URL, | WITH a trailing slash: | | http://example.com/ | | WARNING: You MUST set this value! | | If it is not set, then CodeIgniter will try guess the protocol and path | your installation, but due to security concerns the hostname will be set | to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise. | The auto-detection mechanism exists only for convenience during | development and MUST NOT be used in production! | | If you need to allow multiple domains, remember that this file is still | a PHP script and you can easily do that on your own. | */ $config['base_url'] = 'http://localhost/proyecto'; /* |-------------------------------------------------------------------------- | Index File |-------------------------------------------------------------------------- | | Typically this will be your index.php file, unless you've renamed it to | something else. If you are using mod_rewrite to remove the page set this | variable so that it is blank. | */ $config['index_page'] = ''; /* |-------------------------------------------------------------------------- | URI PROTOCOL |-------------------------------------------------------------------------- | | This item determines which server global should be used to retrieve the | URI string. The default setting of 'REQUEST_URI' works for most servers. | If your links do not seem to work, try one of the other delicious flavors: | | 'REQUEST_URI' Uses $_SERVER['REQUEST_URI'] | 'QUERY_STRING' Uses $_SERVER['QUERY_STRING'] | 'PATH_INFO' Uses $_SERVER['PATH_INFO'] | | WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! */ $config['uri_protocol'] = 'REQUEST_URI'; /* |-------------------------------------------------------------------------- | URL suffix |-------------------------------------------------------------------------- | | This option allows you to add a suffix to all URLs generated by CodeIgniter. | For more information please see the user guide: | | https://codeigniter.com/user_guide/general/urls.html */ $config['url_suffix'] = ''; /* |-------------------------------------------------------------------------- | Default Language |-------------------------------------------------------------------------- | | This determines which set of language files should be used. Make sure | there is an available translation if you intend to use something other | than english. | */ $config['language'] = 'spanish'; /* |-------------------------------------------------------------------------- | Default Character Set |-------------------------------------------------------------------------- | | This determines which character set is used by default in various methods | that require a character set to be provided. | | See http://php.net/htmlspecialchars for a list of supported charsets. | */ $config['charset'] = 'UTF-8'; /* |-------------------------------------------------------------------------- | Enable/Disable System Hooks |-------------------------------------------------------------------------- | | If you would like to use the 'hooks' feature you must enable it by | setting this variable to TRUE (boolean). See the user guide for details. | */ $config['enable_hooks'] = FALSE; /* |-------------------------------------------------------------------------- | Class Extension Prefix |-------------------------------------------------------------------------- | | This item allows you to set the filename/classname prefix when extending | native libraries. For more information please see the user guide: | | https://codeigniter.com/user_guide/general/core_classes.html | https://codeigniter.com/user_guide/general/creating_libraries.html | */ $config['subclass_prefix'] = 'MY_'; /* |-------------------------------------------------------------------------- | Composer auto-loading |-------------------------------------------------------------------------- | | Enabling this setting will tell CodeIgniter to look for a Composer | package auto-loader script in application/vendor/autoload.php. | | $config['composer_autoload'] = TRUE; | | Or if you have your vendor/ directory located somewhere else, you | can opt to set a specific path as well: | | $config['composer_autoload'] = '/path/to/vendor/autoload.php'; | | For more information about Composer, please visit http://getcomposer.org/ | | Note: This will NOT disable or override the CodeIgniter-specific | autoloading (application/config/autoload.php) */ $config['composer_autoload'] = FALSE; /* |-------------------------------------------------------------------------- | Allowed URL Characters |-------------------------------------------------------------------------- | | This lets you specify which characters are permitted within your URLs. | When someone tries to submit a URL with disallowed characters they will | get a warning message. | | As a security measure you are STRONGLY encouraged to restrict URLs to | as few characters as possible. By default only these are allowed: a-z 0-9~%.:_- | | Leave blank to allow all characters -- but only if you are insane. | | The configured value is actually a regular expression character group | and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i | | DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!! | */ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; /* |-------------------------------------------------------------------------- | Enable Query Strings |-------------------------------------------------------------------------- | | By default CodeIgniter uses search-engine friendly segment based URLs: | example.com/who/what/where/ | | By default CodeIgniter enables access to the $_GET array. If for some | reason you would like to disable it, set 'allow_get_array' to FALSE. | | You can optionally enable standard query string based URLs: | example.com?who=me&what=something&where=here | | Options are: TRUE or FALSE (boolean) | | The other items let you set the query string 'words' that will | invoke your controllers and its functions: | example.com/index.php?c=controller&m=function | | Please note that some of the helpers won't work as expected when | this feature is enabled, since CodeIgniter is designed primarily to | use segment based URLs. | */ $config['allow_get_array'] = TRUE; $config['enable_query_strings'] = FALSE; $config['controller_trigger'] = 'c'; $config['function_trigger'] = 'm'; $config['directory_trigger'] = 'd'; /* |-------------------------------------------------------------------------- | Error Logging Threshold |-------------------------------------------------------------------------- | | You can enable error logging by setting a threshold over zero. The | threshold determines what gets logged. Threshold options are: | | 0 = Disables logging, Error logging TURNED OFF | 1 = Error Messages (including PHP errors) | 2 = Debug Messages | 3 = Informational Messages | 4 = All Messages | | You can also pass an array with threshold levels to show individual error types | | array(2) = Debug Messages, without Error Messages | | For a live site you'll usually only enable Errors (1) to be logged otherwise | your log files will fill up very fast. | */ $config['log_threshold'] = 0; /* |-------------------------------------------------------------------------- | Error Logging Directory Path |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default | application/logs/ directory. Use a full server path with trailing slash. | */ $config['log_path'] = ''; /* |-------------------------------------------------------------------------- | Log File Extension |-------------------------------------------------------------------------- | | The default filename extension for log files. The default 'php' allows for | protecting the log files via basic scripting, when they are to be stored | under a publicly accessible directory. | | Note: Leaving it blank will default to 'php'. | */ $config['log_file_extension'] = ''; /* |-------------------------------------------------------------------------- | Log File Permissions |-------------------------------------------------------------------------- | | The file system permissions to be applied on newly created log files. | | IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal | integer notation (i.e. 0700, 0644, etc.) */ $config['log_file_permissions'] = 0644; /* |-------------------------------------------------------------------------- | Date Format for Logs |-------------------------------------------------------------------------- | | Each item that is logged has an associated date. You can use PHP date | codes to set your own date formatting | */ $config['log_date_format'] = 'd-m-Y'; /* |-------------------------------------------------------------------------- | Error Views Directory Path |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default | application/views/errors/ directory. Use a full server path with trailing slash. | */ $config['error_views_path'] = ''; /* |-------------------------------------------------------------------------- | Cache Directory Path |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default | application/cache/ directory. Use a full server path with trailing slash. | */ $config['cache_path'] = ''; /* |-------------------------------------------------------------------------- | Cache Include Query String |-------------------------------------------------------------------------- | | Whether to take the URL query string into consideration when generating | output cache files. Valid options are: | | FALSE = Disabled | TRUE = Enabled, take all query parameters into account. | Please be aware that this may result in numerous cache | files generated for the same page over and over again. | array('q') = Enabled, but only take into account the specified list | of query parameters. | */ $config['cache_query_string'] = FALSE; /* |-------------------------------------------------------------------------- | Encryption Key |-------------------------------------------------------------------------- | | If you use the Encryption class, you must set an encryption key. | See the user guide for more info. | | https://codeigniter.com/user_guide/libraries/encryption.html | */ $config['encryption_key'] = 'jorge1234'; /* |-------------------------------------------------------------------------- | Session Variables |-------------------------------------------------------------------------- | | 'sess_driver' | | The storage driver to use: files, database, redis, memcached | | 'sess_cookie_name' | | The session cookie name, must contain only [0-9a-z_-] characters | | 'sess_expiration' | | The number of SECONDS you want the session to last. | Setting to 0 (zero) means expire when the browser is closed. | | 'sess_save_path' | | The location to save sessions to, driver dependent. | | For the 'files' driver, it's a path to a writable directory. | WARNING: Only absolute paths are supported! | | For the 'database' driver, it's a table name. | Please read up the manual for the format with other session drivers. | | IMPORTANT: You are REQUIRED to set a valid save path! | | 'sess_match_ip' | | Whether to match the user's IP address when reading the session data. | | WARNING: If you're using the database driver, don't forget to update | your session table's PRIMARY KEY when changing this setting. | | 'sess_time_to_update' | | How many seconds between CI regenerating the session ID. | | 'sess_regenerate_destroy' | | Whether to destroy session data associated with the old session ID | when auto-regenerating the session ID. When set to FALSE, the data | will be later deleted by the garbage collector. | | Other session cookie settings are shared with the rest of the application, | except for 'cookie_prefix' and 'cookie_httponly', which are ignored here. | */ $config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = NULL; $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE; /* |-------------------------------------------------------------------------- | Cookie Related Variables |-------------------------------------------------------------------------- | | 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions | 'cookie_domain' = Set to .your-domain.com for site-wide cookies | 'cookie_path' = Typically will be a forward slash | 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists. | 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript) | | Note: These settings (with the exception of 'cookie_prefix' and | 'cookie_httponly') will also affect sessions. | */ $config['cookie_prefix'] = ''; $config['cookie_domain'] = ''; $config['cookie_path'] = '/'; $config['cookie_secure'] = FALSE; $config['cookie_httponly'] = FALSE; /* |-------------------------------------------------------------------------- | Standardize newlines |-------------------------------------------------------------------------- | | Determines whether to standardize newline characters in input data, | meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value. | | This is particularly useful for portability between UNIX-based OSes, | (usually \n) and Windows (\r\n). | */ $config['standardize_newlines'] = FALSE; /* |-------------------------------------------------------------------------- | Global XSS Filtering |-------------------------------------------------------------------------- | | Determines whether the XSS filter is always active when GET, POST or | COOKIE data is encountered | | WARNING: This feature is DEPRECATED and currently available only | for backwards compatibility purposes! | */ $config['global_xss_filtering'] = FALSE; /* |-------------------------------------------------------------------------- | Cross Site Request Forgery |-------------------------------------------------------------------------- | Enables a CSRF cookie token to be set. When set to TRUE, token will be | checked on a submitted form. If you are accepting user data, it is strongly | recommended CSRF protection be enabled. | | 'csrf_token_name' = The token name | 'csrf_cookie_name' = The cookie name | 'csrf_expire' = The number in seconds the token should expire. | 'csrf_regenerate' = Regenerate token on every submission | 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks */ $config['csrf_protection'] = FALSE; $config['csrf_token_name'] = 'csrf_test_name'; $config['csrf_cookie_name'] = 'csrf_cookie_name'; $config['csrf_expire'] = 7200; $config['csrf_regenerate'] = TRUE; $config['csrf_exclude_uris'] = array(); /* |-------------------------------------------------------------------------- | Output Compression |-------------------------------------------------------------------------- | | Enables Gzip output compression for faster page loads. When enabled, | the output class will test whether your server supports Gzip. | Even if it does, however, not all browsers support compression | so enable only if you are reasonably sure your visitors can handle it. | | Only used if zlib.output_compression is turned off in your php.ini. | Please do not use it together with httpd-level output compression. | | VERY IMPORTANT: If you are getting a blank page when compression is enabled it | means you are prematurely outputting something to your browser. It could | even be a line of whitespace at the end of one of your scripts. For | compression to work, nothing can be sent before the output buffer is called | by the output class. Do not 'echo' any values with compression enabled. | */ $config['compress_output'] = FALSE; /* |-------------------------------------------------------------------------- | Master Time Reference |-------------------------------------------------------------------------- | | Options are 'local' or any PHP supported timezone. This preference tells | the system whether to use your server's local time as the master 'now' | reference, or convert it to the configured one timezone. See the 'date | helper' page of the user guide for information regarding date handling. | */ $config['time_reference'] = 'local'; /* |-------------------------------------------------------------------------- | Rewrite PHP Short Tags |-------------------------------------------------------------------------- | | If your PHP installation does not have short tag support enabled CI | can rewrite the tags on-the-fly, enabling you to utilize that syntax | in your view files. Options are TRUE or FALSE (boolean) | | Note: You need to have eval() enabled for this to work. | */ $config['rewrite_short_tags'] = FALSE; /* |-------------------------------------------------------------------------- | Reverse Proxy IPs |-------------------------------------------------------------------------- | | If your server is behind a reverse proxy, you must whitelist the proxy | IP addresses from which CodeIgniter should trust headers such as | HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify | the visitor's IP address. | | You can use both an array or a comma-separated list of proxy addresses, | as well as specifying whole subnets. Here are a few examples: | | Comma-separated: '10.0.1.200,192.168.5.0/24' | Array: array('10.0.1.200', '192.168.5.0/24') */ $config['proxy_ips'] = '';
{ "content_hash": "d175fae45d0a0fa1ddec5fda88c5c715", "timestamp": "", "source": "github", "line_count": 512, "max_line_length": 83, "avg_line_length": 35.453125, "alnum_prop": 0.5457249889819303, "repo_name": "jorgegiltrilles/proyecto-dws", "id": "855fdd8eaf35d62e13c629525bbaa1c5b4bcb7ad", "size": "18152", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/config/config.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "428" }, { "name": "CSS", "bytes": "136183" }, { "name": "HTML", "bytes": "8276690" }, { "name": "JavaScript", "bytes": "298961" }, { "name": "PHP", "bytes": "1831352" } ] }
'use strict'; var assign = require('es5-ext/object/assign') , matchUser = require('../utils/user-matcher') , submit = require('mano/utils/save'); module.exports = assign(exports, require('../user')); exports['user-add'] = { submit: function (data) { data['User#/roles'] = ['manager']; return submit.apply(this, arguments); }, redirectUrl: function (data) { return '/user/' + this.target.__id__ + '/'; } }; exports['user/[0-9][a-z0-9]+'] = { match: matchUser }; exports['request-create-account/[0-9][a-z0-9]+'] = { match: matchUser, redirectUrl: function () { return '/user/' + this.targetId + '/'; } }; exports['user/[0-9][a-z0-9]+/set-activation'] = { match: matchUser }; // Delete manager, the validation is currently handled in submit by user destruction mechanism exports['user/[0-9][a-z0-9]+/delete'] = { match: matchUser, validate: Function.prototype, redirectUrl: function () { if (this.referer) { if (this.referer.pathname !== '/') return '/'; } else { return '/'; } } };
{ "content_hash": "908b67c4543daf8180b101a2b7900432", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 94, "avg_line_length": 22.543478260869566, "alnum_prop": 0.6142719382835101, "repo_name": "egovernment/eregistrations-demo", "id": "aa1c08fe105a4b8ab15620730e89c6c70df03d65", "size": "1080", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "node_modules/eregistrations/controller/manager-validation/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "31" }, { "name": "CSS", "bytes": "293" }, { "name": "HTML", "bytes": "7910" }, { "name": "JavaScript", "bytes": "183311" }, { "name": "Smarty", "bytes": "8823" } ] }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "510af16cd56a8eddb16936c0a5bded7d", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "72b1810389aa5875152ad63506691aa65043f0f9", "size": "177", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Psiadia/Psiadia depauperata/README.md", "mode": "33188", "license": "apache-2.0", "language": [] }
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#33000000" android:endColor="#00000000" android:angle="-90"/> </shape>
{ "content_hash": "e515c021e5f7a2127235df22a7448d7a", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 65, "avg_line_length": 29.444444444444443, "alnum_prop": 0.6452830188679245, "repo_name": "zoozooll/MyExercise", "id": "93f32e04a63f0d7466b3b5b0cf3f058fccb599da", "size": "265", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "MogooPing/res/drawable/shadow.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "1495689" }, { "name": "C#", "bytes": "190108" }, { "name": "C++", "bytes": "8719269" }, { "name": "CMake", "bytes": "46692" }, { "name": "CSS", "bytes": "149067" }, { "name": "GLSL", "bytes": "1069" }, { "name": "HTML", "bytes": "5933291" }, { "name": "Java", "bytes": "20935928" }, { "name": "JavaScript", "bytes": "420263" }, { "name": "Kotlin", "bytes": "13567" }, { "name": "Makefile", "bytes": "40498" }, { "name": "Objective-C", "bytes": "1149532" }, { "name": "Objective-C++", "bytes": "248482" }, { "name": "Python", "bytes": "23625" }, { "name": "RenderScript", "bytes": "3899" }, { "name": "Shell", "bytes": "18962" }, { "name": "TSQL", "bytes": "184481" } ] }
// #[license] // SmartsheetClient SDK for C# // %% // Copyright (C) 2014 SmartsheetClient // %% // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // %[license] using System.Collections.Generic; namespace Smartsheet.Api.Internal { using Api.Models; using System.Text; /// <summary> /// This is the implementation of the TemplateResources. /// /// Thread Safety: This class is thread safe because it is immutable and its base class is thread safe. /// </summary> public class TemplateResourcesImpl : AbstractResources, TemplateResources { /// <summary> /// Constructor. /// /// Exceptions: - IllegalArgumentException : if any argument is /// </summary> /// <param name="smartsheet"> the Smartsheet </param> public TemplateResourcesImpl(SmartsheetImpl smartsheet) : base(smartsheet) { } /// <summary> /// <para>Gets the list of public Templates to which the user has access.</para> /// <remarks>This operation supports pagination of results. For more information, see Paging.</remarks> /// <para>It mirrors to the following Smartsheet REST API method: GET /templates/public</para> /// </summary> /// <returns> the list of Templates (note that an empty list will be returned if there are none). </returns> /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception> /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception> /// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception> /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception> /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception> /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception> public virtual PaginatedResult<Template> ListPublicTemplates(PaginationParameters paging) { StringBuilder path = new StringBuilder("templates/public"); if (paging != null) { path.Append(paging.ToQueryString()); } return this.ListResourcesWithWrapper<Template>(path.ToString()); } /// <summary> /// <para>Gets the list of user-created Templates to which the user has access.</para> /// <remarks>This operation supports pagination of results. For more information, see Paging.</remarks> /// <para>It mirrors to the following Smartsheet REST API method: GET /templates</para> /// </summary> /// <returns> the list of Templates (note that an empty list will be returned if there are none). </returns> /// <exception cref="System.InvalidOperationException"> if any argument is null or empty string </exception> /// <exception cref="InvalidRequestException"> if there is any problem with the REST API request </exception> /// <exception cref="AuthorizationException"> if there is any problem with the REST API authorization (access token) </exception> /// <exception cref="ResourceNotFoundException"> if the resource cannot be found </exception> /// <exception cref="ServiceUnavailableException"> if the REST API service is not available (possibly due to rate limiting) </exception> /// <exception cref="SmartsheetException"> if there is any other error during the operation </exception> public virtual PaginatedResult<Template> ListUserCreatedTemplates(PaginationParameters paging) { StringBuilder path = new StringBuilder("templates"); if (paging != null) { path.Append(paging.ToQueryString()); } return this.ListResourcesWithWrapper<Template>(path.ToString()); } } }
{ "content_hash": "b8a0891478e106f78aac82cab1535347", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 144, "avg_line_length": 52.67045454545455, "alnum_prop": 0.6627831715210356, "repo_name": "smartsheet-platform/smartsheet-csharp-sdk", "id": "a60f096c69af74dcf7812660366e19e6bd5b8928", "size": "4637", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "main/Smartsheet/Api/Internal/TemplateResourcesImpl.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1070" }, { "name": "C#", "bytes": "1798005" }, { "name": "Shell", "bytes": "864" } ] }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title> Module: Concurrent::ErlangActor::FunctionShortcuts &mdash; Concurrent Ruby </title> <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> pathId = "Concurrent::ErlangActor::FunctionShortcuts"; relpath = '../../'; </script> <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script> <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script> </head> <body> <div class="nav_wrap"> <iframe id="nav" src="../../class_list.html?1"></iframe> <div id="resizer"></div> </div> <div id="main" tabindex="-1"> <div id="header"> <div id="menu"> <a href="../../_index.html">Index (F)</a> &raquo; <span class='title'><span class='object_link'><a href="../../Concurrent.html" title="Concurrent (module)">Concurrent</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../ErlangActor.html" title="Concurrent::ErlangActor (module)">ErlangActor</a></span></span> &raquo; <span class="title">FunctionShortcuts</span> </div> <div id="search"> <a class="full_list_link" id="class_list_link" href="../../class_list.html"> <svg width="24" height="24"> <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect> <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect> <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect> </svg> </a> </div> <div class="clear"></div> </div> <div id="content"><h1>Module: Concurrent::ErlangActor::FunctionShortcuts </h1> <div class="box_info"> <dl> <dt>Included in:</dt> <dd><span class='object_link'><a href="../ErlangActor.html" title="Concurrent::ErlangActor (module)">Concurrent::ErlangActor</a></span></dd> </dl> <dl> <dt>Defined in:</dt> <dd>lib-edge/concurrent/edge/erlang_actor.rb</dd> </dl> </div> <h2>Overview</h2><div class="docstring"> <div class="discussion"> <p>Constrains shortcuts for methods in <span class='object_link'><a href="Functions.html" title="Concurrent::ErlangActor::Functions (module)">Functions</a></span>.</p> </div> </div> <div class="tags"> </div> <h2> Instance Method Summary <small><a href="#" class="summary_toggle">collapse</a></small> </h2> <ul class="summary"> <li class="public "> <span class="summary_signature"> <a href="#spawn-instance_method" title="#spawn (instance method)">#<strong>spawn</strong>(*args, &amp;body) &#x21d2; Pid </a> </span> <span class="summary_desc"><div class='inline'><p>Optionally included shortcut method for <span class='object_link'><a href="Functions.html#spawn_actor-instance_method" title="Concurrent::ErlangActor::Functions#spawn_actor (method)">Concurrent::ErlangActor::Functions#spawn_actor</a></span>.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> <a href="#terminate-instance_method" title="#terminate (instance method)">#<strong>terminate</strong>(pid, reason) &#x21d2; true </a> </span> <span class="summary_desc"><div class='inline'><p>Optionally included shortcut method for <span class='object_link'><a href="Functions.html#terminate_actor-instance_method" title="Concurrent::ErlangActor::Functions#terminate_actor (method)">Concurrent::ErlangActor::Functions#terminate_actor</a></span>.</p> </div></span> </li> </ul> <div id="instance_method_details" class="method_details_list"> <h2>Instance Method Details</h2> <div class="method_details first"> <h3 class="signature first" id="spawn-instance_method"> #<strong>spawn</strong>(*args, &amp;body) &#x21d2; <tt><span class='object_link'><a href="Pid.html" title="Concurrent::ErlangActor::Pid (class)">Pid</a></span></tt> </h3><div class="docstring"> <div class="discussion"> <p>Optionally included shortcut method for <span class='object_link'><a href="Functions.html#spawn_actor-instance_method" title="Concurrent::ErlangActor::Functions#spawn_actor (method)">Concurrent::ErlangActor::Functions#spawn_actor</a></span></p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt><span class='object_link'><a href="Pid.html" title="Concurrent::ErlangActor::Pid (class)">Pid</a></span></tt>)</span> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 534 535 536</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib-edge/concurrent/edge/erlang_actor.rb', line 534</span> <span class='kw'>def</span> <span class='id identifier rubyid_spawn'>spawn</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span> <span class='id identifier rubyid_spawn_actor'>spawn_actor</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="terminate-instance_method"> #<strong>terminate</strong>(pid, reason) &#x21d2; <tt>true</tt> </h3><div class="docstring"> <div class="discussion"> <p>Optionally included shortcut method for <span class='object_link'><a href="Functions.html#terminate_actor-instance_method" title="Concurrent::ErlangActor::Functions#terminate_actor (method)">Concurrent::ErlangActor::Functions#terminate_actor</a></span></p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>true</tt>)</span> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 540 541 542</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib-edge/concurrent/edge/erlang_actor.rb', line 540</span> <span class='kw'>def</span> <span class='id identifier rubyid_terminate'>terminate</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span><span class='rparen'>)</span> <span class='id identifier rubyid_terminate_actor'>terminate_actor</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_blank">yard</a>. </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-57940973-1', 'auto'); ga('send', 'pageview'); </script> </div> </body> </html>
{ "content_hash": "d0e7201dda8c4e1a067a83d226449483", "timestamp": "", "source": "github", "line_count": 298, "max_line_length": 324, "avg_line_length": 26.949664429530202, "alnum_prop": 0.61524094135226, "repo_name": "lucasallan/concurrent-ruby", "id": "8cee9fcc2973748c5a4c5681b72839f0cce1a04a", "size": "8031", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "docs/1.1.5/Concurrent/ErlangActor/FunctionShortcuts.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "10947" }, { "name": "CSS", "bytes": "2150" }, { "name": "HTML", "bytes": "640" }, { "name": "Java", "bytes": "402083" }, { "name": "Ruby", "bytes": "1144399" }, { "name": "Shell", "bytes": "585" } ] }
#include "Vajra/Common/Pool/Chunk.h" #include "Vajra/Framework/Core/Framework.h" #include "Vajra/Framework/Logging/Logger.h" #include "Vajra/Utilities/Utilities.h" #include <deque> #if USING_MULTITHREADING_SUPPORT_FOR_POOLS #include <boost/thread/thread.hpp> #include <boost/thread/mutex.hpp> #endif // USING_MULTITHREADING_SUPPORT_FOR_POOLS #define POOL_SIZE_INCREMENT 1000 #define POOL_SIZE_LOW_THRESHOLD 100 // Forward Declarations: template <class TMeat> class ManagedChunk; template <class TMeat> class Pool { public: Pool(); ~Pool(); ManagedChunk<TMeat> GetManagedChunk(); void ReleaseChunk(Chunk<TMeat>* _chunk); int GetFreeCount() { return this->chunks_free.size(); } int GetInuseCount() { return this->chunks_inuse; } private: std::deque<Chunk<TMeat>*> chunks_free; #if USING_MULTITHREADING_SUPPORT_FOR_POOLS boost::mutex chunks_free_mutex; #endif // USING_MULTITHREADING_SUPPORT_FOR_POOLS int chunks_inuse; // Utility Functions: void makeMoreChunks(); }; //////////////////////////////////////////////////////////////////////////////// template <class TMeat> Pool<TMeat>::Pool() { // FRAMEWORK->GetLogger()->dbglog("\nInitializing Pool ..."); this->chunks_inuse = 0; #if USING_MULTITHREADING_SUPPORT_FOR_POOLS boost::mutex::scoped_lock lock_on_chunks_free_queue (this->chunks_free_mutex); #endif // USING_MULTITHREADING_SUPPORT_FOR_POOLS // Create an initial pool: this->makeMoreChunks(); #if USING_MULTITHREADING_SUPPORT_FOR_POOLS // Scoped lock on this->chunks_free_mutex falls off #endif // USING_MULTITHREADING_SUPPORT_FOR_POOLS } template <class TMeat> Pool<TMeat>::~Pool() { // FRAMEWORK->GetLogger()->dbglog("\nDestroying Pool ..."); // Free the pools: for (auto chunk_it = this->chunks_free.begin (); chunk_it != this->chunks_free.end (); ++chunk_it) { Chunk<TMeat>* chunk = (*chunk_it); delete chunk; } this->chunks_free.clear (); } template <class TMeat> ManagedChunk<TMeat> Pool<TMeat>::GetManagedChunk() { #if USING_MULTITHREADING_SUPPORT_FOR_POOLS boost::mutex::scoped_lock lock_on_chunks_free_queue (this->chunks_free_mutex); #endif // USING_MULTITHREADING_SUPPORT_FOR_POOLS if (this->chunks_free.size () == 0) { // Out of free chunks; must make more this->makeMoreChunks (); } // ASSERT (this->chunks_free.size () != 0, "No more chunks"); Chunk<TMeat>* chunk = this->chunks_free.front (); this->chunks_free.pop_front (); if (this->chunks_free.size () < POOL_SIZE_LOW_THRESHOLD) { // Low on free chunks; must make more this->makeMoreChunks (); } this->chunks_inuse++; ManagedChunk<TMeat> mchunk(chunk); return (mchunk); #if USING_MULTITHREADING_SUPPORT_FOR_POOLS // Scoped lock on this->chunks_free_mutex falls off #endif // USING_MULTITHREADING_SUPPORT_FOR_POOLS } template <class TMeat> void Pool<TMeat>::ReleaseChunk(Chunk<TMeat>* _chunk) { // FRAMEWORK->GetLogger()->dbglog("\nIn pool: Moving chunk to free list"); #if USING_MULTITHREADING_SUPPORT_FOR_POOLS boost::mutex::scoped_lock lock_on_chunks_free_queue (this->chunks_free_mutex); #endif // USING_MULTITHREADING_SUPPORT_FOR_POOLS this->chunks_free.push_back (_chunk); ASSERT(this->chunks_inuse > 0, "chunks_inuse > 0"); this->chunks_inuse--; #if USING_MULTITHREADING_SUPPORT_FOR_POOLS // Scoped lock on this->chunks_free_mutex falls off #endif // USING_MULTITHREADING_SUPPORT_FOR_POOLS } template <class TMeat> void Pool<TMeat>::makeMoreChunks() { FRAMEWORK->GetLogger()->dbglog("\nLow on chunks, making %d more", POOL_SIZE_INCREMENT); // Create a pool of size POOL_SIZE_INCREMENT and add them all to the free list: for (int i = 0; i < POOL_SIZE_INCREMENT; i++) { TMeat* meat = new TMeat(); Chunk<TMeat>* chunk = new Chunk<TMeat>(); chunk->SetMeat(meat); chunk->SetPool(this); this->chunks_free.push_back(chunk); } } #endif // Pool_h__
{ "content_hash": "c50288c147620240a310a645f780e1dd", "timestamp": "", "source": "github", "line_count": 139, "max_line_length": 101, "avg_line_length": 28.48201438848921, "alnum_prop": 0.6734023743369538, "repo_name": "VajraFramework/Vajra", "id": "320ada811920c75332ffd791cdc65a89d5ebcf54", "size": "3995", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "VajraFramework/Vajra/Common/Pool/Pool.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "2230562" }, { "name": "C++", "bytes": "3118847" }, { "name": "D", "bytes": "117493" }, { "name": "Java", "bytes": "21196" }, { "name": "Objective-C", "bytes": "1771" }, { "name": "Objective-C++", "bytes": "24327" }, { "name": "Perl", "bytes": "466" }, { "name": "Shell", "bytes": "11992" } ] }
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="semi_transparent">#ee404040</color> <color name="yellow1">#ffbb33</color> <color name="buttonStroke">#ee404040</color> <color name="buttonNormal1">#ffcc00</color> <!-- top --> <color name="buttonNormal2">#996600</color> <!-- bottom --> <color name="buttonPressed1">#996600</color> <color name="buttonPressed2">#ffcc00</color> <color name="buttonFocused1">#ffcc00</color> <color name="buttonFocused2">#ffcc00</color> </resources>
{ "content_hash": "785f090d08d992284fd4c9bf2b0e9261", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 63, "avg_line_length": 37.857142857142854, "alnum_prop": 0.6622641509433962, "repo_name": "Kaljurand/Inimesed", "id": "60ad02d9156eddbc98321274e1a38991764a2d2c", "size": "530", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/res/values/colors.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "45372" }, { "name": "CSS", "bytes": "432" }, { "name": "HTML", "bytes": "13856" }, { "name": "Java", "bytes": "79164" }, { "name": "Makefile", "bytes": "4455" } ] }
# common SHELL := /bin/bash BUILDPATH=$(CURDIR) MAKEPATH=$(BUILDPATH)/make MAKEDEVPATH=$(MAKEPATH)/dev SRCPATH=./src TOOLSPATH=$(BUILDPATH)/tools CHECKENVCMD=checkenv.sh DEVFLAG=true # docker parameters DOCKERCMD=$(shell which docker) DOCKERBUILD=$(DOCKERCMD) build DOCKERRMIMAGE=$(DOCKERCMD) rmi DOCKERIMASES=$(DOCKERCMD) images # binary ADMINSERVERSOURCECODE=$(SRCPATH)/adminserver ADMINSERVERBINARYPATH=$(MAKEDEVPATH)/adminserver ADMINSERVERBINARYNAME=harbor_adminserver UISOURCECODE=$(SRCPATH)/ui UIBINARYPATH=$(MAKEDEVPATH)/ui UIBINARYNAME=harbor_ui JOBSERVICESOURCECODE=$(SRCPATH)/jobservice JOBSERVICEBINARYPATH=$(MAKEDEVPATH)/jobservice JOBSERVICEBINARYNAME=harbor_jobservice # photon dockerfile DOCKERFILEPATH=$(MAKEPATH)/photon DOCKERFILEPATH_ADMINSERVER=$(DOCKERFILEPATH)/adminserver DOCKERFILENAME_ADMINSERVER=Dockerfile DOCKERIMAGENAME_ADMINSERVER=vmware/harbor-adminserver DOCKERFILEPATH_UI=$(DOCKERFILEPATH)/ui DOCKERFILENAME_UI=Dockerfile DOCKERIMAGENAME_UI=vmware/harbor-ui DOCKERFILEPATH_JOBSERVICE=$(DOCKERFILEPATH)/jobservice DOCKERFILENAME_JOBSERVICE=Dockerfile DOCKERIMAGENAME_JOBSERVICE=vmware/harbor-jobservice DOCKERFILEPATH_LOG=$(DOCKERFILEPATH)/log DOCKERFILENAME_LOG=Dockerfile DOCKERIMAGENAME_LOG=vmware/harbor-log # version prepare VERSIONFILEPATH=$(SRCPATH)/views/sections VERSIONFILENAME=header-content.htm GITCMD=$(shell which git) GITTAG=$(GITCMD) describe --tags ifeq ($(DEVFLAG), true) VERSIONTAG=dev else VERSIONTAG=$(shell $(GITTAG)) endif check_environment: @$(MAKEPATH)/$(CHECKENVCMD) build: @echo "building adminserver container for photon..." $(DOCKERBUILD) -f $(DOCKERFILEPATH_ADMINSERVER)/$(DOCKERFILENAME_ADMINSERVER) -t $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) . @echo "Done." @echo "building ui container for photon..." $(DOCKERBUILD) -f $(DOCKERFILEPATH_UI)/$(DOCKERFILENAME_UI) -t $(DOCKERIMAGENAME_UI):$(VERSIONTAG) . @echo "Done." @echo "building jobservice container for photon..." $(DOCKERBUILD) -f $(DOCKERFILEPATH_JOBSERVICE)/$(DOCKERFILENAME_JOBSERVICE) -t $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) . @echo "Done." @echo "building log container for photon..." $(DOCKERBUILD) -f $(DOCKERFILEPATH_LOG)/$(DOCKERFILENAME_LOG) -t $(DOCKERIMAGENAME_LOG):$(VERSIONTAG) . @echo "Done." cleanimage: @echo "cleaning image for photon..." - $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) - $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_UI):$(VERSIONTAG) - $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) - $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_LOG):$(VERSIONTAG) .PHONY: clean clean: cleanimage
{ "content_hash": "12c9e7c3df1e615cc361aa8fb527f1c7", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 128, "avg_line_length": 32.26190476190476, "alnum_prop": 0.7523985239852399, "repo_name": "wemeya/harbor", "id": "1b7673ed51ed36f2edf20c9fb962e5600f82b862", "size": "2861", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "make/photon/Makefile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "14241" }, { "name": "Go", "bytes": "899522" }, { "name": "HTML", "bytes": "88906" }, { "name": "JavaScript", "bytes": "6732" }, { "name": "Makefile", "bytes": "21921" }, { "name": "Python", "bytes": "66184" }, { "name": "Shell", "bytes": "27728" }, { "name": "Smarty", "bytes": "5128" }, { "name": "TypeScript", "bytes": "610148" } ] }
// ----------------------------------------------------------------------------------------- // <copyright file="StorageAuthenticationHttpHandler.Token.cs" company="Microsoft"> // Copyright 2013 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // </copyright> // ----------------------------------------------------------------------------------------- namespace Microsoft.WindowsAzure.Storage.Auth.Protocol { using Microsoft.WindowsAzure.Storage.Core; using Microsoft.WindowsAzure.Storage.Core.Auth; using Microsoft.WindowsAzure.Storage.Core.Util; using Microsoft.WindowsAzure.Storage.Shared.Protocol; using System; using System.Globalization; using System.Net.Http; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; partial class StorageAuthenticationHttpHandler { private Task<HttpResponseMessage> GetTokenAuthenticationTask(StorageRequestMessage request, CancellationToken cancellationToken) { StorageRequestMessage storageRequest = request as StorageRequestMessage; StorageCredentials credentials = storageRequest.Credentials; if (!request.Headers.Contains(Constants.HeaderConstants.Date)) { string dateString = HttpWebUtility.ConvertDateTimeToHttpString(DateTimeOffset.UtcNow); request.Headers.Add(Constants.HeaderConstants.Date, dateString); } if (!"https".Equals(storageRequest.RequestUri.Scheme, StringComparison.OrdinalIgnoreCase)) { throw new InvalidOperationException(SR.OnlyHttpsIsSupportedForTokenCredential); } if (credentials.IsToken) { request.Headers.Add( "Authorization", string.Format(CultureInfo.InvariantCulture, "Bearer {0}", credentials.TokenCredential.Token)); } return base.SendAsync(request, cancellationToken); } } }
{ "content_hash": "38595d9e0cf6bc1c11587ec6dc8154f6", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 136, "avg_line_length": 43.54237288135593, "alnum_prop": 0.6414947450369793, "repo_name": "erezvani1529/azure-storage-net", "id": "ae9c64d4426df10180eef1a499b3475ce5c9813e", "size": "2571", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Lib/WindowsRuntime/Auth/Protocol/StorageAuthenticationHttpHandler.Token.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "291" }, { "name": "C#", "bytes": "15689345" } ] }
package com.intellij.uiDesigner.propertyInspector; import com.intellij.designer.DesignerEditorPanelFacade; import com.intellij.designer.LightToolWindow; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.wm.ToolWindowAnchor; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.impl.content.ToolWindowContentUi; import com.intellij.ui.content.Content; import com.intellij.ui.content.ContentManager; import com.intellij.uiDesigner.AbstractToolWindowManager; import com.intellij.uiDesigner.UIDesignerBundle; import com.intellij.uiDesigner.designSurface.GuiEditor; import icons.UIDesignerIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * @author Alexander Lobas */ public class DesignerToolWindowManager extends AbstractToolWindowManager implements Disposable { private final DesignerToolWindow myToolWindowPanel; public DesignerToolWindowManager(Project project, FileEditorManager fileEditorManager) { super(project, fileEditorManager); myToolWindowPanel = ApplicationManager.getApplication().isHeadlessEnvironment() ? null : new DesignerToolWindow(project); if (myToolWindowPanel != null) { Disposer.register(this, () -> myToolWindowPanel.dispose()); } } public static DesignerToolWindow getInstance(GuiEditor designer) { DesignerToolWindowManager manager = getInstance(designer.getProject()); if (manager.isEditorMode()) { return (DesignerToolWindow)manager.getContent(designer); } return manager.myToolWindowPanel; } public static DesignerToolWindowManager getInstance(Project project) { return project.getComponent(DesignerToolWindowManager.class); } @Nullable public GuiEditor getActiveFormEditor() { return (GuiEditor)getActiveDesigner(); } @Override protected void initToolWindow() { myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(UIDesignerBundle.message("toolwindow.ui.designer.name"), false, getAnchor(), myProject, true); myToolWindow.setIcon(UIDesignerIcons.ToolWindowUIDesigner); if (!ApplicationManager.getApplication().isHeadlessEnvironment()) { myToolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true"); } initGearActions(); ContentManager contentManager = myToolWindow.getContentManager(); Content content = contentManager.getFactory() .createContent(myToolWindowPanel.getToolWindowPanel(), UIDesignerBundle.message("toolwindow.ui.designer.title"), false); content.setCloseable(false); content.setPreferredFocusableComponent(myToolWindowPanel.getComponentTree()); contentManager.addContent(content); contentManager.setSelectedContent(content, true); myToolWindow.setAvailable(false, null); } @Override protected void updateToolWindow(@Nullable DesignerEditorPanelFacade designer) { myToolWindowPanel.update((GuiEditor)designer); if (designer == null) { myToolWindow.setAvailable(false, null); } else { myToolWindow.setAvailable(true, null); myToolWindow.show(null); } } @Override protected ToolWindowAnchor getAnchor() { return ToolWindowAnchor.LEFT; } @Override protected LightToolWindow createContent(@NotNull DesignerEditorPanelFacade designer) { DesignerToolWindow toolWindowContent = new DesignerToolWindow(myProject); toolWindowContent.update((GuiEditor)designer); return createContent(designer, toolWindowContent, UIDesignerBundle.message("toolwindow.ui.designer.title"), UIDesignerIcons.ToolWindowUIDesigner, toolWindowContent.getToolWindowPanel(), toolWindowContent.getComponentTree(), 320, null); } @NotNull @Override public String getComponentName() { return "UIDesignerToolWindowManager"; } }
{ "content_hash": "e8e5cb6b2ba558195b032bce2a31cd3f", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 135, "avg_line_length": 37.21739130434783, "alnum_prop": 0.741822429906542, "repo_name": "mglukhikh/intellij-community", "id": "5dcc8acebf30a62a1d5f6993fe0b7007003c3631", "size": "4880", "binary": false, "copies": "14", "ref": "refs/heads/master", "path": "plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/DesignerToolWindowManager.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AMPL", "bytes": "20665" }, { "name": "AspectJ", "bytes": "182" }, { "name": "Batchfile", "bytes": "60827" }, { "name": "C", "bytes": "211435" }, { "name": "C#", "bytes": "1264" }, { "name": "C++", "bytes": "197674" }, { "name": "CMake", "bytes": "1675" }, { "name": "CSS", "bytes": "201445" }, { "name": "CoffeeScript", "bytes": "1759" }, { "name": "Erlang", "bytes": "10" }, { "name": "Groovy", "bytes": "3243028" }, { "name": "HLSL", "bytes": "57" }, { "name": "HTML", "bytes": "1899088" }, { "name": "J", "bytes": "5050" }, { "name": "Java", "bytes": "165554704" }, { "name": "JavaScript", "bytes": "570364" }, { "name": "Jupyter Notebook", "bytes": "93222" }, { "name": "Kotlin", "bytes": "4611299" }, { "name": "Lex", "bytes": "147047" }, { "name": "Makefile", "bytes": "2352" }, { "name": "NSIS", "bytes": "51276" }, { "name": "Objective-C", "bytes": "27861" }, { "name": "Perl", "bytes": "903" }, { "name": "Perl 6", "bytes": "26" }, { "name": "Protocol Buffer", "bytes": "6680" }, { "name": "Python", "bytes": "25439881" }, { "name": "Roff", "bytes": "37534" }, { "name": "Ruby", "bytes": "1217" }, { "name": "Scala", "bytes": "11698" }, { "name": "Shell", "bytes": "66341" }, { "name": "Smalltalk", "bytes": "338" }, { "name": "TeX", "bytes": "25473" }, { "name": "Thrift", "bytes": "1846" }, { "name": "TypeScript", "bytes": "9469" }, { "name": "Visual Basic", "bytes": "77" }, { "name": "XSLT", "bytes": "113040" } ] }
<?php // Check for empty fields if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['message']) || !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL)) { echo "No arguments Provided!"; return false; } $name = $_POST['name']; $email_address = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; // Create the email and send the message $to = 'nj.wallace@outlook.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to. $email_subject = "Website Contact Form: $name"; $email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message"; $headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com. $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); return true; ?>
{ "content_hash": "9478a36a66ea4982c65b5de5fc3086d2", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 187, "avg_line_length": 42.15384615384615, "alnum_prop": 0.6742700729927007, "repo_name": "CrocoNiall/CrocoNiall.co.uk", "id": "8f9910b36c017d771ee9cf3b7bcd325d832ea6f1", "size": "1096", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "mail/contact_me.php", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "127235" }, { "name": "HTML", "bytes": "27650" }, { "name": "JavaScript", "bytes": "43232" }, { "name": "PHP", "bytes": "1132" } ] }
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { LoginComponent } from './login.component'; describe('LoginComponent', () => { let component: LoginComponent; let fixture: ComponentFixture<LoginComponent>; beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [ LoginComponent ] }) .compileComponents(); }); beforeEach(() => { fixture = TestBed.createComponent(LoginComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); });
{ "content_hash": "e7377de294497b41d94221b04dbc2b94", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 66, "avg_line_length": 23.846153846153847, "alnum_prop": 0.667741935483871, "repo_name": "sadlil/archiva", "id": "2f92cf4f59bbd5e19838f7d0a72d5fca428f8c35", "size": "1422", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "archiva-modules/archiva-web/archiva-webapp/src/main/archiva-web/src/app/modules/shared/login/login.component.spec.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AGS Script", "bytes": "27" }, { "name": "Batchfile", "bytes": "948" }, { "name": "CSS", "bytes": "193266" }, { "name": "Dockerfile", "bytes": "3302" }, { "name": "Groovy", "bytes": "8937" }, { "name": "HTML", "bytes": "315360" }, { "name": "Java", "bytes": "7001198" }, { "name": "JavaScript", "bytes": "830548" }, { "name": "Mustache", "bytes": "12049" }, { "name": "PowerShell", "bytes": "7011" }, { "name": "SCSS", "bytes": "26549" }, { "name": "Shell", "bytes": "31357" }, { "name": "TypeScript", "bytes": "334037" } ] }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Scheduler { public class RuntimeActivity : IRuntimeActivity { ScheduleActivity _activity; public RuntimeActivity(ScheduleActivity act) { _activity = act; } public string Name { get { return _activity.Name; } } public System.Drawing.Color Color { get { return _activity.Color; } } public Guid ID { get { return _activity.ID; } } public int Duration { get { return _activity.Duration; } } public int MaxPlannedDuration { get { return _activity.MaxPlannedDuration; } } public ResourceRequired Resources { get { return _activity.Resources; } } public int PlannedStart { get { return _activity.PlannedStart; } } public int PlannedDuration { get { return _activity.PlannedDuration; } } public Dictionary<string, int[]> Reservations { get { return _activity.Reservations; } } public Status Status { get { return _activity.Status; } } } }
{ "content_hash": "58e3992cd65e7af6d820d8635a71d39e", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 56, "avg_line_length": 20.53030303030303, "alnum_prop": 0.5151291512915129, "repo_name": "weihuajiang/SchedulerEngineDotNet", "id": "bdb8f19ac26a952751589297a145a87cb4949459", "size": "1357", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "SchedulerLib/definition/RuntimeActivity.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "184498" } ] }
<div> <img src="https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/ADnD%202E%20Revised/img/sheet-logo.png" style="max-height: 70px;" alt="AD&D Logo"/> <input type="text" name="attr_version" class="sheet-version-right" readonly/> </div> <br> insert_changelog.html <br> <input type="radio" name="attr_tab11" class="sheet-tab sheet-tab1" value="1" checked/><span class="sheet-tab sheet-tab1">Character Sheet</span>&nbsp; <input type="radio" name="attr_tab11" class="sheet-tab sheet-tab2" value="2"/><span class="sheet-tab sheet-tab2">Monster Sheet</span>&nbsp; <input type="radio" name="attr_tab11" class="sheet-tab sheet-tab85" value="3"/><span class="sheet-tab sheet-tab85">Sheet Settings</span> <br> <br> insert_character-tab.html insert_monster-tab.html insert_sheet-settings.html <hr> <input type="checkbox" name="attr_toast" class="sheet-show-toast" value="1"> <div class="sheet-toast"> <button class="sheet-hide-toast" type="action" name="act_hide-toast">X</button> <input type="radio" name="attr_toast-content" class="sheet-show-toast-success" value="1"> <input type="radio" name="attr_toast-content" class="sheet-show-toast-info" value="2"> <input type="radio" name="attr_toast-content" class="sheet-show-toast-warning" value="3"> <input type="radio" name="attr_toast-content" class="sheet-show-toast-error" value="4"> <div class="sheet-success"> <input name="attr_toast-title-success" readonly> <br> <textarea name="attr_toast-message-success" style="width: 300px; height: 100px;" readonly></textarea> </div> <div class="sheet-info"> <input name="attr_toast-title-info" readonly> <br> <textarea name="attr_toast-message-info" style="width: 300px; height: 100px;" readonly></textarea> </div> <div class="sheet-warning"> <input name="attr_toast-title-warning" readonly> <br> <textarea name="attr_toast-message-warning" style="width: 300px; height: 100px;" readonly></textarea> </div> <div class="sheet-error"> <input name="attr_toast-title-error" readonly> <br> <textarea name="attr_toast-message-error" style="width: 300px; height: 100px;" readonly></textarea> </div> </div> insert_datalists.html insert_dynamicDatalists.html insert_rolltemplates.html <script type="text/worker"> insert_TheAaronSheet.js insert_abilityScores.js insert_weapons.js insert_rogueArmor.js insert_weaponProficiencies.js insert_nonweaponProficiencies.js insert_wizardSpells.js insert_priestSpells.js insert_sheetWorkers.js insert_version.js </script>
{ "content_hash": "d01e551d928fb1acda1b1d9b77c21b60", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 169, "avg_line_length": 33.278481012658226, "alnum_prop": 0.697984024343857, "repo_name": "chesster415/roll20-character-sheets", "id": "6f4053a418fa375786438f6a2906da86e5f0f7b9", "size": "2629", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ADnD 2E Revised/html/2ESheet-base.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "381" }, { "name": "CSS", "bytes": "30833417" }, { "name": "EJS", "bytes": "563554" }, { "name": "HTML", "bytes": "236704247" }, { "name": "JavaScript", "bytes": "6986861" }, { "name": "Less", "bytes": "79342" }, { "name": "Makefile", "bytes": "297" }, { "name": "Nunjucks", "bytes": "12443" }, { "name": "PowerShell", "bytes": "3522" }, { "name": "Pug", "bytes": "3314219" }, { "name": "Python", "bytes": "58000" }, { "name": "Rich Text Format", "bytes": "86823" }, { "name": "SCSS", "bytes": "2831837" }, { "name": "Sass", "bytes": "238384" }, { "name": "Shell", "bytes": "1455" }, { "name": "Stylus", "bytes": "702759" }, { "name": "TypeScript", "bytes": "169273" } ] }
import ElementWrapper from "../../../../../../lyts/lyts_core/view/components/ElementWrapper"; import {Route} from "../../../../../../lyts/lyts_core/view/Router"; import view from "./view"; import Page from "../../../../../../lyts/lyts_core/view/pages/page/Page"; import ly from "../../../../../../lyts/lyts_core/ly"; import console from "../../../../../../lyts/lyts_core/commons/console"; import DomCollection from "../../../../../../lyts/lyts_core/commons/storage/DomCollection"; export default class Page1 extends Page { // ------------------------------------------------------------------------ // f i e l d s // ------------------------------------------------------------------------ private readonly _button: ElementWrapper; private readonly _image: ElementWrapper; private readonly _dom_collection: DomCollection; // ------------------------------------------------------------------------ // c o n s t r u c t o r // ------------------------------------------------------------------------ constructor(route: Route) { super(route); this._button = super.getFirst("#" + this.uid + "_button"); this._image = super.getFirst("#" + this.uid + "_image"); this._dom_collection = new DomCollection("images"); } // ------------------------------------------------------------------------ // o v e r r i d e // ------------------------------------------------------------------------ protected render(): string { return view(this.uid, {}); } protected free(): void { // release memory this._button.removeEventListener(); console.log("REMOVED:", this.uid); } protected ready(): void { this.init(); } public show(): void { super.show(); } public hide(): void { super.hide(); } // ------------------------------------------------------------------------ // p u b l i c // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // p r i v a t e // ------------------------------------------------------------------------ private init(): void { try { // call debounced function this._button.addEventListener('click', ly.lang.funcDebounce(this, this.onButtonClick, 1000, true, 'param1')); } catch (err) { console.error("Page1.init()", err) } } private onButtonClick(ev: Event, param1: string) { ev.preventDefault(); console.log("Page1.doLogAction", ev, param1); ly.dom.ready(function () { const len: number = this._dom_collection.length; console.log('Page1.init', 'DomCollection length', len); if (len > 0) { const item: any = this._dom_collection.get("IMG_USER"); const src:string = item.value; if(!!src){ this._image.setAttribute('src', src); } else { console.warn('Page1.init()', 'item', item); } } }, this); } }
{ "content_hash": "a07126c5ca26ae685378065156075e83", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 121, "avg_line_length": 33.23300970873787, "alnum_prop": 0.37510955302366344, "repo_name": "angelogeminiani/ly", "id": "a184bf1f063e0df38259dbee6f99ffd8d0d4d2de", "size": "3423", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lyts_app_src/views/screens/screen2/pages/page1/Page1.ts", "mode": "33261", "license": "mit", "language": [ { "name": "HTML", "bytes": "279" }, { "name": "JavaScript", "bytes": "198765" }, { "name": "TypeScript", "bytes": "90560" } ] }
package com.creditease.dbus.extractor.container; import com.creditease.dbus.extractor.common.utils.Constants; import com.creditease.dbus.extractor.vo.SendStatusVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; public class MsgStatusContainer { protected Logger logger = LoggerFactory.getLogger(getClass()); private static MsgStatusContainer msgStatusContainer; // 10 mins private static final long timeout = 10 * 60 * 1000; //key是batchId private ConcurrentMap<Long, SendStatusVo> map = new ConcurrentHashMap<Long, SendStatusVo>(); private MsgStatusContainer() { } public static MsgStatusContainer getInstance() { if (msgStatusContainer == null) { synchronized (MsgStatusContainer.class) { if (msgStatusContainer == null) { msgStatusContainer = new MsgStatusContainer(); } } } return msgStatusContainer; } public int getSize() { return map.size(); } public void setTotal(long batchId, int totalSplit, boolean status) { SendStatusVo vo = null; synchronized (this) { vo = map.get(batchId); if (vo != null) { vo.setTotal(totalSplit); vo.setStatus(status); } else { vo = new SendStatusVo(); vo.setTotal(totalSplit); vo.setStatus(status); map.put(batchId, vo); } } } // 设置完成数据,不会添加新map项 public void setCompleted(long batchId, int completed) { SendStatusVo vo = null; synchronized (this) { vo = map.get(batchId); if (vo != null) { vo.setCompleted(vo.getCompleted() + 1); } } } // 设置失败情况,不会添加新map项 public void setError(long batchId, boolean isErr) { SendStatusVo vo = null; synchronized (this) { vo = map.get(batchId); if (vo != null) { vo.setError(isErr); } } } public void deleteMsg(long batchId) { synchronized (this) { map.remove(batchId); } } public void clear() { synchronized (this) { map.clear(); } } //从map中复制一份sendstatusvo对象完成状态到treeset中 //map的对象没有被修改 // treeset按照batchId进行排序 public Set<SendStatusVo> getNeedAckOrRollbackBatch() { Set<SendStatusVo> setRet = new TreeSet<SendStatusVo>(); SendStatusVo vo = null; Integer numNeedAcl = 0; Integer numNeedRollback = 0; Integer numNotCompleted = 0; for (Map.Entry<Long, SendStatusVo> entry : map.entrySet()) { vo = entry.getValue(); SendStatusVo voRet = new SendStatusVo(); voRet.setBatchId(entry.getKey()); //大于1分钟就打印节点状态, 用于调试状态 //if (System.currentTimeMillis() - vo.getCreateTime() > 60 * 1000) { // logger.info(vo.toString()); //} if (vo.getTotal() != 0 && vo.getCompleted() != 0 && !vo.isError() && vo.isStatus() && (vo.getTotal() <= vo.getCompleted())) { voRet.setResult(Constants.NEED_ACK_CANAL); numNeedAcl = numNeedAcl + 1; } else if ((System.currentTimeMillis() - vo.getCreateTime() > timeout) || vo.isError()) { voRet.setResult(Constants.NEED_ROLLBACK_CANAL); numNeedRollback = numNeedRollback + 1; } else { voRet.setResult(Constants.SEND_NOT_COMPLETED); numNotCompleted = numNotCompleted + 1; } setRet.add(voRet); } logger.debug("up to now, need ack canal number is {}, need rollback canal number is {}, not completed number is {}.", numNeedAcl, numNeedRollback, numNotCompleted); return setRet; } }
{ "content_hash": "11b580428095f457a472ec2d4c065613", "timestamp": "", "source": "github", "line_count": 133, "max_line_length": 125, "avg_line_length": 30.834586466165412, "alnum_prop": 0.5693733235796147, "repo_name": "BriData/DBus", "id": "cad8a4685dbd3ffa3beca42c3f7920b0eac63fb7", "size": "4879", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dbus-mysql-extractor/src/main/java/com/creditease/dbus/extractor/container/MsgStatusContainer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "49107" }, { "name": "HTML", "bytes": "341931" }, { "name": "Handlebars", "bytes": "8472" }, { "name": "Java", "bytes": "5178835" }, { "name": "JavaScript", "bytes": "1782672" }, { "name": "Less", "bytes": "29815" }, { "name": "PLSQL", "bytes": "5977" }, { "name": "Python", "bytes": "451391" }, { "name": "Ruby", "bytes": "279" }, { "name": "Shell", "bytes": "16088" } ] }
using Newtonsoft.Json; using RiotSharp.Endpoints.AccountEndpoint.Enums; using RiotSharp.Misc; namespace RiotSharp.Endpoints.AccountEndpoint { /// <summary> /// Class representing an activeShard. /// </summary> public class ActiveShardDto { internal ActiveShardDto() { } /// <summary> /// Encrypted PUUID. Exact length of 78 characters. /// </summary> [JsonProperty("puuid")] public string Puuid { get; set; } /// <summary> /// The game. /// </summary> [JsonProperty("game")] public Game Game { get; set; } /// <summary> /// Active shard for combination Puuid and Game. /// </summary> [JsonProperty("activeShard")] public Region ActiveShard { get; set; } } }
{ "content_hash": "ce49f449c3d9447a05ce02576c8a6a79", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 59, "avg_line_length": 25.46875, "alnum_prop": 0.5717791411042945, "repo_name": "BenFradet/RiotSharp", "id": "cc6a74708b527365e941b3ff13b13a2b3166f7c9", "size": "817", "binary": false, "copies": "2", "ref": "refs/heads/develop", "path": "RiotSharp/Endpoints/AccountEndpoint/ActiveShardDto.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "485835" } ] }
"""Custom helpers for working with Django Forms""" from django.template import Library register = Library() @register.inclusion_tag('partials/_form_field.html') def field_generator(field, hidden=0, help=1, custom_label='', custom_class='', inline_styles='', placeholder=''): """Returns a customized chunk of HTML for the given form field""" if custom_label: field.label = custom_label return {'field': field, 'hidden': hidden, 'help': help, 'custom_class': custom_class, 'inline_styles': inline_styles}
{ "content_hash": "0cba9bcdacf7c79be060c1d62c26bc9d", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 78, "avg_line_length": 35, "alnum_prop": 0.6589285714285714, "repo_name": "pwalsh/openbudgets", "id": "5466118d8b02b0b0109109100b3307399c05cd78", "size": "560", "binary": false, "copies": "7", "ref": "refs/heads/develop", "path": "openbudgets/commons/templatetags/form_extras.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "416780" }, { "name": "HTML", "bytes": "80612" }, { "name": "JavaScript", "bytes": "611104" }, { "name": "Makefile", "bytes": "523" }, { "name": "Python", "bytes": "478300" } ] }
<project name="mallet" default="compile" basedir="."> <description>A Machine Learning for Language Toolkit</description> <!-- Properties --> <property name="src" location="src"/> <property name="class" location="class"/> <property name="lib" location="lib"/> <property name="dist" location="dist"/> <property name="doc" location="doc/api"/> <property name="test" location="test"/> <property name="java_version" value="1.7"/> <property name="build.compiler" value="modern"/> <path id="project.classpath"> <pathelement path="${class}"/> <fileset dir="lib" includes="*.jar"/> </path> <path id="project.base.source.files"> <fileset dir="${src}" includes="cc/mallet/**/*.java"/> </path> <fileset id="project.resources" dir="${src}"> <include name="**/resources/*.*"/> <include name="**/*.properties"/> </fileset> <!-- Initialization --> <target name="init"> <!-- Create a time stamp --> <tstamp/> <!-- Create an output directory for class files --> <mkdir dir="${class}"/> <copy todir="${class}" overwrite="true" includeemptydirs="true"> <fileset refid="project.resources"/> </copy> <!-- Create an output directory for the final jar --> <mkdir dir="${dist}"/> <copy file="${lib}/mallet-deps.jar" todir="${dist}"/> <mkdir dir="${test}"/> </target> <!-- Target: compile --> <target name="compile" depends="init" description="Compile all the source files"> <javac source="${java_version}" target="${java_version}" destdir="${class}" classpathref="project.classpath" debug="true" deprecation="off" listfiles="no" > <src path="${src}"/> <include name="cc/**/*.java"/> <!-- compilerarg value="-Xlint:unchecked"/ --> </javac> </target> <!-- Target: doc {build javadoc API documentation} --> <target name="doc" depends="init" description="Build Javadoc API webpages for all the source files"> <javadoc destdir="${doc}" classpathref="project.classpath" author="true" version="true" use="true" windowtitle="Mallet 2 API" > <packageset dir="${src}" defaultexcludes="yes"> <include name="cc/mallet/**"/> </packageset> </javadoc> </target> <!-- Create a jar file --> <target name="jar" depends="compile"> <jar destfile="${dist}/mallet.jar" basedir="${class}"/> </target> <target name="test" depends="compile"> <junit printsummary="yes" > <classpath> <pathelement path="${class}"/> <fileset dir="lib" includes="*.jar"/> </classpath> <formatter type="plain"/> <!-- test name="cc.mallet.types.tests.TestInstanceListWeights" todir="${test}" /--> <batchtest fork="yes" todir="${test}"> <fileset dir="${src}"> <include name="**/*Test*.java"/> </fileset> </batchtest> </junit> </target> </project>
{ "content_hash": "40e7c6422f61628a50c6442bc2a7f909", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 89, "avg_line_length": 26.36283185840708, "alnum_prop": 0.581067472306143, "repo_name": "xiaohan2012/lst", "id": "1648735f41b8317c1a1513d2f2f876cc20173028", "size": "2979", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "external/mallet-2.0.8RC3/build.xml", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "23944" }, { "name": "JavaScript", "bytes": "12920" }, { "name": "Makefile", "bytes": "480" }, { "name": "Python", "bytes": "326635" }, { "name": "Shell", "bytes": "27798" } ] }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "a7faeb4bb9e6766209e960686f34e48e", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "b3e618b5d0cee10e9a93a1da14a12230088a5c63", "size": "183", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Chromista/Ochrophyta/Phaeophyceae/Ectocarpales/Chordariaceae/Phycocelis/README.md", "mode": "33188", "license": "apache-2.0", "language": [] }
package org.elasticsearch.hadoop.mr; import org.apache.hadoop.mapred.Reporter; import org.apache.hadoop.util.Progressable; import org.elasticsearch.hadoop.mr.compat.CompatHandler; import org.elasticsearch.hadoop.mr.compat.TaskInputOutputContext; import org.elasticsearch.hadoop.rest.stats.Stats; class ReportingUtils { // handles Hadoop 'old' and 'new' API reporting classes, namely {@link Reporter} and {@link TaskInputOutputContext} @SuppressWarnings({ "rawtypes" }) static void report(Progressable progressable, Stats stats) { progressable = (Progressable) CompatHandler.unwrap(progressable); if (progressable == null || progressable == Reporter.NULL) { return; } if (progressable instanceof Reporter) { Reporter reporter = (Reporter) progressable; for (Counter count : Counter.ALL) { oldApiCounter(reporter, count, count.get(stats)); } } if (progressable instanceof org.apache.hadoop.mapreduce.TaskInputOutputContext) { TaskInputOutputContext compatTioc = CompatHandler.taskInputOutputContext((org.apache.hadoop.mapreduce.TaskInputOutputContext) progressable); for (Counter count : Counter.ALL) { newApiCounter(compatTioc, count, count.get(stats)); } } } private static void oldApiCounter(Reporter reporter, Enum<?> counter, long value) { try { org.apache.hadoop.mapred.Counters.Counter c = reporter.getCounter(counter); if (c != null) { c.increment(value); } } catch (Exception ex) { // counter unavailable } } private static void newApiCounter(TaskInputOutputContext tioc, Enum<?> counter, long value) { try { org.apache.hadoop.mapreduce.Counter c = tioc.getCounter(counter); if (c != null) { CompatHandler.counter(c).increment(value); } } catch (Exception ex) { // counter unavailable } } }
{ "content_hash": "016221a8f11a9d88934767453b21c5dd", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 152, "avg_line_length": 36.59649122807018, "alnum_prop": 0.6347075743048898, "repo_name": "xjrk58/elasticsearch-hadoop", "id": "a94b87c0485cb008db872ac64d8aab7bf674bb1f", "size": "2874", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "mr/src/main/java/org/elasticsearch/hadoop/mr/ReportingUtils.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1913261" }, { "name": "Scala", "bytes": "432477" } ] }
/** * @module Fabric */ /// <reference path="fabricInterfaces.ts"/> /// <reference path="fabricGlobals.ts"/> /// <reference path="jolokiaHelpers.ts"/> /// <reference path="containerHelpers.ts"/> /// <reference path="schemaConfigure.ts"/> /// <reference path="../../git/js/gitHelpers.ts"/> /// <reference path="../../ui/js/dialog.ts"/> /// <reference path="../../wiki/js/wikiHelpers.ts"/> /// <reference path="iconRegistry.ts"/> /// <reference path="../../core/js/login.ts"/> module Fabric { export var OpenShiftCredentials = <Core.UserDetails> { username: null, password: null }; export function fabricCreated(workspace) { return workspace.treeContainsDomainAndProperties(Fabric.jmxDomain, {type: "Fabric"}); } export function canBootstrapFabric(workspace) { return hasClusterBootstrapManager(workspace); } export function hasClusterBootstrapManager(workspace) { return workspace.treeContainsDomainAndProperties(Fabric.jmxDomain, {type: "ClusterBootstrapManager"}); } export function hasClusterServiceManager(workspace) { return workspace.treeContainsDomainAndProperties(Fabric.jmxDomain, {type: "ClusterServiceManager"}); } export function hasZooKeeper(workspace) { return workspace.treeContainsDomainAndProperties(Fabric.jmxDomain, {type: "ZooKeeper"}); } export function hasOpenShiftFabric(workspace) { return workspace.treeContainsDomainAndProperties(Fabric.jmxDomain, {type: "OpenShift"}); } export function hasMQManager(workspace) { return workspace.treeContainsDomainAndProperties(Fabric.jmxDomain, {type: "MQManager"}); } export function hasSchemaMBean(workspace) { return workspace.treeContainsDomainAndProperties(schemaLookupDomain, {type: schemaLookupType}); } export function hasGitMBean(workspace) { return workspace.treeContainsDomainAndProperties(Git.jmxDomain, {type: Git.mbeanType}); } export function isFMCContainer(workspace) { var hasFabric = Fabric.hasFabric(workspace); var hasSchemaMBean = Fabric.hasSchemaMBean(workspace); var hasGitMBean = Fabric.hasGitMBean(workspace); return hasFabric && hasSchemaMBean && hasGitMBean; } export function hasFabric(workspace):boolean { // lets make sure we only have a fabric if we have // the ClusterServiceManager or ClusterBootstrapManager available // so that we hide Fabric for 6.0 or earlier of JBoss Fuse // which doesn't have the necessary mbeans for hawtio awesomeness return fabricCreated(workspace) && (hasClusterServiceManager(workspace) || hasClusterBootstrapManager(workspace) || hasZooKeeper(workspace)); } /** * Adds a bunch of common helper functions to the given scope * @method initScope * @for Fabric * @param {*} $scope * @param {ng.ILocationService} $location * @paran {*} jolokia * @param {Workspace} workspace */ export function initScope($scope:any, $location, jolokia, workspace) { // Let's avoid re-defining everything if the $scope // has already been initialized here if ($scope.fabricInitialized) { return; } else { $scope.fabricInitialized = true; } ContainerHelpers.decorate($scope, $location, jolokia); $scope.gotoProfile = (versionId:string, profileId:string) => { Fabric.gotoProfile(workspace, jolokia, workspace.localStorage, $location, versionId, profileId); }; $scope.refreshProfile = (versionId, profileId) => { log.debug('Refreshing profile: ' + profileId + '/' + versionId); if (!versionId || !profileId) { return; } jolokia.request({ type: 'exec', mbean: Fabric.managerMBean, operation: 'refreshProfile', arguments: [versionId, profileId] }, { method: 'POST', success: () => { Core.notification('success', 'Triggered refresh of profile ' + profileId + '/' + versionId); Core.$apply($scope); }, error: (response) => { log.warn('Failed to trigger refresh for profile ' + profileId + '/' + versionId + ' due to: ', response.error); log.info("Stack trace: ", response.stacktrace); Core.$apply($scope); } }) }; $scope.getVersionsToExclude = () => { if (!$scope.selectedContainers || $scope.selectedContainers.length === 0) { return []; } var answer = $scope.selectedContainers.map(c => c['versionId']); answer = answer.unique(); if (answer.length > 1) { return []; } else { return answer; } }; $scope.hasFabricWiki = () => { return Git.isGitMBeanFabric(workspace); }; $scope.createRequiredContainers = (profile) => { var profileId = profile.id; var args = {}; if (profileId) { args["profileIds"] = profileId; } var versionId = profile.versionId || profile.version; if (versionId) { args["versionId"] = versionId; } var requirements = profile.requirements; if (requirements) { var min = requirements.minimumInstances; if (min) { var delta = min - (profile.count || 0); if (delta > 1) { args["number"] = delta; } } } $location.url('/fabric/containers/createContainer').search(args); }; $scope.createContainer = () => { var kind:string = null; // lets see if there is an openshift option var providers = registeredProviders(jolokia); angular.forEach(["openshift", "docker", "jclouds"], (value) => { if (!kind && providers[value]) { kind = value; } }); if (!kind) { kind = 'child'; } $location.url('/fabric/containers/createContainer').search('tab', kind); }; $scope.createChildContainer = (container) => { if (!container.root || !container.alive) { return; } $location.url('/fabric/containers/createContainer').search({ 'tab': 'child', 'parentId': container.id }); }; $scope.showProfile = (profile) => { var version = profile.versionId || profile.version || $scope.activeVersionId; Fabric.gotoProfile(workspace, jolokia, localStorage, $location, version, profile); }; $scope.getSelectedClass = (obj) => { var answer = []; if (obj.selected) { answer.push('selected'); } if (angular.isDefined(obj['root']) && obj['root'] === false) { answer.push('child-container'); } return answer.join(' '); }; $scope.isEnsembleContainer = (containerId) => { if (angular.isArray($scope.ensembleContainerIds)) { return $scope.ensembleContainerIds.any(containerId); } return false; }; // for connection dialog $scope.connect = { dialog: new UI.Dialog(), saveCredentials: false, userName: null, password: null, container: null, view: null, onOK: () => { var userName = $scope.connect.userName; var password = $scope.connect.password; var userDetails = <Core.UserDetails> Core.injector.get('userDetails'); if (!userDetails.password) { // this can get unset if the user happens to refresh and hasn't checked rememberMe userDetails.password = password; } var container = <Fabric.Container>$scope.connect.container; if ($scope.connect.saveCredentials) { $scope.connect.saveCredentials = false; if (userName) { localStorage['fabric.userName'] = userName; } if (password) { localStorage['fabric.password'] = password; } } var options = Core.createConnectOptions({ jolokiaUrl: container.jolokiaUrl, userName: userName, password: password, useProxy: true, view: $scope.connect.view, name: container.id }); Core.connectToServer(localStorage, options); $scope.connect.container = {}; setTimeout(() => { $scope.connect.dialog.close(); Core.$apply($scope); }, 100); } }; $scope.doConnect = (container, view) => { if (!$scope.canConnect(container)) { return; } var userDetails = <Core.UserDetails> Core.injector.get('userDetails'); $scope.connect.userName = <any>(userDetails.remoteJolokiaUserDetails && userDetails.remoteJolokiaUserDetails.username ? userDetails.remoteJolokiaUserDetails.username : userDetails.username); $scope.connect.password = <any>(userDetails.remoteJolokiaUserDetails && userDetails.remoteJolokiaUserDetails.password ? userDetails.remoteJolokiaUserDetails.password : userDetails.password); $scope.connect.container = container; $scope.connect.view = view || "#/openlogs"; var alwaysPrompt = localStorage['fabricAlwaysPrompt']; if ((alwaysPrompt && alwaysPrompt !== "false") || !$scope.connect.userName || !$scope.connect.password) { $scope.connect.dialog.open(); } else { $scope.connect.onOK(); } }; // ids of containers being deleted, to prevent from issuing delete call more than once before we get any response // this "protection" is only $scope based $scope.deletePending = {}; $scope.deleteContainer = () => { if ($scope.selectedContainers.all((c) => { return !$scope.deletePending[c.id]; })) { $scope.confirmDeleteDialog.open(); } }; // is it possible to delete selected containers? no, if deletion of container didn't complete $scope.mayDelete = () => { return $scope.selectedContainers.length > 0 && $scope.selectedContainers.all((c) => { return !$scope.deletePending[c.id] && !c.root}); }; $scope.confirmDeleteDialog = { dialog: new UI.Dialog(), onOk: () => { $scope.confirmDeleteDialog.dialog.close(); if (angular.isDefined($scope.containerId)) { $scope.deletePending[$scope.containerId] = true; // avoid any nasty errors that the container doesn't existing anymore Core.unregister(jolokia, $scope); $location.path('/fabric/containers'); ContainerHelpers.doDeleteContainer($scope, jolokia, $scope.containerId, () => { delete $scope.deletePending[$scope.containerId]; }); } else if (angular.isDefined($scope.selectedContainers)) { $scope.selectedContainers.each((c) => { $scope.deletePending[c.id] = true; ContainerHelpers.doDeleteContainer($scope, jolokia, c.id, () => { delete $scope.deletePending[c.id]; }); }); } else { // bail... log.info("Asked to delete containers but no containerId or selectedContainers attributes available"); } }, open: () => { $scope.confirmDeleteDialog.dialog.open(); }, close: () => { $scope.confirmDeleteDialog.dialog.close(); } }; $scope.$watch('selectedContainers', (newValue, oldValue) => { if (newValue !== oldValue) { var num = $scope.selectedContainers.length; $scope.versionTitle = "Migrate " + Core.maybePlural(num, "Container") + " to:"; } }); $scope.onVersionChange = (version) => { var containerIds = []; if (angular.isDefined($scope.selectedContainers)) { containerIds = $scope.selectedContainers.map(c => c.id); } else if (angular.isDefined($scope.row)) { containerIds = [$scope.row.id]; } else { return; } log.info("Setting version to " + version + " on containers: " + containerIds); Fabric.migrateContainers(jolokia, version, containerIds, () => { Core.notification('success', "Initiated container migration to version <strong>" + version + "</strong>, changes make take some time to complete"); Core.$apply($scope); }, (response) => { log.error("Failed to migrate containers due to ", response.error); log.info("Stack trace: ", response.stacktrace); Core.$apply($scope); }); }; var verbose = workspace.localStorage['fabricVerboseNotifications']; $scope.fabricVerboseNotifications = verbose && verbose !== "false"; } export function viewVersion(versionId, $location, $scope) { var defaultTarget = '/wiki/branch/' + versionId + '/view/fabric/profiles'; var path:string = $location.path(); var branch = $scope.branch || $scope.$parent.branch; if (!path.startsWith('/wiki/branch/') || !branch) { $location.path(defaultTarget); } else { path = path.replace('/branch/' + branch, '/branch/' + versionId); $location.path(path); } } export function doCreateVersion($scope, jolokia, $location, newVersionName) { var success = function (response) { var newVersion = response.value.id; Core.notification('success', "Created version <strong>" + newVersion + "</strong>, switching to this new version"); // broadcast events to force reloads var $rootScope = $scope.$root || $scope.$rootScope || $scope; if ($rootScope) { $rootScope.$broadcast('wikiBranchesUpdated'); } viewVersion(newVersion, $location, $scope); Core.$apply($scope); }; var error = function (response) { log.error("Failed to create version due to :", response.error); log.info("stack trace: ", response.stacktrace); Core.$apply($scope); }; if (!Core.isBlank(newVersionName)) { Fabric.createVersionWithId(jolokia, newVersionName, success, error); } else { Fabric.createVersion(jolokia, success, error); } } export function sortVersions(versions, order:boolean) { return (versions || []).sortBy((v) => { var answer = parseFloat(v['id']); if (answer === NaN) { answer = v['id']; } return answer; }, order); } /** * Converts the given path from the wiki into a profile ID * @method pagePathToProfileId * @param {String} pageId * @return {String} */ export function pagePathToProfileId(pageId): string { var answer = null; if (angular.isDefined(pageId) && pageId.has(fabricTopLevel) && pageId !== fabricTopLevel) { var profileId = pageId.remove(fabricTopLevel); if ((Fabric.useDirectoriesInGit || !profileId.has("/"))) { var profileSeparator = profileId.indexOf(profileSuffix + "/"); var endsWithSuffix = profileId.endsWith(profileSuffix); if (!Fabric.useDirectoriesInGit || endsWithSuffix || profileSeparator > 0) { if (Fabric.useDirectoriesInGit) { if (endsWithSuffix) { profileId = Core.trimTrailing(profileId, profileSuffix); } else if (profileSeparator > 0) { profileId = profileId.substring(0, profileSeparator); } profileId = profileId.replace(/\//g, "-"); } answer = profileId; } } } return answer; } export function profilePath(profileId) { if (profileId) { return profileId.replace(/-/g, "/") + profileSuffix; } else { return null; } } export function profileLink(workspace, jolokia, localStorage, versionId, profileId) { var path; if (Wiki.isWikiEnabled(workspace, jolokia, localStorage)) { path = "/wiki/branch/" + versionId + "/view/fabric/profiles/" + Fabric.profilePath(profileId); } else { path = "/fabric/profile/" + versionId + "/" + profileId; } return path; } /** * Returns the CSS style for the number of containers badge * @method containerCountBadgeStyle * @param {Number} min * @param {Number} max * @param {number} count * @return {string} */ export function containerCountBadgeStyle(min, max, count) { if (!max || max == -1) { max = Number.MAX_VALUE; } if (!min) { min = 0; } if (!count) { return "badge-important"; } else { return min <= count && count <= max ? "badge-success" : "badge-warning"; } return ""; } export function gotoProfile(workspace, jolokia, localStorage, $location, versionId, profile:any) { var path = ''; if (angular.isString(profile)) { path = profileLink(workspace, jolokia, localStorage, versionId, profile); } else { path = profileLink(workspace, jolokia, localStorage, versionId, profile.id); } if (!Core.isBlank(path)) { $location.url(path); } } export function gotoContainer(containerId:string) { var $location = Core.injector.get('$location'); $location.path(UrlHelpers.join('/fabric/container', containerId)); } export function setSelect(selection, group) { if (!angular.isDefined(selection)) { return group[0]; } var answer = group.findIndex( function(item) { return item.id === selection.id } ); if (answer !== -1) { return group[answer]; } else { return group[0]; } } export var urlResolvers = ['http:', 'ftp:', 'mvn:']; export function completeUri ($q, $scope, workspace, jolokia, something) { } // TODO cache the current active version? Then clear the cached value if we delete it export function getActiveVersion($location) { return $location.search()['cv'] || "1.0"; } export interface IScopeWithApiURL extends ng.IScope { restApiUrl:string; }; /** * Loads the restApiUrl property into the given $scope and added the helper function */ export function loadRestApi(jolokia, workspace: Workspace, $scope:IScopeWithApiURL, callback:(response:any) => void = undefined) { if ($scope && !$scope.restApiUrl) { $scope.restApiUrl = DEFAULT_REST_API; } Fabric.restApiUrl(jolokia, (response) => { var answer: string = response.value || DEFAULT_REST_API; // if we are running inside a root fabric8 node then lets strip off the host and port // because on Docker / Kubernetes / OpenShift this could could be a port which is not // accessible to the browser if (Fabric.isFMCContainer(workspace)) { // lets strip the host/port from the URL try { var url = new URI(answer); var path = url.pathname(); if (path) { answer = path; response.value = answer; } } catch (e) { // ignore } // If we're proxying... var connectionName = Core.getConnectionNameParameter(location.search); if (connectionName) { var connectionOptions = Core.getConnectOptions(connectionName); if (connectionOptions) { connectionOptions.path = answer; answer = <string>Core.createServerConnectionUrl(connectionOptions); } } } if ($scope) { $scope.restApiUrl = answer; log.info("got REST API: " + $scope.restApiUrl); Core.$apply($scope); } if (callback) { callback(response); } }); } /** * Returns the fully qualified iconURL from the relative link */ export function toIconURL($scope, iconURL) { if (!iconURL) { return iconURL; } var components = iconURL.split('/'); var normalized = ""; components.each((c) => { normalized += '/'; if (/\.profile$/.test(c)) { var profileName = c.substr(0, c.length - 8); normalized += profileName.replace('-', '/') + ".profile"; } else { normalized += c; } }); iconURL = normalized.substr(1); var connectionName = Core.getConnectionNameParameter(location.search); if (connectionName) { // If we're proxying... var connectionOptions = Core.getConnectOptions(connectionName); if (connectionOptions && !/^proxy\/http/.test(iconURL)) { // relative URLs are prefixed with /<base>/git/ connectionOptions.path = /^\//.test(iconURL) ? iconURL : Core.url("/git/") + iconURL; iconURL = <string>Core.createServerConnectionUrl(connectionOptions); // Fix iconURL in cases where jolokia URL was already set. if (iconURL.endsWith('jolokia')) { iconURL = iconURL.replace('jolokia', connectionOptions.path); } } } else { // no proxy iconURL = /^\//.test(iconURL) ? iconURL : Core.url("/git/") + iconURL; } return iconURL; } export function getVersionsInUse(jolokia, callback:(used:string[]) => void) { doAction('containers(java.util.List, java.util.List)', jolokia, [["versionId"], []], (response) => { var versionIds = response.value.map((el) => { return el['versionId']; }).unique(); callback(versionIds); }, (response) => { log.debug("Failed to get versions in use: ", response); log.debug("Stack Trace: ", response.stacktrace); }); } function onJolokiaUrlCreateJolokia(response, fn) { var jolokia:any = null; if (response) { var url = response.value; if (url) { // lets use a proxy if the URL is external url = Core.useProxyIfExternal(url); jolokia = Fabric.createJolokia(url); } else { if (response.error) { log.debug("Failed to fetch remote jolokia URL: ", response.error); log.debug("Stack trace: ", response.stacktrace); } } if (fn) { fn(jolokia); } } return jolokia; } /** * Attempts to create a jolokia for the given profile and version passing the created object * into the onJolokia function * @method profileJolokia * * @paran {*} jolokia * @param {String} profileId * @param {String} versionId * @param {Function} onJolokia a function to receive the jolokia object or null if one cannot be created */ export function profileJolokia(jolokia, profileId, versionId, onJolokia):any { function onJolokiaUrl(response) { return onJolokiaUrlCreateJolokia(response, onJolokia); } if (profileId && versionId) { return Fabric.profileWebAppURL(jolokia, jolokiaWebAppGroupId, profileId, versionId, onJolokiaUrl, onJolokiaUrl); } else { onJolokia(null); return null; } } /** * Attempts to create a jolokia for the given container id, passing the created object * into the onJolokia function * @method containerJolokia * @paran {*} jolokia * @param {String} containerId the id of the container to connect to * @param {Function} onJolokia a function to receive the jolokia object or null if one cannot be created */ export function containerJolokia(jolokia, containerId, onJolokia) { function onJolokiaUrl(response) { return onJolokiaUrlCreateJolokia(response, onJolokia); } return Fabric.containerWebAppURL(jolokia, jolokiaWebAppGroupId, containerId, onJolokiaUrl, onJolokiaUrl); } /** * Get a list of icons for the container's JMX domains * @param container * @returns {Array} */ export function getServiceList(container) { var answer = []; var javaContainer = true; if (angular.isDefined(container) && angular.isDefined(container.jmxDomains) && angular.isArray(container.jmxDomains) && container.alive) { answer = Fabric.serviceIconRegistry.getIcons(container.jmxDomains); } return answer; } /** * Get an icon that represents the type of the container * @param container * @returns {*} */ export function getTypeIcon(container:Container) { var type = container.type; // use the type in the metadata if it's there... if (container.metadata && container.metadata.containerType) { type = container.metadata.containerType; } var answer = Fabric.containerIconRegistry.getIcon(type); if (!answer) { return Fabric.javaIcon; } else { return answer; } } /** * Perform an action on a profile if it's found in the group * @param group * @param targetId * @param action */ export function usingProfile(group:Profile[], targetId:string, action:(profile:Profile) => void):void { var profile:Profile = group.find((p:Profile) => { return p.id === targetId; }); if (profile) { action(profile); } } /** * Returns the default version ID for the current fabric * @param jolokia * @returns the version ID as a string; or defaults to 1.0 if not available */ export function getDefaultVersionId(jolokia) { return (getDefaultVersion(jolokia) || {})["id"] || "1.0"; } /** * Returns the default version object for the current fabric * @param jolokia * @returns the version object */ export function getDefaultVersion(jolokia) { return jolokia.execute(managerMBean, "defaultVersion()"); } export function setDefaultVersion(jolokia, newVersion, callback:() => void) { jolokia.setAttribute(Fabric.managerMBean, "DefaultVersion", newVersion, onSuccess((response) => { callback(); })); } /** * Default the values that are missing in the returned JSON * @method defaultContainerValues * @param {Workspace} workspace * @param {any} $scope * @param {Array} values */ export function defaultContainerValues(workspace:Workspace, $scope, values) { var map = {}; angular.forEach(values, (row) => { var profileIds = row["profileIds"]; if (profileIds) { angular.forEach(profileIds, (profileId) => { var containers = map[profileId]; if (!containers) { containers = []; map[profileId] = containers; } containers.push(row); }); } $scope.profileMap = map; row["link"] = containerLinks(workspace, row["id"]); row["profileLinks"] = profileLinks(workspace, row["versionId"], profileIds); var versionId = row["versionId"]; var versionHref = Core.url("#/fabric/profiles?v=" + versionId); var versionLink = "<a href='" + versionHref + "'>" + versionId + "</a>" row["versionHref"] = versionHref; row["versionLink"] = versionLink; var id = row['id'] || ""; var title = "container " + id + " "; var img:string = "red-dot.png"; if (row['managed'] === false) { img = "spacer.gif"; } else if (!row['alive']) { img = "gray-dot.png"; } else if (row['provisionPending']) { img = "pending.gif"; } else if (row['provisionStatus'] === 'success') { img = "green-dot.png"; } img = "img/dots/" + img; row["statusImageHref"] = img; row["link"] = "<img src='" + img + "' title='" + title + "'/> " + (row["link"] || id); }); return values; } // TODO move to core? export function toCollection(values) { var collection = values; if (!angular.isArray(values)) { collection = [values]; } return collection; } export function containerLinks(workspace, values) { var answer = ""; angular.forEach(toCollection(values), function (value, key) { var prefix:string = ""; if (answer.length > 0) { prefix = " "; } answer += prefix + "<a href='" + Core.url("#/fabric/container/" + value + workspace.hash()) + "'>" + value + "</a>"; }); return answer; } export function profileLinks(workspace, versionId, values) { var answer = ""; angular.forEach(toCollection(values), function (value, key) { var prefix:string = ""; if (answer.length > 0) { prefix = " "; } answer += prefix + "<a href='" + Core.url("#/fabric/profile/" + versionId + "/" + value + workspace.hash()) + "'>" + value + "</a>"; }); return answer; } /** * Default the values that are missing in the returned JSON * @method defaultProfileValues * @param {Workspace} workspace * @param {String} versionId * @param {Array} values */ export function defaultProfileValues(workspace, versionId, values) { angular.forEach(values, (row) => { var id = row["id"]; row["link"] = profileLinks(workspace, versionId, id); row["parentLinks"] = profileLinks(workspace, versionId, row["parentIds"]); var containersHref = Core.url("#/fabric/containers?p=" + id); var containerCount = row["containerCount"]; var containersLink = ""; if (containerCount) { containersLink = "<a href='" + containersHref + "'>" + containerCount + "</a>" } row["containersCountLink"] = containersLink; row["containersHref"] = containersHref; }); return values; } export function getZooKeeperFacadeMBean(workspace: Core.Workspace) { var folder = workspace.findMBeanWithProperties(jmxDomain, {type: "ZooKeeper"}); return Core.pathGet(folder, "objectName"); } export var statusTitle = ContainerHelpers.statusTitle; export var statusIcon = ContainerHelpers.statusIcon; /** * Creates a jolokia object for connecting to the container with the given remote jolokia URL * @method createJolokia * @param {String} url */ export function createJolokia(url: string) { // lets default to the user/pwd for the login var userDetails = <Core.UserDetails> Core.injector.get("userDetails"); log.info("Logging into remote jolokia " + url + " using user details: " + StringHelpers.toString(userDetails)); return Core.createJolokia(url, <string> userDetails.username, <string> userDetails.password); } export function registeredProviders(jolokia) { var providers = jolokia.execute(Fabric.managerMBean, 'registeredValidProviders()'); var answer = {}; angular.forEach(providers, (value, key) => { answer[key] = { id: key, className: value }; }); return answer; } export function getSchema(id, className, jolokia, cb) { jolokia.execute(Fabric.schemaLookupMBean, 'getSchemaForClass(java.lang.String)', className, { method: 'POST', success: (value) => { cb(Fabric.customizeSchema(id, angular.fromJson(value))); } }); } export function getDtoSchema(id, className, jolokia, cb) { jolokia.execute(Fabric.schemaLookupMBean, 'getSchemaForClass(java.lang.String)', className, { method: 'POST', success: (value) => { cb(angular.fromJson(value)); } }); } export function getCurrentContainer(jolokia, fields) { var name = jolokia.getAttribute(Fabric.managerMBean, 'CurrentContainerName', { method: 'POST' }); return jolokia.execute(Fabric.managerMBean, "getContainer(java.lang.String, java.util.List)", name, fields, { method: 'POST' }); } export function getContainerFields(jolokia, name, fields) { return jolokia.execute(Fabric.managerMBean, "getContainer(java.lang.String, java.util.List)", name, fields, { method: 'POST' }); } export function getRootContainers(jolokia) { var fields = ["id", "root"]; var answer:Array<Container> = jolokia.execute(Fabric.managerMBean, "containers(java.util.List)", fields, { method: 'POST' }); return answer.filter((c) => { return c.root }).map(v => v["id"]); } /** * Queries the given fields on the contianers in the fabric invoking the given function or returning the results if the fn is null * @param jolokia * @param fields * @param fn * @return the result if fn is null */ export function getContainersFields(jolokia, fields, fn = null) { return jolokia.execute(Fabric.managerMBean, "containers(java.util.List)", fields, onSuccess(fn)); } export function getOpenShiftDomains(workspace ,jolokia, serverUrl, login, password, fn = null, onError = null) { if (hasOpenShiftFabric(workspace) && serverUrl && login && password) { var options = onSuccess(fn, {error: onError}); return jolokia.execute(Fabric.openShiftFabricMBean, "getDomains", serverUrl, login, password, options); } else { if (fn) { fn([]); } return []; } } export function getOpenShiftGearProfiles(workspace ,jolokia, serverUrl, login, password, fn = null) { if (hasOpenShiftFabric(workspace) && serverUrl && login && password) { return jolokia.execute(Fabric.openShiftFabricMBean, "getGearProfiles", serverUrl, login, password, onSuccess(fn)); } else { if (fn) { fn([]); } return []; } } export function filterProfiles(jolokia, versionId, profileIds) { var profiles = []; if (versionId) { profiles = jolokia.execute(Fabric.managerMBean, "getProfiles(java.lang.String, java.util.List)", versionId, ['id', 'hidden', 'abstract'], { method: 'POST' }); } profiles = profiles.filter((profile) => { return profileIds.some((id) => { return profile.id === id }); }); profiles = profiles.filter((profile => { return !profile.abstract && !profile.hidden; })); return profiles.map((p) => { return p.id; }); } export function getProfileData(jolokia, versionId, profileId, fields) { return jolokia.execute(Fabric.managerMBean, "getProfile(java.lang.String, java.lang.String, java.util.List)", versionId, profileId, fields, { method: 'POST' }); } export function getConfigFile(jolokia, versionId, profileId, fileName, fn = null) { function onResults(answer) { return answer ? answer.decodeBase64() : null; } var callback = !fn ? null : (result) => { fn(onResults(result)); }; var answer = jolokia.execute(Fabric.managerMBean, "getConfigurationFile(java.lang.String, java.lang.String, java.lang.String)", versionId, profileId, fileName, onSuccess(callback)); return fn ? answer : onResults(answer); } /** * Creates a link to the given broker configuration so we can connect in the UI * @param workspace * @param jolokia * @param localStorage * @param brokerVersion * @param brokerProfile * @param brokerId * @return the link to the broker page */ export function brokerConfigLink(workspace, jolokia, localStorage, brokerVersion, brokerProfile, brokerId) { var path = Fabric.profileLink(workspace, jolokia, localStorage, brokerVersion, brokerProfile); path += "/io.fabric8.mq.fabric.server-" + brokerId + ".properties"; return path; } /** * Connects to the broker in a new window */ export function connectToBroker($scope, container, postfix = null) { var view = "#/jmx/attributes?tab=activemq"; if (postfix) { view += "&" + postfix; } $scope.doConnect(container, view); } /** * Removes any attributes from the object that are set to an empty string. * * @method sanitizeJson * @for Fabric * @param {Object} json * @return {Object} */ export function sanitizeJson(json:Object) { angular.forEach(json, (value, key) => { if (value === "") { delete json[key]; } }); return json; } }
{ "content_hash": "a1d59d82b6485a381f1ca1b53f6e8c4e", "timestamp": "", "source": "github", "line_count": 1037, "max_line_length": 196, "avg_line_length": 33.643201542912244, "alnum_prop": 0.6242260949323549, "repo_name": "stalet/hawtio", "id": "af186084d47615e4b0a6d9494d486ac5e899d9ca", "size": "34888", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "hawtio-web/src/main/webapp/app/fabric/js/fabricHelpers.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "26" }, { "name": "CSS", "bytes": "657778" }, { "name": "HTML", "bytes": "609046" }, { "name": "Java", "bytes": "1043378" }, { "name": "JavaScript", "bytes": "3863958" }, { "name": "Scala", "bytes": "5228" }, { "name": "Shell", "bytes": "1997" }, { "name": "TypeScript", "bytes": "2023612" } ] }
var Hapi = require('hapi'); var Hoek = require('hoek'); var path = require('path'); var request = require('request'); var config = require('./config.js'); var server = new Hapi.Server(); server.connection({ port: 3000 }); // configure a folder of templates server.views({ engines: { html: require('handlebars') }, path: path.join(__dirname, 'templates') }); // Register our plugins: // * bell for the OAuth 2.0 workflow // * hapi-auth-cooke for persisting auth in cookies // * good for logging server.register([ { register:require('bell') }, { register:require('hapi-auth-cookie') }, { register: require('good'), options: { reporters: [{ reporter: require('good-console'), args:[{ log: '*', request: '*', server: '*', ops: '*' }] }] } } ], function (err) { if (err) { console.log(err); return; } }); // Get a segment of out of our servers cache for storing user sessions // my default this is an in-memory cache which means that all sessions // will be cleared when your server is killed. Ideally this should be // persisted my configurng the server.cache option http://hapijs.com/api#server-options var sessions = server.cache({ segment: "sessions", expiresIn: (14 * 24 * 60 * 60 * 1000) - (5 * 60 * 1000) // by default 2 weeks - 5 minutes }); // Register a cookie called 'redirect' to store the value of the page to // redirect a user to after sign in. This cookie should be secured because // we dont want to redirect the user to a malicious page after signin this helps, // confirm that the server set this cookie and not an attacker server.state('redirect', { ttl: null, encoding: 'iron', isSecure: config('/secure'), password: config('/secretKey') }); // Configure cookie authentcation defining where to direct users to after // a failed authentication and how to validate a cookie be retriving it from // the session cache. server.auth.strategy('session', 'cookie', { password: config('/secretKey'), cookie: 'arcgis_online_session', redirectTo: '/sign-in', isSecure: config('/secure'), appendNext: true, validateFunc: function(session, callback) { sessions.get(session.sid, function(err, cached) { if (err) { return callback(err, false); } if (!cached) { return callback(null, false); } return callback(null, true, cached.account); }); } }); // Configure bell to provide the OAuth 2.0 workflow by defining // a custom provider with the ArcGIS Online OAuth 2.0 endpoint and // a function to get an normalize the users profile. server.auth.strategy('arcgis', 'bell', { provider: { protocol: 'oauth2', auth: 'https://www.arcgis.com/sharing/rest/oauth2/authorize', token: 'https://www.arcgis.com/sharing/rest/oauth2/token', profile: function(credentials, params, get, callback){ get('https://www.arcgis.com/sharing/rest/portals/self', { token: credentials.token, f: 'json' }, function(response){ credentials.expiresIn = params.expires_in; // pull out the expires_in param so we can save it later credentials.profile = { username: response.user.username, firstName: response.user.firstName, lastName: response.user.lastName, fullName: response.user.fullName, email: response.user.email, orgId: response.orgId, urlKey: response.urlKey, ssl: response.allSSL }; callback(); }); } }, providerParams: { expiration: -1 // get longest possible refresh token }, password: config('/secretKey'), clientId: config('/clientId'), clientSecret: config('/clientSecret'), isSecure: config('/secure') }); // The route that will authenticate with ArcGIS Online. The `handler` is run when authentication is complete. // Because `try` is specified in the auth config auth is not technically required. If auth is successful we // will store the users session in our session cache and look it up by storing their username in a secure cookie. // The cookie will expire shortly before the users refresh token does server.route({ method: ['GET', 'POST'], path: config('/redirectUrl'), config: { auth: { strategy: 'arcgis', mode: 'try' }, handler: function(request, reply) { // handle an error in the auth process. This could redirect the user to another page if (!request.auth.isAuthenticated) { var status = JSON.stringify({ error: request.auth.error.message }, null, 2); return reply('<pre>' + Hoek.escapeHtml(status) + '</pre>'); } var account = request.auth.credentials; // all credential and profile info var sid = account.profile.username; // username will be stored in the cookie and be used to lookup the session in cache var ttl = (account.expiresIn - (30*60)) * 1000; // cookie is valid for the duration of the refresh token minus a half hour // set the session in our cache with sid (username) as the key sessions.set(sid, { account: account }, ttl, function(error) { if (error) { reply(error); } // set the cookie, request.auth.session is the session auth strategy we setup above request.auth.session.set({ sid: sid }); // validate that the redirect URL is going somewhere on our site not a malicious page var redirectTo = (request.state.redirect && request.state.redirect[0] === '/') ? request.state.redirect : config('/postSignIn'); return reply.redirect(redirectTo); }); } } }); // Our applicaitons sign in route, we have a sign-in route and an auth route because this gives us a chance to // set the redirect cookie for after the user signs in. If the session auth fails on another route it will append // the url to redirect to with ?next=page. We set this in the cookie and redirect the user there after sign in server.route({ method: ['GET'], path: '/sign-in', config: { auth: { strategy: 'session', mode: 'try' }, plugins: { 'hapi-auth-cookie': { redirectTo: false } }, }, handler: function(request, reply) { if(request.auth.isAuthenticated){ return reply.redirect(config('/postSignIn')); } return reply.redirect('/auth/arcgis').state('redirect', request.query.next || config('/postSignIn')); } }); // to sign a user out we simply need to clear their auth cookie server.route({ method: ['GET'], path: '/sign-out', handler: function (request, reply) { request.auth.session.clear(); return reply.redirect(config('/postSignOut')); } }); // homepage route, we will try to authenticate the user with a session (mode=try) but if they dont have // a session we will set redirectTo=false in our 'hapi-auth-cookie' plugin so they wont be redirected. // This means that users can be signed in or out when visiting this page server.route({ path: '/', method: 'GET', config: { auth: { strategy: 'session', mode: 'try' }, plugins: { 'hapi-auth-cookie': { redirectTo: false } }, }, handler: function(request, reply) { var status = JSON.stringify({ isLoggedIn: request.auth.isAuthenticated, credentials: (request.auth.isAuthenticated) ? request.auth.credentials: null }, null, 2); reply('<a href="/sign-in">Sign In</a><br><pre>' + Hoek.escapeHtml(status) + '</pre>'); } }); // helper function to generate a token function generateToken(incomingRequest, reply){ if(incomingRequest.auth.isAuthenticated){ request({ method: 'POST', url: 'https://www.arcgis.com/sharing/rest/oauth2/token/', form: { client_id: config('/clientId'), grant_type: 'refresh_token', refresh_token: incomingRequest.auth.credentials.refreshToken }, json: true }, function(error, response, body){ if(error){ reply({ error: 'could not generate token', details: error }); } else { reply({ expires: new Date().getTime() - (body.expires_in * 1000) - (2 * 60 * 1000), server: "https://www.arcgis.com", ssl: incomingRequest.auth.credentials.profile.ssl, token: body.access_token, userId: body.username }); } }); } else { reply.redirect('/sign-in').state('redirect', request.path); } } // This is our application page, a valid session is required to access it server.route({ method: ['GET'], path: '/app', config: { auth: 'session', // require a valid session to access the page pre: [ {method: generateToken, assign: 'token'} ], // generate a token and assign it to `request.pre.token` using the generateToken helper }, handler: function(request, reply){ // render the view inserting the server side token reply.view('app', { token: JSON.stringify(request.pre.token) }); } }); // Will generate a new token for a user whose token is about to run out server.route({ method: ['GET'], path: '/refresh', config: { pre: [ {method: generateToken, assign: 'token'} ], // generate a token and assign it to `request.pre.token` using the generateToken helper plugins: { 'hapi-auth-cookie': { redirectTo: false } }, // don't redirect if auth fails auth: { strategy: 'session', mode: 'try' } // try to authenticate via `session` but don't give a hard failure }, handler: function(request, reply){ // if we are authenticated respond with a token otherwise respond with an error if(request.auth.isAuthenticated){ reply(request.pre.token); } else { reply({error: 'error'}); } } }); server.start(function(){ server.log('server', 'started on port 3000'); });
{ "content_hash": "e2c9fd6dd3be40d3397d5681fe03685a", "timestamp": "", "source": "github", "line_count": 297, "max_line_length": 142, "avg_line_length": 32.986531986531986, "alnum_prop": 0.6432581402470144, "repo_name": "patrickarlt/dev-summit-2015-authentication-in-arcgis-online", "id": "f5a54edfae0995a4dcb5699df19f72a4432a1fb9", "size": "9797", "binary": false, "copies": "2", "ref": "refs/heads/gh-pages", "path": "demos/js-api-server-based/server.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "164221" }, { "name": "HTML", "bytes": "48616" }, { "name": "JavaScript", "bytes": "635141" }, { "name": "PHP", "bytes": "92" } ] }
package compiler.semantic.symbol; import es.uned.lsi.compiler.semantic.ScopeIF; import es.uned.lsi.compiler.semantic.symbol.SymbolBase; import es.uned.lsi.compiler.semantic.type.TypeIF; /** * Class for SymbolConstant. */ // TODO: Student work // Include properties to characterize constants public class SymbolConstant extends SymbolBase { /** * Constructor for SymbolConstant. * @param scope The declaration scope. * @param name The symbol name. * @param type The symbol type. */ public SymbolConstant (ScopeIF scope, String name, TypeIF type) { super (scope, name, type); } }
{ "content_hash": "3b0edaaa57c1cd3f5904591c7e0df864", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 55, "avg_line_length": 24.433333333333334, "alnum_prop": 0.607094133697135, "repo_name": "colymore/Uned", "id": "b13a3bc1e975e43fb3c020331aa4316d9f01dd13", "size": "733", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "PL1/src/compiler/semantic/symbol/SymbolConstant.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "12551" }, { "name": "CSS", "bytes": "4260" }, { "name": "HTML", "bytes": "8022231" }, { "name": "Haskell", "bytes": "6173" }, { "name": "Java", "bytes": "893402" }, { "name": "Lex", "bytes": "24918" }, { "name": "Prolog", "bytes": "8183" }, { "name": "Python", "bytes": "3805" }, { "name": "Shell", "bytes": "3859" } ] }
<?php declare(strict_types=1); namespace Core\Domain\Common\Query; interface QueryBusInterface { public function handle(QueryInterface $query); }
{ "content_hash": "bab255a825a06e6f6b297d1ffa41c0e8", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 50, "avg_line_length": 12.916666666666666, "alnum_prop": 0.7548387096774194, "repo_name": "Dev-Int/glsr", "id": "1f4e3d6e17b30ae10550015e7be518e5675eba12", "size": "408", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "server/src/Core/Domain/Common/Query/QueryBusInterface.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1379" }, { "name": "Dockerfile", "bytes": "1261" }, { "name": "HTML", "bytes": "27369" }, { "name": "JavaScript", "bytes": "6087" }, { "name": "Makefile", "bytes": "10547" }, { "name": "PHP", "bytes": "295068" }, { "name": "SCSS", "bytes": "11942" }, { "name": "Shell", "bytes": "5210" }, { "name": "Twig", "bytes": "11885" }, { "name": "TypeScript", "bytes": "66002" } ] }
End of preview.

No dataset card yet

Downloads last month
5