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 1239
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 995)
              
              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 1239
              
              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
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <script src="../build/react.js"></script> <script src="../build/react-dom.js"></script> <script src="../lib/browser.min.js"></script> <script src="../lib/jquery.min.js"></script> </head> <body> <div id="container"></div> <script type="text/babel" src="spreadAttr.js"></script> </body> </html>
{ "content_hash": "18a6c10ac1185159d14a7a46a5c0b705", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 55, "avg_line_length": 26.333333333333332, "alnum_prop": 0.6050632911392405, "repo_name": "Jackey-Sparrow/learn-react-day-by-day", "id": "3fd4956e3390b664c008bf4aec9e39ce1550313d", "size": "395", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "10-2015.10.12/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "6395" }, { "name": "JavaScript", "bytes": "693307" } ] }
/*jslint node: true */ "use strict"; var $ = require('gulp-load-plugins')(); var argv = require('yargs').argv; var gulp = require('gulp'); var browserSync = require('browser-sync').create(); var merge = require('merge-stream'); var sequence = require('run-sequence'); var colors = require('colors'); var dateFormat = require('dateformat'); var del = require('del'); // Enter URL of your local server here // Example: 'http://localwebsite.dev' var URL = ''; // Check for --production flag var isProduction = !!(argv.production); // Browsers to target when prefixing CSS. var COMPATIBILITY = ['last 2 versions', 'ie >= 9']; // File paths to various assets are defined here. var PATHS = { sass: [ 'assets/components/foundation-sites/scss', 'assets/components/motion-ui/src', 'assets/components/fontawesome/scss', 'assets/components/font-franchise/scss' ], javascript: [ 'assets/components/what-input/what-input.js', 'assets/components/foundation-sites/js/foundation.core.js', 'assets/components/foundation-sites/js/foundation.util.*.js', // Paths to individual JS components defined below 'assets/components/foundation-sites/js/foundation.abide.js', 'assets/components/foundation-sites/js/foundation.accordion.js', 'assets/components/foundation-sites/js/foundation.accordionMenu.js', 'assets/components/foundation-sites/js/foundation.drilldown.js', 'assets/components/foundation-sites/js/foundation.dropdown.js', 'assets/components/foundation-sites/js/foundation.dropdownMenu.js', 'assets/components/foundation-sites/js/foundation.equalizer.js', 'assets/components/foundation-sites/js/foundation.interchange.js', 'assets/components/foundation-sites/js/foundation.magellan.js', 'assets/components/foundation-sites/js/foundation.offcanvas.js', 'assets/components/foundation-sites/js/foundation.orbit.js', 'assets/components/foundation-sites/js/foundation.responsiveMenu.js', 'assets/components/foundation-sites/js/foundation.responsiveToggle.js', 'assets/components/foundation-sites/js/foundation.reveal.js', 'assets/components/foundation-sites/js/foundation.slider.js', 'assets/components/foundation-sites/js/foundation.sticky.js', 'assets/components/foundation-sites/js/foundation.tabs.js', 'assets/components/foundation-sites/js/foundation.toggler.js', 'assets/components/foundation-sites/js/foundation.tooltip.js', // Motion UI 'assets/components/motion-ui/motion-ui.js', // Include your own custom scripts (located in the custom folder) 'assets/javascript/custom/*.js' ], phpcs: [ '**/*.php', '!wpcs', '!wpcs/**' ], pkg: [ '**/*', '!**/node_modules/**', '!**/components/**', '!**/scss/**', '!**/bower.json', '!**/gulpfile.js', '!**/package.json', '!**/composer.json', '!**/composer.lock', '!**/codesniffer.ruleset.xml', '!**/packaged/*' ] }; // Browsersync task gulp.task('browser-sync', ['build'], function() { var files = [ '**/*.php', 'assets/images/**/*.{png,jpg,gif}' ]; browserSync.init(files, { // Proxy address proxy: URL, // Port # // port: PORT }); }); // Compile Sass into CSS // In production, the CSS is compressed gulp.task('sass', function() { // Minify CSS if run wtih --production flag var minifycss = $.if(isProduction, $.minifyCss()); return gulp.src('assets/scss/foundation.scss') .pipe($.sourcemaps.init()) .pipe($.sass({ includePaths: PATHS.sass })) .on('error', $.notify.onError({ message: "<%= error.message %>", title: "Sass Error" })) .pipe($.autoprefixer({ browsers: COMPATIBILITY })) .pipe(minifycss) .pipe($.if(!isProduction, $.sourcemaps.write('.'))) .pipe(gulp.dest('assets/stylesheets')) .pipe(browserSync.stream({match: '**/*.css'})); }); // Lint all JS files in custom directory gulp.task('lint', function() { return gulp.src('assets/javascript/custom/*.js') .pipe($.jshint()) .pipe($.notify(function (file) { if (file.jshint.success) { return false; } var errors = file.jshint.results.map(function (data) { if (data.error) { return "(" + data.error.line + ':' + data.error.character + ') ' + data.error.reason; } }).join("\n"); return file.relative + " (" + file.jshint.results.length + " errors)\n" + errors; })); }); // Combine JavaScript into one file // In production, the file is minified gulp.task('javascript', function() { var uglify = $.uglify() .on('error', $.notify.onError({ message: "<%= error.message %>", title: "Uglify JS Error" })); return gulp.src(PATHS.javascript) .pipe($.sourcemaps.init()) .pipe($.concat('foundation.js')) .pipe($.if(isProduction, uglify)) .pipe($.if(!isProduction, $.sourcemaps.write())) .pipe(gulp.dest('assets/javascript')) .pipe(browserSync.stream()); }); // Copy task gulp.task('copy', function() { // Motion UI var motionUi = gulp.src('assets/components/motion-ui/**/*.*') .pipe($.flatten()) .pipe(gulp.dest('assets/javascript/vendor/motion-ui')); // What Input var whatInput = gulp.src('assets/components/what-input/**/*.*') .pipe($.flatten()) .pipe(gulp.dest('assets/javascript/vendor/what-input')); // Font Awesome var fontAwesome = gulp.src('assets/components/fontawesome/fonts/**/*.*') .pipe(gulp.dest('assets/fonts')); // Font Franchise var fontFranchise = gulp.src('assets/components/font-franchise/fonts/**/*.*') .pipe(gulp.dest('assets/fonts')); // Font Klinic Slab var fontKlinicslab = gulp.src('assets/components/font-klinicslab/fonts/**/*.*') .pipe(gulp.dest('assets/fonts')); return merge(motionUi, whatInput, fontAwesome, fontFranchise, fontKlinicslab); }); // Package task gulp.task('package', ['build'], function() { var fs = require('fs'); var time = dateFormat(new Date(), "yyyy-mm-dd_HH-MM"); var pkg = JSON.parse(fs.readFileSync('./package.json')); var title = pkg.name + '_' + time + '.zip'; return gulp.src(PATHS.pkg) .pipe($.zip(title)) .pipe(gulp.dest('packaged')); }); // Build task // Runs copy then runs sass & javascript in parallel gulp.task('build', ['clean'], function(done) { sequence('copy', ['sass', 'javascript', 'lint'], done); }); // PHP Code Sniffer task gulp.task('phpcs', function() { return gulp.src(PATHS.phpcs) .pipe($.phpcs({ bin: 'wpcs/vendor/bin/phpcs', standard: './codesniffer.ruleset.xml', showSniffCode: true, })) .pipe($.phpcs.reporter('log')); }); // PHP Code Beautifier task gulp.task('phpcbf', function () { return gulp.src(PATHS.phpcs) .pipe($.phpcbf({ bin: 'wpcs/vendor/bin/phpcbf', standard: './codesniffer.ruleset.xml', warningSeverity: 0 })) .on('error', $.util.log) .pipe(gulp.dest('.')); }); // Clean task gulp.task('clean', function(done) { sequence(['clean:javascript', 'clean:css'], done); }); // Clean JS gulp.task('clean:javascript', function() { return del([ 'assets/javascript/foundation.js' ]); }); // Clean CSS gulp.task('clean:css', function() { return del([ 'assets/stylesheets/foundation.css', 'assets/stylesheets/foundation.css.map' ]); }); // Default gulp task // Run build task and watch for file changes gulp.task('default', ['build', 'browser-sync'], function() { // Log file changes to console function logFileChange(event) { var fileName = require('path').relative(__dirname, event.path); console.log('[' + 'WATCH'.green + '] ' + fileName.magenta + ' was ' + event.type + ', running tasks...'); } // Sass Watch gulp.watch(['assets/scss/**/*.scss'], ['clean:css', 'sass']) .on('change', function(event) { logFileChange(event); }); // JS Watch gulp.watch(['assets/javascript/custom/**/*.js'], ['clean:javascript', 'javascript', 'lint']) .on('change', function(event) { logFileChange(event); }); });
{ "content_hash": "de85a56342671d397134b5ee5199f40e", "timestamp": "", "source": "github", "line_count": 272, "max_line_length": 109, "avg_line_length": 29.933823529411764, "alnum_prop": 0.6314173421763695, "repo_name": "JP-Keilbach/japshirt", "id": "bc2ac511a48b1c2eae332f9945b684722a4909d0", "size": "8142", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gulpfile.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "50500" }, { "name": "JavaScript", "bytes": "8813" }, { "name": "PHP", "bytes": "105088" } ] }
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FabricAdcHub.Sender")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FabricAdcHub.Sender")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("7eed00b6-09e2-4e85-b2f1-fae705b30760")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{ "content_hash": "835377cab30dadc6f4d2567cfba54a84", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 84, "avg_line_length": 39.05714285714286, "alnum_prop": 0.745427944403804, "repo_name": "Caraul/FabricAdcHub", "id": "52e7388fd25a2df6bebc382bcfb1483deb758750", "size": "1370", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "FabricAdcHub.Sender/Properties/AssemblyInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "219758" }, { "name": "PowerShell", "bytes": "7999" } ] }
package example.csci567.loclistenerexample; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
{ "content_hash": "6fd0b77e12a9680c0a9b68a9656c64bd", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 81, "avg_line_length": 24.235294117647058, "alnum_prop": 0.7014563106796117, "repo_name": "CSUChico-CSCI567/CSCI567-Spring2017-Lecture-Examples", "id": "5a0ad623e96838e55bbbb80bdad0986b60bda0f1", "size": "412", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "LocListenerExample/app/src/test/java/example/csci567/loclistenerexample/ExampleUnitTest.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "77967" } ] }
fromMaybe defval wrapped = case wrapped of Nothing -> defval Just value -> value
{ "content_hash": "3089a13bb6ae5c6dd48a9f8e10718736", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 28, "avg_line_length": 25.5, "alnum_prop": 0.6078431372549019, "repo_name": "Sgoettschkes/learning", "id": "f7c47ef37dd107d8676f9e7e6ba6840484b34680", "size": "226", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "haskell/RealWorldHaskell/ch03/Guard.hs", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "13545" }, { "name": "Clojure", "bytes": "18283" }, { "name": "CoffeeScript", "bytes": "2205" }, { "name": "Dart", "bytes": "89617" }, { "name": "HTML", "bytes": "7212" }, { "name": "Haskell", "bytes": "187306" }, { "name": "PHP", "bytes": "847" }, { "name": "Python", "bytes": "3063" }, { "name": "Racket", "bytes": "7281" }, { "name": "Rust", "bytes": "1457" }, { "name": "Shell", "bytes": "5310" } ] }
require 'erubis' require 'net/ssh' require 'socket' require 'timeout' require 'colorize' module Hetzner class Bootstrap class FreeBSD class Target attr_accessor :ip attr_accessor :login attr_accessor :password attr_accessor :rescue_os attr_accessor :rescue_os_bit attr_accessor :actions attr_accessor :hostname attr_accessor :post_install attr_accessor :post_install_remote attr_accessor :public_keys attr_accessor :bootstrap_cmd attr_accessor :logger def initialize(options = {}) @rescue_os = 'freebsd' @rescue_os_bit = '64' @retries = 0 @bootstrap_cmd = '' @login = 'root' options.each_pair do |k,v| self.send("#{k}=", v) end end def enable_rescue_mode(options = {}) result = @api.enable_rescue! @ip, @rescue_os, @rescue_os_bit if result.success? && result['rescue'] @password = result['rescue']['password'] reset_retries logger.info "IP: #{ip} | username: #{@login} | password: #{@password}".colorize(:magenta) elsif @retries > 3 logger.error "Rescue system could not be activated".colorize(:red) raise CantActivateRescueSystemError, result else @retries += 1 logger.warn "Problem while trying to activate rescue system (retries: #{@retries})".colorize(:yellow) @api.disable_rescue! @ip rolling_sleep enable_rescue_mode options end end def reset(options = {}) result = @api.reset! @ip, :hw if result.success? reset_retries elsif @retries > 3 logger.error "Resetting through web service failed.".colorize(:red) raise CantResetSystemError, result else @retries += 1 logger.warn "Problem while trying to reset/reboot system (retries: #{@retries})".colorize(:yellow) rolling_sleep reset options end end def port_open? ip, port ssh_port_probe = TCPSocket.new ip, port IO.select([ssh_port_probe], nil, nil, 2) ssh_port_probe.close true end def wait_for_ssh_down(options = {}) loop do sleep 2 Timeout::timeout(4) do if port_open? @ip, 22 logger.debug "SSH UP".colorize(:magenta) else raise Errno::ECONNREFUSED end end end rescue Timeout::Error, Errno::ECONNREFUSED logger.debug "SSH down".colorize(:magenta) end def wait_for_ssh_up(options = {}) loop do Timeout::timeout(4) do if port_open? @ip, 22 logger.debug "SSH up".colorize(:magenta) return true else raise Errno::ECONNREFUSED end end end rescue Errno::ECONNREFUSED, Timeout::Error logger.debug "SSH down".colorize(:magenta) sleep 2 retry end def reboot(options = {}) logger.info "Rebooting ...".colorize(:magenta) remote do |ssh| ssh.exec!("reboot") end end def verify_installation(options = {}) logger.info "Verifying the installation ...".colorize(:magenta) @login = 'root' remote(password: nil) do |ssh| working_hostname = ssh.exec!("cat /etc/hostname") if @hostname == working_hostname.chomp logger.info "The installation has been successful".colorize(:green) else raise InstallationError, "Hostnames do not match: assumed #{@hostname} but received #{working_hostname}" end end end def remove_from_local_known_hosts(options = {}) `ssh-keygen -R #{@hostname}` `ssh-keygen -R #{@ip}` end def update_local_known_hosts(options = {}) remote do |ssh| logger.info "Removing SSH keys for #{@hostname} from local ~/.ssh/known_hosts file ...".colorize(:magenta) `ssh-keygen -R #{@hostname}` `ssh-keygen -R #{@ip}` end rescue Net::SSH::HostKeyMismatch => e e.remember_host! logger.info "Remote host key has been added to local ~/.ssh/known_hosts file.".colorize(:green) end def post_install(options = {}) return unless @post_install post_install = render_post_install logger.info "Executing post_install:\n #{post_install}".colorize(:magenta) output = local do `#{post_install}` end logger.info output end def post_install_remote(options = {}) return unless @post_install_remote remote do |ssh| @post_install_remote.split("\n").each do |cmd| cmd.chomp! logger.info "executing #{cmd}".colorize(:magenta) ssh.exec!(cmd) end end end def render_cloud_config eruby = Erubis::Eruby.new @cloud_config.to_s params = {} params[:hostname] = @hostname params[:ip] = @ip params[:public_keys] = @public_keys return eruby.result(params) end def render_post_install eruby = Erubis::Eruby.new @post_install.to_s params = {} params[:hostname] = @hostname params[:ip] = @ip params[:login] = @login params[:password] = @password return eruby.result(params) end def use_api(api_obj) @api = api_obj end def use_logger(logger_obj) @logger = logger_obj @logger.formatter = default_log_formatter end def remote(options = {}, &block) default = { :password => @password } default.merge! options Net::SSH.start(@ip, @login, default) do |ssh| block.call ssh end end def local(&block) block.call end def reset_retries @retries = 0 end def rolling_sleep sleep @retries * @retries * 3 + 1 # => 1, 4, 13, 28, 49, 76, 109, 148, 193, 244, 301, 364 ... seconds end def default_log_formatter proc do |severity, datetime, progname, msg| caller[4]=~/`(.*?)'/ "[#{datetime.strftime "%H:%M:%S"}][#{sprintf "%-15s", ip}][#{$1}] #{msg}\n" end end class NoCloudConfigProvidedError < ArgumentError; end class CantActivateRescueSystemError < StandardError; end class CantResetSystemError < StandardError; end class InstallationError < StandardError; end end end end end
{ "content_hash": "208a5a328e92323d45c31004f305c394", "timestamp": "", "source": "github", "line_count": 238, "max_line_length": 118, "avg_line_length": 29.777310924369747, "alnum_prop": 0.5256102723296177, "repo_name": "asconix/hetzner-bootstrap-freebsd", "id": "fc2879479a7187556cbd6698cc508e822b82200d", "size": "7087", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/hetzner/bootstrap/freebsd/target.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "13023" } ] }
<?php /* * BOOM. We're a PHP application now. */ ?> <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Heroku Test 01</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> <script src="js/vendor/modernizr-2.6.2.min.js"></script> </head> <body> <!--[if lt IE 7]> <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <!-- Add your site or application content here --> <p>Hello world! This is HTML5 Boilerplate.</p> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.2.min.js"><\/script>')</script> <script src="js/plugins.js"></script> <script src="js/main.js"></script> <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. --> <script> (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]= function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date; e=o.createElement(i);r=o.getElementsByTagName(i)[0]; e.src='//www.google-analytics.com/analytics.js'; r.parentNode.insertBefore(e,r)}(window,document,'script','ga')); ga('create','UA-XXXXX-X');ga('send','pageview'); </script> </body> </html>
{ "content_hash": "0cedfbad3eea74ee4c77a235f0e37d19", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 184, "avg_line_length": 43.4375, "alnum_prop": 0.5669064748201439, "repo_name": "tannerhodges/heroku-test", "id": "b291aa1d62c3ce9981b3e09480143d0af17de1f7", "size": "2085", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "index.php", "mode": "33261", "license": "mit", "language": [] }
import { Component, OnInit, OnDestroy } from '@angular/core'; import { Store } from '@ngrx/store'; import { AppState } from '../../../../interfaces'; import { UserActions } from '../../../actions/user.actions'; import { UserService } from '../../../services/user.service'; import { Address } from '../../../../core/models/address'; import { ActivatedRoute } from '@angular/router'; import { Subscription } from 'rxjs/Subscription'; import { Observable } from 'rxjs/Observable'; import { environment } from '../../../../../environments/environment'; import { AuthActions } from './../../../../auth/actions/auth.actions'; import { AddressService } from './../../../../checkout/address/services/address.service'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; @Component({ selector: 'isAuthenticated', templateUrl: './adrLineEdit.html', styleUrls: ['./adrLineEdit.scss'] }) export class AdrLineEditComp implements OnInit, OnDestroy { routeSubscription$: Subscription; orderSubscription$: Subscription; adrId: String; adr: Address; adrUid: string; isAuthenticated: boolean; addressForm: FormGroup; emailForm: FormGroup; _addressService : AddressService; constructor( private fb: FormBuilder, private authActions: AuthActions, private userService: UserService, private route: ActivatedRoute, private addrService: AddressService ) { this._addressService = addrService; this.addressForm = addrService.initAddressForm(); this.emailForm = addrService.initEmailForm(); } ngOnInit() { this.routeSubscription$ = this.route.params.subscribe( (params: any) => { this.adrId = params['id']; this.orderSubscription$ = this.userService.getAddr(this.adrId).subscribe( response => { this.adr = response; this.adrUid = response.uid; this.addressForm.patchValue({ firstname: this.adr.firstname, lastname: this.adr.lastname, city: this.adr.city, phone: this.adr.phone, zipcode: this.adr.zipcode }); const user = JSON.parse(localStorage.getItem('user')); this.emailForm.patchValue({ email: user.email }) } ); } ); } onSubmit() { const address = this.addressForm.value; let addressAttributes; addressAttributes = this.addrService.createAddresAttributes(address); addressAttributes.order.bill_address_attributes.uid = this.adrUid; addressAttributes.order.ship_address_attributes.uid = this.adrUid; this.addrService.createAddress(addressAttributes).subscribe( response => { } ); } ngOnDestroy() { this.routeSubscription$.unsubscribe(); this.orderSubscription$.unsubscribe(); } }
{ "content_hash": "96501817e175232bd4abf38d0bfc6c83", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 89, "avg_line_length": 28.98, "alnum_prop": 0.6359558316080055, "repo_name": "plumkaballZ/theGlobalX", "id": "081a626b99594e9a0a754af2ac42f78194a09a3f", "size": "2898", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/app/user/components/addresses/adrLine_Edit/adrLineEditComp.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "203185" }, { "name": "DIGITAL Command Language", "bytes": "179" }, { "name": "Dockerfile", "bytes": "451" }, { "name": "HTML", "bytes": "94763" }, { "name": "JavaScript", "bytes": "2432" }, { "name": "TypeScript", "bytes": "370155" } ] }
package fm.jiecao.jcvideoplayer_lib; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.text.TextUtils; import android.util.AttributeSet; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; import java.util.Timer; import java.util.TimerTask; /** * Created by Nathen * On 2016/04/18 16:15 */ public class JCVideoPlayerStandard extends JCVideoPlayer { protected static Timer DISMISS_CONTROL_VIEW_TIMER; public ImageView backButton; public ProgressBar bottomProgressBar, loadingProgressBar; public TextView titleTextView; public ImageView thumbImageView; public ImageView tinyBackImageView; protected DismissControlViewTimerTask mDismissControlViewTimerTask; public JCVideoPlayerStandard(Context context) { super(context); } public JCVideoPlayerStandard(Context context, AttributeSet attrs) { super(context, attrs); } @Override public void init(Context context) { super.init(context); bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progress); titleTextView = (TextView) findViewById(R.id.title); backButton = (ImageView) findViewById(R.id.back); thumbImageView = (ImageView) findViewById(R.id.thumb); loadingProgressBar = (ProgressBar) findViewById(R.id.loading); tinyBackImageView = (ImageView) findViewById(R.id.back_tiny); thumbImageView.setOnClickListener(this); backButton.setOnClickListener(this); tinyBackImageView.setOnClickListener(this); } @Override public void setUp(String url, int screen, Object... objects) { super.setUp(url, screen, objects); if (objects.length == 0) return; titleTextView.setText(objects[0].toString()); if (currentScreen == SCREEN_WINDOW_FULLSCREEN) { fullscreenButton.setImageResource(R.drawable.jc_shrink); backButton.setVisibility(View.VISIBLE); tinyBackImageView.setVisibility(View.INVISIBLE); changeStartButtonSize((int) getResources().getDimension(R.dimen.jc_start_button_w_h_fullscreen)); } else if (currentScreen == SCREEN_LAYOUT_NORMAL || currentScreen == SCREEN_LAYOUT_LIST) { fullscreenButton.setImageResource(R.drawable.jc_enlarge); backButton.setVisibility(View.GONE); tinyBackImageView.setVisibility(View.INVISIBLE); changeStartButtonSize((int) getResources().getDimension(R.dimen.jc_start_button_w_h_normal)); } else if (currentScreen == SCREEN_WINDOW_TINY) { tinyBackImageView.setVisibility(View.VISIBLE); setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); } } public void changeStartButtonSize(int size) { ViewGroup.LayoutParams lp = startButton.getLayoutParams(); lp.height = size; lp.width = size; lp = loadingProgressBar.getLayoutParams(); lp.height = size; lp.width = size; } @Override public int getLayoutId() { return R.layout.jc_layout_standard; } @Override public void setUiWitStateAndScreen(int state) { super.setUiWitStateAndScreen(state); switch (currentState) { case CURRENT_STATE_NORMAL: changeUiToNormal(); break; case CURRENT_STATE_PREPARING: changeUiToPreparingShow(); startDismissControlViewTimer(); break; case CURRENT_STATE_PLAYING: changeUiToPlayingShow(); startDismissControlViewTimer(); break; case CURRENT_STATE_PAUSE: changeUiToPauseShow(); cancelDismissControlViewTimer(); break; case CURRENT_STATE_ERROR: changeUiToError(); break; case CURRENT_STATE_AUTO_COMPLETE: changeUiToCompleteShow(); cancelDismissControlViewTimer(); bottomProgressBar.setProgress(100); break; case CURRENT_STATE_PLAYING_BUFFERING_START: changeUiToPlayingBufferingShow(); break; } } @Override public boolean onTouch(View v, MotionEvent event) { int id = v.getId(); if (id == R.id.surface_container) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_MOVE: break; case MotionEvent.ACTION_UP: startDismissControlViewTimer(); if (mChangePosition) { int duration = getDuration(); int progress = mSeekTimePosition * 100 / (duration == 0 ? 1 : duration); bottomProgressBar.setProgress(progress); } if (!mChangePosition && !mChangeVolume) { onEvent(JCUserActionStandard.ON_CLICK_BLANK); onClickUiToggle(); } break; } } else if (id == R.id.bottom_seek_progress) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: cancelDismissControlViewTimer(); break; case MotionEvent.ACTION_UP: startDismissControlViewTimer(); break; } } return super.onTouch(v, event); } @Override public void onClick(View v) { super.onClick(v); int i = v.getId(); if (i == R.id.thumb) { if (TextUtils.isEmpty(url)) { Toast.makeText(getContext(), getResources().getString(R.string.no_url), Toast.LENGTH_SHORT).show(); return; } if (currentState == CURRENT_STATE_NORMAL) { if (!url.startsWith("file") && !url.startsWith("/") && !JCUtils.isWifiConnected(getContext()) && !WIFI_TIP_DIALOG_SHOWED) { showWifiDialog(); return; } startVideo(); } else if (currentState == CURRENT_STATE_AUTO_COMPLETE) { onClickUiToggle(); } } else if (i == R.id.surface_container) { startDismissControlViewTimer(); } else if (i == R.id.back) { backPress(); } else if (i == R.id.back_tiny) { backPress(); } } @Override public void showWifiDialog() { super.showWifiDialog(); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setMessage(getResources().getString(R.string.tips_not_wifi)); builder.setPositiveButton(getResources().getString(R.string.tips_not_wifi_confirm), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); startVideo(); WIFI_TIP_DIALOG_SHOWED = true; } }); builder.setNegativeButton(getResources().getString(R.string.tips_not_wifi_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); if (currentScreen == SCREEN_WINDOW_FULLSCREEN) { dialog.dismiss(); clearFullscreenLayout(); } } }); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { dialog.dismiss(); if (currentScreen == SCREEN_WINDOW_FULLSCREEN) { dialog.dismiss(); clearFullscreenLayout(); } } }); builder.create().show(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { super.onStartTrackingTouch(seekBar); cancelDismissControlViewTimer(); } @Override public void onStopTrackingTouch(SeekBar seekBar) { super.onStopTrackingTouch(seekBar); startDismissControlViewTimer(); } public void startVideo() { prepareMediaPlayer(); onEvent(JCUserActionStandard.ON_CLICK_START_THUMB); } public void onClickUiToggle() { if (currentState == CURRENT_STATE_PREPARING) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPreparingClear(); } else { changeUiToPreparingShow(); } } else if (currentState == CURRENT_STATE_PLAYING) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPlayingClear(); } else { changeUiToPlayingShow(); } } else if (currentState == CURRENT_STATE_PAUSE) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPauseClear(); } else { changeUiToPauseShow(); } } else if (currentState == CURRENT_STATE_AUTO_COMPLETE) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToCompleteClear(); } else { changeUiToCompleteShow(); } } else if (currentState == CURRENT_STATE_PLAYING_BUFFERING_START) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPlayingBufferingClear(); } else { changeUiToPlayingBufferingShow(); } } } public void onCLickUiToggleToClear() { if (currentState == CURRENT_STATE_PREPARING) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPreparingClear(); } else { } } else if (currentState == CURRENT_STATE_PLAYING) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPlayingClear(); } else { } } else if (currentState == CURRENT_STATE_PAUSE) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPauseClear(); } else { } } else if (currentState == CURRENT_STATE_AUTO_COMPLETE) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToCompleteClear(); } else { } } else if (currentState == CURRENT_STATE_PLAYING_BUFFERING_START) { if (bottomContainer.getVisibility() == View.VISIBLE) { changeUiToPlayingBufferingClear(); } else { } } } @Override public void setProgressAndText() { super.setProgressAndText(); int position = getCurrentPositionWhenPlaying(); int duration = getDuration(); int progress = position * 100 / (duration == 0 ? 1 : duration); if (progress != 0) bottomProgressBar.setProgress(progress); } @Override public void setBufferProgress(int bufferProgress) { super.setBufferProgress(bufferProgress); if (bufferProgress != 0) bottomProgressBar.setSecondaryProgress(bufferProgress); } @Override public void resetProgressAndTime() { super.resetProgressAndTime(); bottomProgressBar.setProgress(0); bottomProgressBar.setSecondaryProgress(0); } //Unified management Ui public void changeUiToNormal() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToPreparingShow() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToPreparingClear() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); break; case SCREEN_WINDOW_TINY: break; } } //JustPreparedUi @Override public void onPrepared() { super.onPrepared(); setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE); startDismissControlViewTimer(); } public void changeUiToPlayingShow() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToPlayingClear() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToPauseShow() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToPauseClear() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToPlayingBufferingShow() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToPlayingBufferingClear() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE); updateStartImage(); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE); updateStartImage(); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToCompleteShow() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToCompleteClear() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE); updateStartImage(); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE); updateStartImage(); break; case SCREEN_WINDOW_TINY: break; } } public void changeUiToError() { switch (currentScreen) { case SCREEN_LAYOUT_NORMAL: case SCREEN_LAYOUT_LIST: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_FULLSCREEN: setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE); updateStartImage(); break; case SCREEN_WINDOW_TINY: break; } } public void setAllControlsVisible(int topCon, int bottomCon, int startBtn, int loadingPro, int thumbImg, int coverImg, int bottomPro) { topContainer.setVisibility(topCon); bottomContainer.setVisibility(bottomCon); startButton.setVisibility(startBtn); loadingProgressBar.setVisibility(loadingPro); thumbImageView.setVisibility(thumbImg); bottomProgressBar.setVisibility(bottomPro); } public void updateStartImage() { if (currentState == CURRENT_STATE_PLAYING) { startButton.setImageResource(R.drawable.jc_click_pause_selector); } else if (currentState == CURRENT_STATE_ERROR) { startButton.setImageResource(R.drawable.jc_click_error_selector); } else { startButton.setImageResource(R.drawable.jc_click_play_selector); } } protected Dialog mProgressDialog; protected ProgressBar mDialogProgressBar; protected TextView mDialogSeekTime; protected TextView mDialogTotalTime; protected ImageView mDialogIcon; @Override public void showProgressDialog(float deltaX, String seekTime, int seekTimePosition, String totalTime, int totalTimeDuration) { super.showProgressDialog(deltaX, seekTime, seekTimePosition, totalTime, totalTimeDuration); if (mProgressDialog == null) { View localView = LayoutInflater.from(getContext()).inflate(R.layout.jc_dialog_progress, null); mDialogProgressBar = ((ProgressBar) localView.findViewById(R.id.duration_progressbar)); mDialogSeekTime = ((TextView) localView.findViewById(R.id.tv_current)); mDialogTotalTime = ((TextView) localView.findViewById(R.id.tv_duration)); mDialogIcon = ((ImageView) localView.findViewById(R.id.duration_image_tip)); mProgressDialog = createDialogWithView(localView); } if (!mProgressDialog.isShowing()) { mProgressDialog.show(); } mDialogSeekTime.setText(seekTime); mDialogTotalTime.setText(" / " + totalTime); mDialogProgressBar.setProgress(totalTimeDuration <= 0 ? 0 : (seekTimePosition * 100 / totalTimeDuration)); if (deltaX > 0) { mDialogIcon.setBackgroundResource(R.drawable.jc_forward_icon); } else { mDialogIcon.setBackgroundResource(R.drawable.jc_backward_icon); } onCLickUiToggleToClear(); } @Override public void dismissProgressDialog() { super.dismissProgressDialog(); if (mProgressDialog != null) { mProgressDialog.dismiss(); } } protected Dialog mVolumeDialog; protected ProgressBar mDialogVolumeProgressBar; protected TextView mDialogVolumeTextView; protected ImageView mDialogVolumeImageView; @Override public void showVolumeDialog(float deltaY, int volumePercent) { super.showVolumeDialog(deltaY, volumePercent); if (mVolumeDialog == null) { View localView = LayoutInflater.from(getContext()).inflate(R.layout.jc_dialog_volume, null); mDialogVolumeImageView = ((ImageView) localView.findViewById(R.id.volume_image_tip)); mDialogVolumeTextView = ((TextView) localView.findViewById(R.id.tv_volume)); mDialogVolumeProgressBar = ((ProgressBar) localView.findViewById(R.id.volume_progressbar)); mVolumeDialog = createDialogWithView(localView); } if (!mVolumeDialog.isShowing()) { mVolumeDialog.show(); } if (volumePercent <= 0) { mDialogVolumeImageView.setBackgroundResource(R.drawable.jc_close_volume); } else { mDialogVolumeImageView.setBackgroundResource(R.drawable.jc_add_volume); } if (volumePercent > 100) { volumePercent = 100; } else if (volumePercent < 0) { volumePercent = 0; } mDialogVolumeTextView.setText(volumePercent + "%"); mDialogVolumeProgressBar.setProgress(volumePercent); onCLickUiToggleToClear(); } @Override public void dismissVolumeDialog() { super.dismissVolumeDialog(); if (mVolumeDialog != null) { mVolumeDialog.dismiss(); } } protected Dialog mBrightnessDialog; protected ProgressBar mDialogBrightnessProgressBar; protected TextView mDialogBrightnessTextView; @Override public void showBrightnessDialog(int brightnessPercent) { super.showBrightnessDialog(brightnessPercent); if (mBrightnessDialog == null) { View localView = LayoutInflater.from(getContext()).inflate(R.layout.jc_dialog_brightness, null); mDialogBrightnessTextView = ((TextView) localView.findViewById(R.id.tv_brightness)); mDialogBrightnessProgressBar = ((ProgressBar) localView.findViewById(R.id.brightness_progressbar)); mBrightnessDialog = createDialogWithView(localView); } if (!mBrightnessDialog.isShowing()) { mBrightnessDialog.show(); } if (brightnessPercent > 100) { brightnessPercent = 100; } else if (brightnessPercent < 0) { brightnessPercent = 0; } mDialogBrightnessTextView.setText(brightnessPercent + "%"); mDialogBrightnessProgressBar.setProgress(brightnessPercent); onCLickUiToggleToClear(); } @Override public void dismissBrightnessDialog() { super.dismissBrightnessDialog(); if (mBrightnessDialog != null) { mBrightnessDialog.dismiss(); } } public Dialog createDialogWithView(View localView) { Dialog dialog = new Dialog(getContext(), R.style.jc_style_dialog_progress); dialog.setContentView(localView); Window window = dialog.getWindow(); window.addFlags(Window.FEATURE_ACTION_BAR); window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL); window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE); window.setLayout(-2, -2); WindowManager.LayoutParams localLayoutParams = window.getAttributes(); localLayoutParams.gravity = Gravity.CENTER; window.setAttributes(localLayoutParams); return dialog; } public void startDismissControlViewTimer() { cancelDismissControlViewTimer(); DISMISS_CONTROL_VIEW_TIMER = new Timer(); mDismissControlViewTimerTask = new DismissControlViewTimerTask(); DISMISS_CONTROL_VIEW_TIMER.schedule(mDismissControlViewTimerTask, 2500); } public void cancelDismissControlViewTimer() { if (DISMISS_CONTROL_VIEW_TIMER != null) { DISMISS_CONTROL_VIEW_TIMER.cancel(); } if (mDismissControlViewTimerTask != null) { mDismissControlViewTimerTask.cancel(); } } public class DismissControlViewTimerTask extends TimerTask { @Override public void run() { if (currentState != CURRENT_STATE_NORMAL && currentState != CURRENT_STATE_ERROR && currentState != CURRENT_STATE_AUTO_COMPLETE) { if (getContext() != null && getContext() instanceof Activity) { ((Activity) getContext()).runOnUiThread(new Runnable() { @Override public void run() { bottomContainer.setVisibility(View.INVISIBLE); topContainer.setVisibility(View.INVISIBLE); startButton.setVisibility(View.INVISIBLE); if (currentScreen != SCREEN_WINDOW_TINY) { bottomProgressBar.setVisibility(View.VISIBLE); } } }); } } } } @Override public void onAutoCompletion() { super.onAutoCompletion(); cancelDismissControlViewTimer(); } @Override public void onCompletion() { super.onCompletion(); cancelDismissControlViewTimer(); } }
{ "content_hash": "3951b301a71d799aa1ed68311958b23e", "timestamp": "", "source": "github", "line_count": 770, "max_line_length": 131, "avg_line_length": 37.82987012987013, "alnum_prop": 0.5896185931545882, "repo_name": "lipprints/jjjx", "id": "f89e64c1d667ee80f6880c3a84206d9382ced0ec", "size": "29129", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "JJJX/jcvideoplayer-lib/src/main/java/fm/jiecao/jcvideoplayer_lib/JCVideoPlayerStandard.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1002055" } ] }
package ast import ( "fmt" "io" "strings" "time" "github.com/pingcap/errors" "github.com/pingcap/tidb/parser/format" "github.com/pingcap/tidb/parser/model" "github.com/pingcap/tidb/parser/types" ) var ( _ FuncNode = &AggregateFuncExpr{} _ FuncNode = &FuncCallExpr{} _ FuncNode = &FuncCastExpr{} _ FuncNode = &WindowFuncExpr{} ) // List scalar function names. const ( LogicAnd = "and" Cast = "cast" LeftShift = "leftshift" RightShift = "rightshift" LogicOr = "or" GE = "ge" LE = "le" EQ = "eq" NE = "ne" LT = "lt" GT = "gt" Plus = "plus" Minus = "minus" And = "bitand" Or = "bitor" Mod = "mod" Xor = "bitxor" Div = "div" Mul = "mul" UnaryNot = "not" // Avoid name conflict with Not in github/pingcap/check. BitNeg = "bitneg" IntDiv = "intdiv" LogicXor = "xor" NullEQ = "nulleq" UnaryPlus = "unaryplus" UnaryMinus = "unaryminus" In = "in" Like = "like" Case = "case" Regexp = "regexp" IsNull = "isnull" IsTruthWithoutNull = "istrue" // Avoid name conflict with IsTrue in github/pingcap/check. IsTruthWithNull = "istrue_with_null" IsFalsity = "isfalse" // Avoid name conflict with IsFalse in github/pingcap/check. RowFunc = "row" SetVar = "setvar" GetVar = "getvar" Values = "values" BitCount = "bit_count" GetParam = "getparam" // common functions Coalesce = "coalesce" Greatest = "greatest" Least = "least" Interval = "interval" // math functions Abs = "abs" Acos = "acos" Asin = "asin" Atan = "atan" Atan2 = "atan2" Ceil = "ceil" Ceiling = "ceiling" Conv = "conv" Cos = "cos" Cot = "cot" CRC32 = "crc32" Degrees = "degrees" Exp = "exp" Floor = "floor" Ln = "ln" Log = "log" Log2 = "log2" Log10 = "log10" PI = "pi" Pow = "pow" Power = "power" Radians = "radians" Rand = "rand" Round = "round" Sign = "sign" Sin = "sin" Sqrt = "sqrt" Tan = "tan" Truncate = "truncate" // time functions AddDate = "adddate" AddTime = "addtime" ConvertTz = "convert_tz" Curdate = "curdate" CurrentDate = "current_date" CurrentTime = "current_time" CurrentTimestamp = "current_timestamp" Curtime = "curtime" Date = "date" DateLiteral = "'tidb`.(dateliteral" DateAdd = "date_add" DateFormat = "date_format" DateSub = "date_sub" DateDiff = "datediff" Day = "day" DayName = "dayname" DayOfMonth = "dayofmonth" DayOfWeek = "dayofweek" DayOfYear = "dayofyear" Extract = "extract" FromDays = "from_days" FromUnixTime = "from_unixtime" GetFormat = "get_format" Hour = "hour" LocalTime = "localtime" LocalTimestamp = "localtimestamp" MakeDate = "makedate" MakeTime = "maketime" MicroSecond = "microsecond" Minute = "minute" Month = "month" MonthName = "monthname" Now = "now" PeriodAdd = "period_add" PeriodDiff = "period_diff" Quarter = "quarter" SecToTime = "sec_to_time" Second = "second" StrToDate = "str_to_date" SubDate = "subdate" SubTime = "subtime" Sysdate = "sysdate" Time = "time" TimeLiteral = "'tidb`.(timeliteral" TimeFormat = "time_format" TimeToSec = "time_to_sec" TimeDiff = "timediff" Timestamp = "timestamp" TimestampLiteral = "'tidb`.(timestampliteral" TimestampAdd = "timestampadd" TimestampDiff = "timestampdiff" ToDays = "to_days" ToSeconds = "to_seconds" UnixTimestamp = "unix_timestamp" UTCDate = "utc_date" UTCTime = "utc_time" UTCTimestamp = "utc_timestamp" Week = "week" Weekday = "weekday" WeekOfYear = "weekofyear" Year = "year" YearWeek = "yearweek" LastDay = "last_day" // TSO functions // TiDBBoundedStaleness is used to determine the TS for a read only request with the given bounded staleness. // It will be used in the Stale Read feature. // For more info, please see AsOfClause. TiDBBoundedStaleness = "tidb_bounded_staleness" TiDBParseTso = "tidb_parse_tso" // string functions ASCII = "ascii" Bin = "bin" Concat = "concat" ConcatWS = "concat_ws" Convert = "convert" Elt = "elt" ExportSet = "export_set" Field = "field" Format = "format" FromBase64 = "from_base64" InsertFunc = "insert_func" Instr = "instr" Lcase = "lcase" Left = "left" Length = "length" LoadFile = "load_file" Locate = "locate" Lower = "lower" Lpad = "lpad" LTrim = "ltrim" MakeSet = "make_set" Mid = "mid" Oct = "oct" OctetLength = "octet_length" Ord = "ord" Position = "position" Quote = "quote" Repeat = "repeat" Replace = "replace" Reverse = "reverse" Right = "right" RTrim = "rtrim" Space = "space" Strcmp = "strcmp" Substring = "substring" Substr = "substr" SubstringIndex = "substring_index" ToBase64 = "to_base64" Trim = "trim" Translate = "translate" Upper = "upper" Ucase = "ucase" Hex = "hex" Unhex = "unhex" Rpad = "rpad" BitLength = "bit_length" CharFunc = "char_func" CharLength = "char_length" CharacterLength = "character_length" FindInSet = "find_in_set" WeightString = "weight_string" Soundex = "soundex" // information functions Benchmark = "benchmark" Charset = "charset" Coercibility = "coercibility" Collation = "collation" ConnectionID = "connection_id" CurrentUser = "current_user" CurrentRole = "current_role" Database = "database" FoundRows = "found_rows" LastInsertId = "last_insert_id" RowCount = "row_count" Schema = "schema" SessionUser = "session_user" SystemUser = "system_user" User = "user" Version = "version" TiDBVersion = "tidb_version" TiDBIsDDLOwner = "tidb_is_ddl_owner" TiDBDecodePlan = "tidb_decode_plan" TiDBDecodeBinaryPlan = "tidb_decode_binary_plan" TiDBDecodeSQLDigests = "tidb_decode_sql_digests" FormatBytes = "format_bytes" FormatNanoTime = "format_nano_time" // control functions If = "if" Ifnull = "ifnull" Nullif = "nullif" // miscellaneous functions AnyValue = "any_value" DefaultFunc = "default_func" InetAton = "inet_aton" InetNtoa = "inet_ntoa" Inet6Aton = "inet6_aton" Inet6Ntoa = "inet6_ntoa" IsFreeLock = "is_free_lock" IsIPv4 = "is_ipv4" IsIPv4Compat = "is_ipv4_compat" IsIPv4Mapped = "is_ipv4_mapped" IsIPv6 = "is_ipv6" IsUsedLock = "is_used_lock" IsUUID = "is_uuid" MasterPosWait = "master_pos_wait" NameConst = "name_const" ReleaseAllLocks = "release_all_locks" Sleep = "sleep" UUID = "uuid" UUIDShort = "uuid_short" UUIDToBin = "uuid_to_bin" BinToUUID = "bin_to_uuid" VitessHash = "vitess_hash" TiDBShard = "tidb_shard" GetLock = "get_lock" ReleaseLock = "release_lock" // encryption and compression functions AesDecrypt = "aes_decrypt" AesEncrypt = "aes_encrypt" Compress = "compress" Decode = "decode" DesDecrypt = "des_decrypt" DesEncrypt = "des_encrypt" Encode = "encode" Encrypt = "encrypt" MD5 = "md5" OldPassword = "old_password" PasswordFunc = "password_func" RandomBytes = "random_bytes" SHA1 = "sha1" SHA = "sha" SHA2 = "sha2" Uncompress = "uncompress" UncompressedLength = "uncompressed_length" ValidatePasswordStrength = "validate_password_strength" // json functions JSONType = "json_type" JSONExtract = "json_extract" JSONUnquote = "json_unquote" JSONArray = "json_array" JSONObject = "json_object" JSONMerge = "json_merge" JSONSet = "json_set" JSONInsert = "json_insert" JSONReplace = "json_replace" JSONRemove = "json_remove" JSONContains = "json_contains" JSONContainsPath = "json_contains_path" JSONValid = "json_valid" JSONArrayAppend = "json_array_append" JSONArrayInsert = "json_array_insert" JSONMergePatch = "json_merge_patch" JSONMergePreserve = "json_merge_preserve" JSONPretty = "json_pretty" JSONQuote = "json_quote" JSONSearch = "json_search" JSONStorageSize = "json_storage_size" JSONDepth = "json_depth" JSONKeys = "json_keys" JSONLength = "json_length" // TiDB internal function. TiDBDecodeKey = "tidb_decode_key" TiDBDecodeBase64Key = "tidb_decode_base64_key" // MVCC information fetching function. GetMvccInfo = "get_mvcc_info" // Sequence function. NextVal = "nextval" LastVal = "lastval" SetVal = "setval" ) type FuncCallExprType int8 const ( FuncCallExprTypeKeyword FuncCallExprType = iota FuncCallExprTypeGeneric ) // FuncCallExpr is for function expression. type FuncCallExpr struct { funcNode Tp FuncCallExprType Schema model.CIStr // FnName is the function name. FnName model.CIStr // Args is the function args. Args []ExprNode } // Restore implements Node interface. func (n *FuncCallExpr) Restore(ctx *format.RestoreCtx) error { var specialLiteral string switch n.FnName.L { case DateLiteral: specialLiteral = "DATE " case TimeLiteral: specialLiteral = "TIME " case TimestampLiteral: specialLiteral = "TIMESTAMP " } if specialLiteral != "" { ctx.WritePlain(specialLiteral) if err := n.Args[0].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr") } return nil } if len(n.Schema.String()) != 0 { ctx.WriteName(n.Schema.O) ctx.WritePlain(".") } if n.Tp == FuncCallExprTypeGeneric { ctx.WriteName(n.FnName.O) } else { ctx.WriteKeyWord(n.FnName.O) } ctx.WritePlain("(") switch n.FnName.L { case "convert": if err := n.Args[0].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr") } ctx.WriteKeyWord(" USING ") if err := n.Args[1].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr") } case "adddate", "subdate", "date_add", "date_sub": if err := n.Args[0].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args[0]") } ctx.WritePlain(", ") ctx.WriteKeyWord("INTERVAL ") if err := n.Args[1].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args[1]") } ctx.WritePlain(" ") if err := n.Args[2].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args[2]") } case "extract": if err := n.Args[0].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args[0]") } ctx.WriteKeyWord(" FROM ") if err := n.Args[1].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args[1]") } case "position": if err := n.Args[0].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr") } ctx.WriteKeyWord(" IN ") if err := n.Args[1].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr") } case "trim": switch len(n.Args) { case 3: if err := n.Args[2].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args[2]") } ctx.WritePlain(" ") fallthrough case 2: if expr, isValue := n.Args[1].(ValueExpr); !isValue || expr.GetValue() != nil { if err := n.Args[1].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args[1]") } ctx.WritePlain(" ") } ctx.WriteKeyWord("FROM ") fallthrough case 1: if err := n.Args[0].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args[0]") } } case WeightString: if err := n.Args[0].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.(WEIGHT_STRING).Args[0]") } if len(n.Args) == 3 { ctx.WriteKeyWord(" AS ") ctx.WriteKeyWord(n.Args[1].(ValueExpr).GetValue().(string)) ctx.WritePlain("(") if err := n.Args[2].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.(WEIGHT_STRING).Args[2]") } ctx.WritePlain(")") } default: for i, argv := range n.Args { if i != 0 { ctx.WritePlain(", ") } if err := argv.Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args %d", i) } } } ctx.WritePlain(")") return nil } // Format the ExprNode into a Writer. func (n *FuncCallExpr) Format(w io.Writer) { fmt.Fprintf(w, "%s(", n.FnName.L) if !n.specialFormatArgs(w) { for i, arg := range n.Args { arg.Format(w) if i != len(n.Args)-1 { fmt.Fprint(w, ", ") } } } fmt.Fprint(w, ")") } // specialFormatArgs formats argument list for some special functions. func (n *FuncCallExpr) specialFormatArgs(w io.Writer) bool { switch n.FnName.L { case DateAdd, DateSub, AddDate, SubDate: n.Args[0].Format(w) fmt.Fprint(w, ", INTERVAL ") n.Args[1].Format(w) fmt.Fprint(w, " ") n.Args[2].Format(w) return true } return false } // Accept implements Node interface. func (n *FuncCallExpr) Accept(v Visitor) (Node, bool) { newNode, skipChildren := v.Enter(n) if skipChildren { return v.Leave(newNode) } n = newNode.(*FuncCallExpr) for i, val := range n.Args { node, ok := val.Accept(v) if !ok { return n, false } n.Args[i] = node.(ExprNode) } return v.Leave(n) } // CastFunctionType is the type for cast function. type CastFunctionType int // CastFunction types const ( CastFunction CastFunctionType = iota + 1 CastConvertFunction CastBinaryOperator ) // FuncCastExpr is the cast function converting value to another type, e.g, cast(expr AS signed). // See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html type FuncCastExpr struct { funcNode // Expr is the expression to be converted. Expr ExprNode // Tp is the conversion type. Tp *types.FieldType // FunctionType is either Cast, Convert or Binary. FunctionType CastFunctionType // ExplicitCharSet is true when charset is explicit indicated. ExplicitCharSet bool } // Restore implements Node interface. func (n *FuncCastExpr) Restore(ctx *format.RestoreCtx) error { switch n.FunctionType { case CastFunction: ctx.WriteKeyWord("CAST") ctx.WritePlain("(") if err := n.Expr.Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr") } ctx.WriteKeyWord(" AS ") n.Tp.RestoreAsCastType(ctx, n.ExplicitCharSet) ctx.WritePlain(")") case CastConvertFunction: ctx.WriteKeyWord("CONVERT") ctx.WritePlain("(") if err := n.Expr.Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr") } ctx.WritePlain(", ") n.Tp.RestoreAsCastType(ctx, n.ExplicitCharSet) ctx.WritePlain(")") case CastBinaryOperator: ctx.WriteKeyWord("BINARY ") if err := n.Expr.Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr") } } return nil } // Format the ExprNode into a Writer. func (n *FuncCastExpr) Format(w io.Writer) { switch n.FunctionType { case CastFunction: fmt.Fprint(w, "CAST(") n.Expr.Format(w) fmt.Fprint(w, " AS ") n.Tp.FormatAsCastType(w, n.ExplicitCharSet) fmt.Fprint(w, ")") case CastConvertFunction: fmt.Fprint(w, "CONVERT(") n.Expr.Format(w) fmt.Fprint(w, ", ") n.Tp.FormatAsCastType(w, n.ExplicitCharSet) fmt.Fprint(w, ")") case CastBinaryOperator: fmt.Fprint(w, "BINARY ") n.Expr.Format(w) } } // Accept implements Node Accept interface. func (n *FuncCastExpr) Accept(v Visitor) (Node, bool) { newNode, skipChildren := v.Enter(n) if skipChildren { return v.Leave(newNode) } n = newNode.(*FuncCastExpr) node, ok := n.Expr.Accept(v) if !ok { return n, false } n.Expr = node.(ExprNode) return v.Leave(n) } // TrimDirectionType is the type for trim direction. type TrimDirectionType int const ( // TrimBothDefault trims from both direction by default. TrimBothDefault TrimDirectionType = iota // TrimBoth trims from both direction with explicit notation. TrimBoth // TrimLeading trims from left. TrimLeading // TrimTrailing trims from right. TrimTrailing ) // String implements fmt.Stringer interface. func (direction TrimDirectionType) String() string { switch direction { case TrimBoth, TrimBothDefault: return "BOTH" case TrimLeading: return "LEADING" case TrimTrailing: return "TRAILING" default: return "" } } // TrimDirectionExpr is an expression representing the trim direction used in the TRIM() function. type TrimDirectionExpr struct { exprNode // Direction is the trim direction Direction TrimDirectionType } // Restore implements Node interface. func (n *TrimDirectionExpr) Restore(ctx *format.RestoreCtx) error { ctx.WriteKeyWord(n.Direction.String()) return nil } // Format the ExprNode into a Writer. func (n *TrimDirectionExpr) Format(w io.Writer) { fmt.Fprint(w, n.Direction.String()) } // Accept implements Node Accept interface. func (n *TrimDirectionExpr) Accept(v Visitor) (Node, bool) { newNode, skipChildren := v.Enter(n) if skipChildren { return v.Leave(newNode) } return v.Leave(n) } // DateArithType is type for DateArith type. type DateArithType byte const ( // DateArithAdd is to run adddate or date_add function option. // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_adddate // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-add DateArithAdd DateArithType = iota + 1 // DateArithSub is to run subdate or date_sub function option. // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_subdate // See https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-sub DateArithSub ) const ( // AggFuncCount is the name of Count function. AggFuncCount = "count" // AggFuncSum is the name of Sum function. AggFuncSum = "sum" // AggFuncAvg is the name of Avg function. AggFuncAvg = "avg" // AggFuncFirstRow is the name of FirstRowColumn function. AggFuncFirstRow = "firstrow" // AggFuncMax is the name of max function. AggFuncMax = "max" // AggFuncMin is the name of min function. AggFuncMin = "min" // AggFuncGroupConcat is the name of group_concat function. AggFuncGroupConcat = "group_concat" // AggFuncBitOr is the name of bit_or function. AggFuncBitOr = "bit_or" // AggFuncBitXor is the name of bit_xor function. AggFuncBitXor = "bit_xor" // AggFuncBitAnd is the name of bit_and function. AggFuncBitAnd = "bit_and" // AggFuncVarPop is the name of var_pop function AggFuncVarPop = "var_pop" // AggFuncVarSamp is the name of var_samp function AggFuncVarSamp = "var_samp" // AggFuncStddevPop is the name of stddev_pop/std/stddev function AggFuncStddevPop = "stddev_pop" // AggFuncStddevSamp is the name of stddev_samp function AggFuncStddevSamp = "stddev_samp" // AggFuncJsonArrayagg is the name of json_arrayagg function AggFuncJsonArrayagg = "json_arrayagg" // AggFuncJsonObjectAgg is the name of json_objectagg function AggFuncJsonObjectAgg = "json_objectagg" // AggFuncApproxCountDistinct is the name of approx_count_distinct function. AggFuncApproxCountDistinct = "approx_count_distinct" // AggFuncApproxPercentile is the name of approx_percentile function. AggFuncApproxPercentile = "approx_percentile" ) // AggregateFuncExpr represents aggregate function expression. type AggregateFuncExpr struct { funcNode // F is the function name. F string // Args is the function args. Args []ExprNode // Distinct is true, function hence only aggregate distinct values. // For example, column c1 values are "1", "2", "2", "sum(c1)" is "5", // but "sum(distinct c1)" is "3". Distinct bool // Order is only used in GROUP_CONCAT Order *OrderByClause } // Restore implements Node interface. func (n *AggregateFuncExpr) Restore(ctx *format.RestoreCtx) error { ctx.WriteKeyWord(n.F) ctx.WritePlain("(") if n.Distinct { ctx.WriteKeyWord("DISTINCT ") } switch strings.ToLower(n.F) { case "group_concat": for i := 0; i < len(n.Args)-1; i++ { if i != 0 { ctx.WritePlain(", ") } if err := n.Args[i].Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore AggregateFuncExpr.Args[%d]", i) } } if n.Order != nil { ctx.WritePlain(" ") if err := n.Order.Restore(ctx); err != nil { return errors.Annotate(err, "An error occur while restore AggregateFuncExpr.Args Order") } } ctx.WriteKeyWord(" SEPARATOR ") if err := n.Args[len(n.Args)-1].Restore(ctx); err != nil { return errors.Annotate(err, "An error occurred while restore AggregateFuncExpr.Args SEPARATOR") } default: for i, argv := range n.Args { if i != 0 { ctx.WritePlain(", ") } if err := argv.Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore AggregateFuncExpr.Args[%d]", i) } } } ctx.WritePlain(")") return nil } // Format the ExprNode into a Writer. func (n *AggregateFuncExpr) Format(w io.Writer) { panic("Not implemented") } // Accept implements Node Accept interface. func (n *AggregateFuncExpr) Accept(v Visitor) (Node, bool) { newNode, skipChildren := v.Enter(n) if skipChildren { return v.Leave(newNode) } n = newNode.(*AggregateFuncExpr) for i, val := range n.Args { node, ok := val.Accept(v) if !ok { return n, false } n.Args[i] = node.(ExprNode) } if n.Order != nil { node, ok := n.Order.Accept(v) if !ok { return n, false } n.Order = node.(*OrderByClause) } return v.Leave(n) } const ( // WindowFuncRowNumber is the name of row_number function. WindowFuncRowNumber = "row_number" // WindowFuncRank is the name of rank function. WindowFuncRank = "rank" // WindowFuncDenseRank is the name of dense_rank function. WindowFuncDenseRank = "dense_rank" // WindowFuncCumeDist is the name of cume_dist function. WindowFuncCumeDist = "cume_dist" // WindowFuncPercentRank is the name of percent_rank function. WindowFuncPercentRank = "percent_rank" // WindowFuncNtile is the name of ntile function. WindowFuncNtile = "ntile" // WindowFuncLead is the name of lead function. WindowFuncLead = "lead" // WindowFuncLag is the name of lag function. WindowFuncLag = "lag" // WindowFuncFirstValue is the name of first_value function. WindowFuncFirstValue = "first_value" // WindowFuncLastValue is the name of last_value function. WindowFuncLastValue = "last_value" // WindowFuncNthValue is the name of nth_value function. WindowFuncNthValue = "nth_value" ) // WindowFuncExpr represents window function expression. type WindowFuncExpr struct { funcNode // F is the function name. F string // Args is the function args. Args []ExprNode // Distinct cannot be true for most window functions, except `max` and `min`. // We need to raise error if it is not allowed to be true. Distinct bool // IgnoreNull indicates how to handle null value. // MySQL only supports `RESPECT NULLS`, so we need to raise error if it is true. IgnoreNull bool // FromLast indicates the calculation direction of this window function. // MySQL only supports calculation from first, so we need to raise error if it is true. FromLast bool // Spec is the specification of this window. Spec WindowSpec } // Restore implements Node interface. func (n *WindowFuncExpr) Restore(ctx *format.RestoreCtx) error { ctx.WriteKeyWord(n.F) ctx.WritePlain("(") for i, v := range n.Args { if i != 0 { ctx.WritePlain(", ") } else if n.Distinct { ctx.WriteKeyWord("DISTINCT ") } if err := v.Restore(ctx); err != nil { return errors.Annotatef(err, "An error occurred while restore WindowFuncExpr.Args[%d]", i) } } ctx.WritePlain(")") if n.FromLast { ctx.WriteKeyWord(" FROM LAST") } if n.IgnoreNull { ctx.WriteKeyWord(" IGNORE NULLS") } ctx.WriteKeyWord(" OVER ") if err := n.Spec.Restore(ctx); err != nil { return errors.Annotate(err, "An error occurred while restore WindowFuncExpr.Spec") } return nil } // Format formats the window function expression into a Writer. func (n *WindowFuncExpr) Format(w io.Writer) { panic("Not implemented") } // Accept implements Node Accept interface. func (n *WindowFuncExpr) Accept(v Visitor) (Node, bool) { newNode, skipChildren := v.Enter(n) if skipChildren { return v.Leave(newNode) } n = newNode.(*WindowFuncExpr) for i, val := range n.Args { node, ok := val.Accept(v) if !ok { return n, false } n.Args[i] = node.(ExprNode) } node, ok := n.Spec.Accept(v) if !ok { return n, false } n.Spec = *node.(*WindowSpec) return v.Leave(n) } // TimeUnitType is the type for time and timestamp units. type TimeUnitType int const ( // TimeUnitInvalid is a placeholder for an invalid time or timestamp unit TimeUnitInvalid TimeUnitType = iota // TimeUnitMicrosecond is the time or timestamp unit MICROSECOND. TimeUnitMicrosecond // TimeUnitSecond is the time or timestamp unit SECOND. TimeUnitSecond // TimeUnitMinute is the time or timestamp unit MINUTE. TimeUnitMinute // TimeUnitHour is the time or timestamp unit HOUR. TimeUnitHour // TimeUnitDay is the time or timestamp unit DAY. TimeUnitDay // TimeUnitWeek is the time or timestamp unit WEEK. TimeUnitWeek // TimeUnitMonth is the time or timestamp unit MONTH. TimeUnitMonth // TimeUnitQuarter is the time or timestamp unit QUARTER. TimeUnitQuarter // TimeUnitYear is the time or timestamp unit YEAR. TimeUnitYear // TimeUnitSecondMicrosecond is the time unit SECOND_MICROSECOND. TimeUnitSecondMicrosecond // TimeUnitMinuteMicrosecond is the time unit MINUTE_MICROSECOND. TimeUnitMinuteMicrosecond // TimeUnitMinuteSecond is the time unit MINUTE_SECOND. TimeUnitMinuteSecond // TimeUnitHourMicrosecond is the time unit HOUR_MICROSECOND. TimeUnitHourMicrosecond // TimeUnitHourSecond is the time unit HOUR_SECOND. TimeUnitHourSecond // TimeUnitHourMinute is the time unit HOUR_MINUTE. TimeUnitHourMinute // TimeUnitDayMicrosecond is the time unit DAY_MICROSECOND. TimeUnitDayMicrosecond // TimeUnitDaySecond is the time unit DAY_SECOND. TimeUnitDaySecond // TimeUnitDayMinute is the time unit DAY_MINUTE. TimeUnitDayMinute // TimeUnitDayHour is the time unit DAY_HOUR. TimeUnitDayHour // TimeUnitYearMonth is the time unit YEAR_MONTH. TimeUnitYearMonth ) // String implements fmt.Stringer interface. func (unit TimeUnitType) String() string { switch unit { case TimeUnitMicrosecond: return "MICROSECOND" case TimeUnitSecond: return "SECOND" case TimeUnitMinute: return "MINUTE" case TimeUnitHour: return "HOUR" case TimeUnitDay: return "DAY" case TimeUnitWeek: return "WEEK" case TimeUnitMonth: return "MONTH" case TimeUnitQuarter: return "QUARTER" case TimeUnitYear: return "YEAR" case TimeUnitSecondMicrosecond: return "SECOND_MICROSECOND" case TimeUnitMinuteMicrosecond: return "MINUTE_MICROSECOND" case TimeUnitMinuteSecond: return "MINUTE_SECOND" case TimeUnitHourMicrosecond: return "HOUR_MICROSECOND" case TimeUnitHourSecond: return "HOUR_SECOND" case TimeUnitHourMinute: return "HOUR_MINUTE" case TimeUnitDayMicrosecond: return "DAY_MICROSECOND" case TimeUnitDaySecond: return "DAY_SECOND" case TimeUnitDayMinute: return "DAY_MINUTE" case TimeUnitDayHour: return "DAY_HOUR" case TimeUnitYearMonth: return "YEAR_MONTH" default: return "" } } // Duration represented by this unit. // Returns error if the time unit is not a fixed time interval (such as MONTH) // or a composite unit (such as MINUTE_SECOND). func (unit TimeUnitType) Duration() (time.Duration, error) { switch unit { case TimeUnitMicrosecond: return time.Microsecond, nil case TimeUnitSecond: return time.Second, nil case TimeUnitMinute: return time.Minute, nil case TimeUnitHour: return time.Hour, nil case TimeUnitDay: return time.Hour * 24, nil case TimeUnitWeek: return time.Hour * 24 * 7, nil case TimeUnitMonth, TimeUnitQuarter, TimeUnitYear: return 0, errors.Errorf("%s is not a constant time interval and cannot be used here", unit) default: return 0, errors.Errorf("%s is a composite time unit and is not supported yet", unit) } } // TimeUnitExpr is an expression representing a time or timestamp unit. type TimeUnitExpr struct { exprNode // Unit is the time or timestamp unit. Unit TimeUnitType } // Restore implements Node interface. func (n *TimeUnitExpr) Restore(ctx *format.RestoreCtx) error { ctx.WriteKeyWord(n.Unit.String()) return nil } // Format the ExprNode into a Writer. func (n *TimeUnitExpr) Format(w io.Writer) { fmt.Fprint(w, n.Unit.String()) } // Accept implements Node Accept interface. func (n *TimeUnitExpr) Accept(v Visitor) (Node, bool) { newNode, skipChildren := v.Enter(n) if skipChildren { return v.Leave(newNode) } return v.Leave(n) } // GetFormatSelectorType is the type for the first argument of GET_FORMAT() function. type GetFormatSelectorType int const ( // GetFormatSelectorDate is the GET_FORMAT selector DATE. GetFormatSelectorDate GetFormatSelectorType = iota + 1 // GetFormatSelectorTime is the GET_FORMAT selector TIME. GetFormatSelectorTime // GetFormatSelectorDatetime is the GET_FORMAT selector DATETIME and TIMESTAMP. GetFormatSelectorDatetime ) // GetFormatSelectorExpr is an expression used as the first argument of GET_FORMAT() function. type GetFormatSelectorExpr struct { exprNode // Selector is the GET_FORMAT() selector. Selector GetFormatSelectorType } // String implements fmt.Stringer interface. func (selector GetFormatSelectorType) String() string { switch selector { case GetFormatSelectorDate: return "DATE" case GetFormatSelectorTime: return "TIME" case GetFormatSelectorDatetime: return "DATETIME" default: return "" } } // Restore implements Node interface. func (n *GetFormatSelectorExpr) Restore(ctx *format.RestoreCtx) error { ctx.WriteKeyWord(n.Selector.String()) return nil } // Format the ExprNode into a Writer. func (n *GetFormatSelectorExpr) Format(w io.Writer) { fmt.Fprint(w, n.Selector.String()) } // Accept implements Node Accept interface. func (n *GetFormatSelectorExpr) Accept(v Visitor) (Node, bool) { newNode, skipChildren := v.Enter(n) if skipChildren { return v.Leave(newNode) } return v.Leave(n) }
{ "content_hash": "d8a7f49e03615bd067ddd61306f68739", "timestamp": "", "source": "github", "line_count": 1106, "max_line_length": 110, "avg_line_length": 29.029837251356238, "alnum_prop": 0.6581119382066216, "repo_name": "ngaut/tidb", "id": "b911734a993e7fbe55b8f34d84e733af36bb91ff", "size": "32622", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "parser/ast/functions.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "2090" }, { "name": "Go", "bytes": "31375546" }, { "name": "HTML", "bytes": "420" }, { "name": "Java", "bytes": "3694" }, { "name": "JavaScript", "bytes": "900" }, { "name": "Jsonnet", "bytes": "15129" }, { "name": "Makefile", "bytes": "21682" }, { "name": "Ragel", "bytes": "3678" }, { "name": "Shell", "bytes": "423441" }, { "name": "Starlark", "bytes": "532142" }, { "name": "TypeScript", "bytes": "61875" }, { "name": "Yacc", "bytes": "341223" } ] }
package com.wangjie.rxandroideventssample.mvp.persenter; import com.wangjie.androidbucket.log.Logger; import com.wangjie.androidbucket.services.network.interceptor.Interceptor; import com.wangjie.androidinject.annotation.annotations.mvp.AIPresenter; import com.wangjie.rxandroideventssample.mvp.interactor.UserInteractor; import com.wangjie.rxandroideventssample.provider.model.PhoneValidate; import com.wangjie.rxandroideventssample.mvp.viewer.TabChatViewer; import java.util.Random; import rx.Observable; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1; /** * Created by xuhon on 2016/4/22. */ public class TabChatPresenter extends BasePresenter<TabChatViewer, UserInteractor> { private static final String TAG = TabChatPresenter.class.getSimpleName(); private static int feedCount = 0; private Random random = new Random(); private static final int ONE_HOUR = 1000 * 60 * 60; public TabChatPresenter(){ super(); interactor = new UserInteractor(); } public void getValidate(String phone){ interactor.sendValidate(phone, o -> {viewer.validateReturn((PhoneValidate) o);}); // goSubscription( // builder.setType(PhoneValidate.class).setUrl(APIInterface.SEND_VALIDATE_CODE_API).getVolley() // .post(param) // .subscribe(phoneValidate -> { // Log.i("kymjs", "======网络请求" + ((PhoneValidate)phoneValidate).getCode()); // AppManager.getAppManager().getTopActivity().getClass().getName(); // viewer.validateReturn((PhoneValidate) phoneValidate); // })); } }
{ "content_hash": "f14ed867c78756f03b4140b7f580e18d", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 110, "avg_line_length": 39.714285714285715, "alnum_prop": 0.7020383693045563, "repo_name": "xuhongjia/RxAndroidEvents", "id": "bb606751d435758471f4064664a8d0f4615a6210", "size": "1676", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/wangjie/rxandroideventssample/mvp/persenter/TabChatPresenter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "415738" }, { "name": "JavaScript", "bytes": "759" } ] }
using System; using System.Data; using System.Data.SqlClient; using Microsoft.VisualStudio.TestTools.UnitTesting; using ReceiverDBStmtSqlServer; using System.Threading.Tasks; using Nest; using SenderElasticSearch; using StankinsInterfaces; using StanskinsImplementation; using System.Collections.Generic; using System.Linq; using System.IO; using Microsoft.Extensions.Configuration; using SenderAzureIoTHub; using ReceiverAzureIoTHub; using System.Diagnostics; using SenderDBStmtSqlServer; using Moq; using Shouldly; namespace StankinsTests { [TestClass] public class TestReceiverSQLServer2SenderIoTHub { const CommandType commandType = CommandType.StoredProcedure; private string GetSqlServerConnectionString() { IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile(Path.Combine(AppContext.BaseDirectory, "appsettings.json")); IConfigurationRoot configuration = builder.Build(); return configuration["SqlServerConnectionString"]; //VSTS SQL Server connection string "(localdb)\MSSQLLocalDB;Trusted_Connection=True;" } [TestMethod] [TestCategory("RequiresSQLServer")] [TestCategory("ExternalProgramsToBeRun")] public async Task TestSimpleJobReceiverFromSQLServer2SenderToIoTHub() { #region arrange string connectionString = GetSqlServerConnectionString(); string commandText1 = "dbo.TestReiceverDBExecuteStoredProcedureNoParam3"; // Receiver SP (Source) string fileNameSerilizeLastRow = string.Empty; string parameters1 = string.Empty; //Receiver using (var conn = new SqlConnection(connectionString)) { await conn.OpenAsync(); using (var cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = "IF OBJECT_ID('dbo.TestingTestReiceverDBExecuteStoredProcedureNoParam3') IS NOT NULL DROP TABLE dbo.TestingTestReiceverDBExecuteStoredProcedureNoParam3; CREATE TABLE dbo.TestingTestReiceverDBExecuteStoredProcedureNoParam3 (PersonID INT NOT NULL PRIMARY KEY, FirstName VARCHAR(50), LastName VARCHAR(50)); INSERT dbo.TestingTestReiceverDBExecuteStoredProcedureNoParam3 VALUES (10, 'John 00', 'Doe 00'), (11, 'John 01', 'Doe 01');"; await cmd.ExecuteNonQueryAsync(); cmd.CommandText = "IF OBJECT_ID('dbo.TestReiceverDBExecuteStoredProcedureNoParam3') IS NOT NULL DROP PROCEDURE dbo.TestReiceverDBExecuteStoredProcedureNoParam3;"; await cmd.ExecuteNonQueryAsync(); cmd.CommandText = "CREATE PROCEDURE dbo.TestReiceverDBExecuteStoredProcedureNoParam3 AS SELECT * FROM dbo.TestingTestReiceverDBExecuteStoredProcedureNoParam3;"; await cmd.ExecuteNonQueryAsync(); } } var rcvr = new ReceiverStmtSqlServer(connectionString, commandType, commandText1, fileNameSerilizeLastRow, parameters1); //Sender string iotHubUri = "a"; string deviceId = "b"; string deviceKey = "c"; string messageType = "UnitTest"; var snd = new SenderToAzureIoTHub(iotHubUri, deviceId, deviceKey, messageType); //Job ISimpleJob job = new SimpleJob(); job.Receivers.Add(0, rcvr); job.Senders.Add(0, snd); #endregion #region act await job.Execute(); //var j = job.SerializeMe(); //File.WriteAllText(@"e:\j.json", j); #endregion #region assert rcvr.valuesRead.Length.ShouldBe(2); //Assert Receiver IoT Hub settings string iotHubConnectionStringEventHubCompatible = "Endpoint=sb://iothub-ns-azbogdanst-208965-a24331514f.servicebus.windows.net/;SharedAccessKeyName=iothubowner;SharedAccessKey=pPQtX7pSbtNM1cUngtgsdRJIopXGF/jfHZPRVtlcebg="; string iotHubMessageEntityEventHubCompatible = "azbogdanstankinsiothub"; string fileNameLastRow = "TestSimpleJobReceiverFromSQLServer2SenderToIoTHub_LastOffset.json"; var rcv = new ReceiverFromAzureIoTHub(iotHubConnectionStringEventHubCompatible, iotHubMessageEntityEventHubCompatible, fileNameLastRow, messageType, -1); await rcv.LoadData(); bool hasFirstRow = false; bool hasSecondRow = false; rcv.valuesRead.ShouldNotBeNull(); rcv.valuesRead.Length.ShouldBeGreaterThanOrEqualTo(2); foreach(var row in rcv.valuesRead) { if(row.Values.ContainsKey("PersonID") && row.Values.ContainsKey("FirstName") && row.Values.ContainsKey("LastName")) { hasFirstRow = ((long)row.Values["PersonID"] == 10 && (string)row.Values["FirstName"] == "John 00" && (string)row.Values["LastName"] == "Doe 00") ? true : hasFirstRow; hasSecondRow = ((long)row.Values["PersonID"] == 11 && (string)row.Values["FirstName"] == "John 01" && (string)row.Values["LastName"] == "Doe 01") ? true : hasSecondRow; } } Assert.IsTrue(hasFirstRow,"must have first row"); Assert.IsTrue(hasSecondRow,"must have second row"); #endregion } [TestMethod] [TestCategory("RequiresSQLServer")] [TestCategory("ExternalProgramsToBeRun")] public async Task TestSimpleJobReceiverFromIoTHub2SenderToSQLServer() { #region arrange //Send test message string iotHubUri = "a"; string deviceId = "b"; string deviceKey = "c"; string messageType = "UnitTestSimpleJobReceiverFromIoTHub2SenderToSQLServer" + DateTime.Now.ToString(); var sndToIoTHub = new SenderToAzureIoTHub(iotHubUri, deviceId, deviceKey, messageType); var m = new Mock<IRow>(); var rows = new List<IRow>(); int nrRows = 2; for (int i = 0; i < nrRows; i++) { var row = new Mock<IRow>(); row.SetupProperty ( obj => obj.Values, new Dictionary<string, object>() { ["PersonID"] = i, ["FirstName"] = "John " + i, ["LastName"] = "Doe " + i } ); rows.Add(row.Object); } sndToIoTHub.valuesToBeSent = rows.ToArray(); await sndToIoTHub.Send(); //End of Send test message //Receiver settings string iotHubConnectionStringEventHubCompatible = "a"; string iotHubMessageEntityEventHubCompatible = "b"; string fileNameLastRow = "TestReceiveAzureIoTHubSimple_LastRow.json"; //Receiver string connectionString = GetSqlServerConnectionString(); string commandText2 = "dbo.TestReiceverDBExecuteStoredProcedureNoParam4"; // Sender SP (Destination) string parameters2 = "@p1=PersonID;@p2=FirstName;@p3=LastName"; //Source if (File.Exists(fileNameLastRow)) { File.Delete(fileNameLastRow); } var rcv = new ReceiverFromAzureIoTHub(iotHubConnectionStringEventHubCompatible, iotHubMessageEntityEventHubCompatible, fileNameLastRow, messageType, -4); //Destination using (var conn = new SqlConnection(connectionString)) { await conn.OpenAsync(); using (var cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = "IF OBJECT_ID('dbo.TestingTestReiceverDBExecuteStoredProcedureNoParam4') IS NOT NULL DROP TABLE dbo.TestingTestReiceverDBExecuteStoredProcedureNoParam4; CREATE TABLE dbo.TestingTestReiceverDBExecuteStoredProcedureNoParam4 (PersonID INT NOT NULL /*PRIMARY KEY*/, FirstName VARCHAR(50), LastName VARCHAR(50));"; await cmd.ExecuteNonQueryAsync(); cmd.CommandText = "IF OBJECT_ID('dbo.TestReiceverDBExecuteStoredProcedureNoParam4') IS NOT NULL DROP PROCEDURE dbo.TestReiceverDBExecuteStoredProcedureNoParam4;"; await cmd.ExecuteNonQueryAsync(); cmd.CommandText = "CREATE PROCEDURE dbo.TestReiceverDBExecuteStoredProcedureNoParam4 (@p1 INT, @p2 VARCHAR(50), @p3 VARCHAR(50)) AS INSERT dbo.TestingTestReiceverDBExecuteStoredProcedureNoParam4 (PersonID, FirstName, LastName) VALUES (@p1, @p2, @p3)"; await cmd.ExecuteNonQueryAsync(); } } var snd = new SenderToDBStmtSqlServer(connectionString, commandType, commandText2, parameters2); //Job ISimpleJob job = new SimpleJob(); job.Receivers.Add(0, rcv); job.Senders.Add(0, snd); //var j = job.SerializeMe(); //File.WriteAllText(@"E:\j2.json", j); #endregion #region act await job.Execute(); #endregion #region assert using (var conn = new SqlConnection(connectionString)) { await conn.OpenAsync(); using (var cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT COUNT(*) AS Cnt FROM TestingTestReiceverDBExecuteStoredProcedureNoParam4;"; var cnt = (int)await cmd.ExecuteScalarAsync(); Assert.IsTrue(cnt >= 2); // It requires a sender in arrange region } } #endregion } } }
{ "content_hash": "c75ce3cf99bd24d3576e457aebddad06", "timestamp": "", "source": "github", "line_count": 211, "max_line_length": 467, "avg_line_length": 47.00473933649289, "alnum_prop": 0.6195805605968945, "repo_name": "ignatandrei/stankins", "id": "fee67b6a6b028bdb21566f40f4ee4dc8230e21bc", "size": "9920", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "stankinsV1/StankinsTests/TestReceiverFromSQLServerSenderToIoTHub.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "31610" }, { "name": "C#", "bytes": "1287789" }, { "name": "CSS", "bytes": "49304" }, { "name": "HTML", "bytes": "5695855" }, { "name": "Java", "bytes": "285028" }, { "name": "JavaScript", "bytes": "5341308" }, { "name": "PowerShell", "bytes": "9358" }, { "name": "Ruby", "bytes": "127" }, { "name": "TSQL", "bytes": "352" }, { "name": "TypeScript", "bytes": "132725" } ] }
@implementation JSONPatchDocument - (NSString *) convertToJsonStringWithError: (NSError **) error{ NSError *jsonDataError; NSData *jsonData = [self convertToJsonDataWithError: &jsonDataError]; if(jsonDataError){ if(error) *error = jsonDataError; return nil; } return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; } - (NSData *) convertToJsonDataWithError: (NSError **) error{ if(![NSJSONSerialization isValidJSONObject: self.value]){ if(error){ *error = [self valueNotSerializableError]; } return nil; } NSError *serializationError; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:0 error:&serializationError]; if(serializationError){ if(error) *error = serializationError; return nil; } return jsonData; } - (NSError *) valueNotSerializableError{ return [NSError errorWithDomain:@"JSONPatchDocumentErrorDomain" code:-101 userInfo:@{NSLocalizedDescriptionKey : @"value provided is not json encodable"}]; } - (NSDictionary *) toDictionary{ NSString *operation = nil; switch (self.op) { case JSONPatchOperationAdd: operation = @"add"; break; case JSONPatchOperationRemove: operation = @"remove"; break; case JSONPatchOperationReplace: operation = @"replace"; break; case JSONPatchOperationCopy: operation = @"copy"; break; case JSONPatchOperationMove: operation = @"move"; break; case JSONPatchOperationTest: operation = @"test"; break; default: break; } return @{@"op" : operation, @"path" : self.path, @"value" : self.value}; } @end
{ "content_hash": "ed714a25cab98267c613877c1602edd7", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 159, "avg_line_length": 24.48235294117647, "alnum_prop": 0.5487746275828929, "repo_name": "qurami/jsonapi-ios", "id": "42387c1807a24bd8527439d45b37db67b059e219", "size": "2255", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Classes/JSONPatchDocument.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "54291" }, { "name": "Ruby", "bytes": "4790" } ] }
package com.pi4j.io.gpio.tasks.impl; import com.pi4j.io.gpio.GpioPinDigitalOutput; public class GpioBlinkTaskImpl implements Runnable { private final GpioPinDigitalOutput pin; public GpioBlinkTaskImpl(GpioPinDigitalOutput pin) { this.pin = pin; } public void run() { pin.toggle(); } }
{ "content_hash": "45fb1d8e9f499176165d0cb3b5d53ef8", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 56, "avg_line_length": 17.94736842105263, "alnum_prop": 0.6656891495601173, "repo_name": "starksm64/pi4j", "id": "97a844caa01ee408cce9cab2eb22dec5b03f0490", "size": "1358", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pi4j-core/src/main/java/com/pi4j/io/gpio/tasks/impl/GpioBlinkTaskImpl.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "97682" }, { "name": "Java", "bytes": "964121" }, { "name": "Makefile", "bytes": "10460" }, { "name": "Shell", "bytes": "6839" } ] }
**************************** Customer Service Information **************************** Contact the office nearest you. U.S., Canada, Asia Pacific & Latin America ------------------------------------------ `<http://www.wizards.com/customerservice>`_ Wizards of the Coast LLC P.O. Box 707 Renton WA, 98057-0707 U.S.A. Tel: 1-800-324-6496 (within the U.S. and Canada) 1-425-204-8069 U.K., Eire & South Africa ------------------------- Wizards of the Coast LLC c/o Hasbro UK Ltd. P.O. Box 43 Newport NP19 4YD UK Tel: +08457 125599 Email: wizards@hasbro.co.uk All Other European Countries ---------------------------- Wizards of the Coast p/a Hasbro Belgium NV/SA Industrialaan 1 1702 Groot-Bijgaarden BELGIUM Tel: +32.70.233.277 Email: custserv@hasbro.be `Visit our website <http://www.magicthegathering.com>`_
{ "content_hash": "831953f651ef96e6c697401bc9db1f59", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 55, "avg_line_length": 20.575, "alnum_prop": 0.6002430133657352, "repo_name": "Julian/cardboard", "id": "5f999de01b59edb0fa93e823014444e743157002", "size": "823", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/rules/customer_service.rst", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "2656758" }, { "name": "Shell", "bytes": "4517" } ] }
package com.android.settings.location; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.drawable.Drawable; import android.location.SettingInjectorService; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.Messenger; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.preference.Preference; import android.util.AttributeSet; import android.util.Log; import android.util.Xml; import com.android.settings.R; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; /** * Adds the preferences specified by the {@link InjectedSetting} objects to a preference group. * * Duplicates some code from {@link android.content.pm.RegisteredServicesCache}. We do not use that * class directly because it is not a good match for our use case: we do not need the caching, and * so do not want the additional resource hit at app install/upgrade time; and we would have to * suppress the tie-breaking between multiple services reporting settings with the same name. * Code-sharing would require extracting {@link * android.content.pm.RegisteredServicesCache#parseServiceAttributes(android.content.res.Resources, * String, android.util.AttributeSet)} into an interface, which didn't seem worth it. */ class SettingsInjector { static final String TAG = "SettingsInjector"; /** * If reading the status of a setting takes longer than this, we go ahead and start reading * the next setting. */ private static final long INJECTED_STATUS_UPDATE_TIMEOUT_MILLIS = 1000; /** * {@link Message#what} value for starting to load status values * in case we aren't already in the process of loading them. */ private static final int WHAT_RELOAD = 1; /** * {@link Message#what} value sent after receiving a status message. */ private static final int WHAT_RECEIVED_STATUS = 2; /** * {@link Message#what} value sent after the timeout waiting for a status message. */ private static final int WHAT_TIMEOUT = 3; private final Context mContext; /** * The settings that were injected */ private final Set<Setting> mSettings; private final Handler mHandler; public SettingsInjector(Context context) { mContext = context; mSettings = new HashSet<Setting>(); mHandler = new StatusLoadingHandler(); } /** * Returns a list for a profile with one {@link InjectedSetting} object for each * {@link android.app.Service} that responds to * {@link SettingInjectorService#ACTION_SERVICE_INTENT} and provides the expected setting * metadata. * * Duplicates some code from {@link android.content.pm.RegisteredServicesCache}. * * TODO: unit test */ private List<InjectedSetting> getSettings(final UserHandle userHandle) { PackageManager pm = mContext.getPackageManager(); Intent intent = new Intent(SettingInjectorService.ACTION_SERVICE_INTENT); final int profileId = userHandle.getIdentifier(); List<ResolveInfo> resolveInfos = pm.queryIntentServicesAsUser(intent, PackageManager.GET_META_DATA, profileId); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Found services for profile id " + profileId + ": " + resolveInfos); } List<InjectedSetting> settings = new ArrayList<InjectedSetting>(resolveInfos.size()); for (ResolveInfo resolveInfo : resolveInfos) { try { InjectedSetting setting = parseServiceInfo(resolveInfo, userHandle, pm); if (setting == null) { Log.w(TAG, "Unable to load service info " + resolveInfo); } else { settings.add(setting); } } catch (XmlPullParserException e) { Log.w(TAG, "Unable to load service info " + resolveInfo, e); } catch (IOException e) { Log.w(TAG, "Unable to load service info " + resolveInfo, e); } } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Loaded settings for profile id " + profileId + ": " + settings); } return settings; } /** * Returns the settings parsed from the attributes of the * {@link SettingInjectorService#META_DATA_NAME} tag, or null. * * Duplicates some code from {@link android.content.pm.RegisteredServicesCache}. */ private static InjectedSetting parseServiceInfo(ResolveInfo service, UserHandle userHandle, PackageManager pm) throws XmlPullParserException, IOException { ServiceInfo si = service.serviceInfo; ApplicationInfo ai = si.applicationInfo; if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) == 0) { if (Log.isLoggable(TAG, Log.WARN)) { Log.w(TAG, "Ignoring attempt to inject setting from app not in system image: " + service); return null; } } XmlResourceParser parser = null; try { parser = si.loadXmlMetaData(pm, SettingInjectorService.META_DATA_NAME); if (parser == null) { throw new XmlPullParserException("No " + SettingInjectorService.META_DATA_NAME + " meta-data for " + service + ": " + si); } AttributeSet attrs = Xml.asAttributeSet(parser); int type; while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) { } String nodeName = parser.getName(); if (!SettingInjectorService.ATTRIBUTES_NAME.equals(nodeName)) { throw new XmlPullParserException("Meta-data does not start with " + SettingInjectorService.ATTRIBUTES_NAME + " tag"); } Resources res = pm.getResourcesForApplicationAsUser(si.packageName, userHandle.getIdentifier()); return parseAttributes(si.packageName, si.name, userHandle, res, attrs); } catch (PackageManager.NameNotFoundException e) { throw new XmlPullParserException( "Unable to load resources for package " + si.packageName); } finally { if (parser != null) { parser.close(); } } } /** * Returns an immutable representation of the static attributes for the setting, or null. */ private static InjectedSetting parseAttributes(String packageName, String className, UserHandle userHandle, Resources res, AttributeSet attrs) { TypedArray sa = res.obtainAttributes(attrs, android.R.styleable.SettingInjectorService); try { // Note that to help guard against malicious string injection, we do not allow dynamic // specification of the label (setting title) final String title = sa.getString(android.R.styleable.SettingInjectorService_title); final int iconId = sa.getResourceId(android.R.styleable.SettingInjectorService_icon, 0); final String settingsActivity = sa.getString(android.R.styleable.SettingInjectorService_settingsActivity); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "parsed title: " + title + ", iconId: " + iconId + ", settingsActivity: " + settingsActivity); } return InjectedSetting.newInstance(packageName, className, title, iconId, userHandle, settingsActivity); } finally { sa.recycle(); } } /** * Gets a list of preferences that other apps have injected. * * @param profileId Identifier of the user/profile to obtain the injected settings for or * UserHandle.USER_CURRENT for all profiles associated with current user. */ public List<Preference> getInjectedSettings(final int profileId) { final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); final List<UserHandle> profiles = um.getUserProfiles(); ArrayList<Preference> prefs = new ArrayList<Preference>(); final int profileCount = profiles.size(); for (int i = 0; i < profileCount; ++i) { final UserHandle userHandle = profiles.get(i); if (profileId == UserHandle.USER_CURRENT || profileId == userHandle.getIdentifier()) { Iterable<InjectedSetting> settings = getSettings(userHandle); for (InjectedSetting setting : settings) { Preference pref = addServiceSetting(prefs, setting); mSettings.add(new Setting(setting, pref)); } } } reloadStatusMessages(); return prefs; } /** * Reloads the status messages for all the preference items. */ public void reloadStatusMessages() { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "reloadingStatusMessages: " + mSettings); } mHandler.sendMessage(mHandler.obtainMessage(WHAT_RELOAD)); } /** * Adds an injected setting to the root. */ private Preference addServiceSetting(List<Preference> prefs, InjectedSetting info) { PackageManager pm = mContext.getPackageManager(); Drawable appIcon = pm.getDrawable(info.packageName, info.iconId, null); Drawable icon = pm.getUserBadgedIcon(appIcon, info.mUserHandle); CharSequence badgedAppLabel = pm.getUserBadgedLabel(info.title, info.mUserHandle); if (info.title.contentEquals(badgedAppLabel)) { // If badged label is not different from original then no need for it as // a separate content description. badgedAppLabel = null; } Preference pref = new DimmableIconPreference(mContext, badgedAppLabel); pref.setTitle(info.title); pref.setSummary(null); pref.setIcon(icon); pref.setOnPreferenceClickListener(new ServiceSettingClickedListener(info)); prefs.add(pref); return pref; } private class ServiceSettingClickedListener implements Preference.OnPreferenceClickListener { private InjectedSetting mInfo; public ServiceSettingClickedListener(InjectedSetting info) { mInfo = info; } @Override public boolean onPreferenceClick(Preference preference) { // Activity to start if they click on the preference. Must start in new task to ensure // that "android.settings.LOCATION_SOURCE_SETTINGS" brings user back to // Settings > Location. Intent settingIntent = new Intent(); settingIntent.setClassName(mInfo.packageName, mInfo.settingsActivity); settingIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivityAsUser(settingIntent, mInfo.mUserHandle); return true; } } /** * Loads the setting status values one at a time. Each load starts a subclass of {@link * SettingInjectorService}, so to reduce memory pressure we don't want to load too many at * once. */ private final class StatusLoadingHandler extends Handler { /** * Settings whose status values need to be loaded. A set is used to prevent redundant loads. */ private Set<Setting> mSettingsToLoad = new HashSet<Setting>(); /** * Settings that are being loaded now and haven't timed out. In practice this should have * zero or one elements. */ private Set<Setting> mSettingsBeingLoaded = new HashSet<Setting>(); /** * Settings that are being loaded but have timed out. If only one setting has timed out, we * will go ahead and start loading the next setting so that one slow load won't delay the * load of the other settings. */ private Set<Setting> mTimedOutSettings = new HashSet<Setting>(); private boolean mReloadRequested; @Override public void handleMessage(Message msg) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "handleMessage start: " + msg + ", " + this); } // Update state in response to message switch (msg.what) { case WHAT_RELOAD: mReloadRequested = true; break; case WHAT_RECEIVED_STATUS: final Setting receivedSetting = (Setting) msg.obj; receivedSetting.maybeLogElapsedTime(); mSettingsBeingLoaded.remove(receivedSetting); mTimedOutSettings.remove(receivedSetting); removeMessages(WHAT_TIMEOUT, receivedSetting); break; case WHAT_TIMEOUT: final Setting timedOutSetting = (Setting) msg.obj; mSettingsBeingLoaded.remove(timedOutSetting); mTimedOutSettings.add(timedOutSetting); if (Log.isLoggable(TAG, Log.WARN)) { Log.w(TAG, "Timed out after " + timedOutSetting.getElapsedTime() + " millis trying to get status for: " + timedOutSetting); } break; default: Log.wtf(TAG, "Unexpected what: " + msg); } // Decide whether to load additional settings based on the new state. Start by seeing // if we have headroom to load another setting. if (mSettingsBeingLoaded.size() > 0 || mTimedOutSettings.size() > 1) { // Don't load any more settings until one of the pending settings has completed. // To reduce memory pressure, we want to be loading at most one setting (plus at // most one timed-out setting) at a time. This means we'll be responsible for // bringing in at most two services. if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "too many services already live for " + msg + ", " + this); } return; } if (mReloadRequested && mSettingsToLoad.isEmpty() && mSettingsBeingLoaded.isEmpty() && mTimedOutSettings.isEmpty()) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "reloading because idle and reload requesteed " + msg + ", " + this); } // Reload requested, so must reload all settings mSettingsToLoad.addAll(mSettings); mReloadRequested = false; } // Remove the next setting to load from the queue, if any Iterator<Setting> iter = mSettingsToLoad.iterator(); if (!iter.hasNext()) { if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "nothing left to do for " + msg + ", " + this); } return; } Setting setting = iter.next(); iter.remove(); // Request the status value setting.startService(); mSettingsBeingLoaded.add(setting); // Ensure that if receiving the status value takes too long, we start loading the // next value anyway Message timeoutMsg = obtainMessage(WHAT_TIMEOUT, setting); sendMessageDelayed(timeoutMsg, INJECTED_STATUS_UPDATE_TIMEOUT_MILLIS); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "handleMessage end " + msg + ", " + this + ", started loading " + setting); } } @Override public String toString() { return "StatusLoadingHandler{" + "mSettingsToLoad=" + mSettingsToLoad + ", mSettingsBeingLoaded=" + mSettingsBeingLoaded + ", mTimedOutSettings=" + mTimedOutSettings + ", mReloadRequested=" + mReloadRequested + '}'; } } /** * Represents an injected setting and the corresponding preference. */ private final class Setting { public final InjectedSetting setting; public final Preference preference; public long startMillis; private Setting(InjectedSetting setting, Preference preference) { this.setting = setting; this.preference = preference; } @Override public String toString() { return "Setting{" + "setting=" + setting + ", preference=" + preference + '}'; } /** * Returns true if they both have the same {@link #setting} value. Ignores mutable * {@link #preference} and {@link #startMillis} so that it's safe to use in sets. */ @Override public boolean equals(Object o) { return this == o || o instanceof Setting && setting.equals(((Setting) o).setting); } @Override public int hashCode() { return setting.hashCode(); } /** * Starts the service to fetch for the current status for the setting, and updates the * preference when the service replies. */ public void startService() { Handler handler = new Handler() { @Override public void handleMessage(Message msg) { Bundle bundle = msg.getData(); boolean enabled = bundle.getBoolean(SettingInjectorService.ENABLED_KEY, true); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, setting + ": received " + msg + ", bundle: " + bundle); } preference.setSummary(null); preference.setEnabled(enabled); mHandler.sendMessage( mHandler.obtainMessage(WHAT_RECEIVED_STATUS, Setting.this)); } }; Messenger messenger = new Messenger(handler); Intent intent = setting.getServiceIntent(); intent.putExtra(SettingInjectorService.MESSENGER_KEY, messenger); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, setting + ": sending update intent: " + intent + ", handler: " + handler); startMillis = SystemClock.elapsedRealtime(); } else { startMillis = 0; } // Start the service, making sure that this is attributed to the user associated with // the setting rather than the system user. mContext.startServiceAsUser(intent, setting.mUserHandle); } public long getElapsedTime() { long end = SystemClock.elapsedRealtime(); return end - startMillis; } public void maybeLogElapsedTime() { if (Log.isLoggable(TAG, Log.DEBUG) && startMillis != 0) { long elapsed = getElapsedTime(); Log.d(TAG, this + " update took " + elapsed + " millis"); } } } }
{ "content_hash": "6a2e63de9130760b26b24b293111b29f", "timestamp": "", "source": "github", "line_count": 497, "max_line_length": 100, "avg_line_length": 40.36217303822938, "alnum_prop": 0.5990528414755733, "repo_name": "manuelmagix/android_packages_apps_Settings", "id": "f0a0ff3543cfeb85f993e919e7bd475c5f50250e", "size": "20679", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/com/android/settings/location/SettingsInjector.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "6041065" }, { "name": "Makefile", "bytes": "3909" } ] }
namespace app { namespace Fuse { namespace Animations { struct MasterBase__Fuse_Elements_StretchMode; } } } namespace app { namespace Fuse { namespace Animations { struct MixerHandle__Fuse_Elements_StretchMode; struct MixerHandle__Fuse_Elements_StretchMode__uType : ::uClassType { ::app::Fuse::Animations::IMixerHandle__Fuse_Elements_StretchMode __interface_0; }; MixerHandle__Fuse_Elements_StretchMode__uType* MixerHandle__Fuse_Elements_StretchMode__typeof(); void MixerHandle__Fuse_Elements_StretchMode___ObjInit(MixerHandle__Fuse_Elements_StretchMode* __this, ::app::Fuse::Animations::MasterBase__Fuse_Elements_StretchMode* master, int mode, int priority); bool MixerHandle__Fuse_Elements_StretchMode__get_HasValue(MixerHandle__Fuse_Elements_StretchMode* __this); int MixerHandle__Fuse_Elements_StretchMode__get_MixOp(MixerHandle__Fuse_Elements_StretchMode* __this); int MixerHandle__Fuse_Elements_StretchMode__get_Priority(MixerHandle__Fuse_Elements_StretchMode* __this); int MixerHandle__Fuse_Elements_StretchMode__get_RestValue(MixerHandle__Fuse_Elements_StretchMode* __this); MixerHandle__Fuse_Elements_StretchMode* MixerHandle__Fuse_Elements_StretchMode__New_1(::uStatic* __this, ::app::Fuse::Animations::MasterBase__Fuse_Elements_StretchMode* master, int mode, int priority); void MixerHandle__Fuse_Elements_StretchMode__Set(MixerHandle__Fuse_Elements_StretchMode* __this, int value, float strength); void MixerHandle__Fuse_Elements_StretchMode__set_MixOp(MixerHandle__Fuse_Elements_StretchMode* __this, int value); void MixerHandle__Fuse_Elements_StretchMode__set_Priority(MixerHandle__Fuse_Elements_StretchMode* __this, int value); void MixerHandle__Fuse_Elements_StretchMode__Unregister(MixerHandle__Fuse_Elements_StretchMode* __this); struct MixerHandle__Fuse_Elements_StretchMode : ::uObject { int Value; float Strength; bool _hasValue; ::uStrong< ::app::Fuse::Animations::MasterBase__Fuse_Elements_StretchMode*> Master; int _MixOp; int _Priority; void _ObjInit(::app::Fuse::Animations::MasterBase__Fuse_Elements_StretchMode* master, int mode, int priority) { MixerHandle__Fuse_Elements_StretchMode___ObjInit(this, master, mode, priority); } bool HasValue() { return MixerHandle__Fuse_Elements_StretchMode__get_HasValue(this); } int MixOp() { return MixerHandle__Fuse_Elements_StretchMode__get_MixOp(this); } int Priority() { return MixerHandle__Fuse_Elements_StretchMode__get_Priority(this); } int RestValue() { return MixerHandle__Fuse_Elements_StretchMode__get_RestValue(this); } void Set(int value, float strength) { MixerHandle__Fuse_Elements_StretchMode__Set(this, value, strength); } void MixOp(int value) { MixerHandle__Fuse_Elements_StretchMode__set_MixOp(this, value); } void Priority(int value) { MixerHandle__Fuse_Elements_StretchMode__set_Priority(this, value); } void Unregister() { MixerHandle__Fuse_Elements_StretchMode__Unregister(this); } }; }}} #endif
{ "content_hash": "1b101cac5e24acc92d8a7939c472d80d", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 201, "avg_line_length": 59.18, "alnum_prop": 0.7620817843866171, "repo_name": "blyk/BlackCode-Fuse", "id": "aa77f1c296a098bf73e034b65a59696e61d49677", "size": "3391", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "AndroidUI/.build/Simulator/Android/include/app/Fuse.Animations.MixerHandle__Fuse_Elements_StretchMode.h", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "31111" }, { "name": "C", "bytes": "22885804" }, { "name": "C++", "bytes": "197750292" }, { "name": "Java", "bytes": "951083" }, { "name": "JavaScript", "bytes": "578555" }, { "name": "Logos", "bytes": "48297" }, { "name": "Makefile", "bytes": "6592573" }, { "name": "Shell", "bytes": "19985" } ] }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="zh"> <head> <!-- Generated by javadoc (1.8.0_121) on Tue Aug 01 15:20:36 CST 2017 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>com.zwy.kutils.http 类分层结构 (kutils 2.4 API)</title> <meta name="date" content="2017-08-01"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="com.zwy.kutils.http \u7C7B\u5206\u5C42\u7ED3\u6784 (kutils 2.4 API)"; } } catch(err) { } //--> </script> <noscript> <div>您的浏览器已禁用 JavaScript。</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="跳过导航链接">跳过导航链接</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="导航"> <li><a href="../../../../overview-summary.html">概览</a></li> <li><a href="package-summary.html">程序包</a></li> <li>类</li> <li class="navBarCell1Rev">树</li> <li><a href="../../../../deprecated-list.html">已过时</a></li> <li><a href="../../../../index-all.html">索引</a></li> <li><a href="../../../../help-doc.html">帮助</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../com/zwy/kutils/eventbus/util/package-tree.html">上一个</a></li> <li><a href="../../../../com/zwy/kutils/utils/package-tree.html">下一个</a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?com/zwy/kutils/http/package-tree.html" target="_top">框架</a></li> <li><a href="package-tree.html" target="_top">无框架</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">所有类</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 class="title">程序包com.zwy.kutils.http的分层结构</h1> <span class="packageHierarchyLabel">程序包分层结构:</span> <ul class="horizontal"> <li><a href="../../../../overview-tree.html">所有程序包</a></li> </ul> </div> <div class="contentContainer"> <h2 title="类分层结构">类分层结构</h2> <ul> <li type="circle">java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="java.lang中的类或接口"><span class="typeNameLink">Object</span></a> <ul> <li type="circle">com.zwy.kutils.http.<a href="../../../../com/zwy/kutils/http/HttpBuild.html" title="com.zwy.kutils.http中的类"><span class="typeNameLink">HttpBuild</span></a></li> <li type="circle">com.zwy.kutils.http.<a href="../../../../com/zwy/kutils/http/HttpBuild.Build.html" title="com.zwy.kutils.http中的类"><span class="typeNameLink">HttpBuild.Build</span></a></li> <li type="circle">com.lzy.okgo.model.HttpParams <ul> <li type="circle">com.zwy.kutils.http.<a href="../../../../com/zwy/kutils/http/HttpParams.html" title="com.zwy.kutils.http中的类"><span class="typeNameLink">HttpParams</span></a></li> </ul> </li> </ul> </li> </ul> <h2 title="枚举分层结构">枚举分层结构</h2> <ul> <li type="circle">java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="java.lang中的类或接口"><span class="typeNameLink">Object</span></a> <ul> <li type="circle">java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="java.lang中的类或接口"><span class="typeNameLink">Enum</span></a>&lt;E&gt; (implements java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html?is-external=true" title="java.lang中的类或接口">Comparable</a>&lt;T&gt;, java.io.<a href="http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html?is-external=true" title="java.io中的类或接口">Serializable</a>) <ul> <li type="circle">com.zwy.kutils.http.<a href="../../../../com/zwy/kutils/http/HttpBuild.HttpUploadDataType.html" title="com.zwy.kutils.http中的枚举"><span class="typeNameLink">HttpBuild.HttpUploadDataType</span></a></li> <li type="circle">com.zwy.kutils.http.<a href="../../../../com/zwy/kutils/http/HttpBuild.CookieType.html" title="com.zwy.kutils.http中的枚举"><span class="typeNameLink">HttpBuild.CookieType</span></a></li> </ul> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="跳过导航链接">跳过导航链接</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="导航"> <li><a href="../../../../overview-summary.html">概览</a></li> <li><a href="package-summary.html">程序包</a></li> <li>类</li> <li class="navBarCell1Rev">树</li> <li><a href="../../../../deprecated-list.html">已过时</a></li> <li><a href="../../../../index-all.html">索引</a></li> <li><a href="../../../../help-doc.html">帮助</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../com/zwy/kutils/eventbus/util/package-tree.html">上一个</a></li> <li><a href="../../../../com/zwy/kutils/utils/package-tree.html">下一个</a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?com/zwy/kutils/http/package-tree.html" target="_top">框架</a></li> <li><a href="package-tree.html" target="_top">无框架</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">所有类</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "content_hash": "c91629f7c3995f570ba19a0255408dde", "timestamp": "", "source": "github", "line_count": 155, "max_line_length": 498, "avg_line_length": 39.69032258064516, "alnum_prop": 0.6285760728218466, "repo_name": "devzwy/KUtils", "id": "f8247a4d773c5f42c828ce6dddb5460cb8c768b5", "size": "6526", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/com/zwy/kutils/http/package-tree.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "874887" } ] }
Community Development- Metrics ============================== Introduction to measures to evaluate the vitality and viability of an open source community. This presentation is publicly distributed under the Apache 2.0 License, see LICENSE file for details. Works of Art in this repository are distributed under the Creative Commons by Attribution 4.0 License. http://creativecommons.org/licenses/by/4.0/deed.en_US
{ "content_hash": "044fc53b4f250ba884eeecc3ff7b711c", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 102, "avg_line_length": 41.8, "alnum_prop": 0.7559808612440191, "repo_name": "luisibanez/Community-Development-Metrics", "id": "4bed7ac0f5161eb49fbcd1879ab6c514e19b37eb", "size": "418", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [] }
#ifndef __COMMON_H__ #define __COMMON_H__ #define MAX_PATH (260) #include "boot0_head.h" #include "toc_head.h" #include "uboot_head.h" #include "script.h" #include <stdlib.h> #include <stdio.h> #include <malloc.h> #include <string.h> void GetFullPath(char *dName, const char *sName); __s32 check_magic( void *mem_base, const char *magic ); __s32 check_sum( void *mem_base, __u32 size ); __s32 gen_check_sum( void *boot_buf ); __s32 gen_check_sum_toc0( void *boot_buf ); uint gen_general_checksum(void *buff, uint length); uint sunxi_sprite_generate_checksum(void *buffer, uint length, uint src_sum); int getfile_size(FILE *pFile); #endif
{ "content_hash": "8cf9a823be0a52cce4be3509acd0beb7", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 77, "avg_line_length": 26.307692307692307, "alnum_prop": 0.6549707602339181, "repo_name": "OLIMEX/DIY-LAPTOP", "id": "3e147aadb4614dac54cbefa2abd0321f23c88ed4", "size": "1209", "binary": false, "copies": "2", "ref": "refs/heads/rel3", "path": "SOFTWARE/A64-TERES/sunxi-pack-tools/include/common.h", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "11134321" }, { "name": "Awk", "bytes": "19031" }, { "name": "Batchfile", "bytes": "8351" }, { "name": "C", "bytes": "567314664" }, { "name": "C++", "bytes": "490541" }, { "name": "CSS", "bytes": "3924" }, { "name": "Classic ASP", "bytes": "4528" }, { "name": "Dockerfile", "bytes": "652" }, { "name": "GDB", "bytes": "21755" }, { "name": "Lex", "bytes": "55791" }, { "name": "M4", "bytes": "3388" }, { "name": "Makefile", "bytes": "2068526" }, { "name": "PHP", "bytes": "54081" }, { "name": "Perl", "bytes": "701416" }, { "name": "Python", "bytes": "307470" }, { "name": "Raku", "bytes": "3727" }, { "name": "Roff", "bytes": "63487" }, { "name": "Scilab", "bytes": "21433" }, { "name": "Shell", "bytes": "328623" }, { "name": "SmPL", "bytes": "69316" }, { "name": "Tcl", "bytes": "967" }, { "name": "UnrealScript", "bytes": "6113" }, { "name": "XS", "bytes": "1240" }, { "name": "XSLT", "bytes": "445" }, { "name": "Yacc", "bytes": "101755" }, { "name": "sed", "bytes": "3126" } ] }
#ifndef WEBRTC_BASE_NETWORK_H_ #define WEBRTC_BASE_NETWORK_H_ #include <deque> #include <map> #include <string> #include <vector> #include "webrtc/base/basictypes.h" #include "webrtc/base/ipaddress.h" #include "webrtc/base/messagehandler.h" #include "webrtc/base/scoped_ptr.h" #include "webrtc/base/sigslot.h" #if defined(WEBRTC_BSD) #include <sys/types.h> #endif #if defined(WEBRTC_POSIX) struct ifaddrs; #endif // defined(WEBRTC_POSIX) namespace rtc { class Network; class Thread; enum AdapterType { // This enum resembles the one in Chromium net::ConnectionType. ADAPTER_TYPE_UNKNOWN = 0, ADAPTER_TYPE_ETHERNET = 1 << 0, ADAPTER_TYPE_WIFI = 1 << 1, ADAPTER_TYPE_CELLULAR = 1 << 2, ADAPTER_TYPE_VPN = 1 << 3, ADAPTER_TYPE_LOOPBACK = 1 << 4 }; // By default, ignore loopback interfaces on the host. const int kDefaultNetworkIgnoreMask = ADAPTER_TYPE_LOOPBACK; // Makes a string key for this network. Used in the network manager's maps. // Network objects are keyed on interface name, network prefix and the // length of that prefix. std::string MakeNetworkKey(const std::string& name, const IPAddress& prefix, int prefix_length); // Generic network manager interface. It provides list of local // networks. class NetworkManager { public: typedef std::vector<Network*> NetworkList; NetworkManager(); virtual ~NetworkManager(); // Called when network list is updated. sigslot::signal0<> SignalNetworksChanged; // Indicates a failure when getting list of network interfaces. sigslot::signal0<> SignalError; // Start/Stop monitoring of network interfaces // list. SignalNetworksChanged or SignalError is emitted immediately // after StartUpdating() is called. After that SignalNetworksChanged // is emitted whenever list of networks changes. virtual void StartUpdating() = 0; virtual void StopUpdating() = 0; // Returns the current list of networks available on this machine. // UpdateNetworks() must be called before this method is called. // It makes sure that repeated calls return the same object for a // given network, so that quality is tracked appropriately. Does not // include ignored networks. virtual void GetNetworks(NetworkList* networks) const = 0; // "AnyAddressNetwork" is a network which only contains single "any address" // IP address. (i.e. INADDR_ANY for IPv4 or in6addr_any for IPv6). This is // useful as binding to such interfaces allow default routing behavior like // http traffic. // TODO(guoweis): remove this body when chromium implements this. virtual void GetAnyAddressNetworks(NetworkList* networks) {} // Dumps a list of networks available to LS_INFO. virtual void DumpNetworks(bool include_ignored) {} struct Stats { int ipv4_network_count; int ipv6_network_count; Stats() { ipv4_network_count = 0; ipv6_network_count = 0; } }; }; // Base class for NetworkManager implementations. class NetworkManagerBase : public NetworkManager { public: NetworkManagerBase(); virtual ~NetworkManagerBase(); virtual void GetNetworks(std::vector<Network*>* networks) const; virtual void GetAnyAddressNetworks(NetworkList* networks); bool ipv6_enabled() const { return ipv6_enabled_; } void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; } void set_max_ipv6_networks(int networks) { max_ipv6_networks_ = networks; } int max_ipv6_networks() { return max_ipv6_networks_; } protected: typedef std::map<std::string, Network*> NetworkMap; // Updates |networks_| with the networks listed in |list|. If // |network_map_| already has a Network object for a network listed // in the |list| then it is reused. Accept ownership of the Network // objects in the |list|. |changed| will be set to true if there is // any change in the network list. void MergeNetworkList(const NetworkList& list, bool* changed); // |stats| will be populated even if |*changed| is false. void MergeNetworkList(const NetworkList& list, bool* changed, NetworkManager::Stats* stats); private: friend class NetworkTest; void DoUpdateNetworks(); NetworkList networks_; int max_ipv6_networks_; NetworkMap networks_map_; bool ipv6_enabled_; rtc::scoped_ptr<rtc::Network> ipv4_any_address_network_; rtc::scoped_ptr<rtc::Network> ipv6_any_address_network_; }; // Basic implementation of the NetworkManager interface that gets list // of networks using OS APIs. class BasicNetworkManager : public NetworkManagerBase, public MessageHandler { public: BasicNetworkManager(); virtual ~BasicNetworkManager(); virtual void StartUpdating(); virtual void StopUpdating(); // Logs the available networks. virtual void DumpNetworks(bool include_ignored); // MessageHandler interface. virtual void OnMessage(Message* msg); bool started() { return start_count_ > 0; } // Sets the network ignore list, which is empty by default. Any network on the // ignore list will be filtered from network enumeration results. void set_network_ignore_list(const std::vector<std::string>& list) { network_ignore_list_ = list; } // Sets the network types to ignore. For instance, calling this with // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and // loopback interfaces. Set to kDefaultNetworkIgnoreMask by default. void set_network_ignore_mask(int network_ignore_mask) { // TODO(phoglund): implement support for other types than loopback. // See https://code.google.com/p/webrtc/issues/detail?id=4288. // Then remove set_network_ignore_list. network_ignore_mask_ = network_ignore_mask; } int network_ignore_mask() const { return network_ignore_mask_; } #if defined(WEBRTC_LINUX) // Sets the flag for ignoring non-default routes. void set_ignore_non_default_routes(bool value) { ignore_non_default_routes_ = true; } #endif protected: #if defined(WEBRTC_POSIX) // Separated from CreateNetworks for tests. void ConvertIfAddrs(ifaddrs* interfaces, bool include_ignored, NetworkList* networks) const; #endif // defined(WEBRTC_POSIX) // Creates a network object for each network available on the machine. bool CreateNetworks(bool include_ignored, NetworkList* networks) const; // Determines if a network should be ignored. bool IsIgnoredNetwork(const Network& network) const; private: friend class NetworkTest; void DoUpdateNetworks(); Thread* thread_; bool sent_first_update_; int start_count_; std::vector<std::string> network_ignore_list_; int network_ignore_mask_; bool ignore_non_default_routes_; }; // Represents a Unix-type network interface, with a name and single address. class Network { public: Network(const std::string& name, const std::string& description, const IPAddress& prefix, int prefix_length); Network(const std::string& name, const std::string& description, const IPAddress& prefix, int prefix_length, AdapterType type); // Returns the name of the interface this network is associated wtih. const std::string& name() const { return name_; } // Returns the OS-assigned name for this network. This is useful for // debugging but should not be sent over the wire (for privacy reasons). const std::string& description() const { return description_; } // Returns the prefix for this network. const IPAddress& prefix() const { return prefix_; } // Returns the length, in bits, of this network's prefix. int prefix_length() const { return prefix_length_; } // |key_| has unique value per network interface. Used in sorting network // interfaces. Key is derived from interface name and it's prefix. std::string key() const { return key_; } // Returns the Network's current idea of the 'best' IP it has. // Or return an unset IP if this network has no active addresses. // Here is the rule on how we mark the IPv6 address as ignorable for WebRTC. // 1) return all global temporary dynamic and non-deprecrated ones. // 2) if #1 not available, return global ones. // 3) if #2 not available, use ULA ipv6 as last resort. (ULA stands // for unique local address, which is not route-able in open // internet but might be useful for a close WebRTC deployment. // TODO(guoweis): rule #3 actually won't happen at current // implementation. The reason being that ULA address starting with // 0xfc 0r 0xfd will be grouped into its own Network. The result of // that is WebRTC will have one extra Network to generate candidates // but the lack of rule #3 shouldn't prevent turning on IPv6 since // ULA should only be tried in a close deployment anyway. // Note that when not specifying any flag, it's treated as case global // IPv6 address IPAddress GetBestIP() const; // Keep the original function here for now. // TODO(guoweis): Remove this when all callers are migrated to GetBestIP(). IPAddress ip() const { return GetBestIP(); } // Adds an active IP address to this network. Does not check for duplicates. void AddIP(const InterfaceAddress& ip) { ips_.push_back(ip); } // Sets the network's IP address list. Returns true if new IP addresses were // detected. Passing true to already_changed skips this check. bool SetIPs(const std::vector<InterfaceAddress>& ips, bool already_changed); // Get the list of IP Addresses associated with this network. const std::vector<InterfaceAddress>& GetIPs() const { return ips_;} // Clear the network's list of addresses. void ClearIPs() { ips_.clear(); } // Returns the scope-id of the network's address. // Should only be relevant for link-local IPv6 addresses. int scope_id() const { return scope_id_; } void set_scope_id(int id) { scope_id_ = id; } // Indicates whether this network should be ignored, perhaps because // the IP is 0, or the interface is one we know is invalid. bool ignored() const { return ignored_; } void set_ignored(bool ignored) { ignored_ = ignored; } AdapterType type() const { return type_; } int preference() const { return preference_; } void set_preference(int preference) { preference_ = preference; } // Debugging description of this network std::string ToString() const; private: std::string name_; std::string description_; IPAddress prefix_; int prefix_length_; std::string key_; std::vector<InterfaceAddress> ips_; int scope_id_; bool ignored_; AdapterType type_; int preference_; friend class NetworkManager; }; } // namespace rtc #endif // WEBRTC_BASE_NETWORK_H_
{ "content_hash": "976e4e49dea8ec6a3bcbd81da2de5a7f", "timestamp": "", "source": "github", "line_count": 304, "max_line_length": 80, "avg_line_length": 35.01973684210526, "alnum_prop": 0.7147285365395454, "repo_name": "CTSRD-SOAAP/chromium-42.0.2311.135", "id": "13dee65b5ae2f7ca3d85e384f189f0bb8e5f7288", "size": "11054", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "third_party/webrtc/base/network.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "AppleScript", "bytes": "8402" }, { "name": "Assembly", "bytes": "241154" }, { "name": "C", "bytes": "12370053" }, { "name": "C++", "bytes": "266788423" }, { "name": "CMake", "bytes": "27829" }, { "name": "CSS", "bytes": "813488" }, { "name": "Emacs Lisp", "bytes": "2360" }, { "name": "Go", "bytes": "13628" }, { "name": "Groff", "bytes": "5283" }, { "name": "HTML", "bytes": "20131029" }, { "name": "Java", "bytes": "8495790" }, { "name": "JavaScript", "bytes": "12980966" }, { "name": "LLVM", "bytes": "1169" }, { "name": "Logos", "bytes": "6893" }, { "name": "Lua", "bytes": "16189" }, { "name": "Makefile", "bytes": "208709" }, { "name": "Objective-C", "bytes": "1509363" }, { "name": "Objective-C++", "bytes": "7960581" }, { "name": "PLpgSQL", "bytes": "215882" }, { "name": "Perl", "bytes": "63937" }, { "name": "Protocol Buffer", "bytes": "432373" }, { "name": "Python", "bytes": "11147426" }, { "name": "Ragel in Ruby Host", "bytes": "104923" }, { "name": "Scheme", "bytes": "10604" }, { "name": "Shell", "bytes": "1207731" }, { "name": "Standard ML", "bytes": "4965" }, { "name": "VimL", "bytes": "4075" }, { "name": "nesC", "bytes": "18347" } ] }
ACCEPTED #### According to Index Fungorum #### Published in Bull. N. Y. St. Mus. 197: 28 (1918) #### Original name Diplodia convolvuli Dearn. & House ### Remarks null
{ "content_hash": "6088d6374ecffbf1368d19e71b2e618c", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 35, "avg_line_length": 13.076923076923077, "alnum_prop": 0.6705882352941176, "repo_name": "mdoering/backbone", "id": "eb93f472e20b76d460dc8f245fa3acc8157018b6", "size": "228", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Dothideomycetes/Botryosphaeriales/Botryosphaeriaceae/Diplodia/Diplodia convolvuli/README.md", "mode": "33188", "license": "apache-2.0", "language": [] }
package command.otherCommands; import command.Command; import controller.ParseTreeChildren; import controller.Traverser; import model.data.Data; public class DoTimes extends Command { private static final long serialVersionUID = -1709915109882273600L; private Data allData; private Traverser traverser = new Traverser(); public DoTimes(Data allData) { super(allData); this.allData = allData; } @Override public double execute(ParseTreeChildren list) { int range = (int) list.getCommandValue(0, 2); double answer = 0; for (double i = 1; i < range + 1; i++) { allData.updateVariableMap(list.getCommandName(0, 1), i); answer = traverser.traverse(list.getChildListAt(1), allData); } return answer; } }
{ "content_hash": "78c9948cf06e6e39146d0eb3d6bb28e5", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 69, "avg_line_length": 24.548387096774192, "alnum_prop": 0.7109067017082786, "repo_name": "karenli1995/slogo_ide", "id": "87ad2b9c2f2338ab67c057c444256c475e032c1b", "size": "761", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/command/otherCommands/DoTimes.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "997" }, { "name": "HTML", "bytes": "15025" }, { "name": "Java", "bytes": "178548" } ] }
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. defined('MOODLE_INTERNAL') || die(); $string['pluginname'] = 'Corrector ortográfico heredado';
{ "content_hash": "769d6d692286e4badb074f22bcc02f6d", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 71, "avg_line_length": 35.86363636363637, "alnum_prop": 0.7313054499366286, "repo_name": "Vicecalidadumb/empleoumb", "id": "8501512ff897036926c6a783588c3315fdfe4931", "size": "1067", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "lang/es/tinymce_spellchecker.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "169845" }, { "name": "JavaScript", "bytes": "567297" }, { "name": "PHP", "bytes": "14173045" } ] }
package proto // nolint:lll func _() { /* dummy file that fixes this error when build tag proto is not specified: $ go mod tidy [...] github.com/jwkohnen/airac imports github.com/jwkohnen/airac/proto: module github.com/jwkohnen/airac@latest found (v1.0.4), but does not contain package github.com/jwkohnen/airac/proto */ }
{ "content_hash": "a136d4a8a774fb80f6920f810c44c127", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 154, "avg_line_length": 29.166666666666668, "alnum_prop": 0.6914285714285714, "repo_name": "wjkohnen/airac", "id": "2cddbf25a3d455074aa66dabd4499e84f2c82433", "size": "350", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "proto/dummy.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "18504" } ] }
jQuery(function($) { $("[data-scroll-down]").each(function(index, element) { element.scrollTop = element.scrollHeight; }); var applyTriggerCheckbox = function(element) { var what = $(element).data("filter-build-trigger"); if( element.checked ) { $("[data-build-trigger="+what+"]").show(); } else { $("[data-build-trigger="+what+"]").hide(); } }; $("[data-filter-build-trigger]").each(function(index, element) { applyTriggerCheckbox(element); }).click(function(event) { applyTriggerCheckbox(event.target); }); });
{ "content_hash": "b00923ccdafa4a35c210dfb0abeabc54", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 66, "avg_line_length": 25.954545454545453, "alnum_prop": 0.6147110332749562, "repo_name": "inch-ci/inch_ci-web", "id": "5afa8b4e9995e92bcefc22b7db732cb55894c28f", "size": "1353", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/assets/javascripts/admin/admin.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "13220" }, { "name": "HTML", "bytes": "81162" }, { "name": "JavaScript", "bytes": "31643" }, { "name": "Ruby", "bytes": "239705" } ] }
using System; using System.Collections.Specialized; using System.Reflection; using System.Threading.Tasks; using System.Web; using System.Web.Mvc; using System.Web.Routing; using Moq; namespace NuGetGallery { public static class TestUtility { // We only need this method because testing URL generation is a pain. // Alternatively, we could write our own service for generating URLs. public static Mock<HttpContextBase> SetupHttpContextMockForUrlGeneration(Mock<HttpContextBase> httpContext, Controller controller) { httpContext.Setup(c => c.Request.Url).Returns(new Uri("https://example.org/")); httpContext.Setup(c => c.Request.ApplicationPath).Returns("/"); httpContext.Setup(c => c.Response.ApplyAppPathModifier(It.IsAny<string>())).Returns<string>(s => s); var requestContext = new RequestContext(httpContext.Object, new RouteData()); var controllerContext = new ControllerContext(requestContext, controller); controller.ControllerContext = controllerContext; var routeCollection = new RouteCollection(); routeCollection.MapRoute("catch-all", "{*catchall}"); controller.Url = new UrlHelper(requestContext, routeCollection); return httpContext; } public static void SetupUrlHelper(Controller controller, Mock<HttpContextBase> mockHttpContext) { var routes = new RouteCollection(); Routes.RegisterRoutes(routes); controller.Url = new UrlHelper(new RequestContext(mockHttpContext.Object, new RouteData()), routes); } public static UrlHelper MockUrlHelper() { var mockHttpContext = new Mock<HttpContextBase>(MockBehavior.Strict); var mockHttpRequest = new Mock<HttpRequestBase>(MockBehavior.Strict); var mockHttpResponse = new Mock<HttpResponseBase>(MockBehavior.Strict); mockHttpContext.Setup(httpContext => httpContext.Request).Returns(mockHttpRequest.Object); mockHttpContext.Setup(httpContext => httpContext.Response).Returns(mockHttpResponse.Object); mockHttpRequest.Setup(httpRequest => httpRequest.Url).Returns(new Uri("http://unittest.nuget.org/")); mockHttpRequest.Setup(httpRequest => httpRequest.ApplicationPath).Returns("http://unittest.nuget.org/"); mockHttpRequest.Setup(httpRequest => httpRequest.ServerVariables).Returns(new NameValueCollection()); string value = null; Action<string> saveValue = x => { value = x; }; Func<String> restoreValue = () => value; mockHttpResponse.Setup(httpResponse => httpResponse.ApplyAppPathModifier(It.IsAny<string>())) .Callback(saveValue).Returns(restoreValue); var requestContext = new RequestContext(mockHttpContext.Object, new RouteData()); var routes = new RouteCollection(); Routes.RegisterRoutes(routes); return new UrlHelper(requestContext, routes); } public static void SetupUrlHelperForUrlGeneration(Controller controller, Uri address) { var mockHttpContext = new Mock<HttpContextBase>(); mockHttpContext.Setup(c => c.Request.Url).Returns(address); mockHttpContext.Setup(c => c.Request.ApplicationPath).Returns("/"); mockHttpContext.Setup(c => c.Response.ApplyAppPathModifier(It.IsAny<string>())).Returns<string>(s => s); var requestContext = new RequestContext(mockHttpContext.Object, new RouteData()); var controllerContext = new ControllerContext(requestContext, controller); controller.ControllerContext = controllerContext; var routes = new RouteCollection(); Routes.RegisterRoutes(routes); controller.Url = new UrlHelper(requestContext, routes); } public static T GetAnonymousPropertyValue<T>(Object source, string propertyName) { var property = source.GetType().GetProperty(propertyName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); if (property == null) { return default(T); } return (T)property.GetValue(source, null); } } }
{ "content_hash": "757f28a132c109b6673fa6ac49f54dc1", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 143, "avg_line_length": 49.348314606741575, "alnum_prop": 0.6593806921675774, "repo_name": "ouhi2008/NuGetGalleryWithLDAP", "id": "e5a9bf76ff052b319ef9a1a434ed3fa7bfeabfdc", "size": "4394", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Facts/TestUtils/TestUtility.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "25375" }, { "name": "C#", "bytes": "1299367" }, { "name": "CSS", "bytes": "129734" }, { "name": "JavaScript", "bytes": "245885" }, { "name": "PowerShell", "bytes": "32149" }, { "name": "Shell", "bytes": "1342" } ] }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>TeamSpeak 3 PHP Framework: libraries/TeamSpeak3/Transport/Abstract.php File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.7.3 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">TeamSpeak 3 PHP Framework&#160;<span id="projectnumber">1.1.5-beta</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li id="searchli"> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> </div> <div class="headertitle"> <h1>libraries/TeamSpeak3/Transport/Abstract.php File Reference</h1> </div> </div> <div class="contents"> <p>TeamSpeak 3 PHP Framework. <a href="#_details">More...</a></p> <p><a href="_transport_2_abstract_8php_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Classes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_team_speak3___transport___abstract.html">TeamSpeak3_Transport_Abstract</a></td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Abstract class for connecting to a TeamSpeak 3 Server through different ways of transport. <a href="class_team_speak3___transport___abstract.html#_details">More...</a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <div class="textblock"><p>TeamSpeak 3 PHP Framework. </p> <dl class="rcs"><dt><b>Id:</b></dt><dd>Abstract.php 3/19/2011 10:09:59 scp </dd></dl> <p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p> <p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p> <p>You should have received a copy of the GNU General Public License along with this program. If not, see &lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;. </p> <p>Definition in file <a class="el" href="_transport_2_abstract_8php_source.html">Abstract.php</a>.</p> </div></div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr class="footer"/><address class="footer"><small>Generated on Sat Mar 19 2011 22:11:54 for TeamSpeak 3 PHP Framework by&#160; <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address> </body> </html>
{ "content_hash": "5fb6fa7eec717807ed3187b3f008cc56", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 684, "avg_line_length": 56.320388349514566, "alnum_prop": 0.6788484744009653, "repo_name": "tperroin/nuitblanche", "id": "12b5355c3439e504ef19790675820b44c1bb4235", "size": "5801", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "vendor/ts3/docs/html/_transport_2_abstract_8php.html", "mode": "33261", "license": "mit", "language": [] }
module.exports = { getReadWidget: function () { return '<ma-choices-column values="::entry.listValues[field.name()]"></ma-choices-column>'; }, getLinkWidget: function () { return '<ma-reference-many-link-column ids="::entry.values[field.name()]" values="::entry.listValues[field.name()]" field="::field"></ma-reference-many-link-column>'; }, getFilterWidget: function () { return '<ma-choices-field field="::field" value="values[field.name()]" datastore="::datastore"></ma-choices-field>'; }, getWriteWidget: function () { return '<ma-reference-many-field field="::field" value="entry.values[field.name()]" datastore="::datastore"></ma-reference-many-field>'; } };
{ "content_hash": "b32e18cb06cf73d348d9b55436ae9a8b", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 174, "avg_line_length": 52.42857142857143, "alnum_prop": 0.6348773841961853, "repo_name": "AgustinCroce/ng-admin", "id": "101f904e74774103b08055aa1c97c81b96ca48c3", "size": "734", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/javascripts/ng-admin/Crud/fieldView/ReferenceManyFieldView.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "65778" }, { "name": "HTML", "bytes": "15749" }, { "name": "JavaScript", "bytes": "285343" }, { "name": "Makefile", "bytes": "417" } ] }
import { environment } from 'environments/environment'; import { ZendeskEnv } from 'environments/environment-type'; interface ZendeskUrls { billing: string; policy: string; createBillingAccount: string; egressFaq: string; dataDictionary: string; videos: string; genomicExtraction: string; gettingStarted: string; gpus: string; helpCenter: string; persistentDisk: string; researchPurpose: string; workingWithData: string; workspaceBucket: string; } const zendeskConfigs = { [ZendeskEnv.Prod]: { baseUrl: 'https://aousupporthelp.zendesk.com/hc', widgetKey: '5a7d70b9-37f9-443b-8d0e-c3bd3c2a55e3', }, [ZendeskEnv.Preprod]: { baseUrl: 'https://aoupreprodsupporthelp.zendesk.com/hc', widgetKey: '41815bdd-7e8f-4450-aadf-dd5957093233', }, [ZendeskEnv.Sandbox]: { baseUrl: 'https://aousupporthelp1634849601.zendesk.com/hc', widgetKey: 'df0a2e39-f8a8-482b-baf5-af82e14d38f9', }, }; export const zendeskWidgetKey = () => { return zendeskConfigs[environment.zendeskEnv].widgetKey; }; export const zendeskBaseUrl = () => { return zendeskConfigs[environment.zendeskEnv].baseUrl; }; /** * A set of support URLs for the current environment. These need to be * parameterized per environment since the Zendesk support content IDs are not * stable across the prod, preprod and sandbox Zendesk instances. */ export const supportUrls: ZendeskUrls = ((env) => { const baseUrl = zendeskConfigs[env].baseUrl; const article = (id) => `${baseUrl}/articles/${id}`; const category = (id) => `${baseUrl}/categories/${id}`; const section = (id) => `${baseUrl}/sections/${id}`; const commonUrls = { helpCenter: baseUrl, }; const urls: { [key: string]: ZendeskUrls } = { [ZendeskEnv.Prod]: { ...commonUrls, billing: section('360039539411'), createBillingAccount: article('360039539411'), dataDictionary: article('360033200232'), egressFaq: article('4407354684052'), videos: category('5942794068756'), genomicExtraction: article('4558187754772'), gettingStarted: category('360002157352'), gpus: article('4558692960660'), persistentDisk: article('5140493753620'), researchPurpose: article('360042673211'), workingWithData: category('5942702296468'), workspaceBucket: article('360040043072'), policy: category('5942677039892'), }, [ZendeskEnv.Preprod]: { ...commonUrls, billing: section('360060301171'), createBillingAccount: article('360060301171'), dataDictionary: article('360058949792'), egressFaq: article('404'), videos: category('360006379271'), genomicExtraction: article('4403537387412'), gpus: article('4428626363668'), gettingStarted: category('360005884571'), persistentDisk: article('404'), researchPurpose: article('360058861612'), workingWithData: category('360005884591'), workspaceBucket: article('360044796611'), policy: category('10680515788436'), }, [ZendeskEnv.Sandbox]: { ...commonUrls, billing: section('360044792211'), createBillingAccount: article('360044792211'), dataDictionary: article('360044793611'), egressFaq: article('404'), videos: category('360003453651'), genomicExtraction: article('404'), gettingStarted: category('360003430652'), gpus: article('4421259211668'), persistentDisk: article('404'), researchPurpose: article('360044334652'), workingWithData: category('360003430672'), workspaceBucket: article('360044796611'), policy: category('360040043072'), }, }; return urls[env]; })(environment.zendeskEnv); // ideally this initialization would be done by including <script> tags in // the component template html file. However, Angular does not allow this. // TODO: investigate whether this will be possible after we migrate to React export function openZendeskWidget( givenName: string, familyName: string, aouEmailAddress: string, contactEmailAddress: string ): void { // Note: we're string-protecting our access of the 'zE' property, since // this property is dynamically loaded by the Zendesk web widget snippet, // and can't properly be typed. If for some reason the support widget is // unavailable, we'll show a notice to the user. // eslint-disable-next-line @typescript-eslint/dot-notation const zE = window['zE']; if (zE == null) { // Show an error message to the user, asking them to reload or contact // support via email. console.error('Error loading Zendesk widget'); return; } // In theory, this webWidget call should identify the user who is filing // this support request. // // In practice, the values provided via 'identify' don't seem to do much. // Zendesk uses values from the 'prefill' action to assign the user email // in the created ticket, which means that for AoU these tickets won't be // correctly associated with the researcher's AoU Google Account. See // the Zendesk integration doc for more discussion. zE('webWidget', 'identify', { name: `${givenName} ${familyName}`, email: aouEmailAddress, }); zE('webWidget', 'prefill', { name: { value: `${givenName} ${familyName}`, readOnly: true, }, // For the contact email we use the user's *contact* email address, // since the AoU email address is not a valid email inbox. email: { value: contactEmailAddress, readOnly: true, }, }); // Trigger the widget to open the full contact form (instead of the // help icon, which is the starting state). zE('webWidget', 'open'); }
{ "content_hash": "9dfdd2ba744424865578bdc6d77aad95", "timestamp": "", "source": "github", "line_count": 163, "max_line_length": 78, "avg_line_length": 34.75460122699386, "alnum_prop": 0.688261253309797, "repo_name": "all-of-us/workbench", "id": "f40dd35493b1a2fd142d44c413ba29a2a193a2b7", "size": "5665", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "ui/src/app/utils/zendesk.ts", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "14709" }, { "name": "Dockerfile", "bytes": "1601" }, { "name": "Groovy", "bytes": "5004" }, { "name": "HTML", "bytes": "354263" }, { "name": "Java", "bytes": "4258561" }, { "name": "JavaScript", "bytes": "104985" }, { "name": "Jupyter Notebook", "bytes": "12135" }, { "name": "Kotlin", "bytes": "76275" }, { "name": "Mustache", "bytes": "126650" }, { "name": "Python", "bytes": "52410" }, { "name": "R", "bytes": "1157" }, { "name": "Ruby", "bytes": "237944" }, { "name": "Shell", "bytes": "507090" }, { "name": "TypeScript", "bytes": "3656309" }, { "name": "wdl", "bytes": "31820" } ] }
@extends('app') @section('content') <div class="container-fluid"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel panel-default"> <div class="panel-heading">Profile</div> <div class="panel-body"> @if (count($errors) > 0) <div class="alert alert-danger"> <strong>Whoops!</strong> There were some problems with your input.<br><br> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif <form class="form-horizontal" role="form" method="POST" action="{{ url('/auth/profile') }}"> <input type="hidden" name="_token" value="{{ csrf_token() }}"> <div class="form-group"> <label class="col-md-4 control-label">Name</label> <div class="col-md-6"> <input type="text" class="form-control" name="name" value="{{ $user->name }}"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">E-Mail Address</label> <div class="col-md-6"> <input type="email" class="form-control" name="email" value="{{ $user->email }}"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Password</label> <div class="col-md-6"> <input type="password" class="form-control" name="password"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Confirm Password</label> <div class="col-md-6"> <input type="password" class="form-control" name="password_confirmation"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Access Token</label> <div class="col-md-6"> <input type="text" class="form-control" name="access_token" value="{{ $user->access_token }}" readonly="readonly"> </div> </div> <div class="form-group"> <div class="col-md-6 col-md-offset-4"> <div class="checkbox"> <label> <input type="checkbox" name="new_access_token"> Create a new access token </label> </div> </div> </div> <div class="form-group"> <div class="col-md-6 col-md-offset-4"> <button type="submit" class="btn btn-primary"> Update profile </button> </div> </div> </form> </div> </div> </div> </div> </div> @endsection
{ "content_hash": "bc52bbc0f52ade409d93ca2877abb956", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 122, "avg_line_length": 30.048780487804876, "alnum_prop": 0.5487012987012987, "repo_name": "CjanOrg/cjan.org", "id": "2c255ddcac59aac3918922e0faaf0d670ac15532", "size": "2464", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "resources/views/auth/profile.blade.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "356" }, { "name": "CSS", "bytes": "1628" }, { "name": "HTML", "bytes": "233229" }, { "name": "JavaScript", "bytes": "581087" }, { "name": "PHP", "bytes": "188800" }, { "name": "Shell", "bytes": "1357" } ] }
Autoloading Files ################# Every application consists of a large number of classes in many different locations. The framework provides classes for core functionality. Your application will have a number of libraries, models, and other entities to make it work. You might have third-party classes that your project is using. Keeping track of where every single file is, and hard-coding that location into your files in a series of ``requires()`` is a massive headache and very error-prone. That's where autoloaders come in. CodeIgniter provides a very flexible autoloader that can be used with very little configuration. It can locate individual non-namespaced classes, namespaced classes that adhere to `PSR4 <https://www.php-fig.org/psr/psr-4/>`_ autoloading directory structures, and will even attempt to locate classes in common directories (like Controllers, Models, etc). For performance improvement, the core CodeIgniter components have been added to the classmap. The autoloader works great by itself, but can also work with other autoloaders, like `Composer <https://getcomposer.org>`_, or even your own custom autoloaders, if needed. Because they're all registered through `spl_autoload_register <https://www.php.net/manual/en/function.spl-autoload-register.php>`_, they work in sequence and don't get in each other's way. The autoloader is always active, being registered with ``spl_autoload_register()`` at the beginning of the framework's execution. Configuration ============= Initial configuration is done in **/app/Config/Autoload.php**. This file contains two primary arrays: one for the classmap, and one for PSR4-compatible namespaces. Namespaces ========== The recommended method for organizing your classes is to create one or more namespaces for your application's files. This is most important for any business-logic related classes, entity classes, etc. The ``psr4`` array in the configuration file allows you to map the namespace to the directory those classes can be found in:: $psr4 = [ 'App' => APPPATH, 'CodeIgniter' => SYSTEMPATH, ]; The key of each row is the namespace itself. This does not need a trailing slash. If you use double-quotes to define the array, be sure to escape the backward slash. That means that it would be ``My\\App``, not ``My\App``. The value is the location to the directory the classes can be found in. They should have a trailing slash. By default, the application folder is namespace to the ``App`` namespace. While you are not forced to namespace the controllers, libraries, or models in the application directory, if you do, they will be found under the ``App`` namespace. You may change this namespace by editing the **/app/Config/Constants.php** file and setting the new namespace value under the ``APP_NAMESPACE`` setting:: define('APP_NAMESPACE', 'App'); You will need to modify any existing files that are referencing the current namespace. .. important:: Config files are namespaced in the ``Config`` namespace, not in ``App\Config`` as you might expect. This allows the core system files to always be able to locate them, even when the application namespace has changed. Classmap ======== The classmap is used extensively by CodeIgniter to eke the last ounces of performance out of the system by not hitting the file-system with extra ``is_file()`` calls. You can use the classmap to link to third-party libraries that are not namespaced:: $classmap = [ 'Markdown' => APPPATH .'third_party/markdown.php' ]; The key of each row is the name of the class that you want to locate. The value is the path to locate it at. Legacy Support ============== If neither of the above methods finds the class, and the class is not namespaced, the autoloader will look in the **/app/Libraries** and **/app/Models** directories to attempt to locate the files. This provides a measure to help ease the transition from previous versions. There are no configuration options for legacy support. Composer Support ================ Composer support is automatically initialized by default. By default, it looks for Composer's autoload file at ``ROOTPATH.'vendor/autoload.php'``. If you need to change the location of that file for any reason, you can modify the value defined in ``Config\Constants.php``. .. note:: If the same namespace is defined in both CodeIgniter and Composer, CodeIgniter's autoloader will be the first one to get a chance to locate the file.
{ "content_hash": "798ad303c6f8950da1f20419b93a59af", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 128, "avg_line_length": 47.421052631578945, "alnum_prop": 0.7547169811320755, "repo_name": "gustavojm/CodeIgniter4", "id": "3fba2750757708ca0d4a196be74ec7d7e65ec271", "size": "4523", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "user_guide_src/source/concepts/autoloader.rst", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "4467" }, { "name": "CSS", "bytes": "142469" }, { "name": "HTML", "bytes": "24555" }, { "name": "JavaScript", "bytes": "17509" }, { "name": "Makefile", "bytes": "4808" }, { "name": "PHP", "bytes": "2219609" }, { "name": "Python", "bytes": "11560" } ] }
End of preview.