text:
package net.paoding.rose.util;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;

/**
 * @author 王志亮 [qieqie.wang@gmail.com]
 */
public class SpringUtils {

    private static Log logger = LogFactory.getLog(SpringUtils.class);

    public static <T> T getBean(ListableBeanFactory bf, Class<?> beanClass) {
        String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(bf, beanClass);
        @SuppressWarnings("unchecked")
        T bean = (T) ((names.length == 0) ? null : bf.getBean(names[0]));
        return bean;
    }

    public static String[] getBeanNames(ListableBeanFactory bf, Class<?> beanClass) {
        return BeanFactoryUtils.beanNamesForTypeIncludingAncestors(bf, beanClass);
    }

    @SuppressWarnings("unchecked")
    public static <T> List<T> getBeans(ListableBeanFactory bf, Class<T> beanClass) {
        String[] names = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(bf, beanClass);
        List<T> beans = new ArrayList<T>(names.length);
        for (String name : names) {
            beans.add((T) bf.getBean(name));
        }
        return beans;
    }

    public static <T> T getBean(ListableBeanFactory bf, String beanName) {
        @SuppressWarnings("unchecked")
        T bean = (T) (bf.containsBean(beanName) ? bf.getBean(beanName) : null);
        return bean;
    }

    /**
     * @param clazz
     * @param context
     * @return
     */
    public static <T> T createBean(Class<?> clazz, ApplicationContext context) {
        @SuppressWarnings("unchecked")
        T bean = (T) context.getAutowireCapableBeanFactory().createBean(clazz,
                AutowireCapableBeanFactory.AUTOWIRE_NO, false);
        if (logger.isDebugEnabled()) {
            logger.debug("create spring bean: " + bean.getClass() + "@" + bean.hashCode());
        }
        return bean;
    }

    /**
     * @param bean
     * @param context
     */
    public static <T> T autowire(T bean, ApplicationContext context) {
        context.getAutowireCapableBeanFactory().autowireBeanProperties(bean,
                AutowireCapableBeanFactory.AUTOWIRE_NO, false);
        @SuppressWarnings("unchecked")
        T ret = (T) context.getAutowireCapableBeanFactory().initializeBean(bean,
                bean.getClass().getName());
        return ret;
    }

}


