text
stringlengths
2
1.04M
meta
dict
/* $Id$ */ /* * Copyright (c) 2003-2009 Axel Andersson * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef WD_FILES_H #define WD_FILES_H 1 #include <wired/wired.h> #include "users.h" #define WD_FILES_META_PATH ".wired" enum _wd_file_type { WD_FILE_TYPE_FILE = 0, WD_FILE_TYPE_DIR, WD_FILE_TYPE_UPLOADS, WD_FILE_TYPE_DROPBOX }; typedef enum _wd_file_type wd_file_type_t; enum _wd_file_label { WD_FILE_LABEL_NONE = WI_FS_FINDER_LABEL_NONE, WD_FILE_LABEL_RED = WI_FS_FINDER_LABEL_RED, WD_FILE_LABEL_ORANGE = WI_FS_FINDER_LABEL_ORANGE, WD_FILE_LABEL_YELLOW = WI_FS_FINDER_LABEL_YELLOW, WD_FILE_LABEL_GREEN = WI_FS_FINDER_LABEL_GREEN, WD_FILE_LABEL_BLUE = WI_FS_FINDER_LABEL_BLUE, WD_FILE_LABEL_PURPLE = WI_FS_FINDER_LABEL_PURPLE, WD_FILE_LABEL_GRAY = WI_FS_FINDER_LABEL_GRAY, }; typedef enum _wd_file_label wd_file_label_t; enum _wd_file_permissions { WD_FILE_OWNER_WRITE = (2 << 6), WD_FILE_OWNER_READ = (4 << 6), WD_FILE_GROUP_WRITE = (2 << 3), WD_FILE_GROUP_READ = (4 << 3), WD_FILE_EVERYONE_WRITE = (2 << 0), WD_FILE_EVERYONE_READ = (4 << 0) }; typedef enum _wd_file_permissions wd_file_permissions_t; typedef struct _wd_files_privileges wd_files_privileges_t; void wd_files_initialize(void); void wd_files_apply_settings(wi_set_t *); void wd_files_schedule(void); wi_boolean_t wd_files_reply_list(wi_string_t *, wi_boolean_t, wd_user_t *, wi_p7_message_t *); wi_file_offset_t wd_files_count_path(wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_reply_info(wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_reply_preview(wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_create_path(wi_string_t *, wd_file_type_t, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_delete_path(wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_move_path(wi_string_t *, wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_link_path(wi_string_t *, wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_set_type(wi_string_t *, wd_file_type_t, wd_user_t *, wi_p7_message_t *); wd_file_type_t wd_files_type(wi_string_t *); wd_file_type_t wd_files_type_with_stat(wi_string_t *, wi_fs_stat_t *); wi_boolean_t wd_files_set_executable(wi_string_t *, wi_boolean_t, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_set_comment(wi_string_t *, wi_string_t *, wd_user_t *, wi_p7_message_t *); void wd_files_move_comment(wi_string_t *, wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_remove_comment(wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_set_label(wi_string_t *, wd_file_label_t, wd_user_t *, wi_p7_message_t *); wd_file_label_t wd_files_label(wi_string_t *path); void wd_files_move_label(wi_string_t *, wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_remove_label(wi_string_t *, wd_user_t *, wi_p7_message_t *); wi_boolean_t wd_files_set_privileges(wi_string_t *, wd_files_privileges_t *, wd_user_t *, wi_p7_message_t *); wd_files_privileges_t * wd_files_privileges(wi_string_t *, wd_user_t *); wd_files_privileges_t * wd_files_drop_box_privileges(wi_string_t *); wi_boolean_t wd_files_path_is_valid(wi_string_t *); wi_string_t * wd_files_virtual_path(wi_string_t *, wd_user_t *); wi_string_t * wd_files_real_path(wi_string_t *, wd_user_t *); wi_boolean_t wd_files_has_uploads_or_drop_box_in_path(wi_string_t *, wd_user_t *, wd_files_privileges_t **); wi_string_t * wd_files_string_for_bytes(wi_file_offset_t); wd_files_privileges_t * wd_files_privileges_with_message(wi_p7_message_t *); wi_boolean_t wd_files_privileges_is_readable_by_account(wd_files_privileges_t *, wd_account_t *); wi_boolean_t wd_files_privileges_is_writable_by_account(wd_files_privileges_t *, wd_account_t *); wi_boolean_t wd_files_privileges_is_readable_and_writable_by_account(wd_files_privileges_t *, wd_account_t *); extern wi_string_t *wd_files; extern wi_uinteger_t wd_files_root_volume; extern wi_fsevents_t *wd_files_fsevents; #endif /* WD_FILES_H */
{ "content_hash": "a8c724e5307cbfbd52cd4b1e465473d1", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 116, "avg_line_length": 46.107438016528924, "alnum_prop": 0.6698333034594013, "repo_name": "nark/wired", "id": "f8cdae09b88d08b4cb282a50db70cfe58cd58970", "size": "5579", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "wired/files.h", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "676007" }, { "name": "C++", "bytes": "41290" }, { "name": "Objective-C", "bytes": "3534" }, { "name": "Shell", "bytes": "5933" } ], "symlink_target": "" }
TaxonomyFilters =============== This extension for spree adds a filter-like behavior to the taxonomy links on the product page and search results page Usage ======= Add the gem to your Gemfile gem 'taxonomy_filters', :git => '[email protected]:MrRuru/spree_taxonomy_filters.git' Copyright (c) 2011 David Ruyer, released under the New BSD License
{ "content_hash": "f647147f2eecd72934b63c4678aced73", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 118, "avg_line_length": 25.5, "alnum_prop": 0.7142857142857143, "repo_name": "mru2/spree_taxonomy_filters", "id": "dea810beff76fa8af3033952c4f0a045fbd951a3", "size": "357", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Ruby", "bytes": "7283" } ], "symlink_target": "" }
import { eventsList } from 'vendor' import { Logger } from '../../utils' import { localFiles } from '../../externals' const logger = new Logger('Config (Update)') const FILE_NAME = 'config.json' const events = eventsList.config.update function update (data) { return localFiles.writeFile(data, FILE_NAME) } function handler (event, data) { try { update(data) logger.info('Updated user configuration.') event.sender.send(events.success) } catch (e) { logger.error('Failed to update user configuration', e) event.sender.send(events.error, e.message) } } export default { eventName: events.main, handler }
{ "content_hash": "0d45063d4f5a6741b6e49e3bf2d33cb0", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 58, "avg_line_length": 22.103448275862068, "alnum_prop": 0.6864274570982839, "repo_name": "Kylart/KawAnime", "id": "6234a1a63b729d0fe1afef4e2fbe738dc71abfa1", "size": "641", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "src/main/services/config/update.js", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "34152" }, { "name": "CMake", "bytes": "2705" }, { "name": "CSS", "bytes": "4158" }, { "name": "HTML", "bytes": "497" }, { "name": "JavaScript", "bytes": "194696" }, { "name": "Vue", "bytes": "225346" } ], "symlink_target": "" }
module Hobo::Dryml::Parser class BaseParser < REXML::Parsers::BaseParser NEW_REX = REXML::VERSION =~ /3\.1\.(\d)(?:\.(\d))?/ && $1.to_i*1000 + $2.to_i >= 7002 DRYML_NAME_STR = "#{NCNAME_STR}(?::(?:#{NCNAME_STR})?)?" DRYML_ATTRIBUTE_PATTERN = if NEW_REX /\s*(#{NAME_STR})(?:\s*=\s*(["'])(.*?)\4)?/um else /\s*(#{NAME_STR})(?:\s*=\s*(["'])(.*?)\2)?/um end DRYML_TAG_MATCH = if NEW_REX /^<((?>#{DRYML_NAME_STR}))\s*((?>\s+#{NAME_STR}(?:\s*=\s*(["']).*?\5)?)*)\s*(\/)?>/um else /^<((?>#{DRYML_NAME_STR}))\s*((?>\s+#{NAME_STR}(?:\s*=\s*(["']).*?\3)?)*)\s*(\/)?>/um end DRYML_CLOSE_MATCH = /^\s*<\/(#{DRYML_NAME_STR})\s*>/um # For compatibility with REXML 3.1.7.3 IDENTITY = /^([!\*\w\-]+)(\s+#{NCNAME_STR})?(\s+["'](.*?)['"])?(\s+['"](.*?)["'])?/u def pull if @closed x, @closed = @closed, nil return [ :end_element, x, false ] end return [ :end_document ] if empty? return @stack.shift if @stack.size > 0 #STDERR.puts @source.encoding @source.read if @source.buffer.size<2 #STDERR.puts "BUFFER = #{@source.buffer.inspect}" if @document_status == nil #@source.consume( /^\s*/um ) word = @source.match( /^((?:\s+)|(?:<[^>]*>))/um ) #word = @source.match(/(<[^>]*)>/um) word = word[1] unless word.nil? #STDERR.puts "WORD = #{word.inspect}" case word when COMMENT_START return [ :comment, @source.match( COMMENT_PATTERN, true )[1] ] when XMLDECL_START #STDERR.puts "XMLDECL" results = @source.match( XMLDECL_PATTERN, true )[1] version = VERSION.match( results ) version = version[1] unless version.nil? encoding = ENCODING.match(results) encoding = encoding[1] unless encoding.nil? @source.encoding = encoding standalone = STANDALONE.match(results) standalone = standalone[1] unless standalone.nil? return [ :xmldecl, version, encoding, standalone ] when INSTRUCTION_START return [ :processing_instruction, *@source.match(INSTRUCTION_PATTERN, true)[1,2] ] when DOCTYPE_START md = @source.match( DOCTYPE_PATTERN, true ) #@nsstack.unshift(curr_ns=Set.new) identity = md[1] close = md[2] identity =~ IDENTITY name = $1 raise REXML::ParseException.new("DOCTYPE is missing a name") if name.nil? pub_sys = $2.nil? ? nil : $2.strip long_name = $4.nil? ? nil : $4.strip uri = $6.nil? ? nil : $6.strip args = [ :start_doctype, name, pub_sys, long_name, uri ] if close == ">" @document_status = :after_doctype @source.read if @source.buffer.size<2 md = @source.match(/^\s*/um, true) @stack << [ :end_doctype ] else @document_status = :in_doctype end return args when /^\s+/ else @document_status = :after_doctype @source.read if @source.buffer.size<2 md = @source.match(/\s*/um, true) if @source.encoding == "UTF-8" if @source.buffer.respond_to? :force_encoding @source.buffer.force_encoding(Encoding::UTF_8) end end end end if @document_status == :in_doctype md = @source.match(/\s*(.*?>)/um) case md[1] when SYSTEMENTITY match = @source.match( SYSTEMENTITY, true )[1] return [ :externalentity, match ] when ELEMENTDECL_START return [ :elementdecl, @source.match( ELEMENTDECL_PATTERN, true )[1] ] when ENTITY_START match = @source.match( ENTITYDECL, true ).to_a.compact match[0] = :entitydecl ref = false if match[1] == '%' ref = true match.delete_at 1 end # Now we have to sort out what kind of entity reference this is if match[2] == 'SYSTEM' # External reference match[3] = match[3][1..-2] # PUBID match.delete_at(4) if match.size > 4 # Chop out NDATA decl # match is [ :entity, name, SYSTEM, pubid(, ndata)? ] elsif match[2] == 'PUBLIC' # External reference match[3] = match[3][1..-2] # PUBID match[4] = match[4][1..-2] # HREF # match is [ :entity, name, PUBLIC, pubid, href ] else match[2] = match[2][1..-2] match.pop if match.size == 4 # match is [ :entity, name, value ] end match << '%' if ref return match when ATTLISTDECL_START md = @source.match( ATTLISTDECL_PATTERN, true ) raise REXML::ParseException.new( "Bad ATTLIST declaration!", @source ) if md.nil? element = md[1] contents = md[0] pairs = {} values = md[0].scan( ATTDEF_RE ) values.each do |attdef| unless attdef[3] == "#IMPLIED" attdef.compact! val = attdef[3] val = attdef[4] if val == "#FIXED " pairs[attdef[0]] = val if attdef[0] =~ /^xmlns:(.*)/ #@nsstack[0] << $1 end end end return [ :attlistdecl, element, pairs, contents ] when NOTATIONDECL_START md = nil if @source.match( PUBLIC ) md = @source.match( PUBLIC, true ) vals = [md[1],md[2],md[4],md[6]] elsif @source.match( SYSTEM ) md = @source.match( SYSTEM, true ) vals = [md[1],md[2],nil,md[4]] else raise REXML::ParseException.new( "error parsing notation: no matching pattern", @source ) end return [ :notationdecl, *vals ] when CDATA_END @document_status = :after_doctype @source.match( CDATA_END, true ) return [ :end_doctype ] end end begin if @source.buffer[0] == ?< if @source.buffer[1] == ?/ #@nsstack.shift last_tag, line_no = @tags.pop #md = @source.match_to_consume( '>', CLOSE_MATCH) md = @source.match(DRYML_CLOSE_MATCH, true) valid_end_tag = last_tag =~ /^#{Regexp.escape(md[1])}(:.*)?/ raise REXML::ParseException.new( "Missing end tag for "+ "'#{last_tag}' (line #{line_no}) (got \"#{md[1]}\")", @source) unless valid_end_tag return [ :end_element, last_tag, true ] elsif @source.buffer[1] == ?! md = @source.match(/\A(\s*[^>]*>)/um) #STDERR.puts "SOURCE BUFFER = #{source.buffer}, #{source.buffer.size}" raise REXML::ParseException.new("Malformed node", @source) unless md if md[0][2] == ?- md = @source.match( COMMENT_PATTERN, true ) case md[1] when /--/, /-$/ raise REXML::ParseException.new("Malformed comment", @source) end return [ :comment, md[1] ] if md else md = @source.match( CDATA_PATTERN, true ) return [ :cdata, md[1] ] if md end raise REXML::ParseException.new( "Declarations can only occur "+ "in the doctype declaration.", @source) elsif @source.buffer[1] == ?? md = @source.match( INSTRUCTION_PATTERN, true ) return [ :processing_instruction, md[1], md[2] ] if md raise REXML::ParseException.new( "Bad instruction declaration", @source) else # Get the next tag md = @source.match(DRYML_TAG_MATCH, true) unless md # Check for missing attribute quotes raise REXML::ParseException.new("missing attribute quote", @source) if defined?(MISSING_ATTRIBUTE_QUOTES) && @source.match(MISSING_ATTRIBUTE_QUOTES) raise REXML::ParseException.new("malformed XML: missing tag start", @source) end attributes = {} #@nsstack.unshift(curr_ns=Set.new) if md[2].size > 0 attrs = md[2].scan(DRYML_ATTRIBUTE_PATTERN) raise REXML::ParseException.new( "error parsing attributes: [#{attrs.join ', '}], excess = \"#$'\"", @source) if $' and $'.strip.size > 0 attrs.each { |a,b,c,d,e| val = NEW_REX ? e : c if attributes.has_key? a msg = "Duplicate attribute #{a.inspect}" raise REXML::ParseException.new( msg, @source, self) end attributes[a] = val || true } end if md[NEW_REX ? 6 : 4] @closed = md[1] #@nsstack.shift else cl = @source.current_line @tags.push( [md[1], cl && cl[2]] ) end return [ :start_element, md[1], attributes, md[0], @source.respond_to?(:last_match_offset) && @source.last_match_offset ] end else md = @source.match( TEXT_PATTERN, true ) if md[0].length == 0 @source.match( /(\s+)/, true ) end #STDERR.puts "GOT #{md[1].inspect}" unless md[0].length == 0 #return [ :text, "" ] if md[0].length == 0 # unnormalized = Text::unnormalize( md[1], self ) # return PullEvent.new( :text, md[1], unnormalized ) return [ :text, md[1] ] end rescue REXML::ParseException raise rescue Exception, NameError => error raise REXML::ParseException.new( "Exception parsing", @source, self, (error ? error : $!) ) end return [ :dummy ] end end end
{ "content_hash": "b735736da48939784ef3356857b90a42", "timestamp": "", "source": "github", "line_count": 254, "max_line_length": 151, "avg_line_length": 40.87007874015748, "alnum_prop": 0.4769290049128215, "repo_name": "lak/puppetshow", "id": "eb316065de0111c688d7fa25400da9602a762e51", "size": "10381", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "vendor/plugins/hobo/lib/hobo/dryml/parser/base_parser.rb", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "JavaScript", "bytes": "89445" }, { "name": "Ruby", "bytes": "43411" } ], "symlink_target": "" }
function tree=readNXU(filename) %READNXU make a tree structure from the xml saved by PhysX %% create the dom object. [~,~,xt]=fileparts(filename); if ~strcmp(xt,'.xml'), error('don''t be a dick'), end dom=xmlread(filename); %% create the actors struct array fields (not the complete list) rawActors=dom.getElementsByTagName('NxActorDesc'); nActors=rawActors.getLength; tree.NxuPhysicsCollection.NxSceneDesc.NxActorDesc=struct(... 'globalPose',cell(1,nActors),... 'linearVelocity',cell(1,nActors),... 'mass',cell(1,nActors),... 'NxBodyDesc',cell(1,nActors),... 'density',cell(1,nActors),... 'NxActorFlag',cell(1,nActors),... 'group',cell(1,nActors),... 'ATTRIBUTE',cell(1,nActors)); %% fill up the important fields: globalPose, linearVelocity, mass for k=1:nActors % careful, java objects zero-based % globalPose sgp=char(rawActors.item(k-1).getElementsByTagName('globalPose').item(0).getTextContent()); gPose=textscan(sgp,'%f',12); tree.NxuPhysicsCollection.NxSceneDesc.NxActorDesc(k).globalPose=... gPose{1}'; % linear velocity slv=char(rawActors.item(k-1).getElementsByTagName('linearVelocity').item(0).getTextContent()); lVel=textscan(slv,'%f',3); tree.NxuPhysicsCollection.NxSceneDesc.NxActorDesc(k).linearVelocity=... lVel{1}'; % mass sms=char(rawActors.item(k-1).getElementsByTagName('mass').item(0).getTextContent()); mass=str2double(sms); tree.NxuPhysicsCollection.NxSceneDesc.NxActorDesc(k).mass=... mass; end %% sniff for shape information for k=1:nActors % careful thisRawActor=rawActors.item(k-1); thisRawSphere=thisRawActor.getElementsByTagName('NxSphereShapeDesc'); if thisRawSphere.getLength > 0 rad=str2double(char(thisRawSphere.item(0).getAttribute('radius'))); tree.NxuPhysicsCollection.NxSceneDesc.NxActorDesc(k).NxSphereShapeDesc.ATTRIBUTE.radius=rad; end thisRawPoly=thisRawActor.getElementsByTagName('NxConvexShapeDesc'); if thisRawPoly.getLength > 0 meshLabel=char(thisRawPoly.item(0).getAttribute('meshData')); tree.NxuPhysicsCollection.NxSceneDesc.NxActorDesc(k).NxConvexShapeDesc.ATTRIBUTE.meshData=... meshLabel; end end %% the convex mesh data is outside of the actor rawMeshes=dom.getElementsByTagName('NxConvexMeshDesc'); nMeshes=rawMeshes.getLength; for k=1:nMeshes spts=char(rawMeshes.item(k-1).getElementsByTagName('points').item(0).getTextContent); pts=textscan(spts,'%f'); tree.NxuPhysicsCollection.NxConvexMeshDesc(k).points=pts{1}'; end
{ "content_hash": "c51d5e565e46340074e9c07309940b43", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 101, "avg_line_length": 40.04545454545455, "alnum_prop": 0.6995838062807416, "repo_name": "nmovshov/ARSS_win", "id": "c89bbd19f536954f909e5d853fc02deab736d9db", "size": "2643", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scripts/legacy(nphysx)/readNXU.m", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "2345" }, { "name": "C++", "bytes": "310309" }, { "name": "Cuda", "bytes": "15297" }, { "name": "Matlab", "bytes": "100654" } ], "symlink_target": "" }
typedef struct ubst_opaq ubst_t; typedef struct ubst_iterator_opaq ubst_iterator_t; typedef enum { UBST_PREORDER, UBST_POSTORDER, UBST_INORDER, } ubst_traverse_mode_t; typedef enum { UBST_DEFAULT_BALANCING, UBST_NO_BALANCING, UBST_RB_BALANCING, UBST_SPLAY_BALANCING, UBST_BALANCING_MODES_COUNT, // keep it last } ubst_balancing_mode_t; void ubst_set_default_balancing_mode(ubst_balancing_mode_t mode); ubst_t *ubst_create(void); ubst_t *ubst_create_ext(ubst_balancing_mode_t mode); void ubst_destroy(ubst_t *b); static bool ubst_is_data_owner(ubst_t *b); static void ubst_drop_data_ownership(ubst_t *b); static void ubst_take_data_ownership(ubst_t *b); void ubst_put(ubst_t *b, ugeneric_t k, ugeneric_t v); ugeneric_t ubst_pop(ubst_t *b, ugeneric_t k, ugeneric_t vdef); ugeneric_t ubst_get(ubst_t *b, ugeneric_t k, ugeneric_t vdef); bool ubst_remove(ubst_t *b, ugeneric_t k); bool ubst_has_key(const ubst_t *b, ugeneric_t k); ugeneric_t ubst_get_min(ubst_t *b); ugeneric_t ubst_get_max(ubst_t *b); size_t ubst_get_size(ubst_t *b); bool ubst_is_empty(ubst_t *b); void ubst_clear(ubst_t *b); ugeneric_t ubst_get_inorder_predecessor(ubst_t *b, ugeneric_t k, ugeneric_t vdef); ugeneric_t ubst_get_inorder_successor(ubst_t *b, ugeneric_t k, ugeneric_t vdef); bool ubst_is_balanced(const ubst_t *b); void ubst_traverse(const ubst_t *b, ubst_traverse_mode_t mode, ugeneric_kv_iter_t iter, void *data); void ubst_dump_to_dot(const ubst_t *b, const char *name, bool dump_values, FILE *out); char *ubst_as_str(const ubst_t *b); void ubst_serialize(const ubst_t *b, ubuffer_t *buf); int ubst_fprint(const ubst_t *b, FILE *out); static inline int ubst_print(const ubst_t *b) {return ubst_fprint(b, stdout);} ubst_iterator_t *ubst_iterator_create(const ubst_t *b); ugeneric_kv_t ubst_iterator_get_next(ubst_iterator_t *bi); bool ubst_iterator_has_next(const ubst_iterator_t *bi); void ubst_iterator_reset(ubst_iterator_t *bi); void ubst_iterator_destroy(ubst_iterator_t *bi); uvector_t *ubst_get_items(const ubst_t *b, udict_items_kind_t kind, bool deep); static inline uvector_t *ubst_get_keys(const ubst_t *b, bool deep) {return ubst_get_items(b, UDICT_KEYS, deep);} static inline uvector_t *ubst_get_values(const ubst_t *b, bool deep) {return ubst_get_items(b, UDICT_VALUES, deep);} ugeneric_base_t *ubst_get_base(ubst_t *b); DEFINE_BASE_FUNCS(ubst, b) #endif
{ "content_hash": "75fbb8d0dd2c2647dd3c2b023e6be669", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 116, "avg_line_length": 37.507462686567166, "alnum_prop": 0.6888181456426582, "repo_name": "vslapik/ugeneric", "id": "8b65f32e123c1eea69a8d1ccb1f1635d8380ddac", "size": "2590", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "include/bst.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "363508" }, { "name": "C++", "bytes": "11486" }, { "name": "GDB", "bytes": "34" }, { "name": "Makefile", "bytes": "2586" }, { "name": "Python", "bytes": "1648" }, { "name": "Vim script", "bytes": "817" } ], "symlink_target": "" }
package org.nd4j.linalg.api.rng.distribution.impl; import lombok.val; import org.apache.commons.math3.exception.NumberIsTooLargeException; import org.apache.commons.math3.exception.OutOfRangeException; import org.apache.commons.math3.exception.util.LocalizedFormats; import org.nd4j.linalg.api.iter.NdIndexIterator; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.api.rng.distribution.BaseDistribution; import org.nd4j.linalg.factory.Nd4j; import java.util.Iterator; /** * Base distribution derived from apache commons math * http://commons.apache.org/proper/commons-math/ * <p/> * (specifically the {@link org.apache.commons.math3.distribution.UniformIntegerDistribution} * * @author Adam Gibson */ public class UniformDistribution extends BaseDistribution { private double upper, lower; /** * Create a uniform real distribution using the given lower and upper * bounds. * * @param lower Lower bound of this distribution (inclusive). * @param upper Upper bound of this distribution (exclusive). * @throws NumberIsTooLargeException if {@code lower >= upper}. */ public UniformDistribution(double lower, double upper) throws NumberIsTooLargeException { this(Nd4j.getRandom(), lower, upper); } /** * Creates a uniform distribution. * * @param rng Random number generator. * @param lower Lower bound of this distribution (inclusive). * @param upper Upper bound of this distribution (exclusive). * @throws NumberIsTooLargeException if {@code lower >= upper}. * @since 3.1 */ public UniformDistribution(org.nd4j.linalg.api.rng.Random rng, double lower, double upper) throws NumberIsTooLargeException { super(rng); if (lower >= upper) { throw new NumberIsTooLargeException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND, lower, upper, false); } this.lower = lower; this.upper = upper; } /** * {@inheritDoc} */ public double density(double x) { if (x < lower || x > upper) { return 0.0; } return 1 / (upper - lower); } /** * {@inheritDoc} */ public double cumulativeProbability(double x) { if (x <= lower) { return 0; } if (x >= upper) { return 1; } return (x - lower) / (upper - lower); } @Override public double cumulativeProbability(double x0, double x1) throws NumberIsTooLargeException { return 0; } @Override public double inverseCumulativeProbability(final double p) throws OutOfRangeException { if (p < 0.0 || p > 1.0) { throw new OutOfRangeException(p, 0, 1); } return p * (upper - lower) + lower; } /** * {@inheritDoc} * <p/> * For lower bound {@code lower} and upper bound {@code upper}, the mean is * {@code 0.5 * (lower + upper)}. */ public double getNumericalMean() { return 0.5 * (lower + upper); } /** * {@inheritDoc} * <p/> * For lower bound {@code lower} and upper bound {@code upper}, the * variance is {@code (upper - lower)^2 / 12}. */ public double getNumericalVariance() { double ul = upper - lower; return ul * ul / 12; } /** * {@inheritDoc} * <p/> * The lower bound of the support is equal to the lower bound parameter * of the distribution. * * @return lower bound of the support */ public double getSupportLowerBound() { return lower; } /** * {@inheritDoc} * <p/> * The upper bound of the support is equal to the upper bound parameter * of the distribution. * * @return upper bound of the support */ public double getSupportUpperBound() { return upper; } /** * {@inheritDoc} */ public boolean isSupportLowerBoundInclusive() { return true; } /** * {@inheritDoc} */ public boolean isSupportUpperBoundInclusive() { return true; } /** * {@inheritDoc} * <p/> * The support of this distribution is connected. * * @return {@code true} */ public boolean isSupportConnected() { return true; } /** * {@inheritDoc} */ @Override public double sample() { final double u = random.nextDouble(); return u * upper + (1 - u) * lower; } @Override public INDArray sample(int[] shape) { final INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order()); return sample(ret); } @Override public INDArray sample(INDArray ret) { if (random.getStatePointer() != null) { return Nd4j.getExecutioner().exec(new org.nd4j.linalg.api.ops.random.impl.UniformDistribution( ret, lower, upper), random); } else { val idxIter = new NdIndexIterator(ret.shape()); //For consistent values irrespective of c vs. fortran ordering long len = ret.length(); for (int i = 0; i < len; i++) { ret.putScalar(idxIter.next(), sample()); } return ret; } } }
{ "content_hash": "52ff5ee936e8cb950e4596a4b2b7d842", "timestamp": "", "source": "github", "line_count": 197, "max_line_length": 122, "avg_line_length": 27.101522842639593, "alnum_prop": 0.5914965349316351, "repo_name": "RobAltena/deeplearning4j", "id": "d19e5506fda00bca5045f9ae9a43f00b4a64c489", "size": "6100", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/rng/distribution/impl/UniformDistribution.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "2469" }, { "name": "C", "bytes": "144275" }, { "name": "C#", "bytes": "138404" }, { "name": "C++", "bytes": "16954560" }, { "name": "CMake", "bytes": "77377" }, { "name": "CSS", "bytes": "10363" }, { "name": "Cuda", "bytes": "2324886" }, { "name": "Dockerfile", "bytes": "1329" }, { "name": "FreeMarker", "bytes": "77045" }, { "name": "HTML", "bytes": "38914" }, { "name": "Java", "bytes": "36293636" }, { "name": "JavaScript", "bytes": "436278" }, { "name": "PureBasic", "bytes": "12256" }, { "name": "Python", "bytes": "325018" }, { "name": "Ruby", "bytes": "4558" }, { "name": "Scala", "bytes": "355054" }, { "name": "Shell", "bytes": "80490" }, { "name": "Smarty", "bytes": "900" }, { "name": "Starlark", "bytes": "931" }, { "name": "TypeScript", "bytes": "80252" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Autocomplete - Custom data and display</title> <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> <script src="../../jquery-1.6.2.js"></script> <script src="../../ui/jquery.ui.core.js"></script> <script src="../../ui/jquery.ui.widget.js"></script> <script src="../../ui/jquery.ui.position.js"></script> <script src="../../ui/jquery.ui.autocomplete.js"></script> <link rel="stylesheet" href="../demos.css"> <style> #project-label { display: block; font-weight: bold; margin-bottom: 1em; } #project-icon { float: left; height: 32px; width: 32px; } #project-description { margin: 0; padding: 0; } </style> <script> $(function() { var projects = [ { value: "jquery", label: "jQuery", desc: "the write less, do more, JavaScript library", icon: "jquery_32x32.png" }, { value: "jquery-ui", label: "jQuery UI", desc: "the official user interface library for jQuery", icon: "jqueryui_32x32.png" }, { value: "sizzlejs", label: "Sizzle JS", desc: "a pure-JavaScript CSS selector engine", icon: "sizzlejs_32x32.png" } ]; $( "#project" ).autocomplete({ minLength: 0, source: projects, focus: function( event, ui ) { $( "#project" ).val( ui.item.label ); return false; }, select: function( event, ui ) { $( "#project" ).val( ui.item.label ); $( "#project-id" ).val( ui.item.value ); $( "#project-description" ).html( ui.item.desc ); $( "#project-icon" ).attr( "src", "images/" + ui.item.icon ); return false; } }) .data( "autocomplete" )._renderItem = function( ul, item ) { return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a>" + item.label + "<br>" + item.desc + "</a>" ) .appendTo( ul ); }; }); </script> </head> <body> <div class="demo"> <div id="project-label">Select a project (type "j" for a start):</div> <img id="project-icon" src="images/transparent_1x1.png" class="ui-state-default" /> <input id="project" /> <input type="hidden" id="project-id" /> <p id="project-description"></p> </div> <!-- End demo --> <div class="demo-description"> <p>You can use your own custom data formats and displays by simply overriding the default focus and select actions.</p> <p>Try typing "j" to get a list of projects or just press the down arrow.</p> </div> <!-- End demo-description --> </body> </html>
{ "content_hash": "488b259ce2bb2a81114d04261f11b421", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 72, "avg_line_length": 24.643564356435643, "alnum_prop": 0.6010445962233829, "repo_name": "zhangjunfang/eclipse-dir", "id": "c24f33f136289de3f8a3c4fcbdfe4c0d407e8094", "size": "2489", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "eCardCity2.0/ecardcity-platform/src/main/resources/views/scripts/lib/jquery/development-bundle/demos/autocomplete/custom-data.html", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "ASP", "bytes": "341592" }, { "name": "Assembly", "bytes": "11762" }, { "name": "CSS", "bytes": "5838098" }, { "name": "ColdFusion", "bytes": "998340" }, { "name": "Java", "bytes": "11143836" }, { "name": "JavaScript", "bytes": "37580201" }, { "name": "Lasso", "bytes": "140040" }, { "name": "PHP", "bytes": "610596" }, { "name": "Perl", "bytes": "280108" }, { "name": "Python", "bytes": "389792" }, { "name": "Scala", "bytes": "652118" }, { "name": "Shell", "bytes": "18696" }, { "name": "Slash", "bytes": "4374192" } ], "symlink_target": "" }
<?php // classpath namespace Mimoto\EntityConfig; // Mimoto classes use Mimoto\Core\CoreFormUtils; use Mimoto\Core\entities\Entity; use Mimoto\Mimoto; use Mimoto\Data\MimotoDataUtils; use Mimoto\Core\CoreConfig; use Mimoto\Data\MimotoEntity; use Mimoto\Data\MimotoEntityException; use Mimoto\EntityConfig\MimotoEntityPropertyTypes; use Mimoto\EntityConfig\EntityConfigTableUtils; use Mimoto\EntityConfig\EntityConfig; use Mimoto\EntityConfig\MimotoEntityPropertyValueTypes; /** * EntityConfigService * * @author Sebastian Kersten (@supertaboo) */ class EntityConfigService { // config private $_aEntityConfigs = []; // components private $_entityConfigRepository; // ---------------------------------------------------------------------------- // --- Constructor ------------------------------------------------------------ // ---------------------------------------------------------------------------- /** * Constructor * @param object $entityConfigRepository */ public function __construct($entityConfigRepository) { // store $this->_entityConfigRepository = $entityConfigRepository; } // ---------------------------------------------------------------------------- // --- Public methods --------------------------------------------------------- // ---------------------------------------------------------------------------- /** * Get entity by id * @param int $nId * @return EntityConfig The requested entity config */ public function getEntityConfigById($nId) { try { $entityConfig = $this->_entityConfigRepository->get($nId); } catch(MimotoEntityException $e) { die($e->getMessage()); } // send return $entityConfig; } public function getAllEntityConfigData() { return $this->_entityConfigRepository->getAllEntityConfigData(); } /** * Get entity config by name */ public function getEntityConfigByName($sEntityConfigName) { return $this->_entityConfigRepository->getEntityConfigByName($sEntityConfigName); } /** * Get all entities */ public function getAllEntityConfigs() { return $this->_entityConfigRepository->getAllEntityConfigs(); } public function getEntityNameById($nId) { return $this->_entityConfigRepository->getEntityNameById($nId); } public function getEntityIdByName($sName) { return $this->_entityConfigRepository->getEntityIdByName($sName); } public function getPropertyNameById($nId) { return $this->_entityConfigRepository->getPropertyNameById($nId); } public function getPropertyIdByName($sName, $nParentEntityTypeId = null) { return $this->_entityConfigRepository->getPropertyIdByName($sName, $nParentEntityTypeId); } public function getPropertyTypeById($nId) { return $this->_entityConfigRepository->getPropertyTypeById($nId); } public function getEntityNameByPropertyId($nId) { return $this->_entityConfigRepository->getEntityNameByPropertyId($nId); } /** * Get all entities */ public function find($criteria) { // init $aEntityConfigs= []; if (isset($criteria['typeOf'])) { // read $sEntityTypeName = $criteria['typeOf']; // load $aEntityConfigs = $this->_entityConfigRepository->getEntityConfigsTypeOf($sEntityTypeName); } // send return $aEntityConfigs; } public function getParent($sParentEntityTypeId, $sParentPropertyId, MimotoEntity $child) { // 1. load $aParents = $this->getParents($sParentEntityTypeId, $sParentPropertyId, $child); // 2. register $nParentCount = count($aParents); // 3. verify and return special format if ($nParentCount == 0) return null; if ($nParentCount == 1) return $aParents[0]; // 4. send all return $aParents; } public function getParents($sParentEntityTypeId, $sParentPropertyId, MimotoEntity $child) { $xId = $child->getId(); if (substr($xId, 0, strlen(CoreConfig::CORE_PREFIX)) == CoreConfig::CORE_PREFIX) { // create $eParent = Mimoto::service('data')->create(CoreConfig::MIMOTO_ENTITY); // setup $eParent->setId($xId); $eParent->setValue('name', $this->_entityConfigRepository->getEntityNameByFormId($xId)); // send return [$eParent]; } else { if (!MimotoDataUtils::isValidId($sParentEntityTypeId)) { if (MimotoDataUtils::isValidEntityName($sParentEntityTypeId)) { // convert $sParentEntityTypeId = Mimoto::service('entityConfig')->getEntityIdByName($sParentEntityTypeId); } } if (!MimotoDataUtils::isValidId($sParentPropertyId)) { if (MimotoDataUtils::validatePropertyName($sParentPropertyId)) { // convert $sParentPropertyId = Mimoto::service('entityConfig')->getPropertyIdByName($sParentPropertyId, $sParentEntityTypeId); } } // validate if (empty($sParentEntityTypeId) || empty($sParentPropertyId)) return []; // load all connections $stmt = Mimoto::service('database')->prepare( "SELECT * FROM `".CoreConfig::MIMOTO_CONNECTION."` WHERE ". "parent_entity_type_id = :parent_entity_type_id && ". "parent_property_id = :parent_property_id && ". "child_entity_type_id = :child_entity_type_id && ". "child_id = :child_id ". "ORDER BY parent_id ASC, sortindex ASC" ); $params = array( ':parent_entity_type_id' => $sParentEntityTypeId, ':parent_property_id' => $sParentPropertyId, ':child_entity_type_id' => $child->getEntityTypeId(), ':child_id' => $child->getId(), ); $stmt->execute($params); // load $aResults = $stmt->fetchAll(); // init $aParents = []; // collect $nResultCount = count($aResults); for ($nResultIndex = 0; $nResultIndex < $nResultCount; $nResultIndex++) { // register $result = $aResults[$nResultIndex]; // load $aParents[] = Mimoto::service('data')->get($sParentEntityTypeId, $result['parent_id']); } // send return $aParents; } } public function entityIsTypeOf($sTypeOfEntity, $sTypeToCompare) { return $this->_entityConfigRepository->entityIsTypeOf($sTypeOfEntity, $sTypeToCompare); } public function correctEntityNameForUserExtension($sEntityName) { return $this->_entityConfigRepository->correctEntityNameForUserExtension($sEntityName); } }
{ "content_hash": "1f2d63e8e27392cf4a6b54b162139402", "timestamp": "", "source": "github", "line_count": 262, "max_line_length": 136, "avg_line_length": 27.931297709923665, "alnum_prop": 0.5465974309920744, "repo_name": "SebastianKersten/Mimoto.Aimless", "id": "5a55cf39d65bc4b01904581508d30f0b48d4a4c7", "size": "7318", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/domains/EntityConfig/EntityConfigService.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "447" }, { "name": "CSS", "bytes": "196135" }, { "name": "HTML", "bytes": "333667" }, { "name": "JavaScript", "bytes": "716341" }, { "name": "PHP", "bytes": "793753" } ], "symlink_target": "" }
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): [email protected] * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var gTestfile = 'regress-307456.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 307456; var summary = 'Do not Freeze with RegExp'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var data='<!---<->---->\n\n<><>--!!!<><><><><><>\n!!<>\n\n<>\n<><><><>!\n\n\n\n--\n--\n--\n\n--\n--\n\n\n-------\n--\n--\n\n\n--\n\n\n\n----\n\n\n\n--\n\n\n-\n\n\n-\n\n-\n\n-\n\n-\n-\n\n----\n\n-\n\n\n\n\n-\n\n\n\n\n\n\n\n\n-----\n\n\n-\n------\n-------\n\n----\n\n\n\n!\n\n\n\n\n\n\n\n!!!\n\n\n--------\n\n\n\n-\n\n\n-\n--\n\n----\n\n\n\n\n\n-\n\n\n----\n\n\n\n\n\n--------\n!\n\n\n\n\n-\n---\n--\n\n----\n\n-\n\n-\n\n-\n\n\n\n-----\n\n\n\n-\n\n\n-\n\n\n--\n-\n\n\n-\n\n----\n\n---\n\n---\n\n----\n\n\n\n---\n\n-++\n\n-------<>\n\n-!\n\n--\n\n----!-\n\n\n\n'; printStatus(data); data=data.replace(RegExp('<!--(\\n[^\\n]|[^-]|-[^-]|--[^>])*-->', 'g'), ''); printStatus(data); reportCompare(expect, actual, summary);
{ "content_hash": "5a7d6f13a7e103603486d52e1cc35f91", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 560, "avg_line_length": 51.94444444444444, "alnum_prop": 0.6114081996434938, "repo_name": "cosh/Jint", "id": "dd2f540f6c28c8cceb9a3da0b7bcff19f504720a", "size": "2805", "binary": false, "copies": "33", "ref": "refs/heads/master", "path": "Jint.Tests/ecma_3/RegExp/regress-307456.js", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "1197607" }, { "name": "GAP", "bytes": "55563" }, { "name": "JavaScript", "bytes": "2031891" } ], "symlink_target": "" }
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.devtools.build.lib.packages; /** * Exception indicating that the same package (i.e. BUILD file) can be loaded * via different package paths. */ // TODO(bazel-team): (2009) Change exception hierarchy so that DuplicatePackageException is no // longer a child of NoSuchPackageException. public class DuplicatePackageException extends NoSuchPackageException { public DuplicatePackageException(PackageIdentifier packageIdentifier, String message) { super(packageIdentifier, message); } public DuplicatePackageException(PackageIdentifier packageIdentifier, String message, Throwable cause) { super(packageIdentifier, message, cause); } }
{ "content_hash": "d28ee929cabfe9663106982c2f9656ef", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 94, "avg_line_length": 39.90909090909091, "alnum_prop": 0.7501898253606681, "repo_name": "rzagabe/bazel", "id": "8dff44f3bfc1caca65e32e8bdcfb05cc15bf3a49", "size": "1317", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "src/main/java/com/google/devtools/build/lib/packages/DuplicatePackageException.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "25392" }, { "name": "C++", "bytes": "245126" }, { "name": "CSS", "bytes": "604" }, { "name": "HTML", "bytes": "51852" }, { "name": "Java", "bytes": "11371038" }, { "name": "JavaScript", "bytes": "12819" }, { "name": "Objective-C", "bytes": "22814" }, { "name": "Protocol Buffer", "bytes": "56631" }, { "name": "Python", "bytes": "70424" }, { "name": "Rust", "bytes": "3144" }, { "name": "Shell", "bytes": "190532" } ], "symlink_target": "" }
class ArticleSubscription < ApplicationRecord include Dateable belongs_to :article, counter_cache: :subscriptions_count belongs_to :user validates :user_id, uniqueness: { scope: :article_id, message: "is already subscribed" } def send_update clear_existing_queued_update_jobs if update_queued? SendArticleUpdateJob.set(wait: 5.minutes).perform_later(article.id, user.id) end def update_queued? existing_queued_update_jobs.any? end def existing_queued_update_jobs Delayed::Job .where(%Q["delayed_jobs"."handler" LIKE '%SendArticleUpdateJob%']) .where(%Q["delayed_jobs"."handler" LIKE '%arguments:%#{article_id}%']) end def clear_existing_queued_update_jobs existing_queued_update_jobs.destroy_all end end
{ "content_hash": "f595528dc650196729b535ed72f7189f", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 80, "avg_line_length": 26.620689655172413, "alnum_prop": 0.7150259067357513, "repo_name": "codeschool/orientation", "id": "8152ae30cad2de31415410efd155d447c6acb084", "size": "772", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/models/article_subscription.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "59296" }, { "name": "CoffeeScript", "bytes": "19559" }, { "name": "HTML", "bytes": "30247" }, { "name": "JavaScript", "bytes": "101" }, { "name": "Ruby", "bytes": "167198" } ], "symlink_target": "" }
This example shows how to stream an instance of Blender 3D on Selkies using the GKE WebRTC VDI stack. ## Dependencies - App Launcher: [v1.0.0+](https://github.com/GoogleCloudPlatform/solutions-k8s-stateful-workload-operator/tree/v1.0.0) - WebRTC Streaming Stack: [v1.4.0+](https://github.com/GoogleCloudPlatform/solutions-webrtc-gpu-streaming/tree/v1.4.0) ## Features - Blender 3D single application streaming experience. - Software renderer when Xpra is true and Node Tier is standard. - Uses App Streaming base image. ## Installed Software - Blender 3D ## Tutorials This tutorial will walk you through the following: - Verifying cluster pre-requisites. - Building the image and deploying the manifests with Cloud Build. ## Setup 1. Set the project, replace `YOUR_PROJECT` with your project ID: ```bash export PROJECT_ID=YOUR_PROJECT ``` ```bash gcloud config set project ${PROJECT_ID?} ``` ## Pre-requisites This tutorial requires that you have already deployed the Kubernetes App Launcher Operator in your GKE cluster. If you have not already deployed the operator, follow this Cloud Shell tutorial to do so: [![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://github.com/GoogleCloudPlatform/solutions-k8s-stateful-workload-operator&cloudshell_git_branch=v1.0.0&cloudshell_tutorial=setup/README.md) This tutorial requires that you have deployed the WebRTC streaming app launcher stack to the cluster. If you have not installed the WebRTC stack, follow this Cloud Shell tutorial to do so: [![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://github.com/GoogleCloudPlatform/solutions-webrtc-gpu-streaming&cloudshell_git_branch=v1.0.0&&cloudshell_tutorial=tutorials/gke/00_Setup.md). ## Platform verification 3. Obtain cluster credentials: ```bash REGION=us-west1 ``` > NOTE: change this to the region of your cluster. ```bash gcloud --project ${PROJECT_ID?} container clusters get-credentials broker-${REGION?} --region ${REGION?} ``` 2. Verify that the WebRTC streaming manifest bundle is present: ```bash kubectl get configmap webrtc-gpu-streaming-manifests-1.4.0 -n pod-broker-system ``` 3. Verify that GPU sharing is enabled: ```bash kubectl describe node -l cloud.google.com/gke-accelerator-initialized=true | grep nvidia.com/gpu ``` Example output: ``` nvidia.com/gpu: 48 nvidia.com/gpu: 48 ``` > Verify that the number of availble GPUs is greater than 1. ## Build the app image 1. Build the container image using cloud build: ```bash (cd images && gcloud builds submit) ``` ## Deploy the app manifests 1. Deploy manifests to the cluster: ```bash gcloud builds submit --substitutions=_REGION=${REGION?} ``` 2. Open the app launcher web interface and launch the app. > NOTE: after the Cloud Build has completed from the previous step, it will take a few minutes for the nodes to pre-pull the image. As a result, the first launch may take longer than usual.
{ "content_hash": "2bd7f671dc8c543881b00cdb1b8dd82c", "timestamp": "", "source": "github", "line_count": 104, "max_line_length": 290, "avg_line_length": 30.048076923076923, "alnum_prop": 0.7552, "repo_name": "GoogleCloudPlatform/selkies-examples", "id": "fcb377cfa1921d1b376dd93d0115d0439a1bbfea", "size": "3161", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "blender/README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "22452" }, { "name": "Go", "bytes": "15791" }, { "name": "HCL", "bytes": "21917" }, { "name": "HTML", "bytes": "2717" }, { "name": "JavaScript", "bytes": "15841" }, { "name": "Makefile", "bytes": "1032" }, { "name": "Open Policy Agent", "bytes": "4277" }, { "name": "PHP", "bytes": "67" }, { "name": "Shell", "bytes": "76179" } ], "symlink_target": "" }
import * as stream from 'stream'; declare class DropStream extends stream.Transform { static obj(options?: stream.TransformOptions): DropStream; } export = DropStream;
{ "content_hash": "e5a03c2d886f8212916eca896357b6a5", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 60, "avg_line_length": 24.571428571428573, "alnum_prop": 0.7674418604651163, "repo_name": "Fitbit/fitbit-sdk-toolchain", "id": "f3af42a0b68f30c518fa242f40bc9f6a471dd09a", "size": "172", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/types/drop-stream/index.d.ts", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "342" }, { "name": "JavaScript", "bytes": "2497" }, { "name": "TypeScript", "bytes": "239547" } ], "symlink_target": "" }
// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons // to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or // substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; using System.Collections.Generic; using System.IO; using System.Linq; using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.TypeSystem; using Microsoft.Build.Framework; using Microsoft.Build.Logging; namespace ICSharpCode.NRefactory.ConsistencyCheck { /// <summary> /// Represents a C# project (.csproj file) /// </summary> public class CSharpProject { /// <summary> /// Parent solution. /// </summary> public readonly Solution Solution; /// <summary> /// Title is the project name as specified in the .sln file. /// </summary> public readonly string Title; /// <summary> /// Name of the output assembly. /// </summary> public readonly string AssemblyName; /// <summary> /// Full path to the .csproj file. /// </summary> public readonly string FileName; public readonly List<CSharpFile> Files = new List<CSharpFile>(); public readonly CompilerSettings CompilerSettings = new CompilerSettings(); /// <summary> /// The unresolved type system for this project. /// </summary> public readonly IProjectContent ProjectContent; /// <summary> /// The resolved type system for this project. /// This field is initialized once all projects have been loaded (in Solution constructor). /// </summary> public ICompilation Compilation; public CSharpProject(Solution solution, string title, string fileName) { // Normalize the file name fileName = Path.GetFullPath(fileName); this.Solution = solution; this.Title = title; this.FileName = fileName; // Use MSBuild to open the .csproj var msbuildProject = new Microsoft.Build.Evaluation.Project(fileName); // Figure out some compiler settings this.AssemblyName = msbuildProject.GetPropertyValue("AssemblyName"); this.CompilerSettings.AllowUnsafeBlocks = GetBoolProperty(msbuildProject, "AllowUnsafeBlocks") ?? false; this.CompilerSettings.CheckForOverflow = GetBoolProperty(msbuildProject, "CheckForOverflowUnderflow") ?? false; string defineConstants = msbuildProject.GetPropertyValue("DefineConstants"); foreach (string symbol in defineConstants.Split(new char[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries)) this.CompilerSettings.ConditionalSymbols.Add(symbol.Trim()); // Initialize the unresolved type system IProjectContent pc = new CSharpProjectContent(); pc = pc.SetAssemblyName(this.AssemblyName); pc = pc.SetProjectFileName(fileName); pc = pc.SetCompilerSettings(this.CompilerSettings); // Parse the C# code files foreach (var item in msbuildProject.GetItems("Compile")) { var file = new CSharpFile(this, Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude)); Files.Add(file); } // Add parsed files to the type system pc = pc.AddOrUpdateFiles(Files.Select(f => f.UnresolvedTypeSystemForFile)); // Add referenced assemblies: foreach (string assemblyFile in ResolveAssemblyReferences(msbuildProject)) { IUnresolvedAssembly assembly = solution.LoadAssembly(assemblyFile); pc = pc.AddAssemblyReferences(new [] { assembly }); } // Add project references: foreach (var item in msbuildProject.GetItems("ProjectReference")) { string referencedFileName = Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude); // Normalize the path; this is required to match the name with the referenced project's file name referencedFileName = Path.GetFullPath(referencedFileName); pc = pc.AddAssemblyReferences(new[] { new ProjectReference(referencedFileName) }); } this.ProjectContent = pc; } IEnumerable<string> ResolveAssemblyReferences(Microsoft.Build.Evaluation.Project project) { // Use MSBuild to figure out the full path of the referenced assemblies var projectInstance = project.CreateProjectInstance(); projectInstance.SetProperty("BuildingProject", "false"); project.SetProperty("DesignTimeBuild", "true"); projectInstance.Build("ResolveAssemblyReferences", new [] { new ConsoleLogger(LoggerVerbosity.Minimal) }); var items = projectInstance.GetItems("_ResolveAssemblyReferenceResolvedFiles"); string baseDirectory = Path.GetDirectoryName(this.FileName); return items.Select(i => Path.Combine(baseDirectory, i.GetMetadataValue("Identity"))); } static bool? GetBoolProperty(Microsoft.Build.Evaluation.Project p, string propertyName) { string val = p.GetPropertyValue(propertyName); bool result; if (bool.TryParse(val, out result)) return result; else return null; } public override string ToString() { return string.Format("[CSharpProject AssemblyName={0}]", AssemblyName); } } }
{ "content_hash": "73244d3503cb2d245234875c35d702b5", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 115, "avg_line_length": 39.63945578231292, "alnum_prop": 0.7405182769864425, "repo_name": "NcLang/vimrc", "id": "976c1c91332e49862958f25607fceb257570d023", "size": "5829", "binary": false, "copies": "14", "ref": "refs/heads/master", "path": "sources_non_forked/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory.ConsistencyCheck/CSharpProject.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "568" }, { "name": "CSS", "bytes": "6320" }, { "name": "CoffeeScript", "bytes": "1402" }, { "name": "Erlang", "bytes": "3232" }, { "name": "GCC Machine Description", "bytes": "525" }, { "name": "Go", "bytes": "2239" }, { "name": "HTML", "bytes": "134" }, { "name": "JavaScript", "bytes": "1064" }, { "name": "Makefile", "bytes": "8657" }, { "name": "Perl", "bytes": "2705" }, { "name": "Python", "bytes": "704814" }, { "name": "Ruby", "bytes": "33390" }, { "name": "Shell", "bytes": "9370" }, { "name": "TeX", "bytes": "6193" }, { "name": "VimL", "bytes": "3170590" }, { "name": "XSLT", "bytes": "4217" } ], "symlink_target": "" }
//------------------------------------------------------------ // Game Framework // Copyright © 2013-2019 Jiang Yin. All rights reserved. // Homepage: http://gameframework.cn/ // Feedback: mailto:[email protected] //------------------------------------------------------------ using GameFramework; using LitJson; using System; namespace PokemonUnity { /// <summary> /// LitJSON 函数集辅助器。 /// </summary> internal class LitJsonHelper : GameFramework.Utility.Json.IJsonHelper { /// <summary> /// 将对象序列化为 JSON 字符串。 /// </summary> /// <param name="obj">要序列化的对象。</param> /// <returns>序列化后的 JSON 字符串。</returns> public string ToJson(object obj) { return JsonMapper.ToJson(obj); } /// <summary> /// 将 JSON 字符串反序列化为对象。 /// </summary> /// <typeparam name="T">对象类型。</typeparam> /// <param name="json">要反序列化的 JSON 字符串。</param> /// <returns>反序列化后的对象。</returns> public T ToObject<T>(string json) { return JsonMapper.ToObject<T>(json); } /// <summary> /// 将 JSON 字符串反序列化为对象。 /// </summary> /// <param name="objectType">对象类型。</param> /// <param name="json">要反序列化的 JSON 字符串。</param> /// <returns>反序列化后的对象。</returns> public object ToObject(Type objectType, string json) { // TODO: 可反射为 ToObject<T>(string json) throw new NotSupportedException("ToObject(Type objectType, string json)"); } } }
{ "content_hash": "67f18463ceea387e366bb08754acad3b", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 86, "avg_line_length": 30.076923076923077, "alnum_prop": 0.5147058823529411, "repo_name": "PokemonUnity/PokemonUnity", "id": "3b94da5fdf61df5415a019194e360bc69eabb79f", "size": "1789", "binary": false, "copies": "1", "ref": "refs/heads/alpha", "path": "Pokemon Unity/Assets/GameMain/Scripts/Utility/LitJsonHelper.cs", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C#", "bytes": "7587885" }, { "name": "ShaderLab", "bytes": "8545" } ], "symlink_target": "" }
from __future__ import absolute_import, print_function import sys import setuptools import pip.req from setuptools.command.test import test as TestCommand import stackquery install_reqs = pip.req.parse_requirements('requirements.txt') class Tox(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [] self.test_suite = True def run_tests(self): # import must be here, because outside the eggs aren't loaded import tox errcode = tox.cmdline(self.test_args) sys.exit(errcode) setuptools.setup( name='stackquery', version=stackquery.__version__, author='Arx Cruz', author_email='[email protected]', url='https://github.com/arxcruz/stackquery', packages=['stackquery'], license='Apache License, Version 2.0', scripts=['bin/stackquery'], description='Get Launchpad statistics and create various CSV or HTML' ' tables from them.', # long_description=long_description, include_package_data=True, platforms='any', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience :: End Users/Desktop', 'License :: OSI Approved :: Apache Software License', 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2' 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Utilities', ], install_requires=[str(x.req) for x in install_reqs], tests_require=['tox>=1.6'], # tox will take care of the other reqs cmdclass={'test': Tox}, )
{ "content_hash": "df6a0a38189c147b72aa269796732e02", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 73, "avg_line_length": 32.67272727272727, "alnum_prop": 0.6377295492487479, "repo_name": "arxcruz/stackquery-cmd", "id": "d526ba7d1b7f05d53846c30843d5e8c7e032080d", "size": "2408", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "setup.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "36924" } ], "symlink_target": "" }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var testing_1 = require("@angular/core/testing"); var auth_guard_1 = require("./auth.guard"); describe('AuthGuard', function () { beforeEach(function () { testing_1.TestBed.configureTestingModule({ providers: [auth_guard_1.AuthGuard] }); }); it('should ...', testing_1.inject([auth_guard_1.AuthGuard], function (guard) { expect(guard).toBeTruthy(); })); });
{ "content_hash": "bc1dbe1ad22680a4c61aed2034848067", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 82, "avg_line_length": 34.785714285714285, "alnum_prop": 0.6180698151950719, "repo_name": "Jrocam/UnidosEnSalud", "id": "a2688b25cd9f447f103776a9fac629565497f3a8", "size": "487", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/app/guards/auth.guard.spec.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "9765" }, { "name": "HTML", "bytes": "97509" }, { "name": "JavaScript", "bytes": "112083" }, { "name": "Shell", "bytes": "768" }, { "name": "TypeScript", "bytes": "112635" } ], "symlink_target": "" }
package org.jetbrains.plugins.scala.lang.psi.stubs.impl import com.intellij.psi.stubs._ import com.intellij.psi.{PsiElement, PsiNamedElement} abstract class ScNamedStubBase[E <: PsiNamedElement] protected[impl](parent: StubElement[_ <: PsiElement], elementType: IStubElementType[_ <: StubElement[_ <: PsiElement], _ <: PsiElement], name: String) extends StubBase[E](parent, elementType) with NamedStub[E] { override final def getName: String = name }
{ "content_hash": "0b863ca7740982b60e065b98afb98bae", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 151, "avg_line_length": 49.666666666666664, "alnum_prop": 0.5855704697986577, "repo_name": "JetBrains/intellij-scala", "id": "842e1e9ba4c711670ddb750a2c7756319b1b8470", "size": "596", "binary": false, "copies": "1", "ref": "refs/heads/idea223.x", "path": "scala/scala-impl/src/org/jetbrains/plugins/scala/lang/psi/stubs/impl/ScNamedStubBase.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "106688" }, { "name": "Java", "bytes": "1165562" }, { "name": "Lex", "bytes": "45405" }, { "name": "Scala", "bytes": "18656869" } ], "symlink_target": "" }
// auto-generated header by CodeFromTemplate - Connected Vision - https://github.com/ConnectedVision // CodeFromTemplate Version: 0.3 alpha // stubs/Stub_Skeleton_params.cpp // NEVER TOUCH this file! #include <utility> #include <rapidjson/document.h> #include <rapidjson/prettywriter.h> #include <rapidjson/stringbuffer.h> #include <rapidjson/error/en.h> #include <boost/make_shared.hpp> #include "Stub_Skeleton_params.h" #include "../Class_Skeleton_params.h" // --> Do NOT EDIT <-- namespace ConnectedVision { namespace test { // --> Do NOT EDIT <-- /* copy constructors */ Stub_Skeleton_params::Stub_Skeleton_params(const Stub_Skeleton_params& other) { // TODO: other.readLock // dummy dummy = other.dummy; // dummy_dynamic_parameter dummy_dynamic_parameter = other.dummy_dynamic_parameter; // configID configID = other.configID; // timestamp timestamp = other.timestamp; } // --> Do NOT EDIT <-- /* copy assignment operator */ Stub_Skeleton_params& Stub_Skeleton_params::operator =(const Stub_Skeleton_params& other) { Stub_Skeleton_params tmp(other); // re-use copy-constructor *this = std::move(tmp); // re-use move-assignment return *this; } // --> Do NOT EDIT <-- /* mopy assignment operator */ Stub_Skeleton_params& Stub_Skeleton_params::operator =(Stub_Skeleton_params&& other) noexcept { // dummy std::swap(dummy, other.dummy); // dummy_dynamic_parameter std::swap(dummy_dynamic_parameter, other.dummy_dynamic_parameter); // configID std::swap(configID, other.configID); // timestamp std::swap(timestamp, other.timestamp); return *this; } // --> Do NOT EDIT <-- /* default constructors */ Stub_Skeleton_params::Stub_Skeleton_params() { clear(); } // --> Do NOT EDIT <-- Stub_Skeleton_params::Stub_Skeleton_params(const rapidjson::Value& value) { clear(); parseJson( value ); } // --> Do NOT EDIT <-- Stub_Skeleton_params::Stub_Skeleton_params(const std::string& str) { clear(); parseJson( str ); } // --> Do NOT EDIT <-- Stub_Skeleton_params::~Stub_Skeleton_params() { } // --> Do NOT EDIT <-- void Stub_Skeleton_params::clear() { this->dummy = static_cast<int64_t>(0); this->dummy_dynamic_parameter = static_cast<int64_t>(0); this->configID = ""; this->timestamp = 0; } // --> Do NOT EDIT <-- void Stub_Skeleton_params::parseJson(const char *str) { // ignore empty data if ( str[0] == 0 ) return; // parse data rapidjson::Document document; if (document.Parse<0>(str).HasParseError()) { std::string context; size_t off = document.GetErrorOffset(); size_t i, line_start = 0, context_start = 0; int num_line = 1; for ( i = 0; (i < off) && str[i]; i++ ) { if ( str[i] == '\n' ) { line_start = i+1; context_start = i+1; num_line++; } if ( str[i] == '{' || str[i] == '[' ) { context_start = i; } } for ( i = context_start; str[i]; i++ ) { if ( str[i] == '\n' || str[i] == '\r' ) break; context += str[i]; if ( str[i] == '}' || str[i] == ']' ) break; } throw ConnectedVision::runtime_error( std::string("parse error of JSON Object: ") + rapidjson::GetParseError_En(document.GetParseError()) + std::string(" at line ") + ConnectedVision::intToStr( num_line ) + ": " + context); } parseJson(document); } // --> Do NOT EDIT <-- void Stub_Skeleton_params::parseJson(const rapidjson::Value& value) { clear(); if ( !value.IsObject() ) throw ConnectedVision::runtime_error( "no JSON Object"); // dummy if ((value.HasMember("dummy")) && value["dummy"].IsInt64()) { set_dummy( value["dummy"].GetInt64() ); } else throw ConnectedVision::runtime_error( "required member is missing: 'dummy'"); // dummy_dynamic_parameter if ((value.HasMember("dummy_dynamic_parameter")) && value["dummy_dynamic_parameter"].IsInt64()) { set_dummy_dynamic_parameter( value["dummy_dynamic_parameter"].GetInt64() ); } else throw ConnectedVision::runtime_error( "required member is missing: 'dummy_dynamic_parameter'"); } // --> Do NOT EDIT <-- std::string Stub_Skeleton_params::toJsonStr() const { rapidjson::StringBuffer s; rapidjson::Document doc; doc.SetObject(); this->toJson(doc, doc.GetAllocator()); rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(s); doc.Accept(writer); return std::string(s.GetString()); } // --> Do NOT EDIT <-- std::string Stub_Skeleton_params::toJson() const { rapidjson::StringBuffer s; rapidjson::Document doc; doc.SetObject(); this->toJson(doc, doc.GetAllocator()); rapidjson::Writer<rapidjson::StringBuffer> writer(s); doc.Accept(writer); return std::string(s.GetString()); } // --> Do NOT EDIT <-- rapidjson::Value& Stub_Skeleton_params::toJson(rapidjson::Value& node, rapidjson::Value::AllocatorType& allocator) const { { // dummy node.AddMember("dummy", rapidjson::Value().SetInt64( get_dummy() ), allocator); } { // dummy_dynamic_parameter node.AddMember("dummy_dynamic_parameter", rapidjson::Value().SetInt64( get_dummy_dynamic_parameter() ), allocator); } return node; } // --> Do NOT EDIT <-- int64_t Stub_Skeleton_params::get_dummy() const { return( this->dummy ); } // --> Do NOT EDIT <-- const int64_t Stub_Skeleton_params::getconst_dummy() const { return( this->dummy ); } // --> Do NOT EDIT <-- void Stub_Skeleton_params::set_dummy(int64_t value) { this->dummy = value; } // --> Do NOT EDIT <-- int64_t Stub_Skeleton_params::get_dummy_dynamic_parameter() const { return( this->dummy_dynamic_parameter ); } // --> Do NOT EDIT <-- const int64_t Stub_Skeleton_params::getconst_dummy_dynamic_parameter() const { return( this->dummy_dynamic_parameter ); } // --> Do NOT EDIT <-- void Stub_Skeleton_params::set_dummy_dynamic_parameter(int64_t value) { this->dummy_dynamic_parameter = value; } // --> Do NOT EDIT <-- ConnectedVision::id_t Stub_Skeleton_params::get_configID() const { return( this->configID ); } // --> Do NOT EDIT <-- const ConnectedVision::id_t Stub_Skeleton_params::getconst_configID() const { return( this->configID ); } // --> Do NOT EDIT <-- void Stub_Skeleton_params::set_configID(ConnectedVision::id_t value) { this->configID = value; } // --> Do NOT EDIT <-- ConnectedVision::timestamp_t Stub_Skeleton_params::get_timestamp() const { return( this->timestamp ); } // --> Do NOT EDIT <-- const ConnectedVision::timestamp_t Stub_Skeleton_params::getconst_timestamp() const { return( this->timestamp ); } // --> Do NOT EDIT <-- void Stub_Skeleton_params::set_timestamp(ConnectedVision::timestamp_t value) { this->timestamp = value; } } // namespace test } // namespace ConnectedVision
{ "content_hash": "02a619c1605c9edd994aae115b57a349", "timestamp": "", "source": "github", "line_count": 266, "max_line_length": 225, "avg_line_length": 24.484962406015036, "alnum_prop": 0.6698909872562567, "repo_name": "ConnectedVision/connectedvision", "id": "4a0add1dda0726c6c035d374e76676dbfa76264e", "size": "6513", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tools/CodeFromTemplate/test/src/stubs/Stub_Skeleton_params.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "204" }, { "name": "C", "bytes": "5011" }, { "name": "C++", "bytes": "2959393" }, { "name": "CMake", "bytes": "103938" }, { "name": "CSS", "bytes": "23468" }, { "name": "HTML", "bytes": "99317" }, { "name": "JavaScript", "bytes": "654032" }, { "name": "Python", "bytes": "134332" }, { "name": "Shell", "bytes": "342" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ProjectModuleManager"> <modules> <module fileurl="file://$PROJECT_DIR$/Telaconduco_Client/Telaconduco_Client.iml" filepath="$PROJECT_DIR$/Telaconduco_Client/Telaconduco_Client.iml" /> <module fileurl="file://$PROJECT_DIR$/Telaconduco_Installer_mac/Telaconduco_Installer_Mac.iml" filepath="$PROJECT_DIR$/Telaconduco_Installer_mac/Telaconduco_Installer_Mac.iml" /> <module fileurl="file://$PROJECT_DIR$/Telaconduco_Installer_Windows/Telaconduco_Installer_Windows.iml" filepath="$PROJECT_DIR$/Telaconduco_Installer_Windows/Telaconduco_Installer_Windows.iml" /> <module fileurl="file://$PROJECT_DIR$/Telaconduco_Server.iml" filepath="$PROJECT_DIR$/Telaconduco_Server.iml" /> <module fileurl="file://$PROJECT_DIR$/Telaconduco_Updater/Telaconduco_Updater.iml" filepath="$PROJECT_DIR$/Telaconduco_Updater/Telaconduco_Updater.iml" /> </modules> </component> </project>
{ "content_hash": "91a852135768ccf093785ab1f0c71aa6", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 200, "avg_line_length": 81.66666666666667, "alnum_prop": 0.7459183673469387, "repo_name": "Telaconduco/TelaconducoCore", "id": "9c4b269ad1071ba9dc6c625de7a5c7f2966dabe0", "size": "980", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": ".idea/modules.xml", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
class ProjectFeature < ActiveRecord::Base # == Project features permissions # # Grants access level to project tools # # Tools can be enabled only for users, everyone or disabled # Access control is made only for non private projects # # levels: # # Disabled: not enabled for anyone # Private: enabled only for team members # Enabled: enabled for everyone able to access the project # Public: enabled for everyone (only allowed for pages) # # Permission levels DISABLED = 0 PRIVATE = 10 ENABLED = 20 PUBLIC = 30 FEATURES = %i(issues merge_requests wiki snippets builds repository pages).freeze PRIVATE_FEATURES_MIN_ACCESS_LEVEL = { merge_requests: Gitlab::Access::REPORTER }.freeze class << self def access_level_attribute(feature) feature = ensure_feature!(feature) "#{feature}_access_level".to_sym end def quoted_access_level_column(feature) attribute = connection.quote_column_name(access_level_attribute(feature)) table = connection.quote_table_name(table_name) "#{table}.#{attribute}" end def required_minimum_access_level(feature) feature = ensure_feature!(feature) PRIVATE_FEATURES_MIN_ACCESS_LEVEL.fetch(feature, Gitlab::Access::GUEST) end private def ensure_feature!(feature) feature = feature.model_name.plural.to_sym if feature.respond_to?(:model_name) raise ArgumentError, "invalid project feature: #{feature}" unless FEATURES.include?(feature) feature end end # Default scopes force us to unscope here since a service may need to check # permissions for a project in pending_delete # http://stackoverflow.com/questions/1540645/how-to-disable-default-scope-for-a-belongs-to belongs_to :project, -> { unscope(where: :pending_delete) } validates :project, presence: true validate :repository_children_level validate :allowed_access_levels default_value_for :builds_access_level, value: ENABLED, allows_nil: false default_value_for :issues_access_level, value: ENABLED, allows_nil: false default_value_for :merge_requests_access_level, value: ENABLED, allows_nil: false default_value_for :snippets_access_level, value: ENABLED, allows_nil: false default_value_for :wiki_access_level, value: ENABLED, allows_nil: false default_value_for :repository_access_level, value: ENABLED, allows_nil: false def feature_available?(feature, user) # This feature might not be behind a feature flag at all, so default to true return false unless ::Feature.enabled?(feature, user, default_enabled: true) get_permission(user, access_level(feature)) end def access_level(feature) public_send(ProjectFeature.access_level_attribute(feature)) # rubocop:disable GitlabSecurity/PublicSend end def builds_enabled? builds_access_level > DISABLED end def wiki_enabled? wiki_access_level > DISABLED end def merge_requests_enabled? merge_requests_access_level > DISABLED end def issues_enabled? issues_access_level > DISABLED end def pages_enabled? pages_access_level > DISABLED end def public_pages? return true unless Gitlab.config.pages.access_control pages_access_level == PUBLIC || pages_access_level == ENABLED && project.public? end private # Validates builds and merge requests access level # which cannot be higher than repository access level def repository_children_level validator = lambda do |field| level = public_send(field) || ProjectFeature::ENABLED # rubocop:disable GitlabSecurity/PublicSend not_allowed = level > repository_access_level self.errors.add(field, "cannot have higher visibility level than repository access level") if not_allowed end %i(merge_requests_access_level builds_access_level).each(&validator) end # Validates access level for other than pages cannot be PUBLIC def allowed_access_levels validator = lambda do |field| level = public_send(field) || ProjectFeature::ENABLED # rubocop:disable GitlabSecurity/PublicSend not_allowed = level > ProjectFeature::ENABLED self.errors.add(field, "cannot have public visibility level") if not_allowed end (FEATURES - %i(pages)).each {|f| validator.call("#{f}_access_level")} end def get_permission(user, level) case level when DISABLED false when PRIVATE user && (project.team.member?(user) || user.full_private_access?) when ENABLED true when PUBLIC true else true end end end
{ "content_hash": "073a9cf6e9dac5032caf6ced58343b60", "timestamp": "", "source": "github", "line_count": 149, "max_line_length": 111, "avg_line_length": 30.838926174496645, "alnum_prop": 0.7072905331882481, "repo_name": "axilleas/gitlabhq", "id": "f700090a493cfa181ac9d7fb9e7c542eaa15a06f", "size": "4626", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/models/project_feature.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "683690" }, { "name": "Clojure", "bytes": "79" }, { "name": "Dockerfile", "bytes": "1907" }, { "name": "HTML", "bytes": "1340167" }, { "name": "JavaScript", "bytes": "4309733" }, { "name": "Ruby", "bytes": "19732082" }, { "name": "Shell", "bytes": "44575" }, { "name": "Vue", "bytes": "1040466" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using StructureMap.Graph; namespace StructureMap.TypeRules { public static partial class TypeExtensions { /* public static bool IsConcreteWithDefaultCtor(this Type type) { if (type.IsConcrete()) { return type.GetConstructor(new Type[0]) != null; } return false; } internal static bool HasAttribute<T>(this MemberInfo provider) where T : Attribute { var atts = provider.GetCustomAttributes(typeof (T), true); return atts.Any(); } internal static void ForAttribute<T>(this MemberInfo provider, Action<T> action) where T : Attribute { foreach (T attribute in provider.GetCustomAttributes(typeof (T), true)) { action(attribute); } } internal static void ForAttribute<T>(this ParameterInfo provider, Action<T> action) where T : Attribute { foreach (T attribute in provider.GetCustomAttributes(typeof(T), true)) { action(attribute); } } internal static T GetAttribute<T>(this MemberInfo provider) where T : Attribute { return provider.GetCustomAttributes(typeof(T), true).OfType<T>().FirstOrDefault(); } public static T CloseAndBuildAs<T>(this Type openType, params Type[] parameterTypes) { var closedType = openType.MakeGenericType(parameterTypes); return (T) Activator.CreateInstance(closedType); } public static T CloseAndBuildAs<T>(this Type openType, object ctorArgument, params Type[] parameterTypes) { var closedType = openType.MakeGenericType(parameterTypes); return (T) Activator.CreateInstance(closedType, ctorArgument); } public static bool Closes(this Type type, Type openType) { var baseType = type.GetTypeInfo().BaseType; if (baseType == null) return false; var closes = baseType.GetTypeInfo().IsGenericType && baseType.GetTypeInfo().GetGenericTypeDefinition() == openType; return closes || baseType.Closes(openType); } public static bool IsInNamespace(this Type type, string nameSpace) { var subNameSpace = nameSpace + "."; return type.Namespace != null && (type.Namespace.Equals(nameSpace) || type.Namespace.StartsWith(subNameSpace)); } public static bool IsOpenGeneric(this Type type) { return type.GetTypeInfo().IsGenericTypeDefinition || type.GetTypeInfo().ContainsGenericParameters; } public static bool IsConcreteAndAssignableTo(this Type TPluggedType, Type pluginType) { return TPluggedType.IsConcrete() && pluginType.GetTypeInfo().IsAssignableFrom(TPluggedType.GetTypeInfo()); } public static bool ImplementsInterfaceTemplate(this Type TPluggedType, Type templateType) { if (!TPluggedType.IsConcrete()) return false; return TPluggedType.GetInterfaces(). Any(itfType => itfType.GetTypeInfo().IsGenericType && itfType.GetGenericTypeDefinition() == templateType); } public static Type FindFirstInterfaceThatCloses(this Type TPluggedType, Type templateType) { return TPluggedType.FindInterfacesThatClose(templateType).FirstOrDefault(); } public static IEnumerable<Type> FindInterfacesThatClose(this Type TPluggedType, Type templateType) { return rawFindInterfacesThatCloses(TPluggedType, templateType).Distinct(); } private static IEnumerable<Type> rawFindInterfacesThatCloses(Type TPluggedType, Type templateType) { if (!TPluggedType.IsConcrete()) yield break; if (templateType.GetTypeInfo().IsInterface) { foreach ( var interfaceType in TPluggedType.GetInterfaces() .Where(type => type.GetTypeInfo().IsGenericType && (type.GetGenericTypeDefinition() == templateType))) { yield return interfaceType; } } else if (TPluggedType.GetTypeInfo().BaseType.GetTypeInfo().IsGenericType && (TPluggedType.GetTypeInfo().BaseType.GetGenericTypeDefinition() == templateType)) { yield return TPluggedType.GetTypeInfo().BaseType; } if (TPluggedType.GetTypeInfo().BaseType == typeof(object)) yield break; foreach (var interfaceType in rawFindInterfacesThatCloses(TPluggedType.GetTypeInfo().BaseType, templateType)) { yield return interfaceType; } } public static bool IsNullable(this Type type) { return type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>); } public static Type GetInnerTypeFromNullable(this Type nullableType) { return nullableType.GetGenericArguments()[0]; } public static string GetName(this Type type) { return type.GetTypeInfo().IsGenericType ? GetGenericName(type) : type.Name; } public static string GetFullName(this Type type) { return type.GetTypeInfo().IsGenericType ? GetGenericName(type) : type.FullName; } public static string GetTypeName(this Type type) { return type.GetTypeInfo().IsGenericType ? GetGenericName(type) : type.Name; } private static string GetGenericName(Type type) { var parameters = type.GetGenericArguments().Select(t => t.GetName()); string parameterList = String.Join(", ", parameters); return "{0}<{1}>".ToFormat(type.Name.Split('`').First(), parameterList); } public static bool CanBeCreated(this Type type) { return type.IsConcrete() && type.HasConstructors(); } public static IEnumerable<Type> AllInterfaces(this Type type) { foreach (var @interface in type.GetInterfaces()) { yield return @interface; } } /// <summary> /// Determines if the PluggedType can be upcast to the pluginType /// </summary> /// <param name="pluginType"></param> /// <param name="pluggedType"></param> /// <returns></returns> public static bool CanBeCastTo(this Type pluggedType, Type pluginType) { if (pluggedType == null) return false; if (pluggedType == pluginType) return true; if (pluginType.IsOpenGeneric()) { return GenericsPluginGraph.CanBeCast(pluginType, pluggedType); } if (IsOpenGeneric(pluggedType)) { return false; } return pluginType.GetTypeInfo().IsAssignableFrom(pluggedType.GetTypeInfo()); } public static bool CanBeCastTo<T>(this Type pluggedType) { return pluggedType.CanBeCastTo(typeof (T)); } public static bool CouldCloseTo(this Type openConcretion, Type closedInterface) { var openInterface = closedInterface.GetGenericTypeDefinition(); var arguments = closedInterface.GetGenericArguments(); var concreteArguments = openConcretion.GetGenericArguments(); return arguments.Length == concreteArguments.Length && openConcretion.CanBeCastTo(openInterface); } public static bool IsString(this Type type) { return type == typeof (string); } public static bool IsPrimitive(this Type type) { return type.GetTypeInfo().IsPrimitive && !IsString(type) && type != typeof(IntPtr); } public static bool IsSimple(this Type type) { if (type == null) return false; return type.GetTypeInfo().IsPrimitive || IsString(type) || type.GetTypeInfo().IsEnum; } public static bool IsInterfaceOrAbstract(this Type type) { return type.GetTypeInfo().IsInterface || type.GetTypeInfo().IsAbstract; } public static bool IsChild(this Type type) { return IsPrimitiveArray(type) || (!type.IsArray && !IsSimple(type)); } public static bool IsChildArray(this Type type) { return type.IsArray && !IsSimple(type.GetElementType()); } public static bool IsPrimitiveArray(this Type type) { return type.IsArray && IsSimple(type.GetElementType()); } public static bool IsConcrete(this Type type) { return !type.GetTypeInfo().IsAbstract && !type.GetTypeInfo().IsInterface; } public static bool IsAutoFillable(this Type type) { return IsChild(type) || IsChildArray(type); } public static bool HasConstructors(this Type type) { return type.GetConstructors().Any(); } public static bool IsVoidReturn(this Type type) { return type == null || type == typeof (void); } */ } }
{ "content_hash": "a0bf44b43da17d196c257c7b5470c037", "timestamp": "", "source": "github", "line_count": 284, "max_line_length": 130, "avg_line_length": 33.84154929577465, "alnum_prop": 0.5939028196857767, "repo_name": "khellang/structuremap", "id": "900666cfd42e3646914cc5d8f0067570419932c1", "size": "9611", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "src/StructureMap/TypeRules/TypeExtensions.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "251" }, { "name": "C#", "bytes": "1517633" }, { "name": "Ruby", "bytes": "3247" } ], "symlink_target": "" }
class AccessLevel < ApplicationRecord end
{ "content_hash": "45104c19425133fa4c11418ce347defa", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 37, "avg_line_length": 21, "alnum_prop": 0.8571428571428571, "repo_name": "jeyavelnkl/jel_apps", "id": "1fe1f720fe3dd67782dc86a3d698a25084f11adb", "size": "42", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "VLS_V1_SDT/app/models/access_level.rb", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1360" }, { "name": "CSS", "bytes": "243399" }, { "name": "CoffeeScript", "bytes": "18561" }, { "name": "Gherkin", "bytes": "126424" }, { "name": "HTML", "bytes": "956511" }, { "name": "JavaScript", "bytes": "695824" }, { "name": "Ruby", "bytes": "2815275" }, { "name": "Shell", "bytes": "1249" } ], "symlink_target": "" }
> see https://aka.ms/autorest Configuration for generating Custom Vision Prediction SDK. The current release is `release_1_0`. ``` yaml tag: release_1_0 openapi-type: data-plane ``` # Releases ### Release 1.0 These settings apply only when `--tag=release_1_0` is specified on the command line. ``` yaml $(tag) == 'release_1_0' input-file: stable/v1.1/Prediction.json ``` # Code Generation ## Suppression ``` yaml directive: - suppress: DefinitionsPropertiesNamesCamelCase reason: Live service and portal doesn't use came case properties ``` ## Swagger to SDK This section describes what SDK should be generated by the automatic system. This is not used by Autorest itself. ``` yaml $(swagger-to-sdk) swagger-to-sdk: - repo: azure-sdk-for-python ``` ## CSharp Settings These settings apply only when `--csharp` is specified on the command line. ``` yaml $(csharp) csharp: sync-methods: None license-header: MICROSOFT_MIT_NO_VERSION azure-arm: false namespace: Microsoft.Azure.CognitiveServices.Vision.CustomVision.Prediction output-folder: $(csharp-sdks-folder)/CognitiveServices/dataPlane/Vision/CustomVision/Prediction/Generated clear-output-folder: true ``` ## Python These settings apply only when `--python` is specified on the command line. Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`. Use `--python-mode=update` if you already have a setup.py and just want to update the code itself. ``` yaml $(python) python-mode: create python: license-header: MICROSOFT_MIT_NO_VERSION payload-flattening-threshold: 2 namespace: azure.cognitiveservices.vision.customvision.prediction package-name: azure-cognitiveservices-vision-customvision clear-output-folder: true ``` ``` yaml $(python) && $(python-mode) == 'update' python: no-namespace-folders: true output-folder: $(python-sdks-folder)/azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction ``` ``` yaml $(python) && $(python-mode) == 'create' python: basic-setup-py: true output-folder: $(python-sdks-folder)/azure-cognitiveservices-vision-customvision ```
{ "content_hash": "1e6c191859dd3d6b9238e46e872f1ea2", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 137, "avg_line_length": 28.539473684210527, "alnum_prop": 0.7468879668049793, "repo_name": "felixwa/azure-rest-api-specs", "id": "9b927a5d50589dea682f95c9c3356d42848325a0", "size": "2209", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "specification/cognitiveservices/data-plane/CustomVision/Prediction/readme.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "43321" } ], "symlink_target": "" }
import angular from 'angular'; import { get } from '../'; /** * Compiles the provided template string using the provided scope. If no scope * was provided, a new one will be created. * * @example * * let scope = get('$rootScope').$new(); * scope.foo = 'bar'; * * let el = compile('<div>{{ foo }}</div>')(scope); * el.find('div').innerHTML; // 'foo' * * @param {string} options.template - Template string. * @param {object} [options.scope] - Optional scope to use. * @param {object} [options.insertAt] - jqLite element in an existing DOM * structure at which to insert the element *prior* to compilation. Useful * when working with directives that will immediately try to `require` a * parent directive upon compilation. * @return {object} - Compiled DOM element. */ export default function compile({template, scope = {}, insertAt} = {}) { if (!template || typeof template !== 'string') { throw new Error('[Unity] Compile requires a "template" option.'); } const insertEl = angular.element(insertAt); let $scope; if (typeof scope === 'object' && scope.$id) { // User provided an actual scope. Use it. $scope = scope; } else { // User provided an object, merge its properties onto the scope. $scope = insertEl.scope() || get('$rootScope').$new(); Object.assign($scope, scope); } // Insert the element into an existing DOM strucutre prior to compiling. if (insertAt) { const el = angular.element(template); insertAt.append(el); return get('$compile')(el)($scope); } return get('$compile')(template)($scope); }
{ "content_hash": "3af7179ef76bd905dfcfbc3f96d81c22", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 78, "avg_line_length": 29.685185185185187, "alnum_prop": 0.6481597005614473, "repo_name": "collectivehealth/unity", "id": "1c6b726def068e964000817501f351e749a07242", "size": "1603", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/utils/compile/compile.js", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "21550" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/debug_drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <com.jakewharton.madge.MadgeFrameLayout android:id="@+id/madge_container" android:layout_width="match_parent" android:layout_height="match_parent"> <com.jakewharton.scalpel.ScalpelFrameLayout android:id="@+id/debug_content" android:layout_width="match_parent" android:layout_height="match_parent"/> </com.jakewharton.madge.MadgeFrameLayout> <ScrollView android:id="@+id/debug_drawer" android:layout_width="290dp" android:layout_height="match_parent" android:layout_gravity="end" android:background="?android:colorBackground"/> </android.support.v4.widget.DrawerLayout>
{ "content_hash": "18532b9b57527c665f381061f13dd2f5", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 62, "avg_line_length": 38.32, "alnum_prop": 0.675365344467641, "repo_name": "pieces029/on-this-day", "id": "39df0a2ba3b67b91fb09844039499b364c817d03", "size": "958", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/debug/res/layout/debug_activity_frame.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "3196" }, { "name": "Java", "bytes": "132845" } ], "symlink_target": "" }
Collection of sample projects for [JBoss Fuse](http://www.jboss.org/products/fuse/overview/).
{ "content_hash": "4a4f71c26733c0ba5da98adb540b1d95", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 93, "avg_line_length": 94, "alnum_prop": 0.776595744680851, "repo_name": "tadayosi/samples-fuse", "id": "02104e747ab87ecfa0479f819c26df126540ccf1", "size": "242", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "261" } ], "symlink_target": "" }
package org.apereo.cas.web.flow.resolver.impl; import org.apache.commons.lang3.StringUtils; import org.apereo.cas.CentralAuthenticationService; import org.apereo.cas.authentication.Authentication; import org.apereo.cas.authentication.AuthenticationSystemSupport; import org.apereo.cas.authentication.principal.Principal; import org.apereo.cas.configuration.CasConfigurationProperties; import org.apereo.cas.services.MultifactorAuthenticationProvider; import org.apereo.cas.services.MultifactorAuthenticationProviderSelector; import org.apereo.cas.services.RegisteredService; import org.apereo.cas.services.ServicesManager; import org.apereo.cas.ticket.registry.TicketRegistrySupport; import org.apereo.cas.validation.AuthenticationRequestServiceSelectionStrategy; import org.apereo.cas.web.flow.authentication.BaseMultifactorAuthenticationProviderEventResolver; import org.apereo.cas.web.support.WebUtils; import org.apereo.inspektr.audit.annotation.Audit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.CookieGenerator; import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; /** * This is {@link RestEndpointMultifactorAuthenticationPolicyEventResolver}. * * @author Misagh Moayyed * @since 5.0.0 */ public class RestEndpointMultifactorAuthenticationPolicyEventResolver extends BaseMultifactorAuthenticationProviderEventResolver { private static final Logger LOGGER = LoggerFactory.getLogger(RestEndpointMultifactorAuthenticationPolicyEventResolver.class); private final String restEndpoint; public RestEndpointMultifactorAuthenticationPolicyEventResolver(final AuthenticationSystemSupport authenticationSystemSupport, final CentralAuthenticationService centralAuthenticationService, final ServicesManager servicesManager, final TicketRegistrySupport ticketRegistrySupport, final CookieGenerator warnCookieGenerator, final List<AuthenticationRequestServiceSelectionStrategy> authSelectionStrategies, final MultifactorAuthenticationProviderSelector selector, final CasConfigurationProperties casProperties) { super(authenticationSystemSupport, centralAuthenticationService, servicesManager, ticketRegistrySupport, warnCookieGenerator, authSelectionStrategies, selector); this.restEndpoint = casProperties.getAuthn().getMfa().getRestEndpoint(); } @Override public Set<Event> resolveInternal(final RequestContext context) { final RegisteredService service = resolveRegisteredServiceInRequestContext(context); final Authentication authentication = WebUtils.getAuthentication(context); final String restEndpoint = this.restEndpoint; if (service == null || authentication == null) { LOGGER.debug("No service or authentication is available to determine event for principal"); return null; } final Principal principal = authentication.getPrincipal(); if (StringUtils.isBlank(restEndpoint)) { LOGGER.debug("Rest endpoint to determine event is not configured for [{}]", principal.getId()); return null; } final Map<String, MultifactorAuthenticationProvider> providerMap = WebUtils.getAvailableMultifactorAuthenticationProviders(this.applicationContext); if (providerMap == null || providerMap.isEmpty()) { LOGGER.error("No multifactor authentication providers are available in the application context"); return null; } final Collection<MultifactorAuthenticationProvider> flattenedProviders = flattenProviders(providerMap.values()); LOGGER.debug("Contacting [{}] to inquire about [{}]", restEndpoint, principal.getId()); final RestTemplate restTemplate = new RestTemplate(); final ResponseEntity<String> responseEntity = restTemplate.postForEntity(restEndpoint, principal.getId(), String.class); if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) { final String results = responseEntity.getBody(); if (StringUtils.isNotBlank(results)) { LOGGER.debug("Result returned from the rest endpoint is [{}]", results); final MultifactorAuthenticationProvider restProvider = flattenedProviders.stream() .filter(p -> p.matches(results)) .findFirst() .orElse(null); if (restProvider != null) { LOGGER.debug("Found multifactor authentication provider [{}]", restProvider.getId()); return Collections.singleton(new Event(this, restProvider.getId())); } LOGGER.debug("No multifactor authentication provider could be matched against [{}]", results); return Collections.emptySet(); } } LOGGER.debug("No providers are available to match rest endpoint results"); return Collections.emptySet(); } @Audit(action = "AUTHENTICATION_EVENT", actionResolverName = "AUTHENTICATION_EVENT_ACTION_RESOLVER", resourceResolverName = "AUTHENTICATION_EVENT_RESOURCE_RESOLVER") @Override public Event resolveSingle(final RequestContext context) { return super.resolveSingle(context); } }
{ "content_hash": "0cdbc00e3cf03e2244f93763a785f067", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 158, "avg_line_length": 54.0625, "alnum_prop": 0.6984310487200661, "repo_name": "gabedwrds/cas", "id": "23ce48da2bfca2730bcbe6bbe5e54d52b42ca343", "size": "6055", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "core/cas-server-core-webflow/src/main/java/org/apereo/cas/web/flow/resolver/impl/RestEndpointMultifactorAuthenticationPolicyEventResolver.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "341009" }, { "name": "Groovy", "bytes": "4592" }, { "name": "HTML", "bytes": "205588" }, { "name": "Java", "bytes": "5420335" }, { "name": "JavaScript", "bytes": "168785" }, { "name": "Shell", "bytes": "5427" } ], "symlink_target": "" }
int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
{ "content_hash": "223ed161c43c75a6fc08ce57bbbfcbfb", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 32, "avg_line_length": 12.5, "alnum_prop": 0.56, "repo_name": "escaflone40/ardoab", "id": "36ecd3926a9a05f43260b1e82475592f4effabff", "size": "174", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "main.cpp", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "BitBake", "bytes": "502" }, { "name": "C++", "bytes": "685" }, { "name": "QMake", "bytes": "585" } ], "symlink_target": "" }
<!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"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.9.1"/> <title>Helix: Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); $(window).load(resizeHeight); </script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Helix </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.9.1 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <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="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('classHelix_1_1Logic_1_1util_1_1HitMapTest.html','');}); </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="headertitle"> <div class="title">Helix::Logic::util::HitMapTest Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html#acd1f600918e0a103a34231ca44945eec">compareLists</a>(vector&lt; HitMap * &gt; *first, vector&lt; HitMap * &gt; *second)</td><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a></td><td class="entry"><span class="mlabel">static</span></td></tr> <tr><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html#a597a0262880fcca2a79533688b245785">compareObjects</a>(HitMap *first, HitMap *second)</td><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a></td><td class="entry"><span class="mlabel">static</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html#a50ae310485ca97386e5c5543e1ceab08">dummy</a>(IOConn &amp;ioc, xmlNodePtr node)</td><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html#abb5f1ce51868b8d94f811c2fb0c392f0">HitMapTest</a>(const HitMapTest &amp;c)</td><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">private</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html#aeabefc33fbe21a954778b9fd3180ed24">HitMapTest</a>()</td><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classHelix_1_1Glob_1_1DataObjectTestClass.html#acd03cc8b30d82b883eef412e36c00205">m_recordMode</a></td><td class="entry"><a class="el" href="classHelix_1_1Glob_1_1DataObjectTestClass.html">Helix::Glob::DataObjectTestClass</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html#a740f08672dd83cca01b900dc828b4942">operator=</a>(const HitMapTest &amp;c)</td><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">private</span></td></tr> <tr><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html#a3f0d672426b8bf88b6087af3fa4a1a13">reg</a></td><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a></td><td class="entry"><span class="mlabel">private</span><span class="mlabel">static</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html#a7c88f701d06084716c2435a749572690">runTests</a>(IOConn &amp;ioc, xmlNodePtr node)</td><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classHelix_1_1Glob_1_1DataObjectTestClass.html#a658be30d275736810eebb9cff923611c">setRecordMode</a>(bool tf)</td><td class="entry"><a class="el" href="classHelix_1_1Glob_1_1DataObjectTestClass.html">Helix::Glob::DataObjectTestClass</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classHelix_1_1Glob_1_1DataObjectTestClass.html#a3c9e4f85b43d003913df06ea5924bb1d">~DataObjectTestClass</a>()</td><td class="entry"><a class="el" href="classHelix_1_1Glob_1_1DataObjectTestClass.html">Helix::Glob::DataObjectTestClass</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html#afe1ed057c3f737084bda9bbb7f72b7c8">~HitMapTest</a>()</td><td class="entry"><a class="el" href="classHelix_1_1Logic_1_1util_1_1HitMapTest.html">Helix::Logic::util::HitMapTest</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> </table></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="footer">Generated on Wed Jan 14 2015 12:23:31 for Helix by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li> </ul> </div> </body> </html>
{ "content_hash": "9d752c214c572052b75b7bdf4b23dbb7", "timestamp": "", "source": "github", "line_count": 138, "max_line_length": 414, "avg_line_length": 67.53623188405797, "alnum_prop": 0.6839055793991416, "repo_name": "smc314/helix", "id": "274537f72c3859cdffd313d71a85cca5da21f6e6", "size": "9320", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "html/devdoc/html/classHelix_1_1Logic_1_1util_1_1HitMapTest-members.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "144970" }, { "name": "C#", "bytes": "149673" }, { "name": "C++", "bytes": "1273269" }, { "name": "CSS", "bytes": "33151" }, { "name": "HTML", "bytes": "13682406" }, { "name": "Java", "bytes": "2214" }, { "name": "JavaScript", "bytes": "7725953" }, { "name": "Makefile", "bytes": "7470" }, { "name": "Python", "bytes": "19101" }, { "name": "Shell", "bytes": "71831" } ], "symlink_target": "" }
module Spree class Recurring < ActiveRecord::Base include RestrictiveDestroyer acts_as_restrictive_destroyer preference :secret_key, :string preference :public_key, :string has_many :plans attr_readonly :type validates :type, :name, presence: true validates :type, uniqueness: { message: 'of provider recurring already exists' } scope :active, -> { undeleted.where(active: true) } def self.display_name name.gsub(%r{.+:}, '') end def visible? active? && !is_destroyed? end def default_plan plans.default end def has_preferred_keys? preferred_secret_key.present? && preferred_public_key.present? end end end
{ "content_hash": "6ee43117a0f285e1cb1f792593a9d255", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 84, "avg_line_length": 21.515151515151516, "alnum_prop": 0.6549295774647887, "repo_name": "vulk/spree-account-recurring", "id": "5a954b13fb57f2979b57a158483a717096a87c89", "size": "710", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "app/models/spree/recurring.rb", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "65" }, { "name": "HTML", "bytes": "20174" }, { "name": "JavaScript", "bytes": "2013" }, { "name": "Ruby", "bytes": "57052" } ], "symlink_target": "" }
<!-- * GenesisUI - Bootstrap 4 Admin Template * @version v1.8.1 * @link https://genesisui.com * Copyright (c) 2017 creativeLabs Łukasz Holeczek * @license Commercial --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content="Real - Bootstrap 4 Admin Template"> <meta name="author" content="Łukasz Holeczek"> <meta name="keyword" content="Bootstrap,Admin,Template,Open,Source,AngularJS,Angular,Angular2,jQuery,CSS,HTML,RWD,Dashboard"> <link rel="shortcut icon" href="img/favicon.png"> <title>Real - Bootstrap 4 Admin Template</title> <!-- Icons --> <link href="css/font-awesome.min.css" rel="stylesheet"> <link href="css/simple-line-icons.css" rel="stylesheet"> <!-- Premium Icons --> <link href="css/glyphicons.css" rel="stylesheet"> <link href="css/glyphicons-filetypes.css" rel="stylesheet"> <link href="css/glyphicons-social.css" rel="stylesheet"> <!-- Main styles for this application --> <link href="css/style.css" rel="stylesheet"> </head> <!-- BODY options, add following classes to body to change options // Header options 1. '.header-fixed' - Fixed Header // Sidebar options 1. '.sidebar-fixed' - Fixed Sidebar 2. '.sidebar-hidden' - Hidden Sidebar 3. '.sidebar-off-canvas' - Off Canvas Sidebar 4. '.sidebar-compact' - Compact Sidebar Navigation (Only icons) // Aside options 1. '.aside-menu-fixed' - Fixed Aside Menu 2. '.aside-menu-hidden' - Hidden Aside Menu 3. '.aside-menu-off-canvas' - Off Canvas Aside Menu // Footer options 1. 'footer-fixed' - Fixed footer --> <body class="app header-fixed sidebar-fixed aside-menu-fixed aside-menu-hidden"> <header class="app-header navbar"> <button class="navbar-toggler mobile-sidebar-toggler hidden-lg-up" type="button">≡</button> <a class="navbar-brand" href="#"></a> <ul class="nav navbar-nav hidden-md-down b-r-1"> <li class="nav-item"> <a class="nav-link navbar-toggler sidebar-toggler" href="#">≡</a> </li> </ul> <form class="form-inline float-left px-2 hidden-md-down"> <i class="fa fa-search"></i> <input class="form-control" type="text" placeholder="Are you looking for something?"> </form> <ul class="nav navbar-nav ml-auto"> <li class="nav-item dropdown hidden-md-down pr-2"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"> <img src="img/flags/United-Kingdom.png" class="img-flag" alt="English" height="24"> </a> <div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-header text-center"> <strong>Choose language</strong> </div> <a class="dropdown-item" href="#"> <img src="img/flags/Poland.png" class="img-flag" alt="Polish" height="24">Polish</a> <a class="dropdown-item" href="#"> <img src="img/flags/United-Kingdom.png" class="img-flag" alt="English" height="24">English</a> <a class="dropdown-item" href="#"> <img src="img/flags/Spain.png" class="img-flag" alt="Español" height="24">Español</a> </div> </li> <li class="nav-item dropdown hidden-md-down"> <a class="nav-link nav-link" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"> <i class="icon-bell"></i> <span class="badge badge-pill badge-danger">5</span> </a> <div class="dropdown-menu dropdown-menu-right dropdown-menu-lg"> <div class="dropdown-header text-center"> <strong>You have 5 notifications</strong> </div> <a href="#" class="dropdown-item"> <i class="icon-user-follow text-success"></i> New user registered </a> <a href="#" class="dropdown-item"> <i class="icon-user-unfollow text-danger"></i> User deleted </a> <a href="#" class="dropdown-item"> <i class="icon-chart text-info"></i> Sales report is ready </a> <a href="#" class="dropdown-item"> <i class="icon-basket-loaded text-primary"></i> New client </a> <a href="#" class="dropdown-item"> <i class="icon-speedometer text-warning"></i> Server overloaded </a> <div class="dropdown-header text-center"> <strong>Server</strong> </div> <a href="#" class="dropdown-item"> <div class="text-uppercase mb-q"> <small><b>CPU Usage</b> </small> </div> <span class="progress progress-xs"> <div class="progress-bar bg-info" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> </span> <small class="text-muted">348 Processes. 1/4 Cores.</small> </a> <a href="#" class="dropdown-item"> <div class="text-uppercase mb-q"> <small><b>Memory Usage</b> </small> </div> <span class="progress progress-xs"> <div class="progress-bar bg-warning" role="progressbar" style="width: 70%" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100"></div> </span> <small class="text-muted">11444GB/16384MB</small> </a> <a href="#" class="dropdown-item"> <div class="text-uppercase mb-q"> <small><b>SSD 1 Usage</b> </small> </div> <span class="progress progress-xs"> <div class="progress-bar bg-danger" role="progressbar" style="width: 95%" aria-valuenow="95" aria-valuemin="0" aria-valuemax="100"></div> </span> <small class="text-muted">243GB/256GB</small> </a> </div> </li> <li class="nav-item dropdown hidden-md-down"> <a class="nav-link nav-link" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"> <i class="icon-list"></i> <span class="badge badge-pill badge-warning">15</span> </a> <div class="dropdown-menu dropdown-menu-right dropdown-menu-lg"> <div class="dropdown-header text-center"> <strong>You have 5 pending tasks</strong> </div> <a href="#" class="dropdown-item"> <div class="small mb-q">Upgrade NPM &amp; Bower <span class="float-right"> <strong>0%</strong> </span> </div> <span class="progress progress-xs"> <div class="progress-bar bg-info" role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div> </span> </a> <a href="#" class="dropdown-item"> <div class="small mb-q">ReactJS Version <span class="float-right"> <strong>25%</strong> </span> </div> <span class="progress progress-xs"> <div class="progress-bar bg-danger" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> </span> </a> <a href="#" class="dropdown-item"> <div class="small mb-q">VueJS Version <span class="float-right"> <strong>50%</strong> </span> </div> <span class="progress progress-xs"> <div class="progress-bar bg-warning" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div> </span> </a> <a href="#" class="dropdown-item"> <div class="small mb-q">Add new layouts <span class="float-right"> <strong>75%</strong> </span> </div> <span class="progress progress-xs"> <div class="progress-bar bg-info" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div> </span> </a> <a href="#" class="dropdown-item"> <div class="small mb-q">Angular 2 Cli Version <span class="float-right"> <strong>100%</strong> </span> </div> <span class="progress progress-xs"> <div class="progress-bar bg-success" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div> </span> </a> <a href="#" class="dropdown-item text-center"> <strong>View all tasks</strong> </a> </div> </li> <li class="nav-item dropdown hidden-md-down"> <a class="nav-link nav-link" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"> <i class="icon-envelope-letter"></i> <span class="badge badge-pill badge-info">7</span> </a> <div class="dropdown-menu dropdown-menu-right dropdown-menu-lg"> <div class="dropdown-header text-center"> <strong>You have 4 messages</strong> </div> <a href="#" class="dropdown-item"> <div class="message"> <div class="py-1 mr-1 float-left"> <div class="avatar"> <img src="img/avatars/7.jpg" class="img-avatar" alt="[email protected]"> <span class="avatar-status badge-success"></span> </div> </div> <div> <small class="text-muted">John Doe</small> <small class="text-muted float-right mt-q">Just now</small> </div> <div class="text-truncate font-weight-bold"> <span class="fa fa-exclamation text-danger"></span>Important message</div> <div class="small text-muted text-truncate">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...</div> </div> </a> <a href="#" class="dropdown-item"> <div class="message"> <div class="py-1 mr-1 float-left"> <div class="avatar"> <img src="img/avatars/6.jpg" class="img-avatar" alt="[email protected]"> <span class="avatar-status badge-warning"></span> </div> </div> <div> <small class="text-muted">John Doe</small> <small class="text-muted float-right mt-q">5 minutes ago</small> </div> <div class="text-truncate font-weight-bold">Lorem ipsum dolor sit amet</div> <div class="small text-muted text-truncate">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...</div> </div> </a> <a href="#" class="dropdown-item"> <div class="message"> <div class="py-1 mr-1 float-left"> <div class="avatar"> <img src="img/avatars/5.jpg" class="img-avatar" alt="[email protected]"> <span class="avatar-status badge-danger"></span> </div> </div> <div> <small class="text-muted">John Doe</small> <small class="text-muted float-right mt-q">1:52 PM</small> </div> <div class="text-truncate font-weight-bold">Lorem ipsum dolor sit amet</div> <div class="small text-muted text-truncate">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...</div> </div> </a> <a href="#" class="dropdown-item"> <div class="message"> <div class="py-1 mr-1 float-left"> <div class="avatar"> <img src="img/avatars/4.jpg" class="img-avatar" alt="[email protected]"> <span class="avatar-status badge-info"></span> </div> </div> <div> <small class="text-muted">John Doe</small> <small class="text-muted float-right mt-q">4:03 PM</small> </div> <div class="text-truncate font-weight-bold">Lorem ipsum dolor sit amet</div> <div class="small text-muted text-truncate">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...</div> </div> </a> <a href="#" class="dropdown-item text-center"> <strong>View all messages</strong> </a> </div> </li> <li class="nav-item hidden-md-down"> <a class="nav-link" href="#"><i class="icon-location-pin"></i></a> </li> <li class="nav-item dropdown"> <a class="nav-link nav-pill" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"> <i class="icon-settings"></i> <span class="badge badge-pill badge-danger">9</span> </a> <div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-header text-center"> <strong>Account</strong> </div> <a class="dropdown-item" href="#"><i class="fa fa-bell-o"></i> Updates<span class="badge badge-info">42</span></a> <a class="dropdown-item" href="#"><i class="fa fa-envelope-o"></i> Messages<span class="badge badge-success">42</span></a> <a class="dropdown-item" href="#"><i class="fa fa-tasks"></i> Tasks<span class="badge badge-danger">42</span></a> <a class="dropdown-item" href="#"><i class="fa fa-comments"></i> Comments<span class="badge badge-warning">42</span></a> <div class="dropdown-header text-center"> <strong>Settings</strong> </div> <a class="dropdown-item" href="#"><i class="fa fa-user"></i> Profile</a> <a class="dropdown-item" href="#"><i class="fa fa-wrench"></i> Settings</a> <a class="dropdown-item" href="#"><i class="fa fa-usd"></i> Payments<span class="badge badge-default">42</span></a> <a class="dropdown-item" href="#"><i class="fa fa-file"></i> Projects<span class="badge badge-primary">42</span></a> <div class="divider"></div> <a class="dropdown-item" href="#"><i class="fa fa-shield"></i> Lock Account</a> <a class="dropdown-item" href="#"><i class="fa fa-lock"></i> Logout</a> </div> </li> <li class="nav-item hidden-md-down"> <a class="nav-link navbar-toggler aside-menu-toggler" href="#">≡</a> </li> </ul> </header> <div class="app-body"> <div class="sidebar"> <div class="sidebar-header"> <img src="img/avatars/8.jpg" class="img-avatar" alt="Avatar"> <div> <strong>JOHN DOE</strong> </div> <div class="text-muted"> <small>Founder &amp; CEO</small> </div> <div class="btn-group" role="group" aria-label="Button group with nested dropdown"> <button type="button" class="btn btn-link"> <i class="icon-settings"></i> </button> <button type="button" class="btn btn-link"> <i class="icon-speech"></i> <span class="badge badge-warning badge-pill">5</span> </button> <button type="button" class="btn btn-link"> <i class="icon-user"></i> </button> </div> </div> <nav class="sidebar-nav"> <ul class="nav"> <li class="nav-item"> <a class="nav-link" href="index.html"><i class="icon-speedometer"></i> Dashboard <span class="badge badge-info">NEW</span></a> </li> <li class="divider"></li> <li class="nav-title"> UI Elements </li> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"><i class="icon-puzzle"></i> Components</a> <ul class="nav-dropdown-items"> <li class="nav-item"> <a class="nav-link" href="components-buttons.html"><i class="icon-puzzle"></i> Buttons</a> </li> <li class="nav-item"> <a class="nav-link" href="components-social-buttons.html"><i class="icon-puzzle"></i> Social Buttons</a> </li> <li class="nav-item"> <a class="nav-link" href="components-cards.html"><i class="icon-puzzle"></i> Cards</a> </li> <li class="nav-item"> <a class="nav-link" href="components-modals.html"><i class="icon-puzzle"></i> Modals</a> </li> <li class="nav-item"> <a class="nav-link" href="components-switches.html"><i class="icon-puzzle"></i> Switches</a> </li> <li class="nav-item"> <a class="nav-link" href="components-tables.html"><i class="icon-puzzle"></i> Tables</a> </li> <li class="nav-item"> <a class="nav-link" href="components-tabs.html"><i class="icon-puzzle"></i> Tabs</a> </li> </ul> </li> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"><i class="icon-note"></i> Forms</a> <ul class="nav-dropdown-items"> <li class="nav-item"> <a class="nav-link" href="forms-basic-forms.html"><i class="icon-note"></i> Basic Forms</a> </li> <li class="nav-item"> <a class="nav-link" href="forms-advanced-forms.html"><i class="icon-note"></i> Advanced Forms</a> </li> <li class="nav-item"> <a class="nav-link" href="forms-validation.html"><i class="icon-note"></i> Validation</a> </li> </ul> </li> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"><i class="icon-star"></i> Icons</a> <ul class="nav-dropdown-items"> <li class="nav-item"> <a class="nav-link" href="icons-font-awesome.html"><i class="icon-star"></i> Font Awesome</a> </li> <li class="nav-item"> <a class="nav-link" href="icons-simple-line-icons.html"><i class="icon-star"></i> Simple Line Icons</a> </li> <li class="nav-item"> <a class="nav-link" href="icons-glyphicons.html"><i class="icon-star"></i> Glyphicons</a> </li> <li class="nav-item"> <a class="nav-link" href="icons-glyphicons-filetypes.html"><i class="icon-star"></i> Filetypes</a> </li> <li class="nav-item"> <a class="nav-link" href="icons-glyphicons-social.html"><i class="icon-star"></i> Glyphicons Social</a> </li> </ul> </li> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"><i class="icon-energy"></i> Plugins</a> <ul class="nav-dropdown-items"> <li class="nav-item"> <a class="nav-link" href="plugins-calendar.html"><i class="icon-calendar"></i> Calendar</a> </li> <li class="nav-item"> <a class="nav-link" href="plugins-draggable-cards.html"><i class="icon-cursor-move"></i> Draggable Cards</a> </li> <li class="nav-item"> <a class="nav-link" href="plugins-loading-buttons.html"><i class="icon-cursor"></i> Loading Buttons</a> </li> <li class="nav-item"> <a class="nav-link" href="plugins-notifications.html"><i class="icon-info"></i> Notifications</a> </li> <li class="nav-item"> <a class="nav-link" href="plugins-sliders.html"><i class="icon-equalizer"></i> Sliders</a> </li> <li class="nav-item"> <a class="nav-link" href="plugins-spinners.html"><i class="fa fa-spinner"></i> Spinners</a> </li> <li class="nav-item"> <a class="nav-link" href="plugins-tables.html"><i class="icon-list"></i> Tables</a> </li> </ul> </li> <li class="nav-item"> <a class="nav-link" href="widgets.html"><i class="icon-calculator"></i> Widgets <span class="badge badge-info">NEW</span></a> </li> <li class="nav-item"> <a class="nav-link" href="charts.html"><i class="icon-pie-chart"></i> Charts</a> </li> <li class="divider"></li> <li class="nav-title"> Extras </li> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"><i class="icon-star"></i> Pages</a> <ul class="nav-dropdown-items"> <li class="nav-item"> <a class="nav-link" href="pages-login.html" target="_top"><i class="icon-star"></i> Login</a> </li> <li class="nav-item"> <a class="nav-link" href="pages-register.html" target="_top"><i class="icon-star"></i> Register</a> </li> <li class="nav-item"> <a class="nav-link" href="pages-404.html" target="_top"><i class="icon-star"></i> Error 404</a> </li> <li class="nav-item"> <a class="nav-link" href="pages-500.html" target="_top"><i class="icon-star"></i> Error 500</a> </li> </ul> </li> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"><i class="icon-layers"></i> UI Kits</a> <ul class="nav-dropdown-items"> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"><i class="icon-speech"></i> Invoicing</a> <ul class="nav-dropdown-items"> <li class="nav-item"> <a class="nav-link" href="UIkits-invoicing-invoice.html"><i class="icon-speech"></i> Invoice</a> </li> </ul> </li> </ul> <ul class="nav-dropdown-items"> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"><i class="icon-speech"></i> Email</a> <ul class="nav-dropdown-items"> <li class="nav-item"> <a class="nav-link" href="UIkits-email-inbox.html"><i class="icon-speech"></i> Inbox</a> </li> <li class="nav-item"> <a class="nav-link" href="UIkits-email-message.html"><i class="icon-speech"></i> Message</a> </li> <li class="nav-item"> <a class="nav-link" href="UIkits-email-compose.html"><i class="icon-speech"></i> Compose</a> </li> </ul> </li> </ul> </li> <li class="divider m-h"></li> <li class="nav-title"> System Utilization </li> <li class="nav-item px-1 hidden-cn"> <div class="text-uppercase mb-q"> <small><b>CPU Usage</b> </small> </div> <div class="progress progress-xs"> <div class="progress-bar bg-info" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> </div> <small class="text-muted">348 Processes. 1/4 Cores.</small> </li> <li class="nav-item px-1 hidden-cn"> <div class="text-uppercase mb-q"> <small><b>Memory Usage</b> </small> </div> <div class="progress progress-xs"> <div class="progress-bar bg-warning" role="progressbar" style="width: 70%" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100"></div> </div> <small class="text-muted">11444GB/16384MB</small> </li> <li class="nav-item px-1 hidden-cn"> <div class="text-uppercase mb-q"> <small><b>SSD 1 Usage</b> </small> </div> <div class="progress progress-xs"> <div class="progress-bar bg-danger" role="progressbar" style="width: 95%" aria-valuenow="95" aria-valuemin="0" aria-valuemax="100"></div> </div> <small class="text-muted">243GB/256GB</small> </li> </ul> </nav> </div> <!-- Main content --> <main class="main"> <!-- Breadcrumb --> <ol class="breadcrumb mb-0"> <li class="breadcrumb-item">Home</li> <li class="breadcrumb-item"><a href="#">Admin</a> </li> <li class="breadcrumb-item active">Dashboard</li> </ol> <div class="container-fluid"> <div class="animated fadeIn"> <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-header"> <i class="fa fa-align-justify"></i> Bootstrap Modals </div> <div class="card-block"> <!-- Button trigger modal --> <button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#myModal"> Launch demo modal </button> <button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#largeModal"> Launch large modal </button> <button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#smallModal"> Launch small modal </button> <hr> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#primaryModal"> Primary modal </button> <button type="button" class="btn btn-success" data-toggle="modal" data-target="#successModal"> Success modal </button> <button type="button" class="btn btn-warning" data-toggle="modal" data-target="#warningModal"> Warning modal </button> <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#dangerModal"> Danger modal </button> <button type="button" class="btn btn-info" data-toggle="modal" data-target="#infoModal"> Info modal </button> </div> </div> </div> <!--/.col--> </div> <!--/.row--> </div> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Modal title</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <div class="modal fade" id="largeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Modal title</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <div class="modal fade" id="smallModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-sm" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Modal title</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <div class="modal fade" id="primaryModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-primary" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Modal title</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <div class="modal fade" id="successModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-success" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Modal title</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <div class="modal fade" id="warningModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-warning" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Modal title</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <div class="modal fade" id="dangerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-danger" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Modal title</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <div class="modal fade" id="infoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-info" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Modal title</h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> </div> <!-- /.conainer-fluid --> </main> <aside class="aside-menu"> <ul class="nav nav-tabs" role="tablist"> <li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#timeline" role="tab"><i class="icon-list"></i></a> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#messages" role="tab"><i class="icon-speech"></i></a> </li> <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#settings" role="tab"><i class="icon-settings"></i></a> </li> </ul> <!-- Tab panes --> <div class="tab-content"> <div class="tab-pane active" id="timeline" role="tabpanel"> <div class="callout m-0 py-h text-muted text-center bg-faded text-uppercase"> <small><b>Today</b> </small> </div> <hr class="transparent mx-1 my-0"> <div class="callout callout-warning m-0 py-1"> <div class="avatar float-right"> <img src="img/avatars/7.jpg" class="img-avatar" alt="[email protected]"> </div> <div>Meeting with <strong>Lucas</strong> </div> <small class="text-muted mr-1"><i class="icon-calendar"></i>&nbsp; 1 - 3pm</small> <small class="text-muted"><i class="icon-location-pin"></i>&nbsp; Palo Alto, CA</small> </div> <hr class="mx-1 my-0"> <div class="callout callout-info m-0 py-1"> <div class="avatar float-right"> <img src="img/avatars/4.jpg" class="img-avatar" alt="[email protected]"> </div> <div>Skype with <strong>Megan</strong> </div> <small class="text-muted mr-1"><i class="icon-calendar"></i>&nbsp; 4 - 5pm</small> <small class="text-muted"><i class="icon-social-skype"></i>&nbsp; On-line</small> </div> <hr class="transparent mx-1 my-0"> <div class="callout m-0 py-h text-muted text-center bg-faded text-uppercase"> <small><b>Tomorrow</b> </small> </div> <hr class="transparent mx-1 my-0"> <div class="callout callout-danger m-0 py-1"> <div>New UI Project - <strong>deadline</strong> </div> <small class="text-muted mr-1"><i class="icon-calendar"></i>&nbsp; 10 - 11pm</small> <small class="text-muted"><i class="icon-home"></i>&nbsp; creativeLabs HQ</small> <div class="avatars-stack mt-h"> <div class="avatar avatar-xs"> <img src="img/avatars/2.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/3.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/4.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/5.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/6.jpg" class="img-avatar" alt="[email protected]"> </div> </div> </div> <hr class="mx-1 my-0"> <div class="callout callout-success m-0 py-1"> <div> <strong>#10 Startups.Garden</strong>Meetup</div> <small class="text-muted mr-1"><i class="icon-calendar"></i>&nbsp; 1 - 3pm</small> <small class="text-muted"><i class="icon-location-pin"></i>&nbsp; Palo Alto, CA</small> </div> <hr class="mx-1 my-0"> <div class="callout callout-primary m-0 py-1"> <div> <strong>Team meeting</strong> </div> <small class="text-muted mr-1"><i class="icon-calendar"></i>&nbsp; 4 - 6pm</small> <small class="text-muted"><i class="icon-home"></i>&nbsp; creativeLabs HQ</small> <div class="avatars-stack mt-h"> <div class="avatar avatar-xs"> <img src="img/avatars/2.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/3.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/4.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/5.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/6.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/7.jpg" class="img-avatar" alt="[email protected]"> </div> <div class="avatar avatar-xs"> <img src="img/avatars/8.jpg" class="img-avatar" alt="[email protected]"> </div> </div> </div> <hr class="mx-1 my-0"> </div> <div class="tab-pane p-1" id="messages" role="tabpanel"> <div class="message"> <div class="py-1 pb-3 mr-1 float-left"> <div class="avatar"> <img src="img/avatars/7.jpg" class="img-avatar" alt="[email protected]"> <span class="avatar-status badge-success"></span> </div> </div> <div> <small class="text-muted">Lukasz Holeczek</small> <small class="text-muted float-right mt-q">1:52 PM</small> </div> <div class="text-truncate font-weight-bold">Lorem ipsum dolor sit amet</div> <small class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...</small> </div> <hr> <div class="message"> <div class="py-1 pb-3 mr-1 float-left"> <div class="avatar"> <img src="img/avatars/7.jpg" class="img-avatar" alt="[email protected]"> <span class="avatar-status badge-success"></span> </div> </div> <div> <small class="text-muted">Lukasz Holeczek</small> <small class="text-muted float-right mt-q">1:52 PM</small> </div> <div class="text-truncate font-weight-bold">Lorem ipsum dolor sit amet</div> <small class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...</small> </div> <hr> <div class="message"> <div class="py-1 pb-3 mr-1 float-left"> <div class="avatar"> <img src="img/avatars/7.jpg" class="img-avatar" alt="[email protected]"> <span class="avatar-status badge-success"></span> </div> </div> <div> <small class="text-muted">Lukasz Holeczek</small> <small class="text-muted float-right mt-q">1:52 PM</small> </div> <div class="text-truncate font-weight-bold">Lorem ipsum dolor sit amet</div> <small class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...</small> </div> <hr> <div class="message"> <div class="py-1 pb-3 mr-1 float-left"> <div class="avatar"> <img src="img/avatars/7.jpg" class="img-avatar" alt="[email protected]"> <span class="avatar-status badge-success"></span> </div> </div> <div> <small class="text-muted">Lukasz Holeczek</small> <small class="text-muted float-right mt-q">1:52 PM</small> </div> <div class="text-truncate font-weight-bold">Lorem ipsum dolor sit amet</div> <small class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...</small> </div> <hr> <div class="message"> <div class="py-1 pb-3 mr-1 float-left"> <div class="avatar"> <img src="img/avatars/7.jpg" class="img-avatar" alt="[email protected]"> <span class="avatar-status badge-success"></span> </div> </div> <div> <small class="text-muted">Lukasz Holeczek</small> <small class="text-muted float-right mt-q">1:52 PM</small> </div> <div class="text-truncate font-weight-bold">Lorem ipsum dolor sit amet</div> <small class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt...</small> </div> </div> <div class="tab-pane p-1" id="settings" role="tabpanel"> <h6>Settings</h6> <div class="aside-options"> <div class="clearfix mt-2"> <small><b>Option 1</b> </small> <label class="switch switch-text switch-pill switch-success switch-sm float-right"> <input type="checkbox" class="switch-input" checked=""> <span class="switch-label" data-on="On" data-off="Off"></span> <span class="switch-handle"></span> </label> </div> <div> <small class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</small> </div> </div> <div class="aside-options"> <div class="clearfix mt-1"> <small><b>Option 2</b> </small> <label class="switch switch-text switch-pill switch-success switch-sm float-right"> <input type="checkbox" class="switch-input"> <span class="switch-label" data-on="On" data-off="Off"></span> <span class="switch-handle"></span> </label> </div> <div> <small class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</small> </div> </div> <div class="aside-options"> <div class="clearfix mt-1"> <small><b>Option 3</b> </small> <label class="switch switch-text switch-pill switch-success switch-sm float-right"> <input type="checkbox" class="switch-input"> <span class="switch-label" data-on="On" data-off="Off"></span> <span class="switch-handle"></span> </label> </div> </div> <div class="aside-options"> <div class="clearfix mt-1"> <small><b>Option 4</b> </small> <label class="switch switch-text switch-pill switch-success switch-sm float-right"> <input type="checkbox" class="switch-input" checked=""> <span class="switch-label" data-on="On" data-off="Off"></span> <span class="switch-handle"></span> </label> </div> </div> <hr> <h6>System Utilization</h6> <div class="text-uppercase mb-q mt-2"> <small><b>CPU Usage</b> </small> </div> <div class="progress progress-xs"> <div class="progress-bar bg-info" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div> </div> <small class="text-muted">348 Processes. 1/4 Cores.</small> <div class="text-uppercase mb-q mt-h"> <small><b>Memory Usage</b> </small> </div> <div class="progress progress-xs"> <div class="progress-bar bg-warning" role="progressbar" style="width: 70%" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100"></div> </div> <small class="text-muted">11444GB/16384MB</small> <div class="text-uppercase mb-q mt-h"> <small><b>SSD 1 Usage</b> </small> </div> <div class="progress progress-xs"> <div class="progress-bar bg-danger" role="progressbar" style="width: 95%" aria-valuenow="95" aria-valuemin="0" aria-valuemax="100"></div> </div> <small class="text-muted">243GB/256GB</small> <div class="text-uppercase mb-q mt-h"> <small><b>SSD 2 Usage</b> </small> </div> <div class="progress progress-xs"> <div class="progress-bar bg-success" role="progressbar" style="width: 10%" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div> </div> <small class="text-muted">25GB/256GB</small> </div> </div> </aside> </div> <footer class="app-footer"> <a href="https://genesisui.com">Real</a> © 2017 creativeLabs. <span class="float-right"> Powered by <a href="https://genesisui.com">GenesisUI</a> </span> </footer> <!-- Bootstrap and necessary plugins --> <script src="js/libs/jquery.min.js"></script> <script src="js/libs/tether.min.js"></script> <script src="js/libs/bootstrap.min.js"></script> <script src="js/libs/pace.min.js"></script> <!-- Plugins and scripts required by all views --> <script src="js/libs/Chart.min.js"></script> <!-- GenesisUI main scripts --> <script src="js/app.js"></script> </body> </html>
{ "content_hash": "cab0a8f81abb3c3b567f58ef6e6258fd", "timestamp": "", "source": "github", "line_count": 1124, "max_line_length": 186, "avg_line_length": 55.01779359430605, "alnum_prop": 0.4161869340232859, "repo_name": "wydsodifficult/wydsodifficult.github.io", "id": "3782b2b2027a7354c8b50178b7b7464f5b5ed2c3", "size": "61875", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "components-modals.html", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "553866" }, { "name": "HTML", "bytes": "3450673" }, { "name": "JavaScript", "bytes": "1903490" } ], "symlink_target": "" }
#import <objc/runtime.h> #import "TiModule.h" #import "TiProxy.h" #import "TiUtils.h" #import "TiHost.h" #import "KrollBridge.h" @implementation TiModule -(void)unregisterForNotifications { [[NSNotificationCenter defaultCenter] removeObserver:self]; } -(void)dealloc { // Have to jump through a hoop here to keep the dealloc block from // retaining 'self' by creating a __block access ref. Note that // this is only safe as long as the block until completion is YES. __block id bself = self; TiThreadPerformOnMainThread(^{ [bself unregisterForNotifications]; }, YES); RELEASE_TO_NIL(host); if (classNameLookup != NULL) { CFRelease(classNameLookup); } RELEASE_TO_NIL(moduleName); RELEASE_TO_NIL(moduleAssets); [super dealloc]; } -(void)contextShutdown:(id)sender { id<TiEvaluator> context = (id<TiEvaluator>)sender; [self contextWasShutdown:context]; if(pageContext == context){ pageContext = nil; pageKrollObject = nil; } //DO NOT run super shutdown here, as we want to change the behavior that TiProxy does. } -(void)setPageContext:(id<TiEvaluator>)evaluator { pageContext = evaluator; // don't retain pageKrollObject = nil; } -(void)setHost:(TiHost*)host_ { RELEASE_TO_NIL(host); host = [host_ retain]; } -(TiHost*)_host { return host; } -(void)shutdown:(id)sender { } -(void)suspend:(id)sender { } -(void)resume:(id)sender { } // Different from resume - there's some information we can only update AFTER the app has popped to the foreground. -(void)resumed:(id)sender { } -(void)registerForNotifications { WARN_IF_BACKGROUND_THREAD_OBJ; //NSNotificationCenter is not threadsafe! [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(shutdown:) name:kTiShutdownNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(suspend:) name:kTiSuspendNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resume:) name:kTiResumeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resumed:) name:kTiResumedNotification object:nil]; } -(void)startup { if (classNameLookup == NULL) { classNameLookup = CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, NULL); //We do not retain the Class, but simply assign them. } TiThreadPerformOnMainThread(^{[self registerForNotifications];}, NO); } -(void)_configure { [self startup]; [super _configure]; } -(void)_setName:(NSString*)name_ { moduleName = [name_ retain]; } // // we dynamically create proxies so we don't create an unnecessary // compile-time dependency on our sub module classes // -(id)createProxy:(NSArray*)args forName:(NSString*)name context:(id<TiEvaluator>)context { Class resultClass = (Class)CFDictionaryGetValue(classNameLookup, name); if (resultClass == NULL) { NSRange range = [name rangeOfString:@"create"]; if (range.location==NSNotFound) { return nil; } // this is a magic check to see if we're inside a compiled code or not // and if so, drop the prefix NSString *prefix = @"Ti"; NSString *moduleName_ = nil; if (moduleName==nil) { moduleName_ = [NSString stringWithCString:class_getName([self class]) encoding:NSUTF8StringEncoding]; } else { // this is only set in the case of a Plus Module moduleName_ = moduleName; prefix = @""; } moduleName_ = [moduleName_ stringByReplacingOccurrencesOfString:@"Module" withString:@""]; NSString *className = [NSString stringWithFormat:@"%@%@%@Proxy",prefix,moduleName_,[name substringFromIndex:range.location+6]]; resultClass = NSClassFromString(className); if (resultClass==nil) { NSLog(@"[WARN] attempted to load: %@",className); @throw [NSException exceptionWithName:@"org.notice_view.module" reason:[NSString stringWithFormat:@"invalid method (%@) passed to %@",name,[self class]] userInfo:nil]; } CFDictionarySetValue(classNameLookup, name, resultClass); } return [[[resultClass alloc] _initWithPageContext:context args:args] autorelease]; } -(NSString*)moduleId { // by default, base modules don't have a module id - but custom modules will return nil; } -(NSData*)moduleJS { NSString *moduleId = [self moduleId]; if (moduleId!=nil) { if (moduleAssets==nil) { NSString *moduleName_ = [NSString stringWithCString:class_getName([self class]) encoding:NSUTF8StringEncoding]; NSString *moduleAsset = [NSString stringWithFormat:@"%@Assets",moduleName_]; id cls = NSClassFromString(moduleAsset); if (cls!=nil) { moduleAssets = [[cls alloc] init]; } } if (moduleAssets!=nil) { return [moduleAssets performSelector:@selector(moduleAsset)]; } } return nil; } -(BOOL)isJSModule { NSString *moduleId = [self moduleId]; if (moduleId!=nil) { // if we have module js than we're a JS native module return [self moduleJS]!=nil; } return NO; } -(NSURL*)moduleResourceURL:(NSString*)name { NSString *resourceurl = [TiHost resourcePath]; NSURL *path = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/modules/%@/%@",resourceurl,[self moduleId],name]]; return path; } -(id)bindCommonJSModule:(NSString*)code { NSString *js = [[NSString alloc] initWithFormat:notice_view$ModuleRequireFormat,code]; id result = [[self pageContext] evalJSAndWait:js]; [js release]; if ([result isKindOfClass:[NSDictionary class]]) { for (id key in result) { [self replaceValue:[result objectForKey:key] forKey:key notification:NO]; } } return result; } -(id)bindCommonJSModuleForPath:(NSURL*)path { NSString *code = [NSString stringWithContentsOfURL:path encoding:NSUTF8StringEncoding error:nil]; if (code!=nil) { return [self bindCommonJSModule:code]; } return nil; } -(void)didReceiveMemoryWarning:(NSNotification *)notification { [super didReceiveMemoryWarning:notification]; RELEASE_TO_NIL(moduleAssets); } @end
{ "content_hash": "38985a9273e2791399978c1156e9630e", "timestamp": "", "source": "github", "line_count": 238, "max_line_length": 130, "avg_line_length": 25.067226890756302, "alnum_prop": 0.7190747569560845, "repo_name": "vanbungkring/ios-NoticeView", "id": "6dfe7829c77bf711e5f66d9020daffeab153580c", "size": "6288", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "build/iphone/Classes/TiModule.m", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "181808" }, { "name": "C++", "bytes": "47528" }, { "name": "D", "bytes": "1176323" }, { "name": "JavaScript", "bytes": "8751" }, { "name": "Objective-C", "bytes": "3216119" }, { "name": "Shell", "bytes": "304" } ], "symlink_target": "" }
package krasa.grepconsole.model; import krasa.grepconsole.tail.runConfiguration.TailRunConfigurationSettings; /** * @author Vojtech Krasa */ public class TailSettings extends DomainObject { private boolean enabled; private String port = String.valueOf(8093); private String defaultEncoding = "UTF-8"; private boolean autodetectEncoding = true; private boolean advancedTailDialog = true; private TailRunConfigurationSettings lastTail = new TailRunConfigurationSettings(); public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public String getPort() { return port; } public void setPort(String port) { this.port = port; } public int getPortAsInt() { return Integer.parseInt(port); } public String getDefaultEncoding() { return defaultEncoding; } public void setDefaultEncoding(final String defaultEncoding) { this.defaultEncoding = defaultEncoding; } public boolean isAutodetectEncoding() { return autodetectEncoding; } public void setAutodetectEncoding(final boolean autodetectEncoding) { this.autodetectEncoding = autodetectEncoding; } public boolean isAdvancedTailDialog() { return advancedTailDialog; } public void setAdvancedTailDialog(final boolean advancedTailDialog) { this.advancedTailDialog = advancedTailDialog; } public void setLastTail(TailRunConfigurationSettings lastTail) { this.lastTail = lastTail; } public TailRunConfigurationSettings getLastTail() { return lastTail; } }
{ "content_hash": "da1464f98e64dd4459b943174b820e37", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 84, "avg_line_length": 22.144927536231883, "alnum_prop": 0.7742146596858639, "repo_name": "krasa/GrepConsole", "id": "5683e1b9e267692e46e0671526ae1bfbce18ed2f", "size": "1528", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/krasa/grepconsole/model/TailSettings.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "3110" }, { "name": "Java", "bytes": "627166" }, { "name": "Kotlin", "bytes": "12639" } ], "symlink_target": "" }
<?php use yii\helpers\Html; use yii\helpers\Url; use app\core\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model app\modules\focus\models\CategorySearch */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="category-search"> <?php $form = ActiveForm::searchBegin(); ?> <?= $form->field($model, 'title') ?> <div class="form-group"> <?= Html::submitButton('查找', ['class' => 'btn btn-primary btn-sm']) ?> <?= Html::a('<i class="fa fa-reply"></i> 重置',Url::toRoute(['index']),['class'=>'btn btn-danger btn-sm']);?> </div> <?php ActiveForm::end(); ?> </div>
{ "content_hash": "1af3bd952a24c9b323b7b87563451058", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 116, "avg_line_length": 23.692307692307693, "alnum_prop": 0.5827922077922078, "repo_name": "cboy868/lion", "id": "8e6ed9223513e3cfc1723309244f2df4e3ccf62b", "size": "624", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "modules/focus/views/admin/default/_search.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ActionScript", "bytes": "20283" }, { "name": "ApacheConf", "bytes": "514" }, { "name": "Batchfile", "bytes": "515" }, { "name": "CSS", "bytes": "1596076" }, { "name": "HTML", "bytes": "388819" }, { "name": "JavaScript", "bytes": "8084067" }, { "name": "PHP", "bytes": "10347057" } ], "symlink_target": "" }
OrgDateRangeable.class StatExportedPlan.class StatExportedPlan::CreateOrUpdate.class Role.class Plan.class User.class ExportedPlan.class # Org usage --- TODO: This should likely be a module class Org # Usage for Nbr of exported plans in the prior month class CreateLastMonthExportedPlanService class << self def call(org = nil, threads: 0) orgs = org.nil? ? ::Org.where(managed: true) : [org] Parallel.each(orgs, in_threads: threads) do |org_obj| months = OrgDateRangeable.split_months_from_creation(org_obj) last = months.last next if last.blank? StatExportedPlan::CreateOrUpdate.do( start_date: last[:start_date], end_date: last[:end_date], org: org_obj ) StatExportedPlan::CreateOrUpdate.do( start_date: last[:start_date], end_date: last[:end_date], org: org_obj, filtered: true ) end end end end end
{ "content_hash": "ed35de0c86e2b2607b8ac0bf03bc41b5", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 71, "avg_line_length": 27.324324324324323, "alnum_prop": 0.6102868447082097, "repo_name": "CDLUC3/dmptool", "id": "b1dc366d3c980d11b9b7b8ff30f53bf68d7db719", "size": "1179", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "app/services/org/create_last_month_exported_plan_service.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "147592" }, { "name": "HTML", "bytes": "744911" }, { "name": "JavaScript", "bytes": "354862" }, { "name": "Procfile", "bytes": "67" }, { "name": "Ruby", "bytes": "2611915" }, { "name": "SCSS", "bytes": "31628" }, { "name": "Shell", "bytes": "289" }, { "name": "XSLT", "bytes": "11471" } ], "symlink_target": "" }
#define opt_on_cam_prop(PROP_NAME) opt_on(double, PROP_NAME, -DBL_MAX,"","<PROP_VAL>", std::string("set camera parameter ") + std::string(#PROP_NAME)) namespace skl{ namespace options{ opt_on_cam_prop(POS_MSEC); opt_on_cam_prop(POS_FRAMES); opt_on_cam_prop(POS_AVI_RATIO); opt_on_cam_prop(FRAME_WIDTH); opt_on_cam_prop(FRAME_HEIGHT); opt_on_cam_prop(FPS); opt_on_cam_prop(FOURCC); opt_on_cam_prop(FRAME_COUNT); opt_on_cam_prop(FORMAT); opt_on_cam_prop(MODE); opt_on_cam_prop(BRIGHTNESS); opt_on_cam_prop(CONTRAST); opt_on_cam_prop(SATURATION); opt_on_cam_prop(HUE); opt_on_cam_prop(GAIN); opt_on_cam_prop(EXPOSURE); opt_on_cam_prop(CONVERT_RGB); opt_on_container(std::vector, double, WHITE_BALANCE, "0.0:0.0","","<BLUE:RED>", "set camera parameter WHITE_BALANCE",":",2); opt_on_cam_prop(RECTIFICATION); opt_on_cam_prop(MONOCROME); opt_on_cam_prop(SHARPNESS); opt_on_cam_prop(AUTO_EXPOSURE); opt_on_cam_prop(GAMMA); opt_on_cam_prop(TEMPERATURE); opt_on_cam_prop(TRIGGER); opt_on_cam_prop(TRIGGER_DELAY); // Options for FlyCapture2 opt_on_cam_prop(IRIS); opt_on_cam_prop(FOCUS); opt_on_cam_prop(ZOOM); opt_on_cam_prop(PAN); opt_on_cam_prop(TILT); opt_on_cam_prop(SHUTTER); }//namespace options }//namespace params #define opt_set_cap_prop(prop_name,params) \ if(skl::options::prop_name!=-DBL_MAX){ assert(params.set(skl::prop_name,skl::options::prop_name));} #define opt_parse_cap_prop(params) \ opt_set_cap_prop(POS_MSEC,params)\ opt_set_cap_prop(POS_FRAMES,params)\ opt_set_cap_prop(POS_AVI_RATIO,params)\ opt_set_cap_prop(FRAME_WIDTH,params)\ opt_set_cap_prop(FRAME_HEIGHT,params)\ opt_set_cap_prop(FPS,params)\ opt_set_cap_prop(FOURCC,params)\ opt_set_cap_prop(FRAME_COUNT,params)\ opt_set_cap_prop(FORMAT,params)\ opt_set_cap_prop(MODE,params)\ opt_set_cap_prop(BRIGHTNESS,params)\ opt_set_cap_prop(CONTRAST,params)\ opt_set_cap_prop(SATURATION,params)\ opt_set_cap_prop(HUE,params)\ opt_set_cap_prop(GAIN,params)\ opt_set_cap_prop(EXPOSURE,params)\ opt_set_cap_prop(CONVERT_RGB,params)\ if(skl::options::WHITE_BALANCE.size()==2 && skl::options::WHITE_BALANCE[0]!=0.0 && skl::options::WHITE_BALANCE[1]!=0.0){\ assert(params.set(skl::WHITE_BALANCE_BLUE_U,skl::options::WHITE_BALANCE[0]));\ assert(params.set(skl::WHITE_BALANCE_RED_V,skl::options::WHITE_BALANCE[1]));\ }\ opt_set_cap_prop(RECTIFICATION,params)\ opt_set_cap_prop(MONOCROME,params);\ opt_set_cap_prop(SHARPNESS,params);\ opt_set_cap_prop(AUTO_EXPOSURE,params);\ opt_set_cap_prop(GAMMA,params);\ opt_set_cap_prop(TEMPERATURE,params);\ opt_set_cap_prop(TRIGGER,params);\ opt_set_cap_prop(TRIGGER_DELAY,params);\ #endif #endif
{ "content_hash": "cd8fc9ad49330c603274bda0f04165b8", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 150, "avg_line_length": 34.78481012658228, "alnum_prop": 0.6874090247452693, "repo_name": "AtsushiHashimoto/TableObjectManager", "id": "0316177dbf4b8ce74a60f1edc60e15e23b0f4046", "size": "2875", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/modules/OpenCV/include/VideoCaptureOptParser.h", "mode": "33261", "license": "bsd-3-clause", "language": [ { "name": "C++", "bytes": "460729" }, { "name": "Cuda", "bytes": "25078" }, { "name": "Makefile", "bytes": "20006" } ], "symlink_target": "" }
package cmd import ( "github.com/spf13/cobra" "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/util/i18n" ) // NewCmdAlpha creates a command that acts as an alternate root command for features in alpha func NewCmdAlpha(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command { cmd := &cobra.Command{ Use: "alpha", Short: i18n.T("Commands for features in alpha"), Long: templates.LongDesc(i18n.T("These commands correspond to alpha features that are not enabled in Kubernetes clusters by default.")), } // Alpha commands should be added here. As features graduate from alpha they should move // from here to the CommandGroups defined by NewKubeletCommand() in cmd.go. //cmd.AddCommand(NewCmdDebug(f, in, out, err)) // NewKubeletCommand() will hide the alpha command if it has no subcommands. Overriding // the help function ensures a reasonable message if someone types the hidden command anyway. if !cmd.HasSubCommands() { cmd.SetHelpFunc(func(*cobra.Command, []string) { cmd.Println(i18n.T("No alpha commands are available in this version of kubectl")) }) } return cmd }
{ "content_hash": "274b02d35b3d9efd4d191a0e8198657d", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 139, "avg_line_length": 35.6, "alnum_prop": 0.7512038523274478, "repo_name": "hzxuzhonghu/kubernetes", "id": "cb78568d950ac2adf70b52694ece0464ad1b7796", "size": "1815", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "pkg/kubectl/cmd/alpha.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "2840" }, { "name": "Dockerfile", "bytes": "60746" }, { "name": "Go", "bytes": "45272226" }, { "name": "HTML", "bytes": "1199455" }, { "name": "Lua", "bytes": "17200" }, { "name": "Makefile", "bytes": "70910" }, { "name": "Python", "bytes": "3052312" }, { "name": "Ruby", "bytes": "393" }, { "name": "Shell", "bytes": "1532098" }, { "name": "sed", "bytes": "11650" } ], "symlink_target": "" }
<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = [ new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new AppBundle\AppBundle(), ]; if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); if ('dev' === $this->getEnvironment()) { $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle(); } } return $bundles; } public function getRootDir() { return __DIR__; } public function getCacheDir() { return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); } public function getLogDir() { return dirname(__DIR__) . '/var/logs'; } public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); } }
{ "content_hash": "919c726bd6cbd6746bb33b54b97fbea9", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 98, "avg_line_length": 33.074074074074076, "alnum_prop": 0.6220604703247481, "repo_name": "gmirmand/wankul", "id": "ec0478759b8b80eb5088411827038d8c97a4ff5c", "size": "1786", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/AppKernel.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3606" }, { "name": "CSS", "bytes": "3655" }, { "name": "HTML", "bytes": "1735" }, { "name": "JavaScript", "bytes": "1971" }, { "name": "PHP", "bytes": "65638" } ], "symlink_target": "" }
<?php namespace Solve\Database\Tests; require_once 'SolveDatabaseTestBasic.php'; use Solve\Database\Models\ModelOperator; use Solve\Database\Models\ModelRelation; use Solve\Database\Models\ModelStructure; use Solve\Database\QC; class ModelAbilitySlugTest extends SolveDatabaseTestBasic { public function testBasic() { $brand = new \Brand(array('title' => 'Apple')); $brand->save(); $this->assertEquals('apple', $brand->getSlug(), 'slug ability for Apple'); $brand->setTitle('Саша')->save(); $this->assertEquals('sasha', $brand->getSlug(), 'slug ability for Sasha'); $brand->setTitle('')->save(); $this->assertEquals('n-a', $brand->getSlug(), 'slug ability for empty'); $brand->setTitle('12 -_ s')->save(); $this->assertEquals('12-s', $brand->getSlug(), 'slug ability for bad string'); } protected static function putTestContent() { QC::executeSQL('SET FOREIGN_KEY_CHECKS = 0'); QC::executeSQL('DROP TABLE IF EXISTS brands'); $storagePath = __DIR__ . '/storage/'; $mo = ModelOperator::getInstance($storagePath); $mo->generateBasicStructure('Brand'); ModelStructure::getInstanceForModel('Brand') ->addAbility('slug') ->saveStructure(); $mo->generateAllModelClasses(); require_once $storagePath . 'bases/BaseBrand.php'; require_once $storagePath . 'classes/Brand.php'; $mo->updateDBForAllModels(); } // public static function tearDownAfterClass() {} }
{ "content_hash": "7cbeff34eaa656f2dc1e48b027c1197c", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 86, "avg_line_length": 31.235294117647058, "alnum_prop": 0.6189579409918393, "repo_name": "Solve/Database", "id": "dff10ff0399d5d05a23053141d942b7a303bf4f6", "size": "1782", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Tests/ModelAbilitySlugTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "191808" } ], "symlink_target": "" }
#include "nacl_mounts/kernel_proxy.h" #include <errno.h> #include <fcntl.h> #include <pthread.h> #include <string.h> #include <string> #include "nacl_mounts/kernel_handle.h" #include "nacl_mounts/mount.h" #include "nacl_mounts/mount_mem.h" #include "nacl_mounts/mount_node.h" #include "nacl_mounts/osstat.h" // TODO(binji): implement MountURL //#include "nacl_mounts/mount_url.h" #include "nacl_mounts/path.h" #include "utils/auto_lock.h" #include "utils/ref_object.h" #ifndef MAXPATHLEN #define MAXPATHLEN 256 #endif // TODO(noelallen) : Grab/Redefine these in the kernel object once available. #define USR_ID 1002 #define GRP_ID 1003 KernelProxy::KernelProxy() : dev_(0) {} KernelProxy::~KernelProxy() {} void KernelProxy::Init() { cwd_ = "/"; dev_ = 1; factories_["memfs"] = MountMem::Create<MountMem>; // TODO(binji): implement MountURL //factories_["urlfs"] = MountURL::Create; // Create memory mount at root StringMap_t smap; mounts_["/"] = MountMem::Create<MountMem>(dev_++, smap); } int KernelProxy::open(const char *path, int oflags) { Path rel; Mount* mnt = AcquireMountAndPath(path, &rel); if (mnt == NULL) return -1; MountNode* node = mnt->Open(rel, oflags); if (node == NULL) { ReleaseMount(mnt); return -1; } KernelHandle* handle = new KernelHandle(mnt, node, oflags); int fd = AllocateFD(handle); mnt->AcquireNode(node); ReleaseHandle(handle); ReleaseMount(mnt); return fd; } int KernelProxy::close(int fd) { KernelHandle* handle = AcquireHandle(fd); if (NULL == handle) return -1; handle->mount_->Close(handle->node_); FreeFD(fd); ReleaseHandle(handle); return 0; } int KernelProxy::dup(int oldfd) { KernelHandle* handle = AcquireHandle(oldfd); if (NULL == handle) return -1; int newfd = AllocateFD(handle); ReleaseHandle(handle); return newfd; } char* KernelProxy::getcwd(char* buf, size_t size) { AutoLock lock(&lock_); if (size <= 0) { errno = EINVAL; return NULL; } // If size is 0, allocate as much as we need. if (size == 0) { size = cwd_.size() + 1; } // Verify the buffer is large enough if (size <= cwd_.size()) { errno = ERANGE; return NULL; } // Allocate the buffer if needed if (buf == NULL) { buf = static_cast<char*>(malloc(size)); } strcpy(buf, cwd_.c_str()); return buf; } char* KernelProxy::getwd(char* buf) { if (NULL == buf) { errno = EFAULT; return NULL; } return getcwd(buf, MAXPATHLEN); } int KernelProxy::chmod(const char *path, mode_t mode) { int fd = KernelProxy::open(path, O_RDWR); if (-1 == fd) return -1; int ret = fchmod(fd, mode); close(fd); return ret; } int KernelProxy::mkdir(const char *path, mode_t mode) { Path rel; Mount* mnt = AcquireMountAndPath(path, &rel); if (mnt == NULL) return -1; int val = mnt->Mkdir(rel, mode); ReleaseMount(mnt); return val; } int KernelProxy::rmdir(const char *path) { Path rel; Mount* mnt = AcquireMountAndPath(path, &rel); if (mnt == NULL) return -1; int val = mnt->Rmdir(rel); ReleaseMount(mnt); return val; } int KernelProxy::stat(const char *path, struct stat *buf) { int fd = KernelProxy::open(path, O_RDONLY); if (-1 == fd) return -1; int ret = fstat(fd, buf); close(fd); return ret; } int KernelProxy::chdir(const char* path) { Path rel; Mount* mnt = AcquireMountAndPath(path, &rel); MountNode* node = mnt->Open(rel, O_RDONLY); if (NULL == node) { errno = EEXIST; ReleaseMount(mnt); return -1; } bool isDir = node->IsaDir(); mnt->Close(node); ReleaseMount(mnt); if (isDir) { AutoLock lock(&lock_); cwd_ = GetAbsPathLocked(path).Join(); return 0; } errno = ENOTDIR; return -1; } int KernelProxy::mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data) { // See if it's already mounted AutoLock lock(&lock_); std::string abs_targ = GetAbsPathLocked(target).Join(); if (mounts_.find(abs_targ) != mounts_.end()) { errno = EBUSY; return -1; } // Find a factory of that type MountFactoryMap_t::iterator factory = factories_.find(filesystemtype); if (factory == factories_.end()) { errno = ENODEV; return -1; } StringMap_t smap; smap["SOURCE"] = source; smap["TARGET"] = abs_targ; if (data) { char* str = strdup(static_cast<const char *>(data)); char* ptr = strtok(str,","); char* val; while (ptr != NULL) { val = strchr(ptr, '='); if (val) { *val = 0; smap[ptr] = val + 1; } else { smap[ptr] = "TRUE"; } ptr = strtok(NULL, ","); } free(str); } Mount* mnt = factory->second(dev_++, smap); if (mnt) { mounts_[abs_targ] = mnt; return 0; } errno = EINVAL; return -1; } int KernelProxy::umount(const char *path) { AutoLock lock(&lock_); Path abs_path = GetAbsPathLocked(path); MountMap_t::iterator it = mounts_.find(abs_path.Join()); if (mounts_.end() == it) { errno = EINVAL; return -1; } if (it->second->RefCount() != 1) { errno = EBUSY; return -1; } it->second->Release(); mounts_.erase(it); return 0; } ssize_t KernelProxy::read(int fd, void *buf, size_t nbytes) { KernelHandle* handle = AcquireHandle(fd); // check if fd is valid and handle exists if (NULL == handle) return -1; AutoLock lock(&handle->lock_); ssize_t cnt = handle->node_->Read(handle->offs_, buf, nbytes); if (cnt > 0) handle->offs_ += cnt; ReleaseHandle(handle); return cnt; } ssize_t KernelProxy::write(int fd, const void *buf, size_t nbytes) { KernelHandle* handle = AcquireHandle(fd); // check if fd is valid and handle exists if (NULL == handle) return -1; AutoLock lock(&handle->lock_); ssize_t cnt = handle->node_->Write(handle->offs_, buf, nbytes); if (cnt > 0) handle->offs_ += cnt; ReleaseHandle(handle); return cnt; } int KernelProxy::fstat(int fd, struct stat* buf) { KernelHandle* handle = AcquireHandle(fd); // check if fd is valid and handle exists if (NULL == handle) return -1; int ret = handle->node_->GetStat(buf); ReleaseHandle(handle); return ret; } int KernelProxy::getdents(int fd, void* buf, unsigned int count) { KernelHandle* handle = AcquireHandle(fd); // check if fd is valid and handle exists if (NULL == handle) return -1; AutoLock lock(&handle->lock_); int cnt = handle->node_->GetDents(handle->offs_, static_cast<dirent *>(buf), count); if (cnt > 0) handle->offs_ += cnt; ReleaseHandle(handle); return cnt; } int KernelProxy::fsync(int fd) { KernelHandle* handle = AcquireHandle(fd); // check if fd is valid and handle exists if (NULL == handle) return -1; int ret = handle->node_->FSync(); ReleaseHandle(handle); return ret; } int KernelProxy::isatty(int fd) { KernelHandle* handle = AcquireHandle(fd); // check if fd is valid and handle exists if (NULL == handle) return -1; int ret = handle->node_->IsaTTY(); ReleaseHandle(handle); return ret; } // TODO(noelallen): Needs implementation. int KernelProxy::fchmod(int fd, int mode) { errno = EINVAL; return -1; } int KernelProxy::remove(const char* path) { errno = EINVAL; return -1; } int KernelProxy::unlink(const char* path) { errno = EINVAL; return -1; } int KernelProxy::access(const char* path, int amode) { errno = EINVAL; return -1; } off_t KernelProxy::lseek(int fd, off_t offset, int whence) { errno = EINVAL; return -1; }
{ "content_hash": "fd9281ddffafe51e12cdfb841dcdbb8f", "timestamp": "", "source": "github", "line_count": 354, "max_line_length": 77, "avg_line_length": 21.37853107344633, "alnum_prop": 0.63107822410148, "repo_name": "junmin-zhu/chromium-rivertrail", "id": "5edc43e5fc260f7ff9ac272c6c51c81c9161dca0", "size": "7740", "binary": false, "copies": "1", "ref": "refs/heads/v8-binding", "path": "native_client_sdk/src/libraries/nacl_mounts/kernel_proxy.cc", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "853" }, { "name": "AppleScript", "bytes": "6973" }, { "name": "Arduino", "bytes": "464" }, { "name": "Assembly", "bytes": "1172794" }, { "name": "Awk", "bytes": "9519" }, { "name": "C", "bytes": "75806807" }, { "name": "C#", "bytes": "1132" }, { "name": "C++", "bytes": "145161929" }, { "name": "DOT", "bytes": "1559" }, { "name": "F#", "bytes": "381" }, { "name": "Java", "bytes": "1546515" }, { "name": "JavaScript", "bytes": "18675242" }, { "name": "Logos", "bytes": "4517" }, { "name": "Matlab", "bytes": "5234" }, { "name": "Objective-C", "bytes": "6981387" }, { "name": "PHP", "bytes": "97817" }, { "name": "Perl", "bytes": "926245" }, { "name": "Python", "bytes": "8088373" }, { "name": "R", "bytes": "262" }, { "name": "Ragel in Ruby Host", "bytes": "3239" }, { "name": "Shell", "bytes": "1513486" }, { "name": "Tcl", "bytes": "277077" }, { "name": "XML", "bytes": "13493" } ], "symlink_target": "" }
package org.copperengine.monitoring.client.form; import java.util.ArrayDeque; import java.util.Deque; import javafx.scene.Node; public abstract class ShowFormsStrategy<E extends Node> { public static final int HISTORY_LIMIT = 10; protected final E component; public ShowFormsStrategy(E component) { this.component = component; } protected abstract void showImpl(Form<?> form); protected abstract void closeImpl(Form<?> form); Form<?> currentForm; public void show(Form<?> form){ if (currentForm!=null && !calledFromBack){ addPrevious(currentForm); } currentForm=form; showImpl(form); } public Form<?> getCurrentForm(){ return currentForm; } protected CloseListener onCloseListener; public void close(Form<?> form){ addPrevious(form); closeImpl(form); if (onCloseListener!=null){ onCloseListener.closed(form); } } protected void addPrevious(Form<?> form) { if (previous.size()>=HISTORY_LIMIT){ previous.removeFirst(); } previous.offerLast(form); } /** * called if form is closed * * @param closeListener */ public void setOnCloseListener(CloseListener closeListener) { onCloseListener = closeListener; } public static interface CloseListener { public void closed(Form<?> form); } boolean calledFromBack=false; final Deque<Form<?>> previous = new ArrayDeque<Form<?>>(HISTORY_LIMIT); public void back(){ Form<?> last = previous.pollLast(); if (last!=null){ if (currentForm!=null){ if (next.size()>=HISTORY_LIMIT){ next.removeFirst(); } next.offerLast(currentForm); } calledFromBack=true; show(last); calledFromBack=false; } } final Deque<Form<?>> next = new ArrayDeque<Form<?>>(HISTORY_LIMIT); public void forward(){ Form<?> forward = next.pollLast(); if (forward!=null){ show(forward); } } }
{ "content_hash": "f1d8b2c87f04d2d6f669aaa7f5fd5098", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 75, "avg_line_length": 24.27777777777778, "alnum_prop": 0.5807780320366133, "repo_name": "benfortuna/copper-engine", "id": "499e468271e39c583fdc6694ac5d7ce130400343", "size": "2793", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "projects/copper-monitoring/copper-monitoring-client/src/main/java/org/copperengine/monitoring/client/form/ShowFormsStrategy.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "11273" }, { "name": "HTML", "bytes": "19139" }, { "name": "Java", "bytes": "2609392" }, { "name": "PLSQL", "bytes": "12599" }, { "name": "SQLPL", "bytes": "1383" } ], "symlink_target": "" }
HRESULT Library_sys_net_native_System_Net_IPAddress::IPv4ToString___STATIC__STRING__U4(CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); NANOCLR_SET_AND_LEAVE(stack.NotImplementedStub()); NANOCLR_NOCLEANUP(); }
{ "content_hash": "e135238cbec7c356b2b842221a0e45e4", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 112, "avg_line_length": 27.625, "alnum_prop": 0.7239819004524887, "repo_name": "nanoframework/nf-interpreter", "id": "2a5263c97ea7fdb8e0b1e396d4434a9ec8431fa5", "size": "377", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "src/DeviceInterfaces/System.Net/sys_net_native_System_Net_IPAddress_stubs.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "53250" }, { "name": "Batchfile", "bytes": "3951" }, { "name": "C", "bytes": "10956982" }, { "name": "C#", "bytes": "7307" }, { "name": "C++", "bytes": "4901068" }, { "name": "CMake", "bytes": "634934" }, { "name": "PowerShell", "bytes": "201566" }, { "name": "Shell", "bytes": "2976" } ], "symlink_target": "" }
namespace Merchant.Tools { public class MineralValueCalculator : ICalculateMineralValue { public decimal MineralValue(decimal quantity, decimal creditValue) { return creditValue/quantity; } public decimal CreditValue(decimal quantity, decimal mineralValue) { return quantity*mineralValue; } } }
{ "content_hash": "d9adc4783df8a646e46bf92ca8a32616", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 74, "avg_line_length": 26.266666666666666, "alnum_prop": 0.6192893401015228, "repo_name": "ofraski/Merchant", "id": "b7655a099f74918489cf8f961d80926537aec440", "size": "396", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Merchant/Tools/MineralValueCalculator.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "66004" } ], "symlink_target": "" }
#ifndef GUIUTIL_H #define GUIUTIL_H #include <QString> #include <QObject> #include <QMessageBox> QT_BEGIN_NAMESPACE class QFont; class QLineEdit; class QWidget; class QDateTime; class QUrl; class QAbstractItemView; QT_END_NAMESPACE class SendCoinsRecipient; /** Utility functions used by the GGcoin-qt UI. */ namespace GUIUtil { // Create human-readable string from date QString dateTimeStr(const QDateTime &datetime); QString dateTimeStr(qint64 nTime); // Render addresses in monospace font QFont bitcoinAddressFont(); // Set up widgets for address and amounts void setupAddressWidget(QLineEdit *widget, QWidget *parent); void setupAmountWidget(QLineEdit *widget, QWidget *parent); // Parse "GGcoin:" URI into recipient object, return true on succesful parsing // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0 bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out); bool parseBitcoinURI(QString uri, SendCoinsRecipient *out); // HTML escaping for rich text controls QString HtmlEscape(const QString& str, bool fMultiLine=false); QString HtmlEscape(const std::string& str, bool fMultiLine=false); /** Copy a field of the currently selected entry of a view to the clipboard. Does nothing if nothing is selected. @param[in] column Data column to extract from the model @param[in] role Data role to extract from the model @see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress */ void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole); /** Get save file name, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when no suffix is provided by the user. @param[in] parent Parent window (or 0) @param[in] caption Window caption (or empty, for default) @param[in] dir Starting directory (or empty, to default to documents directory) @param[in] filter Filter specification such as "Comma Separated Files (*.csv)" @param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0). Can be useful when choosing the save file format based on suffix. */ QString getSaveFileName(QWidget *parent=0, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedSuffixOut=0); /** Get connection type to call object slot in GUI thread with invokeMethod. The call will be blocking. @returns If called from the GUI thread, return a Qt::DirectConnection. If called from another thread, return a Qt::BlockingQueuedConnection. */ Qt::ConnectionType blockingGUIThreadConnection(); // Determine whether a widget is hidden behind other windows bool isObscured(QWidget *w); // Open debug.log void openDebugLogfile(); /** Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text representation if needed. This assures that Qt can word-wrap long tooltip messages. Tooltips longer than the provided size threshold (in characters) are wrapped. */ class ToolTipToRichTextFilter : public QObject { Q_OBJECT public: explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0); protected: bool eventFilter(QObject *obj, QEvent *evt); private: int size_threshold; }; bool GetStartOnSystemStartup(); bool SetStartOnSystemStartup(bool fAutoStart); /** Help message, shown with --help. */ class HelpMessageBox : public QMessageBox { Q_OBJECT public: HelpMessageBox(QWidget *parent = 0); /** Show message box or print help message to standard output, based on operating system. */ void showOrPrint(); /** Print help message to console */ void printToConsole(); private: QString header; QString coreOptions; QString uiOptions; }; } // namespace GUIUtil #endif // GUIUTIL_H
{ "content_hash": "b4da709c8e826258e0f257ff4dd6d014", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 107, "avg_line_length": 35.15833333333333, "alnum_prop": 0.6909220194358853, "repo_name": "Nerede/istcoin", "id": "4f4fce33cc3ac5a44fe42b97ca274d5ca2571c2c", "size": "4219", "binary": false, "copies": "2", "ref": "refs/heads/istanbul", "path": "src/qt/guiutil.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "59064" }, { "name": "C++", "bytes": "1385856" }, { "name": "Objective-C", "bytes": "2463" }, { "name": "Prolog", "bytes": "10954" }, { "name": "Python", "bytes": "18144" }, { "name": "Shell", "bytes": "1144" }, { "name": "TypeScript", "bytes": "3810608" } ], "symlink_target": "" }
<?php namespace Foothing\Tests\Laravel\Visits\Commands; use Foothing\Laravel\Visits\Commands\DumpVisitsBuffer; use Foothing\Laravel\Visits\Visits; class DumpVisitsBufferTest extends \Orchestra\Testbench\TestCase { public function test_fire() { $visits = \Mockery::mock(Visits::class); $command = new DumpVisitsBuffer($visits); $visits->shouldReceive('dumpBuffer')->once(); $command->fire(); } }
{ "content_hash": "dce86ab43ba3808e761ec8e591549724", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 66, "avg_line_length": 31.285714285714285, "alnum_prop": 0.7031963470319634, "repo_name": "foothing/laravel-simple-pageviews", "id": "4ab9df757159b65cfef1942f54b1c947b8f0270a", "size": "438", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/Commands/DumpVisitsBufferTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "41773" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.maven</groupId> <artifactId>maven</artifactId> <version>3.6.1-SNAPSHOT</version> </parent> <artifactId>apache-maven</artifactId> <packaging>pom</packaging> <name>Apache Maven Distribution</name> <description>The Apache Maven distribution, source and binary, in zip and tar.gz formats.</description> <properties> <distributionFileName>${distributionId}-${project.version}</distributionFileName> </properties> <dependencies> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-embedder</artifactId> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-core</artifactId> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-compat</artifactId> </dependency> <dependency> <groupId>org.eclipse.sisu</groupId> <artifactId>org.eclipse.sisu.plexus</artifactId> </dependency> <!-- CLI --> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http</artifactId> <classifier>shaded</classifier> <exclusions> <exclusion> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </exclusion> <exclusion> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> </exclusion> <exclusion> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http-shared</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>${slf4jVersion}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-file</artifactId> </dependency> <dependency> <groupId>org.apache.maven.resolver</groupId> <artifactId>maven-resolver-connector-basic</artifactId> </dependency> <dependency> <groupId>org.apache.maven.resolver</groupId> <artifactId>maven-resolver-transport-wagon</artifactId> </dependency> <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-slf4j-provider</artifactId> </dependency> <dependency> <groupId>org.fusesource.jansi</groupId> <artifactId>jansi</artifactId> </dependency> </dependencies> <build> <finalName>${distributionFileName}</finalName> <pluginManagement> <plugins> <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> <configuration> <excludes combine.children="append"> <exclude>src/bin/m2.conf</exclude> </excludes> </configuration> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <configuration> <includeArtifactIds>jansi</includeArtifactIds> <includes>META-INF/native/**</includes> </configuration> <executions> <execution> <id>unpack-jansi-native</id> <goals> <goal>unpack-dependencies</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <executions> <execution> <id>test-compile</id> <goals> <goal>testCompile</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <systemProperties> <property> <name>basedir</name> <value>${basedir}</value> </property> </systemProperties> </configuration> <executions> <execution> <id>test</id> <goals> <goal>test</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>create-distro-packages</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptors> <descriptor>src/main/assembly/bin.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> </plugins> </build> <pluginRepositories> <pluginRepository> <id>apache.snapshots</id> <url>http://repository.apache.org/snapshots/</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </pluginRepository> </pluginRepositories> <profiles> <profile> <id>create-distribution-in-dir</id> <activation> <property> <name>distributionTargetDir</name> </property> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-clean-plugin</artifactId> <executions> <execution> <goals> <goal>clean</goal> </goals> <id>clean-target-dir</id> <phase>prepare-package</phase> <configuration> <excludeDefaultDirectories>true</excludeDefaultDirectories> <filesets> <fileset> <directory>${distributionTargetDir}</directory> </fileset> </filesets> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>create-distribution-dir</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <finalName>./</finalName> <appendAssemblyId>false</appendAssemblyId> <attach>false</attach> <outputDirectory>${distributionTargetDir}</outputDirectory> <descriptors> <descriptor>src/main/assembly/dir.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> <profile> <id>apache-release</id> <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>make-src-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptors> <descriptor>src/main/assembly/src.xml</descriptor> </descriptors> <tarLongFileMode>gnu</tarLongFileMode> </configuration> </execution> </executions> </plugin> <!-- calculate checksums of source release for Apache dist area --> <plugin> <groupId>net.nicoulaj.maven.plugins</groupId> <artifactId>checksum-maven-plugin</artifactId> <executions> <execution> <id>source-release-checksum</id> <goals> <goal>files</goal> </goals> </execution> </executions> <configuration> <fileSets> <fileSet> <directory>${project.build.directory}</directory> <includes> <include>${project.artifactId}-${project.version}-src.zip</include> <include>${project.artifactId}-${project.version}-src.tar.gz</include> <include>${project.artifactId}-${project.version}-bin.zip</include> <include>${project.artifactId}-${project.version}-bin.tar.gz</include> </includes> </fileSet> </fileSets> <failIfNoFiles>true</failIfNoFiles> </configuration> </plugin> </plugins> </build> </profile> </profiles> </project>
{ "content_hash": "1616f68b72f877beaf552b2a9f8e21d5", "timestamp": "", "source": "github", "line_count": 316, "max_line_length": 204, "avg_line_length": 32.389240506329116, "alnum_prop": 0.5601367855398144, "repo_name": "xasx/maven", "id": "f371d9492ff3c870ce61f722cc149fcd3e14a640", "size": "10235", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "apache-maven/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "7773" }, { "name": "HTML", "bytes": "2422" }, { "name": "Java", "bytes": "4583066" }, { "name": "Shell", "bytes": "9625" } ], "symlink_target": "" }
#include <stdlib.h> #include <lua.h> #include <lauxlib.h> #include "compat-5.2.h" #include <dbus/dbus.h> #include "ldbus.h" #include "connection.h" #include "message.h" #include "error.h" #include "bus.h" static const char *const BusType_lst [] = { "session", /* DBUS_BUS_SESSION == 0 */ "system", /* DBUS_BUS_SYSTEM == 1 */ "starter", /* DBUS_BUS_STARTER == 2 */ NULL }; static const char *const Request_Name_Reply_lst [] = { NULL, /* No 0... */ "primary_owner", /* DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER == 1 */ "in_queue", /* DBUS_REQUEST_NAME_REPLY_IN_QUEUE == 2 */ "exists", /* DBUS_REQUEST_NAME_REPLY_EXISTS == 3 */ "already_owner", /* DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER == 4 */ NULL }; static const char *const Release_Name_Reply_lst [] = { NULL, /* No 0... */ "released", /* DBUS_RELEASE_NAME_REPLY_RELEASED == 1 */ "non_existent", /* DBUS_RELEASE_NAME_REPLY_NON_EXISTENT == 2 */ "not_owner", /* DBUS_RELEASE_NAME_REPLY_NOT_OWNER == 3 */ NULL }; static const char *const Start_Reply_lst [] = { NULL, /* No 0... */ "success", /* DBUS_START_REPLY_SUCCESS == 1 */ "already_running", /* DBUS_START_REPLY_ALREADY_RUNNING == 2 */ NULL }; static int ldbus_bus_get(lua_State *L) { int type = luaL_checkoption(L, 1, NULL, BusType_lst); DBusError *error = new_DBusError(L); DBusConnection *connection = dbus_bus_get(type, error); if (dbus_error_is_set(error)) { lua_pushboolean(L, FALSE); lua_pushstring(L, error->message); return 2; } else { dbus_connection_set_exit_on_disconnect(connection, FALSE); push_DBusConnection(L, connection, FALSE); return 1; } } static int ldbus_bus_register(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); DBusError *error = new_DBusError(L); dbus_bus_register(connection, error); if (dbus_error_is_set(error)) { lua_pushnil(L); lua_pushstring(L, error->message); return 2; } else { lua_pushboolean(L, TRUE); return 1; } } static int ldbus_bus_set_unique_name(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); const char *unique_name = luaL_checkstring(L, 2); lua_pushboolean(L, dbus_bus_set_unique_name(connection, unique_name)); return 1; } static int ldbus_bus_get_unique_name(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); const char *unique_name = dbus_bus_get_unique_name(connection); if (unique_name == NULL) { lua_pushnil(L); } else { lua_pushstring(L, unique_name); } return 1; } static int ldbus_bus_request_name(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); const char *name = luaL_checkstring(L, 2); unsigned int flags = 0; DBusError *error; int result; switch (lua_type(L, 3)) { case LUA_TNIL: case LUA_TNONE: break; case LUA_TTABLE: lua_getfield(L, 3, "allow_replacement"); if (lua_toboolean(L, -1)) flags |= DBUS_NAME_FLAG_ALLOW_REPLACEMENT; lua_getfield(L, 3, "do_not_queue"); if (lua_toboolean(L, -1)) flags |= DBUS_NAME_FLAG_DO_NOT_QUEUE; lua_getfield(L, 3, "replace_existing"); if (lua_toboolean(L, -1)) flags |= DBUS_NAME_FLAG_REPLACE_EXISTING; break; default: return luaL_argerror(L, 3, lua_pushfstring(L, "table or nil expected, got %s", luaL_typename(L, 3))); break; } error = new_DBusError(L); result = dbus_bus_request_name(connection, name, flags, error); if (dbus_error_is_set(error)) { lua_pushnil(L); lua_pushstring(L, error->message); return 2; } else { lua_pushstring(L, Request_Name_Reply_lst [ result ]); return 1; } } static int ldbus_bus_release_name(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); const char *name = luaL_checkstring(L, 2); int result; DBusError *error = new_DBusError(L); result = dbus_bus_release_name(connection, name, error); if (dbus_error_is_set(error)) { lua_pushnil(L); lua_pushstring(L, error->message); return 2; } else { lua_pushstring(L, Release_Name_Reply_lst [ result ]); return 1; } } static int ldbus_bus_name_has_owner(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); const char *name = luaL_checkstring(L, 2); int result; DBusError *error = new_DBusError(L); result = dbus_bus_name_has_owner(connection, name, error); if (dbus_error_is_set(error)) { lua_pushnil(L); lua_pushstring(L, error->message); return 2; } else { lua_pushboolean(L, result); return 1; } } static int ldbus_bus_start_service_by_name(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); const char *name = luaL_checkstring(L, 2); unsigned int result; DBusError *error = new_DBusError(L); dbus_bus_start_service_by_name(connection, name, 0, &result, error); if (dbus_error_is_set(error)) { lua_pushnil(L); lua_pushstring(L, error->message); return 2; } else { lua_pushstring(L, Start_Reply_lst [ result ]); return 1; } } static int ldbus_bus_add_match(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); const char *rule = luaL_checkstring(L, 2); DBusError *error = new_DBusError(L); dbus_bus_add_match(connection, rule, error); if (dbus_error_is_set(error)) { lua_pushnil(L); lua_pushstring(L, error->message); return 2; } else { lua_pushboolean(L, TRUE); return 1; } } static int ldbus_bus_remove_match(lua_State *L) { DBusConnection *connection = check_DBusConnection(L, 1); const char *rule = luaL_checkstring(L, 2); DBusError *error = new_DBusError(L); dbus_bus_remove_match(connection, rule, error); if (dbus_error_is_set(error)) { lua_pushnil(L); lua_pushstring(L, error->message); return 2; } else { lua_pushboolean(L, TRUE); return 1; } } int luaopen_ldbus_bus(lua_State *L) { static const struct luaL_Reg ldbus_bus [] = { { "get", ldbus_bus_get }, { "register", ldbus_bus_register }, { "set_unique_name", ldbus_bus_set_unique_name }, { "get_unique_name", ldbus_bus_get_unique_name }, { "request_name", ldbus_bus_request_name }, { "release_name", ldbus_bus_release_name }, { "name_has_owner", ldbus_bus_name_has_owner }, { "start_service_by_name", ldbus_bus_start_service_by_name }, { "add_match", ldbus_bus_add_match }, { "remove_match", ldbus_bus_remove_match }, { NULL, NULL } }; luaL_newlib(L, ldbus_bus); return 1; }
{ "content_hash": "6bc01614acfad771e8062df48121bb46", "timestamp": "", "source": "github", "line_count": 242, "max_line_length": 104, "avg_line_length": 26.665289256198346, "alnum_prop": 0.6483805981713932, "repo_name": "dodo/ldbus", "id": "665be35e4372262647b30085d516b6419e52d2b9", "size": "6453", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/bus.c", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "66277" }, { "name": "Lua", "bytes": "4745" }, { "name": "Makefile", "bytes": "547" } ], "symlink_target": "" }
package com.example.qiuro.qiuweather; 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": "393b593de167dc656bf4d7570fe81a6f", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 81, "avg_line_length": 23.88235294117647, "alnum_prop": 0.6945812807881774, "repo_name": "qiurongli/qiuweatherr", "id": "90cc9e91e7fa079b37cc30fc4bb91559fbf09d61", "size": "406", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/test/java/com/example/qiuro/qiuweather/ExampleUnitTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "34473" } ], "symlink_target": "" }
<?php defined('BASEPATH') OR exit('No direct script access allowed'); $lang['upload_userfile_not_set'] = 'A userfile POST változó nem található.'; $lang['upload_file_exceeds_limit'] = 'A feltöltött fájl mérete nagyobb, mint amit a PHP konfigurációs fájl beállítása engedélyez.'; $lang['upload_file_exceeds_form_limit'] = 'A feltöltött fájl mérete nagyobb, mint amit az űrlap engedélyez.'; $lang['upload_file_partial'] = 'A fájlt csak részben sikerült feltölteni.'; $lang['upload_no_temp_directory'] = 'Az átmeneti könyvtár hiányzik.'; $lang['upload_unable_to_write_file'] = 'Nem sikerült a fájlt lemezre írni.'; $lang['upload_stopped_by_extension'] = 'A feltöltést egy kiterjesztés megállította.'; $lang['upload_no_file_selected'] = 'Nem választott feltöltendő fájlt.'; $lang['upload_invalid_filetype'] = 'A feltöltésre kijelölt fájl típusa nem engedélyezett.'; $lang['upload_invalid_filesize'] = 'A feltöltésre kijelölt fájl mérete nagyobb mint az engedélyezett maximum.'; $lang['upload_invalid_dimensions'] = 'A feltöltésre kijelölt kép mérete nagyobb mint az engedélyezett szélesség vagy magasság.'; $lang['upload_destination_error'] = 'A feltöltött fájl ideiglenesről végleges helyre mozgatása közben hiba történt.'; $lang['upload_no_filepath'] = 'A feltöltési könyvtár érvénytelen.'; $lang['upload_no_file_types'] = 'Nincsenek megadva feltöltésre engedélyezett fájltípusok.'; $lang['upload_bad_filename'] = 'A megadott fájlnév már létezik a szerveren.'; $lang['upload_not_writable'] = 'A feltöltési könyvtár nem írható.';
{ "content_hash": "14f985b4775c6c10c1b8e5cec0f9d2fd", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 132, "avg_line_length": 77.35, "alnum_prop": 0.7485455720749838, "repo_name": "ivantcholakov/codeigniter3-translations", "id": "b9596c49d5fb23326d07c417215f4f938886d38a", "size": "1926", "binary": false, "copies": "3", "ref": "refs/heads/develop", "path": "language/hungarian/upload_lang.php", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "5818" }, { "name": "PHP", "bytes": "1211066" } ], "symlink_target": "" }
#ifndef FKREALM_H #define FKREALM_H #include "FKInfrastructure.h" #include <QSet> #include <QVariant> #include "FKRealmDBMap.h" #include "FKRoomData.h" class FKConnector; class FKConnectionManager; class FKAusviceData; class FKRoomInviteData; class FKRealm : public FKInfrastructure{ Q_OBJECT public: FKRealm(QObject* parent=0); ~FKRealm(); void ausvise(FKConnectionManager* source,const QVariant loginData); void stopGuestConnection(FKConnectionManager* guest); void stopServerConnection(const qint32 serverId); void stopClientConnection(const QString& clientId); //void refreshRoomList(const QString& clientId,const QVariant& filters); void refreshRoomData(const qint32 serverId, const QVariant& data); void dropRealm(); FKInfrastructureType infrastructureType()const override; void registerServerRoomType(const qint32 serverId, const QVariant& data); void removeServerRoomType(const qint32 serverId, const QVariant& data); void createUser(const QString& clientId, const QVariant& userName); void deleteUser(const QString& clientId, const QVariant& userName); void createRoomRequested(const QString& clientId, const QVariant& data); void joinRoomRequested(const QString& clientId, const QVariant& data); //void createRoomRespond(const qint32 serverId, const QVariant& data); //void enterRoomRespond(const qint32 serverId, const QVariant& data); void clientDisonnectedFromServer(const qint32 serverId,const QVariant& data); void roomStopped(const qint32 serverId, const QVariant& data); //implementation for connector void roomStopped(const qint32 serverId); public slots: virtual void setPort(const qint32 /*port*/){} void incomeConnection(FKConnector* connector,const bool needActivation); void registerRoomType(QString roomType); void removeRoomType(QString roomType); qint32 createServerRecord(const QString password); void dropServer(const qint32 serverId); void deleteServerRecord(const qint32 serverId); void createClientRecord(const QString clientName, const QString password); void deleteClientRecord(const QString clientName); void createRoomRequest(const QString roomName,const QString roomType); QStringList userList()const; QStringList getUserList(const QString clientId)const; QStringList clientList()const; QStringList connectedClientList()const; QStringList activeClientList()const; QStringList serverList()const; QList<qint32> connectedServerList()const; QList<qint32> getConnectedServersForRoomType(const QString roomType)const; QList<qint32> getAvaliableServers()const; QList<qint32> getAvaliableServersForRoomType(const QString roomType)const; QStringList serverAvaliableRoomTypes(const qint32 serverId)const; QStringList getRegisteredRoomTypes()const; QStringList getServersForRoomType(const QString roomType)const; QStringList getRoomList(const QVariant filters)const; private: bool isServerConnected(const qint32 id)const; bool isServerRegistered(const qint32 id)const; bool isClientConnected(const QString& id)const; bool isClientOnServer(const QString& id)const; bool isClientExists(const QString& id)const; void incomeServer(const qint32 id,FKConnector* connector); void incomeClient(const QString& id,FKConnector* connector); QString getServerPassword(const qint32 id)const; QString getClientPassword(const QString& id)const; QString getServerOwner(const qint32 id)const; QStringList getLastUsers(const QString& clientId)const; QString getLastRoom(const QString& clientId)const; bool isClientInRoom(const QString& clientId)const; bool isRoomTypeRegistered(const QString& roomType)const; bool hasActiveServersForRoomType(const QString& roomType)const; bool isRoomTypeRegistered(const QString& roomType,const qint32 serverId)const; bool isUserExists(const QString& userName)const; bool isUserExists(const QString& userName,const QString& clientId)const; bool isRoomExists(const QString& roomName); void createUser(const QString& clientId, const QString& userName); void deleteUser(const QString& clientId, const QString& userName); void createNewClientRecord(const QString& clientName, const QString& password); void deleteClientRecordFromDatabase(const QString& clientName); qint32 createNewServerRecord(const QString& password); void deleteServerRecordFromDatabase(const qint32 serverId); qint32 getFreeServer(const QString& roomType)const; qint32 getRoomServer(const QString& roomId)const; void registerNewRoomType(const QString& roomType); void removeRoomTypeFromDatabase(const QString& roomType); void registerNewRoomType(const qint32 serverId,const QString& roomType); void removeRoomTypeFromDatabase(const qint32 serverId,const QString& roomType); //QString getServerRoom(const qint32 serverId)const; //QString getClientRoom(const QString& clientId)const; //qint32 getUserActive(const QString& clientId, const QString& userName); //bool hasSelectedUser(const QString& clientId)const; qint32 takeNextServerId()const; //FKClientRoomState getClientRoomState(const QString& clientId)const; //void setClientRoomState(const QString& clientId, FKClientRoomState state)const; //bool isCustomServerRequested(const QString& clientId)const; qint32 getCustomServer(const QString& clientId)const; QString getServerRoomType(const qint32 serverId)const; //QString getServerIP(const qint32 serverId); //FKAusviceData customServerPreserve(const QString& clientId); //bool processInviteData(const FKRoomInviteData& invite); void createNewRoomForServer(const QString& roomName, const QString& roomType, const qint32 serverId, const QString& creator=QString()); static QString generateServerPassword(); //const FKRoomData& setServerRoomData(const qint32 serverId, const QString& roomName, const QString& roomType, const QString& clientId, const bool custom); //void submitRoomData(const QString& roomId); //void abortRoomData(const qint32 serverId,const QString& roomId); //void enterRoomRequested(const QString& clientId, const QString& roomId); QString createUserInvitePassword()const; void addClientToRoom(const qint32 server, const QString& client, const QStringList& users); //void removeClientFromRoom(const qint32 server, const QString& client); //void addServerToRoomType(const qint32 serverId,const QString& roomType); void sanityDatabase()override; void restructureDatabase(); struct FKServerReferent{ FKConnectionManager* mgr; QStringList clients; QStringList roomTypes; QString room; QString owner; }; QSet<FKConnectionManager*> _guestConnections; QHash<qint32,FKServerReferent*> _serverConnections; QHash<QString,FKConnectionManager*> _clientConnections; QHash<QString,FKRoomData> _activeRooms; const FKRealmDBMap _dbPath; }; #endif // FKREALM_H
{ "content_hash": "be969f3244d3a757b3e3a1ea5283612e", "timestamp": "", "source": "github", "line_count": 150, "max_line_length": 159, "avg_line_length": 47.11333333333334, "alnum_prop": 0.7764256402999858, "repo_name": "FajraKatviro/FKFramework2", "id": "a536616c437d01b4cd0ca311b99202da9d4bfcd1", "size": "7067", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "FKCore/FKRealm.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "803" }, { "name": "C++", "bytes": "407148" }, { "name": "Prolog", "bytes": "327" }, { "name": "QML", "bytes": "6761" }, { "name": "QMake", "bytes": "6816" } ], "symlink_target": "" }
package io.schinzel.basicutils.str; import java.util.Locale; abstract class AbstractIStr<T extends IStr<T>> implements IStr<T> { private StringBuilder sb = new StringBuilder(); @Override public T a(String s) { sb.append(s); return this.getThis(); } @Override public Locale getLocale() { return Locale.US; } @Override public String asString() { return sb.toString(); } }
{ "content_hash": "55b00b66c2792695194a55ea6176a7d7", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 67, "avg_line_length": 17.307692307692307, "alnum_prop": 0.6155555555555555, "repo_name": "Schinzel/basic-utils", "id": "85b03cdb147e3a0922eecb1d2cb6e4f74c9fd7dd", "size": "450", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/io/schinzel/basicutils/str/AbstractIStr.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "313575" } ], "symlink_target": "" }
package entidades; import java.util.Date; import java.sql.*; import java.io.*; public class Usuario { Connection conn; Statement stmt; public Usuario(){ try { String userName = "bluehats_SEng"; String password = "amss1"; String url = "jdbc:mysql://162.243.134.61/bluehats_SEng"; Class.forName ("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection (url, userName, password); stmt = conn.createStatement(); }catch (Exception e) { System.out.println ("Cannot connect to database server"); } } public boolean existe(int usuario){ try { stmt.executeQuery ("SELECT idUsuario FROM Usuario WHERE idUsuario = " + usuario); ResultSet rs = stmt.getResultSet(); if (rs.next()) { //Va al primer registro si lo hay int idUsuario = rs.getInt ("idUsuario"); rs.close(); return( usuario == idUsuario ); }else{ return false;} } catch (SQLException e) {} return false; } }
{ "content_hash": "b65d2e1297b7f1992fb5d898bbcd436b", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 87, "avg_line_length": 29.58823529411765, "alnum_prop": 0.6322067594433399, "repo_name": "acrogenesis/SEng-Bytes", "id": "23789410c4cf22cf74b71e165f03e08042046f59", "size": "1006", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Entidades/Usuario.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "147195" }, { "name": "Java", "bytes": "36942" }, { "name": "JavaScript", "bytes": "134731" }, { "name": "Shell", "bytes": "917" } ], "symlink_target": "" }
/* * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ /* * This code was generated by https://github.com/googleapis/google-api-java-client-services/ * Modify at your own risk. */ package com.google.api.services.discoveryengine.v1alpha.model; /** * Request message for Import methods. * * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is * transmitted over HTTP when working with the Discovery Engine API. For a detailed explanation see: * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a> * </p> * * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest extends com.google.api.client.json.GenericJson { /** * BigQuery input source. * The value may be {@code null}. */ @com.google.api.client.util.Key private GoogleCloudDiscoveryengineV1alphaBigQuerySource bigquerySource; /** * The desired location of errors incurred during the Import. * The value may be {@code null}. */ @com.google.api.client.util.Key private GoogleCloudDiscoveryengineV1alphaImportErrorConfig errorConfig; /** * Google Cloud Storage location for the input content. * The value may be {@code null}. */ @com.google.api.client.util.Key private GoogleCloudDiscoveryengineV1alphaGcsSource gcsSource; /** * The Inline source for the input content for documents. * The value may be {@code null}. */ @com.google.api.client.util.Key private GoogleCloudDiscoveryengineV1alphaImportDocumentsRequestInlineSource inlineSource; /** * The mode of reconciliation between existing documents and the documents to be imported. * Defaults to ReconciliationMode.INCREMENTAL. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String reconciliationMode; /** * BigQuery input source. * @return value or {@code null} for none */ public GoogleCloudDiscoveryengineV1alphaBigQuerySource getBigquerySource() { return bigquerySource; } /** * BigQuery input source. * @param bigquerySource bigquerySource or {@code null} for none */ public GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest setBigquerySource(GoogleCloudDiscoveryengineV1alphaBigQuerySource bigquerySource) { this.bigquerySource = bigquerySource; return this; } /** * The desired location of errors incurred during the Import. * @return value or {@code null} for none */ public GoogleCloudDiscoveryengineV1alphaImportErrorConfig getErrorConfig() { return errorConfig; } /** * The desired location of errors incurred during the Import. * @param errorConfig errorConfig or {@code null} for none */ public GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest setErrorConfig(GoogleCloudDiscoveryengineV1alphaImportErrorConfig errorConfig) { this.errorConfig = errorConfig; return this; } /** * Google Cloud Storage location for the input content. * @return value or {@code null} for none */ public GoogleCloudDiscoveryengineV1alphaGcsSource getGcsSource() { return gcsSource; } /** * Google Cloud Storage location for the input content. * @param gcsSource gcsSource or {@code null} for none */ public GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest setGcsSource(GoogleCloudDiscoveryengineV1alphaGcsSource gcsSource) { this.gcsSource = gcsSource; return this; } /** * The Inline source for the input content for documents. * @return value or {@code null} for none */ public GoogleCloudDiscoveryengineV1alphaImportDocumentsRequestInlineSource getInlineSource() { return inlineSource; } /** * The Inline source for the input content for documents. * @param inlineSource inlineSource or {@code null} for none */ public GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest setInlineSource(GoogleCloudDiscoveryengineV1alphaImportDocumentsRequestInlineSource inlineSource) { this.inlineSource = inlineSource; return this; } /** * The mode of reconciliation between existing documents and the documents to be imported. * Defaults to ReconciliationMode.INCREMENTAL. * @return value or {@code null} for none */ public java.lang.String getReconciliationMode() { return reconciliationMode; } /** * The mode of reconciliation between existing documents and the documents to be imported. * Defaults to ReconciliationMode.INCREMENTAL. * @param reconciliationMode reconciliationMode or {@code null} for none */ public GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest setReconciliationMode(java.lang.String reconciliationMode) { this.reconciliationMode = reconciliationMode; return this; } @Override public GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest set(String fieldName, Object value) { return (GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest) super.set(fieldName, value); } @Override public GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest clone() { return (GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest) super.clone(); } }
{ "content_hash": "50ffb4645ba03b1f25cda0577906a189", "timestamp": "", "source": "github", "line_count": 165, "max_line_length": 182, "avg_line_length": 35.2, "alnum_prop": 0.7565426997245179, "repo_name": "googleapis/google-api-java-client-services", "id": "351b1e48fac8d66377ce0e3d29e8cf4198e237f4", "size": "5808", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "clients/google-api-services-discoveryengine/v1alpha/2.0.0/com/google/api/services/discoveryengine/v1alpha/model/GoogleCloudDiscoveryengineV1alphaImportDocumentsRequest.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
.class public Lcom/sec/android/ims/IMSManager; .super Landroid/os/Handler; .source "IMSManager.java" # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lcom/sec/android/ims/IMSManager$ManagerHandler;, Lcom/sec/android/ims/IMSManager$ServiceSender; } .end annotation # static fields .field private static final DEBUG:Z = true .field protected static final EVENT_REGISTER:I = 0x1 .field protected static final EVENT_REGISTER_ISIM:I = 0x2 .field protected static final EVENT_REGISTER_LISTENER:I = 0x5 .field protected static final EVENT_UNREGISTER:I = 0x3 .field protected static final EVENT_UNREGISTER_ISIM:I = 0x4 .field protected static final EVENT_UNREGISTER_LISTENER:I = 0x6 .field private static final LOG_TAG:Ljava/lang/String; = "IMSManager" .field public static final PROPERTY_IMS_MODE:Ljava/lang/String; = "persist.sys.ims.mode" .field public static final PROPERTY_IMS_REGISTERED:Ljava/lang/String; = "persist.sys.ims.reg" .field private static imsManager:Lcom/sec/android/ims/IMSManager; # instance fields .field private events:I .field private isIt3gNetwork:Z .field private isimResponse:[B .field private listener:Lcom/sec/android/ims/IMSEventListener; .field private mConnection:Landroid/content/ServiceConnection; .field private mContext:Landroid/content/Context; .field mHandler:Lcom/sec/android/ims/IMSManager$ManagerHandler; .field private mService:Lcom/sec/android/internal/ims/IIMSService; .field mServiceSender:Lcom/sec/android/ims/IMSManager$ServiceSender; .field mServiceSenderThread:Ljava/lang/Thread; .field private pcscfAddr:Ljava/lang/String; # direct methods .method static constructor <clinit>()V .locals 1 .prologue .line 32 const/4 v0, 0x0 sput-object v0, Lcom/sec/android/ims/IMSManager;->imsManager:Lcom/sec/android/ims/IMSManager; return-void .end method .method private constructor <init>(Landroid/content/Context;)V .locals 4 .parameter "context" .prologue .line 56 invoke-direct {p0}, Landroid/os/Handler;-><init>()V .line 267 new-instance v1, Lcom/sec/android/ims/IMSManager$1; invoke-direct {v1, p0}, Lcom/sec/android/ims/IMSManager$1;-><init>(Lcom/sec/android/ims/IMSManager;)V iput-object v1, p0, Lcom/sec/android/ims/IMSManager;->mConnection:Landroid/content/ServiceConnection; .line 57 iput-object p1, p0, Lcom/sec/android/ims/IMSManager;->mContext:Landroid/content/Context; .line 58 new-instance v0, Landroid/content/Intent; const-string v1, "com.sec.android.ims.IMSService" invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V .line 59 .local v0, intent:Landroid/content/Intent; iget-object v1, p0, Lcom/sec/android/ims/IMSManager;->mContext:Landroid/content/Context; iget-object v2, p0, Lcom/sec/android/ims/IMSManager;->mConnection:Landroid/content/ServiceConnection; const/4 v3, 0x1 invoke-virtual {v1, v0, v2, v3}, Landroid/content/Context;->bindService(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z .line 60 new-instance v1, Lcom/sec/android/ims/IMSManager$ServiceSender; invoke-direct {v1, p0}, Lcom/sec/android/ims/IMSManager$ServiceSender;-><init>(Lcom/sec/android/ims/IMSManager;)V iput-object v1, p0, Lcom/sec/android/ims/IMSManager;->mServiceSender:Lcom/sec/android/ims/IMSManager$ServiceSender; .line 61 new-instance v1, Ljava/lang/Thread; iget-object v2, p0, Lcom/sec/android/ims/IMSManager;->mServiceSender:Lcom/sec/android/ims/IMSManager$ServiceSender; const-string v3, "IMSManager" invoke-direct {v1, v2, v3}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/lang/String;)V iput-object v1, p0, Lcom/sec/android/ims/IMSManager;->mServiceSenderThread:Ljava/lang/Thread; .line 62 iget-object v1, p0, Lcom/sec/android/ims/IMSManager;->mServiceSenderThread:Ljava/lang/Thread; invoke-virtual {v1}, Ljava/lang/Thread;->start()V .line 63 new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V const-string v2, "IMSManager getting created, mService: " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 iget-object v2, p0, Lcom/sec/android/ims/IMSManager;->mService:Lcom/sec/android/internal/ims/IIMSService; invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v1 invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v1 invoke-static {v1}, Lcom/sec/android/ims/IMSManager;->log(Ljava/lang/String;)V .line 64 return-void .end method .method static synthetic access$100(Lcom/sec/android/ims/IMSManager;)Lcom/sec/android/internal/ims/IIMSService; .locals 1 .parameter "x0" .prologue .line 25 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->mService:Lcom/sec/android/internal/ims/IIMSService; return-object v0 .end method .method static synthetic access$102(Lcom/sec/android/ims/IMSManager;Lcom/sec/android/internal/ims/IIMSService;)Lcom/sec/android/internal/ims/IIMSService; .locals 0 .parameter "x0" .parameter "x1" .prologue .line 25 iput-object p1, p0, Lcom/sec/android/ims/IMSManager;->mService:Lcom/sec/android/internal/ims/IIMSService; return-object p1 .end method .method static synthetic access$200(Lcom/sec/android/ims/IMSManager;)Ljava/lang/String; .locals 1 .parameter "x0" .prologue .line 25 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->pcscfAddr:Ljava/lang/String; return-object v0 .end method .method static synthetic access$300(Lcom/sec/android/ims/IMSManager;)Z .locals 1 .parameter "x0" .prologue .line 25 iget-boolean v0, p0, Lcom/sec/android/ims/IMSManager;->isIt3gNetwork:Z return v0 .end method .method static synthetic access$400(Lcom/sec/android/ims/IMSManager;)[B .locals 1 .parameter "x0" .prologue .line 25 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->isimResponse:[B return-object v0 .end method .method static synthetic access$500(Lcom/sec/android/ims/IMSManager;)Lcom/sec/android/ims/IMSEventListener; .locals 1 .parameter "x0" .prologue .line 25 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->listener:Lcom/sec/android/ims/IMSEventListener; return-object v0 .end method .method static synthetic access$502(Lcom/sec/android/ims/IMSManager;Lcom/sec/android/ims/IMSEventListener;)Lcom/sec/android/ims/IMSEventListener; .locals 0 .parameter "x0" .parameter "x1" .prologue .line 25 iput-object p1, p0, Lcom/sec/android/ims/IMSManager;->listener:Lcom/sec/android/ims/IMSEventListener; return-object p1 .end method .method static synthetic access$600(Lcom/sec/android/ims/IMSManager;)I .locals 1 .parameter "x0" .prologue .line 25 iget v0, p0, Lcom/sec/android/ims/IMSManager;->events:I return v0 .end method .method static synthetic access$700(Ljava/lang/String;)V .locals 0 .parameter "x0" .prologue .line 25 invoke-static {p0}, Lcom/sec/android/ims/IMSManager;->log(Ljava/lang/String;)V return-void .end method .method public static declared-synchronized getInstance(Landroid/content/Context;)Lcom/sec/android/ims/IMSManager; .locals 2 .parameter "context" .prologue .line 66 const-class v1, Lcom/sec/android/ims/IMSManager; monitor-enter v1 :try_start_0 sget-object v0, Lcom/sec/android/ims/IMSManager;->imsManager:Lcom/sec/android/ims/IMSManager; if-nez v0, :cond_0 .line 67 new-instance v0, Lcom/sec/android/ims/IMSManager; invoke-direct {v0, p0}, Lcom/sec/android/ims/IMSManager;-><init>(Landroid/content/Context;)V sput-object v0, Lcom/sec/android/ims/IMSManager;->imsManager:Lcom/sec/android/ims/IMSManager; .line 69 :cond_0 sget-object v0, Lcom/sec/android/ims/IMSManager;->imsManager:Lcom/sec/android/ims/IMSManager; :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 monitor-exit v1 return-object v0 .line 66 :catchall_0 move-exception v0 monitor-exit v1 throw v0 .end method .method private static log(Ljava/lang/String;)V .locals 1 .parameter "msg" .prologue .line 135 const-string v0, "IMSManager" invoke-static {v0, p0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I .line 136 return-void .end method .method static requestToString(I)Ljava/lang/String; .locals 1 .parameter "request" .prologue .line 257 packed-switch p0, :pswitch_data_0 .line 264 const-string v0, "<unknown event>" :goto_0 return-object v0 .line 258 :pswitch_0 const-string v0, "EVENT_REGISTER" goto :goto_0 .line 259 :pswitch_1 const-string v0, "EVENT_REGISTER_ISIM" goto :goto_0 .line 260 :pswitch_2 const-string v0, "EVENT_UNREGISTER" goto :goto_0 .line 261 :pswitch_3 const-string v0, "EVENT_UNREGISTER_ISIM" goto :goto_0 .line 262 :pswitch_4 const-string v0, "EVENT_REGISTER_LISTENER" goto :goto_0 .line 263 :pswitch_5 const-string v0, "EVENT_UNREGISTER_LISTENER" goto :goto_0 .line 257 :pswitch_data_0 .packed-switch 0x1 :pswitch_0 :pswitch_1 :pswitch_2 :pswitch_3 :pswitch_4 :pswitch_5 .end packed-switch .end method # virtual methods .method public getMessageEnabler()Lcom/sec/android/ims/message/IMessageEnabler; .locals 2 .prologue .line 111 :try_start_0 iget-object v1, p0, Lcom/sec/android/ims/IMSManager;->mService:Lcom/sec/android/internal/ims/IIMSService; invoke-interface {v1}, Lcom/sec/android/internal/ims/IIMSService;->getMessageEnabler()Lcom/sec/android/ims/message/IMessageEnabler; :try_end_0 .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0 move-result-object v1 .line 115 :goto_0 return-object v1 .line 112 :catch_0 move-exception v0 .line 114 .local v0, e:Landroid/os/RemoteException; invoke-virtual {v0}, Landroid/os/RemoteException;->printStackTrace()V .line 115 const/4 v1, 0x0 goto :goto_0 .end method .method public isRegistered()Z .locals 2 .prologue .line 101 :try_start_0 iget-object v1, p0, Lcom/sec/android/ims/IMSManager;->mService:Lcom/sec/android/internal/ims/IIMSService; invoke-interface {v1}, Lcom/sec/android/internal/ims/IIMSService;->isRegistered()Z :try_end_0 .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0 move-result v1 .line 105 :goto_0 return v1 .line 102 :catch_0 move-exception v0 .line 104 .local v0, e:Landroid/os/RemoteException; invoke-virtual {v0}, Landroid/os/RemoteException;->printStackTrace()V .line 105 const/4 v1, 0x0 goto :goto_0 .end method .method public register(Ljava/lang/String;Z)V .locals 3 .parameter "pcscfAddr" .parameter "isIt3gNetwork" .prologue const/4 v2, 0x1 .line 73 new-instance v0, Ljava/lang/StringBuilder; invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V const-string v1, "[Service]< " invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-static {v2}, Lcom/sec/android/ims/IMSManager;->requestToString(I)Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 invoke-static {v0}, Lcom/sec/android/ims/IMSManager;->log(Ljava/lang/String;)V .line 74 iput-object p1, p0, Lcom/sec/android/ims/IMSManager;->pcscfAddr:Ljava/lang/String; .line 75 iput-boolean p2, p0, Lcom/sec/android/ims/IMSManager;->isIt3gNetwork:Z .line 76 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->mHandler:Lcom/sec/android/ims/IMSManager$ManagerHandler; invoke-virtual {p0, v2}, Lcom/sec/android/ims/IMSManager;->obtainMessage(I)Landroid/os/Message; move-result-object v1 invoke-virtual {v0, v1}, Lcom/sec/android/ims/IMSManager$ManagerHandler;->sendMessage(Landroid/os/Message;)Z .line 78 return-void .end method .method public register(Ljava/lang/String;[B)V .locals 3 .parameter "pcscfAddr" .parameter "isimResponse" .prologue const/4 v2, 0x2 .line 81 new-instance v0, Ljava/lang/StringBuilder; invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V const-string v1, "[Service]< " invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-static {v2}, Lcom/sec/android/ims/IMSManager;->requestToString(I)Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 invoke-static {v0}, Lcom/sec/android/ims/IMSManager;->log(Ljava/lang/String;)V .line 82 iput-object p1, p0, Lcom/sec/android/ims/IMSManager;->pcscfAddr:Ljava/lang/String; .line 83 iput-object p2, p0, Lcom/sec/android/ims/IMSManager;->isimResponse:[B .line 84 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->mHandler:Lcom/sec/android/ims/IMSManager$ManagerHandler; invoke-virtual {p0, v2}, Lcom/sec/android/ims/IMSManager;->obtainMessage(I)Landroid/os/Message; move-result-object v1 invoke-virtual {v0, v1}, Lcom/sec/android/ims/IMSManager$ManagerHandler;->sendMessage(Landroid/os/Message;)Z .line 85 return-void .end method .method public registerListener(Lcom/sec/android/ims/IMSEventListener;I)V .locals 3 .parameter "listener" .parameter "events" .prologue const/4 v2, 0x5 .line 119 new-instance v0, Ljava/lang/StringBuilder; invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V const-string v1, "[Service]< " invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-static {v2}, Lcom/sec/android/ims/IMSManager;->requestToString(I)Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 invoke-static {v0}, Lcom/sec/android/ims/IMSManager;->log(Ljava/lang/String;)V .line 120 iput-object p1, p0, Lcom/sec/android/ims/IMSManager;->listener:Lcom/sec/android/ims/IMSEventListener; .line 121 iput p2, p0, Lcom/sec/android/ims/IMSManager;->events:I .line 123 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->mService:Lcom/sec/android/internal/ims/IIMSService; if-eqz v0, :cond_0 .line 124 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->mHandler:Lcom/sec/android/ims/IMSManager$ManagerHandler; invoke-virtual {p0, v2}, Lcom/sec/android/ims/IMSManager;->obtainMessage(I)Landroid/os/Message; move-result-object v1 invoke-virtual {v0, v1}, Lcom/sec/android/ims/IMSManager$ManagerHandler;->sendMessage(Landroid/os/Message;)Z .line 127 :goto_0 return-void .line 126 :cond_0 const-string v0, "Service isn\'t connected " invoke-static {v0}, Lcom/sec/android/ims/IMSManager;->log(Ljava/lang/String;)V goto :goto_0 .end method .method public unregister()V .locals 3 .prologue const/4 v2, 0x3 .line 88 new-instance v0, Ljava/lang/StringBuilder; invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V const-string v1, "[Service]< " invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-static {v2}, Lcom/sec/android/ims/IMSManager;->requestToString(I)Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 invoke-static {v0}, Lcom/sec/android/ims/IMSManager;->log(Ljava/lang/String;)V .line 89 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->mHandler:Lcom/sec/android/ims/IMSManager$ManagerHandler; invoke-virtual {p0, v2}, Lcom/sec/android/ims/IMSManager;->obtainMessage(I)Landroid/os/Message; move-result-object v1 invoke-virtual {v0, v1}, Lcom/sec/android/ims/IMSManager$ManagerHandler;->sendMessage(Landroid/os/Message;)Z .line 90 return-void .end method .method public unregister(Ljava/lang/String;[B)V .locals 3 .parameter "pcscfAddr" .parameter "isimResponse" .prologue const/4 v2, 0x4 .line 94 new-instance v0, Ljava/lang/StringBuilder; invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V const-string v1, "[Service]< " invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-static {v2}, Lcom/sec/android/ims/IMSManager;->requestToString(I)Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 invoke-static {v0}, Lcom/sec/android/ims/IMSManager;->log(Ljava/lang/String;)V .line 95 iput-object p1, p0, Lcom/sec/android/ims/IMSManager;->pcscfAddr:Ljava/lang/String; .line 96 iput-object p2, p0, Lcom/sec/android/ims/IMSManager;->isimResponse:[B .line 97 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->mHandler:Lcom/sec/android/ims/IMSManager$ManagerHandler; invoke-virtual {p0, v2}, Lcom/sec/android/ims/IMSManager;->obtainMessage(I)Landroid/os/Message; move-result-object v1 invoke-virtual {v0, v1}, Lcom/sec/android/ims/IMSManager$ManagerHandler;->sendMessage(Landroid/os/Message;)Z .line 98 return-void .end method .method public unregisterListener(Lcom/sec/android/ims/IMSEventListener;)V .locals 3 .parameter "listener" .prologue const/4 v2, 0x6 .line 129 new-instance v0, Ljava/lang/StringBuilder; invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V const-string v1, "[Service]< " invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-static {v2}, Lcom/sec/android/ims/IMSManager;->requestToString(I)Ljava/lang/String; move-result-object v1 invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v0 invoke-static {v0}, Lcom/sec/android/ims/IMSManager;->log(Ljava/lang/String;)V .line 130 iput-object p1, p0, Lcom/sec/android/ims/IMSManager;->listener:Lcom/sec/android/ims/IMSEventListener; .line 131 iget-object v0, p0, Lcom/sec/android/ims/IMSManager;->mHandler:Lcom/sec/android/ims/IMSManager$ManagerHandler; invoke-virtual {p0, v2}, Lcom/sec/android/ims/IMSManager;->obtainMessage(I)Landroid/os/Message; move-result-object v1 invoke-virtual {v0, v1}, Lcom/sec/android/ims/IMSManager$ManagerHandler;->sendMessage(Landroid/os/Message;)Z .line 132 return-void .end method
{ "content_hash": "3b6da0ae652cb3d7af0a54f7aa9b8a17", "timestamp": "", "source": "github", "line_count": 757, "max_line_length": 153, "avg_line_length": 26.7331571994716, "alnum_prop": 0.7073676928398478, "repo_name": "baidurom/devices-n7108", "id": "26bab4677ae34aeee7c82cd5f024614370d3fd1b", "size": "20237", "binary": false, "copies": "2", "ref": "refs/heads/coron-4.1", "path": "framework2.jar.out/smali/com/sec/android/ims/IMSManager.smali", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "12697" }, { "name": "Shell", "bytes": "1974" } ], "symlink_target": "" }
<!-- Copyright © 2016-2022 The Thingsboard Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <mat-form-field [formGroup]="branchFormGroup" class="mat-block" [floatLabel]="(selectionMode || emptyPlaceholder) ? 'always' : 'auto'"> <mat-label>{{ 'version-control.branch' | translate }}</mat-label> <input matInput type="text" placeholder="{{emptyPlaceholder || ((loading ? 'common.loading' : 'version-control.select-branch') | translate)}}" #branchInput formControlName="branch" (keydown.enter)="branchInput.blur(); autoCompleteTrigger.closePanel();" (focusin)="onFocus()" (blur)="onBlur()" [required]="required" [matAutocomplete]="branchAutocomplete"> <button *ngIf="branchFormGroup.get('branch').value && !disabled" type="button" matSuffix mat-button mat-icon-button aria-label="Clear" (click)="clear()"> <mat-icon class="material-icons">close</mat-icon> </button> <mat-autocomplete class="tb-autocomplete" (closed)="onPanelClosed()" #branchAutocomplete="matAutocomplete" [displayWith]="displayBranchFn"> <mat-option *ngFor="let branch of filteredBranches | async" [value]="branch" class="branch-option"> <mat-icon class="tb-mat-18" *ngIf="selectionMode && branch.name === modelValue">check</mat-icon> <span class="check-placeholder" *ngIf="selectionMode && branch.name !== modelValue"></span> <span [innerHTML]="branch.name | highlight:searchText"></span> <small *ngIf="branch.default" class="default-branch">{{ 'version-control.default' | translate }}</small> </mat-option> </mat-autocomplete> <mat-error *ngIf="branchFormGroup.get('branch').hasError('required')"> {{ 'version-control.branch-required' | translate }} </mat-error> </mat-form-field>
{ "content_hash": "0fc7f268930d7b121b64c8aef448f4a4", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 144, "avg_line_length": 47.83673469387755, "alnum_prop": 0.6783276450511946, "repo_name": "thingsboard/thingsboard", "id": "38ab9e377aab7cc55fc6c7875879352e2ca0d6d9", "size": "2345", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ui-ngx/src/app/shared/components/vc/branch-autocomplete.component.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "5292" }, { "name": "CSS", "bytes": "1419" }, { "name": "Dockerfile", "bytes": "16044" }, { "name": "FreeMarker", "bytes": "76776" }, { "name": "HTML", "bytes": "1592357" }, { "name": "Java", "bytes": "13339554" }, { "name": "JavaScript", "bytes": "32179" }, { "name": "PLpgSQL", "bytes": "175849" }, { "name": "Python", "bytes": "7686" }, { "name": "SCSS", "bytes": "401062" }, { "name": "Shell", "bytes": "98582" }, { "name": "TypeScript", "bytes": "5235207" } ], "symlink_target": "" }
package com.meidusa.venus.notify.io.json; import java.lang.reflect.Type; import com.meidusa.fastjson.parser.DefaultJSONParser; import com.meidusa.fastjson.parser.JSONLexer; import com.meidusa.fastjson.parser.JSONToken; import com.meidusa.fastjson.parser.deserializer.ObjectDeserializer; import com.meidusa.venus.notify.ReferenceInvocationListener; public class ReferenceInvocationListenerDeserializer implements ObjectDeserializer { public final static ReferenceInvocationListenerDeserializer instance = new ReferenceInvocationListenerDeserializer(); @SuppressWarnings("unchecked") public <T> T deserialze(DefaultJSONParser parser, Type type,Object fieldName) { final JSONLexer lexer = parser.getLexer(); if (lexer.token() == JSONToken.NULL) { lexer.nextToken(JSONToken.COMMA); return null; } ReferenceInvocationListener object = new ReferenceInvocationListener(); parser.parseObject(object); return (T) object; } public int getFastMatchToken() { return JSONToken.LBRACE; } }
{ "content_hash": "13ebbe9d5e5c5b2456ff33503cfade05", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 121, "avg_line_length": 35.064516129032256, "alnum_prop": 0.7479300827966882, "repo_name": "blusechen/venus", "id": "a58eb146eb4e7586d1e1dbc628d29b0369e7d61a", "size": "1087", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "venus-commons/venus-common-io/src/main/java/com/meidusa/venus/notify/io/json/ReferenceInvocationListenerDeserializer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "2919" }, { "name": "Java", "bytes": "1312833" }, { "name": "Shell", "bytes": "6643" } ], "symlink_target": "" }
css = u""" body { font-family:"YaHei Consolas Hybrid"; } #test1 { font-family:"hello"; } #test2 { font-family:"Times New Roman"; } #test3 { font-family:""; } #test4 { font-family:"YaHei Consolas Hybrid"; } """ html = u""" <html> <head> <body> <p id='test1'>hello</p> <!-- does not fallback to default font specified --> <p id='test2'>hello</p> <!-- Works !! --> <p id='test3'>hello d d d的的的的</p> <!-- Works !! fallbacks to default font --> <p id='test4'>hello 的的的</p> <p >hello 的的的</p> <!-- Works !! fallbacks to default font --> </body> </html> """ from PySide import QtCore, QtGui,QtWebKit import base64 class MainWindow(QtGui.QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.webview = QtWebKit.QWebView(self) self.webview.settings().setAttribute( QtWebKit.QWebSettings.WebAttribute.DeveloperExtrasEnabled, True) encodeStr = base64.encodestring(css) self.webview.settings().setUserStyleSheetUrl("data:text/css;charset=utf-8;base64,%s==" % encodeStr) self.inspector = QtWebKit.QWebInspector() self.webview.setHtml(html) #self.webview.load(QtCore.QUrl("http://localhost:8999/ptwebos/ide/?path=D:\Dhole\Workspace/netcafe")) self.inspector.setPage(self.webview.page()) self.inspector.show() self.setCentralWidget(self.webview) self.createActions() self.createMenus() self.setWindowTitle("Dock Widgets") def createActions(self): self.fontAct = QtGui.QAction("&Font", self, statusTip="Set Font", triggered=self.font) def createMenus(self): self.menuBar().addSeparator() self.helpMenu = self.menuBar().addMenu("&Font") self.helpMenu.addAction(self.fontAct) def font(self): font, ok = QtGui.QFontDialog.getFont() if ok: self.webview.setFont(font) if __name__ == '__main__': import sys app = QtGui.QApplication(sys.argv) mainWin = MainWindow() mainWin.show() sys.exit(app.exec_())
{ "content_hash": "9ea766ed69d7bfb13297103fe5edc4a3", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 109, "avg_line_length": 24.892857142857142, "alnum_prop": 0.6183644189383071, "repo_name": "ptphp/PyLib", "id": "231167bfdf710d5df4ef620238c6a8fdaa74d357", "size": "2157", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/pyside/font/wekitfont.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "1523" }, { "name": "C++", "bytes": "7541" }, { "name": "CSS", "bytes": "625731" }, { "name": "JavaScript", "bytes": "4811257" }, { "name": "PHP", "bytes": "34868" }, { "name": "Python", "bytes": "3824172" }, { "name": "Ruby", "bytes": "322" }, { "name": "SQL", "bytes": "685656" }, { "name": "Shell", "bytes": "4143" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>ext-lib: Not compatible</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.7.2 / ext-lib - 0.9.1</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> ext-lib <small> 0.9.1 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2020-02-28 21:06:31 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-02-28 21:06:31 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base camlp5 7.11 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-m4 1 Virtual package relying on m4 coq 8.7.2 Formal proof management system. num 1.3 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.09.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.09.0 Official release 4.09.0 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.8.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;[email protected]&quot; homepage: &quot;https://github.com/coq-community/coq-ext-lib&quot; dev-repo: &quot;git+https://github.com/coq-community/coq-ext-lib.git&quot; bug-reports: &quot;https://github.com/coq-community/coq-ext-lib/issues&quot; authors: [&quot;Gregory Malecha&quot;] license: &quot;BSD-2-Clause-FreeBSD&quot; build: [ [make &quot;-j%{jobs}%&quot;] ] install: [ [make &quot;install&quot;] ] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.4pl4&quot; &amp; &lt; &quot;8.5~&quot;} ] synopsis: &quot;A library of Coq definitions, theorems, and tactics&quot; url { src: &quot;https://github.com/coq-community/coq-ext-lib/archive/v0.9.1.tar.gz&quot; checksum: &quot;md5=062cf7e440b8de59875a408bf4c911b4&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-ext-lib.0.9.1 coq.8.7.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.7.2). The following dependencies couldn&#39;t be met: - coq-ext-lib -&gt; coq &lt; 8.5~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-ext-lib.0.9.1</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "c000d0ed9c5df5fe194d6a38a232a56a", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 157, "avg_line_length": 39.78395061728395, "alnum_prop": 0.5231962761830876, "repo_name": "coq-bench/coq-bench.github.io", "id": "0bafe688deea77d5f3f9ae599ef0299652030eed", "size": "6447", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.09.0-2.0.5/released/8.7.2/ext-lib/0.9.1.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@drawable/abc_btn_check_to_on_mtrl_015" /> <item android:drawable="@drawable/abc_btn_check_to_on_mtrl_000" /> </selector><!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-sdk-release/frameworks/support/v7/appcompat/res/drawable/abc_btn_check_material.xml --><!-- From: file:/Users/bhos1889/AndroidStudioProjects/AdMobBanner/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/drawable/abc_btn_check_material.xml -->
{ "content_hash": "e145afcecd341299d6e570ad91d5e35c", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 412, "avg_line_length": 66.2, "alnum_prop": 0.7447129909365559, "repo_name": "Bmoney1014/AdMobBanner", "id": "655a20e3ad4791d4766c82d799938b2ebb95e8d6", "size": "1324", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/build/intermediates/res/merged/debug/drawable/abc_btn_check_material.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "494447" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using Orchard.ContentManagement; namespace Devoffice.GettingStarted.Models { public class AddinsWidgetPart : ContentPart { } }
{ "content_hash": "cdaa92309624e0106235b2ebd38911fb", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 47, "avg_line_length": 18.75, "alnum_prop": 0.7733333333333333, "repo_name": "ShuanWang/devoffice.com-shuanTestRepo", "id": "cdb9376201141b0a28499452c1fdf8b21911e255", "size": "227", "binary": false, "copies": "1", "ref": "refs/heads/release", "path": "src/Orchard.Web/Modules/Devoffice.GettingStarted/Models/AddinsWidgetPart.cs", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "2330" }, { "name": "Batchfile", "bytes": "5642" }, { "name": "C", "bytes": "4755" }, { "name": "C#", "bytes": "8700352" }, { "name": "CSS", "bytes": "878076" }, { "name": "Cucumber", "bytes": "88588" }, { "name": "HTML", "bytes": "174407" }, { "name": "JavaScript", "bytes": "2795665" }, { "name": "PowerShell", "bytes": "13265" }, { "name": "TypeScript", "bytes": "48101" }, { "name": "XSLT", "bytes": "119918" } ], "symlink_target": "" }
package co.cask.coopr.client.rest.handler; import co.cask.coopr.client.rest.RestClientTest; import com.google.gson.Gson; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.RequestLine; import org.apache.http.entity.StringEntity; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpRequestHandler; import java.io.IOException; import java.util.List; import javax.ws.rs.HttpMethod; /** * This abstract class contains common logic for test handlers. * * @param <T> Type of requested object */ public abstract class AbstractAdminHandler<T> implements HttpRequestHandler { private static final Gson GSON = new Gson(); private static final String COOPR_TENANT_ID_HEADER_NAME = "Coopr-TenantID"; private static final String COOPR_USER_ID_HEADER_NAME = "Coopr-UserID"; @Override public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException { RequestLine requestLine = request.getRequestLine(); String method = requestLine.getMethod(); String url = requestLine.getUri(); int statusCode = HttpStatus.SC_OK; String userId = request.getFirstHeader(COOPR_USER_ID_HEADER_NAME).getValue(); String tenantId = request.getFirstHeader(COOPR_TENANT_ID_HEADER_NAME).getValue(); if (userId.equals(RestClientTest.TEST_USER_ID) && tenantId.equals(RestClientTest.TEST_TENANT_ID)) { if (HttpMethod.GET.equals(method) && getAllURL().equals(url)) { response.setEntity(new StringEntity(GSON.toJson(getAll()))); } else if (HttpMethod.GET.equals(method)) { response.setEntity(new StringEntity(GSON.toJson(getSingle()))); } else if (!HttpMethod.DELETE.equals(method)) { statusCode = HttpStatus.SC_BAD_REQUEST; } } else { statusCode = HandlerUtils.getStatusCodeByTestStatusUserId(userId); } response.setStatusCode(statusCode); } public abstract List<T> getAll(); public abstract T getSingle(); public abstract String getAllURL(); }
{ "content_hash": "92487db12990d09d0eca0e2a06cd738f", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 107, "avg_line_length": 35.55, "alnum_prop": 0.7449601500234412, "repo_name": "cdapio/coopr", "id": "b44f85725eca2f2c2f1edbf4242ea6625c6adf73", "size": "2739", "binary": false, "copies": "3", "ref": "refs/heads/develop", "path": "coopr-rest-client/src/test/java/co/cask/coopr/client/rest/handler/AbstractAdminHandler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "2019" }, { "name": "CSS", "bytes": "21741" }, { "name": "CoffeeScript", "bytes": "138981" }, { "name": "Dockerfile", "bytes": "3077" }, { "name": "HTML", "bytes": "90931" }, { "name": "Java", "bytes": "2865887" }, { "name": "JavaScript", "bytes": "433691" }, { "name": "Python", "bytes": "11958" }, { "name": "Shell", "bytes": "39128" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>io.datakernel</groupId> <artifactId>datakernel</artifactId> <version>3.2-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>datakernel-datastream</artifactId> <name>DataKernel : DataStreams</name> <description> Composable asynchronous/reactive streams with powerful data processing capabilities. They are useful for transferring big volumes of lightweight values or objects. </description> <dependencies> <dependency> <groupId>io.datakernel</groupId> <artifactId>datakernel-serializer</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>io.datakernel</groupId> <artifactId>datakernel-csp</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>io.datakernel</groupId> <artifactId>datakernel-jmxapi</artifactId> <version>${project.version}</version> <optional>true</optional> </dependency> <dependency> <groupId>net.jpountz.lz4</groupId> <artifactId>lz4</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>io.datakernel</groupId> <artifactId>datakernel-test</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifestEntries> <Automatic-Module-Name>io.datakernel.datastream</Automatic-Module-Name> </manifestEntries> </archive> </configuration> </plugin> </plugins> </build> </project>
{ "content_hash": "25e3086ef061f8ba1d32dd3cf959fe72", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 205, "avg_line_length": 30.852941176470587, "alnum_prop": 0.6601525262154433, "repo_name": "softindex/datakernel", "id": "36805fb8bbe2397b76a1cc3e39db67e10982e8bb", "size": "2098", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core-datastream/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "438" }, { "name": "HTML", "bytes": "1244" }, { "name": "Java", "bytes": "5078460" }, { "name": "Shell", "bytes": "55" }, { "name": "TSQL", "bytes": "1305" } ], "symlink_target": "" }
<!doctype html> <html data-ng-app='ngAPI' ng-strict-di> <head> <meta charset='utf-8' /> <meta http-equiv='X-UA-Compatible', content='IE=edge' /> <base href="/" /> <title> J.Ca </title> <meta name="description" content=""/> <meta name="viewport" content="width=device-width"/> <style> .ng-hide { display: none!important; } [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; } </style> <!-- build:css /css/vendor.css--> <!-- bower:css --> <link rel="stylesheet" href="/bower/bootstrap/dist/css/bootstrap.css" /> <link rel="stylesheet" href="/bower/toastr/toastr.css" /> <link rel="stylesheet" href="/bower/angular-motion/dist/angular-motion.css" /> <link rel="stylesheet" href="/bower/ionicons/css/ionicons.css" /> <link rel="stylesheet" href="/bower/angular-loading-bar/build/loading-bar.css" /> <link rel="stylesheet" href="/bower/angular-xeditable/dist/css/xeditable.css" /> <link rel="stylesheet" href="/bower/datatables/media/css/jquery.dataTables.css" /> <link rel="stylesheet" href="/bower/angular-datatables/dist/plugins/bootstrap/datatables.bootstrap.min.css" /> <link rel="stylesheet" href="/bower/videojs/dist/video-js/video-js.css" /> <link rel="stylesheet" href="/bower/flat-ui/dist/css/flat-ui.css" /> <!-- endbower --> <!-- endbuild --> <!-- build:css /css/app.css--> <!-- inject:css --> <link rel="stylesheet" href="/.tmp/stylus/app.css"> <!-- endinject --> <!-- endbuild --> </head> <body> <!-- <div ui-view=''></div> --> <!-- <div data-ng-controller="Shell as vm" ng-cloak> --> <section id="content" class="ui-view-container" > <div class="col-sm-12"> <alert-info class='text-center'></alert-info> </div> <div ui-view></div> </section> <!-- </div> --> <!-- build:js /js/vendor.js--> <!-- bower:js --> <script src="/bower/jquery/dist/jquery.js"></script> <script src="/bower/angular/angular.js"></script> <script src="/bower/lodash/dist/lodash.compat.js"></script> <script src="/bower/restangular/dist/restangular.js"></script> <script src="/bower/toastr/toastr.js"></script> <script src="/bower/angular-animate/angular-animate.js"></script> <script src="/bower/angular-ui-router/release/angular-ui-router.js"></script> <script src="/bower/angular-strap/dist/angular-strap.js"></script> <script src="/bower/angular-strap/dist/angular-strap.tpl.js"></script> <script src="/bower/angular-flash/dist/angular-flash.js"></script> <script src="/bower/angular-bootstrap/ui-bootstrap-tpls.js"></script> <script src="/bower/satellizer/satellizer.js"></script> <script src="/bower/angular-loading-bar/build/loading-bar.js"></script> <script src="/bower/angular-xeditable/dist/js/xeditable.js"></script> <script src="/bower/moment/moment.js"></script> <script src="/bower/datatables/media/js/jquery.dataTables.js"></script> <script src="/bower/angular-datatables/dist/plugins/tabletools/angular-datatables.tabletools.min.js"></script> <script src="/bower/angular-datatables/dist/plugins/bootstrap/angular-datatables.bootstrap.min.js"></script> <script src="/bower/angular-datatables/dist/angular-datatables.min.js"></script> <script src="/bower/typeahead.js/dist/typeahead.bundle.js"></script> <script src="/bower/videojs/dist/video-js/video.js"></script> <script src="/bower/flat-ui/dist/js/flat-ui.js"></script> <script src="/bower/highcharts-ng/dist/highcharts-ng.js"></script> <!-- endbower --> <!-- endbuild--> <!-- build:js /js/app.js--> <!-- inject:js --> <script src="/js/vendor/highcharts.src.js"></script> <script src="/js/vendor/table-tools/src/dataTables.tableTools.js"></script> <script src="/js/custom/layout.js"></script> <script src="/js/app.js"></script> <script src="/js/commons/commons.module.js"></script> <script src="/js/core/core.module.js"></script> <script src="/js/exception/exception.module.js"></script> <script src="/js/layout/layout.module.js"></script> <script src="/js/logger/logger.module.js"></script> <script src="/js/register/register.module.js"></script> <script src="/js/router/router.module.js"></script> <script src="/js/services/services.module.js"></script> <script src="/js/setttings/settings.module.js"></script> <script src="/js/signin/signin.module.js"></script> <script src="/js/widgets/widgets.module.js"></script> <script src="/js/routes/admin/customerList/customerList.module.js"></script> <script src="/js/routes/admin/customerRegistration/customerRegistration.module.js"></script> <script src="/js/routes/admin/invoice/invoice.module.js"></script> <script src="/js/routes/admin/others/others.module.js"></script> <script src="/js/routes/admin/primary/primary.module.js"></script> <script src="/js/routes/admin/quotationList/quotationList.module.js"></script> <script src="/js/routes/admin/quotationRegistration/quotationRegistration.module.js"></script> <script src="/js/routes/admin/salesRepresentative/salesRepresentative.module.js"></script> <script src="/js/routes/admin/salesRepresentativeListing/salesRepresentativeListing.module.js"></script> <script src="/js/routes/client/sample/sample.module.js"></script> <script src="/js/services/restangular.js"></script> <script src="/js/commons/commons.js"></script> <script src="/js/commons/dataservice.js"></script> <script src="/js/commons/viewContentLoaded.js"></script> <script src="/js/constants/constants.js"></script> <script src="/js/core/config.js"></script> <script src="/js/core/constants.js"></script> <script src="/js/exception/exception-handler.provider.js"></script> <script src="/js/exception/exception.js"></script> <script src="/js/layout/shell.js"></script> <script src="/js/logger/logger.js"></script> <script src="/js/register/register.js"></script> <script src="/js/router/routerhelper.js"></script> <script src="/js/services/authInterceptor.js"></script> <script src="/js/services/authToken.js"></script> <script src="/js/services/error.config.js"></script> <script src="/js/services/formReset.js"></script> <script src="/js/services/headerModal.js"></script> <script src="/js/services/languageInterceptor.js"></script> <script src="/js/services/languageToken.js"></script> <script src="/js/services/stateChange.js"></script> <script src="/js/services/strapAlert.js"></script> <script src="/js/services/strapModal.js"></script> <script src="/js/services/userAuthorize.js"></script> <script src="/js/setttings/language.js"></script> <script src="/js/signin/signin.js"></script> <script src="/js/widgets/confirmPassword.js"></script> <script src="/js/widgets/forecastUntilDate.js"></script> <script src="/js/widgets/number.js"></script> <script src="/js/widgets/radioFlatUInvoiceForecast.js"></script> <script src="/js/widgets/selectFlatUI.js"></script> <script src="/js/widgets/selectFlatUInvoiceViewList.js"></script> <script src="/js/widgets/typeAheadFrom.js"></script> <script src="/js/widgets/typeAheadTo.js"></script> <script src="/js/routes/admin/customerList/config.route.js"></script> <script src="/js/routes/admin/customerList/customerList.js"></script> <script src="/js/routes/admin/customerList/dataservice.js"></script> <script src="/js/routes/admin/customerList/editCustomerList.js"></script> <script src="/js/routes/admin/customerRegistration/config.route.js"></script> <script src="/js/routes/admin/customerRegistration/customerRegistration.js"></script> <script src="/js/routes/admin/customerRegistration/dataservice.js"></script> <script src="/js/routes/admin/invoice/config.route.js"></script> <script src="/js/routes/admin/invoice/editOne.js"></script> <script src="/js/routes/admin/invoice/forecast.js"></script> <script src="/js/routes/admin/invoice/fromAddress.js"></script> <script src="/js/routes/admin/invoice/fromAddressViewList.js"></script> <script src="/js/routes/admin/invoice/fromToAddressEditOne.js"></script> <script src="/js/routes/admin/invoice/registration.js"></script> <script src="/js/routes/admin/invoice/toAddress.js"></script> <script src="/js/routes/admin/invoice/toAddressViewList.js"></script> <script src="/js/routes/admin/invoice/viewList.js"></script> <script src="/js/routes/admin/invoice/viewOne.js"></script> <script src="/js/routes/admin/others/invoiceAddress.js"></script> <script src="/js/routes/admin/others/others.js"></script> <script src="/js/routes/admin/primary/config.route.js"></script> <script src="/js/routes/admin/primary/primary.js"></script> <script src="/js/routes/admin/quotationList/config.route.js"></script> <script src="/js/routes/admin/quotationList/dataservice.js"></script> <script src="/js/routes/admin/quotationList/editQuotationList.js"></script> <script src="/js/routes/admin/quotationList/quotationList.js"></script> <script src="/js/routes/admin/quotationRegistration/config.route.js"></script> <script src="/js/routes/admin/quotationRegistration/dataservice.js"></script> <script src="/js/routes/admin/quotationRegistration/quotationRegistration.js"></script> <script src="/js/routes/admin/salesRepresentative/config.route.js"></script> <script src="/js/routes/admin/salesRepresentative/dataservice.js"></script> <script src="/js/routes/admin/salesRepresentative/registration.js"></script> <script src="/js/routes/admin/salesRepresentativeListing/config.route.js"></script> <script src="/js/routes/admin/salesRepresentativeListing/dataservice.js"></script> <script src="/js/routes/admin/salesRepresentativeListing/editSalesRepresentativeListing.js"></script> <script src="/js/routes/admin/salesRepresentativeListing/salesRepresentativeListing.js"></script> <script src="/js/routes/client/sample/config.route.js"></script> <script src="/js/routes/client/sample/sample.js"></script> <!-- endinject --> <!-- inject:templates:js --> <!-- endinject --> <!-- endbuild --> </body> </html>
{ "content_hash": "bb38d212d279757890932b292c221b69", "timestamp": "", "source": "github", "line_count": 187, "max_line_length": 114, "avg_line_length": 55.62566844919786, "alnum_prop": 0.6804460680638339, "repo_name": "caninojories/erp_moe3", "id": "f05008db934fde4717b6b8dc0e1b844c523d5066", "size": "10402", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "front-end/views/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "34603" }, { "name": "HTML", "bytes": "133911" }, { "name": "JavaScript", "bytes": "355836" } ], "symlink_target": "" }
using NUnit.Framework; using System; using System.IO; using System.Runtime.InteropServices; using Vanara.PInvoke; namespace Vanara.Extensions.Tests { [TestFixture()] public class IOExtensionsTests { [Test()] public void WriteTest() { using (var ms = new MemoryStream()) { var bw = new BinaryWriter(ms); bw.Write(257); bw.Write(new RECT(1,1,1,1)); bw.Write(new PRECT(1,1,1,1)); bw.Write<string>(null); Assert.That(() => bw.Write(DateTime.Today), Throws.ArgumentException); var buf = ms.ToArray(); Assert.That(buf.Length == Marshal.SizeOf(typeof(int)) + Marshal.SizeOf(typeof(RECT)) + Marshal.SizeOf(typeof(PRECT))); Assert.That(buf[0] == 1 && buf[1] == 1 && buf[4] == 1); } } [Test()] public void ReadTest() { using (var ms = new MemoryStream(new byte[] {1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 })) { var br = new BinaryReader(ms); Assert.That(() => br.Read<DateTime>(), Throws.ArgumentException); Assert.That(br.Read<int>() == 257); Assert.That(br.Read<RECT>() == new RECT(1,1,1,1)); } } } }
{ "content_hash": "2d23cee1ddacc3e5c71358a6c552809e", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 122, "avg_line_length": 26.902439024390244, "alnum_prop": 0.6110607434270172, "repo_name": "dahall/vanara", "id": "55ecc7934c84c32e564a315cfb621d1d4864cf37", "size": "1105", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "UnitTests/Core/Extensions/IOExtensionsTests.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "3818289" } ], "symlink_target": "" }
/** * Module dependencies. */ var util = require('util') , _ = require('lodash') , getSDKMetadata = require('../sockets/lib/getSDKMetadata') , STRINGFILE = require('sails-stringfile'); /** * Module errors */ var Err = { dependency: function (dependent, dependency) { return new Error( '\n' + 'Cannot use `' + dependent + '` hook ' + 'without the `' + dependency + '` hook enabled!' ); } }; module.exports = function(sails) { /** * Expose Hook definition */ return { initialize: function(cb) { var self = this; // If `views` and `http` hook is not enabled, complain and respond w/ error if (!sails.hooks.sockets) { return cb( Err.dependency('pubsub', 'sockets') ); } // Add low-level, generic socket methods. These are mostly just wrappers // around socket.io, to enforce a little abstraction. addLowLevelSocketMethods(); if (!sails.hooks.orm) { return cb( Err.dependency('pubsub', 'orm') ); } // Wait for `hook:orm:loaded` sails.on('hook:orm:loaded', function() { // Do the heavy lifting self.augmentModels(); // Indicate that the hook is fully loaded cb(); }); // When the orm is reloaded, re-apply all of the pubsub methods to the // models sails.on('hook:orm:reloaded', function() { self.augmentModels(); // Trigger an event in case something needs to respond to the pubsub reload sails.emit('hook:pubsub:reloaded'); }); }, augmentModels: function() { // Augment models with room/socket logic (& bind context) for (var identity in sails.models) { var AugmentedModel = _.defaults(sails.models[identity], getPubsubMethods(), {autosubscribe: true} ); _.bindAll(AugmentedModel, 'subscribe', 'watch', 'introduce', 'retire', 'unwatch', 'unsubscribe', 'publish', 'room', 'publishCreate', 'publishUpdate', 'publishDestroy', 'publishAdd', 'publishRemove' ); sails.models[identity] = AugmentedModel; } } }; function addLowLevelSocketMethods () { sails.sockets = {}; sails.sockets.DEFAULT_EVENT_NAME = 'message'; sails.sockets.subscribeToFirehose = require('./drink')(sails); sails.sockets.unsubscribeFromFirehose = require('./drink')(sails); sails.sockets.publishToFirehose = require('./squirt')(sails); /** * Subscribe a socket to a generic room * @param {object} socket The socket to subscribe. * @param {string} roomName The room to subscribe to */ sails.sockets.join = function(sockets, roomName) { if (!sails.util.isArray(sockets)) { sockets = [sockets]; } sails.util.each(sockets, function(socket) { // If a string was sent, try to look up a socket with that ID if (typeof socket == 'string') {socket = sails.io.sockets.socket(socket);} // If it's not a valid socket object, bail if (! (socket && socket.manager) ) { sails.log.warn("Attempted to call `sails.sockets.join`, but the first argument was not a socket."); return; } // Join up! socket.join(roomName); }); return true; }; /** * Unsubscribe a socket from a generic room * @param {object} socket The socket to unsubscribe. * @param {string} roomName The room to unsubscribe from */ sails.sockets.leave = function(sockets, roomName) { if (!sails.util.isArray(sockets)) { sockets = [sockets]; } sails.util.each(sockets, function(socket) { // If a string was sent, try to look up a socket with that ID if (typeof socket == 'string') {socket = sails.io.sockets.socket(socket);} // If it's not a valid socket object, bail if (! (socket && socket.manager) ) { sails.log.warn("Attempted to call `sails.sockets.leave`, but the first argument was not a socket."); return; } // See ya! socket.leave(roomName); }); return true; }; /** * Broadcast a message to a room * * If the event name is omitted, "message" will be used by default. * Thus, sails.sockets.broadcast(roomName, data) is also a valid usage. * * @param {string} roomName The room to broadcast a message to * @param {string} eventName The event name to broadcast * @param {object} data The data to broadcast * @param {object} socket Optional socket to omit */ sails.sockets.broadcast = function(roomName, eventName, data, socketToOmit) { // If the 'eventName' is an object, assume the argument was omitted and // parse it as data instead. if (typeof eventName === 'object') { data = eventName; eventName = null; } // Default to the sails.sockets.DEFAULT_EVENT_NAME. if (!eventName) { eventName = sails.sockets.DEFAULT_EVENT_NAME; } // If we were given a valid socket to omit, broadcast from there. if (socketToOmit && socketToOmit.manager) { socketToOmit.broadcast.to(roomName).emit(eventName, data); } // Otherwise broadcast to everyone else { sails.io.sockets.in(roomName).emit(eventName, data); } }; /** * Broadcast a message to all connected sockets * * If the event name is omitted, sails.sockets.DEFAULT_EVENT_NAME will be used by default. * Thus, sails.sockets.blast(data) is also a valid usage. * * @param {string} event The event name to broadcast * @param {object} data The data to broadcast * @param {object} socket Optional socket to omit */ sails.sockets.blast = function(eventName, data, socketToOmit) { // If the 'eventName' is an object, assume the argument was omitted and // parse it as data instead. if (typeof eventName === 'object') { data = eventName; eventName = null; } // Default to the sails.sockets.DEFAULT_EVENT_NAME eventName. if (!eventName) { eventName = sails.sockets.DEFAULT_EVENT_NAME; } // If we were given a valid socket to omit, broadcast from there. if (socketToOmit && socketToOmit.manager) { socketToOmit.broadcast.emit(eventName, data); } // Otherwise broadcast to everyone else { sails.io.sockets.emit(eventName, data); } }; /** * Get the ID of a socket object * @param {object} socket The socket object to get the ID of * @return {string} The socket's ID */ sails.sockets.id = function(socket) { // If a request was passed in, get its socket socket = socket.socket || socket; if (socket) { return socket.id; } else return undefined; }; /** * Emit a message to one or more sockets by ID * * If the event name is omitted, "message" will be used by default. * Thus, sails.sockets.emit(socketIDs, data) is also a valid usage. * * @param {array|string} socketIDs The ID or IDs of sockets to send a message to * @param {string} event The name of the message to send * @param {object} data Optional data to send with the message */ sails.sockets.emit = function(socketIDs, eventName, data) { if (!_.isArray(socketIDs)) { socketIDs = [socketIDs]; } if (typeof eventName === 'object') { data = eventName; eventName = null; } if (!eventName) { eventName = sails.sockets.DEFAULT_EVENT_NAME; } _.each(socketIDs, function(socketID) { sails.io.sockets.socket(socketID).emit(eventName, data); }); }; /** * Get the list of sockets subscribed to a room * @param {string} roomName The room to get subscribers of * @param {boolean} returnSockets If true, return socket instances rather than IDs. * @return {array} An array of socket ID strings */ sails.sockets.subscribers = function(roomName, returnSockets) { if (returnSockets) { return sails.io.sockets.clients(roomName); } else { return _.pluck(sails.io.sockets.clients(roomName), 'id'); } }; /** * Get the list of rooms a socket is subscribed to * @param {object} socket The socket to get rooms for * @return {array} An array of room names */ sails.sockets.socketRooms = function(socket) { return _.map(_.keys(sails.io.sockets.manager.roomClients[socket.id]), function(roomName) {return roomName.replace(/^\//,'');}); }; /** * Get the list of all rooms * @return {array} An array of room names, minus the empty room */ sails.sockets.rooms = function() { var rooms = sails.util.clone(sails.io.sockets.manager.rooms); delete rooms[""]; return sails.util.map(sails.util.keys(rooms), function(room){return room.substr(1);}); }; } /** * These methods get appended to the Model class objects * Some take req.socket as an argument to get access * to user('s|s') socket object(s) */ function getPubsubMethods () { return { /** * Broadcast a message to a room * * Wrapper for sails.sockets.broadcast * Can be overridden at a model level, i.e. for encapsulating messages within a single event name. * * @param {string} roomName The room to broadcast a message to * @param {string} eventName The event name to broadcast * @param {object} data The data to broadcast * @param {object} socket Optional socket to omit * * @api private */ broadcast: function(roomName, eventName, data, socketToOmit) { sails.sockets.broadcast(roomName, eventName, data, socketToOmit); }, /** * TODO: document */ getAllContexts: function() { var contexts = ['update', 'destroy', 'message']; _.each(this.associations, function(association) { if (association.type == 'collection') { contexts.push('add:'+association.alias); contexts.push('remove:'+association.alias); } }); return contexts; }, /** * Broadcast a custom message to sockets connected to the specified models * @param {Object|String|Finite} record -- record or ID of record whose subscribers should receive the message * @param {Object|Array|String|Finite} message -- the message payload * @param {Request|Socket} req - if specified, broadcast using this * socket (effectively omitting it) * */ message: function(record, data, req) { // If a request object was sent, get its socket, otherwise assume a socket was sent. var socketToOmit = (req && req.socket ? req.socket : req); // If no records provided, throw an error if (!record) { return sails.log.error( util.format( 'Must specify a record or record ID when calling `Model.publish` '+ '(you specified: `%s`)', record)); } // Otherwise publish to each instance room else { // Get the record ID (if the record argument isn't already a scalar) var id = record[this.primaryKey] || record; // Get the socket room to publish to var room = this.room(id, "message"); // Create the payload var payload = { verb: "messaged", id: id, data: data }; this.broadcast( room, this.identity, payload, socketToOmit ); sails.log.silly("Published message to ", room, ": ", payload); } }, /** * Broadcast a message to sockets connected to the specified models * (or null to broadcast to the entire class room) * * @param {Object|Array|String|Finite} models -- models whose subscribers should receive the message * @param {String} eventName -- the event name to broadcast with * @param {String} context -- the context to broadcast to * @param {Object|Array|String|Finite} data -- the message payload * socket (effectively omitting it) * * @api private */ publish: function (models, eventName, context, data, req) { var self = this; // If the event name is an object, assume we're seeing `publish(models, data, req)` if (typeof eventName === 'object') { req = context; context = null; data = eventName; eventName = null; } // Default to the event name being the model identity if (!eventName) { eventName = this.identity; } // If the context is an object, assume we're seeing `publish(models, eventName, data, req)` if (typeof context === 'object' && context !== null) { req = data; data = context; context = null; } // Default to using the message context if (!context) { sails.log.warn('`Model.publish` should specify a context; defaulting to "message". Try `Model.message` instead?'); context = 'message'; } // If a request object was sent, get its socket, otherwise assume a socket was sent. var socketToOmit = (req && req.socket ? req.socket : req); // If no models provided, publish to the class room if (!models) { STRINGFILE.logDeprecationNotice( 'Model.publish(null, ...)', STRINGFILE.get('links.docs.sockets.pubsub'), sails.log.debug) && STRINGFILE.logUpgradeNotice(STRINGFILE.get('upgrade.classrooms'), [], sails.log.debug); sails.log.silly('Published ', eventName, ' to ', self.classRoom()); self.broadcast( self.classRoom(), eventName, data, socketToOmit ); return; } // Otherwise publish to each instance room else { models = this.pluralize(models); var ids = _.pluck(models, this.primaryKey); if ( ids.length === 0 ) { sails.log.warn('Can\'t publish a message to an empty list of instances-- ignoring...'); } _.each(ids,function eachInstance (id) { var room = self.room(id, context); sails.log.silly("Published ", eventName, " to ", room); self.broadcast( room, eventName, data, socketToOmit ); // Also broadcasts a message to the legacy instance room (derived by // using the `legacy_v0.9` context). // Uses traditional eventName === "message". // Uses traditional message format. if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients']) { var legacyRoom = self.room(id, 'legacy_v0.9'); var legacyMsg = _.cloneDeep(data); legacyMsg.model = self.identity; if (legacyMsg.verb === 'created') { legacyMsg.verb = 'create'; } if (legacyMsg.verb === 'updated') { legacyMsg.verb = 'update'; } if (legacyMsg.verb === 'destroyed') { legacyMsg.verb = 'destroy'; } self.broadcast( legacyRoom, 'message', legacyMsg, socketToOmit ); } }); } }, /** * Check that models are a list, if not, make them a list * Also if they are ids, make them dummy objects with an `id` property * * @param {Object|Array|String|Finite} models * @returns {Array} array of things that have an `id` property * * @api private * @synchronous */ pluralize: function (models) { // If `models` is a non-array object, // turn it into a single-item array ("pluralize" it) // e.g. { id: 7 } -----> [ { id: 7 } ] if ( !_.isArray(models) ) { var model = models; models = [model]; } // If a list of ids things look ids (finite numbers or strings), // wrap them up as dummy objects; e.g. [1,2] ---> [ {id: 1}, {id: 2} ] var self = this; return _.map(models, function (model) { if ( _.isString(model) || _.isFinite(model) ) { var id = model; var data = {}; data[self.primaryKey] = id; return data; } return model; }); }, /** * @param {String|} id * @return {String} name of the instance room for an instance of this model w/ given id * @synchronous */ room: function (id, context) { if (!id) return sails.log.error('Must specify an `id` when calling `Model.room(id)`'); return 'sails_model_'+this.identity+'_'+id+':'+context; }, classRoom: function () { STRINGFILE.logDeprecationNotice( 'Model.classRoom', STRINGFILE.get('links.docs.sockets.pubsub'), sails.log.debug) && STRINGFILE.logUpgradeNotice(STRINGFILE.get('upgrade.classrooms'), [], sails.log.debug); return this._classRoom(); }, /** * @return {String} name of this model's global class room * @synchronous * @api private */ _classRoom: function() { return 'sails_model_create_'+this.identity; }, /** * Return the set of sockets subscribed to this instance * @param {String|Integer} id * @return {Array[Socket]} * @synchronous * @api private */ subscribers: function (id, context) { // For a single context, return just the socket subscribed to that context if (context) { return sails.sockets.subscribers(this.room(id, context), true); } // Otherwise return the unique set of sockets subscribed to ALL contexts // // TODO: handle custom contexts here, which aren't returned by getAllContexts // Not currently a big issue since `publish` is a private API, so subscribing // to a custom context doesn't let you do much. var contexts = this.getAllContexts(); var subscribers = []; _.each(contexts, function(context) { subscribers = _.union(subscribers, this.subscribers(id, context)); }, this); return _.uniq(subscribers); }, /** * Return the set of sockets subscribed to this class room * @return {Array[Socket]} * @synchronous * @api private */ watchers: function() { return sails.sockets.subscribers(this._classRoom(), true); }, /** * Subscribe a socket to a handful of records in this model * * Usage: * Model.subscribe(req,socket [, records] ) * * @param {Request|Socket} req - request containing the socket to subscribe, or the socket itself * @param {Object|Array|String|Finite} records - id, array of ids, model, or array of records * * e.g. * // Subscribe to User.create() * User.subscribe(req.socket) * * // Subscribe to User.update() and User.destroy() * // for the specified instances (or user.save() / user.destroy()) * User.subscribe(req.socket, users) * * @api public */ subscribe: function (req, records, contexts) { // If a request object was sent, get its socket, otherwise assume a socket was sent. var socket = req.socket ? req.socket : req; if (!socket.manager) { return sails.log.warn('`Model.subscribe()` called by a non-socket request. Only requests originating from a connected socket may be subscribed. Ignoring...'); } var self = this; // Subscribe to class room to hear about new records if (!records) { sails.log.warn('Missing or empty second argument `records`. API is `.subscribe(request, records [, contexts])`.'); STRINGFILE.logDeprecationNotice( 'Model.subscribe(socket, null, ...)', STRINGFILE.get('links.docs.sockets.pubsub'), sails.log.debug) && STRINGFILE.logUpgradeNotice(STRINGFILE.get('upgrade.classrooms'), [], sails.log.debug); this.watch(req); return; } contexts = contexts || this.autosubscribe; if (!contexts) { sails.log.warn("`subscribe` called without context on a model with autosubscribe:false. No action will be taken."); return; } if (contexts === true || contexts == '*') { contexts = this.getAllContexts(); } else if (sails.util.isString(contexts)) { contexts = [contexts]; } // If the subscribing socket is using the legacy (v0.9.x) socket SDK (sails.io.js), // always subscribe the client to the `legacy_v0.9` context. if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients'] && socket.handshake) { var sdk = getSDKMetadata(socket.handshake); var isLegacySocketClient = sdk.version === '0.9.0'; if (isLegacySocketClient) { contexts.push('legacy_v0.9'); } } // Subscribe to model instances records = self.pluralize(records); var ids = _.pluck(records, this.primaryKey); _.each(ids,function (id) { _.each(contexts, function(context) { sails.log.silly( 'Subscribed to the ' + self.globalId + ' with id=' + id + '\t(room :: ' + self.room(id, context) + ')' ); sails.sockets.join( socket, self.room(id, context) ); }); }); }, /** * Unsubscribe a socket from some records * * @param {Request|Socket} req - request containing the socket to unsubscribe, or the socket itself * @param {Object|Array|String|Finite} models - id, array of ids, model, or array of models */ unsubscribe: function (req, records, contexts) { // If a request object was sent, get its socket, otherwise assume a socket was sent. var socket = req.socket ? req.socket : req; if (!socket.manager) { return sails.log.warn('`Model.unsubscribe()` called by a non-socket request. Only requests originating from a connected socket may be subscribed. Ignoring...'); } var self = this; // If no records provided, unsubscribe from the class room if (!records) { STRINGFILE.logDeprecationNotice( 'Model.unsubscribe(socket, null, ...)', STRINGFILE.get('links.docs.sockets.pubsub'), sails.log.debug) && STRINGFILE.logUpgradeNotice(STRINGFILE.get('upgrade.classrooms'), [], sails.log.debug); this.unwatch(); } contexts = contexts || this.getAllContexts(); if (contexts === true) { contexts = this.getAllContexts(); } if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients'] && socket.handshake) { var sdk = getSDKMetadata(socket.handshake); var isLegacySocketClient = sdk.version === '0.9.0'; if (isLegacySocketClient) { contexts.push('legacy_v0.9'); } } records = self.pluralize(records); var ids = _.pluck(records, this.primaryKey); _.each(ids,function (id) { _.each(contexts, function(context) { sails.log.silly( 'Unsubscribed from the ' + self.globalId + ' with id=' + id + '\t(room :: ' + self.room(id, context) + ')' ); sails.sockets.leave( socket, self.room(id, context)); }); }); }, /** * Publish an update on a particular model * * @param {String|Finite} id * - primary key of the instance we're referring to * * @param {Object} changes * - an object of changes to this instance that will be broadcasted * * @param {Request|Socket} req - if specified, broadcast using this socket (effectively omitting it) * * @api public */ publishUpdate: function (id, changes, req, options) { // Make sure there's an options object options = options || {}; // Ensure that we're working with a clean, unencumbered object changes = _.clone(changes); // Enforce valid usage var validId = _.isString(id) || _.isFinite(id); if ( !validId ) { return sails.log.error( 'Invalid usage of ' + '`' + this.identity + '.publishUpdate(id, changes, [socketToOmit])`' ); } if (sails.util.isFunction(this.beforePublishUpdate)) { this.beforePublishUpdate(id, changes, req, options); } var data = { model: this.identity, verb: 'update', data: changes, id: id }; if (options.previous && !options.noReverse) { var previous = options.previous; // If any of the changes were to association attributes, publish add or remove messages. _.each(changes, function(val, key) { // If value wasn't changed, do nothing if (val == previous[key]) return; // Find an association matching this attribute var association = _.find(this.associations, {alias: key}); // If the attribute isn't an assoctiation, return if (!association) return; // Get the associated model class var ReferencedModel = sails.models[association.type == 'model' ? association.model : association.collection]; // Bail if this attribute isn't in the model's schema if (association.type == 'model') { var previousPK = _.isObject(previous[key]) ? previous[key][ReferencedModel.primaryKey] : previous[key]; var newPK = _.isObject(val) ? val[this.primaryKey] : val; if (previousPK == newPK) return; // Get the inverse association definition, if any reverseAssociation = _.find(ReferencedModel.associations, {collection: this.identity, via: key}) || _.find(ReferencedModel.associations, {model: this.identity, via: key}); if (!reverseAssociation) {return;} // If this is a to-many association, do publishAdd or publishRemove as necessary // on the other side if (reverseAssociation.type == 'collection') { // If there was a previous value, alert the previously associated model if (previous[key]) { ReferencedModel.publishRemove(previousPK, reverseAssociation.alias, id, {noReverse:true}); } // If there's a new value (i.e. it's not null), alert the newly associated model if (val) { ReferencedModel.publishAdd(newPK, reverseAssociation.alias, id, {noReverse:true}); } } // Otherwise do a publishUpdate else { var pubData = {}; // If there was a previous association, notify it that it has been nullified if (previous[key]) { pubData[reverseAssociation.alias] = null; ReferencedModel.publishUpdate(previousPK, pubData, req, {noReverse:true}); } // If there's a new association, notify it that it has been linked if (val) { pubData[reverseAssociation.alias] = id; ReferencedModel.publishUpdate(newPK, pubData, req, {noReverse:true}); } } } else { // Get the reverse association definition, if any reverseAssociation = _.find(ReferencedModel.associations, {collection: this.identity, via: key}) || _.find(ReferencedModel.associations, {model: this.identity, alias: association.via}); if (!reverseAssociation) {return;} // If we can't get the previous PKs (b/c previous isn't populated), bail if (typeof(previous[key]) == 'undefined') return; // Get the previous set of IDs var previousPKs = _.pluck(previous[key], ReferencedModel.primaryKey); // Get the current set of IDs var updatedPKs = _.map(val, function(_val) { if (_.isObject(_val)) { return _val[ReferencedModel.primaryKey]; } else { return _val; } }); // Find any values that were added to the collection var addedPKs = _.difference(updatedPKs, previousPKs); // Find any values that were removed from the collection var removedPKs = _.difference(previousPKs, updatedPKs); // If this is a to-many association, do publishAdd or publishRemove as necessary // on the other side if (reverseAssociation.type == 'collection') { // Alert any removed models _.each(removedPKs, function(pk) { ReferencedModel.publishRemove(pk, reverseAssociation.alias, id, {noReverse:true}); }); // Alert any added models _.each(addedPKs, function(pk) { ReferencedModel.publishAdd(pk, reverseAssociation.alias, id, {noReverse:true}); }); } // Otherwise do a publishUpdate else { // Alert any removed models _.each(removedPKs, function(pk) { var pubData = {}; pubData[reverseAssociation.alias] = null; ReferencedModel.publishUpdate(pk, pubData, req, {noReverse:true}); }); // Alert any added models _.each(addedPKs, function(pk) { var pubData = {}; pubData[reverseAssociation.alias] = id; ReferencedModel.publishUpdate(pk, pubData, req, {noReverse:true}); }); } } }, this); } // If a request object was sent, get its socket, otherwise assume a socket was sent. var socketToOmit = (req && req.socket ? req.socket : req); // In development environment, blast out a message to everyone sails.sockets.publishToFirehose(data); data.verb = 'updated'; data.previous = options.previous; delete data.model; // Broadcast to the model instance room this.publish(id, this.identity, 'update', data, socketToOmit); if (sails.util.isFunction(this.afterPublishUpdate)) { this.afterPublishUpdate(id, changes, req, options); } }, /** * Publish the destruction of a particular model * * @param {String|Finite} id * - primary key of the instance we're referring to * * @param {Request|Socket} req - if specified, broadcast using this socket (effectively omitting it) * */ publishDestroy: function (id, req, options) { options = options || {}; // Enforce valid usage var invalidId = !id || _.isObject(id); if ( invalidId ) { return sails.log.error( 'Invalid usage of ' + this.identity + '`publishDestroy(id, [socketToOmit])`' ); } if (sails.util.isFunction(this.beforePublishDestroy)) { this.beforePublishDestroy(id, req, options); } var data = { model: this.identity, verb: 'destroy', id: id, previous: options.previous }; // If a request object was sent, get its socket, otherwise assume a socket was sent. var socketToOmit = (req && req.socket ? req.socket : req); // In development environment, blast out a message to everyone sails.sockets.publishToFirehose(data); data.verb = 'destroyed'; delete data.model; // Broadcast to the model instance room this.publish(id, this.identity, 'destroy', data, socketToOmit); // Unsubscribe everyone from the model instance this.retire(id); if (options.previous) { var previous = options.previous; // Loop through associations and alert as necessary _.each(this.associations, function(association) { var ReferencedModel; // If it's a to-one association, and it wasn't falsy, alert // the reverse side if (association.type == 'model' && [association.alias] && previous[association.alias]) { ReferencedModel = sails.models[association.model]; // Get the inverse association definition, if any reverseAssociation = _.find(ReferencedModel.associations, {collection: this.identity}) || _.find(ReferencedModel.associations, {model: this.identity}); if (reverseAssociation) { // If it's a to-one, publish a simple update alert var referencedModelId = _.isObject(previous[association.alias]) ? previous[association.alias][ReferencedModel.primaryKey] : previous[association.alias]; if (reverseAssociation.type == 'model') { var pubData = {}; pubData[reverseAssociation.alias] = null; ReferencedModel.publishUpdate(referencedModelId, pubData, {noReverse:true}); } // If it's a to-many, publish a "removed" alert else { ReferencedModel.publishRemove(referencedModelId, reverseAssociation.alias, id, req, {noReverse:true}); } } } else if (association.type == 'collection' && previous[association.alias].length) { ReferencedModel = sails.models[association.collection]; // Get the inverse association definition, if any reverseAssociation = _.find(ReferencedModel.associations, {collection: this.identity}) || _.find(ReferencedModel.associations, {model: this.identity}); if (reverseAssociation) { _.each(previous[association.alias], function(associatedModel) { // If it's a to-one, publish a simple update alert if (reverseAssociation.type == 'model') { var pubData = {}; pubData[reverseAssociation.alias] = null; ReferencedModel.publishUpdate(associatedModel[ReferencedModel.primaryKey], pubData, req, {noReverse:true}); } // If it's a to-many, publish a "removed" alert else { ReferencedModel.publishRemove(associatedModel[ReferencedModel.primaryKey], reverseAssociation.alias, id, req, {noReverse:true}); } }); } } }, this); } if (sails.util.isFunction(this.afterPublishDestroy)) { this.afterPublishDestroy(id, req, options); } }, /** * publishAdd * * @param {[type]} id [description] * @param {[type]} alias [description] * @param {[type]} idAdded [description] * @param {[type]} socketToOmit [description] */ publishAdd: function(id, alias, idAdded, req, options) { // Make sure there's an options object options = options || {}; // Enforce valid usage var invalidId = !id || _.isObject(id); var invalidAlias = !alias || !_.isString(alias); var invalidAddedId = !idAdded || _.isObject(idAdded); if ( invalidId || invalidAlias || invalidAddedId ) { return sails.log.error( 'Invalid usage of ' + this.identity + '`publishAdd(id, alias, idAdded, [socketToOmit])`' ); } if (sails.util.isFunction(this.beforePublishAdd)) { this.beforePublishAdd(id, alias, idAdded, req); } // If a request object was sent, get its socket, otherwise assume a socket was sent. var socketToOmit = (req && req.socket ? req.socket : req); // In development environment, blast out a message to everyone sails.sockets.publishToFirehose({ id: id, model: this.identity, verb: 'addedTo', attribute: alias, addedId: idAdded }); this.publish(id, this.identity, 'add:'+alias, { id: id, verb: 'addedTo', attribute: alias, addedId: idAdded }, socketToOmit); if (!options.noReverse) { // Get the reverse association var reverseModel = sails.models[_.find(this.associations, {alias: alias}).collection]; var data; // Subscribe to the model you're adding if (req) { data = {}; data[reverseModel.primaryKey] = idAdded; reverseModel.subscribe(req, data); } // Find the reverse association, if any var reverseAssociation = _.find(reverseModel.associations, {alias: _.find(this.associations, {alias: alias}).via}) ; if (reverseAssociation) { // If this is a many-to-many association, do a publishAdd for the // other side. if (reverseAssociation.type == 'collection') { reverseModel.publishAdd(idAdded, reverseAssociation.alias, id, req, {noReverse:true}); } // Otherwise, do a publishUpdate else { data = {}; data[reverseAssociation.alias] = id; reverseModel.publishUpdate(idAdded, data, req, {noReverse:true}); } } } if (sails.util.isFunction(this.afterPublishAdd)) { this.afterPublishAdd(id, alias, idAdded, req); } }, /** * publishRemove * * @param {[type]} id [description] * @param {[type]} alias [description] * @param {[type]} idRemoved [description] * @param {[type]} socketToOmit [description] */ publishRemove: function(id, alias, idRemoved, req, options) { // Make sure there's an options object options = options || {}; // Enforce valid usage var invalidId = !id || _.isObject(id); var invalidAlias = !alias || !_.isString(alias); var invalidRemovedId = !idRemoved || _.isObject(idRemoved); if ( invalidId || invalidAlias || invalidRemovedId ) { return sails.log.error( 'Invalid usage of ' + this.identity + '`publishRemove(id, alias, idRemoved, [socketToOmit])`' ); } if (sails.util.isFunction(this.beforePublishRemove)) { this.beforePublishRemove(id, alias, idRemoved, req); } // If a request object was sent, get its socket, otherwise assume a socket was sent. var socketToOmit = (req && req.socket ? req.socket : req); // In development environment, blast out a message to everyone sails.sockets.publishToFirehose({ id: id, model: this.identity, verb: 'removedFrom', attribute: alias, removedId: idRemoved }); this.publish(id, this.identity, 'remove:' + alias, { id: id, verb: 'removedFrom', attribute: alias, removedId: idRemoved }, socketToOmit); if (!options.noReverse) { // Get the reverse association, if any var reverseModel = sails.models[_.find(this.associations, {alias: alias}).collection]; var reverseAssociation = _.find(reverseModel.associations, {alias: _.find(this.associations, {alias: alias}).via}); if (reverseAssociation) { // If this is a many-to-many association, do a publishAdd for the // other side. if (reverseAssociation.type == 'collection') { reverseModel.publishRemove(idRemoved, reverseAssociation.alias, id, req, {noReverse:true}); } // Otherwise, do a publishUpdate else { var data = {}; data[reverseAssociation.alias] = null; reverseModel.publishUpdate(idRemoved, data, req, {noReverse:true}); } } } if (sails.util.isFunction(this.afterPublishRemove)) { this.afterPublishRemove(id, alias, idRemoved, req); } }, /** * Publish the creation of a model * * @param {Object} values * - the data to publish * * @param {Request|Socket} req - if specified, broadcast using this socket (effectively omitting it) * @api private */ publishCreate: function(values, req, options) { var self = this; options = options || {}; if (!values[this.primaryKey]) { return sails.log.error( 'Invalid usage of publishCreate() :: ' + 'Values must have an `'+this.primaryKey+'`, instead got ::\n' + util.inspect(values) ); } if (sails.util.isFunction(this.beforePublishCreate)) { this.beforePublishCreate(values, req); } var id = values[this.primaryKey]; // If any of the added values were association attributes, publish add or remove messages. _.each(values, function(val, key) { // If the user hasn't yet given this association a value, bail out if (val === null) { return; } var association = _.find(this.associations, {alias: key}); // If the attribute isn't an assoctiation, return if (!association) return; // Get the associated model class var ReferencedModel = sails.models[association.type == 'model' ? association.model : association.collection]; // Bail if the model doesn't exist if (!ReferencedModel) return; // Bail if this attribute isn't in the model's schema if (association.type == 'model') { // Get the inverse association definition, if any reverseAssociation = _.find(ReferencedModel.associations, {collection: this.identity, via: key}) || _.find(ReferencedModel.associations, {model: this.identity, via: key}); if (!reverseAssociation) {return;} // If this is a to-many association, do publishAdd on the other side // TODO -- support nested creates. For now, we can't tell if an object value here represents // a NEW object or an existing one, so we'll ignore it. if (reverseAssociation.type == 'collection' && !_.isObject(val)) { ReferencedModel.publishAdd(val, reverseAssociation.alias, id, {noReverse:true}); } // Otherwise do a publishUpdate // TODO -- support nested creates. For now, we can't tell if an object value here represents // a NEW object or an existing one, so we'll ignore it. else { var pubData = {}; if (!_.isObject(val)) { pubData[reverseAssociation.alias] = id; ReferencedModel.publishUpdate(val, pubData, req, {noReverse:true}); } } } else { // Get the inverse association definition, if any reverseAssociation = _.find(ReferencedModel.associations, {collection: this.identity, via: key}) || _.find(ReferencedModel.associations, {model: this.identity, alias: association.via}); if (!reverseAssociation) {return;} // If this is a to-many association, do publishAdds on the other side if (reverseAssociation.type == 'collection') { // Alert any added models _.each(val, function(pk) { // TODO -- support nested creates. For now, we can't tell if an object value here represents // a NEW object or an existing one, so we'll ignore it. if (_.isObject(pk)) return; ReferencedModel.publishAdd(pk, reverseAssociation.alias, id, {noReverse:true}); }); } // Otherwise do a publishUpdate else { // Alert any added models _.each(val, function(pk) { // TODO -- support nested creates. For now, we can't tell if an object value here represents // a NEW object or an existing one, so we'll ignore it. if (_.isObject(pk)) return; var pubData = {}; pubData[reverseAssociation.alias] = id; ReferencedModel.publishUpdate(pk, pubData, req, {noReverse:true}); }); } } }, this); // Ensure that we're working with a plain object values = _.clone(values); // If a request object was sent, get its socket, otherwise assume a socket was sent. var socketToOmit = (req && req.socket ? req.socket : req); // Blast success message sails.sockets.publishToFirehose({ model: this.identity, verb: 'create', data: values, id: values[this.primaryKey] }); // Publish to classroom var eventName = this.identity; this.broadcast(this._classRoom(), eventName, { verb: 'created', data: values, id: values[this.primaryKey] }, socketToOmit); // Also broadcasts a message to the legacy class room (derived by // using the `:legacy_v0.9` trailer on the class room name). // Uses traditional eventName === "message". // Uses traditional message format. if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients']) { var legacyData = _.cloneDeep({ verb: 'create', data: values, model: self.identity, id: values[this.primaryKey] }); var legacyRoom = this._classRoom()+':legacy_v0.9'; self.broadcast( legacyRoom, 'message', legacyData, socketToOmit ); } // Subscribe watchers to the new instance if (!options.noIntroduce) { this.introduce(values[this.primaryKey]); } if (sails.util.isFunction(this.afterPublishCreate)) { this.afterPublishCreate(values, req); } }, /** * * @return {[type]} [description] */ watch: function ( req ) { var socket = req.socket ? req.socket : req; if (!socket.manager) { return sails.log.warn('`Model.watch()` called by a non-socket request. Only requests originating from a connected socket may be subscribed. Ignoring...'); } sails.sockets.join(socket, this._classRoom()); sails.log.silly("Subscribed socket ", sails.sockets.id(socket), "to", this._classRoom()); if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients'] && socket.handshake) { var sdk = getSDKMetadata(socket.handshake); var isLegacySocketClient = sdk.version === '0.9.0'; if (isLegacySocketClient) { sails.sockets.join(socket, this._classRoom()+':legacy_v0.9'); } } }, /** * [unwatch description] * @param {[type]} socket [description] * @return {[type]} [description] */ unwatch: function ( req ) { var socket = req.socket ? req.socket : req; if (!socket.manager) { return sails.log.warn('`Model.unwatch()` called by a non-socket request. Only requests originating from a connected socket may be subscribed. Ignoring...'); } sails.sockets.leave(socket, this._classRoom()); sails.log.silly("Unubscribed socket ", sails.sockets.id(socket), "from", this._classRoom()); if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients'] && socket.handshake) { var sdk = getSDKMetadata(socket.handshake); var isLegacySocketClient = sdk.version === '0.9.0'; if (isLegacySocketClient) { sails.sockets.leave(socket, this._classRoom()+':legacy_v0.9'); } } }, /** * Introduce a new instance * * Take all of the subscribers to the class room and 'introduce' them * to a new instance room * * @param {String|Finite} id * - primary key of the instance we're referring to * * @api private */ introduce: function(model) { var id = model[this.primaryKey] || model; _.each(this.watchers(), function(socket) { this.subscribe(socket, id); }, this); }, /** * Bid farewell to a destroyed instance * Take all of the socket subscribers in this instance room * and unsubscribe them from it */ retire: function(model) { var id = model[this.primaryKey] || model; _.each(this.subscribers(id), function(socket) { this.unsubscribe(socket, id); }, this); } }; } };
{ "content_hash": "0861c9eae900dea3a3fe3724b5645f30", "timestamp": "", "source": "github", "line_count": 1461, "max_line_length": 199, "avg_line_length": 34.347022587268995, "alnum_prop": 0.5634204180865268, "repo_name": "rasata/Iphone-Powered", "id": "925e3ebb98321bf8c8672e9e36ffb1aa736695f6", "size": "50181", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "node_modules/sails/lib/hooks/pubsub/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "874" }, { "name": "JavaScript", "bytes": "168697" } ], "symlink_target": "" }
package examples.model; import static javax.persistence.FetchType.LAZY; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Lob; @Entity public class Employee { @Id private int id; private String name; private long salary; @Basic(fetch=LAZY) @Lob @Column(name="PIC") private byte[] picture; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getSalary() { return salary; } public void setSalary(long salary) { this.salary = salary; } public byte[] getPicture() { return picture; } public void setPicture(byte[] picture) { this.picture = picture; } public String toString() { return "Employee id: " + getId() + " name: " + getName() + " salary: " + getSalary() + " pic: " + new String(getPicture()); } }
{ "content_hash": "f4f40c1d3edd53d3023855ecd690e29d", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 72, "avg_line_length": 19.47457627118644, "alnum_prop": 0.5909486510008704, "repo_name": "velmuruganvelayutham/jpa", "id": "1e37e0de43b3bc2a2d36b6bd669d930961779934", "size": "1149", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/Chapter4/06-lobMapping/src/model/examples/model/Employee.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "831359" }, { "name": "Shell", "bytes": "8424" } ], "symlink_target": "" }
function[f] = greens_interpolant(theta, v, z, suppress_kernel) % greens_interpolant -- Interpolates samples using the Green's function % % f = greens_interpolant(theta, v, z,{{suppress_kernel=true}}) % % Given samples (theta,v) of a velocity field v, this function constructs % the Green's function interpolant and evaluates it at the locations z \in % S^1. The locations theta must be distinct (no checking is performed). % The optional flag suppress_kernel (default true) tells the function % whether or not to push elements in the kernel through the inversion of G. % % If suppress_kernel is true, the steps for the procedure are the following: % 1.) Compute the interpolatory Vandermonde-like matrix G. Note % that since L is positive, G is positive as well. Direct eig solver % is used, but since G is spd, mayhaps iterative methods are better. % 2.) Compute the eig-decomposition of G. Since dim(ker(L)) = 3 and is % given by (1, sin, cos), then we effectively orthogonalize v against % the kernel and then invert G to obtain coefficients. % 3.) Components of the kernel are propagated unchanged and added to the % interpolant. % 4.) Compute the resulting interpolant at z. % % When suppress_kernel is set to false, nothing fancy is done; G is inverted % using a Cholesky decomposition. persistent greens_function L_kernel_vandermonde greens_coefficients if isempty(greens_function) from shapelab.wp import greens_function greens_coefficients L_kernel_vandermonde = @(x) [ones([length(x) 1]) sin(x(:)) cos(x(:))]; end if nargin<4 suppress_kernel = 2; end [u,u_kernel] = greens_coefficients(theta, v, suppress_kernel); %% Form G %[thetai, thetaj] = meshgrid(theta, theta); %G = greens_function(thetai-thetaj); % %if suppress_kernel % % [Gv,Gd] = eig(G); % G is spd, this should be fast, stable % % % Orthogonalize v against 1, cos, sin. % % First compute G-spectral representation of (1, cos, sin): % L_kernel_spectrum = Gv'*L_kernel_vandermonde(theta); % % % Now: % % 1.) kernel is orth to non-kernel in space % % 2.) Gv is unitary ====> kernel spectrum is orth to non-kernel spectrum % % 3.) Ergo, orthogonalize v-spectrum to kernel spectrum % % % Must orthogonalize vectors in kernel spectrum first, form thin QR % [q,r] = qr(L_kernel_spectrum,0); % % v_spectrum = Gv'*v(:); % G-spectrum of v % u_kernel = q'*v_spectrum; % non-normalized coeffs of (1,sin,cos) in v % v_kernel_spectrum = q*u_kernel; % G-spectrum of u_kernel % % % Now just invert G as usual % u = Gv*inv(Gd)*(v_spectrum - v_kernel_spectrum); % non-kernel part %else % % % cholesky is probably better (quicker, more stable) if G is spd % R = chol(G); % u = R\(R'\v); %end % Compute interpolant evaluations for elements orthogonal to the kernel [thetai, thetaj] = meshgrid(theta, z); f = greens_function(thetai-thetaj)*u; % non-kernel part if suppress_kernel>0 % Now add in residual parts in the kernel f = f + L_kernel_vandermonde(z)*u_kernel; end f = reshape(f, size(z));
{ "content_hash": "c5c1c1dca02b964f2628a2b579f444ce", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 80, "avg_line_length": 38.8375, "alnum_prop": 0.683617637592533, "repo_name": "cygnine/shapelab", "id": "bd8b010b8486a23aad024f790e1d45bf8b8479f7", "size": "3107", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "wp/greens_interpolant.m", "mode": "33188", "license": "mit", "language": [ { "name": "Matlab", "bytes": "370626" }, { "name": "Objective-C", "bytes": "5334" } ], "symlink_target": "" }
<?php /** * @category Spark * @package Spark_Event * @copyright Copyright (c) 2010 Christoph Hochstrasser * @license MIT License */ class Spark_Event_Handler { /** * @var array|Closure Closure or Array */ protected $_callback; /** * Constructor * * @throws InvalidArgumentException * @param array|Closure|string $context, if no $callback is given, then something callable is assumed * @param string $callback * @return void */ public function __construct($context, $callback = null) { if (is_array($context)) { $callback = $context; } else if ($callback === null) { $callback = $context; } else { $callback = array($context, $callback); } if (!is_callable($callback)) { throw new InvalidArgumentException("Callback is not callable"); } $this->_callback = $callback; } /** * Calls the encapsulated Callback * * @param Spark_Event_Event $event * @return mixed */ public function call(Spark_Event_Event $event) { $callback = $this->_callback; if (is_array($callback)) { return call_user_func_array($callback, array($event)); } else if ($callback instanceof Closure) { return $callback($event); } throw new RuntimeException("No valid callback set"); } }
{ "content_hash": "328c75d7d6095cf30e2675687dbb6f91", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 107, "avg_line_length": 24.915254237288135, "alnum_prop": 0.5537414965986395, "repo_name": "CHH/Spark-Web-Framework", "id": "e77cb4306ca525833c3e8d3701bf9e05998ad054", "size": "1854", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/Spark/Event/Handler.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "150443" } ], "symlink_target": "" }
const std::string Settings::kAmbientIntensity = "ambient_intensity"; const std::string Settings::kBackgroundColour = "background_colour"; const std::string Settings::kOutputFile = "output_file"; const std::string Settings::kNumThreads = "num_threads"; const std::string Settings::kMaxReflectBounces = "max_reflect_bounces"; const std::map<std::string, std::string> Settings::kDefaults = { {Settings::kAmbientIntensity, "0"}, {Settings::kBackgroundColour, "0,0,0"}, {Settings::kOutputFile, "out.ppm"}, {Settings::kNumThreads, "1"}, {Settings::kMaxReflectBounces, "5"}, }; void Settings::AddSetting(const std::string& aKey, const std::string& aValue){ mSettings[aKey] = aValue; } bool Settings::GetString(const std::string& aKey, std::string* aOut) const{ bool result = true; std::string out; // Check in settings first try{ out = mSettings.at(aKey); result = true; } catch (std::exception e){ result = false; } // If none defined, check in defaults if(!result){ try{ out = kDefaults.at(aKey); result = true; } catch (std::exception e){ result = false; } } if(result) *aOut = out; return result; } bool Settings::GetInt(const std::string& aKey, int* aOut) const{ bool result = true; std::string val; result = GetString(aKey, &val); if(result) result = Misc::GetInt(val, aOut); return result; } bool Settings::GetUnsigned(const std::string& aKey, uint32_t* aOut) const{ bool result = true; std::string val; result = GetString(aKey, &val); if(result) result = Misc::GetUnsigned(val, aOut); return result; } bool Settings::GetDouble(const std::string& aKey, double* aOut) const{ bool result = true; std::string val; result = GetString(aKey, &val); if(result) result = Misc::GetDouble(val, aOut); return result; } bool Settings::GetColour(const std::string& aKey, Colour* aOut) const{ bool result = true; std::string val; result = GetString(aKey, &val); if(result){ std::stringstream str(val); std::vector<std::string> split = Misc::SplitLine(str, ','); if(split.size() != 3) result = false; double r, g, b; if(result) result = Misc::GetDouble(split[0], &r); if(result) result = Misc::GetDouble(split[1], &g); if(result) result = Misc::GetDouble(split[2], &b); if(result) *aOut = Colour(r, g, b); } return result; }
{ "content_hash": "3921ecb322a4f9a8aa8c97db27c53f78", "timestamp": "", "source": "github", "line_count": 110, "max_line_length": 78, "avg_line_length": 23.972727272727273, "alnum_prop": 0.5942358740993553, "repo_name": "davidsami/RayRay", "id": "785e08fb833c5f198454bb5b3b8405e824d985b5", "size": "2698", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Settings.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "41559" }, { "name": "C++", "bytes": "2932990" }, { "name": "CMake", "bytes": "6810" }, { "name": "Makefile", "bytes": "576" } ], "symlink_target": "" }
<!-- @condition /parking downtown --> <hr class="visuallyhidden"> <!-- @condition /NO CONSTRUCTION --> <div data-parking-district="non-downtown"> <h2>Non-Downtown Businesses</h3> <p>Your business needs to provide parking spaces. This panel is to help you determine what volume of spaces the Municipal Code requires. It is only an estimation. There are often unique circumstances that may effect the final calculation. Your planner will confirm whether or not you have enough parking as you go through the process of opening your business.</p> <% if (answers.business_type != null) { %> <div> <div class="well"> <p>You have told us the following information about your business:</p> <ul> <li>Business type: <strong><%= answers.business_type %></strong></li> <li>Business subtype: <strong><%= answers.business_subtype %></strong></li> </ul> <% if (answers.required_parking_spaces != null) { %> <p>You will need to provide <%= answers.required_parking_spaces %> spaces</p> <% } %> </div> </div> <% } %> <form class="calculator" id="parkingSpacesCalculator"> <!-- 38 business types according to the SC Municipal Code, 25 when combined, 11 large categories --> <label> Please select a category for your business type: <select id="business_type" name="business_type"> <option value="default">Choose one...</option> <option value="auto">Automobiles and machinery</option> <option value="halls">Arenas, auditoriums, halls, and meeting facilities</option> <option value="banks">Banks</option> <option value="billiard">Billiard parlors</option> <option value="office">Business and professional offices</option> <option value="communication">Communications equipment buildings</option> <option value="funeral">Funeral homes, mortuaries</option> <option value="furn_repair">Furniture repair</option> <option value="household">Furniture &#38; appliance stores and household equipment</option> <option value="worship">Houses of worship</option> <option value="seniors">Senior care and facilities</option> <option value="children">Child and foster care</option> <option value="fitness">Physical fitness facilities</option> <option value="lodging">Lodging</option> <option value="plants">Manufacturing, bottling, and processing plants</option> <option value="medical">Medical facilities and offices</option> <option value="research">Research and Development</option> <option value="food">Restaurants, bars, and food service</option> <option value="retail">Retail stores, shops, service establishments, &#38; shopping centers</option> <option value="education">Educational facilities</option> <option value="recycle">Recycling collection facilities</option> <option value="laundry">Self-service laundry and dry cleaning establishments</option> <option value="theaters">Theaters</option> <option value="warehouses">Wholesale, warehouses, and service &#38; maintenance centers</option> </select> </label> </form> <div id="business_type_auto" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_auto">Automobile or machinery sales and service garages</option> <option value="parking_service_stations">Automobile service stations</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_auto" > <h3>Automobile or machinery sales and service garages</h3> <div> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 parking space for each 400 square feet of floor area</li> </ul> </div> <form id="parking_auto" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> </div> <div class=business-sub-type-rule id="subtype_parking_service_stations"> <h3>Automobile service stations</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>3 spaces for each lubrication or service bay</li> <li>1 space for each employee on the day shift</li> </ul> </div> <form id="parking_service_stations" class="parking-calculator"> <label> Service bays: <input id="service_bays" name="service_bays" type="text"> </label> <label> Employees <input id="employees" name="employees" type="text"> </label> </form> </div> </div> <!-- /#business_type_auto --> <div id="business_type_banks" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_banks_with_atms">Banks with automatic teller machines</option> <option value="parking_banks_no_atms">Banks without automatic teller machines</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_banks_with_atms"> <h3>Banks with automatic teller machines</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 400 square feet floor area</li> <li>1.5 spaces for each ATM machine</li> </ul> </div> <form id="parking_banks_with_atms" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> <label> ATM machines: <input id="ATMs" name="ATMs" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_banks_no_atms"> <h3>Banks without automatic teller machines</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 400 square feet floor area</li> </ul> </div> <form id="parking_banks_no_atms" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> </div> <!-- /#business_type_banks --> <div id="business_type_billiard" class="business-type-rule"> <h3>Billiard parlors</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1.5 spaces for each table</li> </ul> </div> <form id="parking_billiard" class="parking-calculator"> <label> Number of tables: <input id="tables" name="tables" type="text"> </label> </form> </div> <!-- /#business_type_billiard --> <div id="business_type_children" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_child_homes">Children's Homes</option> <option value="parking_daycare_foster">Family daycare and foster family homes</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_child_homes"> <h3>Children's Homes</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 5 beds</li> <li>1 space for each employee</li> </ul> </div> <form id="parking_child_homes" class="parking-calculator"> <label> Number of beds: <input id="beds" name="beds" type="text"> </label> <label> Number of employees: <input id="employees" name="employees" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_daycare_foster"> <h3>Family daycare and foster family homes</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for every 5 guests</li> <li>1 space for the resident owner or manager</li> </ul> </div> <form id="parking_daycare_foster" class="parking-calculator"> <label> Number of guests: <input id="guests" name="guests" type="text"> </label> </form> </div> </div> <!-- /#business_type_children --> <div id="business_type_communication" class="business-type-rule"> <h3>Communications equipment buildings</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 1&#8218;000 square feet of floor area</li> </ul> </div> <form id="parking_communications" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <!-- /#business_type_communication --> <div id="business_type_education" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_lower_schools">Elementary and junior high schools</option> <option value="parking_high_schools">High schools</option> <option value="parking_colleges">Colleges and Universities</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_lower_schools"> <h3>Elementary and junior high schools</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each employee</li> </ul> </div> <form id="parking_lower_schools" class="parking-calculator"> <label> Number of employees: <input id="employees" name="employees" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_high_schools"> <h3>High schools</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each employee</li> <li>1 space for each 10 students</li> </ul> </div> <form id="parking_high_schools" class="parking-calculator"> <label> Number of employees: <input id="employees" name="employees" type="text"> </label> <label> Number of students: <input id="students" name="students" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_colleges"> <h3>Colleges and universities</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each employee</li> <li>1 space for each 3 students</li> </ul> </div> <form id="parking_colleges" class="parking-calculator"> <label> Number of employees: <input id="employees" name="employees" type="text"> </label> <label> Number of students: <input id="students" name="students" type="text"> </label> </form> </div> </div> <!-- /#business_type_education --> <div id="business_type_fitness" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_multi_program_fitness">Multi-program fitness facilities</option> <option value="parking_single_program_fitness">Single-program fitness facilities</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_multi_program_fitness"> <h3>Multi-program fitness facilities</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 100 square feet of floor area</li> <li>If floor space exceeds 15&#8218;000 square feet&#8218; an additional 10% of parking spaces required</li> </ul> </div> <form id="parking_multi_program_fitness" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_single_program_fitness"> <h3>Single-program fitness facilities</h3> This one is a little complicated. Look at each rule&#8218; and see if it applies to you. Each &#34;Calculate&#34; button will add to the total number of spaces at the bottom. Leave any field blank that doesn't apply to you. <div class="rules"> <h5>Rules:</h5> <ul> <li>Aerobics: 1 space for each 50 square feet of floor area</li> <li>Basketball &#38; volleyball: 1 space for each 3 persons of occupancy</li> <li>Lap pool: 2 spaces per lane</li> <li>Lap pool: 1 space for each 300 square feet of non-pool floor area (area that is not water)</li> <li>Weightlifting: 1 space for each 250 feet of floor area</li> <li>If total floor space exceeds 15&#8218;000 square feet&#8218; an additional 10% of parking spaces required</li> </ul> </div> <form id="parking_single_program_fitness" class="parking-calculator"> <label> Aerobics floor area: <input id="aerobics_area" name="aerobics_area" type="text"> </label> <label> Occupancy for both basketball &#38; volleyball areas: <input id="basketball_volleyball_occupancy" name="basketball_volleyball_occupancy" type="text"> </label> <label> Number of lanes in lap pools: <input id="pool_lanes" name="pool_lanes" type="text"> </label> <label> Lap pool floor area that is not water: <input id="pool_non_water_area" name="pool_non_water_area" type="text"> </label> <label> Weightlifting floor area: <input id="weights_area" name="weights_area" type="text"> </label> <label> Total floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> </div> <!-- /#business_type_fitness --> <div id="business_type_food" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_food">Restaurants&#8218; bars&#8218; other food service establishments&#8218; and nightclubs without live entertainment</option> <option value="parking_take_out">Restaurants with counter&#8218; take-out&#8218; or drive-in service</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_food"> <h3>Restaurants&#8218; bars&#8218; other food service establishments&#8218; and nightclubs without live entertainment</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 120 square feet of floor area</li> </ul> </div> <form id="parking_food" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_take_out"> <h3>Restaurants with counter&#8218; take-out&#8218; or drive-in service</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 120 square feet of floor area</li> <li>1 space for each 50 square feet of floor area devoted to counter/take-out service</li> </ul> </div> <form id="parking_take_out" class="parking-calculator"> <label> Total floor area: <input id="square_feet" name="square_feet" type="text"> </label> <label> Floor area devoted to counter/take-out: <input id="take_out_area" name="take_out_area" type="text"> </label> </form> </div> </div> <!-- /#business_type_food --> <div id="business_type_funeral" class="business-type-rule"> <h3>Funeral homes &#38; mortuaries</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 5 seats of the aggregate number of seats provided in all assembly rooms</li> </ul> </div> <form id="parking_funeral" class="parking-calculator"> <label> Total number of seats provided: <input id="seats" name="seats" type="text"> </label> </form> </div> <!-- /#business_type_funeral --> <div id="business_type_furn_repair" class="business-type-rule"> <h3>Furniture repair</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 500 square feet of floor area</li> </ul> </div> <form id="parking_furniture_repair" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <!-- /#business_type_furn_repair --> <div id="business_type_halls" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_halls_with_seats">Sports arenas&#8218; auditoriums&#8218; assembly halls&#8218; and meeting rooms (all with fixed seats)</option> <option value="parking_halls_no_seats">Dance and exhibition halls and assembly halls without fixed seats</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_halls_with_seats"> <h3>Sports arenas&#8218; auditoriums&#8218; assembly halls&#8218; and meeting rooms (all with fixed seats)</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 3.5 seats of maximum seating capacity</li> </ul> </div> <form id="parking_halls_with_seats" class="parking-calculator"> <label> Maximum seating capacity: <input id="seats" name="seats" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_halls_no_seats"> <h3>Dance and exhibition halls and assembly halls without fixed seats</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 3 persons of design occupancy load</li> <li>Excludes church assembly rooms in conjunction with auditoriums</li> </ul> </div> <form id="parking_halls_no_seats" class="parking-calculator"> <label> Design occupancy load: <input id="max_occupancy_load" name="max_occupancy_load" type="text"> </label> </form> </div> </div> <!-- /#business_type_halls --> <div id="business_type_household" class="business-type-rule"> <h3>Furniture &#38; appliance stores and household equipment</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 800 square feet of sales floor area</li> </ul> </div> <form id="parking_household" class="parking-calculator"> <label> Sales floor area: <input id="sales_area" name="sales_area" type="text"> </label> </form> </div> <!-- /#business_type_household --> <div id="business_type_laundry" class="business-type-rule"> <h3>Self-service laundry and dry cleaning establishments</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 200 square feet of floor area</li> </ul> </div> <form id="parking_laundry" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <!-- /#business_type_laundry --> <div id="business_type_lodging" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_community_care">Community care residential facilities</option> <option value="parking_hotels">Hotels and Motels</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_community_care"> <h3>Community care residential facilities</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 5 guests</li> <li>1 space for the manager</li> <li>1 space for each employee on the shift with the maximum number of personnel</li> </ul> </div> <form id="parking_community_care" class="parking-calculator"> <label> Number of guests: <input id="guests" name="guests" type="text"> </label> <label> Number of employees on busiest shift: <input id="employees" name="employees" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_hotels"> <h3>Hotels and Motels</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each unit intended for separate occupancy</li> <li>1 space for the resident owner or manager</li> </ul> </div> <form id="parking_hotels" class="parking-calculator"> <label> Number of units: <input id="hotel_units" name="hotel_units" type="text"> </label> </form> </div> </div> <!-- /#business_type_lodging --> <div id="business_type_medical" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_convalescent">Convalescent hospitals</option> <option value="parking_hospitals">Hospitals</option> <option value="parking_medical_offices">Medical and dental clinics and offices</option> <option value="parking_physical_therapy">Physical therapy</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_convalescent"> <h3>Convalescent hospitals</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 5 beds</li> <li>1 space for each employee on the shift with the maximum number of personnel</li> </ul> </div> <form id="parking_convalescent" class="parking-calculator"> <label> Number of beds: <input id="beds" name="beds" type="text"> </label> <label> Number of employees on busiest shift <input id="employees" name="employees" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_hospitals"> <h3>Hospitals</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each bed</li> <li>1 space for each employee on the shift with the maximum number of personnel</li> </ul> </div> <form id="parking_hospitals" class="parking-calculator"> <label> Number of beds: <input id="beds" name="beds" type="text"> </label> <label> Number of employees on busiest shift: <input id="employees" name="employees" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_medical_offices"> <h3>Medical and dental clinics and offices</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 200 square feet of floor area</li> </ul> </div> <form id="parking_medical_offices" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_physical_therapy"> <h3>Physical therapy</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space per 200 square feet of floor area</li> <li>1 space per 50 square feet of pool (water) area</li> </ul> </div> <form id="parking_physical_therapy" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> <label> Pool (water) area: <input id="pool_water_area" name="pool_water_area" type="text"> </label> </form> </div> </div> <!-- /#business_type_medical --> <div id="business_type_office" class="business-type-rule"> <h3>Business and professional offices</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 300 square feet floor area</li> <li>Excludes medical and dental offices</li> </ul> </div> <form id="parking_business_offices" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <!-- /#business_type_office --> <div id="business_type_plants" class="business-type-rule"> <h3>Manufacturing, bottling, and processing plants</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 500 square feet of floor area</li> </ul> </div> <form id="parking_plants" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <!-- /#business_type_plants--> <div id="business_type_recycle" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_recycling_independent">Independent recycling collection facilities</option> <option value="parking_recycling_conjunction">Recycling facilities in conjunction with other uses that provide required parking</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_recycling_independent"> <h3>Independent recycling collection facilities</h3> <div class="rules"> <ul> <li>Total: 2 spaces</li> </ul> </div> </div> <div class=business-sub-type-rule id="subtype_parking_recycling_conjunction"> <h3>Recycling facilities in conjunction with other uses that provide required parking</h3> <div class="rules"> <ul> <li>Total: No spaces!</li> </ul> </div> </div> </div> <!-- /#business_type_recycle --> <div id="business_type_research" class="business-type-rule"> <h3>Research &#38; development</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 325 square feet of floor area</li> <li>or 1 space for every 2 employees (maximum shift)&#8218; whichever is greater</li> </ul> </div> <form id="parking_research_development" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> <label> Number of employees on busiest shift: <input id="employees" name="employees" type="text"> </label> </form> </div> <!-- /#business_type_research --> <div id="business_type_retail" class="business-type-rule"> <h3>Retail stores, shops, service establishments, &#38; shopping centers</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 250 square feet of floor area</li> </ul> </div> <form id="parking_retail" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <!-- /#business_type_retail --> <div id="business_type_seniors" class="business-type-rule"> <form class="business_sub_type_calculator" > <label> Please select your specific business type below: <select class="business_subtype" name="business_subtype"> <option value="default">Choose one...</option> <option value="parking_boarding">Boarding homes for the aged</option> <option value="parking_institutions">Institutions for the aged</option> <option value="parking_nursing">Nursing homes</option> </select> </label> </form> <div class=business-sub-type-rule id="subtype_parking_boarding"> <h3>Boarding homes for the aged</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 5 beds</li> <li>1 space for each employee</li> </ul> </div> <form id="parking_boarding" class="parking-calculator"> <label> Number of beds: <input id="beds" name="beds" type="text"> </label> <label> Number of employees: <input id="employees" name="employees" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_institutions"> <h3>Institutions for the aged</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for every 5 guests</li> <li>1 space for each employee on the shift with the maximum number of personnel</li> </ul> </div> <form id="parking_institutions" class="parking-calculator"> <label> Number of guests: <input id="guests" name="guests" type="text"> </label> <label> Number of employees on busiest shift: <input id="employees" name="employees" type="text"> </label> </form> </div> <div class=business-sub-type-rule id="subtype_parking_nursing"> <h3>Nursing homes</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for every 5 guests</li> <li>1 space for the resident manager</li> <li>1 space for each employee on the shift with the maximum number of personnel</li> </ul> </div> <form id="parking_nursing" class="parking-calculator"> <label> Number of guests: <input id="guests" name="guests" type="text"> </label> <label> Number of employees on busiest shift: <input id="employees" name="employees" type="text"> </label> </form> </div> </div> <!-- /#business_type_seniors --> <div id="business_type_theaters" class="business-type-rule"> <h3>Theaters</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 3.5 seats for the first 350 seats</li> <li>1 space for each 5 additional seats</li> </ul> </div> <form id="parking_theaters" class="parking-calculator"> <label> Number of seats: <input id="seats" name="seats" type="text"> </label> </form> </div> <!-- /#business_type_theaters --> <div id="business_type_warehouses" class="business-type-rule"> <h3>Wholesale, warehouses, and service &#38; maintenance centers</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 1&#8218;000 square feet of floor area</li> </ul> </div> <form id="parking_warehouses" class="parking-calculator"> <label> Floor area: <input id="square_feet" name="square_feet" type="text"> </label> </form> </div> <!-- /#business_type_warehouses --> <div id="business_type_worship" class="business-type-rule"> <h3>Houses of worship</h3> <div class="rules"> <h5>Rules:</h5> <ul> <li>1 space for each 3.5 seats in the sanctuary</li> </ul> </div> <form id="parking_houses_of_worship" class="parking-calculator"> <label> Number of seats in sanctuary: <input id="seats" name="seats" type="text"> </label> </form> </div> <!-- /#business_type_worship --> <input type="submit" value="Calculate" class="calc_btn" style="margin: 1em;"> <br> <div id="parking_spaces"></div> </div> <!-- @condition parking non-downtown -->
{ "content_hash": "35a9c51dbb8e4594e241993e2f20b0ae", "timestamp": "", "source": "github", "line_count": 1055, "max_line_length": 365, "avg_line_length": 33.21042654028436, "alnum_prop": 0.5712532465679139, "repo_name": "codeforamerica/opencounter", "id": "d3704d4aa685a7ec172233b00f4f0fd95bbf8d78", "size": "35037", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/templates/fees/parking-non-downtown.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "5689" }, { "name": "HTML", "bytes": "291800" }, { "name": "JavaScript", "bytes": "391224" }, { "name": "Ruby", "bytes": "134554" }, { "name": "Shell", "bytes": "2047" } ], "symlink_target": "" }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.sistemaexperto.logic; import java.util.ArrayList; import java.util.TreeSet; import sun.reflect.generics.tree.Tree; /** * * @author Cesar */ public class Necesidades { private TreeSet<Necesidad> necesidades; private String marca; public Necesidades(String marca) { this.marca=marca; necesidades = new TreeSet<>(); } public void addNecesidad(Necesidad necesidad){ necesidades.add(necesidad); } /** * @return the necesidades */ public TreeSet<Necesidad> getNecesidades() { return necesidades; } /** * @param necesidades the necesidades to set */ public void setNecesidades(TreeSet<Necesidad> necesidades) { this.necesidades = necesidades; } /** * @return the marca */ public String getMarca() { return marca; } /** * @param marca the marca to set */ public void setMarca(String marca) { this.marca = marca; } }
{ "content_hash": "f404211456bf799a07e914ce5cbe2dd4", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 64, "avg_line_length": 17, "alnum_prop": 0.5805626598465473, "repo_name": "cams2692/Sistema-Experto", "id": "7f465fa9ffa2fae498a13d70c131e597762ff0a8", "size": "1173", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sistemaexperto/src/com/sistemaexperto/logic/Necesidades.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "43389" } ], "symlink_target": "" }
CREATE TABLE IACUC_PROTO_CORRESPONDENCE ( ID NUMBER(12), PROTOCOL_NUMBER VARCHAR2(20) NOT NULL, SEQUENCE_NUMBER NUMBER(4) NOT NULL, ACTION_ID NUMBER(6) NOT NULL, PROTOCOL_ID NUMBER(12) NOT NULL, ACTION_ID_FK NUMBER(12) NOT NULL, PROTO_CORRESP_TYPE_CODE VARCHAR2(3) NOT NULL, FINAL_FLAG CHAR(1) NOT NULL, UPDATE_TIMESTAMP DATE, UPDATE_USER VARCHAR2(60), VER_NBR NUMBER(8) default 1 NOT NULL, CORRESPONDENCE BLOB NOT NULL, OBJ_ID VARCHAR2(36) NOT NULL, CREATE_TIMESTAMP DATE, CREATE_USER VARCHAR2(60), FINAL_FLAG_TIMESTAMP DATE ) / ALTER TABLE IACUC_PROTO_CORRESPONDENCE ADD CONSTRAINT IACUC_PROTO_CORRESPONDENCEP1 PRIMARY KEY (ID) /
{ "content_hash": "a1afb6f22803c7193a6e2f4889cb588d", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 49, "avg_line_length": 33.81818181818182, "alnum_prop": 0.6626344086021505, "repo_name": "blackcathacker/kc.preclean", "id": "e8c4ce2412c0ca96fa191932dd894fefca2beade", "size": "744", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "coeus-db/coeus-db-sql/src/main/resources/org/kuali/coeus/coeus-sql/current/5.0.1/tables/KC_TBL_IACUC_PROTO_CORRESPONDENCE.sql", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "96034" }, { "name": "Java", "bytes": "27623677" }, { "name": "JavaScript", "bytes": "749782" }, { "name": "Perl", "bytes": "1278" }, { "name": "Scheme", "bytes": "8283377" }, { "name": "Shell", "bytes": "69314" }, { "name": "XSLT", "bytes": "20298494" } ], "symlink_target": "" }
jQuery(document).ready(function(){ $("#cancelar").click(function(){ url = base_url+"index.php/inicio/index"; location.href = url; }); $("#enviar").click(function(){ dataString = $('#frmContrasena').serialize(); url = base_url+"index.php/inicio/contrasena_enviar"; $.post(url,dataString,function(data){ alert("Se envio un mensaje a su correo"); url = base_url+"index.php/inicio/index"; location.href = url; }); }); });
{ "content_hash": "7f5032342cd82d275ee472816e9318dc", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 60, "avg_line_length": 33.1875, "alnum_prop": 0.5386064030131826, "repo_name": "ccjuantrujillo/cepreadm", "id": "650502517303a697846b6f199640b4b645e231be", "size": "531", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "js/seguridad/contrasena.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "37793" }, { "name": "HTML", "bytes": "8639086" }, { "name": "JavaScript", "bytes": "388568" }, { "name": "PHP", "bytes": "2867186" }, { "name": "TSQL", "bytes": "18848728" } ], "symlink_target": "" }
define([ "./dom", "./crud", "./schema" ], function ( dom, crud, schema ) { "use strict"; //this maps CRUD operations to link methods var renderer, actions = { "GET": function (link, links, data, container) { renderer.render(link.href, container); }, "POST": function (link, links, data, container) { console.log("rendering create form for " + link.rel); var s = schema.load(link.schema.$ref), selfLink = schema.find(links, "schema/rel/self"), backLink; link.schema = s; if (selfLink) { backLink = { rel: "schema/rel/up", method: selfLink.method, href: selfLink.href, title: "Back" }; } createForm(link, backLink, data, container); }, "PUT": function (link, links, data, container) { console.log("rendering edit form for " + link.rel); var s = schema.load(link.schema.$ref), selfLink = schema.find(links, "schema/rel/self"), backLink; link.schema = s; if (selfLink) { backLink = { rel: "schema/rel/up", method: selfLink.method, href: selfLink.href, title: "Back" }; } createForm(link, backLink, data, container); }, "DELETE": function (link, links, data, container) { crud.exec(link, null, function (response) { var parentLink = schema.find(links, "schema/rel/collection"); renderer.render(parentLink.href, container); }); } }, //properties on the response objects that don't have direct value to the user hideProps = { "uri": true }; function createForm(link, backLink, item, container) { console.log("creating form for " + link.rel); dom.empty(container); var header = dom.create("header", {innerHTML: link.title.toUpperCase()}, container), schema = link.schema, properties = schema.properties, keys = Object.keys(properties), elements = {}; keys.sort(); keys.forEach(function (key) { var value = properties[key], label, element; if (!hideProps[key]) { label = dom.create("label", {innerHTML: key}, container); element = dom.create("input", { type: "text", className: "item-" + key }); if (item && item[key]) { element.value = item[key]; } if (value.readonly) { label.style.display = "none"; element.style.display = "none"; } elements[key] = element; dom.append(container, element); dom.create("br", null, container); } else { console.log(key + " is hidden or readonly"); } }); //create the submit button dom.create("button", { innerHTML: "Submit", onclick: function (e) { e.target.disabled = true; var data = {}; Object.keys(elements).forEach(function (key) { var element = elements[key]; data[key] = element.value; }); crud.exec(link, data, function (response) { console.log("received successful edit"); //go back to the previous view now that the form submission is complete renderer.render(backLink.href, container); }); } }, container); renderLinks({ links: [backLink] }, container); breadcrumb(link.href, container); } function addItem(item, table, container, includeLinkCell) { console.log("adding item " + item.uri); var keys = Object.keys(item), tr = dom.create("tr"), uri, linkcell, a; keys.sort(); keys.forEach(function (key) { var value = item[key], td; if (key === "uri") { uri = value; } if (!hideProps[key]) { td = dom.create("td", {innerHTML: value, className: "item-" + key}, tr); } }); //special cell to hold the object link if (includeLinkCell) { linkcell = dom.create("td", {className: "link-cell"}, tr); a = dom.create("a", { href: "#", innerHTML: "view", title: uri, className: "item-uri", onclick: function () { renderer.render(uri, container); } }, linkcell); } dom.append(table, tr); } function tableStart(item, container, includeLinkCell) { //TODO: use the response schema to determine the table template, instead of grabbing an item from the list var keys = Object.keys(item), table = dom.create("table"), tr = dom.create("tr", null, table); keys.sort(); keys.forEach(function (key) { if (!hideProps[key]) { dom.create("th", {innerHTML: key}, tr); } }); if (includeLinkCell) { dom.create("th", {innerHTML: "details", className: "link-cell"}, tr); } dom.append(container, table); return table; } function renderItem(response, container) { var header = dom.create("header", {innerHTML: "ITEM"}, container), data = response.data, table; if (data) { table = tableStart(data, container, false); addItem(data, table, container); } else { dom.create("p", {innerHTML: "(No item details)"}, container); } } function renderItems(response, container) { var header = dom.create("header", {innerHTML: "ITEMS"}, container), data = response.data, items = data.items, table; if (items.length > 0) { table = tableStart(items[0], container, true); items.forEach(function (item) { addItem(item, table, container, true); }); } else { dom.create("p", {innerHTML: "(No items in list)"}, container); } } function renderLinks(response, container) { var header = dom.create("header", {innerHTML: "LINKS"}, container), links = response.links; links.forEach(function (link) { var rel = link.rel, method = link.method || "GET", button, text = link.title; //only display links that have been given a title, so the schema can control the presentation if (text) { button = dom.create("button", { innerHTML: text, onclick: function () { console.log("link clicked! " + rel + " | " + method); var action = actions[link.method]; action(link, links, response.data, container); } }, container); } }); } function breadcrumb(uri, container) { var splits = uri.split("/"), split, full = "", footnote = dom.create("footnote", {innerHTML: "You are here: "}), i, l, a, text; function click(e) { renderer.render(e.target.tag, container); } for (i = 0, l = splits.length; i < l; i += 1) { split = splits[i]; full += split; if (i < l - 1) { full += "/"; } a = dom.create("a", { innerHTML: split, href: "#", tag: full, onclick: click }, footnote); if (l > 1 && i < l - 1) { text = dom.create("text", {innerHTML: "&nbsp;/&nbsp;"}, footnote); } } dom.append(container, footnote); } renderer = { render: function (uri, container) { dom.empty(container); crud.exec({href: uri}, function (response) { console.log("got response to render", response); if (response.data) { if (response.data.items) { renderItems(response, container); } else { renderItem(response, container); } } renderLinks(response, container); breadcrumb(uri, container); }); } }; return renderer; });
{ "content_hash": "0cdb782ea250fd712aa7fd6e03cb20a8", "timestamp": "", "source": "github", "line_count": 338, "max_line_length": 114, "avg_line_length": 27.7396449704142, "alnum_prop": 0.4481655290102389, "repo_name": "atsid/breadboard", "id": "934a7445e269f5c96c4ba9897ac9b2802f3fb31a", "size": "9376", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/client/native/js/renderer.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1041" }, { "name": "HTML", "bytes": "959" }, { "name": "JavaScript", "bytes": "55795" } ], "symlink_target": "" }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Dragon.Configuration")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Dragon.Configuration")] [assembly: AssemblyCopyright("Copyright © 2015")] [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("31e7f743-3215-4d9e-84b4-ca4e9b38aa7e")] // 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": "a4a021f2ccdc4e33de5d4f9337b862ff", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 84, "avg_line_length": 39.25, "alnum_prop": 0.7466383581033262, "repo_name": "aduggleby/dragon", "id": "074685502863a384a6de92bdb7d4ec7e2ec9742a", "size": "1416", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "proj/CPR/src/Dragon.Configuration/Properties/AssemblyInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "113" }, { "name": "Batchfile", "bytes": "4209" }, { "name": "C#", "bytes": "826681" }, { "name": "CSS", "bytes": "513" }, { "name": "HTML", "bytes": "5127" }, { "name": "JavaScript", "bytes": "16833" }, { "name": "PowerShell", "bytes": "1875" } ], "symlink_target": "" }
package github import ( "encoding/json" "errors" "fmt" "net/http" "strings" "github.com/bitrise-io/bitrise-webhooks/bitriseapi" hookCommon "github.com/bitrise-io/bitrise-webhooks/service/hook/common" "github.com/bitrise-io/go-utils/sliceutil" ) // -------------------------- // --- Webhook Data Model --- // CommitModel ... type CommitModel struct { Distinct bool `json:"distinct"` CommitHash string `json:"id"` CommitMessage string `json:"message"` } // PushEventModel ... type PushEventModel struct { Ref string `json:"ref"` Deleted bool `json:"deleted"` HeadCommit CommitModel `json:"head_commit"` } // RepoInfoModel ... type RepoInfoModel struct { Private bool `json:"private"` // Private git clone URL, used with SSH key SSHURL string `json:"ssh_url"` // Public git clone url CloneURL string `json:"clone_url"` } // BranchInfoModel ... type BranchInfoModel struct { Ref string `json:"ref"` CommitHash string `json:"sha"` Repo RepoInfoModel `json:"repo"` } // PullRequestInfoModel ... type PullRequestInfoModel struct { // source brach for the pull request HeadBranchInfo BranchInfoModel `json:"head"` // destination brach for the pull request BaseBranchInfo BranchInfoModel `json:"base"` Title string `json:"title"` Body string `json:"body"` Merged bool `json:"merged"` Mergeable *bool `json:"mergeable"` } // PullRequestChangeFromItemModel ... type PullRequestChangeFromItemModel struct { From string `json:"from"` } // PullRequestChangesInfoModel ... type PullRequestChangesInfoModel struct { Title PullRequestChangeFromItemModel `json:"title"` Body PullRequestChangeFromItemModel `json:"body"` Base interface{} `json:"base"` } // PullRequestEventModel ... type PullRequestEventModel struct { Action string `json:"action"` PullRequestID int `json:"number"` PullRequestInfo PullRequestInfoModel `json:"pull_request"` Changes PullRequestChangesInfoModel `json:"changes"` } // --------------------------------------- // --- Webhook Provider Implementation --- // HookProvider ... type HookProvider struct{} func transformPushEvent(pushEvent PushEventModel) hookCommon.TransformResultModel { if pushEvent.Deleted { return hookCommon.TransformResultModel{ Error: errors.New("This is a 'Deleted' event, no build can be started"), ShouldSkip: true, } } headCommit := pushEvent.HeadCommit if strings.HasPrefix(pushEvent.Ref, "refs/heads/") { // code push branch := strings.TrimPrefix(pushEvent.Ref, "refs/heads/") if len(headCommit.CommitHash) == 0 { return hookCommon.TransformResultModel{ Error: fmt.Errorf("Missing commit hash"), } } return hookCommon.TransformResultModel{ TriggerAPIParams: []bitriseapi.TriggerAPIParamsModel{ { BuildParams: bitriseapi.BuildParamsModel{ Branch: branch, CommitHash: headCommit.CommitHash, CommitMessage: headCommit.CommitMessage, }, }, }, } } else if strings.HasPrefix(pushEvent.Ref, "refs/tags/") { // tag push tag := strings.TrimPrefix(pushEvent.Ref, "refs/tags/") if len(headCommit.CommitHash) == 0 { return hookCommon.TransformResultModel{ Error: fmt.Errorf("Missing commit hash"), } } return hookCommon.TransformResultModel{ TriggerAPIParams: []bitriseapi.TriggerAPIParamsModel{ { BuildParams: bitriseapi.BuildParamsModel{ Tag: tag, CommitHash: headCommit.CommitHash, CommitMessage: headCommit.CommitMessage, }, }, }, } } return hookCommon.TransformResultModel{ Error: fmt.Errorf("Ref (%s) is not a head nor a tag ref", pushEvent.Ref), ShouldSkip: true, } } func isAcceptPullRequestAction(prAction string) bool { return sliceutil.IsStringInSlice(prAction, []string{"opened", "reopened", "synchronize", "edited"}) } func transformPullRequestEvent(pullRequest PullRequestEventModel) hookCommon.TransformResultModel { if pullRequest.Action == "" { return hookCommon.TransformResultModel{ Error: errors.New("No Pull Request action specified"), ShouldSkip: true, } } if !isAcceptPullRequestAction(pullRequest.Action) { return hookCommon.TransformResultModel{ Error: fmt.Errorf("Pull Request action doesn't require a build: %s", pullRequest.Action), ShouldSkip: true, } } if pullRequest.Action == "edited" { // skip it if only title / description changed, and the previous pattern did not include a [skip ci] pattern if pullRequest.Changes.Base == nil { if !hookCommon.IsSkipBuildByCommitMessage(pullRequest.Changes.Title.From) && !hookCommon.IsSkipBuildByCommitMessage(pullRequest.Changes.Body.From) { return hookCommon.TransformResultModel{ Error: errors.New("Pull Request edit doesn't require a build: only title and/or description was changed, and previous one was not skipped"), ShouldSkip: true, } } } } if pullRequest.PullRequestInfo.Merged { return hookCommon.TransformResultModel{ Error: errors.New("Pull Request already merged"), ShouldSkip: true, } } if pullRequest.PullRequestInfo.Mergeable != nil && *pullRequest.PullRequestInfo.Mergeable == false { return hookCommon.TransformResultModel{ Error: errors.New("Pull Request is not mergeable"), ShouldSkip: true, } } commitMsg := pullRequest.PullRequestInfo.Title if pullRequest.PullRequestInfo.Body != "" { commitMsg = fmt.Sprintf("%s\n\n%s", commitMsg, pullRequest.PullRequestInfo.Body) } return hookCommon.TransformResultModel{ TriggerAPIParams: []bitriseapi.TriggerAPIParamsModel{ { BuildParams: bitriseapi.BuildParamsModel{ CommitMessage: commitMsg, CommitHash: pullRequest.PullRequestInfo.HeadBranchInfo.CommitHash, Branch: pullRequest.PullRequestInfo.HeadBranchInfo.Ref, BranchDest: pullRequest.PullRequestInfo.BaseBranchInfo.Ref, PullRequestID: &pullRequest.PullRequestID, PullRequestRepositoryURL: pullRequest.PullRequestInfo.HeadBranchInfo.getRepositoryURL(), PullRequestMergeBranch: fmt.Sprintf("pull/%d/merge", pullRequest.PullRequestID), PullRequestHeadBranch: fmt.Sprintf("pull/%d/head", pullRequest.PullRequestID), }, }, }, } } func detectContentTypeAndEventID(header http.Header) (string, string, error) { contentType := header.Get("Content-Type") if contentType == "" { return "", "", errors.New("No Content-Type Header found") } ghEvent := header.Get("X-Github-Event") if ghEvent == "" { return "", "", errors.New("No X-Github-Event Header found") } return contentType, ghEvent, nil } // TransformRequest ... func (hp HookProvider) TransformRequest(r *http.Request) hookCommon.TransformResultModel { contentType, ghEvent, err := detectContentTypeAndEventID(r.Header) if err != nil { return hookCommon.TransformResultModel{ Error: fmt.Errorf("Issue with Headers: %s", err), } } if contentType != hookCommon.ContentTypeApplicationJSON && contentType != hookCommon.ContentTypeApplicationXWWWFormURLEncoded { return hookCommon.TransformResultModel{ Error: fmt.Errorf("Content-Type is not supported: %s", contentType), } } if ghEvent == "ping" { return hookCommon.TransformResultModel{ Error: fmt.Errorf("Ping event received"), ShouldSkip: true, } } if ghEvent != "push" && ghEvent != "pull_request" { // Unsupported GitHub Event return hookCommon.TransformResultModel{ Error: fmt.Errorf("Unsupported GitHub Webhook event: %s", ghEvent), } } if r.Body == nil { return hookCommon.TransformResultModel{ Error: fmt.Errorf("Failed to read content of request body: no or empty request body"), } } if ghEvent == "push" { // push (code & tag) var pushEvent PushEventModel if contentType == hookCommon.ContentTypeApplicationJSON { if err := json.NewDecoder(r.Body).Decode(&pushEvent); err != nil { return hookCommon.TransformResultModel{Error: fmt.Errorf("Failed to parse request body: %s", err)} } } else if contentType == hookCommon.ContentTypeApplicationXWWWFormURLEncoded { payloadValue := r.PostFormValue("payload") if payloadValue == "" { return hookCommon.TransformResultModel{Error: fmt.Errorf("Failed to parse request body: empty payload")} } if err := json.NewDecoder(strings.NewReader(payloadValue)).Decode(&pushEvent); err != nil { return hookCommon.TransformResultModel{Error: fmt.Errorf("Failed to parse payload: %s", err)} } } else { return hookCommon.TransformResultModel{ Error: fmt.Errorf("Unsupported Content-Type: %s", contentType), } } return transformPushEvent(pushEvent) } else if ghEvent == "pull_request" { var pullRequestEvent PullRequestEventModel if contentType == hookCommon.ContentTypeApplicationJSON { if err := json.NewDecoder(r.Body).Decode(&pullRequestEvent); err != nil { return hookCommon.TransformResultModel{Error: fmt.Errorf("Failed to parse request body as JSON: %s", err)} } } else if contentType == hookCommon.ContentTypeApplicationXWWWFormURLEncoded { payloadValue := r.PostFormValue("payload") if payloadValue == "" { return hookCommon.TransformResultModel{Error: fmt.Errorf("Failed to parse request body: empty payload")} } if err := json.NewDecoder(strings.NewReader(payloadValue)).Decode(&pullRequestEvent); err != nil { return hookCommon.TransformResultModel{Error: fmt.Errorf("Failed to parse payload: %s", err)} } } else { return hookCommon.TransformResultModel{ Error: fmt.Errorf("Unsupported Content-Type: %s", contentType), } } return transformPullRequestEvent(pullRequestEvent) } return hookCommon.TransformResultModel{ Error: fmt.Errorf("Unsupported GitHub event type: %s", ghEvent), } } // returns the repository clone URL depending on the publicity of the project func (branchInfoModel BranchInfoModel) getRepositoryURL() string { if branchInfoModel.Repo.Private { return branchInfoModel.Repo.SSHURL } return branchInfoModel.Repo.CloneURL }
{ "content_hash": "8307588ad0758cccce4544c126b1f3e2", "timestamp": "", "source": "github", "line_count": 313, "max_line_length": 151, "avg_line_length": 32.626198083067095, "alnum_prop": 0.7018213866039953, "repo_name": "crrobinson14/bitrise-webhooks", "id": "2ba8d2e5818615faebc74bc42d6eec03c168dab6", "size": "10212", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "service/hook/github/github.go", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "219927" }, { "name": "Shell", "bytes": "408" } ], "symlink_target": "" }
import datetime import unittest from freezegun import freeze_time from airflow import settings from airflow.models import DagRun, TaskInstance from airflow.models.dag import DAG from airflow.operators.dummy import DummyOperator from airflow.operators.latest_only import LatestOnlyOperator from airflow.utils import timezone from airflow.utils.session import create_session from airflow.utils.state import State from airflow.utils.trigger_rule import TriggerRule from airflow.utils.types import DagRunType DEFAULT_DATE = timezone.datetime(2016, 1, 1) END_DATE = timezone.datetime(2016, 1, 2) INTERVAL = datetime.timedelta(hours=12) FROZEN_NOW = timezone.datetime(2016, 1, 2, 12, 1, 1) def get_task_instances(task_id): session = settings.Session() return ( session.query(TaskInstance) .join(TaskInstance.dag_run) .filter(TaskInstance.task_id == task_id) .order_by(DagRun.execution_date) .all() ) class TestLatestOnlyOperator(unittest.TestCase): def setUp(self): super().setUp() self.dag = DAG( 'test_dag', default_args={'owner': 'airflow', 'start_date': DEFAULT_DATE}, schedule_interval=INTERVAL, ) with create_session() as session: session.query(DagRun).delete() session.query(TaskInstance).delete() freezer = freeze_time(FROZEN_NOW) freezer.start() self.addCleanup(freezer.stop) def test_run(self): task = LatestOnlyOperator(task_id='latest', dag=self.dag) task.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE) def test_skipping_non_latest(self): latest_task = LatestOnlyOperator(task_id='latest', dag=self.dag) downstream_task = DummyOperator(task_id='downstream', dag=self.dag) downstream_task2 = DummyOperator(task_id='downstream_2', dag=self.dag) downstream_task3 = DummyOperator( task_id='downstream_3', trigger_rule=TriggerRule.NONE_FAILED, dag=self.dag ) downstream_task.set_upstream(latest_task) downstream_task2.set_upstream(downstream_task) downstream_task3.set_upstream(downstream_task) self.dag.create_dagrun( run_type=DagRunType.SCHEDULED, start_date=timezone.utcnow(), execution_date=DEFAULT_DATE, state=State.RUNNING, ) self.dag.create_dagrun( run_type=DagRunType.SCHEDULED, start_date=timezone.utcnow(), execution_date=timezone.datetime(2016, 1, 1, 12), state=State.RUNNING, ) self.dag.create_dagrun( run_type=DagRunType.SCHEDULED, start_date=timezone.utcnow(), execution_date=END_DATE, state=State.RUNNING, ) latest_task.run(start_date=DEFAULT_DATE, end_date=END_DATE) downstream_task.run(start_date=DEFAULT_DATE, end_date=END_DATE) downstream_task2.run(start_date=DEFAULT_DATE, end_date=END_DATE) downstream_task3.run(start_date=DEFAULT_DATE, end_date=END_DATE) latest_instances = get_task_instances('latest') exec_date_to_latest_state = {ti.execution_date: ti.state for ti in latest_instances} assert { timezone.datetime(2016, 1, 1): 'success', timezone.datetime(2016, 1, 1, 12): 'success', timezone.datetime(2016, 1, 2): 'success', } == exec_date_to_latest_state downstream_instances = get_task_instances('downstream') exec_date_to_downstream_state = {ti.execution_date: ti.state for ti in downstream_instances} assert { timezone.datetime(2016, 1, 1): 'skipped', timezone.datetime(2016, 1, 1, 12): 'skipped', timezone.datetime(2016, 1, 2): 'success', } == exec_date_to_downstream_state downstream_instances = get_task_instances('downstream_2') exec_date_to_downstream_state = {ti.execution_date: ti.state for ti in downstream_instances} assert { timezone.datetime(2016, 1, 1): None, timezone.datetime(2016, 1, 1, 12): None, timezone.datetime(2016, 1, 2): 'success', } == exec_date_to_downstream_state downstream_instances = get_task_instances('downstream_3') exec_date_to_downstream_state = {ti.execution_date: ti.state for ti in downstream_instances} assert { timezone.datetime(2016, 1, 1): 'success', timezone.datetime(2016, 1, 1, 12): 'success', timezone.datetime(2016, 1, 2): 'success', } == exec_date_to_downstream_state def test_not_skipping_external(self): latest_task = LatestOnlyOperator(task_id='latest', dag=self.dag) downstream_task = DummyOperator(task_id='downstream', dag=self.dag) downstream_task2 = DummyOperator(task_id='downstream_2', dag=self.dag) downstream_task.set_upstream(latest_task) downstream_task2.set_upstream(downstream_task) self.dag.create_dagrun( run_type=DagRunType.MANUAL, start_date=timezone.utcnow(), execution_date=DEFAULT_DATE, state=State.RUNNING, external_trigger=True, ) self.dag.create_dagrun( run_type=DagRunType.MANUAL, start_date=timezone.utcnow(), execution_date=timezone.datetime(2016, 1, 1, 12), state=State.RUNNING, external_trigger=True, ) self.dag.create_dagrun( run_type=DagRunType.MANUAL, start_date=timezone.utcnow(), execution_date=END_DATE, state=State.RUNNING, external_trigger=True, ) latest_task.run(start_date=DEFAULT_DATE, end_date=END_DATE) downstream_task.run(start_date=DEFAULT_DATE, end_date=END_DATE) downstream_task2.run(start_date=DEFAULT_DATE, end_date=END_DATE) latest_instances = get_task_instances('latest') exec_date_to_latest_state = {ti.execution_date: ti.state for ti in latest_instances} assert { timezone.datetime(2016, 1, 1): 'success', timezone.datetime(2016, 1, 1, 12): 'success', timezone.datetime(2016, 1, 2): 'success', } == exec_date_to_latest_state downstream_instances = get_task_instances('downstream') exec_date_to_downstream_state = {ti.execution_date: ti.state for ti in downstream_instances} assert { timezone.datetime(2016, 1, 1): 'success', timezone.datetime(2016, 1, 1, 12): 'success', timezone.datetime(2016, 1, 2): 'success', } == exec_date_to_downstream_state downstream_instances = get_task_instances('downstream_2') exec_date_to_downstream_state = {ti.execution_date: ti.state for ti in downstream_instances} assert { timezone.datetime(2016, 1, 1): 'success', timezone.datetime(2016, 1, 1, 12): 'success', timezone.datetime(2016, 1, 2): 'success', } == exec_date_to_downstream_state
{ "content_hash": "7711710f967efbef657e017fa55cf8a5", "timestamp": "", "source": "github", "line_count": 181, "max_line_length": 100, "avg_line_length": 39.24309392265194, "alnum_prop": 0.6283260594115163, "repo_name": "apache/incubator-airflow", "id": "90714afb71fb30a3a525cd0771b372f0d35ef9b4", "size": "7891", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "tests/operators/test_latest_only_operator.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "69070" }, { "name": "Dockerfile", "bytes": "2001" }, { "name": "HTML", "bytes": "283783" }, { "name": "JavaScript", "bytes": "1387552" }, { "name": "Mako", "bytes": "1284" }, { "name": "Python", "bytes": "5482822" }, { "name": "Shell", "bytes": "40957" } ], "symlink_target": "" }
package monitor import ( "context" "github.com/google/gapid/test/robot/subject" ) // Subject is the in memory representation/wrapper for a subject.Subject type Subject struct { subject.Subject } // Subjects is the type that manages a set of Subject objects. type Subjects struct { entries []*Subject } // All returns the complete set of Subject objects we have seen so far. func (s *Subjects) All() []*Subject { return s.entries } // Get returns the Subject which has the given Id, returns nil if such a // Subject is not found. func (s *Subjects) Get(id string) *Subject { for _, subj := range s.All() { if subj.Id == id { return subj } } return nil } func (o *DataOwner) updateSubject(ctx context.Context, subj *subject.Subject) error { o.Write(func(data *Data) { for i, e := range data.Subjects.entries { if subj.Id == e.Id { data.Subjects.entries[i].Subject = *subj return } } data.Subjects.entries = append(data.Subjects.entries, &Subject{Subject: *subj}) }) return nil }
{ "content_hash": "5d7200b03958489dee6dddfd24a6c071", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 85, "avg_line_length": 22.217391304347824, "alnum_prop": 0.6908023483365949, "repo_name": "Qining/gapid", "id": "069a5ced2431f6fa5118d15604d53aea418cd68f", "size": "1616", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "test/robot/monitor/subject.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "7588" }, { "name": "C", "bytes": "271033" }, { "name": "C++", "bytes": "1412825" }, { "name": "CSS", "bytes": "1154" }, { "name": "GLSL", "bytes": "24812" }, { "name": "Go", "bytes": "6351944" }, { "name": "HTML", "bytes": "128593" }, { "name": "Java", "bytes": "1269337" }, { "name": "JavaScript", "bytes": "31051" }, { "name": "Objective-C", "bytes": "1346" }, { "name": "Objective-C++", "bytes": "12619" }, { "name": "Python", "bytes": "485394" }, { "name": "Shell", "bytes": "24139" }, { "name": "Smarty", "bytes": "3202" } ], "symlink_target": "" }
using System; namespace BAP.Loader.PE { /// <summary> /// The Characteristics field contains flags that indicate attributes of the object or image file. /// The following flags are currently defined. /// </summary> [Flags] public enum IMAGE_FILE_Characteristics : ushort { /// <summary> /// Image only, Windows CE, and Windows NT® and later. This indicates that the file does not contain base relocations and must therefore be loaded at its preferred base address. If the base address is not available, the loader reports an error. The default behavior of the linker is to strip base relocations from executable (EXE) files. /// </summary> IMAGE_FILE_RELOCS_STRIPPED = 0x0001, /// <summary> /// Image only. This indicates that the image file is valid and can be run. If this flag is not set, it indicates a linker error. /// </summary> IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002, /// <summary> /// COFF line numbers have been removed. This flag is deprecated and should be zero. /// </summary> IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004, /// <summary> /// COFF symbol table entries for local symbols have been removed. This flag is deprecated and should be zero. /// </summary> IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008, /// <summary> /// Obsolete. Aggressively trim working set. This flag is deprecated for Windows 2000 and later and must be zero. /// </summary> IMAGE_FILE_AGGRESSIVE_WS_TRIM = 0x0010, /// <summary> /// Application can handle > 2 GB addresses. /// </summary> IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020, /// <summary> /// This flag is reserved for future use. /// </summary> IMAGE_FILE_0x0040 = 0x0040, /// <summary> /// Little endian: the least significant bit (LSB) precedes the most significant bit (MSB) in memory. This flag is deprecated and should be zero. /// </summary> IMAGE_FILE_BYTES_REVERSED_LO = 0x0080, /// <summary> /// Machine is based on a 32-bit-word architecture. /// </summary> IMAGE_FILE_32BIT_MACHINE = 0x0100, /// <summary> /// Debugging information is removed from the image file. /// </summary> IMAGE_FILE_DEBUG_STRIPPED = 0x0200, /// <summary> /// If the image is on removable media, fully load it and copy it to the swap file. /// </summary> IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400, /// <summary> /// If the image is on network media, fully load it and copy it to the swap file. /// </summary> IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800, /// <summary> /// The image file is a system file, not a user program. /// </summary> IMAGE_FILE_SYSTEM = 0x1000, /// <summary> /// The image file is a dynamic-link library (DLL). Such files are considered executable files for almost all purposes, although they cannot be directly run. /// </summary> IMAGE_FILE_DLL = 0x2000, /// <summary> /// The file should be run only on a uniprocessor machine. /// </summary> IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000, /// <summary> /// Big endian: the MSB precedes the LSB in memory. This flag is deprecated and should be zero. /// </summary> IMAGE_FILE_BYTES_REVERSED_HI = 0x8000, } }
{ "content_hash": "1227801969dbb5823b01bb9f5fce904c", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 339, "avg_line_length": 34.3936170212766, "alnum_prop": 0.663161150634086, "repo_name": "binsys/bap", "id": "c0baf9725d8fff3adfe610b8c6e719cb41c90863", "size": "3236", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Code/BAP/BAP.Loader.PE/IMAGE_FILE_Characteristics.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "118959" }, { "name": "C++", "bytes": "736" }, { "name": "Objective-C", "bytes": "236" } ], "symlink_target": "" }
#include <numeric> #include <vector> #include "webrtc/base/array_view.h" #include "webrtc/base/random.h" #include "webrtc/modules/audio_processing/audio_buffer.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/modules/audio_processing/residual_echo_detector.h" #include "webrtc/modules/audio_processing/test/audio_buffer_tools.h" #include "webrtc/modules/audio_processing/test/performance_timer.h" #include "webrtc/modules/audio_processing/test/simulator_buffers.h" #include "webrtc/system_wrappers/include/clock.h" #include "webrtc/test/gtest.h" #include "webrtc/test/testsupport/perf_test.h" namespace webrtc { namespace { constexpr size_t kNumFramesToProcess = 20000; constexpr size_t kNumFramesToProcessStandalone = 50 * kNumFramesToProcess; constexpr size_t kProcessingBatchSize = 200; constexpr size_t kProcessingBatchSizeStandalone = 50 * kProcessingBatchSize; constexpr size_t kNumberOfWarmupMeasurements = (kNumFramesToProcess / kProcessingBatchSize) / 2; constexpr size_t kNumberOfWarmupMeasurementsStandalone = (kNumFramesToProcessStandalone / kProcessingBatchSizeStandalone) / 2; constexpr int kSampleRate = AudioProcessing::kSampleRate48kHz; constexpr int kNumberOfChannels = 1; std::string FormPerformanceMeasureString(const test::PerformanceTimer& timer, int number_of_warmup_samples) { std::string s = std::to_string(timer.GetDurationAverage(number_of_warmup_samples)); s += ", "; s += std::to_string( timer.GetDurationStandardDeviation(number_of_warmup_samples)); return s; } void RunStandaloneSubmodule() { test::SimulatorBuffers buffers( kSampleRate, kSampleRate, kSampleRate, kSampleRate, kNumberOfChannels, kNumberOfChannels, kNumberOfChannels, kNumberOfChannels); test::PerformanceTimer timer(kNumFramesToProcessStandalone / kProcessingBatchSizeStandalone); ResidualEchoDetector echo_detector; echo_detector.Initialize(); float sum = 0.f; for (size_t frame_no = 0; frame_no < kNumFramesToProcessStandalone; ++frame_no) { // The first batch of frames are for warming up, and are not part of the // benchmark. After that the processing time is measured in chunks of // kProcessingBatchSize frames. if (frame_no % kProcessingBatchSizeStandalone == 0) { timer.StartTimer(); } buffers.UpdateInputBuffers(); echo_detector.AnalyzeRenderAudio(rtc::ArrayView<const float>( buffers.render_input_buffer->split_bands_const_f(0)[kBand0To8kHz], buffers.render_input_buffer->num_frames_per_band())); echo_detector.AnalyzeCaptureAudio(rtc::ArrayView<const float>( buffers.capture_input_buffer->split_bands_const_f(0)[kBand0To8kHz], buffers.capture_input_buffer->num_frames_per_band())); sum += echo_detector.echo_likelihood(); if (frame_no % kProcessingBatchSizeStandalone == kProcessingBatchSizeStandalone - 1) { timer.StopTimer(); } } EXPECT_EQ(0.0f, sum); webrtc::test::PrintResultMeanAndError( "echo_detector_call_durations", "", "StandaloneEchoDetector", FormPerformanceMeasureString(timer, kNumberOfWarmupMeasurementsStandalone), "us", false); } void RunTogetherWithApm(std::string test_description, bool use_mobile_aec, bool include_default_apm_processing) { test::SimulatorBuffers buffers( kSampleRate, kSampleRate, kSampleRate, kSampleRate, kNumberOfChannels, kNumberOfChannels, kNumberOfChannels, kNumberOfChannels); test::PerformanceTimer timer(kNumFramesToProcess / kProcessingBatchSize); webrtc::Config config; AudioProcessing::Config apm_config; if (include_default_apm_processing) { config.Set<DelayAgnostic>(new DelayAgnostic(true)); config.Set<ExtendedFilter>(new ExtendedFilter(true)); } apm_config.level_controller.enabled = include_default_apm_processing; apm_config.residual_echo_detector.enabled = true; std::unique_ptr<AudioProcessing> apm; apm.reset(AudioProcessing::Create(config)); ASSERT_TRUE(apm.get()); apm->ApplyConfig(apm_config); ASSERT_EQ(AudioProcessing::kNoError, apm->gain_control()->Enable(include_default_apm_processing)); if (use_mobile_aec) { ASSERT_EQ(AudioProcessing::kNoError, apm->echo_cancellation()->Enable(false)); ASSERT_EQ(AudioProcessing::kNoError, apm->echo_control_mobile()->Enable( include_default_apm_processing)); } else { ASSERT_EQ(AudioProcessing::kNoError, apm->echo_cancellation()->Enable(include_default_apm_processing)); ASSERT_EQ(AudioProcessing::kNoError, apm->echo_control_mobile()->Enable(false)); } ASSERT_EQ(AudioProcessing::kNoError, apm->high_pass_filter()->Enable(include_default_apm_processing)); ASSERT_EQ(AudioProcessing::kNoError, apm->noise_suppression()->Enable(include_default_apm_processing)); ASSERT_EQ(AudioProcessing::kNoError, apm->voice_detection()->Enable(include_default_apm_processing)); ASSERT_EQ(AudioProcessing::kNoError, apm->level_estimator()->Enable(include_default_apm_processing)); StreamConfig stream_config(kSampleRate, kNumberOfChannels, false); for (size_t frame_no = 0; frame_no < kNumFramesToProcess; ++frame_no) { // The first batch of frames are for warming up, and are not part of the // benchmark. After that the processing time is measured in chunks of // kProcessingBatchSize frames. if (frame_no % kProcessingBatchSize == 0) { timer.StartTimer(); } buffers.UpdateInputBuffers(); ASSERT_EQ( AudioProcessing::kNoError, apm->ProcessReverseStream(&buffers.render_input[0], stream_config, stream_config, &buffers.render_output[0])); ASSERT_EQ(AudioProcessing::kNoError, apm->set_stream_delay_ms(0)); if (include_default_apm_processing) { apm->gain_control()->set_stream_analog_level(0); if (!use_mobile_aec) { apm->echo_cancellation()->set_stream_drift_samples(0); } } ASSERT_EQ(AudioProcessing::kNoError, apm->ProcessStream(&buffers.capture_input[0], stream_config, stream_config, &buffers.capture_output[0])); if (frame_no % kProcessingBatchSize == kProcessingBatchSize - 1) { timer.StopTimer(); } } webrtc::test::PrintResultMeanAndError( "echo_detector_call_durations", "_total", test_description, FormPerformanceMeasureString(timer, kNumberOfWarmupMeasurements), "us", false); } } // namespace TEST(EchoDetectorPerformanceTest, StandaloneProcessing) { RunStandaloneSubmodule(); } TEST(EchoDetectorPerformanceTest, ProcessingViaApm) { RunTogetherWithApm("SimpleEchoDetectorViaApm", false, false); } TEST(EchoDetectorPerformanceTest, InteractionWithDefaultApm) { RunTogetherWithApm("EchoDetectorAndDefaultDesktopApm", false, true); RunTogetherWithApm("EchoDetectorAndDefaultMobileApm", true, true); } } // namespace webrtc
{ "content_hash": "0af89acad9a500a1ef1aef453fbdeea5", "timestamp": "", "source": "github", "line_count": 182, "max_line_length": 80, "avg_line_length": 39.45054945054945, "alnum_prop": 0.7055710306406685, "repo_name": "Alkalyne/webrtctrunk", "id": "a42b408b8b783a3879c613e35a7b46ecb734a2e7", "size": "7592", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "modules/audio_processing/residual_echo_detector_complexity_unittest.cc", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "22469" }, { "name": "C", "bytes": "3405665" }, { "name": "C++", "bytes": "24404959" }, { "name": "CSS", "bytes": "1617" }, { "name": "Java", "bytes": "643292" }, { "name": "JavaScript", "bytes": "5409" }, { "name": "Matlab", "bytes": "26947" }, { "name": "Objective-C", "bytes": "186937" }, { "name": "Objective-C++", "bytes": "472228" }, { "name": "Protocol Buffer", "bytes": "21689" }, { "name": "Python", "bytes": "146387" }, { "name": "Ruby", "bytes": "615" }, { "name": "Shell", "bytes": "75957" } ], "symlink_target": "" }
// Copyright (c) 2014, Michael Schout // Distributed under a 3-clause BSD license. See LICENSE. #ifndef SRS2_HPP #define SRS2_HPP #include <time.h> #include <vector> #include <string> #include "srs2/address.hpp" namespace srs2 { const std::string SRS0TAG = "SRS0"; const std::string SRS1TAG = "SRS1"; const std::string SRSSEP = "="; class base { public: base() { }; /** * Constructor. * @param secret the secret for generating and verifying hashes. * @param seapartor the SRS separator. */ base(const std::string& secret, char separator='=') : m_separator(separator) { if (!(m_separator == '+' || m_separator == '-' || m_separator == '=')) throw std::runtime_error(std::string("bad separator: ") + m_separator); m_secrets.push_back(secret); } /** * Forward an address. Returns an SRS address. */ std::string forward(const std::string& sender, const std::string& alias); /** * Reverse an SRS address. */ std::string reverse(const std::string& address); /** * add a secret to the list of secrets. * Future forward() calls will use this secret, and old secrets remain * valid. */ void add_secret(const std::string& secret); /** * check if an address is an SRS address (either SRS0 or SRS1) */ bool is_srs(const std::string& address); /** * check if an address is an SRS0 address */ bool is_srs0(const std::string& address); /** * check if an address is an SRS1 address. */ bool is_srs1(const std::string& address); /** * removes an SRS1 or SRS0 tag plus following separator from the * address in-place. */ void remove_tag(std::string& address); /** * Get the current secret used for generating hashes */ std::string secret() { return m_secrets.back(); } /** * get the separator charactor. */ char separator() { return m_separator; } protected: /** * create an SRS address from an email */ virtual std::string compile(const std::string& sendhost, const std::string& senduser) = 0; /** * parse an SRS address */ virtual address parse(const std::string& address) = 0; std::string hash_create(std::vector<std::string>::const_iterator begin, std::vector<std::string>::const_iterator end, const std::string& secret); std::string hash_create(std::vector<std::string>::const_iterator begin, std::vector<std::string>::const_iterator end) { return hash_create(begin, end, m_secrets.back()); } std::string hash_create(const std::vector<std::string>& data) { return hash_create(data.begin(), data.end()); } bool verify_hash(const std::string& hash, std::vector<std::string>::const_iterator begin, std::vector<std::string>::const_iterator end); bool verify_hash(const std::string& hash, std::vector<std::string> parts) { return verify_hash(hash, parts.begin(), parts.end()); } bool check_timestamp(const std::string& stamp); std::string create_timestamp(time_t now); std::string create_timestamp() { return create_timestamp(time(nullptr)); } std::vector<std::string> m_secrets; char m_separator = '='; int m_maxage = 21; int m_hashlength = 4; int m_hashmin = 4; bool m_alwaysrewrite = false; }; }; // namespace srs2 #endif
{ "content_hash": "675a401a39922b02e28cf91b855cf1ed", "timestamp": "", "source": "github", "line_count": 135, "max_line_length": 98, "avg_line_length": 29.133333333333333, "alnum_prop": 0.5375031782354437, "repo_name": "mschout/libsrs2xx", "id": "f87669f0d29b6ee25c9190c42a630b138dc7cfc4", "size": "3933", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/srs2/base.hpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C++", "bytes": "38545" }, { "name": "Shell", "bytes": "87" } ], "symlink_target": "" }
/** * Background * This code will run in the background, checking Hacker News for updates either * every 20 minutes or when the user clicks on the extension icon. * * @license MIT license */ const NEWS_URL = 'https://news.ycombinator.com/'; const PT_BENCHMARK = 70; const NOTIF_SOUND_PATH = 'sounds/waterSplashing.mp3'; const STD_ALARM_NAME = 'c.alarm'; // "check" alarm const STD_PERIOD = 20; // this (in minutes) is how often the check should happen const NOTIF_DELAY = 15000; // ms until we close the notification automatically const NOTIF_ICON_PATH = 'images/hacker_news.png'; var notifId = 0; // the id for each notification var day = (new Date()).getDay(); var links = []; /* links, indexed by notification id. Dually serves as an set of identifiers * for headlines that have already been displayed */ /* Gets the biggest news that hasn't been seen before, by parsing the page data * given as NEWS. "Biggest news" refers to the highest-scoring news on the front page * (i.e. the one with the most upvotes). * * Returns an array of size 3 containing the title as the first element [0], * the link as second element [1], and the score as the third element [2]. */ function getBiggestNews(news) { // Parse: link/title/score chunks var data = news.match(/class="title".*<a href=".*">.*<\/a>.*sitebit comhead".*\n.*id="score_\d+">\d+ points/g); var dtLength = data.length; var topLink, topTitle, topScore = -1; // vars for keeping track of the biggest news for (var i = 0; i < dtLength; i++) { var dataRe = /class="title".*<a href="(.*)">(.*)<\/a>.*sitebit comhead.*\n.*>(\d+)\spoints/g; var filteredData = dataRe.exec(data[i]).slice(1, 4); var link = filteredData[0], title = filteredData[1], score = filteredData[2]; if (window.links.indexOf(link) == -1 && parseInt(score) > topScore) { // i.e. we haven't seen the link before, and of this pool the score is the biggest // update our "best of show" attributes! topLink = link; topTitle = title; topScore = score; } } window.links[notifId] = topLink; // the news we return is now old news return [topTitle, topLink, topScore]; } /* Checks Hacker News for new topics that have over PT_BENCHMARK points. * ON_CLICK is a boolean value that specifies whether or not this check * originated from a click. */ function checkForUpdates(onClick) { // Send an HTTP GET request to Hacker News var xhr = new XMLHttpRequest(); xhr.open('GET', NEWS_URL, true); xhr.responseType = 'text'; xhr.onload = function(e) { bigNews = getBiggestNews(this.responseText); /* If a hot topic was found, throw out a notification! However, * if the user clicked on the icon and there is nothing over * PT_BENCHMARK points, then we'll settle for the highest-rated news. */ if (onClick || bigNews[2] >= PT_BENCHMARK) { createNotification(bigNews[0], "Click to view article!"); makeSound(); } }; xhr.send(); // go request go! } // Generates the sound that is specified by NOTIF_SOUND_PATH. function makeSound() { var sound = new Audio(NOTIF_SOUND_PATH); sound.play(); } function startAlarm() { chrome.alarms.create(STD_ALARM_NAME, { delayInMinutes: STD_PERIOD, periodInMinutes: STD_PERIOD }); } // Creates a notification with TITLE as the title and LINK as the message. function createNotification(title, link) { chrome.notifications.create(notifId.toString(), { type: 'basic', title: title, // the name of the article message: link, // a link to the article iconUrl: NOTIF_ICON_PATH }, function() {}); // Close the notification after 20 seconds timer = setTimeout(function() { chrome.notifications.clear(notifId.toString(), function() {}); }, NOTIF_DELAY); notifId++; // now that we're done with this iteration of the notification id, update it } // We'll check for updates and start the first alarm chrome.runtime.onInstalled.addListener(function() { checkForUpdates(false); startAlarm(); }); // Every time an alarm rings, look for hot topics that we haven't seen before chrome.alarms.onAlarm.addListener(function() { // The oldNews set should be cleared by the day if (Date.prototype.getDay() != day) { // meaning: is it a new day? oldNews = Object.create(null); day = Date.prototype.getDay(); } checkForUpdates(false); }); // When the icon is clicked, check for updates and reset the alarm timer chrome.browserAction.onClicked.addListener(function() { checkForUpdates(true); // Reset el alarm (because we just checked!) chrome.alarms.clear(STD_ALARM_NAME); startAlarm(); }); // Have the notification take you to the article on click chrome.notifications.onClicked.addListener(function(notificationId) { window.open(links[parseInt(notificationId)]); });
{ "content_hash": "8a6a7232dc4fb945fcdd92538f31f43c", "timestamp": "", "source": "github", "line_count": 135, "max_line_length": 115, "avg_line_length": 37.48148148148148, "alnum_prop": 0.6549407114624506, "repo_name": "ohjay/hacker-headlines", "id": "c485bebc6948df260c4619dd596603d6aa25ead0", "size": "5060", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "background.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "5060" } ], "symlink_target": "" }
package pad; import java.util.Scanner; import Prog1Tools.IOTools; public class Aufgabe4 { /** * Schreiben Sie ein Programm, das Studentendaten für maximal 10 Studenten * (Name, Vorname, Matr.Nr., Studiengang, Semester, eMail) * verwaltet (ähnlich dem Beispielprogramm für die Adressen). * Die Ausgabe von Daten soll nur gemacht werden, wenn gültige Daten * eingegeben wurden. * Die Eingabe bei einem Index, für den bereits Daten vorliegen, soll * erst nach Sicherheitsabfrage erfolgen. * Nach der Eingabe von Daten soll sofort die Ausgabe erfolgen. * Es sollen auch die Daten eines Studenten gelöscht werden können, * danach sollen bei diesem Index auch keine Daten mehr angezeigt werden. * Hilfe: Sie brauchen eine Kennung, ob an einer Indexposition gültige * Daten vorliegen. * Diese Kennung sollte zu Beginn initialisiert werden. * * https://github.com/Johnmalc/PAD/blob/master/5/2%20Klasse%20%28Daten%29/4/AdressBuch_v1.java * * */ public static class Kontakt{ String name; String vorname; String studiengang; String email; int semester; int matrikel; } public static void main(String[] args) { Kontakt[] kontakten = new Kontakt[10]; Kontakt details = null; for(int i = 0; i < kontakten.length; i++){ kontakten[i] = new Kontakt(); details = kontakten[0]; } // for a menu, a convection boolean fertigMitProgramm = false; System.out.println("\n"); // repead action after your input while(!false) { System.out.println("Menu 1 : Eingabe"); System.out.println("Menu 2 : Schuler Daten bearbeiten (Loschen)"); System.out.println("Menu 3 : Programm beenden "); int yourChoice = IOTools.readInt("Your choice for menu, please"); // choose a number and procced switch(yourChoice){ // eingabe ausgabe case 1 : System.out.println(""); System.out.println("Geben Sie jetzt ihre daten ein"); details.name = IOTools.readLine("Name eingeben"); details.vorname = IOTools.readLine("Vorname eingeben"); details.studiengang = IOTools.readLine("Studiengang eingeben"); details.email = IOTools.readLine("Email eingeben"); details.semester = IOTools.readInt("Semester eingeben"); details.matrikel = IOTools.readInt("Matrikel Nummer eingeben"); System.out.println(""); System.out.println(details.name); System.out.println(details.vorname); System.out.println(details.studiengang); System.out.println(details.semester); System.out.println(details.matrikel); System.out.println(""); break; // Schuller wechseln = array uberschreiben case 2 : // if(kontakten[i] == ) { // // } int n = IOTools.readInteger("Schuller wechseln an position" + " 1 bis 10):"); details = kontakten[n-1]; // Fertig case 3 : fertigMitProgramm = true; break; // user's input = error = Fertig default: System.out.println("You cannot write a text (String) or number bigger than " + yourChoice); } } } }
{ "content_hash": "6fd413326569fe679872be74913bb5b9", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 103, "avg_line_length": 35.45794392523364, "alnum_prop": 0.544280442804428, "repo_name": "dmpe/OOPaPrechod", "id": "8a92e94957b3000eeb7c9ab148fbe5e1612e4748", "size": "3802", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/pad/Aufgabe4.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "178589" } ], "symlink_target": "" }
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/bigtable/admin/v2/bigtable_table_admin.proto package com.google.bigtable.admin.v2; /** * * * <pre> * Response message for * [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables] * </pre> * * Protobuf type {@code google.bigtable.admin.v2.ListTablesResponse} */ public final class ListTablesResponse extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.bigtable.admin.v2.ListTablesResponse) ListTablesResponseOrBuilder { private static final long serialVersionUID = 0L; // Use ListTablesResponse.newBuilder() to construct. private ListTablesResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private ListTablesResponse() { tables_ = java.util.Collections.emptyList(); nextPageToken_ = ""; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new ListTablesResponse(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.bigtable.admin.v2.BigtableTableAdminProto .internal_static_google_bigtable_admin_v2_ListTablesResponse_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.bigtable.admin.v2.BigtableTableAdminProto .internal_static_google_bigtable_admin_v2_ListTablesResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.bigtable.admin.v2.ListTablesResponse.class, com.google.bigtable.admin.v2.ListTablesResponse.Builder.class); } public static final int TABLES_FIELD_NUMBER = 1; private java.util.List<com.google.bigtable.admin.v2.Table> tables_; /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ @java.lang.Override public java.util.List<com.google.bigtable.admin.v2.Table> getTablesList() { return tables_; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ @java.lang.Override public java.util.List<? extends com.google.bigtable.admin.v2.TableOrBuilder> getTablesOrBuilderList() { return tables_; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ @java.lang.Override public int getTablesCount() { return tables_.size(); } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ @java.lang.Override public com.google.bigtable.admin.v2.Table getTables(int index) { return tables_.get(index); } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ @java.lang.Override public com.google.bigtable.admin.v2.TableOrBuilder getTablesOrBuilder(int index) { return tables_.get(index); } public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; private volatile java.lang.Object nextPageToken_; /** * * * <pre> * Set if not all tables could be returned in a single response. * Pass this value to `page_token` in another request to get the next * page of results. * </pre> * * <code>string next_page_token = 2;</code> * * @return The nextPageToken. */ @java.lang.Override public java.lang.String getNextPageToken() { java.lang.Object ref = nextPageToken_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); nextPageToken_ = s; return s; } } /** * * * <pre> * Set if not all tables could be returned in a single response. * Pass this value to `page_token` in another request to get the next * page of results. * </pre> * * <code>string next_page_token = 2;</code> * * @return The bytes for nextPageToken. */ @java.lang.Override public com.google.protobuf.ByteString getNextPageTokenBytes() { java.lang.Object ref = nextPageToken_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); nextPageToken_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < tables_.size(); i++) { output.writeMessage(1, tables_.get(i)); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); } getUnknownFields().writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; for (int i = 0; i < tables_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, tables_.get(i)); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.bigtable.admin.v2.ListTablesResponse)) { return super.equals(obj); } com.google.bigtable.admin.v2.ListTablesResponse other = (com.google.bigtable.admin.v2.ListTablesResponse) obj; if (!getTablesList().equals(other.getTablesList())) return false; if (!getNextPageToken().equals(other.getNextPageToken())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getTablesCount() > 0) { hash = (37 * hash) + TABLES_FIELD_NUMBER; hash = (53 * hash) + getTablesList().hashCode(); } hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; hash = (53 * hash) + getNextPageToken().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } public static com.google.bigtable.admin.v2.ListTablesResponse parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } public static com.google.bigtable.admin.v2.ListTablesResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( PARSER, input, extensionRegistry); } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } public static com.google.bigtable.admin.v2.ListTablesResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException( PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.bigtable.admin.v2.ListTablesResponse prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * * * <pre> * Response message for * [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables] * </pre> * * Protobuf type {@code google.bigtable.admin.v2.ListTablesResponse} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.bigtable.admin.v2.ListTablesResponse) com.google.bigtable.admin.v2.ListTablesResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.bigtable.admin.v2.BigtableTableAdminProto .internal_static_google_bigtable_admin_v2_ListTablesResponse_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.bigtable.admin.v2.BigtableTableAdminProto .internal_static_google_bigtable_admin_v2_ListTablesResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.bigtable.admin.v2.ListTablesResponse.class, com.google.bigtable.admin.v2.ListTablesResponse.Builder.class); } // Construct using com.google.bigtable.admin.v2.ListTablesResponse.newBuilder() private Builder() {} private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); } @java.lang.Override public Builder clear() { super.clear(); if (tablesBuilder_ == null) { tables_ = java.util.Collections.emptyList(); } else { tables_ = null; tablesBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); nextPageToken_ = ""; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.bigtable.admin.v2.BigtableTableAdminProto .internal_static_google_bigtable_admin_v2_ListTablesResponse_descriptor; } @java.lang.Override public com.google.bigtable.admin.v2.ListTablesResponse getDefaultInstanceForType() { return com.google.bigtable.admin.v2.ListTablesResponse.getDefaultInstance(); } @java.lang.Override public com.google.bigtable.admin.v2.ListTablesResponse build() { com.google.bigtable.admin.v2.ListTablesResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.bigtable.admin.v2.ListTablesResponse buildPartial() { com.google.bigtable.admin.v2.ListTablesResponse result = new com.google.bigtable.admin.v2.ListTablesResponse(this); int from_bitField0_ = bitField0_; if (tablesBuilder_ == null) { if (((bitField0_ & 0x00000001) != 0)) { tables_ = java.util.Collections.unmodifiableList(tables_); bitField0_ = (bitField0_ & ~0x00000001); } result.tables_ = tables_; } else { result.tables_ = tablesBuilder_.build(); } result.nextPageToken_ = nextPageToken_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.bigtable.admin.v2.ListTablesResponse) { return mergeFrom((com.google.bigtable.admin.v2.ListTablesResponse) other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.bigtable.admin.v2.ListTablesResponse other) { if (other == com.google.bigtable.admin.v2.ListTablesResponse.getDefaultInstance()) return this; if (tablesBuilder_ == null) { if (!other.tables_.isEmpty()) { if (tables_.isEmpty()) { tables_ = other.tables_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureTablesIsMutable(); tables_.addAll(other.tables_); } onChanged(); } } else { if (!other.tables_.isEmpty()) { if (tablesBuilder_.isEmpty()) { tablesBuilder_.dispose(); tablesBuilder_ = null; tables_ = other.tables_; bitField0_ = (bitField0_ & ~0x00000001); tablesBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getTablesFieldBuilder() : null; } else { tablesBuilder_.addAllMessages(other.tables_); } } } if (!other.getNextPageToken().isEmpty()) { nextPageToken_ = other.nextPageToken_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 10: { com.google.bigtable.admin.v2.Table m = input.readMessage( com.google.bigtable.admin.v2.Table.parser(), extensionRegistry); if (tablesBuilder_ == null) { ensureTablesIsMutable(); tables_.add(m); } else { tablesBuilder_.addMessage(m); } break; } // case 10 case 18: { nextPageToken_ = input.readStringRequireUtf8(); break; } // case 18 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag } break; } // default: } // switch (tag) } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.unwrapIOException(); } finally { onChanged(); } // finally return this; } private int bitField0_; private java.util.List<com.google.bigtable.admin.v2.Table> tables_ = java.util.Collections.emptyList(); private void ensureTablesIsMutable() { if (!((bitField0_ & 0x00000001) != 0)) { tables_ = new java.util.ArrayList<com.google.bigtable.admin.v2.Table>(tables_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.bigtable.admin.v2.Table, com.google.bigtable.admin.v2.Table.Builder, com.google.bigtable.admin.v2.TableOrBuilder> tablesBuilder_; /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public java.util.List<com.google.bigtable.admin.v2.Table> getTablesList() { if (tablesBuilder_ == null) { return java.util.Collections.unmodifiableList(tables_); } else { return tablesBuilder_.getMessageList(); } } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public int getTablesCount() { if (tablesBuilder_ == null) { return tables_.size(); } else { return tablesBuilder_.getCount(); } } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public com.google.bigtable.admin.v2.Table getTables(int index) { if (tablesBuilder_ == null) { return tables_.get(index); } else { return tablesBuilder_.getMessage(index); } } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public Builder setTables(int index, com.google.bigtable.admin.v2.Table value) { if (tablesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureTablesIsMutable(); tables_.set(index, value); onChanged(); } else { tablesBuilder_.setMessage(index, value); } return this; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public Builder setTables( int index, com.google.bigtable.admin.v2.Table.Builder builderForValue) { if (tablesBuilder_ == null) { ensureTablesIsMutable(); tables_.set(index, builderForValue.build()); onChanged(); } else { tablesBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public Builder addTables(com.google.bigtable.admin.v2.Table value) { if (tablesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureTablesIsMutable(); tables_.add(value); onChanged(); } else { tablesBuilder_.addMessage(value); } return this; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public Builder addTables(int index, com.google.bigtable.admin.v2.Table value) { if (tablesBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureTablesIsMutable(); tables_.add(index, value); onChanged(); } else { tablesBuilder_.addMessage(index, value); } return this; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public Builder addTables(com.google.bigtable.admin.v2.Table.Builder builderForValue) { if (tablesBuilder_ == null) { ensureTablesIsMutable(); tables_.add(builderForValue.build()); onChanged(); } else { tablesBuilder_.addMessage(builderForValue.build()); } return this; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public Builder addTables( int index, com.google.bigtable.admin.v2.Table.Builder builderForValue) { if (tablesBuilder_ == null) { ensureTablesIsMutable(); tables_.add(index, builderForValue.build()); onChanged(); } else { tablesBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public Builder addAllTables( java.lang.Iterable<? extends com.google.bigtable.admin.v2.Table> values) { if (tablesBuilder_ == null) { ensureTablesIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, tables_); onChanged(); } else { tablesBuilder_.addAllMessages(values); } return this; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public Builder clearTables() { if (tablesBuilder_ == null) { tables_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { tablesBuilder_.clear(); } return this; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public Builder removeTables(int index) { if (tablesBuilder_ == null) { ensureTablesIsMutable(); tables_.remove(index); onChanged(); } else { tablesBuilder_.remove(index); } return this; } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public com.google.bigtable.admin.v2.Table.Builder getTablesBuilder(int index) { return getTablesFieldBuilder().getBuilder(index); } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public com.google.bigtable.admin.v2.TableOrBuilder getTablesOrBuilder(int index) { if (tablesBuilder_ == null) { return tables_.get(index); } else { return tablesBuilder_.getMessageOrBuilder(index); } } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public java.util.List<? extends com.google.bigtable.admin.v2.TableOrBuilder> getTablesOrBuilderList() { if (tablesBuilder_ != null) { return tablesBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(tables_); } } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public com.google.bigtable.admin.v2.Table.Builder addTablesBuilder() { return getTablesFieldBuilder() .addBuilder(com.google.bigtable.admin.v2.Table.getDefaultInstance()); } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public com.google.bigtable.admin.v2.Table.Builder addTablesBuilder(int index) { return getTablesFieldBuilder() .addBuilder(index, com.google.bigtable.admin.v2.Table.getDefaultInstance()); } /** * * * <pre> * The tables present in the requested instance. * </pre> * * <code>repeated .google.bigtable.admin.v2.Table tables = 1;</code> */ public java.util.List<com.google.bigtable.admin.v2.Table.Builder> getTablesBuilderList() { return getTablesFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.bigtable.admin.v2.Table, com.google.bigtable.admin.v2.Table.Builder, com.google.bigtable.admin.v2.TableOrBuilder> getTablesFieldBuilder() { if (tablesBuilder_ == null) { tablesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.bigtable.admin.v2.Table, com.google.bigtable.admin.v2.Table.Builder, com.google.bigtable.admin.v2.TableOrBuilder>( tables_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); tables_ = null; } return tablesBuilder_; } private java.lang.Object nextPageToken_ = ""; /** * * * <pre> * Set if not all tables could be returned in a single response. * Pass this value to `page_token` in another request to get the next * page of results. * </pre> * * <code>string next_page_token = 2;</code> * * @return The nextPageToken. */ public java.lang.String getNextPageToken() { java.lang.Object ref = nextPageToken_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); nextPageToken_ = s; return s; } else { return (java.lang.String) ref; } } /** * * * <pre> * Set if not all tables could be returned in a single response. * Pass this value to `page_token` in another request to get the next * page of results. * </pre> * * <code>string next_page_token = 2;</code> * * @return The bytes for nextPageToken. */ public com.google.protobuf.ByteString getNextPageTokenBytes() { java.lang.Object ref = nextPageToken_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); nextPageToken_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * * * <pre> * Set if not all tables could be returned in a single response. * Pass this value to `page_token` in another request to get the next * page of results. * </pre> * * <code>string next_page_token = 2;</code> * * @param value The nextPageToken to set. * @return This builder for chaining. */ public Builder setNextPageToken(java.lang.String value) { if (value == null) { throw new NullPointerException(); } nextPageToken_ = value; onChanged(); return this; } /** * * * <pre> * Set if not all tables could be returned in a single response. * Pass this value to `page_token` in another request to get the next * page of results. * </pre> * * <code>string next_page_token = 2;</code> * * @return This builder for chaining. */ public Builder clearNextPageToken() { nextPageToken_ = getDefaultInstance().getNextPageToken(); onChanged(); return this; } /** * * * <pre> * Set if not all tables could be returned in a single response. * Pass this value to `page_token` in another request to get the next * page of results. * </pre> * * <code>string next_page_token = 2;</code> * * @param value The bytes for nextPageToken to set. * @return This builder for chaining. */ public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); nextPageToken_ = value; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.bigtable.admin.v2.ListTablesResponse) } // @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListTablesResponse) private static final com.google.bigtable.admin.v2.ListTablesResponse DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.bigtable.admin.v2.ListTablesResponse(); } public static com.google.bigtable.admin.v2.ListTablesResponse getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<ListTablesResponse> PARSER = new com.google.protobuf.AbstractParser<ListTablesResponse>() { @java.lang.Override public ListTablesResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { Builder builder = newBuilder(); try { builder.mergeFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(builder.buildPartial()); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e) .setUnfinishedMessage(builder.buildPartial()); } return builder.buildPartial(); } }; public static com.google.protobuf.Parser<ListTablesResponse> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<ListTablesResponse> getParserForType() { return PARSER; } @java.lang.Override public com.google.bigtable.admin.v2.ListTablesResponse getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
{ "content_hash": "fb607340a68952f40560dde21a3a623b", "timestamp": "", "source": "github", "line_count": 1105, "max_line_length": 117, "avg_line_length": 31.19185520361991, "alnum_prop": 0.6362607711724257, "repo_name": "googleapis/java-bigtable", "id": "fecfb3c8932df4b2857fb3643d89a5774baf7713", "size": "35061", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/ListTablesResponse.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "801" }, { "name": "Java", "bytes": "8304597" }, { "name": "Python", "bytes": "7665" }, { "name": "Shell", "bytes": "23981" } ], "symlink_target": "" }
function util.MultiNetworkStrings(header, ...) local args = {...} for k, v in pairs(args) do util.AddNetworkString(header .. v) end end
{ "content_hash": "f1a4694b5186c2e36da1bceea4d75677", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 46, "avg_line_length": 26, "alnum_prop": 0.6217948717948718, "repo_name": "bull29/b_lib-r1", "id": "3a1d1010aeff093dfa14cd6035246fe115f081f4", "size": "218", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lua/b_lib/util.lua", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Lua", "bytes": "5163" } ], "symlink_target": "" }
@interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
{ "content_hash": "9b9ddf8c76c31fe26204880ac9e559d2", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 60, "avg_line_length": 16.857142857142858, "alnum_prop": 0.7796610169491526, "repo_name": "zhangyonguu/myuu", "id": "ad343015a4a223761f9d5b9581856b83762fa24e", "size": "276", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "远程推送/远程推送/AppDelegate.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "6137360" }, { "name": "CSS", "bytes": "1816" }, { "name": "HTML", "bytes": "217561" }, { "name": "Objective-C", "bytes": "7990477" }, { "name": "Objective-C++", "bytes": "2501" }, { "name": "Ruby", "bytes": "1351" }, { "name": "Shell", "bytes": "42619" } ], "symlink_target": "" }
Charmine as it currently stands is an experimental, proof-of-concept command line game. The game concept itself needs to be further developed, the level generator should be less random, and some sort of points system would be nice. This version of Charmine was developed as a sandbox to test the basic concept and also showcase the techniques for creating terminal-based games for Linux and macOS. ## Gameplay The goal is to move a character that cycles through A to F to the other side (the right side) of the field. The character can only pass through characters of the same letter and empty spaces. ## Installation The `go get` command can be used to install Charmine: ```command go get github.com/mnito/charmine ``` ## Options ### Help The help command will show help for other options. ``` charmine -help ``` ### Controls Restricting usable controls is possible with this option. This specific example will restrict input to right and up: ```command charmine -controls ru ``` Valid options are l,u,d,r. Default is ludr. ### Density Setting the density will vary the amount of letters that appear in the field. ```command charmine -density 10 ``` Valid densities are between 1 and 100. Increasing the density will result in the appearance of more characters in the field. The default is 45. ### Seed A seed can be set for the random number generator providing a determinate field per seed under the same conditions. ```command charmine -seed 123456789 ``` ## License Charmine is licensed under the MIT License. ## Author Michael P. Nitowski * Email: <[email protected]> * Twitter: [@mikenitowski](https://twitter.com/mikenitowski)
{ "content_hash": "63b8fd849530c99d48203fa209937fa1", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 397, "avg_line_length": 25.9375, "alnum_prop": 0.7602409638554217, "repo_name": "mnito/charmine", "id": "9d81bbb4f98025f6bfc0e771f6ee184fb3029fa7", "size": "1672", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "6833" } ], "symlink_target": "" }
namespace Poco { namespace RemotingNG { Identifiable::Identifiable(const Identifiable::ObjectId& oid): _remoting__oid(oid) { } Identifiable::~Identifiable() { } void Identifiable::remoting__setURI(const Poco::URI& uri) { std::string str = uri.toString(); if (!str.empty()) { if (str[str.length() - 1] == '/') str.resize(str.length() - 1); } _remoting__uri = str; } } } // namespace Poco::RemotingNG
{ "content_hash": "d0a0a7c175074e6dd12e5c7c185d4b2e", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 63, "avg_line_length": 14.964285714285714, "alnum_prop": 0.6467780429594272, "repo_name": "minghuam/macchina.io", "id": "ecb6f550a00f2ea07c8d831ff30b0b86213dc9bf", "size": "760", "binary": false, "copies": "2", "ref": "refs/heads/develop", "path": "platform/RemotingNG/src/Identifiable.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "2893" }, { "name": "C", "bytes": "10363948" }, { "name": "C++", "bytes": "12795727" }, { "name": "CMake", "bytes": "44987" }, { "name": "CSS", "bytes": "30785" }, { "name": "HTML", "bytes": "67590" }, { "name": "JavaScript", "bytes": "33398" }, { "name": "Makefile", "bytes": "94192" }, { "name": "Objective-C", "bytes": "2646" }, { "name": "Perl", "bytes": "2054" }, { "name": "Shell", "bytes": "60903" } ], "symlink_target": "" }
template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ET> struct is_checked_cpp_int<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ET> > : public std::integral_constant<bool, true> {}; template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates> struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public std::integral_constant<bool, false> {}; template <> struct related_type<boost::multiprecision::cpp_int> { typedef boost::multiprecision::int256_t type; }; template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET> struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> > { typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits / 2, MaxBits / 2, SignType, Checked, Allocator>, ET> type; }; int main() { test<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> > >(); return boost::report_errors(); }
{ "content_hash": "0bb25a679ba607912f1a9080dc33a958", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 242, "avg_line_length": 69.83333333333333, "alnum_prop": 0.7816229116945107, "repo_name": "davehorton/drachtio-server", "id": "84142edd99fd3aae76754181ccb72da3ea10f10e", "size": "2006", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "deps/boost_1_77_0/libs/multiprecision/test/test_arithmetic_cpp_int_13.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "662596" }, { "name": "Dockerfile", "bytes": "1330" }, { "name": "JavaScript", "bytes": "60639" }, { "name": "M4", "bytes": "35273" }, { "name": "Makefile", "bytes": "5960" }, { "name": "Shell", "bytes": "47298" } ], "symlink_target": "" }
package com.google.errorprone.bugpatterns.testdata; import com.google.common.primitives.Ints; /** Negative cases for {@link com.google.errorprone.bugpatterns.UnnecessaryLongToIntConversion}. */ public class UnnecessaryLongToIntConversionNegativeCases { static void acceptsLong(long value) {} static void acceptsInt(int value) {} static void acceptsMultipleParams(int intValue, long longValue) {} // Converting from a long or Long to an Integer type requires first converting to an int. This is // out of scope. public void longToIntegerForLongParam() { long x = 1; acceptsLong(Integer.valueOf((int) x)); } public void longObjectToIntegerForLongParam() { Long x = Long.valueOf(1); acceptsLong(Integer.valueOf(x.intValue())); } public void longParameterAndLongArgument() { long x = 1; acceptsLong(x); } public void longParameterAndIntArgument() { int i = 1; acceptsLong(i); } public void longParameterAndIntegerArgument() { Integer i = Integer.valueOf(1); acceptsLong(i); } public void castIntToLong() { int i = 1; acceptsLong((long) i); } public void castLongToIntForIntParameter() { long x = 1; acceptsInt((int) x); } public void longValueOfLongObject() { Long x = Long.valueOf(1); acceptsLong(x.longValue()); } public void longValueOfInteger() { Integer i = Integer.valueOf(1); acceptsLong(i.longValue()); } public void intValueOfInteger() { Integer i = Integer.valueOf(1); acceptsLong(i.intValue()); } public void intValueForIntParameter() { Long x = Long.valueOf(1); acceptsInt(x.intValue()); } public void checkedCastOnInt() { int i = 1; acceptsLong(Ints.checkedCast(i)); } public void checkedCastOnInteger() { Integer i = Integer.valueOf(1); acceptsLong(Ints.checkedCast(i)); } public void checkedCastForIntParameter() { long x = 1; acceptsInt(Ints.checkedCast(x)); } public void checkedCastMultipleArgs() { long x = 1; // The method expects an int for the first parameter and a long for the second paremeter. acceptsMultipleParams(Ints.checkedCast(x), x); } public void toIntExactOnInt() { int i = 1; acceptsLong(Math.toIntExact(i)); } public void toIntExactOnInteger() { Integer i = Integer.valueOf(1); acceptsLong(Math.toIntExact(i)); } public void toIntExactForIntParameter() { long x = 1; acceptsInt(Math.toIntExact(x)); } }
{ "content_hash": "d9281490725f90621adc383b03013c82", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 99, "avg_line_length": 23.055555555555557, "alnum_prop": 0.6811244979919678, "repo_name": "google/error-prone", "id": "3b94ceb71a9a0ec5eb5151cd2306b8e214bdc9b2", "size": "3097", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "core/src/test/java/com/google/errorprone/bugpatterns/testdata/UnnecessaryLongToIntConversionNegativeCases.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "9329704" }, { "name": "Mustache", "bytes": "1939" }, { "name": "Shell", "bytes": "1915" }, { "name": "Starlark", "bytes": "959" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>spring-all-in-one</artifactId> <groupId>com.wjiec.springaio</groupId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>41-springboot-admin-client</artifactId> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId> <version>2.4.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
{ "content_hash": "92d285b97979068dbe578e24bd0baf7e", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 108, "avg_line_length": 33.72727272727273, "alnum_prop": 0.6004043126684636, "repo_name": "JShadowMan/package", "id": "341575f1a92f36af334bc497fb3509d2cbec3716", "size": "1484", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "java/spring/spring-all-in-one/41-springboot-admin-client/pom.xml", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "55729" }, { "name": "Makefile", "bytes": "721" }, { "name": "Python", "bytes": "42" }, { "name": "Shell", "bytes": "3398" } ], "symlink_target": "" }
source "${ZSH}/lib/_helpers" echo "[python::install]" source "${ZSH}/python/python-versions.zsh" # Note: you can also install the latest head release with: brew unlink pyenv && brew install pyenv --head require_installed_brew "pyenv" require_installed_brew "pyenv-virtualenv" # Install python 2x if [[ ! -z "$PYTHON_2X_VER" ]]; then if [ -z "$(pyenv versions | grep $PYTHON_2X_VER)" ]; then echo " [pyenv] Installing python $PYTHON_2X_VER for you.." pyenv install $PYTHON_2X_VER pyenv rehash else echo " [pyenv] Python $PYTHON_2X_VER already installed." fi if [[ "$PYTHON_GLOBAL_VER" = '2x' ]]; then echo " [pyenv] Setting python $PYTHON_2X_VER as global.." pyenv global $PYTHON_2X_VER fi else echo " [pyenv] Warning: No PYTHON_2X_VER set, not installing." fi # Install python 3x if [[ ! -z "$PYTHON_3X_VER" ]]; then if [ -z "$(pyenv versions | grep $PYTHON_3X_VER)" ]; then echo " [pyenv] Installing python $PYTHON_3X_VER for you.." pyenv install $PYTHON_3X_VER pyenv rehash else echo " [pyenv] Python $PYTHON_3X_VER already installed." fi if [[ "$PYTHON_GLOBAL_VER" = '3x' ]]; then echo " [pyenv] Setting python $PYTHON_3X_VER as global.." pyenv global $PYTHON_3X_VER fi else echo " [pyenv] Warning: No PYTHON_3X_VER set, not installing." fi
{ "content_hash": "361f9abbd39dc97e57e7015c11a9fad0", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 105, "avg_line_length": 29.57777777777778, "alnum_prop": 0.6536438767843726, "repo_name": "alias1/dotfiles-1", "id": "deba83d13fb282d6ce4a0f6fb08ec742af4d0da0", "size": "1386", "binary": false, "copies": "2", "ref": "refs/heads/devalias", "path": "python/install.sh", "mode": "33261", "license": "mit", "language": [ { "name": "AppleScript", "bytes": "1932" }, { "name": "CSS", "bytes": "25" }, { "name": "CoffeeScript", "bytes": "46" }, { "name": "Python", "bytes": "4102" }, { "name": "Ruby", "bytes": "20299" }, { "name": "Shell", "bytes": "94198" } ], "symlink_target": "" }
from webob import exc from nova.api.openstack import common from nova.api.openstack.compute.schemas import server_migrations from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.api import validation from nova import compute from nova import exception from nova.i18n import _ from nova.policies import servers_migrations as sm_policies def output(migration): """Returns the desired output of the API from an object. From a Migrations's object this method returns the primitive object with the only necessary and expected fields. """ return { "created_at": migration.created_at, "dest_compute": migration.dest_compute, "dest_host": migration.dest_host, "dest_node": migration.dest_node, "disk_processed_bytes": migration.disk_processed, "disk_remaining_bytes": migration.disk_remaining, "disk_total_bytes": migration.disk_total, "id": migration.id, "memory_processed_bytes": migration.memory_processed, "memory_remaining_bytes": migration.memory_remaining, "memory_total_bytes": migration.memory_total, "server_uuid": migration.instance_uuid, "source_compute": migration.source_compute, "source_node": migration.source_node, "status": migration.status, "updated_at": migration.updated_at } class ServerMigrationsController(wsgi.Controller): """The server migrations API controller for the OpenStack API.""" def __init__(self): self.compute_api = compute.API() super(ServerMigrationsController, self).__init__() @wsgi.Controller.api_version("2.22") @wsgi.response(202) @extensions.expected_errors((400, 403, 404, 409)) @wsgi.action('force_complete') @validation.schema(server_migrations.force_complete) def _force_complete(self, req, id, server_id, body): context = req.environ['nova.context'] context.can(sm_policies.POLICY_ROOT % 'force_complete') instance = common.get_instance(self.compute_api, context, server_id) try: self.compute_api.live_migrate_force_complete(context, instance, id) except exception.InstanceNotFound as e: raise exc.HTTPNotFound(explanation=e.format_message()) except (exception.MigrationNotFoundByStatus, exception.InvalidMigrationState, exception.MigrationNotFoundForInstance) as e: raise exc.HTTPBadRequest(explanation=e.format_message()) except exception.InstanceIsLocked as e: raise exc.HTTPConflict(explanation=e.format_message()) except exception.InstanceInvalidState as state_error: common.raise_http_conflict_for_instance_invalid_state( state_error, 'force_complete', server_id) @wsgi.Controller.api_version("2.23") @extensions.expected_errors(404) def index(self, req, server_id): """Return all migrations of an instance in progress.""" context = req.environ['nova.context'] context.can(sm_policies.POLICY_ROOT % 'index') # NOTE(Shaohe Feng) just check the instance is available. To keep # consistency with other API, check it before get migrations. common.get_instance(self.compute_api, context, server_id) migrations = self.compute_api.get_migrations_in_progress_by_instance( context, server_id, 'live-migration') return {'migrations': [output(migration) for migration in migrations]} @wsgi.Controller.api_version("2.23") @extensions.expected_errors(404) def show(self, req, server_id, id): """Return the migration of an instance in progress by id.""" context = req.environ['nova.context'] context.can(sm_policies.POLICY_ROOT % 'show') # NOTE(Shaohe Feng) just check the instance is available. To keep # consistency with other API, check it before get migrations. common.get_instance(self.compute_api, context, server_id) try: migration = self.compute_api.get_migration_by_id_and_instance( context, id, server_id) except exception.MigrationNotFoundForInstance: msg = _("In-progress live migration %(id)s is not found for" " server %(uuid)s.") % {"id": id, "uuid": server_id} raise exc.HTTPNotFound(explanation=msg) if migration.get("migration_type") != "live-migration": msg = _("Migration %(id)s for server %(uuid)s is not" " live-migration.") % {"id": id, "uuid": server_id} raise exc.HTTPNotFound(explanation=msg) # TODO(Shaohe Feng) we should share the in-progress list. in_progress = ['queued', 'preparing', 'running', 'post-migrating'] if migration.get("status") not in in_progress: msg = _("Live migration %(id)s for server %(uuid)s is not in" " progress.") % {"id": id, "uuid": server_id} raise exc.HTTPNotFound(explanation=msg) return {'migration': output(migration)} @wsgi.Controller.api_version("2.24") @wsgi.response(202) @extensions.expected_errors((400, 404, 409)) def delete(self, req, server_id, id): """Abort an in progress migration of an instance.""" context = req.environ['nova.context'] context.can(sm_policies.POLICY_ROOT % 'delete') instance = common.get_instance(self.compute_api, context, server_id) try: self.compute_api.live_migrate_abort(context, instance, id) except exception.InstanceInvalidState as state_error: common.raise_http_conflict_for_instance_invalid_state( state_error, "abort live migration", server_id) except exception.MigrationNotFoundForInstance as e: raise exc.HTTPNotFound(explanation=e.format_message()) except exception.InvalidMigrationState as e: raise exc.HTTPBadRequest(explanation=e.format_message())
{ "content_hash": "9634ffa4d64cad47b13ae0b00b2cba8f", "timestamp": "", "source": "github", "line_count": 137, "max_line_length": 79, "avg_line_length": 44.08029197080292, "alnum_prop": 0.6560688855770823, "repo_name": "Juniper/nova", "id": "c0fd4c38b5ae11f47b90424a1c2ccf5aa3d31a7d", "size": "6675", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "nova/api/openstack/compute/server_migrations.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "601" }, { "name": "PHP", "bytes": "23962" }, { "name": "Python", "bytes": "19816434" }, { "name": "Shell", "bytes": "27717" }, { "name": "Smarty", "bytes": "339635" } ], "symlink_target": "" }
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Suite1" verbose="1" > <test name="Groups" > <classes> <class name="ru.stqa.pft.addressbook.tests.GroupCreationTests" /> <class name="ru.stqa.pft.addressbook.tests.ContactModificationTests" /> <class name="ru.stqa.pft.addressbook.tests.GroupDeletionTests" /> </classes> </test> </suite>
{ "content_hash": "3f1eada2031ccfac5a6ec3e9abc4f11d", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 83, "avg_line_length": 35.083333333333336, "alnum_prop": 0.6270783847980997, "repo_name": "BaastPriest/Java_for_testers", "id": "5bb026c304497e7132d7ce34527e3d2f26c91480", "size": "421", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "addressbook-web-tests/src/test/resources/testng-groups.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "123574" }, { "name": "PHP", "bytes": "444" } ], "symlink_target": "" }
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddRepeatColumnsToComplianceDiary extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('compliance_diary', function($table) { $table->integer('target_id')->nullable(); $table->string('target_type',25)->nullable(); $table->integer('repeat_freq')->nullable(); $table->string('repeat',11)->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { // } }
{ "content_hash": "c69b5d7dc2890d5b6511d90b47cf0882", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 59, "avg_line_length": 19.08823529411765, "alnum_prop": 0.5824345146379045, "repo_name": "denislevin/webapp-dashboard", "id": "98d5f7fc1873cb5d2ad39f8ce055f843bae60946", "size": "649", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/database/migrations/2015_02_26_100442_add_repeat_columns_to_compliance_diary.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "447" }, { "name": "CSS", "bytes": "1985410" }, { "name": "HTML", "bytes": "1628110" }, { "name": "JavaScript", "bytes": "5932815" }, { "name": "PHP", "bytes": "7904340" }, { "name": "Shell", "bytes": "6113" } ], "symlink_target": "" }
<?php $installer = $this; /* @var $installer Mage_Core_Model_Resource_Setup */ $installer->startSetup(); $installer->getConnection()->changeColumn($this->getTable('salesrule'), 'conditions_serialized', 'conditions_serialized', 'mediumtext CHARACTER SET utf8 NOT NULL' ); $installer->getConnection()->changeColumn($this->getTable('salesrule'), 'actions_serialized', 'actions_serialized', 'mediumtext CHARACTER SET utf8 NOT NULL' ); $installer->endSetup();
{ "content_hash": "083a35ce478ddded3b8bfd7b1d5e477b", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 71, "avg_line_length": 26.444444444444443, "alnum_prop": 0.7142857142857143, "repo_name": "melvyn-sopacua/magedepot", "id": "d8bac0e906d13a6ca8f812d3fe6853c76a8f2579", "size": "1434", "binary": false, "copies": "10", "ref": "refs/heads/master", "path": "magento/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.6-0.7.7.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "PHP", "bytes": "25548654" }, { "name": "Shell", "bytes": "642" } ], "symlink_target": "" }
from cx_Freeze import setup, Executable # Dependencies are automatically detected, but it might need # fine tuning. buildOptions = dict(packages = [], excludes = []) executables = [ Executable('push.py', 'Console', targetName = 'ldpush') ] setup(name='ldpush', version = '1.0', description = 'A cross-vendor network configuration distribution tool. This is useful for pushing ACLs or other pieces of configuration to network elements. It can also be used to send commands to a list of devices and gather the results.', options = dict(build_exe = buildOptions), executables = executables)
{ "content_hash": "ac7764aeb39e35dce6d10e4f6e473163", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 246, "avg_line_length": 41.266666666666666, "alnum_prop": 0.7205169628432956, "repo_name": "google/ldpush", "id": "fe3c3ff1fc03400d6ef39bc60a330972d964cf27", "size": "619", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "setup.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "181808" } ], "symlink_target": "" }
import * as React from 'react' import * as Styles from '../styles' import Image from './image' import Text from './text' import {Box2} from './box' import WithTooltip from './with-tooltip' import type {Props} from './custom-emoji' const Kb = { Box2, Image, Text, WithTooltip, } const CustomEmoji = (props: Props) => { const {size, src, alias, style} = props return ( <Kb.Box2 direction="horizontal" alignItems="center" style={Styles.collapseStyles([ styles.emoji, { height: size, width: size, ...style, }, ])} > <Kb.WithTooltip tooltip={alias ?? null} containerStyle={styles.tooltipContainer}> <Kb.Image src={src} style={Styles.collapseStyles([ { maxHeight: size, width: size, }, ])} /> </Kb.WithTooltip> </Kb.Box2> ) } const styles = Styles.styleSheetCreate( () => ({ emoji: Styles.platformStyles({ isElectron: { display: 'inline-flex', justifyContent: 'center', verticalAlign: 'middle', }, }), tooltipContainer: Styles.platformStyles({ isElectron: { justifyContent: 'center', }, }), } as const) ) export default CustomEmoji
{ "content_hash": "8d42aae75d023c3c17969b923a819bc7", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 87, "avg_line_length": 21.09375, "alnum_prop": 0.5325925925925926, "repo_name": "keybase/client", "id": "6fc4f9343103f009a71d932d1a894d948a510044", "size": "1350", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "shared/common-adapters/custom-emoji.desktop.tsx", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "17403" }, { "name": "C", "bytes": "183175" }, { "name": "C++", "bytes": "26935" }, { "name": "CMake", "bytes": "2524" }, { "name": "CSS", "bytes": "46433" }, { "name": "CoffeeScript", "bytes": "28635" }, { "name": "Dockerfile", "bytes": "19841" }, { "name": "Go", "bytes": "32360664" }, { "name": "HTML", "bytes": "7113636" }, { "name": "Java", "bytes": "144690" }, { "name": "JavaScript", "bytes": "113705" }, { "name": "Makefile", "bytes": "8579" }, { "name": "Objective-C", "bytes": "1419995" }, { "name": "Objective-C++", "bytes": "34802" }, { "name": "Perl", "bytes": "2673" }, { "name": "Python", "bytes": "25189" }, { "name": "Roff", "bytes": "108890" }, { "name": "Ruby", "bytes": "38112" }, { "name": "Shell", "bytes": "186628" }, { "name": "Starlark", "bytes": "1928" }, { "name": "Swift", "bytes": "217" }, { "name": "TypeScript", "bytes": "2493" }, { "name": "XSLT", "bytes": "914" } ], "symlink_target": "" }