text:
layout: post
title: Java Core References
categories: [language]
tags: [java, j2se]
description: the collection of Java Core relate articles.
---

## 1. Language

### Object

* [Object clone](http://java-questions.com/Cloning-interview-questions.html)
  * shallow clone
    * Object.clone/Cloneable - Bloch: Item 10: Override Clone Judiciously
    * [commons-beanutils BeanUtils](http://commons.apache.org/proper/commons-beanutils/javadocs/v1.8.3/apidocs/index.html)
    * [Spring BeanUtils](http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/beans/BeanUtils.html)
  * deep clone
    * ObjectOutputStream/ObjectInputStream
    * [commons-lang SerializationUtils](http://commons.apache.org/proper/commons-lang/javadocs/api-release/org/apache/commons/lang3/SerializationUtils.html)
    * [Java Deep Cloning Library](http://stackoverflow.com/questions/2156120/java-recommended-solution-for-deep-cloning-copying-an-instance)
* [hashcode/equals](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode%28%29)
* [wait/notify/notifyAll](http://tutorials.jenkov.com/java-concurrency/thread-signaling.html)
  * [Wait() and notify() methods in java - Definition, 8 key features, solving consumer producer problem with & without these methods and consequences of not using wait() and notify() methods.](http://www.javamadesoeasy.com/2015/03/wait-and-notify-methods-definition-8.html)

### Class

* [Inner/Nested Class](http://viralpatel.net/blogs/inner-classes-in-java/)
  * Inner Class
    * Local Inner Class
    * Anonymous Inner Class
  * Static Inner Class

### Classloading

* [diagram: Classloaders](http://www2.sys-con.com/itsg/virtualcd/java/archives/0808/chaudhri/fig1.jpg)
  * Bootstrap classloader
  * Extensions Classloader
  * System classloader
  * User-defined classloader
* [insidejvm2: The Class Loader Subsystem](http://www.artima.com/insidejvm/ed2/jvm4.html)
  ![image](http://www.artima.com/insidejvm/ed2/images/fig7-1.gif)
  1. Loading: finding and importing the binary data for a type
  2. Linking
    * Verification: ensuring the correctness of the imported type
    * Preparation: allocating memory for class variables and initializing the memory to default values
    * Resolution: transforming symbolic references from the type into direct references.
  3. Initialization: invoking Java code that initializes class variables to their proper starting values.
* [insidejvm2: The Lifetime of a Type](http://www.artima.com/insidejvm/ed2/lifetype.html)
  * Loading, Linking, Initialization
  * [The Lifetime of an Object](http://www.artima.com/insidejvm/ed2/lifetype5.html)
  * [Unloading of Types](http://www.artima.com/insidejvm/ed2/lifetype6.html)

### Collections

### Generic

### String

* [Oracle Tunes Java's Internal String Representation](http://www.infoq.com/news/2013/12/Oracle-Tunes-Java-String)

#### Regex

* [SO: Greedy vs. Reluctant vs. Possessive Quantifiers](http://stackoverflow.com/questions/5319840/greedy-vs-reluctant-vs-possessive-quantifiers)
* [What is the difference between `Greedy` and `Reluctant` regular expression quantifiers?](http://stackoverflow.com/questions/1139171/what-is-the-difference-between-greedy-and-reluctant-regular-expression-quant)
* Online RegEx tester
  * http://myregexp.com
  * http://regexr.com

### Reflection

* [Java Reflection: Private Fields and Methods](http://tutorials.jenkov.com/java-reflection/private-fields-and-methods.html)
* Dynamic Proxy
  * [Java深度历险(七)——Java反射与动态代理](http://www.infoq.com/cn/articles/cf-java-reflection-dynamic-proxy)
  * [Java 动态代理机制分析及扩展,第 1 部分](http://www.ibm.com/developerworks/cn/java/j-lo-proxy1/index.html)
  * [Java 动态代理机制分析及扩展,第 2 部分](http://www.ibm.com/developerworks/cn/java/j-lo-proxy2/index.html)
  * [Spring AOP: Dynamic Proxies vs. CGLib proxies](http://insufficientinformation.blogspot.com/2007/12/spring-dynamic-proxies-vs-cglib-proxies.html)

### [Threads](https://dzone.com/articles/threads-top-80-interview)/Concurrency

* [Threads implement their own stack - demonstration using program and diagram](http://www.javamadesoeasy.com/2015/03/threads-implement-their-own-stack.html)
  ![image](https://lh6.googleusercontent.com/_svC5M0EsqxhAF4s3scoPSyh7ssKqA0SQH3ipHeksBMAll_d72w_abuyQ766i8edOFkWU6PQm5x9OZ1Xc3qT_wMsoy6YFpQSO9VnUWYfJgEDLR8dklnt_ndlFd7_hXQa8xEkfe0)
* [Thread states/ Thread life cycle in java](http://www.javamadesoeasy.com/2015/03/thread-states-thread-life-cycle-in-java.html)
  ![image](https://lh4.googleusercontent.com/oR0_liUxjMnfgFS-fSuc0x2vCCPLQ0Vdw6w2rBVGloaE_84tRNprqNJEJiyI1unMY8Vpj2CDK9GiQGy03_RmteRz-aM31iIQcZsVZhIH2cLrne_5nY9miXKDmQqEHdY60_WopC0)
* [Lock Contention](https://www.javacodegeeks.com/2014/11/multithreading-concurrency-interview-questions-answers.html)
  > Lock contention occurs, when two or more threads are competing in the acquisition of a lock. The scheduler has to decide whether it lets the thread, which has to wait sleeping and performs a context switch to let another thread occupy the CPU, or if letting the waiting thread busy-waiting is more efficient. Both ways introduce idle time to the inferior thread.
  In some cases lock contention can be reduced by applying one of the following techniques:
    * The scope of the lock is reduced.
    * The number of times a certain lock is acquired is reduced (lock splitting).
    * Using hardware supported optimistic locking operations instead of synchronization.
    * Avoid synchronization where possible.
    * Avoid object pooling.
* [insidejvm2: Thread Synchronization](http://www.artima.com/insidejvm/ed2/threadsynch.html)
* synchronized
  * [Synchronized vs Lock Performance](http://architects.dzone.com/articles/synchronized-vs-lock-0)
* volatile
  * [聊聊并发(一)——深入分析Volatile的实现原理](http://www.infoq.com/cn/articles/ftf-java-volatile)
  * [Volatile keyword in java- difference between synchronized and volatile, 10 key points about volatile keyword, why volatile variables are not cached in memory](http://www.javamadesoeasy.com/2015/03/volatile-keyword-in-java-difference.html)
* [Coordinating threads with CountDownLatch](http://www.javamex.com/tutorials/threads/CountDownLatch.shtml)
* [CyclicBarrier: concordinating the stages of a multithreaded operation](http://www.javamex.com/tutorials/threads/CyclicBarrier.shtml)
* Collections
  * ConcurrentHashMap
    * [聊聊并发(四)——深入分析ConcurrentHashMap](http://www.infoq.com/cn/articles/ConcurrentHashMap)
    * [Java并发编程之ConcurrentHashMap](http://www.goldendoc.org/2011/06/juc_concurrenthashmap/)
    * [探索 ConcurrentHashMap 高并发性的实现机制](http://www.ibm.com/developerworks/cn/java/java-lo-concurrenthashmap/index.html)
* Fork/Join
  * [An Introduction to the Fork / Join Framework](http://java.dzone.com/articles/javas-fork-join-framework)
  * [A walkthrough for the fork/join framework introduced in Java SE 7](http://kalali.me/a-walk-through-the-forkjoin-api-introduced-in-java-se-7/)
  * [应用 fork-join 框架,第 1 部分: 学习如何使用 Java 7 中的 fork-join 框架实现细粒度并行性](http://www.ibm.com/developerworks/cn/java/j-jtp11137.html)
  * [应用 fork-join 框架,第 2 部分: 用 Java 7 中的 ParallelArray 类加速排序和搜索](http://www.ibm.com/developerworks/cn/java/j-jtp03048.html)
  * [JDK 7 中的 Fork/Join 模式](http://www.ibm.com/developerworks/cn/java/j-lo-forkjoin/index.html)
  * [Java Fork/Join Example](http://www.javacreed.com/java-fork-join-example/)

### try-catch-finally

* [finally explained - common questions, uses, etc.](http://geekexplains.blogspot.com/2008/06/finally-explained-common-questions-uses.html)
* [Playing with try-catch-finally in Java. Intersting scenarios](http://geekexplains.blogspot.com/2008/11/playing-with-try-catch-finally-in-java.html)
* [finally contd.: an interesting try-catch-finally scenario](http://geekexplains.blogspot.com/2009/01/finally-contd-interesting-try-catch.html)

### Security

* KeyStore
  * [Common Java Keytool commands](http://nl.globalsign.com/en/support/ssl+certificates/java/java+based+webserver/keytool+commands/)
* https
  * [The First Few Milliseconds of an HTTPS Connection](http://www.infoq.com/articles/HTTPS-Connection-Jeff-Moser)

### Java 7

* NIO2
  * [Introducing NIO.2 (JSR 203) Part 1: What are new features?](http://kalali.me/introducing-nio-2-jsr-203-part-1-what-are-new-features/)
  * [Introducing NIO.2 (JSR 203) Part 2: The Basics](http://kalali.me/introducing-nio-2-jsr-203-part-2-the-basics/)
  * [Introducing NIO.2 (JSR 203) Part 3: File System Attributes and Permissions support in NIO.2](http://kalali.me/introducing-nio-2-jsr-203-part-3-file-system-attributes-and-permissions-support-in-nio-2/)
  * [Introducing NIO.2 (JSR 203) Part 4: Changing File System Attributes and Permissions](http://kalali.me/introducing-nio-2-jsr-203-part-4-changing-file-system-attributes-and-permissions/)
  * [Introducing NIO.2 (JSR 203) Part 5: Watch Service and Change Notification](http://kalali.me/introducing-nio-2-jsr-203-part-5-watch-service-and-change-notification/)
  * [Introducing NIO.2 (JSR 203) Part 6: Filtering directory content and walking over a file tree](http://kalali.me/introducing-nio-2-jsr-203-part-6-filtering-directory-content-and-walking-over-a-file-tree/)
  * [An NIO.2 primer, Part 1: The asynchronous channel APIs](http://www.ibm.com/developerworks/java/library/j-nio2-1/?ca=drs-)
  * [An NIO.2 primer, Part 2: The file system APIs](http://www.ibm.com/developerworks/java/library/j-nio2-2/?ca=drs-)
  * [Java 7: NIO.2 I/O operations on asynchronous channels are not atomic](Java 7: NIO.2 I/O operations on asynchronous channels are not atomic)
  * [Java 7: Closing NIO.2 file channels without loosing data](http://niklasschlimm.blogspot.com/2012/05/java-7-9-nio2-file-channels-on-test.html)

### Java 8

* Lambda
  * [Lambda Expressions](http://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
  * [State of the Lambda](http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-final.html)
  * [State of the Lambda: Libraries Edition](http://cr.openjdk.java.net/~briangoetz/lambda/lambda-libraries-final.html)
* Multitenant JVM
  * [Introduction to Java multitenancy](http://www.ibm.com/developerworks/java/library/j-multitenant-java/index.html)
* Static and Default Methods on interfaces.
  * [Default Methods](http://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html)
  * [Abstract Class Versus Interface in the JDK 8 Era](http://java.dzone.com/articles/abstract-class-versus)
  * [Why does Java 8 not allow non-public default methods?](http://stackoverflow.com/a/27369217/4867232)
* Stream
  * [Java 8 Iterable.forEach() vs foreach loop](http://stackoverflow.com/a/20177092/4867232)

### Java 9

* [jagsaw](http://openjdk.java.net/projects/jigsaw/)
* [Java 9, OSGi and the Future of Modularity](https://www.infoq.com/articles/java9-osgi-future-modularity)

## 2. JVM

### GC

* [insidejvm2: Garbage Collection](http://www.artima.com/insidejvm/ed2/gc.html)
  * Reference Counting Collectors
  * Tracing Collectors
  * Compacting Collectors
  * Copying Collectors
  * Generational Collectors
  * Adaptive Collectors
* [GC Algorithms: Implementations](https://plumbr.eu/handbook/garbage-collection-algorithms-implementations)
  * The Serial GC
  * The Parallel GC: Throughput Matters
  * Concurrent Mark-Swap (CMS) GC: Latency Matters
    * [Java VM Options You Should Always Use in Production](http://blog.sokolenko.me/2014/11/javavm-options-production.html)
  * Garbage First (G1) GC
    * [解析JDK 7的Garbage-First收集器](http://www.infoq.com/cn/articles/jdk7-garbage-first-collector)
    * [Presentation: Deep Dive into G1 Garbage Collector](http://www.infoq.com/presentations/java-g1)
    * [G1: One Garbage Collector To Rule Them All](http://www.infoq.com/articles/G1-One-Garbage-Collector-To-Rule-Them-All)
* Generational GC
  * [Java theory and practice: Garbage collection in the HotSpot JVM: Generational and concurrent garbage collection](http://www.ibm.com/developerworks/library/j-jtp11253/)
  * [Useful JVM Flags – Part 5 (Young Generation Garbage Collection)](https://blog.codecentric.de/en/2012/08/useful-jvm-flags-part-5-young-generation-garbage-collection/)
  * [Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide: Sizing the Generations](https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/sizing.html)
* [Java深度历险(四)——Java垃圾回收机制与引用类型](http://www.infoq.com/cn/articles/cf-java-garbage-references)
* [Garbage Collection in the Java HotSpot Virtual Machine](http://www.devx.com/Java/Article/21977)
* [Minor GC vs Major GC vs Full GC](https://plumbr.eu/blog/garbage-collection/minor-gc-vs-major-gc-vs-full-gc)
* [Java technology, IBM style: Garbage collection policies, Part 1: Differing policies provide flexibility](http://www.ibm.com/developerworks/library/j-ibmjava2/)
* [InfoQ: Java Garbage Collection Distilled](http://www.infoq.com/articles/Java_Garbage_Collection_Distilled)
* [Understanding Java Garbage Collection](http://www.cubrid.org/blog/dev-platform/understanding-java-garbage-collection/)
* Tuning
  * JDK Official [Docs](http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/sizing.html#sizing_generations) [Sizing the Generations](https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/sizing.html)
    * [Adjusting Generation Sizes](http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html#0.0.0.0.Adjusting%20Generation%20Sizes%7Coutline)
    * [More On The Incredible Shrinking JVM Heap](https://stopcoding.wordpress.com/2010/04/12/more-on-the-incredible-shrinking-jvm-heap/)
    * [What's the basis for Ergonomics setting the value of MaxNewSize](http://stackoverflow.com/q/22455562)
  * [Garbage Collection Optimization for High-Throughput and Low-Latency Java Applications](https://engineering.linkedin.com/garbage-collection/garbage-collection-optimization-high-throughput-and-low-latency-java-applications)
  * [Tuning Garbage Collection for Mission-Critical Java Applications](http://blog.mgm-tp.com/2013/03/garbage-collection-tuning/)
  * [Tuning Java Garbage Collection for Web Services](https://engineering.linkedin.com/26/tuning-java-garbage-collection-web-services)
  * [UseAdaptiveSizePolicy与CMS垃圾回收同时使用导致的JVM报错](http://www.cnblogs.com/moonandstar08/p/5751175.html)

### VM memory

* [jvmspec: Runtime Data Areas](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.5)
  * The pc Register
  * Java Virtual Machine Stacks
    * [insidejvm2: The Java Stack](http://www.artima.com/insidejvm/ed2/jvm8.html)
    * [insidejvm2: The Stack Frame](http://www.artima.com/insidejvm/ed2/jvm8.html)
  * Heap
    * [insidejvm2: The Heap](http://www.artima.com/insidejvm/ed2/jvm6.html)
  * Method Area
  * Runtime Constant Pool
  * Native Method Stacks
    * [insidejvm2: Native Method Stacks](http://www.artima.com/insidejvm/ed2/jvm9.html)
* [jvmspec: Frames](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.6)
  * Local Variables
  * Operand Stacks
  * Dynamic Linking
  * Normal Method Invocation Completion
  * Abrupt Method Invocation Completion
* [insidejvm2: The Lifetime of a Type](http://www.artima.com/insidejvm/ed2/lifetype.html)
* [insidejvm2: The Linking Model](http://www.artima.com/insidejvm/ed2/linkmod.html)
* [Understand Stack and Heap](http://www.itcsolutions.eu/2011/02/06/tutorial-java-8-understand-stack-and-heap/)
  * ![diagram: CallStack.gif](http://www.itcsolutions.eu/wp-content/uploads/2011/02/CallStack.gif)
  * ![diagram: StackHeapValues.png](http://www.itcsolutions.eu/wp-content/uploads/2011/02/StackHeapValues.png)
* [video: how memory is allocated in stack & heap](http://www.youtube.com/watch?feature=player_embedded&v=VQ4eZw6eVtQ)
* [From Java code to Java heap: Understanding and optimizing your application's memory usage](http://www.ibm.com/developerworks/java/library/j-codetoheap/index.html)
* [5 Tips for Proper Java Heap Size](http://architects.dzone.com/articles/5-tips-proper-java-heap-size)
* PermGen
  * [Java 7 features – PermGen removal](http://javaeesupportpatterns.blogspot.com/2011/10/java-7-features-permgen-removal.html)
    * [Java 7 Questions & Answers](http://javaeesupportpatterns.blogspot.com/2011/10/java-7-features-permgen-removal.html)
    * [Java Heap space - HotSpot VM](http://javaeesupportpatterns.blogspot.com/2011/08/java-heap-space-hotspot-vm.html)
  * [Java 8: From PermGen to Metaspace](http://java.dzone.com/articles/java-8-permgen-metaspace)

# 2. Performance Tuning Tips

## Identify thread cunsuming CPU

* [Figure out why is JAVA eating CPU?](http://javadrama.blogspot.com/2012/02/why-is-java-eating-my-cpu.html)
* [Identify Java code consuming high CPU in Linux (linking JVM thread and Linux PID)](https://blogs.manageengine.com/application-performance-2/appmanager/2011/02/09/identify-java-code-consuming-high-cpu-in-linux-linking-jvm-thread-and-linux-pid.html)
* [Which Java thread consumes my CPU?](http://www.nurkiewicz.com/2012/08/which-java-thread-consumes-my-cpu.html)


text: log base framework

redpajama_set_name: RedPajamaGithub


text:
<!doctype html>

        <title>ToDo</title>

        <link rel="stylesheet" href="<?php echo base_url('public/css/bootstrap.min.css');?>"/>
        <link rel="stylesheet" href="<?php echo base_url('public/css/style.css');?>"/>
        <link rel="icon" type="image/x-icon" href="<?php echo base_url('public/img/favicon.ico'); ?>">

            <a href="<?php echo base_url('task/logout'); ?>" class="navbar-brand glyphicon glyphicon-off">
            <button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">

            </button>

<a href="<?php echo base_url('task'); ?>">home

                        social media

twitter

facebook

yahoo

about

contact


text:
This document should serve as a guide to breaking changes for users moving from code using the v8.x.x version of the SDK to v9.x.x.

![](https://media.giphy.com/media/3o72FfM5HJydzafgUE/giphy.gif)

### Service changes

### All Services
* The `version` of a service can be retrieved with `getVersion()`
* The `version` of a service can be set with `setVersion()`

### Assistant v1 Service

* Added function `bulkClassify()`: Identify intents and entities in multiple user utterances.

### Assistant v1 Models

#### Models Added

`BulkClassifyOptions`, `BulkClassifyOutput`, `BulkClassifyResponse`, `BulkClassifyUtterance`, `DialogNodeContext`, `DialogNodeOutputConnectToAgentTransferInfo`, `DialogNodeOutputGenericDialogNodeOutputResponseTypeConnectToAgent`, `DialogNodeOutputGenericDialogNodeOutputResponseTypeImage`, `DialogNodeOutputGenericDialogNodeOutputResponseTypeOption`, `DialogNodeOutputGenericDialogNodeOutputResponseTypePause`, `DialogNodeOutputGenericDialogNodeOutputResponseTypeSearchSkill`, `DialogNodeOutputGenericDialogNodeOutputResponseTypeText`, `RuntimeResponseGenericRuntimeResponseTypeConnectToAgent`, `RuntimeResponseGenericRuntimeResponseTypeImage`, `RuntimeResponseGenericRuntimeResponseTypeOption`, `RuntimeResponseGenericRuntimeResponseTypePause`, `RuntimeResponseGenericRuntimeResponseTypeSuggestion`, `RuntimeResponseGenericRuntimeResponseTypeText`

#### Models Removed

`DialogSuggestionOutput`, `DialogSuggestionResponseGeneric`, `SystemResponse`

#### Model Properties Changed

`Context`
* Added Builder
* `System` property type changed from `SystemResponse` to `Map<String, Object>`

`Counterexample`, `CreateEntity`, `CreateIntent`, `CreateValue`, `Example`, `Synonym`, `Value`
* `created`, `updated` properties are read only

`CreateDialogNodeOptions`
* `context` property type changed from `Map<String, Object>` to `DialogNodeContext`

`DialogNode`
* `context` property type changed from `Map<String, Object>` to `DialogNodeContext`
* `disabled`, `created` and `updated` properties are read only

`DialogNodeOutput`
* Added Builder
* Added `integrations` property with getter and setter

`DialogNodeOutputGeneric`,
* Added discriminator
* Removed Builder
* Added read only properties `agentAvailable`, `AgentUnavailable`, and `transferInfo`

`DialogSuggestion`
* `output` property type changed from `DialogSuggestionOutput` to `Map<String, Object>`

`ListCounterExamplesOptions`, `ListDialogNodesOptions`, `ListEntitiesOptions`, `ListExamplesOptions`, `ListIntentsOptions`, `ListSynonymsOptions`, `ListValuesOptions`, `ListWorkspacesOptions`
* `includeCount` property added with setter and getter

`MessageInput`
* Added Builder
* Changed `suggestedText` and `originalText` properties to read only

`MessageRequest`
* Changed `actions` property to read only

`OutputData`
* Added Builder

`RuntimeResponseGeneric`,
* Added discriminator
* Changed `ResponseType` interface use only TEXT
* Removed Builder
* Added read only properties `agentAvailable`, `AgentUnavailable`, and `transferInfo`

`UpdateDialogNodeOptions`
* Changed `newContext` property type from `Map<String, Object>` to `DialogNodeContext`

### Assistant v2 Service

* Added function `bulkClassify()`: Identify intents and entities in multiple user utterances.

### Assistant v2 Models

#### Models Added

`BulkClassifyOptions`, `BulkClassifyOutput`, `BulkClassifyResponse`, `BulkClassifyUtterance`,
`DialogNodeOutputConnectToAgentTransferInfo`, `RuntimeResponseGenericRuntimeResponseTypeConnectToAgent`, `RuntimeResponseGenericRuntimeResponseTypeImage`, `RuntimeResponseGenericRuntimeResponseTypeOption`, `RuntimeResponseGenericRuntimeResponseTypePause`, `RuntimeResponseGenericRuntimeResponseTypeSearch`, `RuntimeResponseGenericRuntimeResponseTypeSuggestion`, `RuntimeResponseGenericRuntimeResponseTypeText`

#### Models Removed

`MessageContextSkills`

#### Model Properties Changed

`MessageContext`, `MessageContextStateless`
* Changed `skills` property type from `MessageContextSkills` to `Map<String, MessageContextSkill>`

`MessageContextGlobal`
* Changed `sessionId` property to read only

`MessageContextSkill`
* Changed `system` property type from `Map<String, Object>` to `MessageContextSkillSystem`

`MessageContextSkillSystem`
* Added Builder

`RuntimeResponseGeneric`
* Added discriminator
* Removed Builder
* Added read only properties `agentAvailable`, `AgentUnavailable`, and `transferInfo`

### Compare Comply v1 Service

* No changes

### Compare Comply v1 Models

#### Model Properties Changed

`Category`, `TypeLabel`
* Added `modification` property

`ListBatchesOptions`
* Removed Builder

`ListFeedbackOptions`
* Removed `before` and `after` properties

`OriginalLabelsOut`, `UpdatedLabelsOut`
* Removed `modification` property

### Discovery v1 Service

* No changes

### Discovery v1 Models

#### Models Removed

`NluEnrichmentCategories`

#### Model Properties Changed

`Configuration`
* Changed `configurationId`, `created`, and `updated` properties to read only

`Credentials`
* Changed `credentialId` property to read only

`EventData`
* Changed `queryId` property to read only

`NluEnrichmentFeatures`
* Changed `categories` property type from `NluEnrichmentCategories` to `Map<String, Object>`

### Discovery v2 Service

* Added function `analyzeDocument()`: Process a document using the specified collection's settings and return it for realtime use. - Currently CP4D only

### Discovery v2 Models

#### Models Added

`AnalyzedDocument`, `AnalyzeDocumentOptions`, `AnalyzedResult`

#### Models Removed

`QueryNoticesResult`

#### Model Properties Changed

`CollectionDetails`
* Changed `collectionId` and `created` properties to read only

`TrainingExample`
* Changed `created` and `updated` properties to read only

`TrainingQuery`
* Changed `created`, `queryId` and `updated` properties to read only

### Language Translator v3 Service

* No changes

### Language Translator v3 Models

#### Model Properties Changed

`ListDocumentsOptions`, `ListIdentifiableLanguagesOptions`, `ListLanguagesOptions`
* Removed Builder

### Natural Language Classifier v1 Service

* No changes

### Natural Language Classifier v1 Models

#### Model Properties Changed

`ListClassifiersOptions`
* Removed Builder

### Natural Language Understanding v1 Service

* No changes

### Natural Language Understanding v1 Models

#### Models Added

`FeaturesResultsMetadata`

#### Models Removed

`MetadataOptions`, `AnalysisResultsMetadata`

#### Model Properties Changed

`AnalysisResults`
* Changed `metadata` property type from `AnalysisResultsMetadata` to `FeaturesResultsMetadata`

`Features`
* Changed `metadata` property type from `MetadataOptions` to `Map<String, Object>`

`ListModelsOptions`
* Remove Builder

### Personality Insights v3 Service

* Added deprecation notice

### Personality Insights v3  Models

* No changes

### Speech To Text v1 Service

* `recognizeUsingWebSocket()`: Changed `recognizeOptions` parameter type from `RecognizeOptions` to `RecognizeWithWebsocketsOptions`

### Speech To Text v1 Models

#### Models Added

`RecognizeWithWebsocketsOptions`

#### Model Properties Changed

`CheckJobsOptions`, `ListModelOptions`
* Removed Builder

`RecognizeOptions`
* Removed `interimResults`, `processingMetrics`, `processingMetricsInterval`
properties (Moved to `RecognizeWithWebsocketsOptions`)

### Text to Speech v1 Service

* No changes

### Text to Speech v1 Models

#### Models Added

`CreateCustomModelOptions`, `CustomModel`, `CustomModels`, `DeleteCustomModelOptions`, `GetCustomModelOptions`, `ListCustomModelsOptions`, `UpdateCustomModelOptions`

#### Models Removed

`CreateVoiceModelOptions`, `DeleteVoiceModelOptions`, `GetVoiceModelOptions`, `ListVoiceModelsOptions`, `UpdateVoiceModelOptions`, `VoiceModel`, `VoiceModels`

#### Model Properties Changed

`ListVoicesOptions`
* Remove Builder

`Voice`
* Change return type of `getCustomization()` from `VoiceModel` to `CustomModel`

### Tone Analyzer v3 Service

* No changes

### Tone Analyzer v3 Models

* No changes

### Visual Recognition v3 Service

* Added deprecation notice

### Visual Recognition v3 Models

* No changes

### Visual Recognition v4 Service

* Added deprecation notice

### Visual Recognition v4 Models

#### Models Added

`CollectionTrainingStatus`, `ObjectDetail`

#### Models Removed

#### Model Properties Changed

`Collection`
* Changed `trainingStatus` property type from `TrainingStatus` to `CollectionTrainingStatus`

`CreateCollectionOptions`, `UpdateCollectionOptions`
* Added `trainingStatus` property

`GetTrainingUsageOptions`
* Changed `startTime` and `endTime` property type from `String` to `Date`

`ListCollectionsOptions`
* Remove Builder

`ObjectDetail`
* Changed `location` property type from `Location` to `ObjectDetailLocation`

`UpdateObjectMetadata`
* Changed `count` property to read only


text:
//
//  MHTextViewLayout.h
//  MHTextView
//
//  Created by Marc Haisenko on 20.07.14.
//  Copyright (c) 2014 Marc Haisenko. All rights reserved.
//

#import <UIKit/UIKit.h>

@class MHTextView;

/** Layout specifications for an MHTextView.
 */
@protocol MHTextViewLayout <NSObject>

/** Returns the frames for the given MHTextView bounds.

 Returns an array of @c MHTextViewFrame @c instances.
 */
- (NSArray *)framesWithTextViewBounds:(CGRect)bounds;

@optional

/** Returns the required size of the text view.

 The text view calls this method when it was asked for its @c intrinsicContentSize @c.
 Depending on the layout's capabilities and properties, it should either return
 an appropriate size or the text view's @c bounds @c.
 */
- (CGSize)intrinsicTextViewSize:(MHTextView *)textView;

@end


text:
var Thermostat = function() {
  this.temp = 20;
  this.isPowerSaveOn = true;
};

Thermostat.prototype.temperature = function() {
  return this.temp + ' °C';
};

Thermostat.prototype.increaseTemperature = function() {
  if (this.temp >= 32 && this.isPowerSaveOn == false) {
    this.temp = 32;
  } else if (this.temp >= 25 && this.isPowerSaveOn == true) {
    this.temp = 25;
  } else {
    this.temp++;
  }
};

Thermostat.prototype.decreaseTemperature = function() {
  if (this.temp <= 10) {
    return this.temp;
  } else {
    this.temp--;
  }
};

Thermostat.prototype.powerSave = function() {
   return this.isPowerSaveOn;
 };

Thermostat.prototype.switchMode = function() {
  if (this.isPowerSaveOn === true) {
    this.isPowerSaveOn = false;
  } else {
    this.isPowerSaveOn = true;
  }

  if (this.temp > 25) {
    this.temp = 25;
  }
};

Thermostat.prototype.resetTemperature = function() {
  return this.temp = 20;
};

Thermostat.prototype.colorChange = function() {
  if (this.temp < 18) {
    return 'green';
  } else if (this.temp > 25) {
    return 'red';
  } else {
    return 'orange';
  }
};


text:
=============
django-updown
=============

.. image:: https://secure.travis-ci.org/weluse/django-updown.png?branch=master
    :alt: Travis CI build status
    :target: http://travis-ci.org/weluse/django-updown

``django-updown`` is a simple Django application for adding youtube like up and down voting.

---------
Changelog
---------

**0.5**:

- Fixed DateTimeField RuntimeWarning (thanks to `yurtaev
  <https://github.com/yurtaev>`_)
- Tests are using Django 1.4.10 now

**0.4**:

- Usage of ``AUTH_USER_MODEL`` instead of ``auth.models.User``
  (thanks to `timbutler <https://github.com/timbutler>`_)

**0.3**:

- Removed south as dependency
- Small cleanups (thanks to `gwrtheyrn <https://github.com/gwrtheyrn>`_)

**0.2**:

- Updated related_name to avoid namespace clashes.
- Added south as dependency

-----
Usage
-----
Add ``"updown"`` to your ``INSTALLED_APPS`` then just add a ``RatingField`` to
your existing model and go::

    from django.db import models
    from updown.fields import RatingField

    class Video(models.Model):
        # ...other fields...
        rating = RatingField()

You can also allow the user to change his vote::

    class Video(models.Model):
        # ...other fields...
        rating = RatingField(can_change_vote=True)

Now you can write your own view to submit ratings or use the predefinded::

    from updown.views import AddRatingFromModel

    urlpatterns = patterns("",
        url(r"^(?P<object_id>\d+)/rate/(?P<score>[\d\-]+)$", AddRatingFromModel(), {
            'app_label': 'video',
            'model': 'Video',
            'field_name': 'rating',
        }, name="video_rating"),
    )

To submit a vote just go to ``video/<id>/rate/(1|-1)``. If you allowed users to
change they're vote, they can do it with the same url.

If you're using Django version prior to 1.5, you have to add
``AUTH_USER_MODEL = 'auth.User'`` to your settings.

----------------
Troubleshooting
----------------
If you previously used this app you may get to a point where migrations are
failing.
Try::

    ./manage.py migrate updown --fake 0001

to skip the initial migration. After this apply the migrations again::

    ./manage.py migrate updown

------
Thanks
------
Thanks a lot to ``django-ratings`` for the inspiring code


text:
<?php
namespace Google\Service\Shopping;

class Product extends \Google\Collection
{
  protected $categoriesType = '\Google\Service\Shopping\ShoppingModelCategoryJsonV1';
  protected $categoriesDataType = 'array';
  protected $debugType = '\Google\Service\Shopping\ShoppingModelDebugJsonV1';
  protected $debugDataType = '';
  public $id;
  public $kind;
  protected $productType = '\Google\Service\Shopping\ShoppingModelProductJsonV1';
  protected $productDataType = '';
  protected $recommendationsType = '\Google\Service\Shopping\ShoppingModelRecommendationsJsonV1';
  protected $recommendationsDataType = 'array';
  public $requestId;
  public $selfLink;

  public function setCategories($categories)
  {
    $this->categories = $categories;
  }

  public function getCategories()
  {
    return $this->categories;
  }

  public function setDebug(\Google\Service\Shopping\ShoppingModelDebugJsonV1 $debug)
  {
    $this->debug = $debug;
  }

  public function getDebug()
  {
    return $this->debug;
  }

  public function setId($id)
  {
    $this->id = $id;
  }

  public function getId()
  {
    return $this->id;
  }

  public function setKind($kind)
  {
    $this->kind = $kind;
  }

  public function getKind()
  {
    return $this->kind;
  }

  public function setProduct(\Google\Service\Shopping\ShoppingModelProductJsonV1 $product)
  {
    $this->product = $product;
  }

  public function getProduct()
  {
    return $this->product;
  }

  public function setRecommendations($recommendations)
  {
    $this->recommendations = $recommendations;
  }

  public function getRecommendations()
  {
    return $this->recommendations;
  }

  public function setRequestId($requestId)
  {
    $this->requestId = $requestId;
  }

  public function getRequestId()
  {
    return $this->requestId;
  }

  public function setSelfLink($selfLink)
  {
    $this->selfLink = $selfLink;
  }

  public function getSelfLink()
  {
    return $this->selfLink;
  }
}


text:
'use strict';

var normalizeOptions = require('es5-ext/object/normalize-options');

// This module is used by user, business-process-submitted and inspector routes.
module.exports = function (uniqueKey/*, options*/) {
	var options    = normalizeOptions(arguments[1])
	  , collection = options.collection || 'userApplicable';

	if (this.businessProcess.isClosed) {
		if (!this.businessProcess.isApproved) return false;

		this.businessProcess.certificates.dataSnapshot.resolved.some(function (data) {
			if (data.uniqueKey === uniqueKey) {
				this.dataSnapshot = data;
				return true;
			}
		}, this);
		if (!this.dataSnapshot) return false;
	}

	this.businessProcess.certificates[collection].some(function (certificate) {
		if (certificate.key === uniqueKey) {
			this.document = certificate;
			return true;
		}
	}, this);

	if (!this.businessProcess.isClosed && !this.document) return false;

	this.documentKind = 'certificate';
	this.documentUniqueKey = uniqueKey;
	this.documentUniqueId = this.businessProcess.__id__ + '/' + this.documentKind + '/' + uniqueKey;
	return true;
};


text:
<?php

namespace MyCompany\Ecomm\Model;

/**
 * Represents an Order
 *
 * @storage.table Orders
 */
class Order extends \QModel
{
	use Order_GenTrait, ExposeCRUD;
	/**
	 * @var string|array
	 */
	public static $ModelEntity = "*,Items.*";
	/**
	 * We need to query a bit more data for an order
	 * The name of the property or the implementation are not a frame standard
	 *
	 * @var string
	 */
	public static $QuerySelector = "*,Items.{*,Product.*}";
	/**
	 * We specify how we load things (can be any property).
	 * Notice we don't go within the product
	 *
	 * The name of the property or the implementation are not a frame standard
	 *
	 * @var string
	 */
	public static $SaveSelector = "*,Items.{*,Product}";
	/**
	 * What we should delete when we delete an Order
	 *
	 * The name of the property or the implementation are not a frame standard
	 *
	 * @var string
	 */
	public static $DeleteSelector = "*,Items.{*,Product}";
	/**
	 * The Id
	 *
	 * @var integer
	 */
	public $Id;
	/**
	 * Date
	 * @storage.type datetime
	 * @var datetime
	 */
	public $Date;
	/**
	 * Customer
	 *
	 * @fixValue trim
	 * @validation mandatory && min(3)
	 *
	 * @var string
	 */
	public $Customer;
	/**
	 * We will just use the session id for this field
	 *
	 * @fixValue trim
	 * @validation mandatory && min(7)
	 *
	 * @var string
	 */
	public $Responsible;
	/**
	 * The list of items in the order
	 * For optimization we ask for the collection to be One To Many
	 *
	 * @storage.oneToMany
	 *
	 * @validation mandatory
	 *
	 * @var OrderItem[]
	 */
	public $Items;

	/**
	 * Gets the orders listing
	 *
	 * @return Order[]
	 */
	public static function GetListingOrders()
	{
		// This demonstrates a ORM select with Aliases
		// As you can see it's very simple, standard SQL without JOINS
		$query = "SELECT *,
					COUNT(Items.Id) AS ItemsCount,
					SUM(Items.Quantity * Items.UnitPrice) AS ItemsTotal

				WHERE
					Responsible=?
					AND Items IS_A MyCompany\Ecomm\Model\OrderItem

				ORDER BY
					??OBY_Date?<,[Date ?@]
					??OBY_Id?<,[Id ?@]

				GROUP BY Id
				LIMIT 50";

		// load data
		$data = self::QueryAll($query, [\QApp::GetController()->sessionId, "OBY_Date" => "DESC", "OBY_Id" => "ASC"]);

		// if we don't have any test data for the current session Id we create it
		if ((!$data) || (!count($data)))
		{
			self::PopulateTestData();
			$data = self::QueryAll($query, [\QApp::GetController()->sessionId, "OBY_Date" => "DESC", "OBY_Id" => "ASC"]);
		}

		return $data;
	}

	/**
	 * Gets order details
	 *
	 * @param int $order_id
	 * @return Order
	 */
	public function QueryOrderDetails($order_id)
	{
		$responsible_id = \QApp::GetController()->sessionId;
		// in this sample we use 2 binds, multiple binds must be placed in an array
		return Order::QueryFirst("*,Items.{*,Product.*} WHERE Id=? AND Responsible=? LIMIT 1", [$order_id, $responsible_id]);
	}

	/**
	 * We allow anyone to create an order, or edit one that they own
	 * The api.enable directive allows remote calls to the method
	 *
	 * @api.enable
	 *
	 * @param \MyCompany\Ecomm\Model\Order $order
	 */
	public function saveForCurrentUser()
	{
		$responsible_id = \QApp::GetController()->sessionId;

		// check the data
		if ($this->getId())
		{
			// quick security check
			$db_order = Order::QueryAll("Id,Responsible WHERE Id=? LIMIT 1", $this->getId())->first();
			if (!$db_order)
				throw new \Exception("There is no order with that id in the DB");
			else if ($db_order && ($db_order->Responsible !== $responsible_id))
				throw new \Exception("You do not have access to that order");
		}

		$this->Responsible = $responsible_id;

		$this->save(self::$SaveSelector);
	}

	/**
	 * Deletes the current order
	 *
	 * @throws \Exception
	 */
	public function deleteOrder()
	{
		$responsible_id = \QApp::GetController()->sessionId;

		if (!$this->getId())
			throw new \Exception("Missing order ID");

		// check the data
		// quick security check
		$db_order = Order::QueryAll("Id,Responsible WHERE Id=? LIMIT 1", $this->getId())->first();
		if (!$db_order)
			throw new \Exception("There is no order with that id in the DB");
		else if ($db_order && ($db_order->Responsible !== $responsible_id))
			throw new \Exception("You do not have access to that order");

		$this->Responsible = $responsible_id;

		// make sure we load all the items before delete
		$this->query(self::$DeleteSelector);
		// now delete
		$this->delete(self::$DeleteSelector);

	}

	/**
	 * This is executed inside the COMMIT, immediately after BEGIN TRANSACTION
	 * In our demo we copy prices from Product.Price to the OrderItem.UnitPrice
	 *
	 * @param array $selector
	 * @param int|string $transform_state
	 * @throws Exception
	 */
	public function afterBeginTransaction($selector = null, $transform_state = null)
	{
		// we are only checking for UPDATE & DELETE
		if (!(($transform_state === null) || ($transform_state & \QModel::TransformCreate) || ($transform_state & \QModel::TransformUpdate)))
			return;

		if (!$this->Items)
			throw new \Exception("Missing items");

		$products = new \QModelArray();
		foreach ($this->Items as $item)
			$products[] = $item->Product;

		$products->query("Price");

		foreach ($this->Items as $item)
			$item->UnitPrice = $item->Product->Price;

		// now we call the parent:: to do the default work
		return parent::afterBeginTransaction($selector, $transform_state);
	}

	/**
	 * We create some sample data and link it to the Session Id
	 */
	public static function PopulateTestData()
	{
		// Depending on the model's definition, it is not mandatory to link
		// the data you are saving to the ROOT MODEL, but for this
		// example we will do that to show that you may do multiple opertations in one transaction

		// we get a instance (a new one) to the ROOT MODEL
		$DATA = \QApp::NewData();
		// we prepare the Orders collection
		$DATA->Orders = new \QModelArray();
		// we prepare the Products collection
		$DATA->Products = new \QModelArray();

		$responsible_id = \QApp::GetController()->sessionId;

		// we generate 12 random orders
		for ($o = 0; $o < 12; $o++)
		{
			$order = new Order();
			$order->Date = date('Y-m-d H:i:s', time() - rand(1, 86400 * 30 /* days */));
			$order->Customer = "Customer #".rand(1, 99);
			$order->Responsible = $responsible_id;

			$order->Items = new \QModelArray();

			$no_items = rand(1, 8);
			for ($i = 0; $i < $no_items; $i++)
			{
				$oi = new OrderItem();

				$product_id = rand(1, 99);
				// check if the products exists in the DB, in a production APP we would also begin a transaction here
				// via QApp::GetStorage()->begin()
				$product = Product::QueryAll("Id,Name,Price WHERE Id=?", $product_id)->first();

				if (!$product)
				{
					// we don't have the product, we will create it
					$product = new Product();
					$product->setId($product_id);
					$product->_id = $product_id;
					$product->Name = "Product #".$product_id;
					$product->Price = rand(50, 200) / 10;

					$DATA->Products[] = $product;

					// here we save the product with merge, an id will be linked to it
					$product->merge("Id,Name,Price");
				}

				$oi->Product = $product;
				$oi->Quantity = rand(1, 5);
				// the OrderItem.UnitPrice is a copy from Product.Price in case Product.Price changes
				$oi->UnitPrice = $product->Price;

				$order->Items[] = $oi;
			}

			$DATA->Orders[] = $order;
		}

		// Now we save all the data in one call
		// Notice that you may control what you save
		$DATA->merge("Orders.{*,
						      Items.{*,
									 Product}},
					  Products.{
					            Id,Name,Price}");
	}

}


text:
require 'wargaming_api/world_of_tanks_blitz/tankopedia'

module WargamingApi
  class WargamingApi::WorldOfTanksBlitz::Tankopedia
    class WargamingApi::WorldOfTanksBlitz::Tankopedia::TankopediaInformation < WargamingApi::WorldOfTanksBlitz::Tankopedia

      def initialize
        @application_id = WargamingApi::APP_TOKEN
        @language = 'en'
        @link = 'api.wotblitz.eu/wotb/encyclopedia/info'
      end

      puts 'WorldOfTanksBlitz => Tankopedia -> TankopediaInformation loaded.'
    end
  end
end


text:
This application was developed in the Study Project "Smart Cities" at the Institute for Geoinformatics, University of Muenster.
The idea behind the project is to develop software for the cities of the future. Using the SCRUM software development method, this application was developed by a team of 7 students.
It relates to a server part, which was developed by a second group of students within the study project and can be found here: [https://github.com/chack05/sc16-ephemeral-lbs-server](https://github.com/chack05/sc16-ephemeral-lbs-server).

The project to the concept of opportunistic information sharing, where the inhabitants of a city may share information with other people they meet once they are in range of their mobile phones.

The developers of the project are:
##### ![alt GitHub](http://i.imgur.com/0o48UoR.png") [Heinrich Löwen](https://github.com/heinrichloewen)
##### ![alt GitHub](http://i.imgur.com/0o48UoR.png") [Clara Rendel](https://github.com/crend02)
##### ![alt GitHub](http://i.imgur.com/0o48UoR.png") [Maurin Radtke](https://github.com/MojioMS)
##### ![alt GitHub](http://i.imgur.com/0o48UoR.png") [Saad Sarfraz](https://github.com/saadsarfrazz)
##### ![alt GitHub](http://i.imgur.com/0o48UoR.png") [Apurva Anil Kochar](https://github.com/apurvaakochar)
##### ![alt GitHub](http://i.imgur.com/0o48UoR.png") [Shahzeib Tariq Jaswal](https://github.com/shahzeib)
##### ![alt GitHub](http://i.imgur.com/0o48UoR.png") [Sruthi Ketineni](https://github.com/Sruthiketineni)

This documentation guides through the concepts of the application, the development process as well as the installation and usage of the application.

## Getting Started

The developers of the project came with different programming backgrounds and knowledge, so the initial phase of the project was to some degree used to get familiar with the tools and technologies.

### Github

The decision was made to use a [Github](https://github.com) Repository as version control and code sharing platform. The following graphic was used to explain the concept of git to the developers that had not been working with it before.

![functionality](img/git.png)

### Git Flow

Git Flow is a powerful branching concept for git, which is easy to understand and to learn, and has proofed itself during the project to be indispensable. [This Graph](https://github.com/heinrichloewen/SC-App/network) visualizes how the concept was implemented according to the following simplified graphic.

![functionality](img/git branching.png)

## Installation

This application was mainly developed for the means of the study project, so that it is currently not released into the Google Play Store. There are to ways of installing the application: A developer may clone this repository and deploy the application via Android Studio, whereas a normal user may install the application via a pre-build `happy_share.apk` file.

### Developer

The application was developed with [Android Studio](https://developer.android.com/studio/index.html). The target sdk version was set to *API 23: Android 6.0 (Marshmallow)*, whereas the min sdk version was set to *API 21: Android 5.0 (Lollipop)*. In order to build the application on your own, please make sure to install Android Studio, preferably the latest version, and install the required Android Sdks (Software Development Kits).
After this step, there are two ways of installing the application, whereas both require a preliminary step.

**Preliminary Step**: The application uses external Google services that require an API_KEY.
  1. Go to your [Google Developer Console](https://console.developers.google.com/) and generate an API_KEY.
  2. Activate the services **Google Maps Android API** and **Nearby Messages API** for this API_KEY.
  3. Go to your `AndroidManifest.xml` and insert your API_KEY as follows:

  ```
  <meta-data
        android:name="com.google.android.nearby.messages.API_KEY"
        android:value="[Your API_KEY]" />
  <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="[Your API_KEY]" />
  ```

**Option 1**: Connect your Smartphone to your PC and run the application onto your phone.

**Option 2**: Select `Build` > `Build APK`. Navigate to the *apk* directory on your file system, select the `app-debug.apk` file and transfer it to your Smartphone. Follow the steps in the next section to install the application.

**Note**: If you want to communicate with others all Apps need to be signed with the same API-Key. Apps that are signed with different API-Keys will not be able to communicate among each other. So make sure to generate a `.apk` file and deploy it to everyone you want to communicate with.

### User

As a user the application can be installed by downloading the `happy_share.apk` file, which is provided at the main directory. If your phone prohibits installing applications form unknown sources, you have to go to your phone settings and enable this option.

Steps for the installation:
  1. Download the `happy_share.apk` file.
  2. Enable the phone setting for installing applications from unknown sources.
  3. Click the `happy_share.apk` file and select install.
  4. Enable the application permission in order to get the application work as intended.

## Architecture

![functionality](img/architecture_model.png)

The main three components of the application are the application itself, the connection to the server and the connection to other peers that are using the same application.

### Application

The application is divided into 5 main components that internally connect and interact: The user interface, the messenger (message manager), the peer-to-peer connection manager, the server connection manager and the zone manager.

The user interface is responsible for displaying the application with all its subtasks (writing messages, displaying incoming messages, etc.). It shares the written messages with the messenger and receives messages to display from the messenger. Moreover, it shows the zones that are retrieved from the server and displays the locations that have been attached to the messages.
The Messenger is the heart of the messaging that is possible with the application. Every incoming and outgoing message in evaluated by the Messenger in terms of the zone it belongs to, the expiration date of the message, and if the message has already been received from someone else before. Depending on the decisions of the Messenger messages are then shared with peer, with the server, stored in the database and/or shown in the user interface.
The peer-to-peer connection manager is responsible for sharing messages with other peers that are in range and receiving messages from peers that are in range.
The server connection manager uses the API of the server application in order to connect of the server for requesting messages and zones and for sharing messages with the server.
The zone manager is responsible for handling the zone and the events that may happen with respect to zones, e.g. leaving a zone, entering a zone, selecting a zone.

### Server Connection

As already mentioned the server connection is responsible for exchanging messages and zones with the server. This connections are triggered only when the application is stared or closed. On the start of the application the application requests zones and messages from the server. When closing the application the application sends the messages that have been written and received in the meantime to the server.

### Peer-to-Peer Connection

The peer-to-peer connection is dependent on the lifecycle of the activity of the application and is able to share and receive messages with peers as long as the activity is active.
This is required by the library which is used, which is [Android Nearby](https://developers.google.com/nearby/).
The messages are shared anonymous, so that it is not known to the users to whom messages are send or from whom messages are received. When the activity is active messages that have not been expired will be published until they expired. Then the peer-to-peer connection manager will stop sharing the messages.

## Functionalities

![functionality](img/functionality.png)

### Select and show zones on a map

When the app opens and the user is physically in more than one zone, they have to select one zone they want to operate and communicate in. If they are in just one zone, this is automatically chosen and the user can see the text "You are currently in: [Zone]". If the user wants to change the zone they can do it by tapping "Select a zone" and they are shown all zones they are currently in on a map.

### Select and show interested topics

Topic may be different for zones. By default all topic are shown in the main view, and when selecting a topic all messages within that topic are shown. When opening the settings, the user might disable topics they are not interested in.

### Receive and write messages

The peer-to-peer connection service runs in the background of the app so that the user does not necessarily notice it. Only an indicator in the toolbar indicates that the android nearby service is active. When the service receives new messages the user will get notified and the messages will be shown in the particular topic lists. Moreover the are visually indicated to be new. When selecting the "Write message..." button, the user can write messages. A message consists of a title, a message, a topic and an expiry date. Optionally the user might allow the message to be shared with the server and they might attach a location to the message, which can be any point within the current zone. When selecting "Submit" the message will be shared with nearby devices.

#### Reshare messages

Messages the are received from other users will be automatically reshared. By this a message will not only reach the nearby devices of the author of the message, but if there are enough users, the message might also be shared within the entire zone.

#### Share message to server

When the users decides to leave the application and closes it, all messages that have the attribute "share with server", will be uploaded to the server. Therefore the server API will be used. Messages for which the user selected to not share it with the server will be deleted and not be shared any more. As long as it is not expired it might, however, still be shared by other users.

## Limitations & Future Work

During the design and implementation process of the app it was thought of and discussed a lot about the usability of the app. It was tried to design the app as intuitive as possible, however an in-app tutorial of the purpose and the usage of the app is still missing. Without knowing about the background of the app, new users would probably get confused. However, such a feature could easily be implemented in future work.

The main drawback of the application is the dependency on the android nearby library, which required to be handled by an activity. This makes it impossible to receive messages from nearby peers, when the device screen is off and the device is in the pocket. The service gets only active when the application does.
However, in the time when the application is active the battery is drained a lot faster than usual, which is obviously because of the Android Nearby library, which constantly publishes and receives messages when active. Further investigations have to be made in this regards to find a solution that lowers the battery consumption.

By now all existing topics are open for everyone. In future it could be further investigated to create private topics that can only be entered by invited people. In such a case the concept of end-to-end encryption would have to be considered in order to avoid that people from 'outside' could incept and read the messages.


text:
Lightweight, cross-browser and easy to use jQuery plugin for smooth scrolling to next section on click of a button!

### [Demo](https://rishabh-rajgarhia.github.io/Section-Scroller/demo/demo.html)

## Usage

#### Install using NPM (optional)
```
npm install section-scroller
```

#### Include

```html
<head>
  <!-- Include CSS for section scroller button -->

  <!-- This following line is optional. Required when using scrollType effects other than "linear" or "swing". -->
  <script src="jquery.easings.min.js"></script>

  <script src="sectionscroller.min.js"></script>
</head>
```
`Tip:` For section scroller button styling, you can use the _scrollerButtonSampleCSS.css_ provided or you can use custom style as per your requirements.

#### HTML
```html
<div class="section-scroll">Content...</div>
<div class="section-scroll">Content...</div>
<div class="section-scroll">Content...</div>
...
<div id="section-scroller-button">
    <i class="caret"></i>
</div>
```
`Tip:` For section scroller button, you can use `carret` class (CSS in _scrollerButtonSampleCSS.css_). You can also easily replace it with icons from [Font Awesome](http://fontawesome.io/icons/) or any other vendor.

#### jQuery
```javascript
$(document).ready(function () {
    $(".section-scroll").sectionScroller({
        // Options
        scrollerButton: "#section-scroller-button"
    });
});
```

## Options

This is the default configuration:

```javascript
$(".section-scroll").sectionScroller({
    scrollerButton: "#section-scroller-button",
    scrollerButtonRotateClass: "rotate",
    scrollType: "swing",
    scrollDuration: 1000,
    offset: 0,
    fixedNavbar: null,
    onScrollStart: function () {},
    onScrollEnd: function () {}
});
```
`".section-scroll"` is the CSS selector for sections of the page.

| Options                   | Default                    | Description  |
| ------------------------- |----------------------------|--------------|
| scrollerButton            | "#section-scroller-button" | CSS selector for element on clicking of which, scrolling to the next section will happen. |
| scrollerButtonRotateClass | "rotate"                   | Class added to the scroller button(to rotate the scroller button direction, etc.) when the last section or the bottom of page is reached. |
| scrollType                | "swing"                    | Animation / Easing while section scrolling. Can easily be extended using [jQuery Easing Plugin](http://gsgd.co.uk/sandbox/jquery/easing/). |
| scrollDuration            | 1000                       |  Duration of the section scroll. |
| offset                    | 0                          |  Offset (pixels) from the top for all sections, e.g., `offset: 10`. For setting offset for individual sections, see below. |
| fixedNavbar               | null                       |  CSS Selector for fixed top navbar if any. Useful in responsive websites where height of fixed navbar changes in different screen sizes, e.g., `fixedNavbar: ".navbar-fixed-top"`.  |
| onScrollStart             | Callback Function          |  Callback function fired on start of the section scrollling. |
| onScrollEnd               | Callback Function          |  Callback function fired on start of the section scrollling. |

For setting offset for individual sections, use `data-scroll-offset` HTML Data Attribute as shown below:

```html
<div class="section-scroll" data-scroll-offset="30">Content...</div>
```
**Extra Option(s) Available Inside Callbacks**

`this.scrollToElementIndex` (Number) - index of the destination section - starting with 0 by default.

## License

This project is licensed under the MIT License (http://opensource.org/licenses/MIT).


text:
var precompute = require("./")

var dir  = process.argv[2] || "."
var data = precompute(dir)
process.stdout.write(JSON.stringify(data, null, 2))


text:
layout: default
---

{{ page.title }}

  {{ content }}


text:
$(document).ready(function() {
    $('.show-changeset').click(function(){
        if ($(this).text() == 'View Changes'){
            $(this).text('Hide Changes');
        }else {
            $(this).text('View Changes');
        }
        $('#changeset-' + this.id).toggle();
    });
});


text:
{% extends "layout.html" %}

{% block page_title %}
  Sprint {{sprint}} - Funding
{% endblock %}

{% block inside_header %}
{% endblock %}

{% block after_header %}
{% include "includes/header-gateway.html" %}
{% endblock %}

{% block content %}

Authority to interact with HMRC on your behalf

The Skills Funding Agency software application is requesting to do the following:

access levy data

It will be able to do the above for 10 hours from when you grant authority.

                                    Grant authority
Do not grant authority

You can remove this authority at any time.

{% endblock %}


text:
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.8.xsd"
           xmlns="http://www.hazelcast.com/schema/config"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <properties>
        <property name="hazelcast.mancenter.enabled">false</property>
        <property name="hazelcast.memcache.enabled">false</property>
        <property name="hazelcast.rest.enabled">false</property>
        <property name="hazelcast.wait.seconds.before.join">0</property>
    </properties>
    <group>
        <name>dev</name>
        <password>dev-pass</password>
    </group>

    <network>
        <join>
            <multicast enabled="true" loopbackModeEnabled="false"/>
            <!--<tcp-ip enabled="true">
                <interface>127.0.0.1</interface>
            </tcp-ip>-->
        </join>
        <interfaces enabled="true">
            <interface>127.0.0.1</interface>
        </interfaces>
    </network>

    <multimap name="__vertx.subs">

        <!--
            Number of backups. If 1 is set as the backup-count for example,
            then all entries of the map will be copied to another JVM for
            fail-safety. 0 means no backup.
        -->
        <backup-count>1</backup-count>
    </multimap>

    <map name="__vertx.haInfo">

        <!--
            Number of backups. If 1 is set as the backup-count for example,
            then all entries of the map will be copied to another JVM for
            fail-safety. 0 means no backup.
        -->
        <backup-count>1</backup-count>
        <!--
      Maximum number of seconds for each entry to stay in the map. Entries that are
      older than <time-to-live-seconds> and not updated for <time-to-live-seconds>
      will get automatically evicted from the map.
      Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
    -->
        <time-to-live-seconds>0</time-to-live-seconds>
        <!--
      Maximum number of seconds for each entry to stay idle in the map. Entries that are
      idle(not touched) for more than <max-idle-seconds> will get
      automatically evicted from the map. Entry is touched if get, put or containsKey is called.
      Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
    -->
        <max-idle-seconds>0</max-idle-seconds>
        <!--
            Valid values are:
            NONE (no eviction),
            LRU (Least Recently Used),
            LFU (Least Frequently Used).
            NONE is the default.
        -->
        <eviction-policy>NONE</eviction-policy>
        <!--
            Maximum size of the map. When max size is reached,
            map is evicted based on the policy defined.
            Any integer between 0 and Integer.MAX_VALUE. 0 means
            Integer.MAX_VALUE. Default is 0.
        -->
        <max-size policy="PER_NODE">0</max-size>
        <!--
            When max. size is reached, specified percentage of
            the map will be evicted. Any integer between 0 and 100.
            If 25 is set for example, 25% of the entries will
            get evicted.
        -->
        <eviction-percentage>25</eviction-percentage>
        <!--
            While recovering from split-brain (network partitioning),
            map entries in the small cluster will merge into the bigger cluster
            based on the policy set here. When an entry merge into the
            cluster, there might an existing entry with the same key already.
            Values of these entries might be different for that same key.
            Which value should be set for the key? Conflict is resolved by
            the policy set here. Default policy is PutIfAbsentMapMergePolicy
            There are built-in merge policies such as
            com.hazelcast.map.merge.PassThroughMergePolicy; entry will be added if there is no existing entry for the key.
            com.hazelcast.map.merge.PutIfAbsentMapMergePolicy ; entry will be added if the merging entry doesn't exist in the cluster.
            com.hazelcast.map.merge.HigherHitsMapMergePolicy ; entry with the higher hits wins.
            com.hazelcast.map.merge.LatestUpdateMapMergePolicy ; entry with the latest update wins.
        -->
        <merge-policy>com.hazelcast.map.merge.LatestUpdateMapMergePolicy</merge-policy>

    </map>
    <!-- Used internally in Vert.x to implement async locks -->
    <semaphore name="__vertx.*">
        <initial-permits>1</initial-permits>
    </semaphore>
</hazelcast>


text:
{% load staticfiles %}
<!doctype html>
<html>
    <head>
        <title>IGClone</title>

        <link rel="stylesheet" href="{% static "instaapp/css/bootstrap.min.css" %}">
        <link rel="stylesheet" href="{% static "instaapp/css/style.css" %}">

    </head>

    <body>


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Chrome Remote Comando</title>
  <link href="styles/main.css" rel="stylesheet">

Chrome Remote Commando

Serve at
    <select id="addresses"><option>127.0.0.1</option></select>:
    <input type="number" id="serverPort" value="8888"></input>
    <button id="serverStart">Start!</button>

Serving at
      <button id="serverStop">Stop!</button>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>0.9.9 API documenation: GLM_GTC_round</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

0.9.9 API documenation

Main Page

Modules

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Functions

GLM_GTC_round
GTC Extensions (Stable)

rounding value to specific boundings
More...

Functions

template<typename genType >

GLM_FUNC_DECL genType 	ceilMultiple (genType Source, genType Multiple)

 	Higher multiple number of Source.  More...

template<typename T , precision P, template< typename, precision > class vecType>

GLM_FUNC_DECL vecType< T, P > 	ceilMultiple (vecType< T, P > const &Source, vecType< T, P > const &Multiple)

 	Higher multiple number of Source.  More...

template<typename genIUType >

GLM_FUNC_DECL genIUType 	ceilPowerOfTwo (genIUType Value)

 	Return the power of two number which value is just higher the input value, round up to a power of two.  More...

template<typename T , precision P, template< typename, precision > class vecType>

GLM_FUNC_DECL vecType< T, P > 	ceilPowerOfTwo (vecType< T, P > const &value)

 	Return the power of two number which value is just higher the input value, round up to a power of two.  More...

template<typename genType >

GLM_FUNC_DECL genType 	floorMultiple (genType Source, genType Multiple)

 	Lower multiple number of Source.  More...

template<typename T , precision P, template< typename, precision > class vecType>

GLM_FUNC_DECL vecType< T, P > 	floorMultiple (vecType< T, P > const &Source, vecType< T, P > const &Multiple)

 	Lower multiple number of Source.  More...

template<typename genIUType >

GLM_FUNC_DECL genIUType 	floorPowerOfTwo (genIUType Value)

 	Return the power of two number which value is just lower the input value, round down to a power of two.  More...

template<typename T , precision P, template< typename, precision > class vecType>

GLM_FUNC_DECL vecType< T, P > 	floorPowerOfTwo (vecType< T, P > const &value)

 	Return the power of two number which value is just lower the input value, round down to a power of two.  More...

template<typename genIUType >

GLM_FUNC_DECL bool 	isMultiple (genIUType Value, genIUType Multiple)

 	Return true if the 'Value' is a multiple of 'Multiple'.  More...

template<typename T , precision P, template< typename, precision > class vecType>

GLM_FUNC_DECL vecType< bool, P > 	isMultiple (vecType< T, P > const &Value, T Multiple)

 	Return true if the 'Value' is a multiple of 'Multiple'.  More...

template<typename T , precision P, template< typename, precision > class vecType>

GLM_FUNC_DECL vecType< bool, P > 	isMultiple (vecType< T, P > const &Value, vecType< T, P > const &Multiple)

 	Return true if the 'Value' is a multiple of 'Multiple'.  More...

template<typename genIUType >

GLM_FUNC_DECL bool 	isPowerOfTwo (genIUType Value)

 	Return true if the value is a power of two number.  More...

template<typename T , precision P, template< typename, precision > class vecType>

GLM_FUNC_DECL vecType< bool, P > 	isPowerOfTwo (vecType< T, P > const &value)

 	Return true if the value is a power of two number.  More...

template<typename genType >

GLM_FUNC_DECL genType 	roundMultiple (genType Source, genType Multiple)

 	Lower multiple number of Source.  More...

template<typename T , precision P, template< typename, precision > class vecType>

GLM_FUNC_DECL vecType< T, P > 	roundMultiple (vecType< T, P > const &Source, vecType< T, P > const &Multiple)

 	Lower multiple number of Source.  More...

template<typename genIUType >

GLM_FUNC_DECL genIUType 	roundPowerOfTwo (genIUType Value)

 	Return the power of two number which value is the closet to the input value.  More...

template<typename T , precision P, template< typename, precision > class vecType>

GLM_FUNC_DECL vecType< T, P > 	roundPowerOfTwo (vecType< T, P > const &value)

 	Return the power of two number which value is the closet to the input value.  More...

Detailed Description

rounding value to specific boundings

<glm/gtc/round.hpp> need to be included to use these functionalities.

Function Documentation

          GLM_FUNC_DECL genType glm::ceilMultiple
          (
          genType
          Source,

          genType
          Multiple

          )

Higher multiple number of Source.

Template Parameters

genType	Floating-point or integer scalar or vector types.

Parameters

Source

Multiple	Must be a null or positive value

See also

GLM_GTC_round

          GLM_FUNC_DECL vecType<T, P> glm::ceilMultiple
          (
          vecType< T, P > const &
          Source,

          vecType< T, P > const &
          Multiple

          )

Higher multiple number of Source.

Template Parameters

genType	Floating-point or integer scalar or vector types.

Parameters

Source

Multiple	Must be a null or positive value

See also

GLM_GTC_round

          GLM_FUNC_DECL genIUType glm::ceilPowerOfTwo
          (
          genIUType
          Value	)

Return the power of two number which value is just higher the input value, round up to a power of two.

See also

GLM_GTC_round

          GLM_FUNC_DECL vecType<T, P> glm::ceilPowerOfTwo
          (
          vecType< T, P > const &
          value	)

Return the power of two number which value is just higher the input value, round up to a power of two.

See also

GLM_GTC_round

          GLM_FUNC_DECL genType glm::floorMultiple
          (
          genType
          Source,

          genType
          Multiple

          )

Lower multiple number of Source.

Template Parameters

genType	Floating-point or integer scalar or vector types.

Parameters

Source

Multiple	Must be a null or positive value

See also

GLM_GTC_round

          GLM_FUNC_DECL vecType<T, P> glm::floorMultiple
          (
          vecType< T, P > const &
          Source,

          vecType< T, P > const &
          Multiple

          )

Lower multiple number of Source.

Template Parameters

genType	Floating-point or integer scalar or vector types.

Parameters

Source

Multiple	Must be a null or positive value

See also

GLM_GTC_round

          GLM_FUNC_DECL genIUType glm::floorPowerOfTwo
          (
          genIUType
          Value	)

Return the power of two number which value is just lower the input value, round down to a power of two.

See also

GLM_GTC_round

          GLM_FUNC_DECL vecType<T, P> glm::floorPowerOfTwo
          (
          vecType< T, P > const &
          value	)

Return the power of two number which value is just lower the input value, round down to a power of two.

See also

GLM_GTC_round

          GLM_FUNC_DECL bool glm::isMultiple
          (
          genIUType
          Value,

          genIUType
          Multiple

          )

Return true if the 'Value' is a multiple of 'Multiple'.

See also

GLM_GTC_round

          GLM_FUNC_DECL vecType<bool, P> glm::isMultiple
          (
          vecType< T, P > const &
          Value,

          T
          Multiple

          )

Return true if the 'Value' is a multiple of 'Multiple'.

See also

GLM_GTC_round

          GLM_FUNC_DECL vecType<bool, P> glm::isMultiple
          (
          vecType< T, P > const &
          Value,

          vecType< T, P > const &
          Multiple

          )

Return true if the 'Value' is a multiple of 'Multiple'.

See also

GLM_GTC_round

          GLM_FUNC_DECL bool glm::isPowerOfTwo
          (
          genIUType
          Value	)

Return true if the value is a power of two number.

See also

GLM_GTC_round

          GLM_FUNC_DECL vecType<bool, P> glm::isPowerOfTwo
          (
          vecType< T, P > const &
          value	)

Return true if the value is a power of two number.

See also

GLM_GTC_round

          GLM_FUNC_DECL genType glm::roundMultiple
          (
          genType
          Source,

          genType
          Multiple

          )

Lower multiple number of Source.

Template Parameters

genType	Floating-point or integer scalar or vector types.

Parameters

Source

Multiple	Must be a null or positive value

See also

GLM_GTC_round

          GLM_FUNC_DECL vecType<T, P> glm::roundMultiple
          (
          vecType< T, P > const &
          Source,

          vecType< T, P > const &
          Multiple

          )

Lower multiple number of Source.

Template Parameters

genType	Floating-point or integer scalar or vector types.

Parameters

Source

Multiple	Must be a null or positive value

See also

GLM_GTC_round

          GLM_FUNC_DECL genIUType glm::roundPowerOfTwo
          (
          genIUType
          Value	)

Return the power of two number which value is the closet to the input value.

See also

GLM_GTC_round

          GLM_FUNC_DECL vecType<T, P> glm::roundPowerOfTwo
          (
          vecType< T, P > const &
          value	)

Return the power of two number which value is the closet to the input value.

See also

GLM_GTC_round

<address class="footer">
Generated by

 1.8.10
</address>


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="alexparunov.steganographer.MainActivity">

  <android.support.v7.widget.Toolbar
      android:id="@+id/toolbar"
      android:minHeight="?attr/actionBarSize"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="?attr/colorPrimary"
      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
  </android.support.v7.widget.Toolbar>

  <android.support.v7.widget.AppCompatButton
      android:text="@string/b_secret_text_encrypt"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textColor="@color/colorPrimaryWhite"
      app:backgroundTint="@color/colorBlueGreySecondary"
      android:id="@+id/bAMEncrypt"
      android:layout_below="@+id/toolbar" android:layout_centerHorizontal="true"
      android:layout_marginTop="171dp"/>

  <android.support.v7.widget.AppCompatButton
      android:text="@string/b_secret_text_decrypt"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/bAMDecrypt"
      android:textColor="@color/colorPrimaryWhite"
      app:backgroundTint="@color/colorBlueGreySecondary"
      android:layout_marginTop="21dp"
      android:layout_below="@+id/bAMEncrypt" android:layout_alignEnd="@+id/bAMEncrypt"/>
</RelativeLayout>


text:
package org.onosproject.net.config;

import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.ImmutableSet;

import java.util.Set;

/**
 * Test adapter for network configuration service.
 */
public class NetworkConfigServiceAdapter implements NetworkConfigService {
    @Override
    public Set<Class> getSubjectClasses() {
        return ImmutableSet.of();
    }

    @Override
    public SubjectFactory getSubjectFactory(String subjectClassKey) {
        return null;
    }

    @Override
    public SubjectFactory getSubjectFactory(Class subjectClass) {
        return null;
    }

    @Override
    public Class<? extends Config> getConfigClass(String subjectClassKey, String configKey) {
        return null;
    }

    @Override
    public <S> Set<S> getSubjects(Class<S> subjectClass) {
        return ImmutableSet.of();
    }

    @Override
    public <S, C extends Config<S>> Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass) {
        return ImmutableSet.of();
    }

    @Override
    public <S> Set<? extends Config<S>> getConfigs(S subject) {
        return ImmutableSet.of();
    }

    @Override
    public <S, C extends Config<S>> C getConfig(S subject, Class<C> configClass) {
        return null;
    }

    @Override
    public <S, C extends Config<S>> C addConfig(S subject, Class<C> configClass) {
        return null;
    }

    @Override
    public <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass, JsonNode json) {
        return null;
    }

    @Override
    public <S, C extends Config<S>> C applyConfig(String subjectClassKey, S subject, String configKey, JsonNode json) {
        return null;
    }

    @Override
    public <S, C extends Config<S>> void removeConfig(S subject, Class<C> configClass) {

    }

    @Override
    public <S> void removeConfig(String subjectClassKey, S subject, String configKey) {
    }

    @Override
    public void addListener(NetworkConfigListener listener) {
    }

    @Override
    public void removeListener(NetworkConfigListener listener) {
    }

    @Override
    public <S> void removeConfig(S subject) {
    }

    @Override
    public <S> void removeConfig() {
    }
}


text:
// Copyright 2007 Xito.org
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.xito.dcf.event;

import java.awt.event.*;
import java.util.*;

import org.xito.dcf.*;

/**
 *
 * @author $Author: drichan $
 * @author ocd_dino - ocd_dino@users.sourceforge.net (initial author)
 * @version $Revision: 1.3 $
 * @since $Date: 2007/11/28 03:52:39 $
 */
public interface DCComponentListener extends ComponentListener {

  /**
   * This event is fired when a Component is disposed
   */
  public void componentDisposed(DCComponentEvent event);

  /**
   * This event is fired when a DCComponent is placed on the Desktop.
   */
  public void componentPlacedOnDesktop(DCComponentEvent event);

  /**
   * This event is fired when a DCComponent is placed on the Desktop.
   */
  public void componentRemovedFromDesktop(DCComponentEvent event);

}


text:
package org.json4s

import org.specs2.ScalaCheck
import org.specs2.mutable.Specification
import org.scalacheck.Arbitrary
import text.Document

//import NativeImports._
//import JsonMethods._

object NativeJsonXmlSpec extends JsonXmlSpec[Document]("Native") with native.JsonMethods
object JacksonXmlSpec extends JsonXmlSpec[JValue]("Jackson") with jackson.JsonMethods

/**
* System under specification for JSON XML.
*/
abstract class JsonXmlSpec[T](mod: String) extends Specification with NodeGen with JValueGen with ScalaCheck with JsonMethods[T] {
  import Xml._
  import scala.xml.Node

  (mod+" JSON XML Specification") should {
    "Valid XML can be converted to JSON and back (symmetric op)" in {
      val conversion = (xml: Node) => { toXml(toJson(xml)).head must_== xml }
      prop(conversion)
    }

    "JSON can be converted to XML, and back to valid JSON (non symmetric op)" in {
      val conversion = (json: JValue) => { parse(compact(render(toJson(toXml(json))))); true must beTrue}
      prop(conversion)
    }
  }

  implicit def arbXml: Arbitrary[Node] = Arbitrary(genXml)
  implicit def arbJValue: Arbitrary[JValue] = Arbitrary(genObject)
}


text:
import itertools

import six
from webob import exc

from heat.api.openstack.v1 import util
from heat.common.i18n import _
from heat.common import identifier
from heat.common import param_utils
from heat.common import serializers
from heat.common import wsgi
from heat.rpc import api as rpc_api
from heat.rpc import client as rpc_client

summary_keys = [
    rpc_api.EVENT_ID,
    rpc_api.EVENT_TIMESTAMP,
    rpc_api.EVENT_RES_NAME,
    rpc_api.EVENT_RES_STATUS,
    rpc_api.EVENT_RES_STATUS_DATA,
    rpc_api.EVENT_RES_PHYSICAL_ID,
]

def format_event(req, event, keys=None):
    include_key = lambda k: k in keys if keys else True

    def transform(key, value):
        if not include_key(key):
            return

        if key == rpc_api.EVENT_ID:
            identity = identifier.EventIdentifier(**value)
            yield ('id', identity.event_id)
            yield ('links', [util.make_link(req, identity),
                             util.make_link(req, identity.resource(),
                                            'resource'),
                             util.make_link(req, identity.stack(),
                                            'stack')])
        elif key in (rpc_api.EVENT_STACK_ID, rpc_api.EVENT_STACK_NAME,
                     rpc_api.EVENT_RES_ACTION):
            return
        elif (key == rpc_api.EVENT_RES_STATUS and
              rpc_api.EVENT_RES_ACTION in event):
            # To avoid breaking API compatibility, we join RES_ACTION
            # and RES_STATUS, so the API format doesn't expose the
            # internal split of state into action/status
            yield (key, '_'.join((event[rpc_api.EVENT_RES_ACTION], value)))
        elif (key == rpc_api.RES_NAME):
            yield ('logical_resource_id', value)
            yield (key, value)

        else:
            yield (key, value)

    return dict(itertools.chain.from_iterable(
        transform(k, v) for k, v in event.items()))

class EventController(object):
    """
    WSGI controller for Events in Heat v1 API
    Implements the API actions
    """
    # Define request scope (must match what is in policy.json)
    REQUEST_SCOPE = 'events'

    def __init__(self, options):
        self.options = options
        self.rpc_client = rpc_client.EngineClient()

    def _event_list(self, req, identity, filter_func=lambda e: True,
                    detail=False, filters=None, limit=None, marker=None,
                    sort_keys=None, sort_dir=None):
        events = self.rpc_client.list_events(req.context,
                                             identity,
                                             filters=filters,
                                             limit=limit,
                                             marker=marker,
                                             sort_keys=sort_keys,
                                             sort_dir=sort_dir)
        keys = None if detail else summary_keys

        return [format_event(req, e, keys) for e in events if filter_func(e)]

    @util.identified_stack
    def index(self, req, identity, resource_name=None):
        """
        Lists summary information for all events
        """
        whitelist = {
            'limit': 'single',
            'marker': 'single',
            'sort_dir': 'single',
            'sort_keys': 'multi',
        }
        filter_whitelist = {
            'resource_status': 'mixed',
            'resource_action': 'mixed',
            'resource_name': 'mixed',
            'resource_type': 'mixed',
        }
        params = util.get_allowed_params(req.params, whitelist)
        filter_params = util.get_allowed_params(req.params, filter_whitelist)
        if not filter_params:
            filter_params = None

        key = rpc_api.PARAM_LIMIT
        if key in params:
            try:
                limit = param_utils.extract_int(key, params[key],
                                                allow_zero=True)
            except ValueError as e:
                raise exc.HTTPBadRequest(six.text_type(e))
            params[key] = limit

        if resource_name is None:
            events = self._event_list(req, identity,
                                      filters=filter_params, **params)
        else:
            res_match = lambda e: e[rpc_api.EVENT_RES_NAME] == resource_name

            events = self._event_list(req, identity, res_match,
                                      filters=filter_params, **params)
            if not events:
                msg = _('No events found for resource %s') % resource_name
                raise exc.HTTPNotFound(msg)

        return {'events': events}

    @util.identified_stack
    def show(self, req, identity, resource_name, event_id):
        """
        Gets detailed information for an event
        """

        def event_match(ev):
            identity = identifier.EventIdentifier(**ev[rpc_api.EVENT_ID])
            return (ev[rpc_api.EVENT_RES_NAME] == resource_name and
                    identity.event_id == event_id)

        events = self._event_list(req, identity, event_match, True)
        if not events:
            raise exc.HTTPNotFound(_('No event %s found') % event_id)

        return {'event': events[0]}

def create_resource(options):
    """
    Events resource factory method.
    """
    deserializer = wsgi.JSONRequestDeserializer()
    serializer = serializers.JSONResponseSerializer()
    return wsgi.Resource(EventController(options), deserializer, serializer)


text:
  Vals est
       un village
       localisé dans le département de l'Ariège en Midi-Pyrénées. On dénombrait 75 habitants en 2008.

Le nombre de logements, à Vals, était réparti en 2011 en trois appartements et 50 maisons soit
 un marché relativement équilibré.

À coté de Vals sont localisées les villes de
Saint-Félix-de-Tournegat à 3 km, 124 habitants,
Rieucros située à 1 km, 555 habitants,
Les Pujols à 3 km, 635 habitants,
Viviès à 4 km, 96 habitants,
Arvigna localisée à 4 km, 184 habitants,
Tourtrol à 4 km, 239 habitants,
 entre autres. De plus, Vals est située à seulement douze km de Pamiers.

Si vous pensez demenager à Vals, vous pourrez aisément trouver une maison à vendre.


text:
require "Test.More"
require "Test.LongString"

plan(1)

----
-- Tests setup.
--
local expected
local got
local caption
local Styles   = require "xlsxwriter.styles"
local Workbook = require "xlsxwriter.workbook"
local styles
local workbook

-- Remove extra whitespace in the formatted XML strings.
function _clean_xml_string(s)
  return (string.gsub(s, ">%s+<", "><"))
end

----
-- Test the _write_styles() method.
--
caption = " \tStyles: Styles: _assemble_xml_file()"
expected = _clean_xml_string([[
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
]])

styles   = Styles:new()
workbook = Workbook:new("test.xlsx")

local format1 = workbook:add_format{
  font_color    = '#9C0006',
  bg_color      = '#FFC7CE',
  font_condense = 1,
  font_extend   = 1,
  has_fill      = 1,
  has_font      = 1,
}

-- Get (and set) the DXF format index.
format1:_get_dxf_index()

workbook:_prepare_format_properties()

local properties = {}
properties["xf_formats"]       = workbook.xf_formats
properties["palette"]          = workbook.palette
properties["font_count"]       = workbook.font_count
properties["num_format_count"] = workbook.num_format_count
properties["border_count"]     = workbook.border_count
properties["fill_count"]       = workbook.fill_count
properties["custom_colors"]    = workbook.custom_colors
properties["dxf_formats"]      = workbook.dxf_formats

styles:_set_style_properties(properties)

styles:_set_filehandle(io.tmpfile())

styles:_assemble_xml_file()

got = _clean_xml_string(styles:_get_data())

is_string(got, expected, caption)


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

using System.Collections.Generic;
using UnityEngine;
using Borodar.ScreenShooter.Configs;
using Borodar.ScreenShooter.Utils;

namespace Borodar.ScreenShooter
{
    public class ScreenShooterSettings : ScriptableObject
    {
        private const string RELATIVE_PATH = "Editor/Data/ScreenShooterSettings.asset";

        public Camera Camera;
        public List<ScreenshotConfig> ScreenshotConfigs;
        public string Tag;
        public bool AppendTimestamp;
        public string SaveFolder;

        //---------------------------------------------------------------------
        // Public
        //---------------------------------------------------------------------

        public static ScreenShooterSettings Load()
        {
            return EditorUtil.LoadFromAsset<ScreenShooterSettings>(RELATIVE_PATH);
        }
    }
}


text:
import sys
import pytest
import logging
from battalion.api import *
from battalion.exceptions import *

class DB(object):

    def __init__(self, state):
        self.msg = state.msg

    def myfunc(self):
        return self.msg

@fixture
def db(state):
    return DB(state)

@fixture(memoize=False)
def db2(state):
    return DB(state)

class acli(CLI):
    """
    Toplevel program - acli
    """
    class State:
        version = '0.0.1'
        msg = ""

class mycli(CLI):
    """
    Toplevel program - mycli
    """
    class State:
        version = '0.0.1'
        msg = ""

    @command
    def normal_function(cli, db, data=None):  # NOTE: the "db" arg will be populated from the "db" fixture function
        """Takes in data and outputs new data"""
        if data is None:
            return db.myfunc()
        else:
            return data

    @command
    def greeting(cli, name="Hello"):
        """
        Prints "Hello {name}!"
        """
        print "Hello {0}!".format(name)

class myhandler(Handler):
    """
    Organizational container of commands which can also add state variables
    """
    class State:
        version = '0.0.2'  # Handlers can have their own versioning
        cli = 'mycli'
        msg = "World"

    @command
    def validate(cli, data):
        return data

    @command(alias='greeting')
    def hello(cli, msg=None):
        """
        Prints "Hello World!"
        """
        name = dryrun(cli.normal_function, cli.state.msg)(data=msg)
        name = dryrun(cli.myhandler.validate, name)(data=name)
        cli.greeting(name=name)

class myhandler2(Handler):

    class State:
        cli = 'mycli'

    @command
    def logger(cli, msg):
        """
        Logs "{msg}"

        Options:
            -m --msg=<MSG>                      [default: None]
        """
        cli.log.info(msg)

@command(cli='mycli', alias='greet')
def multi_bind(cli, name="NAME"):
    """
    Prints {name}!
    """
    name = dryrun(cli.normal_function, 'NAME')(data=name)
    print name

registry.bind(multi_bind, 'mycli', 'myhandler2')
registry.bind(multi_bind, 'acli')

@pytest.fixture
def cli():
    return mycli()

def dispatch(cli, argv=None):
    try:
        return cli(argv)
    except SystemExit:
        return

def test_main(cli, capsys):
    rv = dispatch(cli, '--help')
    out, err = capsys.readouterr()
    assert cli.docstring in out

def test_version(cli, capsys):
    dispatch(cli, '--version')
    out, err = capsys.readouterr()
    assert '0.0.1' in out

def test_handler(cli, capsys):
    rv = cli.myhandler()
    out, err = capsys.readouterr()
    assert '' in out

def test_hello(cli, capsys):
    rv = dispatch(cli, 'myhandler hello Kyle')
    out, err = capsys.readouterr()
    assert 'Hello Kyle!' in out

def test_hello_dryrun(cli, capsys):
    rv = dispatch(cli, '--dryrun myhandler hello Kyle')
    out, err = capsys.readouterr()
    assert 'Hello World!' in out

def test_alias(cli, capsys):
    rv = dispatch(cli, 'myhandler greeting Kyle')
    out, err = capsys.readouterr()
    assert 'Hello Kyle!' in out

def test_nosuchcommand_exception(cli, capsys):
    rv = dispatch(cli, 'hello')
    out, err = capsys.readouterr()
    assert 'No such command: hello' in out

def test_logger(cli, caplog):
    rv = dispatch(cli, 'myhandler2 logger -mKyle')
    assert 'Kyle' in caplog.text()

def test_multi_bind(cli, capsys):
    rv = cli.myhandler2.multi_bind()
    out, err = capsys.readouterr()
    assert 'NAME' in out

if __name__ == "__main__":
    mycli.main()


text:
GCC_TOOL=	ar

.include "../Makefile.gcc-tool"


text:
using UnityEngine;
using System.Collections;

[RequireComponent(typeof (Rigidbody))]
[RequireComponent(typeof (AudioSource))]
public class Explosion : MonoBehaviour {
    public float health = 150.0f;
    public float fadeTime = 0.0f;
    public AudioClip detonationSound;
    public GameObject explosionPerfab;
    public bool hasForce = true;
    public float forceToCast = 450.0f;
    public float explosionRadius = 19.5f;
    public float explosionDamage = 3.5f;
    public Ray ray;
    // Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {
        if (health <= 0)
        {
            audio.PlayOneShot(detonationSound);
            //Apply force
            Collider[] colliders = Physics.OverlapSphere(transform.position, explosionRadius);
            foreach (Collider hit in colliders)
            {
                Rigidbody rb = hit.GetComponent<Rigidbody>();

                if (rb != null)
                    rb.AddExplosionForce(forceToCast, transform.position, explosionRadius, 3.0F);

                    hit.SendMessageUpwards("GetDamage", explosionDamage,SendMessageOptions.DontRequireReceiver);

            }
           StartCoroutine(WaitThenInstantiate(fadeTime));
        }
	}

    public void GetDamage(float _damageValue)
    {
        health -= _damageValue;

    }
    IEnumerator WaitThenInstantiate(float _time)
    {
        yield return new WaitForSeconds(_time);
        Instantiate(explosionPerfab, transform.position, Quaternion.identity);
        Destroy(this.gameObject);
    }
    void OnDrawGizmosSelected()
    {
        Gizmos.color = Color.red;
        Gizmos.DrawWireSphere(this.gameObject.transform.position, explosionRadius);
    }
}


text:
'use strict';

const chai = require('chai'),
  Sequelize = require('../../../../index'),
  Op = Sequelize.Op,
  expect = chai.expect,
  Support = require('../../support');

describe(Support.getTestDialectTeaser('Model'), () => {
  describe('scope', () => {

    describe('findAndCountAll', () => {

      beforeEach(function() {
        this.ScopeMe = this.sequelize.define('ScopeMe', {
          username: Sequelize.STRING,
          email: Sequelize.STRING,
          access_level: Sequelize.INTEGER,
          other_value: Sequelize.INTEGER
        }, {
          defaultScope: {
            where: {
              access_level: {
                [Op.gte]: 5
              }
            },
            attributes: ['username', 'email', 'access_level']
          },
          scopes: {
            lowAccess: {
              where: {
                access_level: {
                  [Op.lte]: 5
                }
              }
            },
            withOrder: {
              order: ['username']
            }
          }
        });

        return this.sequelize.sync({force: true}).then(() => {
          const records = [
            {username: 'tony', email: 'tony@sequelizejs.com', access_level: 3, other_value: 7},
            {username: 'tobi', email: 'tobi@fakeemail.com', access_level: 10, other_value: 11},
            {username: 'dan', email: 'dan@sequelizejs.com', access_level: 5, other_value: 10},
            {username: 'fred', email: 'fred@foobar.com', access_level: 3, other_value: 7}
          ];
          return this.ScopeMe.bulkCreate(records);
        });
      });

      it('should apply defaultScope', function() {
        return this.ScopeMe.findAndCountAll().then(result => {
          expect(result.count).to.equal(2);
          expect(result.rows.length).to.equal(2);
        });
      });

      it('should be able to override default scope', function() {
        return this.ScopeMe.findAndCountAll({ where: { access_level: { [Op.gt]: 5 }}})
          .then(result => {
            expect(result.count).to.equal(1);
            expect(result.rows.length).to.equal(1);
          });
      });

      it('should be able to unscope', function() {
        return this.ScopeMe.unscoped().findAndCountAll({ limit: 1 })
          .then(result => {
            expect(result.count).to.equal(4);
            expect(result.rows.length).to.equal(1);
          });
      });

      it('should be able to apply other scopes', function() {
        return this.ScopeMe.scope('lowAccess').findAndCountAll()
          .then(result => {
            expect(result.count).to.equal(3);
          });
      });

      it('should be able to merge scopes with where', function() {
        return this.ScopeMe.scope('lowAccess')
          .findAndCountAll({ where: { username: 'dan'}}).then(result => {
            expect(result.count).to.equal(1);
          });
      });

      it('should ignore the order option if it is found within the scope', function() {
        return this.ScopeMe.scope('withOrder').findAndCountAll()
          .then(result => {
            expect(result.count).to.equal(4);
          });
      });
    });
  });
});


text:
using Machine.Specifications;
using PlainElastic.Net.Mappings;
using PlainElastic.Net.Utils;

namespace PlainElastic.Net.Tests.Builders.Mappings
{
    [Subject(typeof(Object<>))]
    class When_Object_with_enum_property_mapping_built
    {
        Because of = () => result = new Object<FieldsTestClass>()
                                                .Field("TestObject")
                                                .Properties(p => p
                                                    .Number(f => f.EnumProperty, opt => opt.Boost(5))
                                                )
                                                .ToString();

        It should_start_from_specified_field_name = () => result.ShouldStartWith("'TestObject': {".AltQuote());

        It should_contain_object_type_declaration_part = () => result.ShouldContain("'type': 'object'".AltQuote());

        It should_contain_properties_part = () => result.ShouldContain("'properties': { ".AltQuote());

        It should_contain_properties_mapping_part = () => result.ShouldContain("'properties': { 'EnumProperty': { 'type': 'long','boost': 5 } }".AltQuote());

        It should_generate_correct_JSON_result = () => result.ShouldEqual("'TestObject': { 'type': 'object','properties': { 'EnumProperty': { 'type': 'long','boost': 5 } } }".AltQuote());

        private static string result;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Diep TRPG</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/normalize.css">
    <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/main.css">
    <link rel="stylesheet" href="css/app.css">

Diep TRPG

Reddit