text:
rem stop Winstone web server for churchcal
rem @(#) $Id: shut_down.cmd 901 2012-03-10 18:13:36Z gfis $
java -cp ws_churchcal.jar winstone.tools.WinstoneControl --port=8089 --host=localhost shutdown

redpajama_set_name: RedPajamaGithub


text:
NS_ASSUME_NONNULL_BEGIN

@interface SPLifecycleStateMachine : NSObject <SPStateMachineProtocol>

@end

NS_ASSUME_NONNULL_END


text:
using System;
using System.Xml.Serialization;

namespace EZOper.NetSiteUtilities.AopApi
{
    /// <summary>
    /// DataTag Data Structure.
    /// </summary>
    [Serializable]
    public class DataTag : AopObject
    {
        /// <summary>
        /// 聚合方式NONE,COUNT,COUNT_DISTINCT,DISTINCT,MIN,MAX,SUM
        /// </summary>
        [XmlElement("aggregate")]
        public string Aggregate { get; set; }

        /// <summary>
        /// 列别名
        /// </summary>
        [XmlElement("alias")]
        public string Alias { get; set; }

        /// <summary>
        /// 标签CODE
        /// </summary>
        [XmlElement("code")]
        public string Code { get; set; }
    }
}


text:
Simple task scheduler with MRQ
===========================

This is a simple exemple of a recurring task using MRQ.

We have a simple task that print text to the terminal, and we want to launch it every 10 seconds. That is what this exemple is demonstrating.

How to use
==========

First, get into the docker image at the root of this directory:
```
docker run -t -i -v `pwd`:/src -w /src pricingassistant/mrq bash
```
Don't forget to `cd` in the directory of this exemple!

Launch MongoDB & Redis if they are not already started:
```
$ mongod &
$ redis-server &
```

Then launch a scheduler worker, feeding him the config.
```
mrq-worker --scheduler --config config.py
```

In the config. we have described two time the task, with different parameters
You should then see the task printing its parameters every 10 seconds on the terminal.

```
2018-03-09 11:16:03.927182 [DEBUG] Scheduler: added tasks.Print 1 None None None None [["x","Another test."]]
2018-03-09 11:16:03.930823 [DEBUG] Scheduler: added tasks.Print 1 None None None None [["x","Test."]]
2018-03-09 11:16:03.960213 [DEBUG] Scheduler: queued tasks.Print 1 None None None None [["x","Another test."]]
2018-03-09 11:16:03.970537 [DEBUG] Scheduler: queued tasks.Print 1 None None None None [["x","Test."]]
2018-03-09 11:16:04.887654 [DEBUG] Starting tasks.Print({u'x': u'Another test.'})
Hello world !
Another test.
2018-03-09 11:16:04.901856 [DEBUG] Job 5aa26cf322f9db001dfdbdb0 success: 0.014454s total
2018-03-09 11:16:04.903789 [DEBUG] Starting tasks.Print({u'x': u'Test.'})
Hello world !
Test.
2018-03-09 11:16:04.905972 [DEBUG] Job 5aa26cf322f9db001dfdbdb1 success: 0.002258s total
2018-03-09 11:16:14.985899 [DEBUG] Scheduler: queued tasks.Print 1 None None None None [["x","Another test."]]
2018-03-09 11:16:14.988513 [DEBUG] Scheduler: queued tasks.Print 1 None None None None [["x","Test."]]
2018-03-09 11:16:15.961432 [DEBUG] Starting tasks.Print({u'x': u'Another test.'})
Hello world !
Another test.
2018-03-09 11:16:15.964429 [DEBUG] Job 5aa26cfe22f9db001dfdbdb4 success: 0.004088s total
2018-03-09 11:16:15.967952 [DEBUG] Starting tasks.Print({u'x': u'Test.'})
Hello world !
Test.
2018-03-09 11:16:15.970359 [DEBUG] Job 5aa26cfe22f9db001dfdbdb5 success: 0.002809s total
```

Other features
==============

It is also possible to launch tasks everyday, or on specifics days of the week or month.

We advise you to look at the [tests](https://github.com/pricingassistant/mrq/blob/master/tests/test_scheduler.py) for these use-cases.


text:
"""
Example of usecase for EvolAcc class.
"""

#########################
# IMPORTS               #
#########################
#from evolacc import EvolAcc, Unit
import random
from collections import defaultdict

class EvolAcc():
    def __init__(self, world_size):
        self.engine = Engine(world_size)

    def scatter(self, factories):
        assert(sum((c(0, 0) for c in factories.values())) == 1)
        x, y = self.engine.world_size
        for col in range(x):
            for row in range(y):
                unit = random.choice(tuple(factories.keys()))()
                self.engine.add_unit((row, col), unit)

    def run(self, phase_counter):
        [self.engine.step() for _ in range(phase_counter)]

    def __str__(self):
        output = ''
        x, y = self.engine.world_size
        for col in range(x):
            for row in range(y):
                unit = self.engine.units[col, row]
                output += 'X' if is_turned_on(unit) else '.'
            output += '\n'
        return output

class Unit():
    def __init__(self, genome=None, prop=None):
        self.genome = genome
        self.prop   = prop

    def step(self, coords, env):
        return self.genome(coords, env) if self.genome is not None else True

class Property():
    def __init__(self, *args, **kwargs):
        assert(len(args) == 0) # no positionnal parameter expected
        self.values = dict(kwargs) # copy values

class Engine():
    def __init__(self, world_size):
        self.world_size = world_size
        self.units = defaultdict(lambda:Unit())

    def add_unit(self, coords, unit):
        self.units[coords] = unit

    def step(self):
        for coords, unit in list(self.units.items()):
            unit.step(coords, self)

    def neighbors_count(self, coords, filter):
        neighbors = lambda x,y: [(x+i, y+j) for i in (-1, 0, 1) for j in (-1, 0, 1) if not(i == j and i == 0)]
        return len([self.units[nei] for nei in neighbors(*coords) if filter(self.units[nei])])

#########################
# PRE-DECLARATIONS      #
#########################
def is_turned_on(unit):
    return unit.genome == turned_on_genome

def turned_on_genome(coords, env):
    """Implementation of Conway Game of Life"""
    if env.neighbors_count(coords, is_turned_on) not in (2, 3):
        env.units[coords].genome = turned_off_genome
    return True

def turned_off_genome(coords, env):
    """Implementation of Conway Game of Life"""
    if env.neighbors_count(coords, is_turned_on) is 3:
        env.units[coords].genome = turned_on_genome
    return True

#########################
# MAIN                  #
#########################
if __name__ == '__main__':
    ea = EvolAcc(world_size=(4, 4))
    factory_property = lambda x: Property(turned_off=x)
    factory_cell_off = lambda: Unit(genome=turned_on_genome,  prop=factory_property(True ))
    factory_cell_on  = lambda: Unit(genome=turned_off_genome, prop=factory_property(False))

    # 40% of 'on' cells (alive, in Conway GOF), and 60% of 'off' cells.
    # unused here: see evolacc implementation
    distrib = {factory_cell_on:(lambda _1,_2:0.4), factory_cell_off:(lambda _1,_2:0.6)}
    print(distrib.__class__, distrib)
    ea.scatter(distrib)
    print(ea, '\n')
    ea.run(1)
    print(ea)


text:
package com.umeng.comm.ui.widgets;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;

/**
 * 解决开发者使用ViewPager的方式并使用Fragment的方式集成,ViewPager嵌套ViewPager的滑动事件冲突
 */
public class CommunityViewPager extends ViewPager {

    private ViewPager mSubViewPager;

    /**
     * @param context
     */
    public CommunityViewPager(Context context) {
        super(context);
    }

    /**
     * @param context
     * @param attrs
     */
    public CommunityViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected boolean canScroll(View v, boolean arg1, int dx, int arg3, int arg4) {
        if (v != this && v instanceof ViewPager) {
            // 处于社区的viewpager,且在"所有"页面且向做滑动操作
            if (mSubViewPager != null && dx > 0 && (mSubViewPager.getCurrentItem() == 0)) {
                return false;
            } else if (mSubViewPager != null
                    && dx < 0
                    && (mSubViewPager.getCurrentItem() == mSubViewPager.getAdapter().getCount() - 1)) {
                // 处于社区的viewpager,且在"所有"页面且向做滑动操作
                return false;
            }
        }
        return super.canScroll(v, arg1, dx, arg3, arg4);
    }

}


text:
<!DOCTYPE html>

<meta http-equiv="refresh" content="0;url=pages/login.php">
<title>ME</title>

Go to /pages/login.php


text:
namespace component_updater {

class ComponentUpdateService;

// Call once during startup to make the component update service aware of
// the Client Side Phishing component.
void RegisterClientSidePhishingComponent(ComponentUpdateService* cus);

}  // namespace component_updater

#endif  // CHROME_BROWSER_COMPONENT_UPDATER_CHROME_CLIENT_SIDE_PHISHING_COMPONENT_INSTALLER_H_


text:
package calculadora;

/**
 * Verificações matemáticas
 * @author LuanComputacao
 */
public class Verificadores {

    /**
     * Verifica se um número é par
     * @param numero Número à ser verificado
     * @return True se o número for p
     * ar
     */
    public static boolean par(int numero) {
        if(numero == 0) throw new RuntimeException("Número neutro");
        return (numero % 2 == 0);
    }
}


text:
<?php

/**
 * Upload a list of @{class:ArcanistFileDataRef} objects over Conduit.
 *
 *   // Create a new uploader.
 *   $uploader = id(new ArcanistFileUploader())
 *     ->setConduitClient($conduit);
 *
 *   // Queue one or more files to be uploaded.
 *   $file = id(new ArcanistFileDataRef())
 *     ->setName('example.jpg')
 *     ->setPath('/path/to/example.jpg');
 *   $uploader->addFile($file);
 *
 *   // Upload the files.
 *   $files = $uploader->uploadFiles();
 *
 * For details about building file references, see @{class:ArcanistFileDataRef}.
 *
 * @task config Configuring the Uploader
 * @task add Adding Files
 * @task upload Uploading Files
 * @task internal Internals
 */
final class ArcanistFileUploader extends Phobject {

  private $conduit;
  private $files;

/* -(  Configuring the Uploader  )------------------------------------------- */

  /**
   * Provide a Conduit client to choose which server to upload files to.
   *
   * @param ConduitClient Configured client.
   * @return this
   * @task config
   */
  public function setConduitClient(ConduitClient $conduit) {
    $this->conduit = $conduit;
    return $this;
  }

/* -(  Adding Files  )------------------------------------------------------- */

  /**
   * Add a file to the list of files to be uploaded.
   *
   * You can optionally provide an explicit key which will be used to identify
   * the file. After adding files, upload them with @{method:uploadFiles}.
   *
   * @param ArcanistFileDataRef File data to upload.
   * @param null|string Optional key to use to identify this file.
   * @return this
   * @task add
   */
  public function addFile(ArcanistFileDataRef $file, $key = null) {

    if ($key === null) {
      $this->files[] = $file;
    } else {
      if (isset($this->files[$key])) {
        throw new Exception(
          pht(
            'Two files were added with identical explicit keys ("%s"); each '.
            'explicit key must be unique.',
            $key));
      }
      $this->files[$key] = $file;
    }

    return $this;
  }

/* -(  Uploading Files  )---------------------------------------------------- */

  /**
   * Upload files to the server.
   *
   * This transfers all files which have been queued with @{method:addFiles}
   * over the Conduit link configured with @{method:setConduitClient}.
   *
   * This method returns a map of all file data references. If references were
   * added with an explicit key when @{method:addFile} was called, the key is
   * retained in the result map.
   *
   * On return, files are either populated with a PHID (indicating a successful
   * upload) or a list of errors. See @{class:ArcanistFileDataRef} for
   * details.
   *
   * @return map<string, ArcanistFileDataRef> Files with results populated.
   * @task upload
   */
  public function uploadFiles() {
    if (!$this->conduit) {
      throw new PhutilInvalidStateException('setConduitClient');
    }

    $files = $this->files;
    foreach ($files as $key => $file) {
      try {
        $file->willUpload();
      } catch (Exception $ex) {
        $file->didFail($ex->getMessage());
        unset($files[$key]);
      }
    }

    $conduit = $this->conduit;
    $futures = array();
    foreach ($files as $key => $file) {
      $futures[$key] = $conduit->callMethod(
        'file.allocate',
        array(
          'name' => $file->getName(),
          'contentLength' => $file->getByteSize(),
          'contentHash' => $file->getContentHash(),
        ));
    }

    $iterator = id(new FutureIterator($futures))->limit(4);
    $chunks = array();
    foreach ($iterator as $key => $future) {
      try {
        $result = $future->resolve();
      } catch (Exception $ex) {
        // The most likely cause for a failure here is that the server does
        // not support `file.allocate`. In this case, we'll try the older
        // upload method below.
        continue;
      }

      $phid = $result['filePHID'];
      $file = $files[$key];

      // We don't need to upload any data. Figure out why not: this can either
      // be because of an error (server can't accept the data) or because the
      // server already has the data.
      if (!$result['upload']) {
        if (!$phid) {
          $file->didFail(
            pht(
              'Unable to upload file: the server refused to accept file '.
              '"%s". This usually means it is too large.',
              $file->getName()));
        } else {
          // These server completed the upload by creating a reference to known
          // file data. We don't need to transfer the actual data, and are all
          // set.
          $file->setPHID($phid);
        }
        unset($files[$key]);
        continue;
      }

      // The server wants us to do an upload.
      if ($phid) {
        $chunks[$key] = array(
          'file' => $file,
          'phid' => $phid,
        );
      }
    }

    foreach ($chunks as $key => $chunk) {
      $file = $chunk['file'];
      $phid = $chunk['phid'];
      try {
        $this->uploadChunks($file, $phid);
        $file->setPHID($phid);
      } catch (Exception $ex) {
        $file->didFail(
          pht(
            'Unable to upload file chunks: %s',
            $ex->getMessage()));
      }
      unset($files[$key]);
    }

    foreach ($files as $key => $file) {
      try {
        $phid = $this->uploadData($file);
        $file->setPHID($phid);
      } catch (Exception $ex) {
        $file->didFail(
          pht(
            'Unable to upload file data: %s',
            $ex->getMessage()));
      }
      unset($files[$key]);
    }

    foreach ($this->files as $file) {
      $file->didUpload();
    }

    return $this->files;
  }

/* -(  Internals  )---------------------------------------------------------- */

  /**
   * Upload missing chunks of a large file by calling `file.uploadchunk` over
   * Conduit.
   *
   * @task internal
   */
  private function uploadChunks(ArcanistFileDataRef $file, $file_phid) {
    $conduit = $this->conduit;

    $chunks = $conduit->callMethodSynchronous(
      'file.querychunks',
      array(
        'filePHID' => $file_phid,
      ));

    $remaining = array();
    foreach ($chunks as $chunk) {
      if (!$chunk['complete']) {
        $remaining[] = $chunk;
      }
    }

    $done = (count($chunks) - count($remaining));

    if ($done) {
      $this->writeStatus(
        pht(
          'Resuming upload (%d of %d chunks remain).',
          new PhutilNumber(count($remaining)),
          new PhutilNumber(count($chunks))));
    } else {
      $this->writeStatus(
        pht(
          'Uploading chunks (%d chunks to upload).',
          new PhutilNumber(count($remaining))));
    }

    $progress = new PhutilConsoleProgressBar();
    $progress->setTotal(count($chunks));

    for ($ii = 0; $ii < $done; $ii++) {
      $progress->update(1);
    }

    $progress->draw();

    // TODO: We could do these in parallel to improve upload performance.
    foreach ($remaining as $chunk) {
      $data = $file->readBytes($chunk['byteStart'], $chunk['byteEnd']);

      $conduit->callMethodSynchronous(
        'file.uploadchunk',
        array(
          'filePHID' => $file_phid,
          'byteStart' => $chunk['byteStart'],
          'dataEncoding' => 'base64',
          'data' => base64_encode($data),
        ));

      $progress->update(1);
    }
  }

  /**
   * Upload an entire file by calling `file.upload` over Conduit.
   *
   * @task internal
   */
  private function uploadData(ArcanistFileDataRef $file) {
    $conduit = $this->conduit;

    $data = $file->readBytes(0, $file->getByteSize());

    return $conduit->callMethodSynchronous(
      'file.upload',
      array(
        'name' => $file->getName(),
        'data_base64' => base64_encode($data),
      ));
  }

  /**
   * Write a status message.
   *
   * @task internal
   */
  private function writeStatus($message) {
    fwrite(STDERR, $message."\n");
  }

}


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**floodRisk** | [**List<FloodRiskResponse>**](FloodRiskResponse.md) |  |  [optional]


text:
You may link to this document using short form:
  https://www.dearimgui.org/faq
or its real address:
  https://github.com/ocornut/imgui/blob/master/docs/FAQ.md
or view this file with any Markdown viewer.

## Index

| **Q&A: Basics** |
:---------------------------------------------------------- |
| [Where is the documentation?](#q-where-is-the-documentation) |
| [What is this library called?](#q-what-is-this-library-called) |
| [Which version should I get?](#q-which-version-should-i-get) |
| **Q&A: Integration** |
| **[How to get started?](#q-how-to-get-started)** |
| **[How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?](#q-how-can-i-tell-whether-to-dispatch-mousekeyboard-to-dear-imgui-or-my-application)** |
| [How can I enable keyboard or gamepad controls?](#q-how-can-i-enable-keyboard-or-gamepad-controls) |
| [How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)](#q-how-can-i-use-this-on-a-machine-without-mouse-keyboard-or-screen-input-share-remote-display) |
| [I integrated Dear ImGui in my engine and little squares are showing instead of text...](#q-i-integrated-dear-imgui-in-my-engine-and-little-squares-are-showing-instead-of-text) |
| [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around) |
| [I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-displaying-outside-their-expected-windows-boundaries) |
| **Q&A: Usage** |
| **[Why is my widget not reacting when I click on it?
How can I have widgets with an empty label?
How can I have multiple widgets with the same label?](#q-why-is-my-widget-not-reacting-when-i-click-on-it)** |
| [How can I display an image? What is ImTextureID, how does it work?](#q-how-can-i-display-an-image-what-is-imtextureid-how-does-it-work)|
| [How can I use my own math types instead of ImVec2/ImVec4?](#q-how-can-i-use-my-own-math-types-instead-of-imvec2imvec4) |
| [How can I interact with standard C++ types (such as std::string and std::vector)?](#q-how-can-i-interact-with-standard-c-types-such-as-stdstring-and-stdvector) |
| [How can I display custom shapes? (using low-level ImDrawList API)](#q-how-can-i-display-custom-shapes-using-low-level-imdrawlist-api) |
| **Q&A: Fonts, Text** |
| [How should I handle DPI in my application?](#q-how-should-i-handle-dpi-in-my-application) |
| [How can I load a different font than the default?](#q-how-can-i-load-a-different-font-than-the-default) |
| [How can I easily use icons in my application?](#q-how-can-i-easily-use-icons-in-my-application) |
| [How can I load multiple fonts?](#q-how-can-i-load-multiple-fonts) |
| [How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?](#q-how-can-i-display-and-input-non-latin-characters-such-as-chinese-japanese-korean-cyrillic) |
| **Q&A: Concerns** |
| [Who uses Dear ImGui?](#q-who-uses-dear-imgui) |
| [Can you create elaborate/serious tools with Dear ImGui?](#q-can-you-create-elaborateserious-tools-with-dear-imgui)  |
| [Can you reskin the look of Dear ImGui?](#q-can-you-reskin-the-look-of-dear-imgui) |
| [Why using C++ (as opposed to C)?](#q-why-using-c-as-opposed-to-c) |
| **Q&A: Community** |
| [How can I help?](#q-how-can-i-help) |

# Q&A: Basics

### Q: Where is the documentation?

**This library is poorly documented at the moment and expects the user to be acquainted with C/C++.**
- The [Wiki](https://github.com/ocornut/imgui/wiki) is a hub to many resources and links.
- Dozens of standalone example applications using e.g. OpenGL/DirectX are provided in the [examples/](https://github.com/ocornut/imgui/blob/master/examples/) folder to explain how to integrate Dear ImGui with your own engine/application. You can run those applications and explore them.
- See demo code in [imgui_demo.cpp](https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp) and particularly the `ImGui::ShowDemoWindow()` function. The demo covers most features of Dear ImGui, so you can read the code and see its output.
- See documentation: [Backends](https://github.com/ocornut/imgui/blob/master/docs/BACKENDS.md), [Examples](https://github.com/ocornut/imgui/blob/master/docs/EXAMPLES.md), [Fonts](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md).
- See documentation and comments at the top of [imgui.cpp](https://github.com/ocornut/imgui/blob/master/imgui.cpp) + general API comments in [imgui.h](https://github.com/ocornut/imgui/blob/master/imgui.h).
- The [Glossary](https://github.com/ocornut/imgui/wiki/Glossary) page may be useful.
- The [Issues](https://github.com/ocornut/imgui/issues) and [Discussions](https://github.com/ocornut/imgui/discussions) sections can be searched for past questions and issues.
- Your programming IDE is your friend, find the type or function declaration to find comments associated with it.
- The `ImGui::ShowMetricsWindow()` function exposes lots of internal information and tools. Although it is primary designed as a debugging tool, having access to that information tends to help understands concepts.

##### [Return to Index](#index)

---

### Q. What is this library called?

**This library is called Dear ImGui**. Please refer to it as Dear ImGui (not ImGui, not IMGUI).

(The library misleadingly started its life in 2014 as "ImGui" due to the fact that I didn't give it a proper name when when I released 1.0, and had no particular expectation that it would take off. However, the term IMGUI (immediate-mode graphical user interface) was coined before and is being used in variety of other situations e.g. Unity uses it own implementation of the IMGUI paradigm. To reduce the ambiguity without affecting existing code bases, I have decided in December 2015 a fully qualified name "Dear ImGui" for this library.

##### [Return to Index](#index)

---

### Q: Which version should I get?
I occasionally tag [Releases](https://github.com/ocornut/imgui/releases) but it is generally safe and recommended to sync to master/latest. The library is fairly stable and regressions tend to be fixed fast when reported.

You may use the [docking](https://github.com/ocornut/imgui/tree/docking) branch which includes:
- [Docking features](https://github.com/ocornut/imgui/issues/2109)
- [Multi-viewport features](https://github.com/ocornut/imgui/issues/1542)

Many projects are using this branch and it is kept in sync with master regularly.

##### [Return to Index](#index)

----

# Q&A: Integration

### Q: How to get started?

Read [EXAMPLES.md](https://github.com/ocornut/imgui/blob/master/docs/EXAMPLES.md).

Read [BACKENDS.md](https://github.com/ocornut/imgui/blob/master/docs/BACKENDS.md).

Read `PROGRAMMER GUIDE` section of [imgui.cpp](https://github.com/ocornut/imgui/blob/master/imgui.cpp).

The [Wiki](https://github.com/ocornut/imgui/wiki) is a hub to many resources and links.

##### [Return to Index](#index)

---

### Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?

You can read the `io.WantCaptureMouse`, `io.WantCaptureKeyboard` and `io.WantTextInput` flags from the ImGuiIO structure.
- When `io.WantCaptureMouse` is set, you need to discard/hide the mouse inputs from your underlying application.
- When `io.WantCaptureKeyboard` is set, you need to discard/hide the keyboard inputs from your underlying application.
- When `io.WantTextInput` is set, you can notify your OS/engine to popup an on-screen keyboard, if available (e.g. on a mobile phone, or console OS).

Important: you should always pass your mouse/keyboard inputs to Dear ImGui, regardless of the value `io.WantCaptureMouse`/`io.WantCaptureKeyboard`. This is because e.g. we need to detect that you clicked in the void to unfocus its own windows, and other reasons.

```cpp
void MyLowLevelMouseButtonHandler(int button, bool down)
{
    // (1) ALWAYS forward mouse data to ImGui! This is automatic with default backends. With your own backend:
    ImGuiIO& io = ImGui::GetIO();
    io.MouseDown[button] = down;

    // (2) ONLY forward mouse data to your underlying app/game.
    if (!io.WantCaptureMouse)
        my_game->HandleMouseData(...);
}
```

**Note:** The `io.WantCaptureMouse` is more correct that any manual attempt to "check if the mouse is hovering a window" (don't do that!). It handle mouse dragging correctly (both dragging that started over your application or over a Dear ImGui window) and handle e.g. popup and modal windows blocking inputs.

**Note:** Those flags are updated by `ImGui::NewFrame()`. However it is generally more correct and easier that you poll flags from the previous frame, then submit your inputs, then call `NewFrame()`. If you attempt to do the opposite (which is generally harder) you are likely going to submit your inputs after `NewFrame()`, and therefore too late.

**Note:** If you are using a touch device, you may find use for an early call to `UpdateHoveredWindowAndCaptureFlags()` to correctly dispatch your initial touch. We will work on better out-of-the-box touch support in the future.

**Note:** Text input widget releases focus on the "KeyDown" event of the Return key, so the subsequent "KeyUp" event that your application receive will typically have `io.WantCaptureKeyboard == false`. Depending on your application logic it may or not be inconvenient to receive that KeyUp event. You might want to track which key-downs were targeted for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.)

##### [Return to Index](#index)

---

### Q: How can I enable keyboard or gamepad controls?
- The gamepad/keyboard navigation is fairly functional and keeps being improved. The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable. Gamepad support is particularly useful to use Dear ImGui on a game console (e.g. PS4, Switch, XB1) without a mouse connected!
- Keyboard: set `io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard` to enable.
- Gamepad: set `io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad` to enable (with a supporting backend).
- See [Control Sheets for Gamepads](http://www.dearimgui.org/controls_sheets) (reference PNG/PSD for for PS4, XB1, Switch gamepads).
- See `USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS` section of [imgui.cpp](https://github.com/ocornut/imgui/blob/master/imgui.cpp) for more details.

##### [Return to Index](#index)

---

### Q: How can I use this on a machine without mouse, keyboard or screen? (input share, remote display)
- You can share your computer mouse seamlessly with your console/tablet/phone using solutions such as [Synergy](https://symless.com/synergy)
This is the preferred solution for developer productivity.
In particular, the [micro-synergy-client repository](https://github.com/symless/micro-synergy-client) has simple
and portable source code (uSynergy.c/.h) for a small embeddable client that you can use on any platform to connect
to your host computer, based on the Synergy 1.x protocol. Make sure you download the Synergy 1 server on your computer.
Console SDK also sometimes provide equivalent tooling or wrapper for Synergy-like protocols.
- Game console users: consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback.
- You may also use a third party solution such as [netImgui](https://github.com/sammyfreg/netImgui), [Remote ImGui](https://github.com/JordiRos/remoteimgui) or [imgui-ws](https://github.com/ggerganov/imgui-ws) which sends the vertices to render over the local network, allowing you to use Dear ImGui even on a screen-less machine. See [Wiki](https://github.com/ocornut/imgui/wiki) index for most details.
- For touch inputs, you can increase the hit box of widgets (via the `style.TouchPadding` setting) to accommodate for the lack of precision of touch inputs, but it is recommended you use a mouse or gamepad to allow optimizing for screen real-estate and precision.

##### [Return to Index](#index)

---

### Q: I integrated Dear ImGui in my engine and little squares are showing instead of text...
This usually means that: your font texture wasn't uploaded into GPU, or your shader or other rendering state are not reading from the right texture (e.g. texture wasn't bound).
If this happens using the standard backends it is probably that the texture failed to upload, which could happens if for some reason your texture is too big. Also see [docs/FONTS.md](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md).

##### [Return to Index](#index)

---

### Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...
### Q: I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...
You are probably mishandling the clipping rectangles in your render function.
Each draw command needs the triangle rendered using the clipping rectangle provided in the ImDrawCmd structure (`ImDrawCmd->CllipRect`).
Rectangles provided by Dear ImGui are defined as
`(x1=left,y1=top,x2=right,y2=bottom)`
and **NOT** as
`(x1,y1,width,height)`
Refer to rendering backends in the [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder for references of how to handle the `ClipRect` field.

##### [Return to Index](#index)

---

# Q&A: Usage

### Q: Why is my widget not reacting when I click on it?
### Q: How can I have widgets with an empty label?
### Q: How can I have multiple widgets with the same label?

A primer on labels and the ID Stack...

Dear ImGui internally need to uniquely identify UI elements.
Elements that are typically not clickable (such as calls to the Text functions) don't need an ID.
Interactive widgets (such as calls to Button buttons) need a unique ID.
Unique ID are used internally to track active widgets and occasionally associate state to widgets.
Unique ID are implicitly built from the hash of multiple elements that identify the "path" to the UI element.

- Unique ID are often derived from a string label and at minimum scoped within their host window:
```cpp
Begin("MyWindow");
Button("OK");          // Label = "OK",     ID = hash of ("MyWindow", "OK")
Button("Cancel");      // Label = "Cancel", ID = hash of ("MyWindow", "Cancel")
End();
```
- Other elements such as tree nodes, etc. also pushes to the ID stack:
```cpp
Begin("MyWindow");
if (TreeNode("MyTreeNode"))
{
    Button("OK");      // Label = "OK",     ID = hash of ("MyWindow", "MyTreeNode", "OK")
    TreePop();
}
End();
```
- Two items labeled "OK" in different windows or different tree locations won't collide:
```cpp
Begin("MyFirstWindow");
Button("OK");          // Label = "OK",     ID = hash of ("MyFirstWindow", "OK")
End();
Begin("MyOtherWindow");
Button("OK");          // Label = "OK",     ID = hash of ("MyOtherWindow", "OK")
End();
```

- If you have a same ID twice in the same location, you'll have a conflict:
```cpp
Button("OK");
Button("OK");          // ID collision! Interacting with either button will trigger the first one.
```
Fear not! this is easy to solve and there are many ways to solve it!

- Solving ID conflict in a simple/local context:
When passing a label you can optionally specify extra ID information within string itself.
Use "##" to pass a complement to the ID that won't be visible to the end-user.
This helps solving the simple collision cases when you know e.g. at compilation time which items
are going to be created:
```cpp
Begin("MyWindow");
Button("Play");        // Label = "Play",   ID = hash of ("MyWindow", "Play")
Button("Play##foo1");  // Label = "Play",   ID = hash of ("MyWindow", "Play##foo1")  // Different from above
Button("Play##foo2");  // Label = "Play",   ID = hash of ("MyWindow", "Play##foo2")  // Different from above
End();
```
- If you want to completely hide the label, but still need an ID:
```cpp
Checkbox("##On", &b);  // Label = "",       ID = hash of (..., "##On")   // No visible label, just a checkbox!
```
- Occasionally/rarely you might want change a label while preserving a constant ID. This allows
you to animate labels. For example you may want to include varying information in a window title bar,
but windows are uniquely identified by their ID. Use "###" to pass a label that isn't part of ID:
```cpp
Button("Hello###ID");  // Label = "Hello",  ID = hash of (..., "###ID")
Button("World###ID");  // Label = "World",  ID = hash of (..., "###ID")  // Same ID, different label

sprintf(buf, "My game (%f FPS)###MyGame", fps);
Begin(buf);            // Variable title,   ID = hash of "MyGame"
```
- Solving ID conflict in a more general manner:
Use PushID() / PopID() to create scopes and manipulate the ID stack, as to avoid ID conflicts
within the same window. This is the most convenient way of distinguishing ID when iterating and
creating many UI elements programmatically.
You can push a pointer, a string or an integer value into the ID stack.
Remember that ID are formed from the concatenation of _everything_ pushed into the ID stack.
At each level of the stack we store the seed used for items at this level of the ID stack.
```cpp
Begin("Window");
for (int i = 0; i < 100; i++)
{
  PushID(i);           // Push i to the id tack
  Button("Click");     // Label = "Click",  ID = hash of ("Window", i, "Click")
  PopID();
}
for (int i = 0; i < 100; i++)
{
  MyObject* obj = Objects[i];
  PushID(obj);
  Button("Click");     // Label = "Click",  ID = hash of ("Window", obj pointer, "Click")
  PopID();
}
for (int i = 0; i < 100; i++)
{
  MyObject* obj = Objects[i];
  PushID(obj->Name);
  Button("Click");     // Label = "Click",  ID = hash of ("Window", obj->Name, "Click")
  PopID();
}
End();
```
- You can stack multiple prefixes into the ID stack:
```cpp
Button("Click");       // Label = "Click",  ID = hash of (..., "Click")
PushID("node");
  Button("Click");     // Label = "Click",  ID = hash of (..., "node", "Click")
  PushID(my_ptr);
    Button("Click");   // Label = "Click",  ID = hash of (..., "node", my_ptr, "Click")
  PopID();
PopID();
```
- Tree nodes implicitly creates a scope for you by calling PushID().
```cpp
Button("Click");       // Label = "Click",  ID = hash of (..., "Click")
if (TreeNode("node"))  // <-- this function call will do a PushID() for you (unless instructed not to, with a special flag)
{
  Button("Click");     // Label = "Click",  ID = hash of (..., "node", "Click")
  TreePop();
}
```

When working with trees, ID are used to preserve the open/close state of each tree node.
Depending on your use cases you may want to use strings, indices or pointers as ID.
- e.g. when following a single pointer that may change over time, using a static string as ID
will preserve your node open/closed state when the targeted object change.
- e.g. when displaying a list of objects, using indices or pointers as ID will preserve the
node open/closed state differently. See what makes more sense in your situation!

##### [Return to Index](#index)

---

### Q: How can I display an image? What is ImTextureID, how does it work?

Short explanation:
- Refer to [Image Loading and Displaying Examples](https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples) on the [Wiki](https://github.com/ocornut/imgui/wiki).
- You may use functions such as `ImGui::Image()`, `ImGui::ImageButton()` or lower-level `ImDrawList::AddImage()` to emit draw calls that will use your own textures.
- Actual textures are identified in a way that is up to the user/engine. Those identifiers are stored and passed as ImTextureID (void*) value.
- Loading image files from the disk and turning them into a texture is not within the scope of Dear ImGui (for a good reason).

**Please read documentations or tutorials on your graphics API to understand how to display textures on the screen before moving onward.**

Long explanation:
- Dear ImGui's job is to create "meshes", defined in a renderer-agnostic format made of draw commands and vertices. At the end of the frame those meshes (ImDrawList) will be displayed by your rendering function. They are made up of textured polygons and the code to render them is generally fairly short (a few dozen lines). In the examples/ folder we provide functions for popular graphics API (OpenGL, DirectX, etc.).
- Each rendering function decides on a data type to represent "textures". The concept of what is a "texture" is entirely tied to your underlying engine/graphics API.
 We carry the information to identify a "texture" in the ImTextureID type.
ImTextureID is nothing more that a void*, aka 4/8 bytes worth of data: just enough to store 1 pointer or 1 integer of your choice.
Dear ImGui doesn't know or understand what you are storing in ImTextureID, it merely pass ImTextureID values until they reach your rendering function.
- In the [examples/](https://github.com/ocornut/imgui/tree/master/examples) backends, for each graphics API we decided on a type that is likely to be a good representation for specifying an image from the end-user perspective. This is what the _examples_ rendering functions are using:
```cpp
OpenGL:
- ImTextureID = GLuint
- See ImGui_ImplOpenGL3_RenderDrawData() function in imgui_impl_opengl3.cpp
```
```cpp
DirectX9:
- ImTextureID = LPDIRECT3DTEXTURE9
- See ImGui_ImplDX9_RenderDrawData() function in imgui_impl_dx9.cpp
```
```cpp
DirectX11:
- ImTextureID = ID3D11ShaderResourceView*
- See ImGui_ImplDX11_RenderDrawData() function in imgui_impl_dx11.cpp
```
```cpp
DirectX12:
- ImTextureID = D3D12_GPU_DESCRIPTOR_HANDLE
- See ImGui_ImplDX12_RenderDrawData() function in imgui_impl_dx12.cpp
```
For example, in the OpenGL example backend we store raw OpenGL texture identifier (GLuint) inside ImTextureID.
Whereas in the DirectX11 example backend we store a pointer to ID3D11ShaderResourceView inside ImTextureID, which is a higher-level structure tying together both the texture and information about its format and how to read it.

- If you have a custom engine built over e.g. OpenGL, instead of passing GLuint around you may decide to use a high-level data type to carry information about the texture as well as how to display it (shaders, etc.). The decision of what to use as ImTextureID can always be made better knowing how your codebase is designed. If your engine has high-level data types for "textures" and "material" then you may want to use them.
If you are starting with OpenGL or DirectX or Vulkan and haven't built much of a rendering engine over them, keeping the default ImTextureID representation suggested by the example backends is probably the best choice.
(Advanced users may also decide to keep a low-level type in ImTextureID, and use ImDrawList callback and pass information to their renderer)

User code may do:
```cpp
// Cast our texture type to ImTextureID / void*
MyTexture* texture = g_CoffeeTableTexture;
ImGui::Image((void*)texture, ImVec2(texture->Width, texture->Height));
```
The renderer function called after ImGui::Render() will receive that same value that the user code passed:
```cpp
// Cast ImTextureID / void* stored in the draw command as our texture type
MyTexture* texture = (MyTexture*)pcmd->GetTexID();
MyEngineBindTexture2D(texture);
```
Once you understand this design you will understand that loading image files and turning them into displayable textures is not within the scope of Dear ImGui.
This is by design and is actually a good thing, because it means your code has full control over your data types and how you display them.
If you want to display an image file (e.g. PNG file) into the screen, please refer to documentation and tutorials for the graphics API you are using.

Refer to [Image Loading and Displaying Examples](https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples) on the [Wiki](https://github.com/ocornut/imgui/wiki) to find simplified examples for loading textures with OpenGL, DirectX9 and DirectX11.

C/C++ tip: a void* is pointer-sized storage. You may safely store any pointer or integer into it by casting your value to ImTextureID / void*, and vice-versa.
Because both end-points (user code and rendering function) are under your control, you know exactly what is stored inside the ImTextureID / void*.
Examples:
```cpp
GLuint my_tex = XXX;
void* my_void_ptr;
my_void_ptr = (void*)(intptr_t)my_tex;                  // cast a GLuint into a void* (we don't take its address! we literally store the value inside the pointer)
my_tex = (GLuint)(intptr_t)my_void_ptr;                 // cast a void* into a GLuint

ID3D11ShaderResourceView* my_dx11_srv = XXX;
void* my_void_ptr;
my_void_ptr = (void*)my_dx11_srv;                       // cast a ID3D11ShaderResourceView* into an opaque void*
my_dx11_srv = (ID3D11ShaderResourceView*)my_void_ptr;   // cast a void* into a ID3D11ShaderResourceView*
```
Finally, you may call `ImGui::ShowMetricsWindow()` to explore/visualize/understand how the ImDrawList are generated.

##### [Return to Index](#index)

---

### Q: How can I use my own math types instead of ImVec2/ImVec4?

You can edit [imconfig.h](https://github.com/ocornut/imgui/blob/master/imconfig.h) and setup the `IM_VEC2_CLASS_EXTRA`/`IM_VEC4_CLASS_EXTRA` macros to add implicit type conversions.
This way you'll be able to use your own types everywhere, e.g. passing `MyVector2` or `glm::vec2` to ImGui functions instead of `ImVec2`.

##### [Return to Index](#index)

---

### Q: How can I interact with standard C++ types (such as std::string and std::vector)?
- Being highly portable (backends/bindings for several languages, frameworks, programming style, obscure or older platforms/compilers), and aiming for compatibility & performance suitable for every modern real-time game engines, dear imgui does not use any of std C++ types. We use raw types (e.g. char* instead of std::string) because they adapt to more use cases.
- To use ImGui::InputText() with a std::string or any resizable string class, see [misc/cpp/imgui_stdlib.h](https://github.com/ocornut/imgui/blob/master/misc/cpp/imgui_stdlib.h).
- To use combo boxes and list boxes with `std::vector` or any other data structure: the `BeginCombo()/EndCombo()` API
lets you iterate and submit items yourself, so does the `ListBoxHeader()/ListBoxFooter()` API.
Prefer using them over the old and awkward `Combo()/ListBox()` api.
- Generally for most high-level types you should be able to access the underlying data type.
You may write your own one-liner wrappers to facilitate user code (tip: add new functions in ImGui:: namespace from your code).
- Dear ImGui applications often need to make intensive use of strings. It is expected that many of the strings you will pass
to the API are raw literals (free in C/C++) or allocated in a manner that won't incur a large cost on your application.
Please bear in mind that using `std::string` on applications with large amount of UI may incur unsatisfactory performances.
Modern implementations of `std::string` often include small-string optimization (which is often a local buffer) but those
are not configurable and not the same across implementations.
- If you are finding your UI traversal cost to be too large, make sure your string usage is not leading to excessive amount
of heap allocations. Consider using literals, statically sized buffers and your own helper functions. A common pattern
is that you will need to build lots of strings on the fly, and their maximum length can be easily be scoped ahead.
One possible implementation of a helper to facilitate printf-style building of strings: https://github.com/ocornut/Str
This is a small helper where you can instance strings with configurable local buffers length. Many game engines will
provide similar or better string helpers.

##### [Return to Index](#index)

---

### Q: How can I display custom shapes? (using low-level ImDrawList API)

- You can use the low-level `ImDrawList` api to render shapes within a window.
```cpp
ImGui::Begin("My shapes");

ImDrawList* draw_list = ImGui::GetWindowDrawList();

// Get the current ImGui cursor position
ImVec2 p = ImGui::GetCursorScreenPos();

// Draw a red circle
draw_list->AddCircleFilled(ImVec2(p.x + 50, p.y + 50), 30.0f, IM_COL32(255, 0, 0, 255), 16);

// Draw a 3 pixel thick yellow line
draw_list->AddLine(ImVec2(p.x, p.y), ImVec2(p.x + 100.0f, p.y + 100.0f), IM_COL32(255, 255, 0, 255), 3.0f);

// Advance the ImGui cursor to claim space in the window (otherwise the window will appears small and needs to be resized)
ImGui::Dummy(ImVec2(200, 200));

ImGui::End();
```
![ImDrawList usage](https://raw.githubusercontent.com/wiki/ocornut/imgui/tutorials/CustomRendering01.png)

- Refer to "Demo > Examples > Custom Rendering" in the demo window and read the code of `ShowExampleAppCustomRendering()` in `imgui_demo.cpp` from more examples.
- To generate colors: you can use the macro `IM_COL32(255,255,255,255)` to generate them at compile time, or use `ImGui::GetColorU32(IM_COL32(255,255,255,255))` or `ImGui::GetColorU32(ImVec4(1.0f,1.0f,1.0f,1.0f))` to generate a color that is multiplied by the current value of `style.Alpha`.
- Math operators: if you have setup `IM_VEC2_CLASS_EXTRA` in `imconfig.h` to bind your own math types, you can use your own math types and their natural operators instead of ImVec2. ImVec2 by default doesn't export any math operators in the public API. You may use `#define IMGUI_DEFINE_MATH_OPERATORS` `#include "imgui_internal.h"` to use the internally defined math operators, but instead prefer using your own math library and set it up in `imconfig.h`.
- You can use `ImGui::GetBackgroundDrawList()` or `ImGui::GetForegroundDrawList()` to access draw lists which will be displayed behind and over every other dear imgui windows (one bg/fg drawlist per viewport). This is very convenient if you need to quickly display something on the screen that is not associated to a dear imgui window.
- You can also create your own empty window and draw inside it. Call Begin() with the NoBackground | NoDecoration | NoSavedSettings | NoInputs flags (The `ImGuiWindowFlags_NoDecoration` flag itself is a shortcut for NoTitleBar | NoResize | NoScrollbar | NoCollapse). Then you can retrieve the ImDrawList* via `GetWindowDrawList()` and draw to it in any way you like.
`- You can create your own ImDrawList instance. You'll need to initialize them with `ImGui::GetDrawListSharedData()`, or create your own instancing ImDrawListSharedData`, and then call your renderer function with your own ImDrawList or ImDrawData data.
- Looking for fun? The [ImDrawList coding party 2020](https://github.com/ocornut/imgui/issues/3606) thread is full of "don't do this at home" extreme uses of the ImDrawList API.

##### [Return to Index](#index)

---

# Q&A: Fonts, Text

### Q: How should I handle DPI in my application?

The short answer is: obtain the desired DPI scale, load your fonts resized with that scale (always round down fonts size to nearest integer), and scale your Style structure accordingly using `style.ScaleAllSizes()`.

Your application may want to detect DPI change and reload the fonts and reset style between frames.

Your ui code  should avoid using hardcoded constants for size and positioning. Prefer to express values as multiple of reference values such as `ImGui::GetFontSize()` or `ImGui::GetFrameHeight()`. So e.g. instead of seeing a hardcoded height of 500 for a given item/window, you may want to use `30*ImGui::GetFontSize()` instead.

Down the line Dear ImGui will provide a variety of standardized reference values to facilitate using this.

Applications in the `examples/` folder are not DPI aware partly because they are unable to load a custom font from the file-system (may change that in the future).

The reason DPI is not auto-magically solved in stock examples is that we don't yet have a satisfying solution for the "multi-dpi"  problem (using the `docking` branch: when multiple viewport windows are over multiple monitors using different DPI scale). The current way to handle this on the application side is:
- Create and maintain one font atlas per active DPI scale (e.g. by iterating `platform_io.Monitors[]` before `NewFrame()`).
- Hook `platform_io.OnChangedViewport()` to detect when a `Begin()` call makes a Dear ImGui window change monitor (and therefore DPI).
- In the hook: swap atlas, swap style with correctly sized one, remap the current font from one atlas to the other (may need to maintain a remapping table of your fonts at variying DPI scale).

This approach is relatively easy and functional but come with two issues:
- It's not possibly to reliably size or position a window ahead of `Begin()` without knowing on which monitor it'll land.
- Style override may be lost during the `Begin()` call crossing monitor boundaries. You may need to do some custom scaling mumbo-jumbo if you want your `OnChangedViewport()` handler to preserve style overrides.

Please note that if you are not using multi-viewports with multi-monitors using different DPI scale, you can ignore all of this and use the simpler technique recommended at the top.

### Q: How can I load a different font than the default?
Use the font atlas to load the TTF/OTF file you want:

```cpp
ImGuiIO& io = ImGui::GetIO();
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels);
io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()
```

Default is ProggyClean.ttf, monospace, rendered at size 13, embedded in dear imgui's source code.

(Tip: monospace fonts are convenient because they allow to facilitate horizontal alignment directly at the string level.)

(Read the [docs/FONTS.md](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md) file for more details about font loading.)

New programmers: remember that in C/C++ and most programming languages if you want to use a
backslash \ within a string literal, you need to write it double backslash "\\":

```cpp
io.Fonts->AddFontFromFileTTF("MyFolder\MyFont.ttf", size);  // WRONG (you are escaping the M here!)
io.Fonts->AddFontFromFileTTF("MyFolder\\MyFont.ttf", size;  // CORRECT (Windows only)
io.Fonts->AddFontFromFileTTF("MyFolder/MyFont.ttf", size);  // ALSO CORRECT
```

##### [Return to Index](#index)

---

### Q: How can I easily use icons in my application?
The most convenient and practical way is to merge an icon font such as FontAwesome inside you
main font. Then you can refer to icons within your strings.
You may want to see `ImFontConfig::GlyphMinAdvanceX` to make your icon look monospace to facilitate alignment.
(Read the [docs/FONTS.md](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md) file for more details about icons font loading.)
With some extra effort, you may use colorful icon by registering custom rectangle space inside the font atlas,
and copying your own graphics data into it. See docs/FONTS.md about using the AddCustomRectFontGlyph API.

##### [Return to Index](#index)

---

### Q: How can I load multiple fonts?
Use the font atlas to pack them into a single texture:
(Read the [docs/FONTS.md](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md) file and the code in ImFontAtlas for more details.)

```cpp
ImGuiIO& io = ImGui::GetIO();
ImFont* font0 = io.Fonts->AddFontDefault();
ImFont* font1 = io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels);
ImFont* font2 = io.Fonts->AddFontFromFileTTF("myfontfile2.ttf", size_in_pixels);
io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()
// the first loaded font gets used by default
// use ImGui::PushFont()/ImGui::PopFont() to change the font at runtime

// Options
ImFontConfig config;
config.OversampleH = 2;
config.OversampleV = 1;
config.GlyphOffset.y -= 1.0f;      // Move everything by 1 pixels up
config.GlyphExtraSpacing.x = 1.0f; // Increase spacing between characters
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, &config);

// Combine multiple fonts into one (e.g. for icon fonts)
static ImWchar ranges[] = { 0xf000, 0xf3ff, 0 };
ImFontConfig config;
config.MergeMode = true;
io.Fonts->AddFontDefault();
io.Fonts->AddFontFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges); // Merge icon font
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese()); // Merge japanese glyphs
```

##### [Return to Index](#index)

---

### Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?
When loading a font, pass custom Unicode ranges to specify the glyphs to load.

```cpp
// Add default Japanese ranges
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, NULL, io.Fonts->GetGlyphRangesJapanese());

// Or create your own custom ranges (e.g. for a game you can feed your entire game script and only build the characters the game need)
ImVector<ImWchar> ranges;
ImFontGlyphRangesBuilder builder;
builder.AddText("Hello world");                        // Add a string (here "Hello world" contains 7 unique characters)
builder.AddChar(0x7262);                               // Add a specific character
builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges
builder.BuildRanges(&ranges);                          // Build the final result (ordered ranges with all the unique characters submitted)
io.Fonts->AddFontFromFileTTF("myfontfile.ttf", 16.0f, NULL, ranges.Data);
```

All your strings needs to use UTF-8 encoding. In C++11 you can encode a string literal in UTF-8
by using the u8"hello" syntax. Specifying literal in your source code using a local code page
(such as CP-923 for Japanese or CP-1251 for Cyrillic) will NOT work!
Otherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8.

Text input: it is up to your application to pass the right character code by calling `io.AddInputCharacter()`.
The applications in examples/ are doing that.
Windows: you can use the WM_CHAR or WM_UNICHAR or WM_IME_CHAR message (depending if your app is built using Unicode or MultiByte mode).
You may also use MultiByteToWideChar() or ToUnicode() to retrieve Unicode codepoints from MultiByte characters or keyboard state.
Windows: if your language is relying on an Input Method Editor (IME), you copy the HWND of your window to io.ImeWindowHandle in order for
the default implementation of io.ImeSetInputScreenPosFn() to set your Microsoft IME position correctly.

##### [Return to Index](#index)

---

# Q&A: Concerns

### Q: Who uses Dear ImGui?

You may take a look at:

- [Quotes](https://github.com/ocornut/imgui/wiki/Quotes)
- [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui)
- [Sponsors](https://github.com/ocornut/imgui/wiki/Sponsors)
- [Gallery](https://github.com/ocornut/imgui/issues/3488)

##### [Return to Index](#index)

---

### Q: Can you create elaborate/serious tools with Dear ImGui?

Yes. People have written game editors, data browsers, debuggers, profilers and all sort of non-trivial tools with the library. In my experience the simplicity of the API is very empowering. Your UI runs close to your live data. Make the tools always-on and everybody in the team will be inclined to create new tools (as opposed to more "offline" UI toolkits where only a fraction of your team effectively creates tools). The list of sponsors below is also an indicator that serious game teams have been using the library.

Dear ImGui is very programmer centric and the immediate-mode GUI paradigm might require you to readjust some habits before you can realize its full potential. Dear ImGui is about making things that are simple, efficient and powerful.

Dear ImGui is built to be efficient and scalable toward the needs for AAA-quality applications running all day. The IMGUI paradigm offers different opportunities for optimization that the more typical RMGUI paradigm.

##### [Return to Index](#index)

---

### Q: Can you reskin the look of Dear ImGui?

Somehow. You can alter the look of the interface to some degree: changing colors, sizes, padding, rounding, fonts. However, as Dear ImGui is designed and optimized to create debug tools, the amount of skinning you can apply is limited. There is only so much you can stray away from the default look and feel of the interface. Dear ImGui is NOT designed to create user interface for games, although with ingenious use of the low-level API you can do it.

A reasonably skinned application may look like (screenshot from [#2529](https://github.com/ocornut/imgui/issues/2529#issuecomment-524281119))
![minipars](https://user-images.githubusercontent.com/314805/63589441-d9794f00-c5b1-11e9-8d96-cfc1b93702f7.png)

##### [Return to Index](#index)

---

### Q: Why using C++ (as opposed to C)?

Dear ImGui takes advantage of a few C++ languages features for convenience but nothing anywhere Boost insanity/quagmire. Dear ImGui does NOT require C++11 so it can be used with most old C++ compilers. Dear ImGui doesn't use any C++ header file. Language-wise, function overloading and default parameters are used to make the API easier to use and code more terse. Doing so I believe the API is sitting on a sweet spot and giving up on those features would make the API more cumbersome. Other features such as namespace, constructors and templates (in the case of the ImVector<> class) are also relied on as a convenience.

There is an auto-generated [c-api for Dear ImGui (cimgui)](https://github.com/cimgui/cimgui) by Sonoro1234 and Stephan Dilly. It is designed for creating bindings to other languages. If possible, I would suggest using your target language functionalities to try replicating the function overloading and default parameters used in C++ else the API may be harder to use. Also see [Bindings](https://github.com/ocornut/imgui/wiki/Bindings) for various third-party bindings.

##### [Return to Index](#index)

---

# Q&A: Community

### Q: How can I help?
- Businesses: please reach out to `contact AT dearimgui.com` if you work in a place using Dear ImGui! We can discuss ways for your company to fund development via invoiced technical support, maintenance or sponsoring contacts. This is among the most useful thing you can do for Dear ImGui. With increased funding, we can hire more people working on this project.
- Individuals: you can support continued maintenance and development via PayPal donations. See [README](https://github.com/ocornut/imgui/blob/master/docs/README.md).
- If you are experienced with Dear ImGui and C++, look at [GitHub Issues](https://github.com/ocornut/imgui/issues), [GitHub Discussions](https://github.com/ocornut/imgui/discussions), the [Wiki](https://github.com/ocornut/imgui/wiki), read [docs/TODO.txt](https://github.com/ocornut/imgui/blob/master/docs/TODO.txt) and see how you want to help and can help!
- Disclose your usage of Dear ImGui via a dev blog post, a tweet, a screenshot, a mention somewhere etc.
You may post screenshot or links in the [gallery threads](https://github.com/ocornut/imgui/issues/3488). Visuals are ideal as they inspire other programmers. Disclosing your use of Dear ImGui helps the library grow credibility, and help other teams and programmers with taking decisions.
- If you have issues or if you need to hack into the library, even if you don't expect any support it is useful that you share your issues or sometimes incomplete PR.

##### [Return to Index](#index)


text:
package org.oscm.rest.common;

import javax.ws.rs.WebApplicationException;

import org.oscm.internal.vo.BaseVO;

/**
 * Base class for all representations
 *
 * @author miethaner
 */
public abstract class Representation {

    private transient Integer version;
    private Long etag;
    private Long id;

    /**
     * Creates new representation
     */
    public Representation() {
    }

    public Representation(BaseVO vo) {
        if (vo == null) {
            return;
        }

        this.id = new Long(vo.getKey());
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Long getETag() {
        return etag;
    }

    public void setETag(Long tag) {
        this.etag = tag;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    protected long convertIdToKey() {
        if (getId() == null) {
            return 0L;
        }
        return getId().longValue();
    }

    protected int convertETagToVersion() {
        if (getETag() == null) {
            return 0;
        }
        return getETag().intValue();
    }

    /**
     * Validates the content and format of the fields to be legitimate. Throws
     * BadRequestException if not valid.
     *
     * @throws WebApplicationException
     */
    public abstract void validateContent() throws WebApplicationException;

    /**
     * Updates the fields and format of the internal version to the current one
     */
    public abstract void update();

    /**
     * Converts the format and fields of the current version to the internal old
     * one
     */
    public abstract void convert();
}


text:
package com.cedac.security.acls.mongo;

import com.lordofthejars.nosqlunit.annotation.ShouldMatchDataSet;
import com.lordofthejars.nosqlunit.annotation.UsingDataSet;
import com.lordofthejars.nosqlunit.mongodb.InMemoryMongoDb;
import com.lordofthejars.nosqlunit.mongodb.MongoDbRule;
import com.mongodb.Mongo;

import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.cache.support.NoOpCacheManager;
import org.springframework.security.acls.domain.AclAuthorizationStrategy;
import org.springframework.security.acls.domain.BasePermission;
import org.springframework.security.acls.domain.GrantedAuthoritySid;
import org.springframework.security.acls.domain.ObjectIdentityImpl;
import org.springframework.security.acls.domain.PrincipalSid;
import org.springframework.security.acls.domain.SpringCacheBasedAclCache;
import org.springframework.security.acls.model.AclCache;
import org.springframework.security.acls.model.AlreadyExistsException;
import org.springframework.security.acls.model.ChildrenExistException;
import org.springframework.security.acls.model.MutableAcl;
import org.springframework.security.acls.model.PermissionGrantingStrategy;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;

import static com.lordofthejars.nosqlunit.mongodb.InMemoryMongoDb.InMemoryMongoRuleBuilder.newInMemoryMongoDbRule;
import static com.lordofthejars.nosqlunit.mongodb.MongoDbRule.MongoDbRuleBuilder.newMongoDbRule;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

/**
 * @author mauro.franceschini@cedac.com
 * @since 1.0.0
 */
@UsingDataSet
public class MongoMutableAclServiceTests {
    @ClassRule
    public static InMemoryMongoDb inMemoryMongoDb = newInMemoryMongoDbRule().targetPath("target/test-db").build();

    @Rule
    public MongoDbRule embeddedMongoDbRule = newMongoDbRule().defaultEmbeddedMongoDb("test");

    private MongoMutableAclService fixture;
    @Mock
    private PermissionGrantingStrategy pgs;
    @Mock
    private AclAuthorizationStrategy aas;

    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);

        Mongo mongo = embeddedMongoDbRule.getDatabaseOperation().connectionManager();
        final AclCache aclCache = new SpringCacheBasedAclCache(new NoOpCacheManager().getCache("acl"), pgs, aas);
        fixture = new MongoMutableAclService(mongo, "test", aclCache, pgs, aas);
        fixture.afterPropertiesSet();

        SecurityContextHolder.getContext()
                .setAuthentication(new PreAuthenticatedAuthenticationToken("admin@cedac.com", "password"));
    }

    @After
    public void tearDown() throws Exception {
        SecurityContextHolder.clearContext();
    }

    @Test
    @ShouldMatchDataSet
    public void creatingAcl_withNoAcl() {
        MutableAcl acl = fixture.createAcl(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "2"));

        assertNotNull(acl);
        assertEquals("com.cedac.smartresidence.profile.domain.Home", acl.getObjectIdentity().getType());
        assertEquals("2", acl.getObjectIdentity().getIdentifier());
        assertEquals(new PrincipalSid("admin@cedac.com"), acl.getOwner());
        assertEquals(true, acl.isEntriesInheriting());
        assertEquals(0, acl.getEntries().size());
    }

    @Test
    @ShouldMatchDataSet
    public void updateAcl_changeOwner() {
        MutableAcl acl = (MutableAcl) fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "1"));
        acl.setOwner(new PrincipalSid("other@cedac.com"));

        fixture.updateAcl(acl);
    }

    @Test
    @ShouldMatchDataSet
    public void updateAcl_changeEntriesInheriting() {
        MutableAcl acl = (MutableAcl) fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "1"));
        acl.setEntriesInheriting(false);

        fixture.updateAcl(acl);
    }

    @Test
    @ShouldMatchDataSet
    public void updateAcl_changeParent() {
        MutableAcl acl = (MutableAcl) fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Device", "1.1.2"));
        acl.setParent(
                fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Device", "1.1.1")));

        fixture.updateAcl(acl);
    }

    @Test
    @ShouldMatchDataSet
    public void updateAcl_addEntries() {
        MutableAcl acl = (MutableAcl) fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Device", "1.1.2"));
        acl.insertAce(0, BasePermission.READ, new GrantedAuthoritySid("ROLE_USER"), true);
        acl.insertAce(1, BasePermission.WRITE, new GrantedAuthoritySid("ROLE_USER"), true);

        fixture.updateAcl(acl);
    }

    @Test
    @ShouldMatchDataSet
    public void updateAcl_updateEntries() {
        MutableAcl acl = (MutableAcl) fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "1"));
        acl.updateAce(2, BasePermission.DELETE);

        fixture.updateAcl(acl);
    }

    @Test
    @ShouldMatchDataSet
    public void updateAcl_deleteEntries() {
        MutableAcl acl = (MutableAcl) fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "1"));
        acl.deleteAce(5);

        fixture.updateAcl(acl);
    }

    @Test(expected = AlreadyExistsException.class)
    @ShouldMatchDataSet
    public void creatingAcl_withExistingAcl() {
        fixture.createAcl(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "1"));
    }

    @Test
    @ShouldMatchDataSet
    public void deleteAcl_cascadeWithNoChildren() {
        fixture.deleteAcl(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Device", "1.1.2"), true);
    }

    @Test
    @ShouldMatchDataSet
    public void deleteAcl_noCascadeWithNoChildren() {
        fixture.deleteAcl(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Device", "1.1.2"), false);
    }

    @Test
    @ShouldMatchDataSet
    public void deleteAcl_cascadeWithChildren() {
        fixture.deleteAcl(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Room", "1.1"), true);
    }

    @Test(expected = ChildrenExistException.class)
    @ShouldMatchDataSet
    public void deleteAcl_noCascadeWithChildren() {
        fixture.deleteAcl(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Room", "1.1"), false);
    }
}


text:
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <link rel="stylesheet" href="./../../helpwin.css">
      <title>MATLAB File Help: prtDataSetRegress/setObservationsAndTargets</title>

            MATLAB File Help: prtDataSetRegress/setObservationsAndTargets

prtDataSetRegress/setObservationsAndTargets

 dataSet = setObservationsAndTargets(dataSet,data,targets)
  Replace both the data and targets in a data set with new
  "data" and "targets".  The inputs should have the same size
  in the first dimension.

  setObservationsAndTargets is useful when the size of a data
  set has to change.

Method Details

            Defining Class
            prtDataSetInMem

            Access
            public

            Sealed
            false

            Static
            false


text:
@import './typography.css';

:root {
    --intergen-yellow: #FFD300;
    --intergen-logo-yellow: #FFDD00;
    --intergen-black: #222;

    --max-page-width: 1280px;
}

html, body {
    margin: 0;
    background-color: var(--intergen-black);
}

*::selection {
	background: var(--intergen-yellow);
}

*::-moz-selection {
	background: var(--intergen-yellow);
}


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

namespace Microsoft.WindowsAzure.Management.Automation.Testing
{
    public class RunbookDefinition
    {
        private readonly string psScript;
        private readonly string runbookName;

        public RunbookDefinition(string runbookName, string psScript)
        {
            this.runbookName = runbookName;
            this.psScript = psScript;
        }

        public string PsScript
        {
            get { return psScript; }
        }

        public string RunbookName
        {
            get { return runbookName; }
        }

        public static RunbookDefinition TestLongRunningWorkflow = new RunbookDefinition(
            "TestLongRunningWorkflow", @"Workflow TestLongRunningWorkflow {
                param([int] $maxCount = 20)
                ""maxCount  is "" + $maxCount
                for ($i = 0; $i -lt $maxCount; $i++ )
                {
                    write-progress -activity ""Long running workflow in Progress out of $maxCount"" -status ""% Complete:"" -percentcomplete $i;
                    get-date
                    start-sleep -Seconds 2
                    pspersist
                }
            }");

        public static RunbookDefinition TestFasterWorkflow = new RunbookDefinition(
            "TestFasterWorkflow", @"Workflow TestFasterWorkflow {
                get-date
            }");

        public static RunbookDefinition TestFasterWorkflow_V2 = new RunbookDefinition(
            "TestFasterWorkflow", @"Workflow TestFasterWorkflow {
                get-date
                start-sleep -s 10
            }");
    }
}


text:
package fr.assoba.open.perf;

import org.apache.commons.math3.distribution.LogNormalDistribution;

public class FindDist {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		for (double s = 5; s < 9; s = s + 0.01) {
			for (double c = 0.5; c < 5; c = c + 0.01) {
				LogNormalDistribution distribution = new LogNormalDistribution(
						s, c);
				if ((distribution.cumulativeProbability(200) > .248)
						&& (distribution.cumulativeProbability(200) < .252)) {
					System.out.println(s + ":" + c);
					System.out.println("\t"
							+ distribution.cumulativeProbability(200));
					System.out.println("\t"
							+ distribution.cumulativeProbability(600));
					System.out.println("\t"
							+ distribution.cumulativeProbability(1000 * 1000));
				}
			}
		}
	}

}


text:
namespace Microsoft.Azure.Management.Media.Models
{
    using Newtonsoft.Json;
    using System.Linq;

    /// <summary>
    /// Class to specify DRM configurations of CommonEncryptionCbcs scheme in
    /// Streaming Policy
    /// </summary>
    public partial class CbcsDrmConfiguration
    {
        /// <summary>
        /// Initializes a new instance of the CbcsDrmConfiguration class.
        /// </summary>
        public CbcsDrmConfiguration()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the CbcsDrmConfiguration class.
        /// </summary>
        /// <param name="fairPlay">FairPlay configurations</param>
        /// <param name="playReady">PlayReady configurations</param>
        /// <param name="widevine">Widevine configurations</param>
        public CbcsDrmConfiguration(StreamingPolicyFairPlayConfiguration fairPlay = default(StreamingPolicyFairPlayConfiguration), StreamingPolicyPlayReadyConfiguration playReady = default(StreamingPolicyPlayReadyConfiguration), StreamingPolicyWidevineConfiguration widevine = default(StreamingPolicyWidevineConfiguration))
        {
            FairPlay = fairPlay;
            PlayReady = playReady;
            Widevine = widevine;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets fairPlay configurations
        /// </summary>
        [JsonProperty(PropertyName = "fairPlay")]
        public StreamingPolicyFairPlayConfiguration FairPlay { get; set; }

        /// <summary>
        /// Gets or sets playReady configurations
        /// </summary>
        [JsonProperty(PropertyName = "playReady")]
        public StreamingPolicyPlayReadyConfiguration PlayReady { get; set; }

        /// <summary>
        /// Gets or sets widevine configurations
        /// </summary>
        [JsonProperty(PropertyName = "widevine")]
        public StreamingPolicyWidevineConfiguration Widevine { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="Rest.ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (FairPlay != null)
            {
                FairPlay.Validate();
            }
        }
    }
}


text:
// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
// Generated from waveclient-rpc.proto

package org.waveprotocol.wave.examples.fedone.waveserver;

import com.google.gwt.core.client.*;

public class WaveletSnapshot extends JavaScriptObject  {

    public static class Builder extends WaveletSnapshot {
      protected Builder() { }
      public final WaveletSnapshot build() {
        return (WaveletSnapshot)this;
      }
      public static native Builder create() /*-{
        return {
        };
      }-*/;
    }

    public static final Builder newBuilder() {
      return Builder.create();
    }

    /**
     * Creates a new WaveletSnapshot instance
     *
     * @return new WaveletSnapshot instance
     */
    public static native WaveletSnapshot create() /*-{
        return {
          "_protoMessageName": "WaveletSnapshot",
        };
    }-*/;

    /**
     * Creates a new JsArray<WaveletSnapshot> instance
     *
     * @return new JsArray<WaveletSnapshot> instance
     */
    public static native JsArray<WaveletSnapshot> createArray() /*-{
        return [];
    }-*/;

    /**
     * Returns the name of this protocol buffer.
     */
    public static native String getProtocolBufferName(JavaScriptObject instance) /*-{
        return instance._protoMessageName;
    }-*/;

    /**
     * Gets a WaveletSnapshot (casting) from a JavaScriptObject
     *
     * @param JavaScriptObject to cast
     * @return WaveletSnapshot
     */
    public static native WaveletSnapshot get(JavaScriptObject jso) /*-{
        return jso;
    }-*/;

    /**
     * Gets a JsArray<WaveletSnapshot> (casting) from a JavaScriptObject
     *
     * @param JavaScriptObject to cast
     * @return JsArray<WaveletSnapshot>
     */
    public static native JsArray<WaveletSnapshot> getArray(JavaScriptObject jso) /*-{
        return jso;
    }-*/;

    /**
     * Parses a WaveletSnapshot from a json string
     *
     * @param json string to be parsed/evaluated
     * @return WaveletSnapshot
     */
    public static native WaveletSnapshot parse(String json) /*-{
        return eval("(" + json + ")");
    }-*/;

    /**
     * Parses a JsArray<WaveletSnapshot> from a json string
     *
     * @param json string to be parsed/evaluated
     * @return JsArray<WaveletSnapshot>
     */
    public static native JsArray<WaveletSnapshot> parseArray(String json) /*-{
        return eval("(" + json + ")");
    }-*/;

    /**
     * Serializes a json object to a json string.
     *
     * @param WaveletSnapshot the object to serialize
     * @return String the serialized json string
     */
    public static native String stringify(WaveletSnapshot obj) /*-{
        var buf = [];
        var _1 = obj["1"];
        if(_1 != null && _1.length != 0) {
            buf.push("\"1\":[\"" + _1.join("\",\"") + "\"]");
        }
        var _2 = obj["2"];
        if(_2 != null && _2.length != 0) {
            var b = [], fn = @org.waveprotocol.wave.examples.fedone.waveserver.DocumentSnapshot::stringify(Lorg/waveprotocol/wave/examples/fedone/waveserver/DocumentSnapshot;);
            for(var i=0,l=_2.length; i<l; i++)
                b.push(fn(_2[i]));
            buf.push("\"2\":[" + b.join(",") + "]");
        }

        return buf.length == 0 ? "{}" : "{" + buf.join(",") + "}";
    }-*/;

    public static native boolean isInitialized(WaveletSnapshot obj) /*-{
        return true;
    }-*/;

    protected WaveletSnapshot() {}

    // getters and setters

    // participantId

    public final native JsArrayString getParticipantIdArray() /*-{
        return this["1"];
    }-*/;

    public final java.util.List<String> getParticipantIdList() {
        JsArrayString array = getParticipantIdArray();
        java.util.List<String> list = new java.util.ArrayList<String>();

        if (array == null) {
          return null;
        }
        for (int i=0; i < getParticipantIdCount(); i++) {
          list.add(array.get(i));
        }
        return list;
    }

    public final native WaveletSnapshot setParticipantIdArray(JsArrayString participantId) /*-{
        this["1"] = participantId;
        return this;
    }-*/;

    public final native JsArrayString clearParticipantIdArray() /*-{
        return (this["1"] = []);
    }-*/;

    public final String getParticipantId(int index) {
        JsArrayString array = getParticipantIdArray();
        return array == null ? null : array.get(index);
    }

    public final int getParticipantIdCount() {
        JsArrayString array = getParticipantIdArray();
        return array == null ? 0 : array.length();
    }

    public final void addParticipantId(String participantId) {
        JsArrayString array = getParticipantIdArray();
        if(array == null)
            array = clearParticipantIdArray();
        array.push(participantId);
    }

    // document

    public final native JsArray<DocumentSnapshot> getDocumentArray() /*-{
        return this["2"];
    }-*/;

    public final java.util.List<DocumentSnapshot> getDocumentList() {
        JsArray<DocumentSnapshot> array = getDocumentArray();
        java.util.List<DocumentSnapshot> list = new java.util.ArrayList<DocumentSnapshot>();

        if (array == null) {
          return null;
        }
        for (int i=0; i < getDocumentCount(); i++) {
          list.add(array.get(i));
        }
        return list;
    }

    public final native WaveletSnapshot setDocumentArray(JsArray<DocumentSnapshot> document) /*-{
        this["2"] = document;
        return this;
    }-*/;

    public final native JsArray<DocumentSnapshot> clearDocumentArray() /*-{
        return (this["2"] = []);
    }-*/;

    public final DocumentSnapshot getDocument(int index) {
        JsArray<DocumentSnapshot> array = getDocumentArray();
        return array == null ? null : array.get(index);
    }

    public final int getDocumentCount() {
        JsArray<DocumentSnapshot> array = getDocumentArray();
        return array == null ? 0 : array.length();
    }

    public final void addDocument(DocumentSnapshot document) {
        JsArray<DocumentSnapshot> array = getDocumentArray();
        if(array == null)
            array = clearDocumentArray();
        array.push(document);
    }

}


text:
package com.ccjeng.news.view.base;

import android.os.Bundle;
import android.view.MenuItem;

import com.google.android.gms.analytics.GoogleAnalytics;

import me.yokeyword.fragmentation.SwipeBackLayout;
import me.yokeyword.fragmentation_swipeback.SwipeBackActivity;

/**
 * Created by andycheng on 2016/6/17.
 */
public class BaseActivity  extends SwipeBackActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getSwipeBackLayout().setEdgeOrientation(SwipeBackLayout.EDGE_LEFT);

    }

    @Override
    protected void onStart() {
        super.onStart();
        GoogleAnalytics.getInstance(this).reportActivityStart(this);
    }

    @Override
    public void onStop() {
        super.onStop();
        GoogleAnalytics.getInstance(this).reportActivityStop(this);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                finish();
                break;
        }

        return super.onOptionsItemSelected(item);
    }
}


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

package com.google.devtools.build.lib.bazel.repository;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;
import com.google.common.io.ByteStreams;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.packages.AggregatingAttributeMapper;
import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.rules.repository.RepositoryFunction.RepositoryFunctionException;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunctionException;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.annotation.Nullable;

/**
 * Helper class for downloading a file from a URL.
 */
public class HttpDownloader {
  private static final int BUFFER_SIZE = 32 * 1024;

  private final String urlString;
  private final String sha256;
  private final String type;
  private final Path outputDirectory;
  private final EventHandler eventHandler;
  private final ScheduledExecutorService scheduler;

  private HttpDownloader(EventHandler eventHandler, String urlString, String sha256,
      Path outputDirectory, String type) {
    this.urlString = urlString;
    this.sha256 = sha256;
    this.outputDirectory = outputDirectory;
    this.eventHandler = eventHandler;
    this.scheduler = Executors.newScheduledThreadPool(1);
    this.type = type;
  }

  @Nullable
  public static Path download(Rule rule, Path outputDirectory, EventHandler eventHandler)
      throws RepositoryFunctionException {
    AggregatingAttributeMapper mapper = AggregatingAttributeMapper.of(rule);
    String url = mapper.get("url", Type.STRING);
    String sha256 = mapper.get("sha256", Type.STRING);
    String type = mapper.has("type", Type.STRING) ? mapper.get("type", Type.STRING) : "";

    try {
      return new HttpDownloader(eventHandler, url, sha256, outputDirectory, type).download();
    } catch (IOException e) {
      throw new RepositoryFunctionException(new IOException("Error downloading from "
          + url + " to " + outputDirectory + ": " + e.getMessage()),
          SkyFunctionException.Transience.TRANSIENT);
    }
  }

  /**
   * Attempt to download a file from the repository's URL. Returns the path to the file downloaded.
   */
  public Path download() throws IOException {
    URL url = new URL(urlString);
    String filename = new PathFragment(url.getPath()).getBaseName();
    if (filename.isEmpty()) {
      filename = "temp";
    }
    if (!type.isEmpty()) {
      filename += "." + type;
    }
    Path destination = outputDirectory.getRelative(filename);

    try {
      String currentSha256 = getHash(Hashing.sha256().newHasher(), destination);
      if (currentSha256.equals(sha256)) {
        // No need to download.
        return destination;
      }
    } catch (IOException e) {
      // Ignore error trying to hash. We'll just download again.
    }

    AtomicInteger totalBytes = new AtomicInteger(0);
    final ScheduledFuture<?> loggerHandle = getLoggerHandle(totalBytes);

    try (OutputStream out = destination.getOutputStream();
         InputStream in = getInputStream(url)) {
      int read;
      byte[] buf = new byte[BUFFER_SIZE];
      while ((read = in.read(buf)) > 0) {
        totalBytes.addAndGet(read);
        out.write(buf, 0, read);
      }
    } catch (IOException e) {
      throw new IOException(
          "Error downloading " + url + " to " + destination + ": " + e.getMessage());
    } finally {
      scheduler.schedule(new Runnable() {
        @Override
        public void run() {
          loggerHandle.cancel(true);
        }
      }, 0, TimeUnit.SECONDS);
    }

    String downloadedSha256;
    try {
      downloadedSha256 = getHash(Hashing.sha256().newHasher(), destination);
    } catch (IOException e) {
      throw new IOException(
          "Could not hash file " + destination + ": " + e.getMessage() + ", expected SHA-256 of "
              + sha256 + ")");
    }
    if (!downloadedSha256.equals(sha256)) {
      throw new IOException(
          "Downloaded file at " + destination + " has SHA-256 of " + downloadedSha256
              + ", does not match expected SHA-256 (" + sha256 + ")");
    }
    return destination;
  }

  private ScheduledFuture<?> getLoggerHandle(final AtomicInteger totalBytes) {
    final Runnable logger = new Runnable() {
      private static final int KB = 1024;
      private static final String UNITS = " KMGTPEY";
      private final double logOfKb = Math.log(1024);

      @Override
      public void run() {
        try {
          eventHandler.handle(Event.progress(
              "Downloading from " + urlString + ": " + formatSize(totalBytes.get())));
        } catch (Exception e) {
          eventHandler.handle(Event.error(
              "Error generating download progress: " + e.getMessage()));
        }
      }

      private String formatSize(int bytes) {
        if (bytes < KB) {
          return bytes + "B";
        }
        int logBaseUnitOfBytes = (int) (Math.log(bytes) / logOfKb);
        if (logBaseUnitOfBytes < 0 || logBaseUnitOfBytes >= UNITS.length()) {
          return bytes + "B";
        }
        return (int) (bytes / Math.pow(KB, logBaseUnitOfBytes))
            + (UNITS.charAt(logBaseUnitOfBytes) + "B");
      }
    };
    return scheduler.scheduleAtFixedRate(logger, 0, 1, TimeUnit.SECONDS);
  }

  private InputStream getInputStream(URL url) throws IOException {
    HttpURLConnection connection = (HttpURLConnection) url.openConnection(
        createProxyIfNeeded(url.getProtocol()));
    connection.setInstanceFollowRedirects(true);
    connection.connect();
    if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
      return connection.getInputStream();
    }

    InputStream errorStream = connection.getErrorStream();
    throw new IOException(connection.getResponseCode() + ": "
        + new String(ByteStreams.toByteArray(errorStream), StandardCharsets.UTF_8));
  }

  private static Proxy createProxyIfNeeded(String protocol) throws IOException {
    if (protocol.equals("https")) {
      return createProxy(System.getenv("HTTPS_PROXY"));
    } else if (protocol.equals("http")) {
      return createProxy(System.getenv("HTTP_PROXY"));
    }
    return Proxy.NO_PROXY;
  }

  @VisibleForTesting
  static Proxy createProxy(String proxyAddress) throws IOException {
    if (Strings.isNullOrEmpty(proxyAddress)) {
      return Proxy.NO_PROXY;
    }

    // Here there be dragons.
    Pattern urlPattern =
        Pattern.compile("^(https?)://(?:([^:@]+?)(?::([^@]+?))?@)?(?:[^:]+)(?::(\\d+))?$");
    Matcher matcher = urlPattern.matcher(proxyAddress);
    if (!matcher.matches()) {
      throw new IOException("Proxy address " + proxyAddress + " is not a valid URL");
    }

    String protocol = matcher.group(1);
    final String username = matcher.group(2);
    final String password = matcher.group(3);
    String port = matcher.group(4);

    boolean https;
    switch (protocol) {
      case "https":
        https = true;
        break;
      case "http":
        https = false;
        break;
      default:
        throw new IOException("Invalid proxy protocol for " + proxyAddress);
    }

    if (username != null) {
      if (password == null) {
        throw new IOException("No password given for proxy " + proxyAddress);
      }
      System.setProperty(protocol + ".proxyUser", username);
      System.setProperty(protocol + ".proxyPassword", password);

      Authenticator.setDefault(
          new Authenticator() {
            public PasswordAuthentication getPasswordAuthentication() {
              return new PasswordAuthentication(username, password.toCharArray());
            }
          });
    }

    if (port == null) {
      return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyAddress, https ? 443 : 80));
    }

    try {
      return new Proxy(
          Proxy.Type.HTTP,
          new InetSocketAddress(
              proxyAddress.substring(0, proxyAddress.lastIndexOf(':')), Integer.parseInt(port)));
    } catch (NumberFormatException e) {
      throw new IOException("Error parsing proxy port: " + proxyAddress);
    }
  }

  public static String getHash(Hasher hasher, Path path) throws IOException {
    byte byteBuffer[] = new byte[BUFFER_SIZE];
    try (InputStream stream = path.getInputStream()) {
      int numBytesRead = stream.read(byteBuffer);
      while (numBytesRead != -1) {
        if (numBytesRead != 0) {
          // If more than 0 bytes were read, add them to the hash.
          hasher.putBytes(byteBuffer, 0, numBytesRead);
        }
        numBytesRead = stream.read(byteBuffer);
      }
    }
    return hasher.hash().toString();
  }
}


text:
CarouselCollectionModelObject::CarouselCollectionModelObject(const uint64_t &collectionId, const QString &picPath, const QString &collectionName)
    :
      collectionId(collectionId),
      picPath(picPath),
      collectionName(collectionName)
{}


text:
<TITLE>Review for Gone in Sixty Seconds (2000)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Gone in Sixty Seconds (2000)

reviewed by
Chad Polenz

Gone In 60 Seconds

Nicholas Cage is Randall "Memphis" Raines, a retired car thief who is
blackmailed back into the business by a really creepy crime ring
leader who will kill Raines' younger brother Kip (Giovanni Ribisi)
because of something he messed up. Raines has to steal 50 cars in a
short amount of time and in order to do he has to round up a gang of
characters that could only be found in a Jerry Bruckheimer movie.

If you saw "Armageddon" or "Con Air" you can make a lot of assumptions
about this film and be correct.  The difference this time is that the
subject matter is a little more tame, the tone is lighthearted and
fun, it's not so trite and unbelievable. Raines is a nice guy but
technically, he's a criminal, yet we don't want him to be
caught. There's a subplot involving two detectives' efforts to catch
Raines and his gang and amazingly, it works well and is actually
suspenseful and exciting - exactly what a summer movie should be!
Think of as a thriller for the whole family.

GRADE: B+

Chad'z Movie Page is back!
New reviews of the latest movies in easy-to-swallow capsule form with the
trendy, Entertainment Weekly-style of letter grades instead of the old star
system. Have I sold out? Visit my page and decide for yourself ;-)

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
(function() {
    function CollectionCtrl(Fixtures) {
      this.albums = [];
      for (var i=0; i < 12; i++) {
        this.albums.push(angular.copy(Fixtures.getAlbum()));
      }
      this.albums = Fixtures.getCollection(12);
    }

    angular
        .module('blocJams')
        .controller('CollectionCtrl', ["Fixtures", CollectionCtrl]);

})();


text:
<!--
Copyright 2017 The Kubernetes Dashboard Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<div ng-transclude
     class="kd-user-help"
     layout-align="start center"> </div>