answer
stringlengths
15
1.25M
#import "AWSRequest.h" @class NSString, NSNumber; @interface <API key> : AWSRequest { NSString* _device; NSNumber* _dryRun; NSString* _instanceId; NSString* _volumeId; } @property(retain, nonatomic) NSString* device; @property(retain, nonatomic) NSNumber* dryRun; @property(retain, nonatomic) NSString* instanceId; @property(retain, nonatomic) NSString* volumeId; + (id)<API key>; - (void).cxx_destruct; @end
<?php class StatusesController extends AppController { var $name = 'Statuses'; function index() { $this->Status->recursive = 0; $this->set('statuses', $this->paginate()); } function view($id = null) { if (!$id) { $this->Session->setFlash('Invalid Status.'); $this->redirect(array('action'=>'index')); } $this->set('status', $this->Status->read(null, $id)); } function add() { if (!empty($this->data)) { $this->Status->create(); $this->data['Status']['slug'] = $this->slug($this->data['Status']['name']); if ($this->Status->save($this->data)) { $this->Session->setFlash('The Status has been saved'); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash('The Status could not be saved. Please, try again.'); } } } function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash('Invalid Status'); $this->redirect(array('action'=>'index')); } if (!empty($this->data)) { if ($this->Status->save($this->data)) { $this->Session->setFlash('The Status has been saved'); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash('The Status could not be saved. Please, try again.'); } } if (empty($this->data)) { $this->data = $this->Status->read(null, $id); } } function delete($id = null) { if (!$id) { $this->Session->setFlash('Invalid id for Status'); $this->redirect(array('action'=>'index')); } if ($this->Status->del($id)) { $this->Session->setFlash('Status deleted'); $this->redirect(array('action'=>'index')); } } } ?>
2015-03-22 # objective-c * <img src='https://avatars2.githubusercontent.com/u/4797?v=3&s=40' height='20' width='20'>[ cparnot / ASCIImage ](https://github.com/cparnot/ASCIImage): Create UIImage / NSImage instances with NSString and ASCII art * <img src='https://avatars2.githubusercontent.com/u/495143?v=3&s=40' height='20' width='20'>[ pdcgomes / XCActionBar ](https://github.com/pdcgomes/XCActionBar): "Alfred for Xcode" plugin * <img src='https://avatars1.githubusercontent.com/u/4316898?v=3&s=40' height='20' width='20'>[ itouch2 / PhotoTweaks ](https://github.com/itouch2/PhotoTweaks): Drag, Rotate, Scale and Crop * <img src='https://avatars2.githubusercontent.com/u/852375?v=3&s=40' height='20' width='20'>[ MengTo / DesignerNewsApp ](https://github.com/MengTo/DesignerNewsApp): Build a Swift App as a designer * <img src='https://avatars1.githubusercontent.com/u/1039147?v=3&s=40' height='20' width='20'>[ Raizlabs / RZDataBinding ](https://github.com/Raizlabs/RZDataBinding): Lightweight KVO-based data binding options. * <img src='https://avatars3.githubusercontent.com/u/7659?v=3&s=40' height='20' width='20'>[ AFNetworking / AFNetworking ](https://github.com/AFNetworking/AFNetworking): A delightful iOS and OS X networking framework * <img src='https://avatars0.githubusercontent.com/u/1423931?v=3&s=40' height='20' width='20'>[ layerhq / Atlas-iOS ](https://github.com/layerhq/Atlas-iOS): Atlas is a library of native iOS communications user interface components for Layer. * <img src='https://avatars1.githubusercontent.com/u/447328?v=3&s=40' height='20' width='20'>[ izqui / Taylor ](https://github.com/izqui/Taylor): A library for writing HTTP servers with Swift * <img src='https://avatars3.githubusercontent.com/u/28012?v=3&s=40' height='20' width='20'>[ eczarny / spectacle ](https://github.com/eczarny/spectacle): Spectacle allows you to organize your windows without using a mouse. * <img src='https://avatars1.githubusercontent.com/u/2301114?v=3&s=40' height='20' width='20'>[ jessesquires / <API key> ](https://github.com/jessesquires/<API key>): An elegant messages UI library for iOS * <img src='https://avatars0.githubusercontent.com/u/353438?v=3&s=40' height='20' width='20'>[ IFTTT / FastttCamera ](https://github.com/IFTTT/FastttCamera): Fasttt and easy camera framework for iOS with customizable filters * <img src='https://avatars2.githubusercontent.com/u/1628832?v=3&s=40' height='20' width='20'>[ lmirosevic / GBDeviceInfo ](https://github.com/lmirosevic/GBDeviceInfo): Detects the hardware, software and display of the current iOS or Mac OS X device at runtime. * <img src='https://avatars1.githubusercontent.com/u/627285?v=3&s=40' height='20' width='20'>[ supermarin / Alcatraz ](https://github.com/supermarin/Alcatraz): Package manager for Xcode * <img src='https://avatars0.githubusercontent.com/u/3817366?v=3&s=40' height='20' width='20'>[ CoderMJLee / MJRefresh ](https://github.com/CoderMJLee/MJRefresh): The easiest way to use pull-to-refresh * <img src='https://avatars1.githubusercontent.com/u/432536?v=3&s=40' height='20' width='20'>[ ReactiveCocoa / ReactiveCocoa ](https://github.com/ReactiveCocoa/ReactiveCocoa): A framework for composing and transforming streams of values * <img src='https://avatars3.githubusercontent.com/u/1088217?v=3&s=40' height='20' width='20'>[ hyperoslo / Form ](https://github.com/hyperoslo/Form): JSON driven form * <img src='https://avatars3.githubusercontent.com/u/265901?v=3&s=40' height='20' width='20'>[ samvermette / SVPullToRefresh ](https://github.com/samvermette/SVPullToRefresh): Give pull-to-refresh & infinite scrolling to any UIScrollView with 1 line of code. * <img src='https://avatars1.githubusercontent.com/u/1156192?v=3&s=40' height='20' width='20'>[ kevinzhow / PNChart ](https://github.com/kevinzhow/PNChart): A simple and beautiful chart lib used in Piner and CoinsMan for iOS * <img src='https://avatars1.githubusercontent.com/u/697021?v=3&s=40' height='20' width='20'>[ OpenEmu / OpenEmu ](https://github.com/OpenEmu/OpenEmu): Emulator framework for Mac OS X * <img src='https://avatars2.githubusercontent.com/u/68232?v=3&s=40' height='20' width='20'>[ rs / SDWebImage ](https://github.com/rs/SDWebImage): Asynchronous image downloader with cache support with an UIImageView category * <img src='https://avatars3.githubusercontent.com/u/250144?v=3&s=40' height='20' width='20'>[ realm / realm-cocoa ](https://github.com/realm/realm-cocoa): Realm is a mobile database: a replacement for Core Data & SQLite * <img src='https://avatars1.githubusercontent.com/u/164821?v=3&s=40' height='20' width='20'>[ facebook / KVOController ](https://github.com/facebook/KVOController): Simple, modern, thread-safe key-value observing for iOS and OS X. * <img src='https://avatars1.githubusercontent.com/u/1699865?v=3&s=40' height='20' width='20'>[ GabrielAlva / Cool-iOS-Camera ](https://github.com/GabrielAlva/Cool-iOS-Camera): A fully customisable and modern camera implementation for iOS made with AVFoundation. * <img src='https://avatars3.githubusercontent.com/u/719492?v=3&s=40' height='20' width='20'>[ d235j / 360Controller ](https://github.com/d235j/360Controller): TattieBogle Xbox 360 Driver (with improvements) * <img src='https://avatars3.githubusercontent.com/u/598870?v=3&s=40' height='20' width='20'>[ Masonry / Masonry ](https://github.com/Masonry/Masonry): Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout * <img src='https://avatars1.githubusercontent.com/u/988750?v=3&s=40' height='20' width='20'>[ anacrolix / torrent ](https://github.com/anacrolix/torrent): Full-featured BitTorrent client package and utilities * <img src='https://avatars1.githubusercontent.com/u/11505236?v=3&s=40' height='20' width='20'>[ google / gxui ](https://github.com/google/gxui): An experimental Go cross platform UI library. * <img src='https://avatars1.githubusercontent.com/u/520208?v=3&s=40' height='20' width='20'>[ fogleman / nes ](https://github.com/fogleman/nes): NES emulator written in Go. * <img src='https://avatars1.githubusercontent.com/u/749551?v=3&s=40' height='20' width='20'>[ docker / docker ](https://github.com/docker/docker): Docker - the open-source application container engine * <img src='https://avatars1.githubusercontent.com/u/4108044?v=3&s=40' height='20' width='20'>[ jamiealquiza / es-stats ](https://github.com/jamiealquiza/es-stats): ElasticSearch cluster metrics -> Graphite * <img src='https://avatars0.githubusercontent.com/u/2946214?v=3&s=40' height='20' width='20'>[ gogits / gogs ](https://github.com/gogits/gogs): Gogs(Go Git Service) is a painless self-hosted Git Service. * <img src='https://avatars3.githubusercontent.com/u/125426?v=3&s=40' height='20' width='20'>[ syncthing / syncthing ](https://github.com/syncthing/syncthing): Open Source Continuous File Synchronization * <img src='https://avatars3.githubusercontent.com/u/104030?v=3&s=40' height='20' width='20'>[ golang / go ](https://github.com/golang/go): The Go programming language * <img src='https://avatars0.githubusercontent.com/u/627898?v=3&s=40' height='20' width='20'>[ goburrow / gomelon ](https://github.com/goburrow/gomelon): Dropwizard-like web service framework in Go * <img src='https://avatars1.githubusercontent.com/u/4625714?v=3&s=40' height='20' width='20'>[ youtube / vitess ](https://github.com/youtube/vitess): vitess provides servers and tools which facilitate scaling of MySQL databases for large scale web services. * <img src='https://avatars0.githubusercontent.com/u/5507614?v=3&s=40' height='20' width='20'>[ zxh0 / jvm.go ](https://github.com/zxh0/jvm.go): A JVM written in GO... * <img src='https://avatars1.githubusercontent.com/u/2100512?v=3&s=40' height='20' width='20'>[ gizak / termui ](https://github.com/gizak/termui): Golang terminal dashboard * <img src='https://avatars0.githubusercontent.com/u/127379?v=3&s=40' height='20' width='20'>[ gin-gonic / gin ](https://github.com/gin-gonic/gin): Gin is a web framework written in Golang. It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin. * <img src='https://avatars1.githubusercontent.com/u/4479947?v=3&s=40' height='20' width='20'>[ coreos / etcd ](https://github.com/coreos/etcd): A highly-available key value store for shared configuration and service discovery * <img src='https://avatars3.githubusercontent.com/u/5751682?v=3&s=40' height='20' width='20'>[ GoogleCloudPlatform / kubernetes ](https://github.com/GoogleCloudPlatform/kubernetes): Container Cluster Manager from Google * <img src='https://avatars2.githubusercontent.com/u/297621?v=3&s=40' height='20' width='20'>[ influxdb / influxdb ](https://github.com/influxdb/influxdb): Scalable datastore for metrics, events, and real-time analytics * <img src='https://avatars0.githubusercontent.com/u/233907?v=3&s=40' height='20' width='20'>[ astaxie / <API key> ](https://github.com/astaxie/<API key>): A golang ebook intro how to build a web with golang * <img src='https://avatars1.githubusercontent.com/u/6843?v=3&s=40' height='20' width='20'>[ jinzhu / gorm ](https://github.com/jinzhu/gorm): The fantastic ORM library for Golang, aims to be developer friendly * <img src='https://avatars0.githubusercontent.com/u/233907?v=3&s=40' height='20' width='20'>[ astaxie / beego ](https://github.com/astaxie/beego): beego is an open-source, high-performance web framework for the Go programming language. * <img src='https://avatars2.githubusercontent.com/u/715656?v=3&s=40' height='20' width='20'>[ joewalnes / websocketd ](https://github.com/joewalnes/websocketd): Turn any program that uses STDIN/STDOUT into a WebSocket server. Like inetd, but for WebSockets. * <img src='https://avatars0.githubusercontent.com/u/10121772?v=3&s=40' height='20' width='20'>[ grpc / grpc-go ](https://github.com/grpc/grpc-go): The Go language implementation of gRPC. HTTP/2 based RPC * <img src='https://avatars3.githubusercontent.com/u/195836?v=3&s=40' height='20' width='20'>[ phuslu / goproxy ](https://github.com/phuslu/goproxy): a go proxy * <img src='https://avatars3.githubusercontent.com/u/118015?v=3&s=40' height='20' width='20'>[ boltdb / bolt ](https://github.com/boltdb/bolt): A low-level key/value database for Go. * <img src='https://avatars0.githubusercontent.com/u/592032?v=3&s=40' height='20' width='20'>[ hashicorp / consul ](https://github.com/hashicorp/consul): Consul is a tool for service discovery, monitoring and configuration. * <img src='https://avatars2.githubusercontent.com/u/1754002?v=3&s=40' height='20' width='20'>[ rancherio / os ](https://github.com/rancherio/os): The easiest way to run Docker in production # javascript * <img src='https://avatars0.githubusercontent.com/u/60294?v=3&s=40' height='20' width='20'>[ kriskowal / gtor ](https://github.com/kriskowal/gtor): A General Theory of Reactivity * <img src='https://avatars0.githubusercontent.com/u/2171796?v=3&s=40' height='20' width='20'>[ arasatasaygin / is.js ](https://github.com/arasatasaygin/is.js): Micro check library * <img src='https://avatars0.githubusercontent.com/u/2781777?v=3&s=40' height='20' width='20'>[ cazala / synaptic ](https://github.com/cazala/synaptic): architecture-free neural network library for node.js and the browser * <img src='https://avatars0.githubusercontent.com/u/1213542?v=3&s=40' height='20' width='20'>[ DemocracyOS / app ](https://github.com/DemocracyOS/app): DemocracyOS is an online space for deliberation and voting on political proposals. The software aims to stimulate better arguments and come to better rulings. * <img src='https://avatars3.githubusercontent.com/u/216296?v=3&s=40' height='20' width='20'>[ angular / angular.js ](https://github.com/angular/angular.js): HTML enhanced for web apps * <img src='https://avatars1.githubusercontent.com/u/376661?v=3&s=40' height='20' width='20'>[ mafintosh / airpaste ](https://github.com/mafintosh/airpaste): A 1-1 network pipe that auto discovers other peers using mdns * <img src='https://avatars0.githubusercontent.com/u/182219?v=3&s=40' height='20' width='20'>[ enaqx / awesome-react ](https://github.com/enaqx/awesome-react): A collection of awesome React libraries, resources and shiny things. * <img src='https://avatars2.githubusercontent.com/u/230541?v=3&s=40' height='20' width='20'>[ mbostock / d3 ](https://github.com/mbostock/d3): A JavaScript visualization library for HTML and SVG. * <img src='https://avatars3.githubusercontent.com/u/8445?v=3&s=40' height='20' width='20'>[ facebook / react ](https://github.com/facebook/react): A declarative, efficient, and flexible JavaScript library for building user interfaces. * <img src='https://avatars1.githubusercontent.com/u/16724?v=3&s=40' height='20' width='20'>[ meteor / meteor ](https://github.com/meteor/meteor): Meteor, an ultra-simple, database-everywhere, data-on-the-wire, pure-Javascript web framework. * <img src='https://avatars2.githubusercontent.com/u/6561371?v=3&s=40' height='20' width='20'>[ nathanford / type.js ](https://github.com/nathanford/type.js): Type.js – Typographic tools for better web type. * <img src='https://avatars0.githubusercontent.com/u/4514159?v=3&s=40' height='20' width='20'>[ arnarthor / <API key> ](https://github.com/arnarthor/<API key>): React boilerplate using webpack with ImmutableJS, Flummox, Babel and ESlint. * <img src='https://avatars3.githubusercontent.com/u/919913?v=3&s=40' height='20' width='20'>[ dnomak / frontend-folder ](https://github.com/dnomak/frontend-folder): Frontend Folder * <img src='https://avatars0.githubusercontent.com/u/412533?v=3&s=40' height='20' width='20'>[ mailcheck / mailcheck ](https://github.com/mailcheck/mailcheck): Reduce user-misspelled email addresses in your forms. * <img src='https://avatars2.githubusercontent.com/u/1265995?v=3&s=40' height='20' width='20'>[ driftyco / ionic ](https://github.com/driftyco/ionic): Advanced HTML5 mobile development framework and SDK. Build incredible hybrid apps with web technologies you already know and love. Best friends with AngularJS. * <img src='https://avatars3.githubusercontent.com/u/97088?v=3&s=40' height='20' width='20'>[ mrdoob / three.js ](https://github.com/mrdoob/three.js): JavaScript 3D library. * <img src='https://avatars1.githubusercontent.com/u/425716?v=3&s=40' height='20' width='20'>[ gulpjs / gulp ](https://github.com/gulpjs/gulp): The streaming build system * <img src='https://avatars2.githubusercontent.com/u/181635?v=3&s=40' height='20' width='20'>[ nodegit / nodegit ](https://github.com/nodegit/nodegit): Native Node bindings to Git. * <img src='https://avatars0.githubusercontent.com/u/23123?v=3&s=40' height='20' width='20'>[ Semantic-Org / Semantic-UI ](https://github.com/Semantic-Org/Semantic-UI): Semantic is a UI component framework based around useful principles from natural language. * <img src='https://avatars0.githubusercontent.com/u/12100?v=3&s=40' height='20' width='20'>[ reapp / reapp ](https://github.com/reapp/reapp): Reapp - next gen hybrid apps * <img src='https://avatars3.githubusercontent.com/u/629429?v=3&s=40' height='20' width='20'>[ hakimel / reveal.js ](https://github.com/hakimel/reveal.js): The HTML Presentation Framework * <img src='https://avatars3.githubusercontent.com/u/33044?v=3&s=40' height='20' width='20'>[ caiogondim / logdown ](https://github.com/caiogondim/logdown): Debug utility with markdown support that runs on browser and server * <img src='https://avatars1.githubusercontent.com/u/35996?v=3&s=40' height='20' width='20'>[ angular / angular ](https://github.com/angular/angular): * <img src='https://avatars1.githubusercontent.com/u/339208?v=3&s=40' height='20' width='20'>[ airbnb / javascript ](https://github.com/airbnb/javascript): JavaScript Style Guide * <img src='https://avatars1.githubusercontent.com/u/50130?v=3&s=40' height='20' width='20'>[ facebook / immutable-js ](https://github.com/facebook/immutable-js): Immutable persistent data collections for Javascript which increase efficiency and simplicity. # ruby * <img src='https://avatars2.githubusercontent.com/u/3356474?v=3&s=40' height='20' width='20'>[ skywinder / <API key> ](https://github.com/skywinder/<API key>): Automatically generate change log from your tags, issues, labels and pull requests on GitHub. * <img src='https://avatars1.githubusercontent.com/u/7573396?v=3&s=40' height='20' width='20'>[ tom-lord / missy_elliott ](https://github.com/tom-lord/missy_elliott): A Missy Elliott - inspired encoding algorithm * <img src='https://avatars2.githubusercontent.com/u/568243?v=3&s=40' height='20' width='20'>[ Homebrew / homebrew ](https://github.com/Homebrew/homebrew): The missing package manager for OS X. * <img src='https://avatars2.githubusercontent.com/u/118992?v=3&s=40' height='20' width='20'>[ neonichu / Rome ](https://github.com/neonichu/Rome): Rome makes it easy to build a list of frameworks. * <img src='https://avatars2.githubusercontent.com/u/16700?v=3&s=40' height='20' width='20'>[ ruby / ruby ](https://github.com/ruby/ruby): The Ruby Programming Language * <img src='https://avatars2.githubusercontent.com/u/237985?v=3&s=40' height='20' width='20'>[ jekyll / jekyll ](https://github.com/jekyll/jekyll): Jekyll is a blog-aware, static site generator in Ruby * <img src='https://avatars3.githubusercontent.com/u/9582?v=3&s=40' height='20' width='20'>[ plataformatec / devise ](https://github.com/plataformatec/devise): Flexible authentication solution for Rails with Warden. * <img src='https://avatars1.githubusercontent.com/u/3124?v=3&s=40' height='20' width='20'>[ rails / rails ](https://github.com/rails/rails): Ruby on Rails * <img src='https://avatars1.githubusercontent.com/u/305940?v=3&s=40' height='20' width='20'>[ gitlabhq / gitlabhq ](https://github.com/gitlabhq/gitlabhq): GitLab is version control for your server * <img src='https://avatars3.githubusercontent.com/u/820186?v=3&s=40' height='20' width='20'>[ podigee / device_detector ](https://github.com/podigee/device_detector): DeviceDetector is a precise and fast user agent parser and device detector written in Ruby * <img src='https://avatars1.githubusercontent.com/u/5520?v=3&s=40' height='20' width='20'>[ hybridgroup / artoo ](https://github.com/hybridgroup/artoo): Ruby robotics framework using Celluloid * <img src='https://avatars2.githubusercontent.com/u/1299?v=3&s=40' height='20' width='20'>[ mitchellh / vagrant ](https://github.com/mitchellh/vagrant): Vagrant is a tool for building and distributing development environments. * <img src='https://avatars0.githubusercontent.com/u/727482?v=3&s=40' height='20' width='20'>[ caskroom / homebrew-cask ](https://github.com/caskroom/homebrew-cask): A CLI workflow for the administration of Mac applications distributed as binaries * <img src='https://avatars1.githubusercontent.com/u/17538?v=3&s=40' height='20' width='20'>[ discourse / discourse ](https://github.com/discourse/discourse): A platform for community discussion. Free, open, simple. * <img src='https://avatars1.githubusercontent.com/u/216339?v=3&s=40' height='20' width='20'>[ twbs / bootstrap-sass ](https://github.com/twbs/bootstrap-sass): Official Sass port of Bootstrap * <img src='https://avatars1.githubusercontent.com/u/4632?v=3&s=40' height='20' width='20'>[ thoughtbot / paperclip ](https://github.com/thoughtbot/paperclip): Easy file attachment management for ActiveRecord * <img src='https://avatars0.githubusercontent.com/u/131818?v=3&s=40' height='20' width='20'>[ elastic / logstash ](https://github.com/elastic/logstash): logstash - logs/event transport, processing, management, search. * <img src='https://avatars0.githubusercontent.com/u/2114465?v=3&s=40' height='20' width='20'>[ aws / aws-sdk-rails ](https://github.com/aws/aws-sdk-rails): Official repository for the aws-sdk-rails gem, which integrates the AWS SDK for Ruby V2 with Ruby on Rails. * <img src='https://avatars1.githubusercontent.com/u/47848?v=3&s=40' height='20' width='20'>[ plataformatec / simple_form ](https://github.com/plataformatec/simple_form): Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup. * <img src='https://avatars0.githubusercontent.com/u/11493?v=3&s=40' height='20' width='20'>[ amatsuda / kaminari ](https://github.com/amatsuda/kaminari): A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for Rails 3 and 4 * <img src='https://avatars3.githubusercontent.com/u/1048705?v=3&s=40' height='20' width='20'>[ CocoaPods / CocoaPods ](https://github.com/CocoaPods/CocoaPods): The Cocoa Dependency Manager. * <img src='https://avatars0.githubusercontent.com/u/2687?v=3&s=40' height='20' width='20'>[ spree / spree ](https://github.com/spree/spree): Spree is a complete open source e-commerce solution for Ruby on Rails. * <img src='https://avatars1.githubusercontent.com/u/83835?v=3&s=40' height='20' width='20'>[ cantino / huginn ](https://github.com/cantino/huginn): Build agents that monitor and act on your behalf. Your agents are standing by! * <img src='https://avatars0.githubusercontent.com/u/103882?v=3&s=40' height='20' width='20'>[ bbatsov / rubocop ](https://github.com/bbatsov/rubocop): A Ruby static code analyzer, based on the community Ruby style guide. * <img src='https://avatars3.githubusercontent.com/u/179065?v=3&s=40' height='20' width='20'>[ charliesome / better_errors ](https://github.com/charliesome/better_errors): Better error page for Rack apps
<?php class <API key> extends <API key> { protected function code() { $this->setResult('success', false); $post = <API key>::getInstance(); $post->trim(); $post->htmlSpecialChars();; $post->setLength(500); $stop = false; $session = Dune_Session::getInstance('data'); $session->clearZone(); foreach ($post as $key => $value) { $session->$key = $value; } if (!$this->gm) { if ($post->balcony) $session->balcony = 1; else $session->balcony = 0; if ($post->loggia) $session->loggia = 1; else $session->loggia = 0; if ($post->activity) $session->activity = 1; else $session->activity = 0; if ($post->have_phone) $session->have_phone = 1; else $session->have_phone = 0; // if ($post->haggling) $session->haggling = $post->getDigit('haggling'); // else // $session->haggling = 0; if ($post->house_type) $session->house_type = $post->getDigit('house_type'); else $session->house_type = 0; $spaces = new Dune_String_Explode($session->space_total,'/', 1); if ($spaces->count() == 3) { $session->space_total = $spaces[1]; $session->space_living = $spaces[2]; $session->space_kitchen = $spaces[3]; } } $session = Dune_Session::getInstance('control'); $object = <API key><API key>::getInstance($session->edit); // else $session = Dune_Session::getInstance('data'); $object->setTypeId($post->type); unset($session->type); $object->loadData($session->getZone()); if ($this->update_id) { $result = $object->save(); } else { //$result = $object->add(); } if ($result) { $session->clearZone(); $this->setResult('success', true); } $this->setResult('id', $result); } }
#include "modules/audio_coding/neteq/dtmf_buffer.h" #include <assert.h> #include <algorithm> // max #include <API key> //original-code:"rtc_base/checks.h" #include <API key> //original-code:"rtc_base/logging.h" // Modify the code to obtain backwards bit-exactness. Once bit-exactness is no // longer required, this #define should be removed (and the code that it // enables). #define LEGACY_BITEXACT namespace webrtc { DtmfBuffer::DtmfBuffer(int fs_hz) { SetSampleRate(fs_hz); } DtmfBuffer::~DtmfBuffer() = default; void DtmfBuffer::Flush() { buffer_.clear(); } // The ParseEvent method parses 4 bytes from |payload| according to this format // from RFC 4733: // 0 1 2 3 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 // | event |E|R| volume | duration | // Legend (adapted from RFC 4733) // - event: The event field is a number between 0 and 255 identifying a // specific telephony event. The buffer will not accept any event // numbers larger than 15. // - E: If set to a value of one, the "end" bit indicates that this // packet contains the end of the event. For long-lasting events // that have to be split into segments, only the final packet for // the final segment will have the E bit set. // - R: Reserved. // - volume: For DTMF digits and other events representable as tones, this // field describes the power level of the tone, expressed in dBm0 // after dropping the sign. Power levels range from 0 to -63 dBm0. // Thus, larger values denote lower volume. The buffer discards // values larger than 36 (i.e., lower than -36 dBm0). // - duration: The duration field indicates the duration of the event or segment // being reported, in timestamp units, expressed as an unsigned // integer in network byte order. For a non-zero value, the event // or segment began at the instant identified by the RTP timestamp // and has so far lasted as long as indicated by this parameter. // The event may or may not have ended. If the event duration // exceeds the maximum representable by the duration field, the // event is split into several contiguous segments. The buffer will // discard zero-duration events. int DtmfBuffer::ParseEvent(uint32_t rtp_timestamp, const uint8_t* payload, size_t <API key>, DtmfEvent* event) { RTC_CHECK(payload); RTC_CHECK(event); if (<API key> < 4) { RTC_LOG(LS_WARNING) << "ParseEvent payload too short"; return kPayloadTooShort; } event->event_no = payload[0]; event->end_bit = ((payload[1] & 0x80) != 0); event->volume = (payload[1] & 0x3F); event->duration = payload[2] << 8 | payload[3]; event->timestamp = rtp_timestamp; return kOK; } // Inserts a DTMF event into the buffer. The event should be parsed from the // bit stream using the ParseEvent method above before inserting it in the // buffer. // DTMF events can be quite long, and in most cases the duration of the event // is not known when the first packet describing it is sent. To deal with that, // the RFC 4733 specifies that multiple packets are sent for one and the same // event as it is being created (typically, as the user is pressing the key). // These packets will all share the same start timestamp and event number, // while the duration will be the cumulative duration from the start. When // inserting a new event, the InsertEvent method tries to find a matching event // already in the buffer. If so, the new event is simply merged with the // existing one. int DtmfBuffer::InsertEvent(const DtmfEvent& event) { if (event.event_no < 0 || event.event_no > 15 || event.volume < 0 || event.volume > 63 || event.duration <= 0 || event.duration > 65535) { RTC_LOG(LS_WARNING) << "InsertEvent invalid parameters"; return <API key>; } DtmfList::iterator it = buffer_.begin(); while (it != buffer_.end()) { if (MergeEvents(it, event)) { // A matching event was found and the new event was merged. return kOK; } ++it; } buffer_.push_back(event); // Sort the buffer using CompareEvents to rank the events. buffer_.sort(CompareEvents); return kOK; } bool DtmfBuffer::GetEvent(uint32_t current_timestamp, DtmfEvent* event) { DtmfList::iterator it = buffer_.begin(); while (it != buffer_.end()) { // |event_end| is an estimate of where the current event ends. If the end // bit is set, we know that the event ends at |timestamp| + |duration|. uint32_t event_end = it->timestamp + it->duration; #ifdef LEGACY_BITEXACT bool next_available = false; #endif if (!it->end_bit) { // If the end bit is not set, we allow extrapolation of the event for // some time. event_end += <API key>; DtmfList::iterator next = it; ++next; if (next != buffer_.end()) { // If there is a next event in the buffer, we will not extrapolate over // the start of that new event. event_end = std::min(event_end, next->timestamp); #ifdef LEGACY_BITEXACT next_available = true; #endif } } if (current_timestamp >= it->timestamp && current_timestamp <= event_end) { // TODO(hlundin): Change to <. // Found a matching event. if (event) { event->event_no = it->event_no; event->end_bit = it->end_bit; event->volume = it->volume; event->duration = it->duration; event->timestamp = it->timestamp; } #ifdef LEGACY_BITEXACT if (it->end_bit && current_timestamp + frame_len_samples_ >= event_end) { // We are done playing this. Erase the event. buffer_.erase(it); } #endif return true; } else if (current_timestamp > event_end) { // TODO(hlundin): Change to >=. // Erase old event. Operation returns a valid pointer to the next element // in the list. #ifdef LEGACY_BITEXACT if (!next_available) { if (event) { event->event_no = it->event_no; event->end_bit = it->end_bit; event->volume = it->volume; event->duration = it->duration; event->timestamp = it->timestamp; } it = buffer_.erase(it); return true; } else { it = buffer_.erase(it); } #else it = buffer_.erase(it); #endif } else { ++it; } } return false; } size_t DtmfBuffer::Length() const { return buffer_.size(); } bool DtmfBuffer::Empty() const { return buffer_.empty(); } int DtmfBuffer::SetSampleRate(int fs_hz) { if (fs_hz != 8000 && fs_hz != 16000 && fs_hz != 32000 && fs_hz != 48000) { return kInvalidSampleRate; } <API key> = 7 * fs_hz / 100; frame_len_samples_ = fs_hz / 100; return kOK; } // The method returns true if the two events are considered to be the same. // The are defined as equal if they share the same timestamp and event number. // The special case with long-lasting events that have to be split into segments // is not handled in this method. These will be treated as separate events in // the buffer. bool DtmfBuffer::SameEvent(const DtmfEvent& a, const DtmfEvent& b) { return (a.event_no == b.event_no) && (a.timestamp == b.timestamp); } bool DtmfBuffer::MergeEvents(DtmfList::iterator it, const DtmfEvent& event) { if (SameEvent(*it, event)) { if (!it->end_bit) { // Do not extend the duration of an event for which the end bit was // already received. it->duration = std::max(event.duration, it->duration); } if (event.end_bit) { it->end_bit = true; } return true; } else { return false; } } // Returns true if |a| goes before |b| in the sorting order ("|a| < |b|"). // The events are ranked using their start timestamp (taking wrap-around into // account). In the unlikely situation that two events share the same start // timestamp, the event number is used to rank the two. Note that packets // that belong to the same events, and therefore sharing the same start // timestamp, have already been merged before the sort method is called. bool DtmfBuffer::CompareEvents(const DtmfEvent& a, const DtmfEvent& b) { if (a.timestamp == b.timestamp) { return a.event_no < b.event_no; } // Take wrap-around into account. return (static_cast<uint32_t>(b.timestamp - a.timestamp) < 0xFFFFFFFF / 2); } } // namespace webrtc
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Wyam.Abstractions; namespace Wyam.Core.Modules { // This filters the documents public class Where : IModule { private readonly Func<IDocument, bool> _predicate; public Where(Func<IDocument, bool> predicate) { _predicate = predicate; } public IEnumerable<IDocument> Execute(IReadOnlyList<IDocument> inputs, IExecutionContext context) { return inputs.Where(_predicate); } } }
# docker-jenkins Dockerfile for Jenkins. Last update: Tue 05 April 2016 Docker version: 1.10.3 Will update this once personal builds are reconfigured.
<?php namespace CodeDocs\Processor; use CodeDocs\Exception\MarkupException; use CodeDocs\Helper\Filesystem; use CodeDocs\Logger; use CodeDocs\ProcessorInterface; use CodeDocs\State; use RuntimeException; /** * Copies generated doc files to a given directory */ class CopyExportFiles implements ProcessorInterface { /** * @var string */ private $destination; /** * @var bool */ private $purge; /** * @param string $destination * @param bool $purge */ public function __construct($destination, $purge = false) { $this->destination = $destination; $this->purge = $purge; } /** * @param State $state * @param Logger $logger * * @throws RuntimeException * @throws MarkupException */ public function run(State $state, Logger $logger) { $filesystem = new Filesystem(); $from = realpath($state->config->getExportDir()); if (!$from) { throw new MarkupException('export dir does not exist'); } if (!$this->destination) { throw new MarkupException('destination no set'); } $to = $state->config->getBaseDir() . '/' . $this->destination; if ($this->purge) { $filesystem->purge($to); } $logger->log(0, sprintf('mirror export dir (%s -> %s)', $from, $to)); $filesystem->copy($from, $to); } }
package com.blinkboxbooks.android.model; public class BookmarkUpdatedBy { public String client_id; public String client_name; }
package openperipheral.integration.minefactoryreloaded; import openmods.reflection.MethodAccess; import openmods.reflection.MethodAccess.Function0; import openmods.reflection.MethodAccess.Function1; import openmods.reflection.ReflectionHelper; import openperipheral.api.adapter.IPeripheralAdapter; import openperipheral.api.adapter.method.Arg; import openperipheral.api.adapter.method.ReturnType; import openperipheral.api.adapter.method.ScriptCallable; public class <API key> implements IPeripheralAdapter { private final Class<?> CLASS = ReflectionHelper.getClass("powercrystals.minefactoryreloaded.tile.machine.<API key>"); private final Function0<Integer> GET_TARGET_LEVEL = MethodAccess.create(int.class, CLASS, "getTargetLevel"); private final Function1<Void, Integer> SET_TARGET_LEVEL = MethodAccess.create(void.class, CLASS, int.class, "setTargetLevel"); @Override public String getSourceId() { return "mfr_enchanter"; } @Override public Class<?> getTargetClass() { return CLASS; } @ScriptCallable(description = "Get target level of enchantment", returnTypes = ReturnType.NUMBER) public int getTargetLevel(Object <API key>) { return GET_TARGET_LEVEL.call(<API key>); } @ScriptCallable(description = "Set the target level of enchantment (1-30)") public void setTargetLevel(Object <API key>, @Arg(name = "level") int level) { SET_TARGET_LEVEL.call(<API key>, level); } }
<?php namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\Models\CMS\CmsGroup; use Doctrine\ORM\Tools\Pagination\Paginator; /** * @group DDC-1918 */ class DDC1918Test extends \Doctrine\Tests\<API key> { protected function setUp() : void { $this->useModelSet('cms'); parent::setUp(); } public function testLastPageCorrect() { $groups = []; for ($i = 0; $i < 3; $i++) { $group = new CmsGroup(); $group->name = "test"; $this->_em->persist($group); $groups[] = $group; } for ($i = 0; $i < 10; $i++) { $user = new CmsUser(); $user->username = "user$i"; $user->name = "user$i"; $user->status = "active"; $user->groups = $groups; $this->_em->persist($user); } $this->_em->flush(); $query = $this->_em->createQuery('SELECT u, g FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.groups g'); $query->setFirstResult(6); $query->setMaxResults(3); $paginator = new Paginator($query, true); $this->assertEquals(3, count(iterator_to_array($paginator))); $query->setFirstResult(8); $query->setMaxResults(3); $paginator = new Paginator($query, true); $this->assertEquals(2, count(iterator_to_array($paginator))); $query->setFirstResult(10); $query->setMaxResults(3); $paginator = new Paginator($query, true); $this->assertEquals(0, count(iterator_to_array($paginator))); } }
namespace CloudLibrary.Common.Diagnostics { using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Text; <summary> Utilities for diagnostic </summary> <history> <create time="2016/5/16" author="lixinxu" /> </history> public static class DiagnosticUtilities { private const string <API key> = "Stack Trace"; private const string DefaultFileLabel = "File"; private const string DefaultLineLabel = "Line"; private const string DefaultColumnLabel = "Column"; private const string <API key> = "Runtime Information"; private const string <API key> = "Event Source"; private const string DefaultEventIdTitle = "Event Id"; private const string <API key> = "Exception Data"; private const string <API key> = "Inner Exception"; private const string <API key> = "{0}:\"{1}\""; private const string <API key> = "{0}:{1}"; <summary> Add stack trace information into message builder </summary> <param name="builder">string builder</param> <param name="stackTrace">stack trace</param> <param name="title">stack trace title</param> <param name="fileLabel">file label</param> <param name="lineLable">line label</param> <param name="columnLabel">column label</param> public static void <API key>( StringBuilder builder, StackTrace stackTrace, string title = <API key>, string fileLabel = DefaultFileLabel, string lineLable = DefaultLineLabel, string columnLabel = DefaultColumnLabel) { if (stackTrace != null) { var frames = stackTrace.GetFrames(); if (!frames.IsNullOrEmpty()) { builder.AppendLine($"{title}:"); foreach (var frame in frames) { builder.Append('\t'); DiagnosticUtilities.<API key>(builder, frame, fileLabel, lineLable, columnLabel); builder.AppendLine(); } } } } <summary> Add method information to message builder </summary> <param name="builder">string builder</param> <param name="frame">stack frame</param> <param name="fileLabel">file label</param> <param name="lineLable">line label</param> <param name="columnLabel">column label</param> public static void <API key>( StringBuilder builder, StackFrame frame, string fileLabel, string lineLable, string columnLabel) { try { var methodInformation = frame.GetMethod(); builder.AppendFormat("{0}(", methodInformation.Name); var parameters = methodInformation.GetParameters(); if (!parameters.IsNullOrEmpty()) { var first = false; foreach (var parameter in parameters) { if (!first) { builder.Append(", "); first = false; } builder.AppendFormat("{0} {1}", parameter.ParameterType.Name, parameter.Name); } } builder.Append(")"); var filename = frame.GetFileName(); if (!string.IsNullOrEmpty(filename)) { builder.AppendFormat(" " + <API key>, fileLabel, filename); var lineNumber = frame.GetFileLineNumber(); if (lineNumber > 0) { builder.AppendFormat(" " + <API key>, lineLable, lineNumber); } var columnNumber = frame.GetFileColumnNumber(); if (columnNumber > 0) { builder.AppendFormat(" " + <API key>, columnLabel, columnNumber); } } } catch (Exception exception) { builder.AppendLine(exception.ToString()); } } <summary> Add runtime information </summary> <param name="builder">message builder</param> <param name="runtimeInformation">runtime information</param> <param name="title">title for runtime information</param> public static void <API key>( StringBuilder builder, IReadOnlyDictionary<string, object> runtimeInformation, string title = <API key>) { if (!runtimeInformation.<API key>()) { builder.AppendFormat("{0}:", title); builder.AppendLine(); foreach (var pair in runtimeInformation) { string value; try { value = pair.Value.ToString(); } catch (Exception exception) { value = exception.ToString(); } builder.AppendLine($"\t{pair.Key}: {value}"); } } } <summary> Format event log message </summary> <param name="builder">event message builder</param> <param name="template">message template</param> <param name="parameters">parameters for template to build the message</param> <remarks> <para>Basically it is kind of builder.AppendFormat(template, parameters). However, it does more:</para> <para>1. if calling parameter.ToString() failed, it will add exception information and log error</para> <para>2. if parameter is an exception. It will add more information like inner exception information</para> <para>3. if parameter is inherit from ExceptionBase, it will add more information like error id, runtime information, and so on</para> <para>4. if string.Format() failed, for example, number of parameters in template does not match, i.e. template uses "Could not find file {0} in folder {1}" but only one parameter provided. The Method will try to recover the issue and report error.</para> </remarks> public static void FormatMessage(StringBuilder builder, string template, params object[] parameters) { if (parameters.IsNullOrEmpty()) { builder.Append(template); return; } var items = new string[parameters.Length]; for (var i = 0; i < parameters.Length; i++) { var parameter = parameters[i]; if ((parameter == null) || (parameter is string)) { items[i] = parameter as string; } else if (parameter is Exception) { var exceptionBuilder = new StringBuilder(); <API key>(exceptionBuilder, parameter as Exception); items[i] = exceptionBuilder.ToString(); } else { string value; try { value = parameter.ToString(); } catch(Exception exception) { // TODO: log error value = exception.ToString(); } items[i] = value; } } string message; try { message = string.Format(template, items); builder.Append(message); } catch (Exception exception) { builder.AppendFormat("Template:{0}", template); builder.AppendLine(); builder.AppendLine("Parameters:"); for (var i = 0; i < items.Length; i++) { builder.AppendFormat(<API key>, i, items[i]); builder.AppendLine(); } builder.AppendLine("Format exception:"); <API key>(builder, exception); } } public static void <API key>( StringBuilder builder, Exception exception, string eventSourceTitle = <API key>, string eventIdTitle = DefaultEventIdTitle) { var isInnerException = false; while (exception != null) { if (isInnerException) { builder.AppendLine(" } var predefinedException = exception as ExceptionBase; if (predefinedException != null) { builder.AppendFormat(<API key>, eventSourceTitle, predefinedException.EventSource); builder.AppendLine(); builder.AppendFormat(<API key>, eventIdTitle, predefinedException.EventId); builder.AppendLine(); <API key>(builder, predefinedException.RuntimeInformation); } if (!exception.Data.IsNullOrEmpty()) { builder.AppendFormat("{0}:", <API key>); foreach (DictionaryEntry pair in exception.Data) { builder.AppendFormat("\t" + <API key>, pair.Key, pair.Value); } } var stackTrace = new StackTrace(exception, true); <API key>(builder, stackTrace); exception = exception.InnerException; isInnerException = true; } } } }
package ca.appspace.bean.serialization.server; public class <API key> extends Exception { private static final long serialVersionUID = 1L; public <API key>() { // TODO Auto-generated constructor stub } public <API key>(String arg0) { super(arg0); // TODO Auto-generated constructor stub } public <API key>(Throwable arg0) { super(arg0); // TODO Auto-generated constructor stub } public <API key>(String arg0, Throwable arg1) { super(arg0, arg1); // TODO Auto-generated constructor stub } }
FROM debian:jessie MAINTAINER Byte Pixie <hello@bytepixie.com> RUN apt-get update \ && apt-get install -y --<API key> \ ca-certificates \ libssl1.0.0 \ logrotate \ curl \ && curl -L https://dzbscw1ubdtyw.cloudfront.net/actordb_0.10.25-1_amd64.deb -o /tmp/actordb.deb \ && dpkg -i /tmp/actordb.deb \ && curl -L https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb -o /tmp/dumb-init.deb \ && dpkg -i /tmp/dumb-init.deb \ && apt-get purge --auto-remove -y \ curl \ && apt-get clean \
package de.sfdccommander.controller.helper; import java.io.File; import java.io.FilenameFilter; /** * @author jochen * */ public class XmlFileNameFilter implements FilenameFilter { @Override public final boolean accept(final File aDir, final String aName) { boolean accept = true; String extension = aName.substring(aName.lastIndexOf(".") + 1) .toLowerCase(); for (String codeExtension : CodeFileNameFilter.extensions) { if (extension.equals(codeExtension)) { accept = false; break; } } return accept; } }
import figures.Rectangle; import input.InputManager; public class Main { public static void main(String[] args) { InputManager inputManager = new InputManager(); Rectangle rectangle = inputManager.<API key>(); inputManager.<API key>(rectangle); } }
System.register(['angular2/core', "angular2/common", '../../services/stores/category-store', "../../services/actions/category-actions", "../../services/drinks-api-service", "../../services/actions/drink-query-actions"], function(exports_1) { var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.<API key>(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var core_1, common_1, category_store_1, category_actions_1, <API key>, <API key>; var CategoryItem, CategoryList; return { setters:[ function (core_1_1) { core_1 = core_1_1; }, function (common_1_1) { common_1 = common_1_1; }, function (category_store_1_1) { category_store_1 = category_store_1_1; }, function (<API key>) { category_actions_1 = <API key>; }, function (<API key>) { <API key> = <API key>; }, function (<API key>) { <API key> = <API key>; }], execute: function() { CategoryItem = (function () { function CategoryItem() { var _this = this; this.selected = new core_1.EventEmitter(); this.searchForDrinks = function (drinkString) { return _this.selected.next(drinkString); }; } __decorate([ core_1.Input(), __metadata('design:type', Object) ], CategoryItem.prototype, "category", void 0); __decorate([ core_1.Output(), __metadata('design:type', core_1.EventEmitter) ], CategoryItem.prototype, "selected", void 0); CategoryItem = __decorate([ core_1.Component({ selector: 'category-item', directives: [common_1.NgFor, CategoryItem], template: "\n <div class=\"category-name\">\n <a (click)=\"searchForDrinks(category.name)\" >{{category.name}}</a>\n <div class=\"sub-cats\">\n <category-item\n *ngFor=\"#subcategory of category.children\"\n [category]=\"subcategory\" (selected)=\"searchForDrinks($event)\"></category-item>\n </div>\n </div>\n ", styles: ["\n :host {\n width: 200px;\n }\n\n a {\n margin: 6px 0;\n font-size: 18px;\n }\n\n .sub-cats {\n padding-left: 20px;\n }\n\n .sub-cats a {\n margin: 3px 0;\n font-size: 15px;\n font-weight: 400;\n }\n\n .category-name {\n font-size: 18px;\n }\n\n "] }), __metadata('design:paramtypes', []) ], CategoryItem); return CategoryItem; })(); CategoryList = (function () { function CategoryList(_categoryStore) { var _this = this; this._categoryStore = _categoryStore; this.<API key> = category_actions_1.CategoryActions.getCategories; this.requestNewDrinks = function (res) { <API key>.DrinkActions.getDrinksByCategory(res); }; this.<API key>(); _categoryStore.stream.subscribe(function (res) { return _this.categoryList = res; }); } CategoryList = __decorate([ core_1.Component({ providers: [category_actions_1.CategoryActions, <API key>.DrinkActions, category_store_1.CategoryStore, <API key>.<API key>], selector: "category-list", template: "\n <span>**Sub Categories WIP**</span>\n <category-item *ngFor=\"#category of categoryList\" [category]=\"category\" (selected)=\"requestNewDrinks($event)\"></category-item>\n ", directives: [common_1.NgFor, CategoryItem], styles: ["\n :host {\n width: 20vw;\n height: 100vw;\n overflow: scroll;\n display: flex;\n flex-direction: column;\n }"] }), __metadata('design:paramtypes', [category_store_1.CategoryStore]) ], CategoryList); return CategoryList; })(); exports_1("CategoryList", CategoryList); } } }); //# sourceMappingURL=category-list.js.map
// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.appservice.models; import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** Value of resource metric. */ @Immutable public final class ResourceMetricValue { @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceMetricValue.class); /* * Value timestamp. */ @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) private String timestamp; /* * Value average. */ @JsonProperty(value = "average", access = JsonProperty.Access.WRITE_ONLY) private Float average; /* * Value minimum. */ @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) private Float minimum; /* * Value maximum. */ @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) private Float maximum; /* * Value total. */ @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) private Float total; /* * Value count. */ @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) private Float count; /* * Resource metric properties collection. */ @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private List<<API key>> properties; /** * Get the timestamp property: Value timestamp. * * @return the timestamp value. */ public String timestamp() { return this.timestamp; } /** * Get the average property: Value average. * * @return the average value. */ public Float average() { return this.average; } /** * Get the minimum property: Value minimum. * * @return the minimum value. */ public Float minimum() { return this.minimum; } /** * Get the maximum property: Value maximum. * * @return the maximum value. */ public Float maximum() { return this.maximum; } /** * Get the total property: Value total. * * @return the total value. */ public Float total() { return this.total; } /** * Get the count property: Value count. * * @return the count value. */ public Float count() { return this.count; } /** * Get the properties property: Resource metric properties collection. * * @return the properties value. */ public List<<API key>> properties() { return this.properties; } /** * Validates the instance. * * @throws <API key> thrown if the instance is not valid. */ public void validate() { if (properties() != null) { properties().forEach(e -> e.validate()); } } }
import { ReactElement } from "react"; import TableCellList from "./TableCellList"; export default function ComponentsCons(): ReactElement | null { return ( <TableCellList> <li> Components are low-level which requires creating your own high-level components for repeated functionality or patterns. </li> <li>Typescript types can be improved when generics are involved.</li> </TableCellList> ); }
scheduler._props = {}; scheduler.createUnitsView = function (name, property, list, size, step, skip_incorrect) { if (typeof name == "object"){ list = name.list; property = name.property; size = name.size||0; step = name.step||1; skip_incorrect = name.skip_incorrect; name = name.name; } scheduler._props[name]={map_to:property, options:list, step:step, position:0 }; if(size>scheduler._props[name].options.length){ scheduler._props[name]._original_size = size; size = 0; } scheduler._props[name].size = size; scheduler._props[name].skip_incorrect = skip_incorrect||false; scheduler.date[name+"_start"]= scheduler.date.day_start; scheduler.templates[name+"_date"] = function(date){ return scheduler.templates.day_date(date); }; scheduler._get_unit_index = function(unit_view, date) { var original_position = unit_view.position || 0; var date_position = Math.floor((scheduler._correct_shift(+date, 1) - +scheduler._min_date) / (60 * 60 * 24 * 1000)); return original_position + date_position; }; scheduler.templates[name + "_scale_text"] = function(id, label, option) { if (option.css) { return "<span class='" + option.css + "'>" + label + "</span>"; } else { return label; } }; scheduler.templates[name+"_scale_date"] = function(date) { var unit_view = scheduler._props[name]; var list = unit_view.options; if (!list.length) return ""; var index = scheduler._get_unit_index(unit_view, date); var option = list[index]; return scheduler.templates[name + "_scale_text"](option.key, option.label, option); }; scheduler.date["add_"+name]=function(date,inc){ return scheduler.date.add(date,inc,"day"); }; scheduler.date["get_"+name+"_end"]=function(date){ return scheduler.date.add(date,scheduler._props[name].size||scheduler._props[name].options.length,"day"); }; scheduler.attachEvent("onOptionsLoad",function(){ var pr = scheduler._props[name]; var order = pr.order = {}; var list = pr.options; for(var i=0; i<list.length;i++) order[list[i].key]=i; if(pr._original_size && pr.size===0){ pr.size = pr._original_size; delete pr.original_size; } if(pr.size > list.length) { pr._original_size = pr.size; pr.size = 0; } else pr.size = pr._original_size||pr.size; if (scheduler._date && scheduler._mode == name) scheduler.setCurrentView(scheduler._date, scheduler._mode); }); scheduler["mouse_"+ name] = function(pos){ //mouse_coord handler var pr = scheduler._props[this._mode]; if (pr){ pos = this.<API key>(pos); if(!this._drag_event) this._drag_event = {}; if (this._drag_id && this._drag_mode){ this._drag_event._dhx_changed = true; } var unit_ind = Math.min(pos.x+pr.position,pr.options.length-1); pos.section = (pr.options[unit_ind]||{}).key; pos.x = 0; var ev = this.getEvent(this._drag_id); this.<API key>({view:pr, event:ev, pos:pos}); } pos.force_redraw = true; return pos; }; scheduler.callEvent("onOptionsLoad",[]); }; scheduler.<API key> = function(action){ var view = action.view, event = action.event, pos = action.pos; if(event) { event[view.map_to] = pos.section; } }; scheduler.scrollUnit=function(step){ var pr = scheduler._props[this._mode]; if (pr){ pr.position=Math.min(Math.max(0,pr.position+step),pr.options.length-pr.size); this.update_view(); } }; (function(){ var <API key> = function(evs) { var pr = scheduler._props[scheduler._mode]; if(pr && pr.order && pr.skip_incorrect) { var correct_events = []; for(var i=0; i<evs.length; i++) { if(typeof pr.order[evs[i][pr.map_to]] != "undefined") { correct_events.push(evs[i]); } } evs.splice(0,evs.length); evs.push.apply(evs,correct_events); } return evs; }; var <API key> = scheduler.<API key>; scheduler.<API key>=function(evs,hold) { evs = <API key>(evs); return <API key>.apply(this, [evs, hold]); }; var <API key> = scheduler.<API key>; scheduler.<API key> = function(evs,hold){ evs = <API key>(evs); return <API key>.apply(this, [evs, hold]); }; var fix_und=function(pr,ev){ if (pr && typeof pr.order[ev[pr.map_to]] == "undefined"){ var s = scheduler; var dx = 24*60*60*1000; var ind = Math.floor((ev.end_date - s._min_date)/dx); //ev.end_date = new Date(s.date.time_part(ev.end_date)*1000+s._min_date.valueOf()); //ev.start_date = new Date(s.date.time_part(ev.start_date)*1000+s._min_date.valueOf()); ev[pr.map_to] = pr.options[Math.min(ind+pr.position,pr.options.length-1)].key; return true; } }; var t = scheduler._reset_scale; var oldive = scheduler.is_visible_events; scheduler.is_visible_events = function(e){ var res = oldive.apply(this,arguments); if (res){ var pr = scheduler._props[this._mode]; if (pr && pr.size){ var val = pr.order[e[pr.map_to]]; if (val < pr.position || val >= pr.size+pr.position ) return false; } } return res; }; scheduler._reset_scale = function(){ var pr = scheduler._props[this._mode]; var ret = t.apply(this,arguments); if (pr){ this._max_date=this.date.add(this._min_date,1,"day"); var d = this._els["dhx_cal_data"][0].childNodes; for (var i=0; i < d.length; i++) d[i].className = d[i].className.replace("_now",""); //clear now class if (pr.size && pr.size < pr.options.length){ var h = this._els["dhx_cal_header"][0]; var arrow = document.createElement("DIV"); if (pr.position){ arrow.className = "dhx_cal_prev_button"; arrow.style.cssText="left:1px;top:2px;position:absolute;"; arrow.innerHTML = "&nbsp;"; h.firstChild.appendChild(arrow); arrow.onclick=function(){ scheduler.scrollUnit(pr.step*-1); }; } if (pr.position+pr.size<pr.options.length){ arrow = document.createElement("DIV"); arrow.className = "dhx_cal_next_button"; arrow.style.cssText="left:auto; right:0px;top:2px;position:absolute;"; arrow.innerHTML = "&nbsp;"; h.lastChild.appendChild(arrow); arrow.onclick=function(){ scheduler.scrollUnit(pr.step); }; } } } return ret; }; var r = scheduler._get_event_sday; scheduler._get_event_sday=function(ev){ var pr = scheduler._props[this._mode]; if (pr){ fix_und(pr,ev); return pr.order[ev[pr.map_to]]-pr.position; } return r.call(this,ev); }; var l = scheduler.locate_holder_day; scheduler.locate_holder_day=function(a,b,ev){ var pr = scheduler._props[this._mode]; if (pr && ev) { fix_und(pr,ev); return pr.order[ev[pr.map_to]]*1+(b?1:0)-pr.position; } return l.apply(this,arguments); }; var o = scheduler._time_order; scheduler._time_order = function(evs){ var pr = scheduler._props[this._mode]; if (pr){ evs.sort(function(a,b){ return pr.order[a[pr.map_to]]>pr.order[b[pr.map_to]]?1:-1; }); } else o.apply(this,arguments); }; scheduler.attachEvent("onEventAdded",function(id,ev){ if (this._loading) return true; for (var a in scheduler._props){ var pr = scheduler._props[a]; if (typeof ev[pr.map_to] == "undefined") ev[pr.map_to] = pr.options[0].key; } return true; }); scheduler.attachEvent("onEventCreated",function(id,n_ev){ var pr = scheduler._props[this._mode]; if (pr && n_ev){ var ev = this.getEvent(id); var pos = this._mouse_coords(n_ev); this.<API key>({view:pr, event:ev, pos:pos}); fix_und(pr,ev); this.event_updated(ev); } return true; }); })();
export default { SORT_DESC: "desc", SORT_ASC: "asc", SIZE_PER_PAGE: 10, NEXT_PAGE: ">", LAST_PAGE: ">>", PRE_PAGE: "<", FIRST_PAGE: "<<", ROW_SELECT_BG_COLOR: "", ROW_SELECT_NONE: "none", ROW_SELECT_SINGLE: "radio", ROW_SELECT_MULTI: "checkbox", CELL_EDIT_NONE: "none", CELL_EDIT_CLICK: "click", CELL_EDIT_DBCLICK: "dbclick", SIZE_PER_PAGE_LIST: [10, 25, 30, 50], PAGINATION_SIZE: 5, NO_DATA_TEXT: "There is no data to display", SHOW_ONLY_SELECT: "Show Selected Only", SHOW_ALL: "Show All", FILTER_DELAY: 500, FILTER_TYPE: { TEXT: "TextFilter", REGEX: "RegexFilter", SELECT: "SelectFilter", NUMBER: "NumberFilter", DATE: "DateFilter", CUSTOM: "CustomFilter" } }
#pragma once class EWLabel; typedef std::shared_ptr<EWLabel> EWLabelPtr; /* EWLabel */ class EWLabel : public EWWidget { protected: EGstring label; EGTextPtr text; public: EWLabel(EGenum widgetFlags = 0); EWLabel(EGstring label); virtual ~EWLabel(); static const EGClass* classFactory(); virtual const EGClass* getClass() const; virtual const char* widgetTypeName(); virtual EGstring getLabel(); virtual EGTextPtr getText(); virtual void setLabel(EGstring label); virtual void setText(EGTextPtr text); virtual EGSize calcMinimumSize(); virtual void layout(); };
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>Fancytree - 3rd Party Example: jQuery contextMenu</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" /> <script src="//code.jquery.com/jquery-3.2.1.min.js"></script> <script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script> <link href="../src/skin-win8/ui.fancytree.css" rel="stylesheet"> <script src="../src/jquery.fancytree.js"></script> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery-contextmenu/2.2.3/jquery.contextMenu.min.css" /> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-contextmenu/2.2.3/jquery.contextMenu.min.js"> </script> <!-- Start_Exclude: This block is not part of the sample code --> <link href="../lib/prettify.css" rel="stylesheet"> <script src="../lib/prettify.js"></script> <link href="sample.css" rel="stylesheet"> <script src="sample.js"></script> <!-- End_Exclude --> <style type="text/css"> </style> <script type="text/javascript"> $(function() { $("#tree").fancytree({ extensions: [], source: { url: "ajax-tree-plain.json" }, lazyLoad: function(event, data) { data.result = { url: "ajax-sub2.json" } } }); $.contextMenu({ selector: "#tree span.fancytree-title", items: { "cut": {name: "Cut", icon: "cut", callback: function(key, opt){ var node = $.ui.fancytree.getNode(opt.$trigger); alert("Clicked on " + key + " on " + node); } }, "copy": {name: "Copy", icon: "copy"}, "paste": {name: "Paste", icon: "paste", disabled: false }, "sep1": " "edit": {name: "Edit", icon: "edit", disabled: true }, "delete": {name: "Delete", icon: "delete", disabled: true }, "more": {name: "More", items: { "sub1": {name: "Sub 1"}, "sub1": {name: "Sub 2"} }} }, callback: function(itemKey, opt) { var node = $.ui.fancytree.getNode(opt.$trigger); alert("select " + itemKey + " on " + node); } }); }); </script> </head> <body class="example"> <h1>Example: use 'jQuery contextMenu'</h1> <div class="description"> <p> This example integrates the <a href="https://github.com/mar10/<API key>" target="_blank" class="external">jQuery contextMenu plugin</a>, which is maintained independantly from Fancytree and is based on <a href="http://api.jqueryui.com/menu/">jQuery UI Menu</a> (part of jQuery UI 1.9+). </p> <p> This is only one of more options. See the <a href="index.html#sample-ext-menu.html">menu overview</a> for details. </p> </div> <div> <label for="skinswitcher">Skin:</label> <select id="skinswitcher"></select> </div> <!-- Tree wrapper --> <div id="tree"></div> <hr /> <div id="selected-action">Click right mouse button on node</div> <!-- Start_Exclude: This block is not part of the sample code --> <hr> <p class="sample-links no_code"> <a class="hideInsideFS" href="https://github.com/mar10/fancytree">jquery.fancytree.js project home</a> <a class="hideOutsideFS" href="#">Link to this page</a> <a class="hideInsideFS" href="index.html">Example Browser</a> <a href="#" id="codeExample">View source code</a> </p> <pre id="sourceCode" class="prettyprint" style="display:none"></pre> <!-- End_Exclude --> </body> </html>
using UnityEngine; using System.Collections; public class LoadLevel : MonoBehaviour { public void LoadScene(int index){ Application.LoadLevel (index); } public void Quit(){ Application.Quit (); } }
package com.example.graduation_project; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
<?php namespace Home\Controller; use Think\Controller; class IndexController extends Controller { public function index () { $good = D('Good'); $category = D('Category'); switch (I('get.sort')) { case '1': $sort = 'sales_num'; break; default: $sort = 'add_time'; break; } $order = I('get.order'); if(!$order) $order = 'desc'; $where = ['is_delete'=>0, 'is_on_sale'=>1, 'good_number' => ['gt', 0]]; if (C('CHECK_ISSUE_GOOD')) $where['is_check'] = 1; $page = new \Org\Util\Page(C('GOOD_PAGE_NUM'), false); $list = $good->where($where)->limit($page->limit)->order($sort . ' ' . $order)->select(); $this->cateList = $category->order('grade desc')->select(); $this->page = $page->show($list); $this->list = $list; $this->display(); } public function article() { $this->display(); } }
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_101) on Mon Sep 19 15:00:06 UTC 2016 --> <title><API key> (Spring Framework 4.3.3.RELEASE API)</title><script>var _hmt = _hmt || [];(function() {var hm = document.createElement("script");hm.src = "//hm.baidu.com/hm.js?<API key>";var s = document.<API key>("script")[0];s.parentNode.insertBefore(hm, s);})();</script> <meta name="date" content="2016-09-19"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><! try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="<API key> (Spring Framework 4.3.3.RELEASE API)"; } } catch(err) { } var methods = {"i0":6,"i1":6}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar.top"> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Spring Framework</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/springframework/web/servlet/resource/ResourceTransformer.html" title="interface in org.springframework.web.servlet.resource"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../../org/springframework/web/servlet/resource/<API key>.html" title="class in org.springframework.web.servlet.resource"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/springframework/web/servlet/resource/<API key>.html" target="_top">Frames</a></li> <li><a href="<API key>.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> </a></div> <div class="header"> <div class="subTitle">org.springframework.web.servlet.resource</div> <h2 title="Interface <API key>" class="title">Interface <API key></h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public interface <span class="typeNameLabel"><API key></span></pre> <div class="block">A contract for invoking a chain of <a href="../../../../../org/springframework/web/servlet/resource/ResourceTransformer.html" title="interface in org.springframework.web.servlet.resource"><code>ResourceTransformer</code></a>s where each resolver is given a reference to the chain allowing it to delegate when necessary.</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>4.1</dd> <dt><span class="simpleTagLabel">Author:</span></dt> <dd>Rossen Stoyanchev</dd> </dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="method.summary"> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code><a href="../../../../../org/springframework/web/servlet/resource/<API key>.html" title="interface in org.springframework.web.servlet.resource"><API key></a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/springframework/web/servlet/resource/<API key>.html#getResolverChain--">getResolverChain</a></span>()</code> <div class="block">Return the <code><API key></code> that was used to resolve the <code>Resource</code> being transformed.</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code><a href="../../../../../org/springframework/core/io/Resource.html" title="interface in org.springframework.core.io">Resource</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/springframework/web/servlet/resource/<API key>.html <a href="../../../../../org/springframework/core/io/Resource.html" title="interface in org.springframework.core.io">Resource</a>&nbsp;resource)</code> <div class="block">Transform the given resource.</div> </td> </tr> </table> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="method.detail"> </a> <h3>Method Detail</h3> <a name="getResolverChain </a> <ul class="blockList"> <li class="blockList"> <h4>getResolverChain</h4> <pre><a href="../../../../../org/springframework/web/servlet/resource/<API key>.html" title="interface in org.springframework.web.servlet.resource"><API key></a>&nbsp;getResolverChain()</pre> <div class="block">Return the <code><API key></code> that was used to resolve the <code>Resource</code> being transformed. This may be needed for resolving related resources, e.g. links to other resources.</div> </li> </ul> <a name="transform-javax.servlet.http.<API key>.springframework.core.io.Resource-"> </a> <ul class="blockListLast"> <li class="blockList"> <h4>transform</h4> <pre><a href="../../../../../org/springframework/core/io/Resource.html" title="interface in org.springframework.core.io">Resource</a>&nbsp;transform(<a href="http://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletRequest.html?is-external=true" title="class or interface in javax.servlet.http">HttpServletRequest</a>&nbsp;request, <a href="../../../../../org/springframework/core/io/Resource.html" title="interface in org.springframework.core.io">Resource</a>&nbsp;resource) throws <a href="http://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre> <div class="block">Transform the given resource.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>request</code> - the current request</dd> <dd><code>resource</code> - the candidate resource to transform</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the transformed or the same resource, never <code>null</code></dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="http://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if transformation fails</dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <div class="bottomNav"><a name="navbar.bottom"> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Spring Framework</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/springframework/web/servlet/resource/ResourceTransformer.html" title="interface in org.springframework.web.servlet.resource"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../../org/springframework/web/servlet/resource/<API key>.html" title="class in org.springframework.web.servlet.resource"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/springframework/web/servlet/resource/<API key>.html" target="_top">Frames</a></li> <li><a href="<API key>.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> </a></div> </body> </html>
/* General styles */ html { height: 100%; } body { margin:0; padding:0; border:0; /* This removes the border around the viewport in old versions of IE */ width:100%; color: #fcfcfc; background:#071790; font-size:90%; height: 100%; } a { color:#fff; text-decoration: none; } a:hover { color:#fff; text-decoration:underline; } h1 { width: 75%; padding: 20% 0 15% 0; background: url("header.png") center top; background-repeat: no-repeat; background-size: contain; text-indent: -9999px; margin: 15% auto 5% auto; } } h1, h2, h3 { margin:.8em 0 .2em 0; padding:0; } p { font-family: 'GothamNarrow-XLight', helvetica, sans-serif; margin: 0% auto; padding: 0; width: 75%; font-size: 20px; line-height: 36px; letter-spacing: 0.5px; } img { margin:10px 0 5px; } /* column container */ .colmask { clear:both; float:left; width:100%; /* width of whole page */ overflow:hidden; /* This chops off any overhanging divs */ height: 100%; } /* common column settings */ .colright, .colmid, .colleft { float:left; width:100%; position:relative; height: 100%; } .col1, .col2, .col3 { float:left; position:relative; padding:0 0 0 0; overflow:hidden; height: 100%; } /* 2 Column (double page) settings */ .doublepage { height: 100%; } .doublepage .colleft { right:50%; /* right column width */ background:#071790; /* left column background colour */ height: 100%; } .doublepage .col1 { width:50%; /* left column content width (column width minus left and right padding) */ left:50%; margin: 0; /* right column width plus left column left padding */ height: 100%; overflow: auto; } .doublepage .col2 { width:50%; /* right column content width (column width minus left and right padding) */ left:50%; /* (right column width) plus (left column left and right padding) plus (right column left padding) */ background-image: url("josef.jpg"); background-repeat:no-repeat; background-position:top center; background-size: cover; min-height: 100%; } .content { padding: 1em; height: auto; margin-bottom: 10vh; } /** Generated by FG **/ @font-face { font-family: 'GothamNarrow-XLight'; src: url('fonts/GothamNarrow-XLight.eot'); src: local(''), url('fonts/GothamNarrow-XLight.woff') format('woff'), url('fonts/GothamNarrow-XLight.ttf') format('truetype'), url('fonts/GothamNarrow-XLight.svg') format('svg'); font-weight: normal; font-style: normal; } @media (max-width: 800px) { .colleft { width: 100% !important; background: none !important;} .col1 { width: 100% !important; z-index: 1;} .col2 { width: 100% !important; position: absolute; opacity: 0.4; filter: alpha(opacity=40); /* For IE8 and earlier */ z-index: -1; } h1 { margin-top: 65vh; width: 87.5%; margin-bottom:5vh; } p { margin: 0 auto; font-size: 1.3em; line-height: 1.7; width: 87.5%; } }
<!DOCTYPE html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="generator" content="Source Themes Academic 4.4.0"> <meta name="author" content="Lorena Pantano"> <meta name="description" content="Senior Computational Biologist"> <link rel="alternate" hreflang="en-us" href="http://lpantano.github.io/authors/n-b-jamieson/"> <meta name="theme-color" content="#2962ff"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/academicons/1.8.6/css/academicons.min.css" integrity="<API key>+<API key>=" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.0/css/all.css" integrity="<API key>+h" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.5/jquery.fancybox.min.css" integrity="<API key>+U5S2idbLtxs=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/github.min.css" crossorigin="anonymous" title="hl-light"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/dracula.min.css" crossorigin="anonymous" title="hl-dark" disabled> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,700|Roboto:400,400italic,700|Roboto+Mono&display=swap"> <link rel="stylesheet" href="/css/academic.min.<API key>.css"> <link rel="alternate" href="/authors/n-b-jamieson/index.xml" type="application/rss+xml" title="My BioBits"> <link rel="manifest" href="/site.webmanifest"> <link rel="icon" type="image/png" href="/img/icon.png"> <link rel="apple-touch-icon" type="image/png" href="/img/icon-192.png"> <link rel="canonical" href="http://lpantano.github.io/authors/n-b-jamieson/"> <meta property="twitter:card" content="summary"> <meta property="twitter:site" content="@lopantano"> <meta property="twitter:creator" content="@lopantano"> <meta property="og:site_name" content="My BioBits"> <meta property="og:url" content="http://lpantano.github.io/authors/n-b-jamieson/"> <meta property="og:title" content="N B Jamieson | My BioBits"> <meta property="og:description" content="Senior Computational Biologist"><meta property="og:image" content="http://lpantano.github.io/img/icon-192.png"> <meta property="twitter:image" content="http://lpantano.github.io/img/icon-192.png"><meta property="og:locale" content="en-us"> <meta property="og:updated_time" content="2016-01-01T00:00:00&#43;00:00"> <title>N B Jamieson | My BioBits</title> </head> <body id="top" data-spy="scroll" data-offset="70" data-target="#TableOfContents" > <aside class="search-results" id="search"> <div class="container"> <section class="search-header"> <div class="row no-gutters <API key> mb-3"> <div class="col-6"> <h1>Search</h1> </div> <div class="col-6 col-search-close"> <a class="js-search" href="#"><i class="fas fa-times-circle text-muted" aria-hidden="true"></i></a> </div> </div> <div id="search-box"> <input name="q" id="search-query" placeholder="Search..." autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" type="search"> </div> </section> <section class="<API key>"> <div id="search-hits"> </div> </section> </div> </aside> <nav class="navbar navbar-light fixed-top navbar-expand-lg py-0 <API key>" id="navbar-main"> <div class="container"> <a class="navbar-brand" href="/">My BioBits</a> <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation"> <span><i class="fas fa-bars"></i></span> </button> <div class="collapse navbar-collapse" id="navbar"> <ul class="navbar-nav mr-auto"> <li class="nav-item"> <a class="nav-link " href="/#about"><span>Home</span></a> </li> <li class="nav-item"> <a class="nav-link " href="/#posts"><span>Posts</span></a> </li> <li class="nav-item"> <a class="nav-link " href="/#featured"><span>Publications</span></a> </li> <li class="nav-item"> <a class="nav-link " href="/#talks"><span>Talks</span></a> </li> <li class="nav-item"> <a class="nav-link " href="/#contact"><span>Contact</span></a> </li> </ul> <ul class="navbar-nav ml-auto"> <li class="nav-item"> <a class="nav-link js-search" href="#"><i class="fas fa-search" aria-hidden="true"></i></a> </li> <li class="nav-item"> <a class="nav-link js-dark-toggle" href="#"><i class="fas fa-moon" aria-hidden="true"></i></a> </li> </ul> </div> </div> </nav> <div class="universal-wrapper pt-3"> <h1 itemprop="name">N B Jamieson</h1> </div> <section id="profile-page" class="pt-5"> <div class="container"> <div class="article-widget"> <div class="hr-light"></div> <h3>Latest</h3> <ul> <li> <a href="/publication/bailey-2016/">Genomic analyses identify molecular subtypes of pancreatic cancer</a> </li> </ul> </div> </div> </section> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="<API key>=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/4.1.4/imagesloaded.pkgd.min.js" integrity="<API key>/<API key>=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js" integrity="<API key>/iI=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.5/jquery.fancybox.min.js" integrity="sha256-X5PoE3KU5l+JcX+w09p/<API key>=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js" integrity="<API key>/1c8s1dgkYPQ8=" crossorigin="anonymous"></script> <script>hljs.<API key>();</script> <script> const <API key> = "/index.json"; const i18n = { 'placeholder': "Search...", 'results': "results found", 'no_results': "No results found" }; const content_type = { 'post': "Posts", 'project': "Projects", 'publication' : "Publications", 'talk' : "Talks" }; </script> <script id="<API key>" type="text/x-template"> <div class="search-hit" id="summary-{{key}}"> <div class="search-hit-content"> <div class="search-hit-name"> <a href="{{relpermalink}}">{{title}}</a> <div class="article-metadata search-hit-type">{{type}}</div> <p class="<API key>">{{snippet}}</p> </div> </div> </div> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.2.1/fuse.min.js" integrity="<API key>+<API key>=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="<API key>=" crossorigin="anonymous"></script> <script src="/js/academic.min.<API key>.js"></script> <div class="container"> <footer class="site-footer"> <p class="powered-by"> Powered by the <a href="https://sourcethemes.com/academic/" target="_blank" rel="noopener">Academic theme</a> for <a href="https://gohugo.io" target="_blank" rel="noopener">Hugo</a>. <span class="float-right" aria-hidden="true"> <a href="#" id="back_to_top"> <span class="button_icon"> <i class="fas fa-chevron-up fa-2x"></i> </span> </a> </span> </p> </footer> </div> <div id="modal" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Cite</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <pre><code class="tex hljs"></code></pre> </div> <div class="modal-footer"> <a class="btn btn-outline-primary my-1 js-copy-cite" href="#" target="_blank"> <i class="fas fa-copy"></i> Copy </a> <a class="btn btn-outline-primary my-1 js-download-cite" href="#" target="_blank"> <i class="fas fa-download"></i> Download </a> <div id="modal-error"></div> </div> </div> </div> </div> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Weather App</title> <link rel="stylesheet" type="text/css" href="styles/inline.css"> <link rel="manifest" href="/manifest.json"> <!-- Add to home screen for Safari on iOS --> <meta name="<API key>" content="yes"> <meta name="<API key>" content="black"> <meta name="<API key>" content="Weather App"> <link rel="apple-touch-icon" href="images/icons/icon-152x152.png"> <!--Tile icon for Windows <meta name="<API key>" content="images/icons/icon-144x144.png"> <meta name="<API key>" content="#2F3BA2"> </head> <body> <header class="header"> <h1 class="header__title">Weather App</h1> <button id="butRefresh" class="headerButton"></button> <button id="butAdd" class="headerButton"></button> </header> <main class="main" hidden> <div class="card cardTemplate weather-forecast" hidden> <div class="city-key" hidden></div> <div class="location"></div> <div class="date"></div> <div class="description"></div> <div class="current"> <div class="visual"> <div class="icon"></div> <div class="temperature"> <span class="value"></span><span class="scale">°F</span> </div> </div> <div class="description"> <div class="feels-like"> <span class="value"></span><span class="scale">°F</span> </div> <div class="precip"></div> <div class="humidity"></div> <div class="wind"> <span class="value"></span> <span class="scale">mph</span> <span class="direction"></span> </div> </div> </div> <div class="future"> <div class="oneday"> <div class="date"></div> <div class="icon"></div> <div class="temp-high"> <span class="value"></span>° </div> <div class="temp-low"> <span class="value"></span>° </div> </div> <div class="oneday"> <div class="date"></div> <div class="icon"></div> <div class="temp-high"> <span class="value"></span>° </div> <div class="temp-low"> <span class="value"></span>° </div> </div> <div class="oneday"> <div class="date"></div> <div class="icon"></div> <div class="temp-high"> <span class="value"></span>° </div> <div class="temp-low"> <span class="value"></span>° </div> </div> <div class="oneday"> <div class="date"></div> <div class="icon"></div> <div class="temp-high"> <span class="value"></span>° </div> <div class="temp-low"> <span class="value"></span>° </div> </div> <div class="oneday"> <div class="date"></div> <div class="icon"></div> <div class="temp-high"> <span class="value"></span>° </div> <div class="temp-low"> <span class="value"></span>° </div> </div> <div class="oneday"> <div class="date"></div> <div class="icon"></div> <div class="temp-high"> <span class="value"></span>° </div> <div class="temp-low"> <span class="value"></span>° </div> </div> <div class="oneday"> <div class="date"></div> <div class="icon"></div> <div class="temp-high"> <span class="value"></span>° </div> <div class="temp-low"> <span class="value"></span>° </div> </div> </div> </div> </main> <div class="dialog-container"> <div class="dialog"> <div class="dialog-title">Add new city</div> <div class="dialog-body"> <select id="selectCityToAdd"> <option value="austin">Austin, TX</option> <option value="boston">Boston, MA</option> <option value="chicago">Chicago, IL</option> <option value="portland">Portland, OR</option> <option value="sanfrancisco">San Francisco, CA</option> <option value="seattle">Seattle, WA</option> </select> </div> <div class="dialog-buttons"> <button id="butAddCity" class="button">Add</button> <button id="butAddCancel" class="button">Cancel</button> </div> </div> </div> <div class="loader"> <svg viewBox="0 0 32 32" width="32" height="32"> <circle id="spinner" cx="16" cy="16" r="14" fill="none"></circle> </svg> </div> <script src="/app.js"></script> </body> </html>
/** * \file sgui_utf8.h * * \brief Contains helper functions for UTF-8 string handling. */ #ifndef SGUI_UTF8_H #define SGUI_UTF8_H #include "sgui_predef.h" #ifdef __cplusplus extern "C" { #endif /** * \brief Get the unicode code point for a UTF8 encoded character * * \param utf8 A string holding the UTF8 character * \param length An optional pointer to an integer returning the length of the * UTF8 encoded character in bytes * * \return The decoded unicode code point */ SGUI_DLL unsigned int sgui_utf8_decode( const char* utf8, unsigned int* length ); /** * \brief Get the UTF8 encoding of a unicode code point * * \param cp The unicode code point * \param str A pointer to a buffer to write the UTF8 encoding to. Buffer * must be able to hold at least 4 bytes. * * \return The number of bytes written to the buffer */ SGUI_DLL unsigned int sgui_utf8_encode( unsigned int cp, char* str ); /** * \brief Get the number of characters in an UTF8 encoded string * * In a string using UTF8 encoding, the number of bytes does not have to match * the number of characters, as characters can be up to 6 bytes long (unless * you use plain ASCII which is part of UTF8). Using the regular strlen * function on such a string yields the number of bytes, excluding the null * terminator, but not the number of actual characters. * * \param utf8 A string using UTF8 encoding * * \return The number of actual characters in the string */ SGUI_DLL unsigned int sgui_utf8_strlen( const char* utf8 ); #ifdef __cplusplus } #endif #endif /* SGUI_UTF8_H */
<?php /** * Upgrader API: <API key> class * * @package WordPress * @subpackage Upgrader * @since 4.6.0 */ /** * Plugin Upgrader Skin for WordPress Plugin Upgrades. * * @since 2.8.0 * @since 4.6.0 Moved to its own file from wp-admin/includes/<API key>.php. * * @see WP_Upgrader_Skin */ class <API key> extends WP_Upgrader_Skin { public $plugin = ''; public $plugin_active = false; public $<API key> = false; /** * * @param array $args */ public function __construct( $args = array() ) { $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') ); $args = wp_parse_args($args, $defaults); $this->plugin = $args['plugin']; $this->plugin_active = is_plugin_active( $this->plugin ); $this-><API key> = <API key>( $this->plugin ); parent::__construct($args); } /** * @access public */ public function after() { $this->plugin = $this->upgrader->plugin_info(); if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){ // Currently used only when JS is off for a single plugin update? echo '<iframe title="' . esc_attr__( 'Update progress' ) . '" style="border:0;overflow:hidden" width="100%" height="170" src="' . wp_nonce_url( 'update.php?action=activate-plugin&networkwide=' . $this-><API key> . '&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin ) . '"></iframe>'; } $this-><API key>( 'plugin' ); $update_actions = array( 'activate_plugin' => '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>', 'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>' ); if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) ) unset( $update_actions['activate_plugin'] ); /** * Filters the list of action links available following a single plugin update. * * @since 2.7.0 * * @param array $update_actions Array of plugin action links. * @param string $plugin Path to the plugin file. */ $update_actions = apply_filters( '<API key>', $update_actions, $this->plugin ); if ( ! empty($update_actions) ) $this->feedback(implode(' | ', (array)$update_actions)); } }
//! Draw ellipse use types::{Color, Radius, Rectangle, Resolution}; use {triangulation, DrawState, Graphics}; use math::Matrix2d; pub use rectangle::centered; pub use rectangle::centered_square as circle; Ellipse border #[derive(Copy, Clone)] pub struct Border { The border color pub color: Color, The border radius pub radius: Radius, } An ellipse with filled color #[derive(Copy, Clone)] pub struct Ellipse { The ellipse color pub color: Color, The ellipse border pub border: Option<Border>, The resolution for the shape, 360 degrees. pub resolution: Resolution, } impl Ellipse { Creates a new ellipse pub fn new(color: Color) -> Ellipse { Ellipse { color: color, border: None, resolution: 128, } } Creates a new ellipse border pub fn new_border(color: Color, radius: Radius) -> Ellipse { Ellipse { color: [0.0; 4], border: Some(Border { color: color, radius: radius, }), resolution: 128, } } Sets ellipse color. pub fn color(mut self, value: Color) -> Self { self.color = value; self } Sets ellipse border. pub fn border(mut self, value: Border) -> Self { self.border = Some(value); self } Sets optional ellipse border. pub fn maybe_border(mut self, value: Option<Border>) -> Self { self.border = value; self } Sets resolution of the ellipse smoothness. pub fn resolution(mut self, value: Resolution) -> Self { self.resolution = value; self } Draws ellipse by corners using default method. #[inline(always)] pub fn draw_from_to<P: Into<crate::types::Vec2d>, G>(&self, from: P, to: P, draw_state: &DrawState, transform: Matrix2d, g: &mut G) where G: Graphics { use rectangle::<API key>; let from = from.into(); let to = to.into(); g.ellipse(self, <API key>(from[0], from[1], to[0], to[1]), draw_state, transform); } Draws ellipse using default method. #[inline(always)] pub fn draw<R: Into<Rectangle>, G>(&self, rectangle: R, draw_state: &DrawState, transform: Matrix2d, g: &mut G) where G: Graphics { g.ellipse(self, rectangle, draw_state, transform); } Draws ellipse using triangulation. pub fn draw_tri<R: Into<Rectangle>, G>(&self, rectangle: R, draw_state: &DrawState, transform: Matrix2d, g: &mut G) where G: Graphics { let rectangle = rectangle.into(); g.tri_list(draw_state, &self.color, |f| { triangulation::<API key>(self.resolution, transform, rectangle, |vertices| f(vertices)) }); if let Some(Border { color, radius: border_radius }) = self.border { g.tri_list(&draw_state, &color, |f| { triangulation::<API key>(self.resolution, transform, rectangle, border_radius, |vertices| f(vertices)) }); } } } #[cfg(test)] mod test { use super::*; #[test] fn test_ellipse() { let _ellipse = Ellipse::new([1.0; 4]) .color([0.0; 4]) .border(Border { color: [1.0; 4], radius: 3.0, }); } }
/ // printq.c // A simple example of how to access and print the // different K object types from C. Handles atoms, lists // dictionaries and tables (enumerated types and functions // are currently unsupported). // @updated: 17/03/2015 // @authors: Kent Lee, Kevin Piar, Mark Rooney // AquaQ Analytics // kdb+ consultancy, training and support // For questions, comments, requests or bug reports, please contact us // e: info@aquaq.co.uk // p: +44 (0)28 9051 1232 #include <stdio.h> #include <stdlib.h> #include <time.h> #include <ctype.h> #include <string.h> #define KXVER 3 #include "k.h" static K printq(K x); static void fmt_time(char *str, time_t time, int adjusted) { static char buffer[4096]; struct tm *timeinfo = localtime(&time); if (adjusted) timeinfo->tm_hour -= 1; strftime(buffer, sizeof(buffer), str, timeinfo); printf("%s ", buffer); } static K printatom(K x) { switch (xt) { case -1: printf("%db", x->g); break; case -4: printf("0x%02x", x->g); break; case -5: printf("%d", x->h); break; case -6: printf("%d", x->i); break; case -7: printf("%lld", x->j); break; case -8: printf("%.2f", x->e); break; case -9: printf("%.2f", x->f); break; case -10: printf("\"%c\"", x->g); break; case -11: printf("`%s", x->s); break; case -12: fmt_time("%Y.%m.%dD%H:%M:%S.", ((x->j) / 8.64e13 + 10957)*8.64e4, 0); break; case -13: printf("%04d.%02d", (x->i)/12+2000, (x->i)%12+1); break; case -14: fmt_time("%Y.%m.%d", ((x->i) + 10957)*8.64e4, 0); break; case -15: fmt_time("%Y.%m.%dD%H:%M:%S", ((x->f) + 10957)*8.64e4, 0); break; case -16: { fmt_time("%jD%H:%M:%S", (x->j)/1000000000, 1); printf(".%09lld", (x->j)%1000000000); break; } case -17: fmt_time("%H:%M", (x->i) * 60, 1); break; case -18: fmt_time("%H:%M:%S", x->i, 1); break; case -19: { fmt_time("%H:%M:%S", (x->i) / 1000, 1); printf(".%03d", (x->i)%1000); break; } default: return krr("notimplemented"); } return (K) 0; } #define showatom(c,a,x,i) do { K r = c(a((x))[i]); printatom(r); r0(r); } while(0) static K printitem(K x, int index) { switch (xt) { case 0: printq(kK(x)[index]); break; case 1: showatom(kb, kG, x, index); break; case 4: showatom(kg, kG, x, index); break; case 5: showatom(kh, kH, x, index); break; case 6: showatom(ki, kI, x, index); break; case 7: showatom(kj, kJ, x, index); break; case 8: showatom(ke, kE, x, index); break; case 9: showatom(kf, kF, x, index); break; case 10: showatom(kc, kC, x, index); break; case 11: showatom(ks, kS, x, index); break; case 14: showatom(kd, kI, x, index); break; case 15: showatom(kz, kF, x, index); break; default: return krr("notimplemented"); } return (K) 0; } static K printlist(K x) { if (x->n == 1) printf(","); for (int i = 0; i < x->n; i++) printitem(x, i); return (K) 0; } static K printdict(K x) { K keys = kK(x)[0]; K data = kK(x)[1]; for (int row = 0; row < keys->n; row++) { printitem(keys, row); printf("| "); printitem(data, row); if (row < keys->n - 1) printf("\n"); } return (K) 0; } static K printtable(K x) { K flip = ktd(x); K columns = kK(flip->k)[0]; K rows = kK(flip->k)[1]; int colcount = columns->n; int rowcount = kK(rows)[0]->n; for (int i = 0; i < colcount; i++) printf("%s\t", kS(columns)[i]); printf("\n"); for (int i = 0; i < rowcount; i++) { for (int j = 0; j < colcount; j++) { printitem(kK(rows)[j], i); printf("\t"); } printf("\n"); } return (K) 0; } static K printq(K x) { K result; if (xt < 0) result = printatom(x); else if ((xt >= 0) && (xt < 20)) result = printlist(x); else if (xt == 98) result = printtable(x); else if (xt == 99) result = printdict(x); else result = krr((S)"notimplemented"); printf("\n"); return result; }
import { combineReducers } from 'redux' import characterList from './characterList' export default combineReducers({ characterList })
title: Question 225 category: [Data Structure] tags: [Stack, Queue] ![Description](../Assets/Figure/question225.png) ## Algorithm - [](https://leetcode.com/discuss/39814/<API key>) - pushqueuequeuepushtop, pop ## Comment - ## Code c++ class Stack { queue<int> myQueue; public: // Push element x onto stack. void push(int x) { myQueue.push(x); for (int i = 1; i < myQueue.size(); i++) { myQueue.push(myQueue.front()); myQueue.pop(); } } // Removes the element on top of the stack. void pop() { myQueue.pop(); } // Get the top element. int top() { return myQueue.front(); } // Return whether the stack is empty. bool empty() { return (myQueue.empty()); } };
'use strict'; const Async = require('async'); const Boom = require('boom'); const Config = require('../../config'); const Joi = require('joi'); const internals = {}; internals.applyRoutes = function (server, next) { const Account = server.plugins['hapi-mongo-models'].Account; //const Session = server.plugins['hapi-mongo-models'].Session; const Session = require('../models/CouchSession'); //server.plugins['hapi-mongo-models'].Session; const User = server.plugins['hapi-mongo-models'].User; server.route({ method: 'POST', path: '/signup', config: { plugins: { 'hapi-auth-cookie': { redirectTo: false } }, auth: { mode: 'try', strategy: 'session' }, validate: { payload: { name: Joi.string().required(), email: Joi.string().email().lowercase().required(), username: Joi.string().token().lowercase().required(), password: Joi.string().required() } }, pre: [{ assign: 'usernameCheck', method: function (request, reply) { const conditions = { username: request.payload.username }; User.findOne(conditions, (err, user) => { if (err) { return reply(err); } if (user) { return reply(Boom.conflict('Username already in use.')); } reply(true); }); } }, { assign: 'emailCheck', method: function (request, reply) { const conditions = { email: request.payload.email }; User.findOne(conditions, (err, user) => { if (err) { return reply(err); } if (user) { return reply(Boom.conflict('Email already in use.')); } reply(true); }); } }] }, handler: function (request, reply) { const mailer = request.server.plugins.mailer; Async.auto({ user: function (done) { const username = request.payload.username; const password = request.payload.password; const email = request.payload.email; User.create(username, password, email, done); }, account: ['user', function (results, done) { const name = request.payload.name; Account.create(name, done); }], linkUser: ['account', function (results, done) { const id = results.account._id.toString(); const update = { $set: { user: { id: results.user._id.toString(), name: results.user.username } } }; Account.findByIdAndUpdate(id, update, done); }], linkAccount: ['account', function (results, done) { const id = results.user._id.toString(); const update = { $set: { roles: { account: { id: results.account._id.toString(), name: results.account.name.first + ' ' + results.account.name.last } } } }; User.findByIdAndUpdate(id, update, done); }], welcome: ['linkUser', 'linkAccount', function (results, done) { const emailOptions = { subject: 'Your ' + Config.get('/projectName') + ' account', to: { name: request.payload.name, address: request.payload.email } }; const template = 'welcome'; mailer.sendEmail(emailOptions, template, request.payload, (err) => { if (err) { console.warn('sending welcome email failed:', err.stack); } }); done(); }], session: ['linkUser', 'linkAccount', function (results, done) { Session.create(results.user._id.toString(), done); }] }, (err, results) => { if (err) { return reply(err); } const user = results.linkAccount; const credentials = user.username + ':' + results.session.key; const authHeader = 'Basic ' + new Buffer(credentials).toString('base64'); const result = { user: { _id: user._id, username: user.username, email: user.email, roles: user.roles }, session: results.session, authHeader }; request.cookieAuth.set(result); reply(result); }); } }); next(); }; exports.register = function (server, options, next) { server.dependency(['mailer', 'hapi-mongo-models'], internals.applyRoutes); next(); }; exports.register.attributes = { name: 'signup' };
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class <API key> extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('audio_recordings', function(Blueprint $table) { $table->increments('id'); $table->integer('recording_id'); $table->string('audio_format_id'); $table->text('lineage'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('audio_recordings'); } }
""" Template tags for reversion application. """
package net.gree.aurora.scala.domain.cluster import net.gree.aurora.domain.cluster.{ClusterId => JClusterId} private[domain] case class ClusterIdImpl(underlying: JClusterId) extends ClusterId { def value = underlying.getValue }
<?php namespace JSomerstone\MongoToken\test\unit; use JSomerstone\MongoToken\Model\DataContainer; use \DateTime; class DataContainerTest extends \<API key> { /** * @var DataContainer */ protected $dataContainer; public function setUp() { $this->dataContainer = new DataContainer(); } /** * @test * @dataProvider <API key> */ public function testSetterAndGetter($value) { $this->dataContainer->set('givenName', $value); $this->assertEquals( $value, $this->dataContainer->get('givenName') ); } /** * @param $value * @dataProvider <API key> */ public function testSerialization($value) { $this->dataContainer->set('index', $value); $serializedData = $this->dataContainer->serialize(); $newContainer = DataContainer::unserialize($serializedData); $this->assertEquals( $this->dataContainer, $newContainer ); } public function <API key>() { return array( [ null ], [ true ], [ false ], [ 1 ], [ PHP_INT_MAX ], [ 'A string' ], [ pi() ], [ new DateTime() ], [ new DataContainer(['one' => 1, 'two' => 2]) ] ); } public function <API key>() { $dataSet = $this-><API key>(); foreach($dataSet as $index => $value) { $this->dataContainer->set($index, $value); } $output = $this->dataContainer->getAll(); $this->assertEquals( $dataSet, $output ); } public function testHas() { $this->dataContainer->set('some-index', true); $this->assertTrue($this->dataContainer->has('some-index')); $this->assertFalse($this->dataContainer->has('none-existing')); } public function <API key>() { $this->dataContainer->set('abba', 'A band'); $this->assertTrue($this->dataContainer->has('abba')); $this->dataContainer->set('abba', null); $this->assertFalse($this->dataContainer->has('abba')); } }
<?php /* AcmeModelBundle:Default:index.html.twig */ class <API key> extends Twig_Template { protected $parent; public function __construct(Twig_Environment $env) { parent::__construct($env); $this->blocks = array( 'body' => array($this, 'block_body'), ); } public function getParent(array $context) { if (null === $this->parent) { $this->parent = $this->env->loadTemplate("::base.html.twig"); } return $this->parent; } protected function doDisplay(array $context, array $blocks = array()) { $context = array_merge($this->env->getGlobals(), $context); $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); } // line 4 public function block_body($context, array $blocks = array()) { // line 5 echo "<h1>Posts</h1> <ul class=\"Post\"> "; // line 7 $context['_parent'] = (array) $context; $context['_seq'] = <API key>($this->getContext($context, 'posts')); foreach ($context['_seq'] as $context['_key'] => $context['post']) { // line 8 echo " <li> <h2>"; // line 9 echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, 'post'), "title", array(), "any", false), "html"); echo "</h2> <p>"; // line 10 echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, 'post'), "body", array(), "any", false), "html"); echo "</p> </li> "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['post'], $context['_parent'], $context['loop']); $context = array_merge($_parent, array_intersect_key($context, $_parent)); // line 13 echo " </ul> "; } public function getTemplateName() { return "AcmeModelBundle:Default:index.html.twig"; } public function isTraitable() { return false; } }
#!/usr/bin/env python import sys import json import platform from alertaclient.api import ApiClient from alertaclient.alert import Alert from alertaclient.heartbeat import Heartbeat class Listener(object): def wait(self): data = sys.stdin.readline() headers = dict([x.split(':') for x in data.split()]) data = sys.stdin.read(int(headers['len'])) body = dict([x.split(':') for x in data.split()]) return headers, body def send_cmd(self, s): sys.stdout.write(s) sys.stdout.flush() def log_stderr(self, s): sys.stderr.write(s) sys.stderr.flush() def main(): api = ApiClient() listener = Listener() while True: listener.send_cmd('READY\n') headers, body = listener.wait() event = headers['eventname'] if event.startswith('TICK'): supervisorAlert = Heartbeat( origin='supervisord', tags=[headers['ver'], event] ) else: if event.endswith('FATAL'): severity = 'critical' elif event.endswith('BACKOFF'): severity = 'warning' elif event.endswith('EXITED'): severity = 'minor' else: severity = 'normal' supervisorAlert = Alert( resource='%s:%s' % (platform.uname()[1], body['processname']), environment='Production', service=['supervisord'], event=event, correlate=[ '<API key>', '<API key>', '<API key>', '<API key>', '<API key>', '<API key>', 'PROCESS_STATE_FATAL', '<API key>' ], value='serial=%s' % headers['serial'], severity=severity, origin=headers['server'], text='State changed from %s to %s.' % (body['from_state'], event), raw_data='%s\n\n%s' % (json.dumps(headers), json.dumps(body)) ) try: api.send(supervisorAlert) except Exception as e: listener.log_stderr(e) listener.send_cmd('RESULT 4\nFAIL') else: listener.send_cmd('RESULT 2\nOK') if __name__ == '__main__': main()
using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using System.Linq; namespace PhysicsLayers.Components.InternalManagements { [Serializable] public sealed class UnityLayerInfos : AbstractLayerInfos<UnityLayer> { public override int LayerCount { get { return this.ValidateLayers.Count(); } } public override Dictionary<int, string> Layers { get { return this.ValidateLayers.ToDictionary(layer => layer.LayerID, layer => layer.LayerName); } } public override IEnumerable<int> LayerIDs { get { return this.ValidateLayers.Select(layer => layer.LayerID); } } public override IEnumerable<string> LayerNames { get { return this.ValidateLayers.Select(layer => layer.LayerName); } } public int AllLayerCount { get { return LayersManager.UnityLayerCount; } } public Dictionary<int, string> AllLayers { get { return this.InternalLayers.ToDictionary(layer => layer.LayerID, layer => layer.LayerName); } } public IEnumerable<int> AllLayerIDs { get { return this.InternalLayers.Select(layer => layer.LayerID); } } public IEnumerable<string> AllLayerNames { get { return this.InternalLayers.Select(layer => layer.LayerName); } } private IEnumerable<UnityLayer> ValidateLayers { get { return this.InternalLayers.Where(layer => string.IsNullOrEmpty(layer.LayerName) == false); } } private IEnumerable<UnityLayer> InternalLayers { get { if(this.layers.Count < this.AllLayerCount) { this.Update(); } return this.layers; } } public override string LayerToName(int layerID) { return LayerMask.LayerToName(layerID); } public override int NameToLayer(string layerName) { return LayerMask.NameToLayer(layerName); } public override IEnumerable<UnityLayer> GetEnumerable() { var layers = this.ValidateLayers; foreach(var layer in layers) { yield return layer; } } private void Update() { for(var i = 0; i < this.AllLayerCount; i++) { var lay = this[i]; if(lay == null) { lay = new UnityLayer(); lay.LayerID = i; this.layers.Add(lay); } } } } }
#include <rpc/server.h> #include <base58.h> #include <fs.h> #include <init.h> #include <random.h> #include <sync.h> #include <ui_interface.h> #include <util.h> #include <utilstrencodings.h> #include <boost/bind.hpp> #include <boost/signals2/signal.hpp> #include <boost/algorithm/string/case_conv.hpp> // for to_upper() #include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/split.hpp> #include <memory> // for unique_ptr #include <unordered_map> static bool fRPCRunning = false; static bool fRPCInWarmup = true; static std::string rpcWarmupStatus("RPC server started"); static CCriticalSection cs_rpcWarmup; /* Timer-creating functions */ static RPCTimerInterface* timerInterface = nullptr; /* Map of name to timer. */ static std::map<std::string, std::unique_ptr<RPCTimerBase> > deadlineTimers; static struct CRPCSignals { boost::signals2::signal<void ()> Started; boost::signals2::signal<void ()> Stopped; boost::signals2::signal<void (const CRPCCommand&)> PreCommand; } g_rpcSignals; void RPCServer::OnStarted(std::function<void ()> slot) { g_rpcSignals.Started.connect(slot); } void RPCServer::OnStopped(std::function<void ()> slot) { g_rpcSignals.Stopped.connect(slot); } void RPCTypeCheck(const UniValue& params, const std::list<UniValue::VType>& typesExpected, bool fAllowNull) { unsigned int i = 0; for (UniValue::VType t : typesExpected) { if (params.size() <= i) break; const UniValue& v = params[i]; if (!(fAllowNull && v.isNull())) { <API key>(v, t); } i++; } } void <API key>(const UniValue& value, UniValue::VType typeExpected) { if (value.type() != typeExpected) { throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Expected type %s, got %s", uvTypeName(typeExpected), uvTypeName(value.type()))); } } void RPCTypeCheckObj(const UniValue& o, const std::map<std::string, UniValueType>& typesExpected, bool fAllowNull, bool fStrict) { for (const auto& t : typesExpected) { const UniValue& v = find_value(o, t.first); if (!fAllowNull && v.isNull()) throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first)); if (!(t.second.typeAny || v.type() == t.second.type || (fAllowNull && v.isNull()))) { std::string err = strprintf("Expected type %s for %s, got %s", uvTypeName(t.second.type), t.first, uvTypeName(v.type())); throw JSONRPCError(RPC_TYPE_ERROR, err); } } if (fStrict) { for (const std::string& k : o.getKeys()) { if (typesExpected.count(k) == 0) { std::string err = strprintf("Unexpected key %s", k); throw JSONRPCError(RPC_TYPE_ERROR, err); } } } } CAmount AmountFromValue(const UniValue& value) { if (!value.isNum() && !value.isStr()) throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string"); CAmount amount; if (!ParseFixedPoint(value.getValStr(), 8, &amount)) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); if (!MoneyRange(amount)) throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range"); return amount; } uint256 ParseHashV(const UniValue& v, std::string strName) { std::string strHex; if (v.isStr()) strHex = v.get_str(); if (!IsHex(strHex)) // Note: IsHex("") is false throw JSONRPCError(<API key>, strName+" must be hexadecimal string (not '"+strHex+"')"); if (64 != strHex.length()) throw JSONRPCError(<API key>, strprintf("%s must be of length %d (not %d)", strName, 64, strHex.length())); uint256 result; result.SetHex(strHex); return result; } uint256 ParseHashO(const UniValue& o, std::string strKey) { return ParseHashV(find_value(o, strKey), strKey); } std::vector<unsigned char> ParseHexV(const UniValue& v, std::string strName) { std::string strHex; if (v.isStr()) strHex = v.get_str(); if (!IsHex(strHex)) throw JSONRPCError(<API key>, strName+" must be hexadecimal string (not '"+strHex+"')"); return ParseHex(strHex); } std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey) { return ParseHexV(find_value(o, strKey), strKey); } /** * Note: This interface may still be subject to change. */ std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest& helpreq) const { std::string strRet; std::string category; std::set<rpcfn_type> setDone; std::vector<std::pair<std::string, const CRPCCommand*> > vCommands; for (const auto& entry : mapCommands) vCommands.push_back(make_pair(entry.second->category + entry.first, entry.second)); sort(vCommands.begin(), vCommands.end()); JSONRPCRequest jreq(helpreq); jreq.fHelp = true; jreq.params = UniValue(); for (const std::pair<std::string, const CRPCCommand*>& command : vCommands) { const CRPCCommand *pcmd = command.second; std::string strMethod = pcmd->name; if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand) continue; jreq.strMethod = strMethod; try { rpcfn_type pfn = pcmd->actor; if (setDone.insert(pfn).second) (*pfn)(jreq); } catch (const std::exception& e) { // Help text is returned in an exception std::string strHelp = std::string(e.what()); if (strCommand == "") { if (strHelp.find('\n') != std::string::npos) strHelp = strHelp.substr(0, strHelp.find('\n')); if (category != pcmd->category) { if (!category.empty()) strRet += "\n"; category = pcmd->category; std::string firstLetter = category.substr(0,1); boost::to_upper(firstLetter); strRet += "== " + firstLetter + category.substr(1) + " ==\n"; } } strRet += strHelp + "\n"; } } if (strRet == "") strRet = strprintf("help: unknown command: %s\n", strCommand); strRet = strRet.substr(0,strRet.size()-1); return strRet; } UniValue help(const JSONRPCRequest& jsonRequest) { if (jsonRequest.fHelp || jsonRequest.params.size() > 1) throw std::runtime_error( "help ( \"command\" )\n" "\nList all commands, or get help for a specified command.\n" "\nArguments:\n" "1. \"command\" (string, optional) The command to get help on\n" "\nResult:\n" "\"text\" (string) The help text\n" ); std::string strCommand; if (jsonRequest.params.size() > 0) strCommand = jsonRequest.params[0].get_str(); return tableRPC.help(strCommand, jsonRequest); } UniValue stop(const JSONRPCRequest& jsonRequest) { // Accept the deprecated and ignored 'detach' boolean argument if (jsonRequest.fHelp || jsonRequest.params.size() > 1) throw std::runtime_error( "stop\n" "\nStop Doriancoin server."); // Event loop will exit after current HTTP requests have been handled, so // this reply will get back to the client. StartShutdown(); return "Doriancoin server stopping"; } UniValue uptime(const JSONRPCRequest& jsonRequest) { if (jsonRequest.fHelp || jsonRequest.params.size() > 1) throw std::runtime_error( "uptime\n" "\nReturns the total uptime of the server.\n" "\nResult:\n" "ttt (numeric) The number of seconds that the server has been running\n" "\nExamples:\n" + HelpExampleCli("uptime", "") + HelpExampleRpc("uptime", "") ); return GetTime() - GetStartupTime(); } /** * Call Table */ static const CRPCCommand vRPCCommands[] = { // category name actor (function) argNames /* Overall control/query calls */ { "control", "help", &help, {"command"} }, { "control", "stop", &stop, {} }, { "control", "uptime", &uptime, {} }, }; CRPCTable::CRPCTable() { unsigned int vcidx; for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); vcidx++) { const CRPCCommand *pcmd; pcmd = &vRPCCommands[vcidx]; mapCommands[pcmd->name] = pcmd; } } const CRPCCommand *CRPCTable::operator[](const std::string &name) const { std::map<std::string, const CRPCCommand*>::const_iterator it = mapCommands.find(name); if (it == mapCommands.end()) return nullptr; return (*it).second; } bool CRPCTable::appendCommand(const std::string& name, const CRPCCommand* pcmd) { if (IsRPCRunning()) return false; // don't allow overwriting for now std::map<std::string, const CRPCCommand*>::const_iterator it = mapCommands.find(name); if (it != mapCommands.end()) return false; mapCommands[name] = pcmd; return true; } bool StartRPC() { LogPrint(BCLog::RPC, "Starting RPC\n"); fRPCRunning = true; g_rpcSignals.Started(); return true; } void InterruptRPC() { LogPrint(BCLog::RPC, "Interrupting RPC\n"); // Interrupt e.g. running longpolls fRPCRunning = false; } void StopRPC() { LogPrint(BCLog::RPC, "Stopping RPC\n"); deadlineTimers.clear(); DeleteAuthCookie(); g_rpcSignals.Stopped(); } bool IsRPCRunning() { return fRPCRunning; } void SetRPCWarmupStatus(const std::string& newStatus) { LOCK(cs_rpcWarmup); rpcWarmupStatus = newStatus; } void <API key>() { LOCK(cs_rpcWarmup); assert(fRPCInWarmup); fRPCInWarmup = false; } bool RPCIsInWarmup(std::string *outStatus) { LOCK(cs_rpcWarmup); if (outStatus) *outStatus = rpcWarmupStatus; return fRPCInWarmup; } void JSONRPCRequest::parse(const UniValue& valRequest) { // Parse request if (!valRequest.isObject()) throw JSONRPCError(RPC_INVALID_REQUEST, "Invalid Request object"); const UniValue& request = valRequest.get_obj(); // Parse id now so errors from here on will have the id id = find_value(request, "id"); // Parse method UniValue valMethod = find_value(request, "method"); if (valMethod.isNull()) throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method"); if (!valMethod.isStr()) throw JSONRPCError(RPC_INVALID_REQUEST, "Method must be a string"); strMethod = valMethod.get_str(); LogPrint(BCLog::RPC, "ThreadRPCServer method=%s\n", SanitizeString(strMethod)); // Parse params UniValue valParams = find_value(request, "params"); if (valParams.isArray() || valParams.isObject()) params = valParams; else if (valParams.isNull()) params = UniValue(UniValue::VARR); else throw JSONRPCError(RPC_INVALID_REQUEST, "Params must be an array or object"); } bool <API key>(const std::string& method) { const std::vector<std::string> enabled_methods = gArgs.GetArgs("-deprecatedrpc"); return find(enabled_methods.begin(), enabled_methods.end(), method) != enabled_methods.end(); } static UniValue JSONRPCExecOne(JSONRPCRequest jreq, const UniValue& req) { UniValue rpc_result(UniValue::VOBJ); try { jreq.parse(req); UniValue result = tableRPC.execute(jreq); rpc_result = JSONRPCReplyObj(result, NullUniValue, jreq.id); } catch (const UniValue& objError) { rpc_result = JSONRPCReplyObj(NullUniValue, objError, jreq.id); } catch (const std::exception& e) { rpc_result = JSONRPCReplyObj(NullUniValue, JSONRPCError(RPC_PARSE_ERROR, e.what()), jreq.id); } return rpc_result; } std::string JSONRPCExecBatch(const JSONRPCRequest& jreq, const UniValue& vReq) { UniValue ret(UniValue::VARR); for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++) ret.push_back(JSONRPCExecOne(jreq, vReq[reqIdx])); return ret.write() + "\n"; } /** * Process named arguments into a vector of positional arguments, based on the * passed-in specification for the RPC call's arguments. */ static inline JSONRPCRequest <API key>(const JSONRPCRequest& in, const std::vector<std::string>& argNames) { JSONRPCRequest out = in; out.params = UniValue(UniValue::VARR); // Build a map of parameters, and remove ones that have been processed, so that we can throw a focused error if // there is an unknown one. const std::vector<std::string>& keys = in.params.getKeys(); const std::vector<UniValue>& values = in.params.getValues(); std::unordered_map<std::string, const UniValue*> argsIn; for (size_t i=0; i<keys.size(); ++i) { argsIn[keys[i]] = &values[i]; } // Process expected parameters. int hole = 0; for (const std::string &argNamePattern: argNames) { std::vector<std::string> vargNames; boost::algorithm::split(vargNames, argNamePattern, boost::algorithm::is_any_of("|")); auto fr = argsIn.end(); for (const std::string & argName : vargNames) { fr = argsIn.find(argName); if (fr != argsIn.end()) { break; } } if (fr != argsIn.end()) { for (int i = 0; i < hole; ++i) { // Fill hole between specified parameters with JSON nulls, // but not at the end (for backwards compatibility with calls // that act based on number of specified parameters). out.params.push_back(UniValue()); } hole = 0; out.params.push_back(*fr->second); argsIn.erase(fr); } else { hole += 1; } } // If there are still arguments in the argsIn map, this is an error. if (!argsIn.empty()) { throw JSONRPCError(<API key>, "Unknown named parameter " + argsIn.begin()->first); } // Return request with named arguments transformed to positional arguments return out; } UniValue CRPCTable::execute(const JSONRPCRequest &request) const { // Return immediately if in warmup { LOCK(cs_rpcWarmup); if (fRPCInWarmup) throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus); } // Find method const CRPCCommand *pcmd = tableRPC[request.strMethod]; if (!pcmd) throw JSONRPCError(<API key>, "Method not found"); g_rpcSignals.PreCommand(*pcmd); try { // Execute, convert arguments to array if necessary if (request.params.isObject()) { return pcmd->actor(<API key>(request, pcmd->argNames)); } else { return pcmd->actor(request); } } catch (const std::exception& e) { throw JSONRPCError(RPC_MISC_ERROR, e.what()); } } std::vector<std::string> CRPCTable::listCommands() const { std::vector<std::string> commandList; typedef std::map<std::string, const CRPCCommand*> commandMap; std::transform( mapCommands.begin(), mapCommands.end(), std::back_inserter(commandList), boost::bind(&commandMap::value_type::first,_1) ); return commandList; } std::string HelpExampleCli(const std::string& methodname, const std::string& args) { return "> doriancoin-cli " + methodname + " " + args + "\n"; } std::string HelpExampleRpc(const std::string& methodname, const std::string& args) { return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", " "\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:1948/\n"; } void <API key>(RPCTimerInterface *iface) { if (!timerInterface) timerInterface = iface; } void <API key>(RPCTimerInterface *iface) { timerInterface = iface; } void <API key>(RPCTimerInterface *iface) { if (timerInterface == iface) timerInterface = nullptr; } void RPCRunLater(const std::string& name, std::function<void(void)> func, int64_t nSeconds) { if (!timerInterface) throw JSONRPCError(RPC_INTERNAL_ERROR, "No timer handler registered for RPC"); deadlineTimers.erase(name); LogPrint(BCLog::RPC, "queue run of timer %s in %i seconds (using %s)\n", name, nSeconds, timerInterface->Name()); deadlineTimers.emplace(name, std::unique_ptr<RPCTimerBase>(timerInterface->NewTimer(func, nSeconds*1000))); } int <API key>() { int flag = 0; if (gArgs.GetArg("-rpcserialversion", <API key>) == 0) flag |= <API key>; return flag; } CRPCTable tableRPC;
using HpSchedulerJob.NET.Foundation; using HpSchedulerJob.NET.RabbitMq.RabbitMqScene; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HpSchedulerJob.NET.HpSchedule { public class JobApplication { public JobApplication(HpScheduleOptions options = null) { if (options == null) { options = new HpScheduleOptions(); } if (!string.IsNullOrEmpty(options.Log4net)) { Log.config(options.Log4net); //Log if (options.Debug) Log.SimpleFormat = true; } if (!string.IsNullOrEmpty(options.Config)) { ConfigurationCenter.<API key>(new JsonConfiguration(options.Config)); if (!ConfigurationCenter.load()) { throw new Exception(""); } } } public void start(string <API key>, params HpScheduleJob[] jobs) { if (string.IsNullOrEmpty(<API key>)) { <API key> = "<API key>"; } foreach (var job in jobs) { job.run(<API key>); } } public void stop() { Log.shutdown(); } } }
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" ng-app="myApp"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Treerock Projects - Do Something</title> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/main.css"> </head> <body ng-controller="MyCtrl"> <div class="navbar navbar-default ng-cloak"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="http://sandbox.treerock.me/">Sandbox Project</a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="#/main" class="active">Do Something</a> </li> </ul> <form class="navbar-form navbar-right" name="login_form" ng-submit="login(login_form)"> <div ng-hide="main.loggedin"> <div class="form-group"> <input type="text" placeholder="Enter Username" class="form-control" ng-model="main.form_data.user_name"> </div> <button type="submit" class="btn">Log In</button> </div> </form> <p ng-hide="! main.loggedin" class="navbar-text navbar-right">Hello &amp; Welcome <strong>{{main.user_name}}</strong>. (<a href="#" ng-click="logout()">Logout</a>)</p> </div> <!--/.navbar-collapse --> </div> </div> <div class="alert alert-warning ng-cloak" ng-show="main.user_message"> <p>{{main.user_message}}</p> </div> <div class="ng-view"></div> <footer id="footer"> <div class="container"> <p>Treerock</p> </div> </footer> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <script> window.jQuery || document.write('<script src="js/vendor/jquery-1.10.1.min.js"><\/script>') </script> <script src="js/vendor/bootstrap.min.js"></script> <script src="js/main.js"></script> <!-- In production use: <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"> </script> <script src="lib/angular/angular.js"></script> <script src="lib/angular/angular-route.js"></script> <script src="lib/angular/angular-cookies.js"></script> <script src="js/app.js"></script> <script src="js/services.js"></script> <script src="js/controllers.js"></script> <script src="js/filters.js"></script> <script src="js/directives.js"></script> </body> </html>
class CreateSubnets < ActiveRecord::Migration def change create_table :subnets do |t| t.string :cidr t.timestamps end end end
module BraintreeRails class CreditCard include Model define_attributes( :create => [:billing_address, :cardholder_name, :customer_id, :expiration_date, :expiration_month, :expiration_year, :number, :cvv, :options, :token, :device_data], :update => [:billing_address, :cardholder_name, :expiration_date, :expiration_month, :expiration_year, :options, :number, :cvv, :device_data], :readonly => [ :bin, :card_type, :commercial, :country_of_issuance, :created_at, :debit, :durbin_regulated, :default, :expired, :healthcare, :issuing_bank, :image_url, :last_4, :payroll, :prepaid, :<API key>, :updated_at ], :as_association => [:cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number] ) has_many :transactions, :class_name => "BraintreeRails::Transactions" has_many :subscriptions, :class_name => "BraintreeRails::Subscriptions" belongs_to :customer, :class_name => "BraintreeRails::Customer", :foreign_key => :customer_id has_one :billing_address, :class_name => "BraintreeRails::BillingAddress" alias_method :id, :token alias_method :id=, :token= around_persist :<API key> before_update :<API key>, :if => :expiry_date_changed? def ensure_model(model) if Braintree::Transaction::CreditCardDetails === model assign_attributes(extract_values(model)) self.persisted = model.id.present? model else super end end def expired? expired end def default? default end def masked_number " end def add_errors(validation_errors) billing_address.add_errors(extract_errors(validation_errors)) if billing_address super(validation_errors) end def attributes_for(action) super.tap do |attributes| if attributes[:billing_address] && action == :update attributes[:billing_address].merge!(:options => {:update_existing => true}) end end end def <API key> yield if block_given? ensure return unless Configuration.mode == Configuration::Mode::JS [:number=, :cvv=].each do |encrypted_attribute| self.send(encrypted_attribute, nil) end end def <API key> self.expiration_date = [self.expiration_month, self.expiration_year].join("/") self.expiration_month = self.expiration_year = nil end def expiry_date_changed? changed.include?(:expiration_month) || changed.include?(:expiration_year) end end end
<?php namespace Cinemax\FeedbackBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Comments * * @ORM\Table(name="comments") * @ORM\Entity */ class Comments { /** * @var integer * * @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; /** * @var string * * @ORM\Column(name="author", type="string", length=255, nullable=false) */ private $author; /** * @var string * * @ORM\Column(name="comment", type="text", nullable=false) */ private $comment; /** * @var \DateTime * * @ORM\Column(name="created", type="date", nullable=false) */ private $created; /** * @var Movie * @ORM\ManyToOne(targetEntity="\Cinemax\VideosBundle\Entity\Movies", inversedBy="comment") */ private $movie; /** * @var boolean * * @ORM\Column(name="active", type="boolean", nullable=true) */ private $active; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set author * * @param string $author * @return Comments */ public function setAuthor($author) { $this->author = $author; return $this; } /** * Get author * * @return string */ public function getAuthor() { return $this->author; } /** * Set comment * * @param string $comment * @return Comments */ public function setComment($comment) { $this->comment = $comment; return $this; } /** * Get comment * * @return string */ public function getComment() { return $this->comment; } /** * Set created * * @param \DateTime $created * @return Comments */ public function setCreated($created) { $this->created = $created; return $this; } /** * Get created * * @return \DateTime */ public function getCreated() { return $this->created; } /** * Set movie * * @param \Cinemax\VideosBundle\Entity\Movies $movie * @return Comments */ public function setMovie(\Cinemax\VideosBundle\Entity\Movies $movie = null) { $this->movie = $movie; return $this; } /** * Get movie * * @return \Cinemax\VideosBundle\Entity\Movies */ public function getMovie() { return $this->movie; } /** * Set active * * @param boolean $active * @return Comments */ public function setActive($active) { $this->active = $active; return $this; } /** * Get active * * @return boolean */ public function getActive() { return $this->active; } }
package com.voxworx.polycom; import java.util.ArrayList; import java.util.List; /** * The state of default soft keys, and any user defined soft keys. * Once populated, used to generate the softkey configuration tag<br> * Usage: a) Turn on/off the default soft keys * b) Create and add any custom soft keys * @author Ian * */ public class SoftKeyProfile { private final PhoneModel phoneModel; private boolean newCallEnabled = true; // 'New Call' soft key private boolean endCallEnabled = true; // 'End Call' soft key private boolean splitEnabled = false; // 'Split' soft key (conference) private boolean joinEnabled = true; // 'Join' soft key (conference) private boolean forwardEnabled = true; // 'Forward' soft key private boolean directoriesEnabled = true; // 'Dir' soft key private boolean callersEnabled = true; // 'Callers' soft key private boolean myStatusEnabled = true; // 'MyStatus' soft key (?) private boolean <API key> = true; // Represents 3 key // Must be true for 32x/33x phones private final List<CustomSoftKey> customSoftKeys; public SoftKeyProfile(PhoneModel phoneModel) { super(); this.phoneModel = phoneModel; this.customSoftKeys = new ArrayList<CustomSoftKey>(); } /** * Add a custom soft key (in addition to the default soft keys) * @param customSoftKey The custom soft key to add */ public void addCustomSoftKey(CustomSoftKey customSoftKey) { customSoftKeys.add(customSoftKey); } public PhoneModel getPhoneModel() { return phoneModel; } public boolean isNewCallEnabled() { return newCallEnabled; } public void setNewCallEnabled(boolean newCallEnabled) { this.newCallEnabled = newCallEnabled; } public boolean isEndCallEnabled() { return endCallEnabled; } public void setEndCallEnabled(boolean endCallEnabled) { this.endCallEnabled = endCallEnabled; } public boolean isSplitEnabled() { return splitEnabled; } public void setSplitEnabled(boolean splitEnabled) { this.splitEnabled = splitEnabled; } public boolean isJoinEnabled() { return joinEnabled; } public void setJoinEnabled(boolean joinEnabled) { this.joinEnabled = joinEnabled; } public boolean isForwardEnabled() { return forwardEnabled; } public void setForwardEnabled(boolean forwardEnabled) { this.forwardEnabled = forwardEnabled; } public boolean <API key>() { return directoriesEnabled; } public void <API key>(boolean directoriesEnabled) { this.directoriesEnabled = directoriesEnabled; } public boolean isCallersEnabled() { return callersEnabled; } public void setCallersEnabled(boolean callersEnabled) { this.callersEnabled = callersEnabled; } public boolean isMyStatusEnabled() { return myStatusEnabled; } public void setMyStatusEnabled(boolean myStatusEnabled) { this.myStatusEnabled = myStatusEnabled; } public boolean <API key>() { return <API key>; } public void <API key>( boolean <API key>) { this.<API key> = <API key>; } public List<CustomSoftKey> getCustomSoftKeys() { return customSoftKeys; } }
# CMake generated Testfile for # Source directory: /home/bladestery/Downloads/opencv-3.2.0/samples/android/15-puzzle # Build directory: /home/bladestery/Sapphire/example_apps/AndroidStudioMinnie/sapphire/.externalNativeBuild/cmake/debug/armeabi-v7a/samples/android/15-puzzle # This file includes the relevant testing commands required for # testing this directory and lists subdirectories to be tested as well.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>User agent detail - SAMSUNG-SGH-E608</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="../circle.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="section"> <h1 class="header center orange-text">User agent detail</h1> <div class="row center"> <h5 class="header light"> SAMSUNG-SGH-E608 </h5> </div> </div> <div class="section"> <table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Test suite</th></tr><tr><td>UAParser<br /><small>v0.5.0.2</small><br /><small>vendor/thadafinser/uap-core/tests/test_device.yaml</small></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-E608</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UAParser result detail</h4> <p><pre><code class="php">Array ( [user_agent_string] => SAMSUNG-SGH-E608 [family] => Samsung SGH-E608 [brand] => Samsung [model] => SGH-E608 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapFull<br /><small>6014</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>BrowscapLite<br /><small>6014</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>BrowscapPhp<br /><small>6014</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>DonatjUAParser<br /><small>v0.5.1</small><br /></td><td>SAMSUNG-SGH-E608 </td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>DonatjUAParser result detail</h4> <p><pre><code class="php">Array ( [platform] => [browser] => SAMSUNG-SGH-E608 [version] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>JenssegersAgent<br /><small>v2.3.3</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>JenssegersAgent result detail</h4> <p><pre><code class="php">Array ( [browserName] => [browserVersion] => [osName] => [osVersion] => [deviceModel] => Samsung [isMobile] => 1 [isRobot] => [botName] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>NeutrinoApiCom<br /><small></small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-E608</td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.20701</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>NeutrinoApiCom result detail</h4> <p><pre><code class="php">stdClass Object ( [<API key>] => 0 [is_mobile] => 1 [type] => mobile-browser [mobile_brand] => Samsung [mobile_model] => SGH-E608 [version] => [is_android] => [browser_name] => unknown [<API key>] => unknown [<API key>] => [is_ios] => [producer] => Samsung [operating_system] => unknown [mobile_screen_width] => 0 [mobile_browser] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>PiwikDeviceDetector<br /><small>3.6.1</small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-E608</td><td>smartphone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.006</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>PiwikDeviceDetector result detail</h4> <p><pre><code class="php">Array ( [client] => [operatingSystem] => Array ( ) [device] => Array ( [brand] => SA [brandName] => Samsung [model] => SGH-E608 [device] => 1 [deviceName] => smartphone ) [bot] => [extra] => Array ( [isBot] => [isBrowser] => [isFeedReader] => [isMobileApp] => [isPIM] => [isLibrary] => [isMediaPlayer] => [isCamera] => [isCarBrowser] => [isConsole] => [isFeaturePhone] => [isPhablet] => [<API key>] => [isSmartDisplay] => [isSmartphone] => 1 [isTablet] => [isTV] => [isDesktop] => [isMobile] => 1 [isTouchEnabled] => ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td><API key><br /><small>6.0.1</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>UAParser<br /><small>v3.4.5</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-E608</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.011</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UAParser result detail</h4> <p><pre><code class="php">UAParser\Result\Client Object ( [ua] => UAParser\Result\UserAgent Object ( [major] => [minor] => [patch] => [family] => Other ) [os] => UAParser\Result\OperatingSystem Object ( [major] => [minor] => [patch] => [patchMinor] => [family] => Other ) [device] => UAParser\Result\Device Object ( [brand] => Samsung [model] => SGH-E608 [family] => Samsung SGH-E608 ) [originalUserAgent] => SAMSUNG-SGH-E608 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UserAgentApiCom<br /><small></small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>UserAgentStringCom<br /><small></small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>WhatIsMyBrowserCom<br /><small></small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.23301</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhatIsMyBrowserCom result detail</h4> <p><pre><code class="php">stdClass Object ( [<API key>] => [<API key>] => [<API key>] => [browser_version] => [extra_info] => Array ( ) [operating_platform] => [extra_info_table] => Array ( ) [layout_engine_name] => [detected_addons] => Array ( ) [<API key>] => [<API key>] => [<API key>] => [<API key>] => Array ( ) [browser_name_code] => [<API key>] => [<API key>] => Samsung SGH-E608 [is_abusive] => [<API key>] => [<API key>] => Array ( ) [<API key>] => Samsung [operating_system] => [<API key>] => [<API key>] => SGH-E608 [browser_name] => [<API key>] => [user_agent] => SAMSUNG-SGH-E608 [<API key>] => [browser] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>WhichBrowser<br /><small>v2.0.18</small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-E608</td><td>mobile:feature</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.002</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhichBrowser result detail</h4> <p><pre><code class="php">Array ( [device] => Array ( [type] => mobile [subtype] => feature [manufacturer] => Samsung [model] => SGH-E608 ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Woothee<br /><small>v1.2.0</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>Wurfl<br /><small>1.7.1.0</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555"></td><td></td><td>Feature Phone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.021</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Wurfl result detail</h4> <p><pre><code class="php">Array ( [virtual] => Array ( [is_android] => false [is_ios] => false [is_windows_phone] => false [is_app] => false [is_full_desktop] => false [is_largescreen] => false [is_mobile] => true [is_robot] => false [is_smartphone] => false [is_touchscreen] => false [is_wml_preferred] => false [<API key>] => true [is_html_preferred] => false [<API key>] => [<API key>] => [advertised_browser] => [<API key>] => [<API key>] => [device_name] => [form_factor] => Feature Phone [is_phone] => true [is_app_webview] => false ) [all] => Array ( [brand_name] => [model_name] => [unique] => true [<API key>] => [is_wireless_device] => true [<API key>] => false [has_qwerty_keyboard] => false [<API key>] => false [uaprof] => [uaprof2] => [uaprof3] => [nokia_series] => 0 [nokia_edition] => 0 [device_os] => [mobile_browser] => [<API key>] => [device_os_version] => [pointing_method] => [release_date] => 2002_january [marketing_name] => [model_extra_info] => [nokia_feature_pack] => 0 [<API key>] => true [is_tablet] => false [manufacturer_name] => [is_bot] => false [is_google_glass] => false [proportional_font] => false [<API key>] => false [card_title_support] => true [softkey_support] => false [table_support] => true [numbered_menus] => false [<API key>] => false [<API key>] => true [<API key>] => false [<API key>] => true [access_key_support] => false [wrap_mode_support] => false [<API key>] => false [<API key>] => false [<API key>] => true [wizards_recommended] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => wtai://wp/mc; [<API key>] => false [emoji] => false [<API key>] => false [<API key>] => false [imode_region] => none [<API key>] => tel: [chtml_table_support] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [xhtml_nowrap_mode] => false [<API key>] => false [<API key>] => #FFFFFF [<API key>] => #FFFFFF [<API key>] => false [<API key>] => true [<API key>] => utf8 [<API key>] => false [<API key>] => tel: [<API key>] => application/vnd.wap.xhtml+xml [xhtml_table_support] => false [<API key>] => none [<API key>] => none [xhtml_file_upload] => not_supported [cookie_support] => true [<API key>] => true [<API key>] => none [<API key>] => false [<API key>] => none [<API key>] => false [ajax_manipulate_css] => false [<API key>] => false [<API key>] => false [ajax_xhr_type] => none [ajax_manipulate_dom] => false [ajax_support_events] => false [<API key>] => false [<API key>] => none [xhtml_support_level] => 1 [preferred_markup] => <API key> [wml_1_1] => true [wml_1_2] => false [wml_1_3] => false [<API key>] => true [<API key>] => true [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [html_web_3_2] => false [html_web_4_0] => false [voicexml] => false [multipart_support] => false [<API key>] => false [<API key>] => false [resolution_width] => 90 [resolution_height] => 90 [columns] => 11 [max_image_width] => 90 [max_image_height] => 35 [rows] => 6 [<API key>] => 27 [<API key>] => 27 [dual_orientation] => false [density_class] => 1.0 [wbmp] => true [bmp] => false [epoc_bmp] => false [gif_animated] => false [jpg] => false [png] => false [tiff] => false [<API key>] => false [<API key>] => false [svgt_1_1] => false [svgt_1_1_plus] => false [greyscale] => false [gif] => true [colors] => 256 [webp_lossy_support] => false [<API key>] => false [post_method_support] => true [basic_<API key>] => true [<API key>] => true [emptyok] => false [nokia_voice_call] => false [wta_voice_call] => false [wta_phonebook] => false [wta_misc] => false [wta_pdc] => false [https_support] => true [phone_id_provided] => false [max_data_rate] => 9 [wifi] => false [sdio] => false [vpn] => false [has_cellular_radio] => true [max_deck_size] => 4000 [<API key>] => 128 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [max_no_of_bookmarks] => 0 [<API key>] => 0 [<API key>] => 0 [max_object_size] => 0 [downloadfun_support] => false [<API key>] => false [inline_support] => false [oma_support] => false [ringtone] => false [ringtone_3gpp] => false [<API key>] => false [<API key>] => false [ringtone_imelody] => false [ringtone_digiplug] => false [<API key>] => false [ringtone_mmf] => false [ringtone_rmf] => false [ringtone_xmf] => false [ringtone_amr] => false [ringtone_awb] => false [ringtone_aac] => false [ringtone_wav] => false [ringtone_mp3] => false [ringtone_spmidi] => false [ringtone_qcelp] => false [ringtone_voices] => 1 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [wallpaper] => false [wallpaper_max_width] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [wallpaper_resize] => none [wallpaper_wbmp] => false [wallpaper_bmp] => false [wallpaper_gif] => false [wallpaper_jpg] => false [wallpaper_png] => false [wallpaper_tiff] => false [wallpaper_greyscale] => false [wallpaper_colors] => 2 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [screensaver] => false [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [screensaver_resize] => none [screensaver_wbmp] => false [screensaver_bmp] => false [screensaver_gif] => false [screensaver_jpg] => false [screensaver_png] => false [<API key>] => false [screensaver_colors] => 2 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [picture] => false [picture_max_width] => 0 [picture_max_height] => 0 [<API key>] => 0 [<API key>] => 0 [picture_resize] => none [picture_wbmp] => false [picture_bmp] => false [picture_gif] => false [picture_jpg] => false [picture_png] => false [picture_greyscale] => false [picture_colors] => 2 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [video] => false [<API key>] => false [<API key>] => false [<API key>] => false [streaming_video] => false [streaming_3gpp] => false [streaming_mp4] => false [streaming_mov] => false [<API key>] => 0 [<API key>] => none [streaming_flv] => false [streaming_3g2] => false [<API key>] => -1 [<API key>] => -1 [<API key>] => -1 [<API key>] => -1 [<API key>] => -1 [<API key>] => none [<API key>] => none [streaming_wmv] => none [<API key>] => rtsp [<API key>] => none [wap_push_support] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => false [utf8_support] => false [ascii_support] => false [iso8859_support] => false [expiration_date] => false [j2me_cldc_1_0] => false [j2me_cldc_1_1] => false [j2me_midp_1_0] => false [j2me_midp_2_0] => false [doja_1_0] => false [doja_1_5] => false [doja_2_0] => false [doja_2_1] => false [doja_2_2] => false [doja_3_0] => false [doja_3_5] => false [doja_4_0] => false [j2me_jtwi] => false [j2me_mmapi_1_0] => false [j2me_mmapi_1_1] => false [j2me_wmapi_1_0] => false [j2me_wmapi_1_1] => false [j2me_wmapi_2_0] => false [j2me_btapi] => false [j2me_3dapi] => false [j2me_locapi] => false [j2me_nokia_ui] => false [j2me_motorola_lwt] => false [<API key>] => false [<API key>] => false [j2me_heap_size] => 0 [j2me_max_jar_size] => 0 [j2me_storage_size] => 0 [<API key>] => 0 [j2me_screen_width] => 0 [j2me_screen_height] => 0 [j2me_canvas_width] => 0 [j2me_canvas_height] => 0 [j2me_bits_per_pixel] => 0 [<API key>] => false [<API key>] => false [<API key>] => false [<API key>] => none [j2me_http] => false [j2me_https] => false [j2me_socket] => false [j2me_udp] => false [j2me_serial] => false [j2me_gif] => false [j2me_gif89a] => false [j2me_jpg] => false [j2me_png] => false [j2me_bmp] => false [j2me_bmp3] => false [j2me_wbmp] => false [j2me_midi] => false [j2me_wav] => false [j2me_amr] => false [j2me_mp3] => false [j2me_mp4] => false [j2me_imelody] => false [j2me_rmf] => false [j2me_au] => false [j2me_aac] => false [j2me_realaudio] => false [j2me_xmf] => false [j2me_wma] => false [j2me_3gpp] => false [j2me_h263] => false [j2me_svgt] => false [j2me_mpeg4] => false [j2me_realvideo] => false [j2me_real8] => false [j2me_realmedia] => false [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [j2me_clear_key_code] => 0 [<API key>] => false [<API key>] => false [receiver] => false [sender] => false [mms_max_size] => 0 [mms_max_height] => 0 [mms_max_width] => 0 [built_in_recorder] => false [built_in_camera] => false [mms_jpeg_baseline] => false [<API key>] => false [mms_gif_static] => false [mms_gif_animated] => false [mms_png] => false [mms_bmp] => false [mms_wbmp] => false [mms_amr] => false [mms_wav] => false [mms_midi_monophonic] => false [mms_midi_polyphonic] => false [<API key>] => 0 [mms_spmidi] => false [mms_mmf] => false [mms_mp3] => false [mms_evrc] => false [mms_qcelp] => false [mms_ota_bitmap] => false [mms_nokia_wallpaper] => false [<API key>] => false [<API key>] => false [<API key>] => false [mms_rmf] => false [mms_xmf] => false [mms_symbian_install] => false [mms_jar] => false [mms_jad] => false [mms_vcard] => false [mms_vcalendar] => false [mms_wml] => false [mms_wbxml] => false [mms_wmlc] => false [mms_video] => false [mms_mp4] => false [mms_3gpp] => false [mms_3gpp2] => false [mms_max_frame_rate] => 0 [nokiaring] => false [picturemessage] => false [operatorlogo] => false [largeoperatorlogo] => false [callericon] => false [nokiavcard] => false [nokiavcal] => false [sckl_ringtone] => false [sckl_operatorlogo] => false [sckl_groupgraphic] => false [sckl_vcard] => false [sckl_vcalendar] => false [text_imelody] => false [ems] => false [<API key>] => false [ems_imelody] => false [ems_odi] => false [ems_upi] => false [ems_version] => 0 [siemens_ota] => false [siemens_logo_width] => 101 [siemens_logo_height] => 29 [<API key>] => 101 [<API key>] => 50 [gprtf] => false [sagem_v1] => false [sagem_v2] => false [panasonic] => false [sms_enabled] => true [wav] => false [mmf] => false [smf] => false [mld] => false [midi_monophonic] => false [midi_polyphonic] => false [sp_midi] => false [rmf] => false [xmf] => false [compactmidi] => false [digiplug] => false [nokia_ringtone] => false [imelody] => false [au] => false [amr] => false [awb] => false [aac] => false [mp3] => false [voices] => 1 [qcelp] => false [evrc] => false [flash_lite_version] => [fl_wallpaper] => false [fl_screensaver] => false [fl_standalone] => false [fl_browser] => false [fl_sub_lcd] => false [full_flash_support] => false [<API key>] => true [css_border_image] => none [css_rounded_corners] => none [css_gradient] => none [css_spriting] => false [css_gradient_linear] => none [is_transcoder] => false [<API key>] => user-agent [rss_support] => false [pdf_support] => false [<API key>] => false [<API key>] => -1 [<API key>] => -1 [<API key>] => -1 [<API key>] => -1 [<API key>] => -1 [playback_real_media] => none [playback_3gpp] => false [playback_3g2] => false [playback_mp4] => false [playback_mov] => false [playback_acodec_amr] => none [playback_acodec_aac] => none [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => 0 [<API key>] => false [playback_wmv] => none [<API key>] => false [html_preferred_dtd] => xhtml_mp1 [viewport_supported] => false [viewport_width] => [<API key>] => [<API key>] => [<API key>] => [<API key>] => [mobileoptimized] => false [handheldfriendly] => false [canvas_support] => none [image_inlining] => false [is_smarttv] => false [is_console] => false [nfc_support] => false [ux_full_desktop] => false [jqm_grade] => none [is_sencha_touch_ok] => false ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Zsxsoft<br /><small>1.3</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-E608</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#<API key>">Detail</a> <!-- Modal Structure --> <div id="<API key>" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Zsxsoft result detail</h4> <p><pre><code class="php">Array ( [browser] => Array ( [link] => [title] => Unknown [name] => Unknown [version] => [code] => null [image] => img/16/browser/null.png ) [os] => Array ( [link] => [name] => [version] => [code] => null [x64] => [title] => [type] => os [dir] => os [image] => img/16/os/null.png ) [device] => Array ( [link] => http: [title] => Samsung SGH-E608 [model] => SGH-E608 [brand] => Samsung [code] => samsung [dir] => device [type] => device [image] => img/16/device/samsung.png ) [platform] => Array ( [link] => http: [title] => Samsung SGH-E608 [model] => SGH-E608 [brand] => Samsung [code] => samsung [dir] => device [type] => device [image] => img/16/device/samsung.png ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr></table> </div> <div class="section"> <h1 class="header center orange-text">About this comparison</h1> <div class="row center"> <h5 class="header light"> The primary goal of this project is simple<br /> I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br /> <br /> The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br /> <br /> You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/<API key>">ThaDafinser/<API key></a><br /> <br /> The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a> </h5> </div> </div> <div class="card"> <div class="card-content"> Comparison created <i>2016-05-10 08:12:04</i> | by <a href="https://github.com/ThaDafinser">ThaDafinser</a> </div> </div> </div> <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.2.0/list.min.js"></script> <script> $(document).ready(function(){ // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered $('.modal-trigger').leanModal(); }); </script> </body> </html>
# Homebrew OS Zimmee's homebrew installs Homebrew for MacOS, as well as any Homebrew apps that are not set up in other OS Zimmee app folders. ## Install bash bash $OSZ_ROOT/homebrew/install ## Uninstall bash bash $OSZ_ROOT/homebrew/uninstall ## Details This app sets up the following functionality: 1. [Install script](./install) to install Homebrew for MacOS and certain apps/packages. 2. Sets up ZSH environment for Homebrew. 3. Provides an [update script](./update) to update Homebrew and installed apps/packages. 4. [Uninstall script](./uninstall) to uninstall Homebrew and installed apps/packages.
package com.att.m2x.android.services.model; public enum DeviceSort { LAST_ACTIVITY("last_activity"), NAME("name"), SERIAL("serial"), CREATED("created"); private String fieldName; DeviceSort(String fieldName) { this.fieldName = fieldName; } public String fieldName() { return fieldName; } }
package com.andreytim.jafar.problems.sortsearch; import java.util.Arrays; public class <API key> { public class Song implements Comparable<Song> { private int duration; private int tone; public Song(int duration, int tone) { this.duration = duration; this.tone = tone; } @Override public int compareTo(Song other) { return this.tone - other.tone; } } public int maxSongs(int[] duration, int[] tone, int T) { Song[] songs = new Song[tone.length]; for (int i = 0; i < tone.length; i++) { songs[i] = new Song(duration[i], tone[i]); } Arrays.sort(songs); int result = 0; int bitMask = 0; while (bitMask < (1 << songs.length)) { int currSum = 0, currCount = 0; int minTone = Integer.MAX_VALUE/2, maxTone = Integer.MIN_VALUE/2; for (int i = 0; i < songs.length; i++) { if ((bitMask & (1 << i)) != 0) { currCount++; currSum += songs[i].duration; minTone = Math.min(minTone, songs[i].tone); maxTone = Math.max(maxTone, songs[i].tone); } } if (currSum + maxTone - minTone <= T) { result = Math.max(result, currCount); } bitMask++; } return result; } public void test(int[] duration, int[] tone, int T) { System.out.printf("Input: duration=%s, tone=%s, T=%d;\nResult: %d\n Arrays.toString(duration), Arrays.toString(tone), T, maxSongs(duration, tone, T)); } public static void main(String[] args) { <API key> gumi = new <API key>(); gumi.test(new int[]{100, 200, 300}, new int[]{1, 2, 3}, 0); gumi.test(new int[]{1, 2, 3, 4}, new int[]{1, 1, 1, 1}, 100); gumi.test(new int[]{10, 10, 10}, new int[]{58, 58, 58}, 30); gumi.test(new int[]{8, 11, 7, 15, 9, 16, 7, 9}, new int[]{3, 8, 5, 4, 2, 7, 4, 1}, 14); gumi.test( new int[]{5611,39996,20200,56574,81643,90131,33486,99568,48112,97168,5600,49145,73590,3979,94614}, new int[]{2916,53353,64924,86481,44803,61254,99393,5993,40781,2174,67458,74263,69710,40044,80853}, 302606); } }
'use strict'; /* Services */ // Demonstrate how to register services // In this case it is a simple value service. angular.module('myApp.services', []) .factory('FIREBASE_URL', function () { return 'https://waitandeat-senate.firebaseio.com/'; }) .factory('dataService', function($firebase, FIREBASE_URL) { var dataRef = new Firebase(FIREBASE_URL); var fireData = $firebase(dataRef); return fireData; }) .factory('partyService', function (dataService) { var users = dataService.$child('users'); var partyServiceObject = { saveParty: function (party, userId) { users.$child(userId).$child('parties').$add(party); }, getPartiesByUserId: function (userId) { return users.$child(userId).$child('parties'); } }; return partyServiceObject; }) .factory('textMessageService', function(partyService, dataService) { var textMessages = dataService.$child('textMessages'); var <API key> = { sendTextMessage: function (party, userId) { var newTextMessage = { phoneNumber: party.phone, name: party.name, size: party.size }; textMessages.$add(newTextMessage); partyService.getPartiesByUserId(userId).$child(party.$id).$update({notified: 'Yes'}); } }; return <API key>; }) .factory('authService', function ($firebaseSimpleLogin, $location, $rootScope, FIREBASE_URL, dataService) { var authRef = new Firebase(FIREBASE_URL); var auth = $firebaseSimpleLogin(authRef); var emails = dataService.$child('emails'); var authServiceObject = { register: function (user) { auth.$createUser(user.email, user.password).then(function (data) { console.log(data); authServiceObject.login(user, function() { emails.$add({email: user.email}); }); }); }, login: function (user, optionalCallback) { auth.$login('password', user).then(function (data) { console.log(data); if (optionalCallback) { optionalCallback(); } $location.path('/waitlist'); }); }, logout: function () { auth.$logout(); $location.path('/'); }, getCurrentUser: function () { return auth.$getCurrentUser(); } }; $rootScope.$on("$firebaseSimpleLogin:login", function (e, user) { //save current user on rootScope $rootScope.currentUser = user; }); $rootScope.$on("$firebaseSimpleLogin:logout", function () { //save current user on rootScope $rootScope.currentUser = null; }); return authServiceObject; });
Yuncms ============== Yuncms > protected/apps/default/view/ - config 'TPL' => array ( 'TPL_TEMPLATE_PATH' => 'default', '<API key>' => 'default', ), /* 1.PC 2.core.phprun 3. */ ** configtpl - view > viewdefaultinfo.php <?php return array ( 'name' => '91', 'author' => '', ); ?> ***layout*** > Layoutheader,footerlayout - layout >{include file="$__template_file"} >__template_filecontroller.php - layout? > commonController.php protected $layout = 'layout'; //layout - > layoutheader.php footer.php > {include file="header"} > {include file="footer"} >header,header.php {include file="/header"} Yuncms`` //base/extend/function.phpgetlist $this->view()->addTags(array( "/{(\S+):{(.*)}}/i"=>"<?php $$1=getlist(\"$2\"); $$1_i=0; if(!empty($$1)) foreach($$1 as $$1){ $$1_i++; ?> ", "/{\/([a-zA-Z_]+)}/i"=> "<?php } ?>", "/\[([a-zA-Z_]+)\:\i\]/i"=>"<?php echo \$$1_i ?>", "/\#\[([a-zA-Z_]+)\:([a-zA-Z_]+)\]\#/i"=>'".\$$1[\'$2\']."', "/\#\[([a-zA-Z_]+)\:([a-zA-Z_]+)\]\#/i"=> '".\$$1[\'$2\']."', "/\#\\$(\S+)\#/i"=>'".$$1."', "/\[([a-zA-Z_]+)\:([a-zA-Z_]+)\]/i"=>"<?php echo \$$1['$2'] ?>", "/\[([a-zA-Z_]+)\:([a-zA-Z_]+) \\\$len\=([0-9]+)\]/i"=>"<?php echo msubstr(\$$1['$2'],0,$3); ?>", "/\[([a-zA-Z_]+)\:([a-zA-Z_]+) \\\$elen\=([0-9]+)\]/i"=>"<?php echo substr(\$$1['$2'],0,$3); ?>", "/{piece:([a-zA-Z_]+)}/i"=> "<?php \$cpTemplate->display(model('fragment')->fragment($1),false,false); ?>" ),true); base/extend/function.php`` >getlist + *js*phpd? > > phpjsonjs > phphtmljs - .php >.php.html - `<?php if(!defined('APP_NAME')) exit;?>` - > `$this->result=$result;` > $result** > `$this->display();` - js,css //css <link href="__PUBLICAPP__/css/back.css" type=text/css rel=stylesheet> <script type="text/javascript" src="__PUBLIC__/js/jquery.js"></script> //publicappcss,js,public - , `{include file=""}` ** Yuncms config {$name}$name {CONSTANCE}:CONSTANCE PHPUnix1970 1 1 00:00:00 {date($t,Y-m-d H:i:s)} $t Y-m-d H:i:s -- ::1985-11-15 12:00:00 {date(Y-m-d H:i:s)} : Y-m-d H:i:s -- ::2013-4-1 12:00:00 #PHP php<?php ?>{php } {12....} url() URL{url('default/index/index')} ID100001URL{url('default/news/content',array('id'=>100001))} #if {if 1} .. {elseif 2} .. {else} . {/if} news_content.php {if !empty($upnews)} <a href="{url($upnews['method'],array('id'=>$upnews['id']))}">{$upnews['title']}</a> {else} .... {/if} '' # for {for } .. {/for} : {for $i=0;$i<3;$i++} {$i}<br> {/for} 0 1 2 #loop loop loopphpforeach {loop } .. {/loop} $arr=array(''=>'20',''=>'24',''=>'28') ; loop {loop $arr $key $vo} {$key}{$vo} <br> {/loop} 20 24 28 example: $list= model('member_tag')->select("mid='{$id}'",'id,name','id asc'); $this->mytag=$list; {loop $mytag $key $vo} <a value="{$vo['id']}" title="{$vo['name']}" href="javascript:void(0);"><span>{$vo['name']}</span><em></em> </a> {/loop} {:{table=() field() where=() limit=() order=()}} {/} example: <span class="margin"></span> {link:{table=(link) field=(name,url,type,picture,logourl) order=(norder desc,id desc) where=(ispass='1')}} {if $link['type']==1} <a href="[link:url]" target="_blank">[link:name]</a> {elseif $link['type']==2} <a href="[link:url]" target="_blank"><img src="[link:picturepath]" alt="[link:name]"></a> {/if} {/link} ID1000013 {news:{table=(news) field=(title,color,addtime) order= (recmd DESC,norder desc,id desc)where=(ispass='1'AND like '%100001%') limit=(3)}} [news:i] - [news:color] - [news:title] - 3[news:title $len=3] - [news:addtime] <br> {/news} {:{table=(news) field=() place=(ID) column=(ID) where=() order=() limit=()}} {/} /* 1.column ID 2.place ID 3. */ example: {news:{table=(news) field=(id,title,color,addtime,method,picture,description) column=(100001) order=(norder desc,id desc) where=(ispass='1') limit=(8)}} <a style="color:[news:color]" title="[news:title]" target="_blank" href="[news:url]">[news:title $len=16]</a><span>{date($news['addtime'],Y-m-d)}</span> {$NewImgPath}[news:picture] 1.1.8 {$NewImgPath}thumb_[news:picture] (1.1.8) [:picturepath] [news:title $len=16]"$len=16" {msubstr($news['title'], 0, 16)} [news:title $elen=16]"$elen=16" {substr($news['title'], 0, 16)} {date($news['addtime'],Y-m-d H:i:s)} Y-m-d H:i:s -- ::1985-11-15 12:00:00 {date($news['addtime'],Y-m-d)} Y-m-d --1985-11-15 $news_i 12345678 {/news} 8ID"100001"IDID
var Dungeon = { map: [], in_battle: 0, player_position: 0 }; Dungeon.mapGenerator = function () { this.map = []; this.player_position = 0; for (var i = 0; i < 100; i++) { if (rand(0, 5) != 0) { this.map[i] = {symbol: '_', unit: null}; } else { this.map[i] = {symbol: '~', unit: null}; } } this.map[0].special = 'enter'; this.map[99].special = 'exit'; }; Dungeon.<API key> = function () { if (this.in_battle) { return this.getMapString(); } else { return this.getMenuString(); } }; Dungeon.getMapString = function () { var map_string = ''; var visible_area = this.getVisibleArea(); visible_area.forEach(function (place, id) { map_string += Dungeon.getPlaceString(id); }); return map_string; }; Dungeon.getVisibleArea = function () { var shift = (this.player_position > 5) ? this.player_position - 5 : 0; var visible_area = []; this.map.forEach(function (place, id) { if (id >= shift && id < shift + 20) { visible_area[id] = place; } }); return visible_area; // this.map.slice(shift, shift + 20); }; Dungeon.getPlaceString = function (id) { var place = this.map[id]; if (place.unit) { return place.unit.symbol; } if (place.special == 'enter') { return '0'; } if (place.special == 'exit') { return 'O'; } return place.symbol; }; Dungeon.getMenuString = function () { return '<button onclick="Dungeon.go();">Go to dungeon</button>'; }; Dungeon.go = function () { if (Player.action_points < 1) { message("Not enough action points."); return false; } Player.action_points this.mapGenerator(); this.map[0].unit = Player.unit; this.in_battle = 1; }; Dungeon.tick = function () { if (this.in_battle == 0) { return false; } else { var visible_area = this.getVisibleArea(); var units = []; visible_area.forEach(function (place ,id) { units[id] = place.unit; }); units.forEach(function (unit, id) { if (!unit) return false; //console.log(unit); unit.AI(id); }); } }; Dungeon.unitMove = function (from_id, to_id) { var unit = this.map[from_id].unit; if (unit == Player.unit) this.player_position = to_id; this.map[to_id].unit = unit; this.map[from_id].unit = null; }; Dungeon.exit = function () { this.in_battle = 0; Player.knowledge++; };
<?php namespace Bundle\AdminBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\HttpFoundation\File\UploadedFile; /*for image resize and upload*/ use Gregwar\Image\Image; /*for image resize and upload*/ /** * <API key> * * @ORM\Table(name="<API key>", indexes={@ORM\Index(name="<API key>", columns={"<API key>"})}) * @ORM\Entity * @ORM\<API key> */ class <API key> { /** * @var integer * * @ORM\Column(name="profile_id", type="bigint") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $profileId; /** * @var boolean * * @ORM\Column(name="profile_status", type="boolean", nullable=true) */ private $profileStatus; /** * @var boolean * * @ORM\Column(name="<API key>", type="boolean", nullable=true) */ private $<API key>; /** * @var boolean * * @ORM\Column(name="<API key>", type="boolean", nullable=true) */ private $<API key>; /** * @var string * * @ORM\Column(name="profile_msg", type="string", length=255, nullable=true) */ private $profileMsg; /** * @var string * * @ORM\Column(name="profile_about_me", type="text", nullable=true) */ private $profileAboutMe; /** * @var string * * @ORM\Column(name="<API key>", type="string", length=255, nullable=true) */ private $path; /** * @Assert\File( * maxSizeMessage = "Profile image must be less than 5mb.", * maxSize = "5000k", * mimeTypes = {"image/jpg", "image/jpeg", "image/gif", "image/png"}, * mimeTypesMessage = "Profile image format must be of types JPG, GIF,jpeg." * ) */ private $file; private $temp; /** * @var string * * @ORM\Column(name="profile_website", type="string", length=255, nullable=true) */ private $profileWebsite; /** * @var string * * @ORM\Column(name="profile_facebook", type="string", length=45, nullable=true) */ private $profileFacebook; /** * @var string * * @ORM\Column(name="profile_twitter", type="string", length=45, nullable=true) */ private $profileTwitter; /** * @var string * * @ORM\Column(name="profile_google_plus", type="string", length=45, nullable=true) */ private $profileGooglePlus; /** * @var string * * @ORM\Column(name="profile_youtube", type="string", length=45, nullable=true) */ private $profileYoutube; /** * @var string * * @ORM\Column(name="profile_linkedin", type="string", length=45, nullable=true) */ private $profileLinkedin; /** * @var string * * @ORM\Column(name="<API key>", type="string", length=255, nullable=true) */ private $profileCroppedImage; /** * @var string * * @ORM\Column(name="<API key>", type="string", length=255, nullable=true) */ private $<API key>; /** * @var \DateTime * * @ORM\Column(name="<API key>", type="datetime", nullable=true) */ private $profileDateCreated; /** * @var \DateTime * * @ORM\Column(name="<API key>", type="datetime", nullable=true) */ private $profileDateModified; /** * @var string * * @ORM\Column(name="profile_dob", type="date", nullable=true) */ private $profileDob; /** * @var string * * @ORM\Column(name="<API key>", type="text", nullable=true) */ private $<API key>; /** * @var string * * @ORM\Column(name="<API key>", type="text", nullable=true) */ private $profileVideoResume; /** * @var \Bundle\AdminBundle\Entity\KidskulaUsers * * @ORM\OneToOne(targetEntity="Bundle\AdminBundle\Entity\KidskulaUsers") * @ORM\JoinColumns({ * @ORM\JoinColumn(name="<API key>", <API key>="id", unique=true) * }) */ private $kidskulaUsersUser; /** * @var string * * @ORM\Column(name="visible_to_whom", type="text", nullable=true) */ private $visible_to_whom; /** * @var string * * @ORM\Column(name="networkUpdates", type="string", nullable=true) */ private $networkUpdates; /** * @var boolean * * @ORM\Column(name="NotifictionsShow", type="boolean", nullable=true) */ private $NotifictionsShow; /** * @var boolean * * @ORM\Column(name="tradeVirtualGifts", type="boolean", nullable=true) */ private $tradeVirtualGifts; /** * @var boolean * * @ORM\Column(name="sendMessages", type="boolean", nullable=true) */ private $sendMessages; /** * @var boolean * * @ORM\Column(name="isChat", type="boolean", nullable=true) */ private $isChat; /** * Set profileId * * @param integer $profileId * @return <API key> */ public function setProfileId($profileId) { $this->profileId = $profileId; return $this; } /** * Get profileId * * @return integer */ public function getProfileId() { return $this->profileId; } /** * Set profileStatus * * @param boolean $profileStatus * @return <API key> */ public function setProfileStatus($profileStatus) { $this->profileStatus = $profileStatus; return $this; } /** * Get profileStatus * * @return boolean */ public function getProfileStatus() { return $this->profileStatus; } /** * Set <API key> * * @param boolean $<API key> * @return <API key> */ public function <API key>($<API key>) { $this-><API key> = $<API key>; return $this; } /** * Get <API key> * * @return boolean */ public function <API key>() { return $this-><API key>; } /** * Set <API key> * * @param boolean $<API key> * @return <API key> */ public function <API key>($<API key>) { $this-><API key> = $<API key>; return $this; } /** * Get <API key> * * @return boolean */ public function <API key>() { return $this-><API key>; } /** * Set profileMsg * * @param string $profileMsg * @return <API key> */ public function setProfileMsg($profileMsg) { $this->profileMsg = $profileMsg; return $this; } /** * Get profileMsg * * @return string */ public function getProfileMsg() { return $this->profileMsg; } /** * Set profileAboutMe * * @param string $profileAboutMe * @return <API key> */ public function setProfileAboutMe($profileAboutMe) { $this->profileAboutMe = $profileAboutMe; return $this; } /** * Get profileAboutMe * * @return string */ public function getProfileAboutMe() { return $this->profileAboutMe; } /** * Set profileWebsite * * @param string $profileWebsite * @return <API key> */ public function setProfileWebsite($profileWebsite) { $this->profileWebsite = $profileWebsite; return $this; } /** * Get profileWebsite * * @return string */ public function getProfileWebsite() { return $this->profileWebsite; } /** * Set profileFacebook * * @param string $profileFacebook * @return <API key> */ public function setProfileFacebook($profileFacebook) { $this->profileFacebook = $profileFacebook; return $this; } /** * Get profileFacebook * * @return string */ public function getProfileFacebook() { return $this->profileFacebook; } /** * Set profileTwitter * * @param string $profileTwitter * @return <API key> */ public function setProfileTwitter($profileTwitter) { $this->profileTwitter = $profileTwitter; return $this; } /** * Get profileTwitter * * @return string */ public function getProfileTwitter() { return $this->profileTwitter; } /** * Set profileGooglePlus * * @param string $profileGooglePlus * @return <API key> */ public function <API key>($profileGooglePlus) { $this->profileGooglePlus = $profileGooglePlus; return $this; } /** * Get profileGooglePlus * * @return string */ public function <API key>() { return $this->profileGooglePlus; } /** * Set profileYoutube * * @param string $profileYoutube * @return <API key> */ public function setProfileYoutube($profileYoutube) { $this->profileYoutube = $profileYoutube; return $this; } /** * Get profileYoutube * * @return string */ public function getProfileYoutube() { return $this->profileYoutube; } /** * Set profileLinkedin * * @param string $profileLinkedin * @return <API key> */ public function setProfileLinkedin($profileLinkedin) { $this->profileLinkedin = $profileLinkedin; return $this; } /** * Get profileLinkedin * * @return string */ public function getProfileLinkedin() { return $this->profileLinkedin; } /** * Set profileCroppedImage * * @param string $profileCroppedImage * @return <API key> */ public function <API key>($profileCroppedImage) { $this->profileCroppedImage = $profileCroppedImage; return $this; } /** * Get profileCroppedImage * * @return string */ public function <API key>() { return $this->profileCroppedImage; } /** * Set <API key> * * @param string $<API key> * @return <API key> */ public function <API key>($<API key>) { $this-><API key> = $<API key>; return $this; } /** * Get <API key> * * @return string */ public function <API key>() { return $this-><API key>; } /** * Set profileDateCreated * * @param \DateTime $profileDateCreated * @return <API key> */ public function <API key>($profileDateCreated) { $this->profileDateCreated = $profileDateCreated; return $this; } /** * Get profileDateCreated * * @return \DateTime */ public function <API key>() { return $this->profileDateCreated; } /** * Set profileDateModified * * @param \DateTime $profileDateModified * @return <API key> */ public function <API key>($profileDateModified) { $this->profileDateModified = $profileDateModified; return $this; } /** * Get profileDateModified * * @return \DateTime */ public function <API key>() { return $this->profileDateModified; } public function setProfileDob($profileDob) { $this->profileDob = $profileDob; return $this; } public function getProfileDob() { return $this->profileDob; } /** * Set <API key> * * @param string $<API key> * @return <API key> */ public function <API key>($<API key>) { $this-><API key> = $<API key>; return $this; } /** * Get <API key> * * @return string */ public function <API key>() { return $this-><API key>; } /** * Set profileVideoResume * * @param string $profileVideoResume * @return <API key> */ public function <API key>($profileVideoResume) { $this->profileVideoResume = $profileVideoResume; return $this; } /** * Get profileVideoResume * * @return string */ public function <API key>() { return $this->profileVideoResume; } /** * Set kidskulaUsersUser * * @param \Bundle\AdminBundle\Entity\KidskulaUsers $kidskulaUsersUser * @return <API key> */ public function <API key>(\Bundle\AdminBundle\Entity\KidskulaUsers $kidskulaUsersUser = null) { $this->kidskulaUsersUser = $kidskulaUsersUser; return $this; } /** * Get kidskulaUsersUser * * @return \Bundle\AdminBundle\Entity\KidskulaUsers */ public function <API key>() { return $this->kidskulaUsersUser; } public function getVisibletowhom() { return $this->visible_to_whom; } public function getNetworkUpdates() { return $this->networkUpdates; } public function getNotifictionsShow() { return $this->NotifictionsShow; } public function <API key>() { return $this->tradeVirtualGifts; } public function getSendMessages() { return $this->sendMessages; } public function getIsChat() { return $this->isChat; } public function setVisibletowhom($visible_to_whom) { $this->visible_to_whom = $visible_to_whom; } public function setNetworkUpdates($networkUpdates) { $this->networkUpdates = $networkUpdates; } public function setNotifictionsShow($NotifictionsShow) { $this->NotifictionsShow = $NotifictionsShow; } public function <API key>($tradeVirtualGifts) { $this->tradeVirtualGifts = $tradeVirtualGifts; } public function setSendMessages($sendMessages) { $this->sendMessages = $sendMessages; } public function setIsChat($isChat) { $this->isChat = $isChat; } public function setPath($path) { $this->path = $path; return $this; } public function setTemp($temp) { $this->temp = $temp; return $this; } public function getPath() { return $this->path; } public function getTemp() { return $this->temp; } /** * Sets file. * * @param UploadedFile $file */ public function setFile(UploadedFile $file = null) { $this->file = $file; $obj = is_object($file); // check if we have an old image path if (isset($this->path) && $obj == true) { // store the old name to delete after the update $this->temp = $this->path; $this->path = null; } elseif (isset($this->path)) { $this->file = $file; } else { $this->path = 'initial'; } } /** * Get image * * @return string */ public function getFile() { return $this->file; } protected function getUploadRootDir() { // the absolute directory path where uploaded // documents should be saved //return __DIR__ . '/../../../../web/' . $this->getUploadDir(); return __DIR__ .$this->getRootDir(). $this->getUploadDir(); } public function getUploadDir() { // get rid of the __DIR__ so it doesn't screw up // when displaying uploaded doc/image in the view. // return 'upload/profilepicture'; return $this->getUploadImagePath(). $this->getProfileImagePath(); } private $rootDir; public function setRootDir($rootDir) { $this->rootDir = $rootDir; return $this; } public function getRootDir() { return $this->rootDir; } private $uploadImagePath; public function setUploadImagePath($uploadImagePath) { $this->uploadImagePath = $uploadImagePath; return $this; } public function getUploadImagePath() { return $this->uploadImagePath; } private $profileImagePath; public function setProfileImagePath($profileImagePath) { $this->profileImagePath = $profileImagePath; return $this; } public function getProfileImagePath() { return $this->profileImagePath; } private $<API key>; public function <API key>($<API key>) { $this-><API key> = $<API key>; return $this; } public function <API key>() { return $this-><API key>; } private $<API key>; public function <API key>($<API key>) { $this-><API key> = $<API key>; return $this; } public function <API key>() { return $this-><API key>; } /** * @ORM\PrePersist() * @ORM\PreUpdate() */ public function preUpload() { $file = $this->getFile(); $obj = is_object($file); if (null !== $this->getFile() && $obj == true) { // do whatever you want to generate a unique name $filename = sha1(uniqid(mt_rand(), true)); $this->path = $filename . '.' . $this->getFile()->guessExtension(); } } /** * @ORM\PostPersist() * @ORM\PostUpdate() */ public function upload() { $file = $this->getFile(); $obj = is_object($file); if (null != $this->getFile() && $obj == true) { // if there is an error when moving the file, an exception will // be automatically thrown by move(). This will properly prevent // the entity from being persisted to the database on error $this->getFile()->move($this->getUploadRootDir(), $this->path); $path=$this->getAbsolutePath(); $absoluteurl=$this->getUploadRootDir(); $imagename=$this->getPath(); // Image::open($path)->forceResize(384,512 ,583)->save($absoluteurl.'/resizedimages/'.$imagename); Image::open($path)->forceResize(384,512 ,583)->save($absoluteurl.$this-><API key>().$imagename); //Image::open($path)->crop(384,512 ,24,40)->save($absoluteurl.'/resizedimages/'.$imagename); // check if we have an old image if (isset($this->temp)) { // delete the old image /*@unlink($this->getUploadRootDir() . '/' . $this->temp); @unlink($this->getUploadRootDir() . '/resizedimages/' . $this->temp); @unlink($this->getUploadRootDir() . '/cropedimages/' . $this->temp);*/ @unlink($this->getUploadRootDir() . $this->temp); @unlink($this->getUploadRootDir() . $this-><API key>() . $this->temp); @unlink($this->getUploadRootDir() . $this-><API key>() . $this->temp); // clear the temp image path $this->temp = null; } $this->file = null; } } /** * @ORM\PostRemove() */ public function removeUpload() { if ($file = $this->getAbsolutePath()) { @unlink($file); } } public function getAbsolutePath() { return null === $this->path ? null : $this->getUploadRootDir() . $this->path; } public function cropUpload($image_name) { $path=$this->getAbsolutePath(); $absoluteurl=$this->getUploadRootDir(); $imagename=$image_name['image_name']; $x_axix = $image_name['x']; $y_axix = $image_name['y']; $width = $image_name['w']; $height = $image_name['h']; //Image::open($path)->crop(384,512 ,24,40)->save($absoluteurl.'/cropedimages/'.$imagename); //Image::open($absoluteurl.'/resizedimages/'.$imagename)->crop($x_axix,$y_axix,$width,$height)->save($absoluteurl.'/cropedimages/'.$imagename); Image::open($absoluteurl. '/' .$this-><API key>().$imagename)->crop($x_axix,$y_axix,$width,$height)->save($absoluteurl. '/' .$this-><API key>().$imagename); $this->file = null; } }
import { createSelector } from 'reselect'; /** * Direct selector to the billsTab state domain */ const <API key> = (state) => state.get('billsTab'); /** * Other specific selectors */ const makeSelectLoading = () => createSelector( <API key>, (pageState) => pageState.get('loading') ); const makeSelectError = () => createSelector( <API key>, (pageState) => pageState.get('error') ); const makeSelectBills = () => createSelector( <API key>, (pageState) => pageState.get('bills').toJS() ); /** * Default selector used by BillsTab */ const makeSelectBillsTab = () => createSelector( <API key>, (substate) => substate.toJS() ); export default makeSelectBillsTab; export { <API key>, makeSelectLoading, makeSelectError, makeSelectBills, };
require "spec_helper" require "vimrunner/server" require "vimrunner/platform" module Vimrunner RSpec.describe Server do let(:server) { Server.new } describe "#initialize" do it "defaults to using Platform.vim for the executable" do expect(server.executable).to eq(Platform.vim) end it "defaults to a random name" do expect(server.name).to start_with("VIMRUNNER") end it "ensures that its server name is uppercase" do server = Vimrunner::Server.new(:name => "foo") expect(server.name).to eq("FOO") end end describe "#start" do it "starts a vim server process" do begin server.start expect(server.serverlist).to include(server.name) ensure server.kill expect(server.serverlist).to_not include(server.name) end end it "can start more than one vim server process" do begin first = Server.new second = Server.new first.start second.start expect(first.serverlist).to include(first.name, second.name) ensure first.kill second.kill end end it "can start a vim server process with a block" do server.start do |client| expect(server.serverlist).to include(server.name) end expect(server.serverlist).to_not include(server.name) end end describe "connecting to an existing server" do before(:each) do server.start end let(:second_server) { Server.new(:name => server.name) } it "returns a client" do expect(second_server.connect).to be_a(Client) expect(second_server.connect!).to be_a(Client) end it "returns a client connected to the named server" do expect(second_server.connect.server).to eq(second_server) expect(second_server.connect!.server).to eq(second_server) end describe "#connect" do it "returns nil if no server is found in :timeout seconds" do server = Server.new(:name => 'NONEXISTENT') expect(server.connect(:timeout => 0.1)).to be_nil end end describe "#connect!" do it "raises an error if no server is found in :timeout seconds" do server = Server.new(:name => 'NONEXISTENT') expect { server.connect!(:timeout => 0.1) }.to raise_error(TimeoutError) end end end describe "#running?" do it "returns true if the server started successfully" do server.start expect(server).to be_running end it "returns true if the given name corresponds to a running Vim instance" do server.start other_server = Server.new(:name => server.name) expect(other_server).to be_running end end describe "#new_client" do it "returns a client" do expect(server.new_client).to be_a(Client) end it "is attached to the server" do expect(server.new_client.server).to eq(server) end end describe "#remote_expr" do it "uses the server's executable to send remote expressions" do expect(server).to receive(:execute). with([server.executable, "--servername", server.name, "--remote-expr", "version"]) server.remote_expr("version") end it "fails with a ExecutionError if the executable writes anything to stderr" do expect(server).to receive(:name).and_return('WRONG_NAME') expect { server.remote_expr("version") }.to raise_error(ExecutionError, /E247:/) end end describe "#remote_send" do it "uses the server's executable to send remote keys" do expect(server).to receive(:execute). with([server.executable, "--servername", server.name, "--remote-send", "ihello"]) server.remote_send("ihello") end it "fails with a ExecutionError if the executable writes anything to stderr" do expect(server).to receive(:name).and_return('WRONG_NAME') expect { server.remote_send("ihello") }.to raise_error(ExecutionError, /E247:/) end end describe "#serverlist" do it "uses the server's executable to list servers" do expect(server).to receive(:execute). with([server.executable, "--serverlist"]).and_return("VIM") server.serverlist end it "splits the servers into an array" do allow(server).to receive(:execute).and_return("VIM\nVIM2") expect(server.serverlist).to eq(["VIM", "VIM2"]) end end describe "pid" do it "returns the pid of the server" do server.start expect(server.pid).not_to be(nil) end end end end
FindYourMakeUp =========== MVC Application which will allow users to vote and leave comment for different make ups. This will help the selection of the appropriate product.
package voli_Es29; import java.util.ArrayList; public class Volo { static int idNumero=1; static char idChar='A'; String id=""; String destinazione, partenza; int postiDispE; int postiDispP; ArrayList<Passeggero> passeggeri; public Volo(String destinazione, String partenza, int postiDispE, int postiDispP) { this.destinazione = destinazione; this.partenza = partenza; this.postiDispE = postiDispE; this.postiDispP = postiDispP; passeggeri = new ArrayList<>(); //id=String.valueOf(counter); //counter++; id = idNumero+":"+idChar; if (idChar=='Z') { idChar='A'; idNumero++; }else idChar++; } void aggiungiPasseggero(Passeggero p) { if (p.getClasse() == 'E' && postiDispE > 0) { passeggeri.add(p); postiDispE } else if (p.getClasse() == 'P' && postiDispP > 0) { passeggeri.add(p); postiDispP } else System.out.println("Non ci sono più posti in classe " + p.getClasse()); } int indicePasseggero(int id) { for (int i=0; i<passeggeri.size(); i++) if (id==passeggeri.get(i).getIdBiglietto()) return i; return -1; } void rimuoviPasseggero(int idBiglietto) { for (int i=0; i<passeggeri.size(); i++) { int indice=indicePasseggero(idBiglietto); if (indice!=-1) { if (passeggeri.get(indice).getClasse()=='E') postiDispE++; else if (passeggeri.get(indice).getClasse()=='P') postiDispP++; passeggeri.remove(indice); }else System.out.println("Passeggero non trovato"); } } double incassoVolo() { double tot=0; for (int i=0; i<passeggeri.size(); i++) tot+=passeggeri.get(i).getPrezzoBiglietto(); return tot; } void stampaPasseggeri() { for (Passeggero p: passeggeri) System.out.println(p.toString()); } @Override public String toString() { return id + " " + destinazione + " " + partenza + " disp E " + postiDispE + " disp P " + postiDispP; } }
namespace Oragon.Architecture.Text { public abstract class FormatStrategy { #region Public Fields public static FormatStrategy None = new NoneFormatStrategy(); #endregion Public Fields #region Protected Fields protected char[] splitter = new char[] { ' ', '\t' }; #endregion Protected Fields #region Public Methods public abstract string Format(string original); #endregion Public Methods } public class NoneFormatStrategy : FormatStrategy { #region Public Methods public override string Format(string original) { return original; } #endregion Public Methods } }
package softuni.dto.binding.XMLDtos; import softuni.dto.binding.Import.SupplierImportDto; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import java.util.List; @XmlRootElement(name="suppliers") @XmlAccessorType(XmlAccessType.FIELD) public class <API key> { @XmlElement(name = "supplier") private List<SupplierImportDto> supplierImportDtos; public <API key>() { } public List<SupplierImportDto> <API key>() { return supplierImportDtos; } public void <API key>(List<SupplierImportDto> supplierImportDtos) { this.supplierImportDtos = supplierImportDtos; } }
USE [ANTERO] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER VIEW [dw].[<API key>] AS SELECT [Tilastovuosi] = f.[tilastovuosi] ,[Tilastokuukausi] = d6.kuukausi_fi ,[Sukupuoli] = d11.sukupuoli_fi ,[Äidinkieli] = d12.kieliryhma1_fi ,[Ikäryhmä] = d13.ikaryhma3_fi ,[Ikä] = d13.ika_fi ,[Tutkinto] = d2.koulutusluokitus_fi ,[Koulutusala, taso 1] = d2.koulutusalataso1_fi ,[Koulutusala, taso 2] = d2.koulutusalataso2_fi ,[Koulutusala, taso 3] = d2.koulutusalataso3_fi ,[Tutkintotyyppi] = d2.tutkintotyyppi_fi ,[Rahoitusmuoto] = d5.selite_fi ,[Kustannusryhmä] = d7.selite_fi ,[Oppisopimuskoulutus] = d4.selite_fi ,[Erityisopetus] = d3.<API key> ,[Suorituksen tyyppi] = d8.selite_fi ,[Hankintakoulutus] = d14.kytkin_fi ,[Hankintakoulutuksen järjestäjä] = d15.organisaatio_fi ,[Koulutuksen järjestäjä] = d1a.organisaatio_fi ,[Koulutuksen järjestäjän AVI] = d10a.avi_fi ,[Koulutuksen järjestäjän ELY] = d10a.ely_fi ,[Koulutuksen järjestäjän maakunta] = d10a.maakunta_fi ,[Koulutuksen järjestäjän kunta] = d10a.kunta_fi ,[Oppilaitos] = d1b.organisaatio_fi ,[Oppilaitoksen AVI] = d10b.avi_fi ,[Oppilaitoksen ELY] = d10b.ely_fi ,[Oppilaitoksen maakunta] = d10b.maakunta_fi ,[Oppilaitoksen kunta] = d10b.kunta_fi ,[Toimipiste] = d1c.organisaatio_fi ,[Toimipisteen AVI] = d10c.avi_fi ,[Toimipisteen ELY] = d10c.ely_fi ,[Toimipisteen maakunta] = d10c.maakunta_fi ,[Toimipisteen kunta] = d10c.kunta_fi ,[Luvaton koulutus] = d23.selite_fi ,[Luvaton korotustekijä] = d25.selite_fi ,[Koodit Koulutuksen järjestäjä] = d1a.organisaatio_koodi ,[Koodit Hankintakoulutuksen järjestäjä] = d15.organisaatio_koodi ,[Koodit Tutkinto] = d2.<API key> ,[Koodit Tutkintotyyppi] = d2.<API key> ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] ,[<API key>] --leikkuri (120 osaamispistettä varainhoitovuoden tavoitteellista opiskelijavuotta kohti) ,[leikkauskerroin] = CASE WHEN os_pisteet_summa.osaamispisteet_sum > 120.0 * sa1.<API key> THEN (120.0 * sa1.<API key>) / os_pisteet_summa.osaamispisteet_sum ELSE 1.0 END ,[tavoitteelliset_opv] = sa1.<API key> ,[<API key>] = d5.<API key> ,[<API key>] = case when d23.koodi=1 /*and d25.koodi=1*/ then 1 else 0 end --järjestykset ,[jarj Tilastokuukausi] = d6.kuukausi ,[jarj Sukupuoli] = d11.<API key> ,[jarj Äidinkieli] = d12.<API key> ,[jarj Ikäryhmä] = d13.jarjestys_ikaryhma3 ,[jarj Ikä] = d13.jarjestys_ika ,[jarj Koulutusala, taso 1] = d2.<API key> ,[jarj Koulutusala, taso 2] = d2.<API key> ,[jarj Koulutusala, taso 3] = d2.<API key> ,[jarj Tutkintotyyppi] = d2.<API key> ,[jarj Rahoitusmuoto] = d5.jarjestys_koodi ,[jarj Kustannusryhmä] = d7.jarjestys_koodi ,[jarj Oppisopimuskoulutus] = d4.jarjestys ,[jarj Erityisopetus] = d3.<API key> ,[jarj Suorituksen tyyppi] = d8.jarjestys ,[jarj Koulutuksen järjestäjän AVI] = d10a.jarjestys_avi_koodi ,[jarj Koulutuksen järjestäjän ELY] = d10a.jarjestys_ely_koodi ,[jarj Koulutuksen järjestäjän maakunta] = d10a.<API key> ,[jarj Oppilaitoksen AVI] = d10b.jarjestys_avi_koodi ,[jarj Oppilaitoksen ELY] = d10b.jarjestys_ely_koodi ,[jarj Oppilaitoksen maakunta] = d10b.<API key> ,[jarj Toimipisteen AVI] = d10c.jarjestys_avi_koodi ,[jarj Toimipisteen ELY] = d10c.jarjestys_ely_koodi ,[jarj Toimipisteen maakunta] = d10c.<API key> ,<API key> = d23.jarjestys ,<API key> = d25.jarjestys FROM dw.<API key> f LEFT JOIN dw.<API key> d1a on d1a.id = f.<API key> LEFT JOIN dw.<API key> d1b on d1b.id = f.<API key> LEFT JOIN dw.<API key> d1c on d1c.id = f.<API key> LEFT JOIN dw.d_koulutusluokitus d2 on d2.id = f.<API key> LEFT JOIN dw.d_erityisopetus d3 on d3.id = f.d_erityisopetus_id LEFT JOIN dw.<API key> d4 on d4.id = f.<API key> LEFT JOIN dw.d_opintojenrahoitus d5 on d5.id = f.<API key> LEFT JOIN dw.d_kalenteri d6 on d6.id = f.d_kalenteri_id LEFT JOIN dw.<API key> d7 on d7.id = f.d_kustannusryhma_id LEFT JOIN dw.<API key> d8 on d8.id = f.<API key> LEFT JOIN dw.<API key> d9 on d9.id = f.<API key> LEFT JOIN dw.d_alueluokitus d10a on d10a.alueluokitus_avain = 'kunta_'+d1a.kunta_koodi LEFT JOIN dw.d_alueluokitus d10b on d10b.alueluokitus_avain = 'kunta_'+d1b.kunta_koodi LEFT JOIN dw.d_alueluokitus d10c on d10c.alueluokitus_avain = 'kunta_'+d1c.kunta_koodi LEFT JOIN dw.d_sukupuoli d11 on d11.id = f.d_sukupuoli_id LEFT JOIN dw.d_kieli d12 on d12.id = f.<API key> LEFT JOIN dw.d_ika d13 on d13.id = f.d_ika_id LEFT JOIN dw.d_kytkin d14 on d14.id = f.<API key> LEFT JOIN dw.<API key> d15 on d15.id = f.<API key> LEFT JOIN dw.<API key> d23 ON d23.id = f.<API key> LEFT JOIN dw.<API key> d25 ON d25.id = f.<API key> --tavoitteelliset opiskelijavuodet (fuusiot huomioiden) LEFT JOIN ( SELECT ytunnus = coalesce(d.ytunnus_amos_spl, sa.ytunnus) ,vuosi ,<API key> = SUM(<API key>) FROM sa.<API key> sa LEFT JOIN dw.<API key> d on d.ytunnus_avain = sa.ytunnus GROUP BY coalesce(d.ytunnus_amos_spl, sa.ytunnus),vuosi ) sa1 on sa1.ytunnus = d1a.organisaatio_koodi and sa1.vuosi = f.tilastovuosi --tutkinnon osien osaamispisteiden leikkuria varten lasketaan rahoituksessa huomioitavien luvallisten osaamispisteiden summa per järjestäjä per vuosi LEFT JOIN ( SELECT f.tilastovuosi ,organisaatio_koodi = d1.ytunnus_amos_spl ,osaamispisteet_sum = sum(f.<API key>) FROM dw.<API key> f JOIN dw.<API key> d1 on d1.id = f.<API key> JOIN dw.d_opintojenrahoitus d2 on d2.id = f.<API key> JOIN dw.<API key> d3 on d3.id = f.<API key> WHERE d2.<API key> = 1 and d3.koodi = 1 GROUP BY f.tilastovuosi, d1.ytunnus_amos_spl ) os_pisteet_summa on os_pisteet_summa.organisaatio_koodi = d9.ytunnus_amos_spl AND os_pisteet_summa.tilastovuosi = f.tilastovuosi
const vm = require('vm'); const iconv = require('iconv-lite'); const GLOBAL_VARS = [ 'process', 'Buffer', 'clearImmediate', 'clearInterval', 'clearTimeout', 'setImmediate', 'setInterval', 'setTimeout', 'console', 'module', 'require', ]; /* eslint-disable no-console */ const TIMEOUT = 600; const RULE_VALUE_RE = /^([\w\-.]+)(?:\((.+)\))?.*$/; const scripts = {}; const VM_OPTIONS = { displayErrors: false, timeout: TIMEOUT, }; let CONTEXT = vm.createContext(); setInterval(() => { CONTEXT = vm.createContext(); }, 30000); const getScript = (code, name) => { code = code && code.trim(); if (!code) { return; } code = `const d = require('domain').create(); d.on('error', console.error); d.run(() => { ${code} });`; try { return new vm.Script(`(function(){\n${code}\n})()`, { filename: name, timeout: TIMEOUT }); } catch (err) { console.error(err); } }; const execScript = (script, value) => { if (!script) { return {}; } GLOBAL_VARS.forEach((key) => { CONTEXT[key] = global[key]; }); CONTEXT.require = require; CONTEXT.iconv = iconv; CONTEXT.process = { args: value ? value.split(',') : [], }; CONTEXT.exports = {}; CONTEXT.module = { exports: CONTEXT.exports }; try { script.runInContext(CONTEXT, VM_OPTIONS); return CONTEXT.module.exports || {}; } catch (err) { console.error(err); } finally { Object.keys(CONTEXT).forEach((key) => { if (GLOBAL_VARS.indexOf(key) === -1) { delete CONTEXT[key]; } }); } return {}; }; const parseRuleValue = (ctx) => { const { ruleValue } = ctx.req.originalReq; if (!RULE_VALUE_RE.test(ruleValue)) { return ''; } return { name: RegExp.$1, value: RegExp.$2, }; }; exports.get = (name) => { return scripts[name]; }; exports.getHandler = (ctx) => { const { name, value } = parseRuleValue(ctx); return execScript(scripts[name], value); }; const set = (name, text) => { scripts[name] = typeof text === 'string' ? getScript(text) : text; }; exports.set = set; exports.remove = (name) => { delete scripts[name]; }; exports.load = (storage) => { storage.getFileList().forEach(({ name, data }) => { set(name, data); }); };
using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Ma420_Assignments.Chapter7; namespace BairstowRunner { class Program { static void Main(string[] args) { Console.Write("Please enter an output file-name for data (note: .csv will be automatically appended): "); string outfileName = Console.ReadLine() + ".csv"; Console.Write("How many problems to solve? "); using (StreamWriter writer = new StreamWriter(outfileName)){ for(int numtosolve = Convert.ToInt32(Console.ReadLine()); numtosolve > 0; --numtosolve) { Console.Write("Please enter name for problem: "); string name = Console.ReadLine(); Console.Write("Please enter error percentage (example, enter 0.001 for 0.1% allowed error): "); double error = getDouble(); Console.Write("Please enter maximum iterations: "); int iterations = Convert.ToInt32(Console.ReadLine()); Console.Write("Please enter initial s guess: "); double sGuess = getDouble(); Console.Write("Please enter initial r guess: "); double rGuess = getDouble(); Console.Write("Please enter the highest power of x. For example, if the highest power of x in the polynomial is x^5, then please enter 5. "); int numSlots = Convert.ToInt32(Console.ReadLine()) + 1; Console.WriteLine("We will now begin entering the values of the coefficients of the polynomial. To do so, please enter the coefficients for the prompted power of x (where x0 is x^0, x1 is x_1, x2 is x^2, etc)."); double[] polynomial = new double[numSlots]; for (int i = 0; i < numSlots; ++i) { Console.Write("x^" + i + ": "); polynomial[i] = getDouble(); } Console.Write("The polynomial you entered is f(x) = "); Console.Write(polynomial[0]); for (int i = 1; i < numSlots; ++i) { Console.Write(" + " + polynomial[i] + "x^" + i); } Console.Write("\n"); Bairstow b = new Bairstow(polynomial, error, iterations, sGuess, rGuess); Tuple<double, double>[] roots = b.calculateRoots(); List<List<Bairstow.IterationResult>> iterationData = b.getIterationResults(); writer.WriteLine("Problem Name: " + name); writer.WriteLine(); writer.WriteLine(); writer.WriteLine("ROOTS"); writer.WriteLine("REAL Component, COMPLEX Component"); for(int i = 0; i < roots.Length; ++i) { writer.WriteLine(roots[i].Item1 + "," + roots[i].Item2); } if (iterationData[0].Count > 0) { writer.WriteLine(); writer.WriteLine(); writer.WriteLine("ITERATION RESULTS"); writer.WriteLine("S,R,DELTA-S,DELTA-R,ERROR-S,ERROR-R"); writer.WriteLine(); for (int i = 0; i < iterationData.Count(); ++i) { List<Bairstow.IterationResult> currentSet = iterationData[i]; if (currentSet.Count == 0) continue; writer.WriteLine("ITERATION SET for (int j = 0; j < currentSet.Count; ++j) { Bairstow.IterationResult current = currentSet[j]; writer.WriteLine(current.iterS + "," + current.iterR + "," + current.deltaS + "," + current.deltaR + "," + current.iterSError + "," + current.iterRError); } writer.WriteLine(); } } writer.WriteLine("\n\n"); } } int bob = 2; } static double getDouble() { bool good = false; double value = 0; do { string valueString = Console.ReadLine(); try { value = Convert.ToDouble(valueString); good = true; } catch (FormatException e) { Console.WriteLine("Error: " + valueString + " is not a valid number. Please enter a valid number."); } } while (!good); return value; } } }
describe('wcUnique directive specs', function () { var scope, modelCtrl, modelValue, customerSvcMock, form, element, input, compiledForm, changeInputValueTo, passPromise; function setEmailId(value) { scope.customer.email = value; scope.$digest(); } beforeEach(function () { module('customersApp') }); beforeEach(function () { inject(function ($compile, $rootScope, $q, customersService) { scope = $rootScope.$new(); input = angular.element('<input type="text" name="email" class="form-control" data-ng-model="customer.email" ' + '<API key>="{ updateOn: \'blur\' }" ' + 'data-wc-unique data-wc-unique-key="{{customer.id}}" <API key>="email" ' + 'data-ng-minlength="3" required />'); element = angular.element('<form name="editForm"></form>'); element.append(input); scope.customer = {}; compiledForm = $compile(element)(scope); scope.$digest(); modelCtrl = scope.editForm.email; form = scope.editForm; passPromise = true; customerSvcMock = customersService; spyOn(customerSvcMock, "checkUniqueValue").andCallFake(function (id, property, value) { if (passPromise) { if (value === "someone@gmail.com") { return $q.when(true); } else { return $q.when(false); } } else { return $q.reject(); } }); changeInputValueTo = function (el, value) { el.val(value); el.triggerHandler('blur'); $rootScope.$digest(); }; }); }); it('Should be invalid initially due to minlength', function () { expect(form.email.$valid).toBe(false); }); it('Should call checkUniqueValue when value is entered in the input field', function () { scope.$evalAsync(function () { changeInputValueTo(compiledForm.find('input'), "abc@def.com"); expect(customerSvcMock.checkUniqueValue).toHaveBeenCalled(); }); }); it('Unique validator should be invalid if the email ID is abc@def.com', function () { scope.$evalAsync(function () { changeInputValueTo(compiledForm.find('input'), "abc@def.com"); expect(form.email.$valid).toBe(false); expect(form.email.$error.unique).toBe(true); }); }); it('Unique validator should be valid if the email ID is someone@gmail.com', function () { scope.$evalAsync(function () { changeInputValueTo(compiledForm.find('input'), "someone@gmail.com"); expect(form.email.$error.unique).toBe(false); }); }); it('Unique validator should be valid if the server fails to respond', function () { scope.$evalAsync(function () { passPromise = false; changeInputValueTo(compiledForm.find('input'), "someone@gmail.com"); expect(form.email.$error.unique).toBe(false); }); }); });
import * as request from 'request-promise' class DAO { private headers; private path; constructor() { this.headers = {}; this.path = "http://localhost:3000"; this.init() } // FACULTIES public getAllFaculties() { return request(`${this.path}/api/v1/faculties/`, this.headers.GET) .then((res) => res) } public createFaculty(facultyName: string) { const data = JSON.stringify({name: facultyName}); return request(`${this.path}/api/v1/faculties`, { method: 'POST', body: data, headers: { 'Content-Type': 'application/json' } }) .then((response) => response) .catch((err) => { console.log(err) }) } public deleteFaculty(facultyId: number) { return request(`${this.path}/api/v1/faculties/${facultyId}`, { method: 'DELETE', headers: { 'Content-Type': 'application/json' } }) .then((response) => response) .catch((err) => { console.log(err) }) } public updateFaculty(facultyId: number, facultyName: string) { const data = JSON.stringify({name: facultyName}); return request(`${this.path}/api/v1/faculties/${facultyId}`, { method: 'PATCH', body: data, headers: { 'Content-Type': 'application/json' } }) .then((response) => response) .catch((err) => { console.log(err) }) } public getOneFaculty(id: number) { return request(`${this.path}/api/v1/faculties/${id}`, this.headers.GET) .then((result) => { return result }) } // COUNCILS public getAllCouncils(facultyID: number) { return request(`${this.path}/api/v1/councils/${facultyID}`, this.headers.GET) .then((result) => { return result }) } public getOneCouncil(councilId: number) { return request(`${this.path}/api/v1/councils/${councilId}`, this.headers.GET) .then((result) => { return result }) } public getCouncilInstance(instanceId: number) { return request(`${this.path}/api/v1/councilsinst/${instanceId}`, this.headers.GET) .then((result) => { return result }) } public createCouncil(data: any) { data = JSON.stringify(data) return request(`${this.path}/api/v1/councils`, { method: 'POST', body: data, headers: { 'Content-Type': 'application/json' } }) .then((response) => response) .catch((err) => { console.log(err) }) } public <API key>(data: any) { data = JSON.stringify(data) return request(`${this.path}/api/v1/councilsinst`, { method: 'POST', body: data, headers: { 'Content-Type': 'application/json' } }) .then((response) => response) .catch((err) => { console.log(err) }) } public deleteCouncil(councilId: number) { return request(`${this.path}/api/v1/councilinst/${councilId}`, { method: 'DELETE', headers: { 'Content-Type': 'application/json' } }) .then((response) => response) .catch((err) => { console.log(err) }) } public updateCouncil(data: any, councilId: number) { data = JSON.stringify(data) return request(`${this.path}/api/v1/councils/${councilId}`, { method: 'PATCH', body: data, headers: { 'Content-Type': 'application/json' } }) .then((response) => response) .catch((err) => { console.log(err) }) } // CRUD student/representative public getAllStudents() { return request(`${this.path}/api/v1/users/`, this.headers.GET) .then((result) => result ) } public getOneStudent(studentID: number) { return request(`${this.path}/api/v1/users/${studentID}`, this.headers.GET) } // CRUD Employee public getAllStaff() { return request(`${this.path}/api/v1/employees/`, this.headers.GET) .then((result) => result ) } public getOneStaff(staffID: number) { return request(`${this.path}/api/v1/employees/${staffID}`, this.headers.GET) } // VACANT public getAllForSchoolYear() { return request(`/api/v1/applications/test`, this.headers.GET) .then((result) => { return result.json() }) } public init() { // Setup headers. this.headers.GET = { method: 'GET', headers: { 'Content-Type': 'application/json' }, json: true } } } export default new DAO()
using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.Mvc; using monomart; using monomart.Controllers; using monomart.Models; namespace monomart.Tests { [TestFixture()] public class <API key> { [Test()] public void Index() { // Arrange CatalogController controller = new CatalogController(new TestEntites()); // Act ViewResult result = controller.Index("1", 1) as ViewResult; // Assert Assert.AreEqual("Test Brand", result.ViewBag.BrandName); } } }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const images = require("images"); class ImageOperation { constructor(path) { this.image = images(path); } getCutImage(cutParams) { return images(this.image, cutParams.x, cutParams.y, cutParams.width, cutParams.height); } toBase64() { return "data:image/jpg;base64," + this.image.encode('jpg').toString("base64"); } } exports.ImageOperation = ImageOperation;
""" Compiler objects for postgres data definition language. """ from sqlalchemy.sql.expression import Executable, ClauseElement from sqlalchemy.ext.compiler import compiles class CreateTableAs(Executable, ClauseElement): def __init__(self, name, query): self.name = name self.query = query @compiles(CreateTableAs, "postgresql") def _create_table_as(element, compiler, **kw): return "CREATE TABLE %s AS %s" % ( element.name, compiler.process(element.query) )
Gather a group of floating point numbers Sum and average them display the results Input: Multiple floating point numbers. - Using showInputDialog() <API key> for input (999). Calculation: Sum, Average, of the numbers. Output: 1. Count 2. Sum 3. Average 4. Warning if sum > 100 Seperate Methods: 1. BenjaminBunkP2.input() 2. BenjaminBunkP2.sum() 3. BenjaminBunkP2.average() 4. BenjaminBunkP2.displayResults() Notes: 1. Use floating point math. 2. Test plan include: 1. Zero 2. Negative Number 3. Sentinel value 999 4. Call each method from main 5. Use showInputDialog and showMessageDialog methods. Test Data: Input Data, Expected Output, Actual Output, pass/fail results. 2, 2, 3, 3, 999 = 2.5 (Normal) Count: 4, Sum: 10, Average: 2.5 -1, -1, 0, 1, 1, 999 = 0 (Lower Boundary) Count: 5, Sum: 0, Average: 0 50, 25, 25, 999 = 33.33 (Upper Boundary) Count: 3, Sum: 100, Average: 33.333333333333336 998, 998, 998, 999 = 998 (Error Checking) Values have exceeded a sum of 100.
function flat (obj, prefix, flatten) { if (typeof obj === 'string') { return flatten.concat(prefix + obj) } if (Array.isArray(obj)) { return flatten.concat([[prefix + obj[0], obj.slice(1)]]) } if (typeof obj === 'object' && obj.prefix && Array.isArray(obj.names)) { return obj.names.reduce(function (flatten, name) { return flat(name, prefix + obj.prefix, flatten) }, flatten) } return flatten } var handlers = { require: function (element) { if (Array.isArray(element)) { return [require(element[0])].concat(element.slice(1)) } return require(element) }, string: function (element) { if (Array.isArray(element)) { return element[0] } return element } } module.exports = function (obj, handler) { var result = flat(obj, '', []) if (!handler || !handlers[handler]) { return result } return result.map(handlers[handler]) }
<!DOCTYPE HTML> <html> <head> <title>Select Box Demo</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="libs/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="selectboxes.css"> </head> <body> <div class="container"> <div class="col-md-12"> <h3>Two Row Example</h3> <select class="pwn-boxes form-control"> <option value="Cake" pwnicon="fa fa-birthday-cake">Cake</option> <option value="Coffe" pwnicon="fa fa-coffee">Coffe</option> <option value="Bear" pwnicon="fa fa-beer">Bear</option> <option value="Wine" pwnicon="fa fa-vine">Wine</option> <option value="Omlet" pwnicon="fa fa-cutlery">Omlet</option> <option value="Pizza" pwnicon="fa fa-bullseye">Pizza</option> </select> <h3>Single Row Example</h3> <select class="pwn-boxe form-control"> <option value="Cake" pwnicon="fa fa-birthday-cake">Cake</option> <option value="Coffe" pwnicon="fa fa-coffee">Coffe</option> <option value="Bear" pwnicon="fa fa-beer">Bear</option> <option value="Wine" pwnicon="fa fa-vine">Wine</option> <option value="Omlet" pwnicon="fa fa-cutlery">Omlet</option> <option value="Pizza" pwnicon="fa fa-bullseye">Pizza</option> </select> </div> </div> <script src="libs/jquery-1.11.0.js"></script> <script src="selectboxes.js"></script> <script> // 2 row with each row 4 element $('.pwn-boxes').pwnselectboxes({ rows : 2, selecthide : false }); // single row $('.pwn-boxe').pwnselectboxes({ selecthide : false, perrow: 8 }); </script> </body> </html>
package com.dmurph.mvc; import java.beans.<API key>; /** * @author Daniel Murphy * */ public interface IModel { public static final String DIRTY = "MODEL_DIRTY"; /** * Adds a property change listener to this model * @param argListener */ public abstract void <API key>(<API key> argListener); /** * Removes a property change listener to this model * @param argListener */ public abstract void <API key>(<API key> argListener); }
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Problem 12. Generate list</title> <script src="GenerateList.js"></script> </head> <body> <h1>Problem 12. Generate list</h1> <ul> <li>Write a function that creates a HTML ul using a template for every HTML li.</li> <li>The source of the list should be an array of elements.</li> <li>Replace all placeholders marked with –{…}– with the value of the corresponding property of the object.</li> </ul> <hr> <div><em>You could use Chrome console (F12) or Firebug to see the results.</em></div> </body> </html>
package com.example.digitaloceanapp; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
<div flex-container="column"> <div class="{{content.class}}" ng-controller="coverController" > <div in-view="loadAnimate(0,$event,content.classToAnimate)" class="section hidden " > <cover-info> </cover-info> </div> </div> <div class="{{content.class}}" ng-controller="generalController" > <div class="section hidden" in-view="$parent.loadAnimate(1,$event,content.classToAnimate)" > <personal-info> </personal-info> </div> </div> <div class="{{content.class}}" ng-controller="<API key>" > <div in-view="loadAnimate(2,$event,content.classToAnimate)" class="section hidden" > <experience-info> </experience-info> </div> </div> <div class="{{content.class}}" ng-controller="knowledgeController" > <div in-view="loadAnimate(3,$event,content.classToAnimate)" class="section hidden" > <knowledge-info> </knowledge-info> </div> </div> <div class="{{content.class}}" ng-controller="projectsController" > <div in-view="loadAnimate(4,$event,content.classToAnimate)" class="section hidden" > <projects-info> </projects-info> </div> </div> <footer class="{{content.class}}" ng-controller="footerController" > <div in-view="$parent.loadAnimate(5,$event,content.classToAnimate)" class="section hidden" > <footer-info> </footer-info> </div> </footer> <script> (function(i,s,o,g,r,a,m){i['<API key>']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.<API key>(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https: ga('create', 'UA-44391866-10', 'auto'); ga('send', 'pageview'); </script> </div>
# Changelog # 2.0.0 **Not yet released** * Added support for different EOL-styles. * Added new combinator class `minus< M, S >`. * Added support for custom incremental input readers. * Added support for parsing C streams, i.e. `std::FILE *`. * Added support for parsing C++ streams, i.e. `std::istream`. * Added incremental input support rule `discard`. * Added the byte position to input classes and `position_info`. * Added `apply` and `if_apply` rules for in-grammar direct actions. * Added `apply()` method to control class for greater control. * Removed the `begin` member from class `position_info`. * Refactored the `input` class into multiple classes. * Refactored the handling of nested parsing. * Optimised superfluous input markers. * Renamed some parsing front-end functions. * Reduced template instantiation depth of `pegtl_(i)string_t`. * Increased allowed string length to 512 for `pegtl_(i)string_t`. * Allowed embedded null bytes for `pegtl_(i)string_t`. * Allowed re-defining of the `pegtl` namespace name. * Added defines for the version of the PEGTL. * Added support for GCC 4.7. * Improved CI tests. # 1.3.1 Released 2016-04-06 * Fixed unit test to use `eol` instead of hard-coded line ending. # 1.3.0 Released 2016-04-06 * Tentative Android compatibility. * Fixed build with MinGW on Windows. * Changed file reader to open files in binary mode. * Changed `eol` and `eolf` to accept both Unix and MS-DOS line endings. * Optimised bumping the input forward and removed little used bump function. * Simplified grammar analysis algorithm (and more `analyze()` tests). # 1.2.2 Released 2015-11-12 * Improved the JSON grammar and JSON string escaping. * Added JSON test suite from http://json.org/JSON_checker/. * Optimised bumping the input forward and string unescaping. * Promoted `examples/json_changes.hh` to `pegtl/contrib/changes.hh`. # 1.2.1 Released on 2015-09-21 * Added [`file_parser`](Parser-Reference.md#parser-classes) as alias for [`mmap_parser`](Parser-Reference.md#parser-classes) or [`read_parser`](Parser-Reference.md#parser-classes) depending on availability of the former. * Added Clang 3.7 to the automated tests. * Added MacOS X with XCode 6 and XCode 7 to the automated tests. * Added coverage test and improved test coverage to 100%. * Fixed state changing bug in `json_build_one` example. # 1.2.0 Released on 2015-08-23 * Added [`pegtl_string_t`](Rule-Reference.md#pegtl_string_t--) and [`pegtl_istring_t`](Rule-Reference.md#pegtl_istring_t--) to simplify string definitions as follows: c++ pegtl::string< 'h', 'e', 'l', 'l', 'o' > // Normal pegtl_string_t( "hello" ) // New shortcut * Added [`examples/abnf2pegtl.cc`](<API key>.md * Added [`contrib/alphabet.hh`](<API key>.md#<API key>) with integer constants for alphabetic ASCII letters. # 1.1.0 Released on 2015-07-31 * Renamed namespace `pegtl::ucs4` to `pegtl::utf32` and generally adopted UTF-32 in all naming. * Added experimental support for UTF-16 similar to the previously existing UTF-32 parsing rules. * Added support for merging escaped UTF-16 surrogate pairs to `pegtl/contrib/unescape.hh`. * Fixed incorrect handling of escaped UTF-16 surrogate pairs in the JSON examples. * A [state](Rule-Reference.md#state-s-r-)'s `S::success()`-method can now have an extended signature to get access to the current `apply_mode`, *action*- and *control* class (template). * The `contrib/raw_string` class template now calls `Action<raw_string<...>::content>::apply()` with the user's state(s). # 1.0.0 Released on 2015-03-29 * First release. # Previous The changelog of the old 0.x versions was dropped due to the [large refactoring](2014-Refactoring.md) preceding version 1.0.0. The PEGTL was initially developed in 2008 as an experiment in C++0x based on ideas from the YARD library by Christopher Diggins. Several years of real-world experience and smaller updates passed until 2014, when some of the more experimental PEGTL features were removed, the remaining parts refactored and refined, and some interesting additions made. Copyright (c) 2014-2017 Dr. Colin Hirsch and Daniel Frey
namespace AgileObjects.ReadableExpressions.Visualizers.Dialog.Theming { using System.Drawing; using System.Windows.Forms; using Core.Theming; internal class <API key> : <API key> { private readonly VisualizerDialog _dialog; private Color? _foreColour; private Brush _foreColourBrush; private Brush <API key>; private Color? _toolbarColour; private Brush _toolbarColourBrush; private Color? _menuColour; private Brush _menuColourBrush; private Color? <API key>; private Brush <API key>; public <API key>(VisualizerDialog dialog) { _dialog = dialog; } private <API key> Theme => _dialog.Theme; public void HandleThemeChanged() { _foreColour = null; _foreColourBrush = null; <API key> = null; _toolbarColour = null; _toolbarColourBrush = null; _menuColour = null; _menuColourBrush = null; <API key> = null; <API key> = null; } public override Color ToolStripBorder => ForeColour; public override Color <API key> => MenuColour; public Color ForeColour => _foreColour ??= ColorTranslator.FromHtml(Theme.Default); public Brush ForeColourBrush => _foreColourBrush ??= new SolidBrush(ForeColour); public Brush <API key> => <API key> ??= new SolidBrush( ForeColour.ChangeBrightness(ForeColour.IsDark() ? 0.5f : -0.4f)); public Color ToolbarColour => _toolbarColour ??= ColorTranslator.FromHtml(Theme.Toolbar); public Brush ToolbarColourBrush => _toolbarColourBrush ??= new SolidBrush(ToolbarColour); public Color MenuColour => _menuColour ??= ColorTranslator.FromHtml(Theme.Menu); public Brush MenuColourBrush => _menuColourBrush ??= new SolidBrush(MenuColour); public Color MenuHighlightColour => <API key> ??= ColorTranslator.FromHtml(Theme.MenuHighlight); public Brush <API key> => <API key> ??= new SolidBrush(MenuHighlightColour); public string IconSuffix => MenuColour.IsDark() ? "Dark" : null; } }
namespace SimpleFixture.Tests.Classes { public interface ISomeInterface { int SomeIntMethod(); } }
var gulp = require('gulp'); var jshint = require('gulp-jshint'); var concat = require('gulp-concat'); var rename = require('gulp-rename'); var uglify = require('gulp-uglify'); var srcPath = 'src/ng-sort-set.js'; gulp.task('lint', function () { return gulp.src(srcPath) .pipe(jshint()) .pipe(jshint.reporter('default')); }); gulp.task('build', function () { return gulp.src(['src/ng-sort-set.prefix', srcPath, 'src/ng-sort-set.suffix']) .pipe(concat('all.js')) .pipe(rename('ng-sort-set.js')) .pipe(gulp.dest('dist')) .pipe(uglify()) .pipe(rename('ng-sort-set.min.js')) .pipe(gulp.dest('dist')); }); gulp.task('default', function () { gulp.watch(srcPath, ['lint', 'build']); });
/** * @file Magic * @author liuxuanzy(liuxuanzy@qq.com) */ 'use strict'; const MAGIC_LIST_CONFIG = require('./config'); /** * * * @class MagicBase */ class MagicBase { /** * * * @param {Object} options */ constructor(options) { /** * * * @type {string} */ this.name = options.name; /** * * * @type {number} */ this.cost = options.cost; /** * * * @type {string} */ this.description = options.description; // deal if (options.deal) { this.deal = options.deal; } } /** * * * @public * @abstract * @param {Scene} scene */ deal(scene) { //throw new Error(''); } } const MAGIC_LIST = MAGIC_LIST_CONFIG.map(a => new MagicBase(a)); /** * * * @type {Magic} */ module.exports = class Magic { /** * * * @param {Scene} scene * @param {number} count */ constructor(scene, count) { /** * * * @type {Array} */ this.list = []; /** * * * @type {Scene} */ this.scene = scene; for (let i = 0; i < count; i++) { this.list.push(Magic.randomMagic()); } } deal() { for (let magic of this.list) { magic.deal(this.scene); if (this.scene.finished) { break; } } } /** * * * @returns {*} */ static randomMagic() { let index = Math.floor(Math.random() * MAGIC_LIST.length); return MAGIC_LIST[index]; } };
class <API key> < ActiveRecord::Migration def change add_column :onboarding_users, :last_step, :string end end
<?php namespace Fisharebest\Localization\Script; class ScriptBugi extends AbstractScript implements ScriptInterface { public function code() { return 'Bugi'; } public function number() { return '367'; } public function unicodeName() { return 'Buginese'; } }
<?php while (have_posts()) : the_post(); ?> <!-- if in quote category, display title as excerpt --> <?php if(has_post_format('quote')){ ?> <article <?php post_class(); ?>> <header> <h2 class="quote"><?php the_content(''); ?></h2> <div class="entry-meta"> <time class="updated" datetime="<?= get_post_time('c', true); ?>"><?= get_the_date(); ?></time> <span class="byline author vcard"><?= __('', 'sage'); ?> <a href="<?= <API key>(get_the_author_meta('ID')); ?>" rel="author" class="fn"><?= get_the_author(); ?></a></span> </div> </header> </article> <!-- all other types of posts --> <?php } else { ?> <article <?php post_class(); ?>> <header> <h1 class="entry-title"><?php the_title(); ?></h1> <?php get_template_part('templates/entry-meta'); ?> </header> <div class="entry-content"> <?php the_content(); ?> </div> <footer> <?php wp_link_pages(['before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']); ?> </footer> <?php comments_template('/templates/comments.php'); ?> </article> <!-- end if --> <?php } ?> <?php endwhile; ?>
# Changelog ## 5.0.2 - Fix sibling months day click gave incorrect date ## 5.0.1 - Globals are evil. By trying to make things easy to use, we declared a global `window.DPicker` variable. Since `5.0.1` it's not the case anymore and it will be declared as `window.dpicker`. It's recommended that you use a bundle system though (webpack, rollup, browserify...). - Plugins are exporting a `function`. Makes things easier to pre-build packages. This means that this won't work anymore: javascript <script type="text/javascript" src="https://unpkg.com/dpicker@5.0.0/dist/dpicker.min.js"></script> <script type="text/javascript" src="https://unpkg.com/dpicker@5.0.0/dist/dpicker.time.min.js"></script> To get date + time, you should use: javascript <script type="text/javascript" src="https://unpkg.com/dpicker@5.0.0/dist/dpicker.datetime.min.js"></script> Or the package with every module: javascript <script type="text/javascript" src="https://unpkg.com/dpicker@5.0.0/dist/dpicker.datetime.all.js"></script> ## 5.0.0 - Use browserify instead of gulp - Use real dom, real dates ([nanomorph](https: - Use [standard](https://github.com/feross/standard) - Get rid of momentjs hard dependency (still required for now) - Implement a Date Adapter for future libraries support - Simplify plugins api - uses immutable `Date` instances internally! [BC] No more `_modules` stuff. Just simple objects creation: javascript DPicker.renders.closeButton = function renderCloseButton(events, data) { const button = document.createElement('button') button.innerText = 'Confirm' button.type = 'button' button.classList.add('<API key>') button.addEventListener('click', events.hidePicker) return button } DPicker.events.hidePicker = function hidePicker() { this.display = false } - Incremental builds You can use `dpicker.datetime.js` directly. Coming soon builds with `date-fns`. Available builds: dist/dpicker.all.min.js.gz: 7.698 kb dist/dpicker.arrow-navigation.min.js.gz: 0.9410000000000001 kb dist/dpicker.core.min.js.gz: 4.892 kb dist/dpicker.datetime.min.js.gz: 6.947 kb dist/dpicker.min.js.gz: 5.699 kb dist/dpicker.modifiers.min.js.gz: 0.58 kb dist/dpicker.navigation.min.js.gz: 0.6900000000000001 kb dist/dpicker.time.min.js.gz: 2.08 kb dist/polyfills.min.js.gz: 4.5200000000000005 kb - Improve docs (A LOT) https: - Build a decent demo using cycle.js - naming public stuff `_events` => `events` `_data` => `data` - new getter for `empty` ## 4.2.0 `onChange` now has a second argument giving informations about the recent change, for example: javascript dpicker.onChange = function(data, event) { console.log('Model changed? %s', event.modelChanged ? 'yes' : 'no') console.log('DPicker event: %s', event.name) console.log('DPicker original event: %s', event.event) } ## 4.0.9 - Adds an option to enable sibling month days ## 4.0.8 - Adds an option `<API key>` to merge hours and minutes in one `select` ## 4.0.0 - Drop hyperscript library, it's not needed anymore and it's not possible to add a custom one - An invalid Date doesn't reset the value to the closest correct one, it leaves the choice to the user instead - A class `.invalid` is added to the input - `aria-*` attributes are now working ## 3.1.1 Add touch friendly behavior ## 3.1.0 Drop maquettejs hard dependency (see #1). You can now use your own hyperscript library, for example with mithriljs: let dpicker = DPicker(label, { h: mithril, mount: function(element, toRender) { mithril.render(element, toRender()) }, redraw: mithril.redraw }) ## 3.0.0 `time-format` renamed to `meridiem` ## 2.0.0 `isEmpty` renamed `empty` ## 1.3.0 Drop `previousYear` and `futureYear`. Those are replaced by `min` and `max`: - `input[type="date"]` polyfill ( - allows to change the months selection on max/min dates
class <API key> < ActiveRecord::Migration def change create_table :authorizations do |t| t.references :provider t.string :user_token t.string :user_secret t.string :uid t.references :user t.timestamps null: false end end end
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Data.SqlClient; using <API key>.Models; using <API key>.Classes; namespace <API key>.Controllers { public class <API key> : Controller { public ActionResult InventoryViewView() { InventoryViewModel model = new InventoryViewModel(); return View(model); } [HttpPost] public JsonResult UpdateQuantities(string ItemName, int ItemQuantity) { MethodStatus status = new MethodStatus(); SqlConnection conn = new SqlConnection("SERVER=173.88.245.82,1433;Database=Inventory;USER ID=Capstone;PASSWORD=abc123"); try { conn.Open(); string query = "UPDATE Inventory SET InventoryQuantity=" + ItemQuantity + " WHERE ItemName=" + ItemName; using (SqlCommand command = new SqlCommand(query, conn)) { command.CommandText = "UPDATE Inventory SET InventoryQuantity = @quantity WHERE ItemName = @name"; command.Parameters.AddWithValue("@quantity", ItemQuantity); command.Parameters.AddWithValue("@name", ItemName); command.ExecuteNonQuery(); } } catch (Exception ex) { status.success = false; status.Message = ex.InnerException.ToString(); } return Json(status, JsonRequestBehavior.DenyGet); } [HttpPost] public JsonResult <API key>(string locationName) { InventoryStatus status = new InventoryStatus(); status.success = true; List<Location> Locations = new List<Location>(); List<InventoryItem> Items = new List<InventoryItem>(); List<InventoryItem> FinalItems = new List<InventoryItem>(); SqlConnection conn = new SqlConnection("SERVER=173.88.245.82,1433;Database=Inventory;USER ID=Capstone;PASSWORD=abc123"); try { conn.Open(); string query = "SELECT * FROM InventoryLocation"; // Get All Locations using (SqlCommand command = new SqlCommand(query, conn)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { string LocationName = reader.GetString(reader.GetOrdinal("<API key>")); //int LocationID = reader.GetInt32(reader.GetOrdinal("InventoryLocationID")); Locations.Add(new Location(LocationName)); } } } query = "SELECT * FROM Inventory"; // Get all items using (SqlCommand command = new SqlCommand(query, conn)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { string ItemName = reader.GetString(reader.GetOrdinal("ItemName")); int ItemQuantity = reader.GetInt32(reader.GetOrdinal("InventoryQuantity")); int ItemReorder = reader.GetInt32(reader.GetOrdinal("<API key>")); string ItemDescription = reader.GetString(reader.GetOrdinal("<API key>")); int InventoryTypeID = (int)reader.GetInt64(reader.GetOrdinal("InventoryTypeID")); int InventoryLocationID = (int)reader.GetInt64(reader.GetOrdinal("InventoryLocationID")); int ItemID = (int)reader.GetInt64(reader.GetOrdinal("InventoryID")); InventoryItem item = new InventoryItem(ItemName, ItemQuantity, ItemReorder, ItemDescription, InventoryTypeID, InventoryLocationID, ItemID); Items.Add(item); } } } foreach(var item in Items) { foreach(var location in Locations) { if(location.LocationName == locationName) { if(location.LocationID == item.LocationId) { status.items.Add(item); } } } } } catch(Exception ex) { status.success = false; status.Message = ex.Message; } return Json(status, JsonRequestBehavior.DenyGet); } } }
// Joe Presbrey <presbrey@mit.edu> // 2007-07-15 // 2010-08-08 TimBL folded in Kenny's WEBDAV // 2010-12-07 TimBL addred local file write code $rdf.sparqlUpdate = function() { var anonymize = function (obj) { return (obj.toNT().substr(0,2) == "_:") ? "?" + obj.toNT().substr(2) : obj.toNT(); } var anonymizeNT = function(stmt) { return anonymize(stmt.subject) + " " + anonymize(stmt.predicate) + " " + anonymize(stmt.object) + " ."; } var sparql = function(store) { this.store = store; this.ifps = {}; this.fps = {}; this.ns = {}; this.ns.link = $rdf.Namespace("http://www.w3.org/2007/ont/link this.ns.http = $rdf.Namespace("http://www.w3.org/2007/ont/http this.ns.httph = $rdf.Namespace("http://www.w3.org/2007/ont/httph this.ns.rdf = $rdf.Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns this.ns.rdfs = $rdf.Namespace("http://www.w3.org/2000/01/rdf-schema this.ns.rdf = $rdf.Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns this.ns.owl = $rdf.Namespace("http://www.w3.org/2002/07/owl } // Returns The method string SPARQL or DAV or LOCALFILE or false if known, undefined if not known. // Files have to have a specific annotaton that they are machine written, for safety. // We don't actually check for write access on files. sparql.prototype.editable = function(uri, kb) { if (!uri) return false; // Eg subject is bnode, no known doc to write to if (!kb) kb = tabulator.kb; if (uri.slice(0,8) == 'file: if (kb.holds(kb.sym(uri), tabulator.ns.rdf('type'), tabulator.ns.link('<API key>'))) return 'LOCALFILE'; var sts = kb.statementsMatching(kb.sym(uri),undefined,undefined); tabulator.log.warn("sparql.editable: Not <API key> file "+uri+"\n"); tabulator.log.warn(sts.map(function(x){return x.toNT();}).join('\n')) return false; //@@ Would be nifty of course to see whether we actually have write acess first. } var request; var definitive = false; var requests = kb.each(undefined, this.ns.link("requestedURI"), $rdf.uri.docpart(uri)); for (var r=0; r<requests.length; r++) { request = requests[r]; if (request !== undefined) { var response = kb.any(request, this.ns.link("response")); if (request !== undefined) { var author_via = kb.each(response, this.ns.httph("ms-author-via")); if (author_via.length) { for (var i = 0; i < author_via.length; i++) { var method = author_via[i].value.trim(); if (method.indexOf('SPARQL') >=0 ) return 'SPARQL'; if (method.indexOf('DAV') >=0 ) return 'DAV'; // if (author_via[i].value == "SPARQL" || author_via[i].value == "DAV") // dump("sparql.editable: Success for "+uri+": "+author_via[i] +"\n"); //return author_via[i].value; } } var status = kb.each(response, this.ns.http("status")); if (status.length) { for (var i = 0; i < status.length; i++) { if (status[i] == 200 || status[i] == 404) { definitive = true; // return false; // A definitive answer } } } } else { tabulator.log.warn("sparql.editable: No response for "+uri+"\n"); } } } if (requests.length == 0) { tabulator.log.warn("sparql.editable: No request for "+uri+"\n"); } else { if (definitive) return false; // We have got a request and it did NOT say editable => not editable }; tabulator.log.warn("sparql.editable: inconclusive for "+uri+"\n"); return undefined; // We don't know (yet) as we haven't had a response (yet) } //////// The identification of bnodes sparql.prototype._statement_bnodes = function(st) { return [st.subject, st.predicate, st.object].filter(function(x){return x.isBlank}); } sparql.prototype.<API key> = function(sts) { var bnodes = []; for (var i=0; i<sts.length;i++) bnodes = bnodes.concat(this._statement_bnodes(sts[i])); bnodes.sort(); // in place sort - result may have duplicates bnodes2 = []; for (var j=0; j<bnodes.length; j++) if (j==0 || !bnodes[j].sameTerm(bnodes[j-1])) bnodes2.push(bnodes[j]); return bnodes2; } sparql.prototype._cache_ifps = function() { // Make a cached list of [Inverse-]Functional properties // Call this once before calling context_statements this.ifps = {}; var a = this.store.each(undefined, this.ns.rdf('type'), this.ns.owl('<API key>')) for (var i=0; i<a.length; i++) { this.ifps[a[i].uri] = true; } this.fps = {}; var a = this.store.each(undefined, this.ns.rdf('type'), this.ns.owl('FunctionalProperty')) for (var i=0; i<a.length; i++) { this.fps[a[i].uri] = true; } } sparql.prototype._bnode_context2 = function(x, source, depth) { // Return a list of statements which indirectly identify a node // Depth > 1 if try further indirection. // Return array of statements (possibly empty), or null if failure var sts = this.store.statementsMatching(undefined, undefined, x, source); // incoming links for (var i=0; i<sts.length; i++) { if (this.fps[sts[i].predicate.uri]) { var y = sts[i].subject; if (!y.isBlank) return [ sts[i] ]; if (depth) { var res = this._bnode_context2(y, source, depth-1); if (res != null) return res.concat([ sts[i] ]); } } } var sts = this.store.statementsMatching(x, undefined, undefined, source); // outgoing links for (var i=0; i<sts.length; i++) { if (this.ifps[sts[i].predicate.uri]) { var y = sts[i].object; if (!y.isBlank) return [ sts[i] ]; if (depth) { var res = this._bnode_context2(y, source, depth-1); if (res != undefined) return res.concat([ sts[i] ]); } } } return null; // Failure } sparql.prototype._bnode_context = function(x, source) { // Return a list of statements which indirectly identify a node // Breadth-first for (var depth = 0; depth < 3; depth++) { // Try simple first var con = this._bnode_context2(x, source, depth); if (con != null) return con; } throw ('Unable to uniquely identify bnode: '+ x.toNT()); } sparql.prototype._bnode_context = function(bnodes) { var context = []; if (bnodes.length) { if (this.store.statementsMatching(st.subject.isBlank?undefined:st.subject, st.predicate.isBlank?undefined:st.predicate, st.object.isBlank?undefined:st.object, st.why).length <= 1) { context = context.concat(st); } else { this._cache_ifps(); for (x in bnodes) { context = context.concat(this._bnode_context(bnodes[x], st.why)); } } } return context; } sparql.prototype._statement_context = function(st) { var bnodes = this._statement_bnodes(st); return this._bnode_context(bnodes); } sparql.prototype._context_where = function(context) { return (context == undefined || context.length == 0) ? "" : "WHERE { " + context.map(anonymizeNT).join("\n") + " }\n"; } sparql.prototype._fire = function(uri, query, callback) { if (!uri) throw "No URI given for remote editing operation: "+query; tabulator.log.info("sparql: sending update to <"+uri+">\n query="+query+"\n"); var xhr = $rdf.Util.XMLHTTPFactory(); xhr.onreadystatechange = function() { //dump("SPARQL update ready state for <"+uri+"> readyState="+xhr.readyState+"\n"+query+"\n"); if (xhr.readyState == 4) { var success = (!xhr.status || (xhr.status >= 200 && xhr.status < 300)); if (!success) tabulator.log.error("sparql: update failed for <"+uri+"> status="+ xhr.status+", "+xhr.statusText+", body length="+xhr.responseText.length+"\n for query: "+query); else tabulator.log.debug("sparql: update Ok for <"+uri+">"); callback(uri, success, xhr.responseText); } } if(!tabulator.isExtension) { try { $rdf.Util.enablePrivilege("<API key>") } catch(e) { alert("Failed to get privileges: " + e) } } xhr.open('POST', uri, true); // async=true xhr.setRequestHeader('Content-type', 'application/sparql-update'); xhr.send(query); } // This does NOT update the statement. // It returns an object whcih includes // function which can be used to change the object of the statement. sparql.prototype.update_statement = function(statement) { if (statement && statement.why == undefined) return; var sparql = this; var context = this._statement_context(statement); return { statement: statement?[statement.subject, statement.predicate, statement.object, statement.why]:undefined, statementNT: statement?anonymizeNT(statement):undefined, where: sparql._context_where(context), set_object: function(obj, callback) { query = this.where; query += "DELETE DATA { " + this.statementNT + " } ;\n"; query += "INSERT DATA { " + anonymize(this.statement[0]) + " " + anonymize(this.statement[1]) + " " + anonymize(obj) + " " + " . }\n"; sparql._fire(this.statement[3].uri, query, callback); } } } sparql.prototype.insert_statement = function(st, callback) { var st0 = st instanceof Array ? st[0] : st; var query = this._context_where(this._statement_context(st0)); if (st instanceof Array) { var stText=""; for (var i=0;i<st.length;i++) stText+=st[i]+'\n'; query += "INSERT DATA { " + stText + " }\n"; } else { query += "INSERT DATA { " + anonymize(st.subject) + " " + anonymize(st.predicate) + " " + anonymize(st.object) + " " + " . }\n"; } this._fire(st0.why.uri, query, callback); } sparql.prototype.delete_statement = function(st, callback) { var st0 = st instanceof Array ? st[0] : st; var query = this._context_where(this._statement_context(st0)); if (st instanceof Array) { var stText=""; for (var i=0;i<st.length;i++) stText+=st[i]+'\n'; query += "DELETE DATA { " + stText + " }\n"; } else { query += "DELETE DATA { " + anonymize(st.subject) + " " + anonymize(st.predicate) + " " + anonymize(st.object) + " " + " . }\n"; } this._fire(st0.why.uri, query, callback); } // This high-level function updates the local store iff the web is changed successfully. // - deletions, insertions may be undefined or single statements or lists or formulae. // - callback is called as callback(uri, success, errorbody) sparql.prototype.update = function(deletions, insertions, callback) { var kb = this.store; tabulator.log.info("update called") var ds = deletions == undefined ? [] : deletions instanceof $rdf.IndexedFormula ? deletions.statements : deletions instanceof Array ? deletions : [ deletions ]; var is = insertions == undefined? [] : insertions instanceof $rdf.IndexedFormula ? insertions.statements : insertions instanceof Array ? insertions : [ insertions ]; if (! (ds instanceof Array)) throw "Type Error "+(typeof ds)+": "+ds; if (! (is instanceof Array)) throw "Type Error "+(typeof is)+": "+is; var doc = ds.length ? ds[0].why : is[0].why; ds.map(function(st){if (!doc.sameTerm(st.why)) throw "sparql update: destination "+doc+" inconsistent with ds "+st.why;}); is.map(function(st){if (!doc.sameTerm(st.why)) throw "sparql update: destination = "+doc+" inconsistent with st.why ="+st.why;}); var protocol = this.editable(doc.uri, kb); if (!protocol) throw "Can't make changes in uneditable "+doc; if (protocol.indexOf('SPARQL') >=0) { var bnodes = [] if (ds.length) bnodes = this.<API key>(ds); if (is.length) bnodes = bnodes.concat(this.<API key>(is)); var context = this._bnode_context(bnodes); var whereClause = this._context_where(context); var query = "" if (whereClause.length) { // Is there a WHERE clause? if (ds.length) { query += "DELETE { "; for (var i=0; i<ds.length;i++) query+= anonymizeNT(ds[i])+"\n"; query += " }\n"; } if (is.length) { query += "INSERT { "; for (var i=0; i<is.length;i++) query+= anonymizeNT(is[i])+"\n"; query += " }\n"; } query += whereClause; } else { // no where clause if (ds.length) { query += "DELETE DATA { "; for (var i=0; i<ds.length;i++) query+= anonymizeNT(ds[i])+"\n"; query += " } \n"; } if (is.length) { if (ds.length) query += " ; "; query += "INSERT DATA { "; for (var i=0; i<is.length;i++) query+= anonymizeNT(is[i])+"\n"; query += " }\n"; } } this._fire(doc.uri, query, function(uri, success, body) { tabulator.log.info("\t sparql: Return success="+success+" for query "+query+"\n"); if (success) { for (var i=0; i<ds.length;i++) try { kb.remove(ds[i]) } catch(e) { callback(uri, false, "sparqlUpdate: Remote OK but error deleting statemmnt "+ ds[i] + " from local store:\n" + e) } for (var i=0; i<is.length;i++) kb.add(is[i].subject, is[i].predicate, is[i].object, doc); } callback(uri, success, body); }); } else if (protocol.indexOf('DAV') >=0) { // The code below is derived from Kenny's UpdateCenter.js var documentString; var request = kb.any(doc, this.ns.link("request")); if (!request) throw "No record of our HTTP GET request for document: "+doc; //should not happen var response = kb.any(request, this.ns.link("response")); if (!response) return null; // throw "No record HTTP GET response for document: "+doc; var content_type = kb.the(response, this.ns.httph("content-type")).value; //prepare contents of revised document var newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy! for (var i=0;i<ds.length;i++) $rdf.Util.RDFArrayRemove(newSts, ds[i]); for (var i=0;i<is.length;i++) newSts.push(is[i]); //serialize to te appropriate format var sz = $rdf.Serializer(kb); sz.suggestNamespaces(kb.namespaces); sz.setBase(doc.uri);//?? beware of this - kenny (why? tim) switch(content_type){ case 'application/rdf+xml': documentString = sz.statementsToXML(newSts); break; case 'text/n3': case 'text/turtle': case 'application/x-turtle': // Legacy case 'application/n3': // Legacy documentString = sz.statementsToN3(newSts); break; default: throw "Content-type "+content_type +" not supported for data write"; } // Write the new version back var candidateTarget = kb.the(response, this.ns.httph("content-location")); if (candidateTarget) targetURI = $rdf.uri.join(candidateTarget.value, targetURI); var xhr = $rdf.Util.XMLHTTPFactory(); xhr.onreadystatechange = function (){ if (xhr.readyState == 4){ //formula from sparqlUpdate.js, what about redirects? var success = (!xhr.status || (xhr.status >= 200 && xhr.status < 300)); if (success) { for (var i=0; i<ds.length;i++) kb.remove(ds[i]); for (var i=0; i<is.length;i++) kb.add(is[i].subject, is[i].predicate, is[i].object, doc); } callback(doc.uri, success, xhr.responseText); } }; xhr.open('PUT', targetURI, true); //assume the server does PUT content-negotiation. xhr.setRequestHeader('Content-type', content_type); xhr.send(documentString); } else if (protocol.indexOf('LOCALFILE') >=0) { try { tabulator.log.info("Writing back to local file\n"); //prepare contents of revised document var newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy! for (var i=0;i<ds.length;i++) $rdf.Util.RDFArrayRemove(newSts, ds[i]); for (var i=0;i<is.length;i++) newSts.push(is[i]); //serialize to the appropriate format var documentString; var sz = $rdf.Serializer(kb); sz.suggestNamespaces(kb.namespaces); sz.setBase(doc.uri);//?? beware of this - kenny (why? tim) var dot = doc.uri.lastIndexOf('.'); if (dot < 1) throw "Rewriting file: No filename extension: "+doc.uri; var ext = doc.uri.slice(dot+1); switch(ext){ case 'rdf': case 'owl': // Just my experence ...@@ we should keep the format in which it was parsed case 'xml': documentString = sz.statementsToXML(newSts); break; case 'n3': case 'nt': case 'ttl': documentString = sz.statementsToN3(newSts); break; default: throw "File extension ."+ext +" not supported for data write"; } // Write the new version back //create component for file writing dump("Writing back: <<<"+documentString+">>>\n") var filename = doc.uri.slice(7); // chop off file:// leaving /path //tabulator.log.warn("Writeback: Filename: "+filename+"\n") var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath(filename); if(!file.exists()) throw "Rewriting file <"+doc.uri+"> but it does not exist!"; //file.create( Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420); //create file output stream and use write/create/truncate mode //0x02 writing, 0x08 create file, 0x20 truncate length if exist var stream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance(Components.interfaces.nsIFileOutputStream); stream.init(file, 0x02 | 0x08 | 0x20, 0666, 0); //write data to file then close output stream stream.write(documentString, documentString.length); stream.close(); for (var i=0; i<ds.length;i++) kb.remove(ds[i]); for (var i=0; i<is.length;i++) kb.add(is[i].subject, is[i].predicate, is[i].object, doc); callback(doc.uri, true, ""); // success! } catch(e) { callback(doc.uri, false, "Exception trying to write back file <"+doc.uri+">\n"+ tabulator.Util.stackString(e)) } } else throw "Unhandled edit method: '"+protocol+"' for "+doc; }; // This suitable for an inital creation of a document sparql.prototype.put = function(doc, newSts, content_type, callback) { var documentString; var kb = this.store; //serialize to te appropriate format var sz = $rdf.Serializer(kb); sz.suggestNamespaces(kb.namespaces); sz.setBase(doc.uri);//?? beware of this - kenny (why? tim) switch(content_type){ case 'application/rdf+xml': documentString = sz.statementsToXML(newSts); break; case 'text/n3': case 'text/turtle': case 'application/x-turtle': // Legacy case 'application/n3': // Legacy documentString = sz.statementsToN3(newSts); break; default: throw "Content-type "+content_type +" not supported for data PUT"; } var xhr = $rdf.Util.XMLHTTPFactory(); xhr.onreadystatechange = function (){ if (xhr.readyState == 4){ //formula from sparqlUpdate.js, what about redirects? var success = (!xhr.status || (xhr.status >= 200 && xhr.status < 300)); callback(doc.uri, success, xhr.responseText); } }; xhr.open('PUT', doc.uri, true); //assume the server does PUT content-negotiation. xhr.setRequestHeader('Content-type', content_type); xhr.send(documentString); }; return sparql; }();
var async = require('async'); var _ = require('underscore'); var cache = require('./cache.js'); var user = require('./user.js'); var beer = require('./beer.js'); var aUtils = require('./analyseUtils'); exports.getUserCheckins = function(token, username, cb){ user.info(token, username, function(err, userInfo){ if (err){ return cb(err); } var totalCheckins = userInfo.stats.total_beers, totalUnique = userInfo.stats.total_beers, ourUserInfo = _.pick(userInfo, 'user_name', 'first_name', 'last_name', 'location', 'bio', 'user_avatar'), offset = 0, offsetIncrement = 25, getters = []; ourUserInfo.total_beers = totalCheckins; while (offset < totalUnique){ (function(token, username, offset){ getters.push( function(asyncCb){ beer.distinct(token, username, undefined, offset, asyncCb); } ); })(token, username, offset); offset += offsetIncrement; } async.parallel(getters, function(err, combinedRes){ if (err){ return cb(err); } var <API key> = _.flatten(combinedRes); return cb(err, { user : ourUserInfo, beers : <API key>}); }); }); } exports.analyseUserCheckins = function(userInfo, cb){ var userCheckins = userInfo.beers, styles = {}, countries = {}, beers = {}; _.each(userCheckins, function(checkin){ var name = checkin.brewery.brewery_name + ' - ' + checkin.beer.beer_name, style = checkin.beer.beer_style, country = checkin.brewery.country_name rating = checkin.rating_score; if (typeof rating !== 'number' || rating === 0){ return; } if (!styles.hasOwnProperty(style)){ styles[style] = []; } if (!countries.hasOwnProperty(country)){ countries[country] = []; } styles[style].push(rating); countries[country].push(rating); beers[name] = { rating : rating, name : name, breweryName : checkin.brewery.brewery_name, beerName : checkin.beer.beer_name, label : checkin.brewery.brewery_label }; }); // Average up all the style sums _.each(styles, function(averages, key){ var sum = _.reduce(averages, function(a, b){ return a + b; }), average = sum / averages.length; styles[key] = average; }); // Average up all the country sums _.each(countries, function(averages, key){ var sum = _.reduce(averages, function(a, b){ return a + b; }), average = sum / averages.length; countries[key] = average; }); return cb(null, { styles : styles, beers : beers, countries : countries, user : userInfo.user}); } exports.<API key> = function(token, user, cb){ exports.getUserCheckins(token, user, function(err, userCheckinsRes){ if (err){ return cb(err); } exports.analyseUserCheckins(userCheckinsRes, cb); }); } exports.compareUsers = function(token, userA, userB, cb){ async.parallel({ a : function(cb){ exports.<API key>(token, userA, cb); }, b : function(cb){ exports.<API key>(token, userB, cb); } }, function(err, combinedUserRes){ if (err){ return cb(err); } var a = combinedUserRes.a, b = combinedUserRes.b, stylesInCommon = {}, beersInCommon = {}, countriesInCommon = {}; // Compare A v.s. B styles _.each(a.styles, function(ratingAGave, style){ if (b.styles.hasOwnProperty(style)){ var ratingBGave = b.styles[style], diff = aUtils.diff(ratingAGave, ratingBGave); stylesInCommon[style] = {}; stylesInCommon[style].a = ratingAGave; stylesInCommon[style].b = ratingBGave; stylesInCommon[style].diff = diff; stylesInCommon[style].desc = aUtils.describe(diff); } }); // Compare A v.s. B countries of origin _.each(a.countries, function(ratingAGave, country){ if (b.countries.hasOwnProperty(country)){ var ratingBGave = b.countries[country], diff = aUtils.diff(ratingAGave, ratingBGave); countriesInCommon[country] = {}; countriesInCommon[country].a = ratingAGave; countriesInCommon[country].b = ratingBGave; countriesInCommon[country].diff = diff; countriesInCommon[country].desc = aUtils.describe(diff); } }); // Compare A v.s. B beers _.each(a.beers, function(ratingObj, beer){ var ratingAGave = ratingObj.rating; if (b.beers.hasOwnProperty(beer)){ var ratingBGave = b.beers[beer].rating, diff = aUtils.diff(ratingAGave, ratingBGave); beersInCommon[beer] = {}; beersInCommon[beer].label = ratingObj.label; beersInCommon[beer].a = ratingAGave; beersInCommon[beer].b = ratingBGave; beersInCommon[beer].diff = diff; beersInCommon[beer].desc = aUtils.describe(diff); } }); var <API key>; if (!_.isEmpty(stylesInCommon)){ var <API key> = _.pluck(_.values(stylesInCommon), 'diff'); <API key> = _.reduce(<API key>, function(a, b){ return a + b; }) / <API key>.length; } var <API key>; if (!_.isEmpty(beersInCommon)){ var totalBeerDifference = _.pluck(_.values(beersInCommon), 'diff'); <API key> = _.reduce(totalBeerDifference, function(a, b){ return a + b; }) / totalBeerDifference.length; } var <API key> = ((<API key> || 2.5) + (<API key> || 2.5)), // default to an average difference match; // average the totals & round the number.. if (Math.round(<API key>) / 2 <=1){ match = true; }else{ match = false; } return cb(null, { beersInCommon : beersInCommon, stylesInCommon : stylesInCommon, countriesInCommon : countriesInCommon, <API key> : <API key>, <API key> : <API key>, styleDesc : aUtils.describe(<API key>), beerDesc : aUtils.describe(<API key>), match : match, // <API key> is the % by which the users differ. To get their similarity, invert the % percent : Math.abs(Math.round(<API key> * 10) - 100), a : a.user, b : b.user }); }); }
import React from 'react' import Base from '../_helpers/BaseComponent' import classnames from 'classnames' export default class Login extends Base { constructor() { super() } render() { let usernameClasses = classnames({ 'h5': true, 'form-input': true, 'color-input-red': this.props.validUsername === false }) let passwordClasses = classnames({ 'h5': true, 'form-input': true, 'color-input-red': this.props.validPassword === false }) // initialise the message and messageClasses let message = '' let messageClasses = '' if(this.props.shouldMessageShow) { message = { true: 'You are now logged in!', false: 'Something went wrong, please try again' }[this.props.isLoginSuccessful] messageClasses = classnames({ 'color-green': this.props.isLoginSuccessful === true, 'color-red': this.props.isLoginSuccessful === false, 'h6': true }) } // initialise button classes and disabled state let loginDisabled = this.props.loginDisabled ? 'disabled' : '' let buttonOptions = { 'className': 'form-submit h6', 'onClick': this.props.onLogin, 'id': 'login-button' } if(loginDisabled) { buttonOptions['disabled'] = 'disabled' } return ( <div> <div className="hero-form--title"> <h1 className="h2">Login</h1> <p className={messageClasses} id="login-message"> {message} </p> </div> <input onChange={this.props.onChangeInput} value={this.props.username} className={usernameClasses} type="text" id="login-username" name="username" placeholder="Username..." /> <input onChange={this.props.onChangeInput} value={this.props.password} className={passwordClasses} type="password" id="login-password" name="password" placeholder="Password..." /> <button {...buttonOptions}> Login </button> </div> ) } }
layout: splash title: "Page Not Found" excerpt: "Page not found. Your pixels are in another canvas." sitemap: false permalink: /404.html Sorry, but the page you were trying to view does not exist --- perhaps you can try searching for it below. <script> var GOOG_FIXURL_LANG = 'en'; var GOOG_FIXURL_SITE = '{{ site.url }}' </script> <script src="https://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"> </script>
// Media+CoreDataProperties.h // CDASyncService // to delete and recreate this implementation file for your updated model. #import "Media.h" <API key> @interface Media (CoreDataProperties) @property (nullable, nonatomic, retain) NSNumber *contentItemId; @property (nullable, nonatomic, retain) NSString *fileHash; @property (nullable, nonatomic, retain) NSString *fileName; @property (nullable, nonatomic, retain) NSNumber *id; @property (nullable, nonatomic, retain) NSNumber *languageId; @property (nullable, nonatomic, retain) NSNumber *pages; @property (nullable, nonatomic, retain) NSString *type; @property (nullable, nonatomic, retain) NSString *url; @end <API key>
""" Some common utilities. """ from turtle import Turtle def turtle_subclass(name): """ Creates a subclass of Turtle with the given name. """ return type(name, (Turtle,), {}) def translate_methods(cls, translations): """ Creates aliases for method names. """ for method, aliases in translations.items(): func = getattr(cls, method) for alias in aliases: setattr(cls, alias, func)
import { Component } from '@angular/core'; import { TuneBookService, FilterSettings } from './business/index'; @Component({ moduleId: module.id, selector: 'etb-filter-text', templateUrl: 'filter-text.component.html', styleUrls: ['filter-text.component.css'] }) export class FilterTextComponent { filterSettings: FilterSettings; constructor(public tuneBookService: TuneBookService) { this.filterSettings = this.tuneBookService.<API key>(); } }
<!DOCTYPE html> <html> <head> <title>Peter Jahnes</title> <link rel="stylesheet" type="text/css" href="./style.css"> </head> <body> <div id = "message"> <h1><a href = "http: <h1 id = "link"><a href = "http: </div> </body> </html>