text:
package com.nortal.jroad.client.rr;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.apache.xmlbeans.XmlString;
import org.springframework.stereotype.Service;

import com.nortal.jroad.client.exception.XRoadServiceConsumptionException;
import com.nortal.jroad.client.rr.database.RrXRoadDatabase;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.DokumendiTyyp;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.IsikuStaatus;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR40Request;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR40Response;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR41Request;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR41RequestV1;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR41ResponseV1;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR42Request;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR42Response;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR43Request;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR43Response;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR52Request;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR52Response;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR63RequestV1;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR63ResponseV1;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR67Request;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR67Response;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR72Request;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR81Request;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR81RequestV1;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR81Response;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR81ResponseV1;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR84Request;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR84Response;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR96RequestV1;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR96ResponseV1;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RRExtDocumentDataRequest;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RRExtDocumentDataResponse;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR67Response.TtKoodid;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RR72Response.TtIsikud;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RRPORTTEOVOIMERequest;
import com.nortal.jroad.client.rr.types.ee.riik.xtee.rr.producers.producer.rr.RRPORTTEOVOIMEResponse;
import com.nortal.jroad.client.util.XmlBeansUtil;

/**
 * @author Roman Tekhov
 */
@Service("rrXTeeService")
public class RrXTeeServiceImpl implements RrXTeeService {

	@Resource
	private RrXRoadDatabase rrXRoadDatabase;

	public RR42Response findRR42isikAadressKood(RR42RequestCallback callback)
			throws XRoadServiceConsumptionException {
		RR42Request paring = RR42Request.Factory.newInstance();

		callback.populate(paring);

		return rrXRoadDatabase.rr42IsikAadressKoodV1(paring);
	}

	public RR40Response findRR40isikTaielikIsikukood(String isikukood)
			throws XRoadServiceConsumptionException {
		RR40Request paring = RR40Request.Factory.newInstance();

		XmlString isikukoodElement = XmlBeansUtil
				.getAttributedXmlString(isikukood);
		paring.xsetIsikukood(isikukoodElement);

		return rrXRoadDatabase.rr40IsikTaielikIsikukoodV1(paring);
	}

	public List<TtIsikud.Item> findRR72Isik(String... idCodes)
			throws XRoadServiceConsumptionException {
		RR72Request request = RR72Request.Factory.newInstance();

		String isikukoodid = StringUtils.join(idCodes, ",");
		XmlString isikukoodidElement = XmlBeansUtil
				.getAttributedXmlString(isikukoodid);
		request.xsetCIsikukoodid(isikukoodidElement);

		TtIsikud ttIsikud = rrXRoadDatabase.rr72IsikV1(request).getTtIsikud();

		return ttIsikud != null ? ttIsikud.getItemList()
				: new ArrayList<TtIsikud.Item>(0);
	}

	public RR63ResponseV1 findRR63IsikAadrDok(String surname, String firstName,
			String idCode, String birthDate)
			throws XRoadServiceConsumptionException {

		RR63RequestV1 request = RR63RequestV1.Factory.newInstance();
		XmlString eesnimiElement = XmlBeansUtil
				.getAttributedXmlString(firstName);
		request.xsetIsikueesnimi(eesnimiElement);
		XmlString perenimiElement = XmlBeansUtil
				.getAttributedXmlString(surname);
		request.xsetIsikuperenimi(perenimiElement);
		XmlString isikukoodElement = XmlBeansUtil
				.getAttributedXmlString(idCode);
		request.xsetIsikukood(isikukoodElement);
		XmlString synnikpElement = XmlBeansUtil
				.getAttributedXmlString(birthDate);
		request.xsetIsikuSynnikuupaev(synnikpElement);

		return rrXRoadDatabase.rr63IsikAadrDokV1V1(request);
	}

	public RR81Response getRR81KMAisikkontroll(String idCode)
			throws XRoadServiceConsumptionException {
		RR81Request request = RR81Request.Factory.newInstance();

		XmlString isikukoodElement = XmlBeansUtil
				.getAttributedXmlString(idCode);
		request.xsetIsikukood(isikukoodElement);

		return rrXRoadDatabase.rr81KMAisikkontrollV1(request);
	}

	public RR81ResponseV1 getRR81KMAisikkontrollv1(String idCode)
			throws XRoadServiceConsumptionException {
		RR81RequestV1 request = RR81RequestV1.Factory.newInstance();

		XmlString isikukoodElement = XmlBeansUtil
				.getAttributedXmlString(idCode);
		request.xsetIsikukood(isikukoodElement);

		return rrXRoadDatabase.rr81KMAisikkontrollV1V1(request);
	}

	public RR52Response getRR52(String idCode, String forename, String surname)
			throws XRoadServiceConsumptionException {
		RR52Request request = RR52Request.Factory.newInstance();

		XmlString isikukoodElement = XmlBeansUtil
				.getAttributedXmlString(idCode);
		request.xsetIsikukood(isikukoodElement);

		XmlString forenameElement = XmlBeansUtil
				.getAttributedXmlString(forename);
		request.xsetIsikueesnimi(forenameElement);

		XmlString surnameElement = XmlBeansUtil.getAttributedXmlString(surname);
		request.xsetIsikuperenimi(surnameElement);

		return rrXRoadDatabase.rr52V1(request);
	}

	public RR43Response getRR43dokument(final String dokumendiKood,
			final String dokumendiSeeria, DokumendiTyyp.Enum dokumendiTyyp)
			throws XRoadServiceConsumptionException {
		RR43Request request = RR43Request.Factory.newInstance();

		request.setDokumendiKood(dokumendiKood);
		request.setDokumendiSeeria(dokumendiSeeria);
		request.setDokumendiTyyp(dokumendiTyyp);

		return rrXRoadDatabase.rr43DokumentV1(request);
	}

	public RR96ResponseV1 getRR96isikDokElukSuhe(final String isikueesnimi,
			final String isikuperenimi, final String isikukood,
			final Long vastusteArv) throws XRoadServiceConsumptionException {
		RR96RequestV1 request = RR96RequestV1.Factory.newInstance();

		request.setIsikueesnimi(isikueesnimi);
		request.setIsikuperenimi(isikuperenimi);
		request.setIsikukood(isikukood);
		request.setVastusteArv(String.valueOf(vastusteArv));

		return rrXRoadDatabase.rr96IsikDokElukSuheV1V1(request);
	}

	public RRExtDocumentDataResponse sendRRExtDocumentDataArkLuba(
			RRExtDocumentDataRequest request)
			throws XRoadServiceConsumptionException {
		return rrXRoadDatabase.rrExtDocumentDataArkLubaV1(request);
	}

	public List<TtKoodid.Item> findRR67MuutusV1(Date algus, Date lopp,
			String... koodid) throws XRoadServiceConsumptionException {
		RR67Request request = RR67Request.Factory.newInstance();

		SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy");
		SimpleDateFormat tf = new SimpleDateFormat("HH:mm");
		if (koodid != null) {
			String codes = "";
			for (String item : koodid) {
				codes += codes.length() > 0 ? "," : "";
				codes += item;
			}
			request.setCMuutused(codes);
		}
		if (algus != null) {
			request.setCAlgKpv(df.format(algus));
			request.setCAlgKell(tf.format(algus));
		}

		if (lopp != null) {
			request.setCLoppKpv(df.format(lopp));
			request.setCLoppKell(tf.format(lopp));
		}
		RR67Response rsp = rrXRoadDatabase.rr67MuutusV1(request);
		return rsp.getTtKoodid() != null ? rsp.getTtKoodid().getItemList()
				: new ArrayList<TtKoodid.Item>();
	}

	public RR84Response findRR84IsikuSeosed(String isikukood)
	    throws XRoadServiceConsumptionException {
	  RR84Request request = RR84Request.Factory.newInstance();
	  request.setIsikukood(isikukood);
	  return rrXRoadDatabase.rr84IsikuSeosedV1(request);
	}

	public RR41ResponseV1 findRR41isikPohiandmedV1(String perenimi, String eesnimi, String isikukood,
			String vald, IsikuStaatus staatus, Long vastusteArv)
			throws XRoadServiceConsumptionException {
		RR41RequestV1 request = RR41RequestV1.Factory.newInstance();

		request.setIsikuperenimi(perenimi);
		request.setIsikueesnimi(eesnimi);
		request.setIsikukood(isikukood);
		request.setVald(vald);
		request.xsetStaatus(staatus);
		request.setMitu(String.valueOf(vastusteArv));

		return rrXRoadDatabase.rr41IsikPohiandmedV1V1(request);
	}

	public RRPORTTEOVOIMEResponse getRRPortTeovoimeV1(String isikukood)
			throws XRoadServiceConsumptionException {
		RRPORTTEOVOIMERequest request = RRPORTTEOVOIMERequest.Factory.newInstance();
		request.setIsikukood(isikukood);

		return rrXRoadDatabase.rrportteovoimeV1(request);
	}
}


text:
"""
Django settings for api project.

Generated by 'django-admin startproject' using Django 1.9.5.

For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""

from settings import *

DEBUG = False

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'test_database',
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

mb_language('Japanese');
mb_internal_encoding('UTF-8');

//----Initialise----------------

$_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__) . '/..';

include $_SERVER['DOCUMENT_ROOT'] . '/conf/include_files.php';

//----/Initialise---------------

//----Start----------------

//note file as downloaded from jdic.com is EUC-JP :-/
$handle = @fopen($_SERVER['DOCUMENT_ROOT'] . '/csv/edict/edict2', 'r');
//$handle = @fopen($_SERVER['DOCUMENT_ROOT'] . '/csv/edict/edict_newer', 'r');
//$handle = @fopen($_SERVER['DOCUMENT_ROOT'] . '/csv/edict/edict_subset', 'r');

$lines_in_file = 0;
$correct_lines = 0;

if($handle)
{
	while(($line = fgets($handle, 4096)) !== false)
	{
		$lines_in_file++;

        //echo $line;

        $line = mb_convert_encoding($line, 'UTF-8', 'EUC-JP');

        //echo $line;

        $parts = explode("/", $line);

        //skip "header" line (actually not at top of edict2 file!?!)
        if($parts[0] == ' ??? ')
        {
            continue;
        }

        $common = 'n';

        //print_r($parts);
        if($parts[count($parts) - 3] == '(P)')
        {
            //print_r($parts);
            $common = 'y';
        }
        //continue;

        $kanji_and_poss_kana = trim($parts[0], '] ');

        $kanji_and_kana_parts = explode(' [', $kanji_and_poss_kana);

        //

        $kanji = '';
        $kana = '';
        $have_kana = false; //do we have kana for a kanji word?

        //kanji word and kana reading both present
        if(count($kanji_and_kana_parts) > 1)
        {
            //take only first of multiple spellings / readings

        	$kana = remove_bracketed_all(get_first_from_semicolon_list($kanji_and_kana_parts[1]));
        	$kanji = remove_bracketed_meta(get_first_from_semicolon_list($kanji_and_kana_parts[0]));
        	$have_kana = true;
        }

        else    //word not in kanji in the first place (ie. same as reading)
        {
            //take only first of multiple spellings / readings

            $kanji = remove_bracketed_meta(get_first_from_semicolon_list($kanji_and_poss_kana));
            $kana = remove_bracketed_all(get_first_from_semicolon_list($kanji_and_poss_kana));
        }

        //print_r(array($kanji, $kana));

        array_shift($parts);

        $definitions = array();

        foreach($parts as $defSegment)
        {
            $defSegment = trim($defSegment);

            if(empty($defSegment))
            {
                continue;
            }

            if(strpos($defSegment, 'EntL') === 0)
            {
                continue;
            }

            $def = remove_bracketed_meta($defSegment);

            if(!empty($def))
            {
                $definitions[] = $def;
            }
        }

        if(empty($definitions))
        {
            echo "NOTE no defs" . PHP_EOL;
        }

        //print_r($definitions);

        //echo '----------------' . PHP_EOL;

        $flat_defs = implode('/', $definitions);

        $safeKanji = MySQL::esc($kanji);
        $safeKana = MySQL::esc($kana);
        $safeDefinition = MySQL::esc("/{$flat_defs}/");   //add head and tail slashes for easier searching (in liguistics.php)

        MySQL::exec("INSERT INTO edict(kanji, kana, definition, common) VALUES('{$safeKanji}', '{$safeKana}', '{$safeDefinition}', '{$common}')");

	}
}

//echo "\n{$lines_in_file} total lines :: {$correct_lines} correct lines\n";

//UTILITY----------------

/**
 * remove meta type information in brackets (eg . "(See blah)" or "(vs)" or "(1)")
 * but not if like "(one two)" [ie. with internal space] because these are useful
 * to the definition.
 * note this also removes the actual brackets.
 *
 * @author Daniel Rhodes
 *
 * @param string $string
 * @return string
 */
function remove_bracketed_meta($string)
{
    //'U' modifier means ungreedy

	$temp = preg_replace('/[(][A-Za-z0-9,:-]{1,}[)]/', '', $string);

    $temp = preg_replace('/[(]See[ ].*[)]/U', '', $temp);

    return trim($temp);
}

/**
 * remove anything in brackets (including the brackets)
 *
 * @author Daniel Rhodes
 *
 * @param string $string
 * @return string
 */
function remove_bracketed_all($string)
{
    //'U' modifier means ungreedy
    //'u' modifier mean utf-8 unicode

	//$temp = preg_replace('/[(][A-Za-z0-9,:-]{1,}[)]/', '', $string);

    $temp = preg_replace('/[(].*[)]/U', '', $string);

    return trim($temp);
}

/**
 * return first item from a semicolon-separated list of items
 *
 * @author Daniel Rhodes
 *
 * @param string $list
 * @return string
 */
function get_first_from_semicolon_list($list)
{
    $items = explode(';', $list);

    if(is_array($items))
    {
        return $items[0];
    }

    return $items;  //no semicolons anyway
}


text:
<?php

require "Snoopy.class.php";

if (!function_exists('json_decode')){
  require('compat.json.php');
  function json_decode($input) {
    $json = new Services_JSON();
    return $json->decode($input);
  }
  function json_encode($input) {
    $json = new Services_JSON();
    return $json->encode($input);
  }
}

/** @var string host name from which to allow access */
$allowed_hosts = array(
    "there4development.com",
    $_SERVER["HTTP_HOST"]
    );

/** @var array urls of geo location service in order of failover from primary and secondary */
$geo_locations = array(
    "http://ipinfodb.com/ip_locator.php",
    "http://backup.ipinfodb.com/ip_locator.php"
    );

/** @var array query paramters to send the location service */
$vars = array(
    'output'   => 'json',
    'timezone' => $_REQUEST['timezone'],
    'ip'       => $_REQUEST['ip']
    );

// Only allow this to be used by ourselves
if (!in_array(parse_url($_SERVER['HTTP_REFERER'],PHP_URL_HOST), $allowed_hosts)) {
  exitWithError('This service is not allowed from your referring host.');
}

// Use snoopy to make the IP request
foreach ($geo_locations as $geo_location) {
  $snoopy = new Snoopy;
  if ($snoopy->fetch($geo_location . '?' . http_build_query($vars))) {
    break;
  }
}

if ('' == $snoopy->results) {
  exitWithError('IpInfoDB service is currently unavailable');
}

// Add an extra State two letter code to these results
$data = json_decode($snoopy->results);
$data->State = state_to_code($data->RegionName);

// remove some of the bits that we don't need and save some bytes.
$unneeded_keys = array("CountryCode","CountryName","RegionCode","Latitude","Longitude");
foreach ($unneeded_keys as $key) {
  unset($data->$key);
}

// Encode and return the data
header('Content-type: text/json');
print json_encode($data);
exit();

/**
* Return an error message
*
* @var string $message
*/
function exitWithError($message) {
  header('Content-type: text/json');
  print json_encode(array(
    'Status'  => 'Error',
    'Message' => $message
    ));
  exit();
}

/**
* Translate a state name to a two letter code
*
* @var string $name Name of a USA state
* @return string Two letter iso code for a USA state, or "--"
*/
function state_to_code($name) {
  if ($name == '') { return '--'; }
  $states = array_flip(array(
    'AL' => 'Alabama',
    'AK' => 'Alaska',
    'AS' => 'American Samoa',
    'AZ' => 'Arizona',
    'AR' => 'Arkansas',
    'CA' => 'California',
    'CO' => 'Colorado',
    'CT' => 'Connecticut',
    'DE' => 'Delaware',
    'DC' => 'District of Columbia',
    'EA' => 'Pearson Core Standards',
    'FM' => 'Federated States of Micronesia',
    'FL' => 'Florida',
    'GA' => 'Georgia',
    'GU' => 'Guam',
    'HI' => 'Hawaii',
    'ID' => 'Idaho',
    'IL' => 'Illinois',
    'IN' => 'Indiana',
    'IA' => 'Iowa',
    'KS' => 'Kansas',
    'KY' => 'Kentucky',
    'LA' => 'Louisiana',
    'ME' => 'Maine',
    'MH' => 'Marshall Islands',
    'MD' => 'Maryland',
    'MA' => 'Massachusetts',
    'MI' => 'Michigan',
    'MN' => 'Minnesota',
    'MS' => 'Mississippi',
    'MO' => 'Missouri',
    'MT' => 'Montana',
    'NE' => 'Nebraska',
    'NV' => 'Nevada',
    'NH' => 'New Hampshire',
    'NJ' => 'New Jersey',
    'NM' => 'New Mexico',
    'NY' => 'New York',
    'NC' => 'North Carolina',
    'ND' => 'North Dakota',
    'MP' => 'Northern Mariana Islands',
    'OH' => 'Ohio',
    'OK' => 'Oklahoma',
    'OR' => 'Oregon',
    'PW' => 'Palau',
    'PA' => 'Pennsylvania',
    'PR' => 'Puerto Rico',
    'RI' => 'Rhode Island',
    'SC' => 'South Carolina',
    'SD' => 'South Dakota',
    'TN' => 'Tennessee',
    'TX' => 'Texas',
    'UT' => 'Utah',
    'VT' => 'Vermont',
    'VI' => 'Virgin Islands',
    'VA' => 'Virginia',
    'WA' => 'Washington',
    'WV' => 'West Virginia',
    'WI' => 'Wisconsin',
    'WY' => 'Wyoming'
  ));
  if (isset($states[$name])) { return $states[$name]; }
  return '--';
}

?>


text:
<component name="libraryTable">
  <library name="Maven: org.apache.httpcomponents:httpcore:4.3.3">
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$MAVEN_REPOSITORY$/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
`phone` is used to normalize the `mobile` phone number into a E.164 format.

The common problem is user normally input the phone number in this way:

```
`(817) 569-8900` or
`817569-8900` or
`1(817) 569-8900` or
`+1(817) 569-8900` or ...
```

What we want is always:

```
+18175698900
```

## Install
```
npm install phone
```

## Usage
```javascript
import phone from 'phone';
phone('+852 6569-8900'); // return ['+85265698900', 'HKG']
phone('(817) 569-8900'); // return ['+18175698900, 'USA']
phone('(817) 569-8900', ''); // return ['+18175698900, 'USA']
phone('(817) 569-8900', 'USA'); // return ['+18175698900', 'USA']
phone('(817) 569-8900', 'HKG'); // return []
phone('+1(817) 569-8900', 'HKG'); // return [], as it is not a valid HKG mobile phone number
phone('+1(817) 569-8900', ''); // return ['+18175698900', 'USA']
phone('(817) 569-8900', ''); // return ['+18175698900', 'USA']
phone('6123-6123', ''); // return [], as default country is USA
phone('6123-6123', 'HKG'); // return ['+85261236123', 'HKG']
```

## Test

```
npm test
```

## Old browsers & browser support

We currently transpile script to base on target env which that browser global usage '>1%' and "node: 6.10".

You can check on the [browserlist](http://browserl.ist/?q=%3E1%25)
You also need polyfill for some old browser more details please read the `README` inside the `example` folder

## FAQ

1. Does `phone` do any phone validation?

	Yes: If you provide the 2nd parameter (country), and the phone number do not start with `+` sign.

	`phone` will validate `phone_number_lengths` and `mobile_begin_with`

2. Why some of the number is valid, but return null?
	This npm is used to validate a mobile phone number for sending the SMS.
	So, we try to match all possible rule, such as area code, number prefix, etc. to test if it is a mobile phone number.
	However, some countries, like USA, we can only check if it is a valid `AREA CODE`, there is no mobile phone prefix.

	For UK, we know that mobile phone number is always start with `7`, in this case, this npm will be more helpful.

3. Why do you make this?

	Because we need to normalize the phone number for SMS notification for mobile phone only.

We don't validate if the number is mobile or not.

## Help

We try to google for many results, but none of package can fit our need.
If you know that our rule is wrong, or can add more validation to make this npm more accurate.
Please open an issue and let us know.

## License
MIT


text:
MLLAYOUT_SYNTH_DUMMY_CLASS(UIView_DeallocCallbackForMLLayout)

@interface DeallocCallbackObjectForMLLayout : NSObject

@property (nonatomic, weak) MLLayout *layout;
@property (nonatomic, copy) void(^deallocCallback)(MLLayout *layout);

@end

@implementation DeallocCallbackObjectForMLLayout

- (void)dealloc {
    if (_layout&&_deallocCallback) {
        _deallocCallback(_layout);
    }
}

@end

@interface UIView()

@property (nonatomic, strong) NSMutableArray *mlLayout_deallocCallbackObjects;

@end

@implementation UIView (DeallocCallbackForMLLayout)

MLLAYOUT_SYNTH_DYNAMIC_PROPERTY_OBJECT(mlLayout_deallocCallbackObjects, setMlLayout_deallocCallbackObjects:, RETAIN_NONATOMIC, NSMutableArray*)

- (void)mlLayout_setDeallocCallback:(void(^)(MLLayout *l))callback forLayout:(MLLayout*)layout {
    NSParameterAssert(layout);
    NSParameterAssert(callback);
    NSAssert([layout.view isEqual:self], @"`layout.view` must be equal to the callee with `mlLayout_setDeallocCallback:forLayout:` ");

    if (!self.mlLayout_deallocCallbackObjects) {
        self.mlLayout_deallocCallbackObjects = [NSMutableArray array];
    }

    DeallocCallbackObjectForMLLayout *object = [self mlLayout_deallocCallbackObjectForMLLayout:layout];
    if (!object) {
        object = [DeallocCallbackObjectForMLLayout new];
        object.layout = layout;
    }
    [object setDeallocCallback:callback];

    [self.mlLayout_deallocCallbackObjects addObject:object];
}

- (void)mlLayout_removeDeallocCallbackForLayout:(MLLayout *)layout {
    DeallocCallbackObjectForMLLayout *object = [self mlLayout_deallocCallbackObjectForMLLayout:layout];
    object.deallocCallback = nil;
    [self.mlLayout_deallocCallbackObjects removeObject:object];
}

- (DeallocCallbackObjectForMLLayout *)mlLayout_deallocCallbackObjectForMLLayout:(MLLayout*)layout {
    for (DeallocCallbackObjectForMLLayout *object in self.mlLayout_deallocCallbackObjects) {
        if ([object.layout isEqual:layout]) {
            return object;
        }
    }
    return nil;
}

@end


text:
#ifndef LIEF_EXCEPTIONS_H_
#define LIEF_EXCEPTIONS_H_

#include <exception>
#include <stdexcept>
#include <string>

#include "LIEF/visibility.h"

namespace LIEF {

class LIEF_API exception : public std::exception {
  public:

    exception(const exception& other);
    explicit exception(std::string  msg);
    explicit exception(const char* msg);
    const char* what() const noexcept override;
    virtual ~exception() noexcept;

  protected:
    std::string msg_;

};

class LIEF_API bad_file : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API bad_format : public bad_file {
  public:
  using bad_file::bad_file;
  using bad_file::what;
};

class LIEF_API not_implemented : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API not_supported : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API integrity_error : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API read_out_of_bound : public exception {
  public:
  using exception::exception;
  using exception::what;
  explicit read_out_of_bound(uint64_t offset, uint64_t size);
  explicit read_out_of_bound(uint64_t offset);

};

class LIEF_API not_found : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API corrupted : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API conversion_error : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API type_error : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API builder_error : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API parser_error : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API pe_error : public exception {
  public:
  using exception::exception;
  using exception::what;
};

class LIEF_API pe_bad_section_name : public pe_error {
  public:
  using pe_error::pe_error;
  using pe_error::what;
};

} //namespace ELF
#endif


text:
class CreateCourses < ActiveRecord::Migration
  def change
    create_table :courses do |t|
      t.string :title
      t.string :code
      t.references :user
      t.timestamps null: false
    end
  end
end


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>wCMF 4.0: OptimisticLockException Class Reference</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="A MDSD framework for building reliable, maintainable and extendable web applications with PHP">
  <meta name="keywords" content="PHP, web application framework, model driven development">
  <meta name="author" content="wemove digital solutions">
  <link rel="shortcut icon" href="theme/images/favicon.ico">

  <link href="theme/css/doxstyles.css" rel="stylesheet">

  <link href="theme/bootstrap3/css/bootstrap.min.css" rel="stylesheet">
  <link href="theme/bootstrap3/css/font-awesome.min.css" rel="stylesheet">

  <link href="theme/js/tocify/jquery.tocify.css" rel="stylesheet">

  <link href="theme/css/syntax.css" rel="stylesheet">
  <link href="theme/css/style.css" rel="stylesheet">

          <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".menu-navbar-collapse">
            Toggle navigation
          </button>
          wCMF 4.0

 Guides

Getting started

Architecture

Model

Persistence

Presentation

Configuration

Security

I18n & l10n

Tests

 API

 Code

 Support

                <input id="MSearchField" type="text" class="form-control" placeholder="Search API" name="query" onkeyup="searchBox.OnSearchFieldChange(event)">

wcmf

lib

persistence

concurrency

OptimisticLockException

Public Member Functions |
List of all members

OptimisticLockException Class Reference

Detailed Description

OptimisticLockException signals an exception when trying to create an optimistic lock.

Author

ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 19 of file OptimisticLockException.php.

   Inheritance diagram for OptimisticLockException:

This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.

Public Member Functions

 	__construct ($currentState)

 	getCurrentState ()

Constructor & Destructor Documentation

          __construct
          (

          $currentState	)

Constructor.

Parameters

$currentState	PersistentObject instance representing the current object state or null, if the object is deleted

Definition at line 28 of file OptimisticLockException.php.

Member Function Documentation

          getCurrentState
          (
          	)

Get the current object.

Returns

PersistentObject instance

Definition at line 45 of file OptimisticLockException.php.

        © 2016 wemove digital solutions

          Generated on Fri Jul 15 2016 22:20:47 for wCMF by  doxygen 1.8.10


text:
#ifndef QUASAR_FDW_QUASAR_FDW_H
#define QUASAR_FDW_QUASAR_FDW_H

#include "postgres.h"
#include "executor/tuptable.h"
#include "foreign/foreign.h"
#include "funcapi.h"
#include "lib/stringinfo.h"
#include "nodes/execnodes.h"
#include "nodes/relation.h"
#include "utils/rel.h"

#include "yajl/yajl_parse.h"
#include <curl/curl.h>

#define BUF_SIZE 65536
#define DEFAULT_CURL_TIMEOUT_MS 1000

/* Default option values */
#define DEFAULT_SERVER "http://localhost:8080"
#define DEFAULT_PATH "/test"
#define DEFAULT_TIMEOUT_MS 1000
#define DEFAULT_FDW_USE_REMOTE_ESTIMATE true
/* Cost to start up a query */
#define DEFAULT_FDW_STARTUP_COST 100.0
/* Cost to process a tuple */
#define DEFAULT_FDW_TUPLE_COST 0.01
/* Multiplier on cost to sort (~= n * log n) */
#define DEFAULT_FDW_SORT_MULTIPLIER 1.2 /* 20% */
/* ASSUME join conditions limit rowcount to 1 */
#define DEFAULT_FDW_JOIN_ROWCOUNT_ESTIMATE 1
#define QUASAR_STARTUP_COST 10.0
#define QUASAR_PER_TUPLE_COST 0.001

/*
 * FDW-specific planner information kept in RelOptInfo.fdw_private for a
 * foreign table.  This information is collected by postgresGetForeignRelSize.
 */
typedef struct QuasarFdwRelationInfo
{
    /* baserestrictinfo clauses, broken down into safe and unsafe subsets. */
    List       *remote_conds;
    List       *local_conds;

    /* Bitmap of attr numbers we need to fetch from the remote server. */
    Bitmapset  *attrs_used;

    /* Cost and selectivity of local_conds. */
    QualCost        local_conds_cost;
    Selectivity local_conds_sel;

    /* Estimated size and cost for a scan with baserestrictinfo quals. */
    double          rows;
    int                     width;
    Cost            startup_cost;
    Cost            total_cost;

    /* Options extracted from catalogs. */
    bool            use_remote_estimate;
    Cost            fdw_startup_cost;
    Cost            fdw_tuple_cost;
    List       *shippable_extensions;       /* OIDs of whitelisted extensions */

    /* Cached catalog information. */
    ForeignTable *table;
    ForeignServer *server;
} QuasarFdwRelationInfo;

typedef struct quasar_parse_context
{
    yajl_handle handle;
    void *p;
} quasar_parse_context;

typedef struct quasar_query_curl_context {
    int status;
    bool is_query;              /* True if SELECT, False if EXPLAIN */
    quasar_parse_context parse;

    MemoryContext batchmem;     /* Context for each batch of tuples */
    MemoryContext tempmem;      /* Context for temporary tuples */
    int batch_count;            /* Number of batches transferred */

    /* For converting to tuples */
    Relation rel;
    AttInMetadata *attinmeta;
    List *retrieved_attrs;

    /* for storing result tuples */
    HeapTuple  *tuples;                 /* array of currently-retrieved tuples */
    int         num_tuples;             /* # of tuples in array */
    int         next_tuple;             /* index of next one to return */
    int         alloc_tuples;           /* Number allocated spots for tuples */
} quasar_query_curl_context;

typedef struct quasar_info_curl_context {
    int status;
    StringInfoData buf;
} quasar_info_curl_context;

/*
 * FDW-specific information for ForeignScanState
 * fdw_state.
 */
typedef struct QuasarConn
{
    char *post_path;            /* Path where a POST request has put data
                                 * Needs to be DELETEd afterwards */

    char *server;
    char *path;
    char *full_url;
    long timeout_ms; /* curl request timeout */

    CURLM *curlm;                    /* curl multi handle */
    CURL *curl;                      /* current transfer handle */
    int ongoing_transfers;           /* 1 if transfer still ongoing, 0 otherwise */
    int exec_transfer;               /* 1 if transfer started, 0 otherwise */

    quasar_query_curl_context *qctx;   /* For buffering tuples */
} QuasarConn;

/* quasar_conn.c headers */
extern void QuasarGlobalConnectionInit(void);
extern QuasarConn *QuasarGetConnection(ForeignServer *server);
extern void QuasarCleanupConnection(QuasarConn *conn);
extern void QuasarResetConnection(QuasarConn *conn);

extern void QuasarPrepQuery(QuasarConn *conn,
                            EState *estate,
                            Relation rel);
extern void QuasarExecuteQuery(QuasarConn *conn,
                               char *query,
                               const char **param_values,
                               size_t numParams);
extern void QuasarContinueQuery(QuasarConn *conn);
extern void QuasarRewindQuery(QuasarConn *conn);

extern double QuasarEstimateRows(QuasarConn *conn, char *query);

extern char *QuasarCompileQuery(QuasarConn *conn, char *query);

/* quasar_options.c headers */
extern Datum quasar_fdw_validator(PG_FUNCTION_ARGS);
extern bool quasar_is_valid_option(const char *option, Oid context);

/* quasar_parse.c headers */
void quasar_parse_alloc(quasar_parse_context *ctx,
                        Relation rel);
void quasar_parse_free(quasar_parse_context *ctx);
void quasar_parse_reset(quasar_parse_context *ctx);
bool quasar_parse(quasar_parse_context *ctx,
                  const char *buffer,
                  size_t *buf_loc,
                  size_t buf_size,
                  HeapTuple *result);

/* quasar_query.c headers */
extern void classifyConditions(PlannerInfo *root,
                               RelOptInfo *baserel,
                               List *input_conds,
                               List **remote_conds,
                               List **local_conds);
extern bool is_foreign_expr(PlannerInfo *root,
                            RelOptInfo *baserel,
                            Expr *expr);
extern void deparseSelectSql(StringInfo buf,
                             PlannerInfo *root,
                             RelOptInfo *baserel,
                             Bitmapset *attrs_used,
                             List **scan_tlist,
                             bool sizeEstimate);
extern void appendWhereClause(StringInfo buf,
                              PlannerInfo *root,
                              RelOptInfo *baserel,
                              List *exprs,
                              bool is_first,
                              List **params);
extern void deparseLiteral(StringInfo buf, Oid type, const char *svalue,
                           Datum value);
extern void deparseStringLiteral(StringInfo buf, const char *val);
extern Expr *find_em_expr_for_rel(EquivalenceClass *ec, RelOptInfo *rel);
extern void appendOrderByClause(StringInfo buf, PlannerInfo *root,
                                RelOptInfo *baserel, List *pathkeys);

#endif /* QUASAR_FDW_QUASAR_FDW_H */


text:
package com.rho.rhoelements;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.rho.rhoelements.plugins.Plugin;

/**
 * Maintains map of instantiated plugins
 *
 * @author XFH386, NCVT73 (Added convenience method: applySettings)
 */
public class PluginManager
{
	public static final String	PLUGIN_HOURGLASS	= "hourglass";
	public static final String RHOELEMENTS_PACKAGE_NAME = "com.rho.rhoelements";

	// Map of plugin name as per http-equiv to instance of implementation class
	private HashMap<String, Plugin> PluginMap;

	// Map of plugin name as per http-equiv to name of implementation class
	private HashMap<String, String> PluginNamesMap;

	public PluginManager()
	{
		PluginMap = new HashMap<String, Plugin>();
		PluginNamesMap = new HashMap<String, String>();
	}

	/**
	 * Adds a module name/class name pair.
	 *
	 * @param module_name Module name as used by EMML
	 * @param class_name Class name of corresponding object to construct
	 */
	public void addName(String module_name, String class_name)
	{
		PluginNamesMap.put(module_name.toLowerCase(), class_name);
	}

	/**
	 * Adds a module name/plugin object pair ONLY EXISTS FOR LOADING THE SCANNER MODULE WHICH MUST BE DONE AT START UP FROM THE MAIN ACTIVITY
	 *
	 * @param module_name Module name as used by EMML
	 * @param plugin Plugin object implementing this module
	 */
	public void addPlugin(String module_name, Plugin plugin)
	{
		PluginMap.put(module_name.toLowerCase(), plugin);
	}

	public Plugin loadPlugin(String module_name)
	{
		String class_name = "";

		try
		{
			// Get the class name from the module name
			class_name = PluginNamesMap.get(module_name.toLowerCase());
			if (class_name == null)
				throw new Exception("Module name not found '" + module_name + "'");

			// Instantiate the class
			@SuppressWarnings("unchecked")
			Class<Plugin> plugin_class = (Class<Plugin>) Class.forName(RHOELEMENTS_PACKAGE_NAME + ".plugins." + class_name);
			Plugin plugin = plugin_class.newInstance();

			// Add to plugin map
			PluginMap.put(module_name.toLowerCase(), plugin);

			Common.logger.add(new LogEntry(LogEntry.PB_LOG_INFO, module_name));

			return plugin;
		}
		catch (ClassNotFoundException e)
		{
			Common.logger.add(new LogEntry(LogEntry.PB_LOG_ERROR, "Plugin class not found '" + class_name + "'"));
		}
		catch (Exception e)
		{
			Common.logger.add(new LogEntry(LogEntry.PB_LOG_ERROR, e.getMessage()));
		}

		return null;
	}

	/** Finds plugin in map from lowercase name */
	public Plugin getPlugin(String module_name)
	{
		return PluginMap.get(module_name.toLowerCase());
	}

	public void applySetting(PluginSetting setting)
	{
		// Get plugin from map of loaded plugins
		Plugin plugin = getPlugin(setting.getModule());
		if (plugin == null)
		{
			// Plugin not loaded so load it now
			plugin = loadPlugin(setting.getModule());
			if (plugin == null)
			{
				// Plugin can't be loaded so log error and quit
				Common.logger.add(new LogEntry(LogEntry.PB_LOG_ERROR, "Cannot load module '" + setting.getModule() + "'"));
				return;
			}
		}

		// Pass the setting to the plugin
		plugin.onSetting(setting);
	}

	/**
	 * Convenience method to apply a list of settings.
	 *
	 * @param settings the list of plugin settings to apply
	 */
	public void applySettings(List<PluginSetting> settings)
	{
		for (PluginSetting setting : settings)
		{
			applySetting(setting);
		}
	}

	/** Calls onShutdown() for all registered plugins */
	public void shutdown()
	{
		for (Plugin plugin : PluginMap.values())
		{
			plugin.onShutdown();
		}
	}

	public void pageStarted(String url)
	{
		for (Plugin plugin : PluginMap.values())
		{
			plugin.onPageStarted(url);
		}
	}

	public void pageFinished(String url)
	{
		for (Plugin plugin : PluginMap.values())
		{
			plugin.onPageFinished(url);
		}
	}

	/**
	 * When the app comes to foreground let all the plugins know
	 * about the event so that they restore the saved attributes
	 * @param url
	 */
	public void onForeground(String url)
	{
		if (!Common.elementsCore.bLaunchingAppHasFocus)
		{
			Common.elementsCore.bLaunchingAppHasFocus = true;

			Common.logger.add(new LogEntry(LogEntry.PB_LOG_INFO,"Application foreground event received by the plugin manager"));
			for (Plugin plugin : PluginMap.values())
			{
				plugin.onForeground(url);
			}
		}
		else
		{
			Common.logger.add(new LogEntry(LogEntry.PB_LOG_WARNING,"Unexpected application foreground event received by the plugin manager"));
		}
	}

	/**
	 * When the app goes background let all the plugins know
	 * about the event so that they restore the saved attributes
	 * @param url
	 */
	public void onBackground(String url)
	{
		if (Common.elementsCore.bLaunchingAppHasFocus)
		{
			Common.logger.add(new LogEntry(LogEntry.PB_LOG_INFO,"Application background event received by the plugin manager"));
			for (Plugin plugin : PluginMap.values())
			{
				plugin.onBackground(url);
			}

			Common.elementsCore.bLaunchingAppHasFocus = false;
		}
		else
		{
			Common.logger.add(new LogEntry(LogEntry.PB_LOG_WARNING,"Unexpected application background event received by the plugin manager"));
		}
	}

	/**
	 * Request Version object from each plugin in name map. Static functions are used and reflection so plugin doesn't have to be instantiated.
	 *
	 * @return List of Version objects
	 */
	public ArrayList<Version> getVersions()
	{
		ArrayList<Version> versions = new ArrayList<Version>();

		// For each plugin name...
		for (String class_name : PluginNamesMap.values())
		{
			try
			{
				// Call static getVersion() using reflection
				@SuppressWarnings("unchecked")
				Class<Plugin> plugin_class = (Class<Plugin>) Class.forName(RHOELEMENTS_PACKAGE_NAME + ".plugins." + class_name);
				Method version_method = plugin_class.getMethod("getVersion", new Class[] {});
				versions.add ((Version)version_method.invoke(null, new Object[] {}));
			}
			catch (Exception e)
			{
				// If there's any problem then use a general UnknownVersion
				versions.add(new UnknownVersion(class_name));
			}
		}

		return versions;
	}

	public void pause()
	{
		for (Plugin plugin : PluginMap.values())
		{
			plugin.onPause();
		}
	}

	public void resume()
	{
		for (Plugin plugin : PluginMap.values())
		{
			plugin.onResume();
		}
	}
}


text:
import os

import mint.client
import mint.config
import mint.shimclient

from catalogService import storage
from catalogService.rest.models import userInfo
from catalogService.rest.models import serviceInfo
from catalogService.rest.middleware.response import XmlResponse
from catalogService.rest.api import base
from catalogService.rest.api import jobs
from catalogService.rest.api import users
from catalogService.rest.api import clouds

class CatalogServiceController(base.BaseController):
    urls = {'clouds' : clouds.AllCloudController,
            'users' : users.UsersController,
            'userinfo' : 'userinfo',
            'serviceinfo' : 'serviceinfo',
            'jobs' : jobs.JobsController, }

    def __init__(self, restdb):
        storagePath = os.path.join(restdb.cfg.dataPath, 'catalog')

        storageConfig = storage.StorageConfig(storagePath=storagePath)
        base.BaseController.__init__(self, None, None, storageConfig, restdb)
        self.loadCloudTypes()

    def loadCloudTypes(self):
        self._getController('clouds').loadCloudTypes()

    def _getController(self, url):
        return self.urls[url]

    def userinfo(self, request):
        responseId = self.url(request, "userinfo")
        prefhref = self.url(request, "users") + request.mintAuth.username\
            + "/preferences/"
        preferences = userInfo.Preferences(href=prefhref)
        response = userInfo.UserInfo(id = responseId,
            email = request.mintAuth.email,
            username = request.mintAuth.username,
            fullName = request.mintAuth.fullName,
            isAdmin = bool(request.mintAuth.admin),
            preferences = preferences,
            displayRepositories = bool(self.hasRepositories()))
        return XmlResponse(response)

    def serviceinfo(self, request):
        responseId = self.url(request, "serviceinfo")
        # TODO:  Get proper version/type in here.  See RBL-4191.
        # For type, client needs "full", "limited", or "disabled"
        response = serviceInfo.ServiceInfo(id = responseId,
            version = "1",
            type = "full")
        return XmlResponse(response)

    # See if there are any repositories that the current user can browse
    def hasRepositories(self):
        return len(self.db.listProducts(prodtype = 'Repository').products)


text:
package github.nisrulz.mobilevisionapi2readbarcodes;

import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import androidx.core.app.ActivityCompat;
import android.util.Log;
import android.util.SparseArray;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

import com.google.android.gms.vision.CameraSource;
import com.google.android.gms.vision.Detector;
import com.google.android.gms.vision.barcode.Barcode;
import com.google.android.gms.vision.barcode.BarcodeDetector;

import java.io.IOException;

public class MobileVisionHelper {

    private static BarcodeDetector barcodeDetector;
    private static CameraSource cameraSource;

    public static void init(final Context context, final SurfaceView cameraView, final CodeListener codeListener) {
        barcodeDetector =
                new BarcodeDetector.Builder(context)
                        .setBarcodeFormats(Barcode.QR_CODE)
                        .build();

        cameraSource = new CameraSource
                .Builder(context, barcodeDetector)
                .setRequestedPreviewSize(800, 800)
                .build();

        cameraView.getHolder()
                .addCallback(new SurfaceHolder.Callback() {
                    @Override
                    public void surfaceCreated(SurfaceHolder holder) {
                        startCameraView(context, cameraSource, cameraView);
                    }

                    @Override
                    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
                    }

                    @Override
                    public void surfaceDestroyed(SurfaceHolder holder) {
                        startCameraView(context, cameraSource, cameraView);
                    }
                });

        barcodeDetector.setProcessor(new Detector.Processor<Barcode>() {
            @Override
            public void release() {
            }

            @Override
            public void receiveDetections(Detector.Detections<Barcode> detections) {
                final SparseArray<Barcode> barcodes = detections.getDetectedItems();

                if (barcodes.size() != 0) {
                    System.out.println("Value : " + barcodes.valueAt(0).displayValue);
                    codeListener.onDetected(barcodes.valueAt(0).displayValue);
                }
            }
        });

    }

    private static void startCameraView(Context context, CameraSource cameraSource, SurfaceView
            cameraView) {
        try {
            if (ActivityCompat.checkSelfPermission(context, Manifest.permission.CAMERA)
                    == PackageManager.PERMISSION_GRANTED) {
                cameraSource.start(cameraView.getHolder());
            } else {
                System.out.println("Permission not granted!");
            }
        } catch (IOException ie) {
            Log.e("CAMERA SOURCE", ie.getMessage());
        }

    }
}


text:
package com.thinkaurelius.titan.diskstorage.indexing;

import com.google.common.base.Preconditions;
import com.thinkaurelius.titan.diskstorage.StorageException;
import com.thinkaurelius.titan.diskstorage.TransactionHandle;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Wraps the transaction handle of an index and buffers all mutations against an index for efficiency.
 * Also acts as a proxy to the {@link IndexProvider} methods.
 *
 * @author Matthias Broecheler (me@matthiasb.com)
 */

public class IndexTransaction implements TransactionHandle {

    private static final int DEFAULT_OUTER_MAP_SIZE = 3;
    private static final int DEFAULT_INNER_MAP_SIZE = 5;

    private final IndexProvider index;
    private final TransactionHandle indexTx;
    private final KeyInformation.IndexRetriever keyInformations;
    private Map<String,Map<String,IndexMutation>> mutations;

    public IndexTransaction(final IndexProvider index, final KeyInformation.IndexRetriever keyInformations) throws StorageException {
        Preconditions.checkNotNull(index);
        Preconditions.checkNotNull(keyInformations);
        this.index=index;
        this.keyInformations = keyInformations;
        this.indexTx=index.beginTransaction();
        Preconditions.checkNotNull(indexTx);
        this.mutations = null;
    }

    public void add(String store, String docid, String key, Object value, boolean isNew) {
        getIndexMutation(store,docid,isNew,false).addition(new IndexEntry(key,value));
    }

    public void delete(String store, String docid, String key, boolean deleteAll) {
        getIndexMutation(store,docid,false,deleteAll).deletion(key);
    }

    private IndexMutation getIndexMutation(String store, String docid, boolean isNew, boolean isDeleted) {
        if (mutations==null) mutations = new HashMap<String,Map<String,IndexMutation>>(DEFAULT_OUTER_MAP_SIZE);
        Map<String,IndexMutation> storeMutations = mutations.get(store);
        if (storeMutations==null) {
            storeMutations = new HashMap<String,IndexMutation>(DEFAULT_INNER_MAP_SIZE);
            mutations.put(store,storeMutations);

        }
        IndexMutation m = storeMutations.get(docid);
        if (m==null) {
            m = new IndexMutation(isNew,isDeleted);
            storeMutations.put(docid, m);
        }
        return m;
    }

    public void register(String store, String key, KeyInformation information) throws StorageException {
        index.register(store,key,information,indexTx);
    }

    public List<String> query(IndexQuery query) throws StorageException {
        return index.query(query,keyInformations,indexTx);
    }

    public Iterable<RawQuery.Result<String>> query(RawQuery query) throws StorageException {
        return index.query(query,keyInformations,indexTx);
    }

    @Override
    public void commit() throws StorageException {
        flushInternal();
        indexTx.commit();
    }

    @Override
    public void rollback() throws StorageException {
        mutations=null;
        indexTx.rollback();
    }

    @Override
    public void flush() throws StorageException {
        flushInternal();
        indexTx.flush();
    }

    private void flushInternal() throws StorageException {
        if (mutations!=null && !mutations.isEmpty()) {
            index.mutate(mutations,keyInformations,indexTx);
            mutations=null;
        }
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<scenario xmlns="urn:perfcake:scenario:8.0">
   <run type="iteration" value="${perfcake.test.duration:1000000}"/>
   <generator class="DefaultMessageGenerator" threads="10">
      <property name="senderTaskQueueSize" value="5000"/>
   </generator>
   <sequences>
      <sequence class="PrimitiveNumberSequence" id="seq.number"/>
   </sequences>
   <sender class="TestSender">
      <target>Out there!</target>
   </sender>
   <receiver class="DummyReceiver" threads="1">
      <correlator class="DummyCorrelator"/>
      <property name="messagesToConfirm" value="${perfcake.test.duration:1000000}"/>
   </receiver>
   <reporting>
      <reporter class="IterationsPerSecondReporter">
         <destination class="ConsoleDestination">
            <period type="iteration" value="500"/>
         </destination>
      </reporter>
   </reporting>
   <messages>
      <message uri="message1.xml">
         <validatorRef id="validator1"/>
      </message>
   </messages>
   <validation>
      <validator class="DummyValidator" id="validator1"/>
   </validation>
</scenario>


text:
require "spec_helper"

describe "nodejs::nvm" do
  let(:facts) { default_test_facts }

  it do
    should contain_class("boxen::config")

    should contain_file("/test/boxen/env.d/nvm.sh").with_ensure("absent")

    should contain_exec("purge nvm").with({
      :command => "rm -rf /test/boxen/nvm",
      :onlyif  => "test -d /test/boxen/nvm"
    })
  end

  context "Linux" do
    let(:facts) { default_test_facts.merge(:osfamily => "Linux") }

    it do
      should_not contain_class("boxen::config")

      should_not contain_file("/test/boxen/env.d/nvm.sh")
    end
  end
end


text:
#ifndef CGDIRECTDISPLAY_H_
#define CGDIRECTDISPLAY_H_

#ifndef __CGBASE__
#include <CGBase.h>
#endif

#ifndef __CGGEOMETRY__
#include <CGGeometry.h>
#endif

#ifndef __CGERROR__
#include <CGError.h>
#endif

#ifndef __CFARRAY__
#include <CFArray.h>
#endif

#ifndef __CFSTRING__
#include <CFString.h>
#endif

#ifndef __CFDICTIONARY__
#include <CFDictionary.h>
#endif

#include <stdint.h>

#if PRAGMA_ONCE
#pragma once
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if PRAGMA_IMPORT
#pragma import on
#endif

typedef struct _CGDirectDisplayID*      CGDirectDisplayID;
typedef struct _CGDirectPaletteRef*     CGDirectPaletteRef;
typedef uint32_t                        CGDisplayCount;
typedef uint32_t                        CGTableCount;
typedef int32_t                         CGDisplayCoord;
typedef uint8_t                         CGByteValue;
typedef uint32_t                        CGOpenGLDisplayMask;
typedef uint32_t                        CGBeamPosition;
typedef int32_t                         CGMouseDelta;
typedef double                          CGRefreshRate;
typedef CGError                         CGDisplayErr;
enum {
  CGDisplayNoErr                = kCGErrorSuccess
};

/* A NULL value points to the main display device as a programming convention */
#define kCGDirectMainDisplay            ((CGDirectDisplayID)NULL)

/*
 * Mechanisms used to find screen IDs
 * An array length (maxDisplays) and array of CGDirectDisplayIDs are passed in.
 * Up to maxDisplays of the array are filled in with the displays meeting the
 * specified criteria.  The actual number of displays filled in is returned in
 * dspyCnt.
 *
 * If the dspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
 * in with the number of displays meeting the function's requirements.
 */
/*
 *  CGGetDisplaysWithPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGGetDisplaysWithPoint(
  CGPoint              point,
  CGDisplayCount       maxDisplays,
  CGDirectDisplayID *  dspys,
  CGDisplayCount *     dspyCnt);

/*
 *  CGGetDisplaysWithRect()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGGetDisplaysWithRect(
  CGRect               rect,
  CGDisplayCount       maxDisplays,
  CGDirectDisplayID *  dspys,
  CGDisplayCount *     dspyCnt);

/*
 *  CGGetDisplaysWithOpenGLDisplayMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGGetDisplaysWithOpenGLDisplayMask(
  CGOpenGLDisplayMask   mask,
  CGDisplayCount        maxDisplays,
  CGDirectDisplayID *   dspys,
  CGDisplayCount *      dspyCnt);

/*
 * Get lists of displays.  Use this to determine display IDs
 *
 * If the activeDspys array is NULL, maxDisplays is ignored, and *dspyCnt is filled
 * in with the number of displays meeting the function's requirements.
 *
 * The first display returned in the list is the main display,
 * the one with the menu bar.
 * When mirroring, this will be the largest display,
 * or if all are the same size, the one with the deepest pixel depth.
 */
/*
 *  CGGetActiveDisplayList()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGGetActiveDisplayList(
  CGDisplayCount       maxDisplays,
  CGDirectDisplayID *  activeDspys,
  CGDisplayCount *     dspyCnt);

/* Map a display to an OpenGL display mask; returns 0 on invalid display */
/*
 *  CGDisplayIDToOpenGLDisplayMask()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGOpenGLDisplayMask )
CGDisplayIDToOpenGLDisplayMask(CGDirectDisplayID display);

/* Return screen size and origin in global coords; Empty rect if display is invalid */
/*
 *  CGDisplayBounds()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGRect )
CGDisplayBounds(CGDirectDisplayID display);

/*
 *  CGDisplayPixelsWide()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( size_t )
CGDisplayPixelsWide(CGDirectDisplayID display);

/*
 *  CGDisplayPixelsHigh()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( size_t )
CGDisplayPixelsHigh(CGDirectDisplayID display);

/*
 * Display mode selection
 * Display modes are represented as CFDictionaries
 * All dictionaries and arrays returned via these mechanisms are
 * owned by the framework and should not be released.  The framework
 * will not release them out from under your application.
 *
 * Values associated with the following keys are CFNumber types.
 * With CFNumberGetValue(), use kCFNumberLongType for best results.
 */
/*
 * Keys used in mode dictionaries.  Source C strings shown won't change.
 * Some CFM environments cannot import data variables, and so
 * duplicate these CFStringRefs locally.
 */
/*
 *  kCGDisplayWidth
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
extern CFStringRef kCGDisplayWidth;
/*
 *  kCGDisplayHeight
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
extern CFStringRef kCGDisplayHeight;
/*
 *  kCGDisplayMode
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
extern CFStringRef kCGDisplayMode;
/*
 *  kCGDisplayBitsPerPixel
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
extern CFStringRef kCGDisplayBitsPerPixel;
/*
 *  kCGDisplayBitsPerSample
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
extern CFStringRef kCGDisplayBitsPerSample;
/*
 *  kCGDisplaySamplesPerPixel
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
extern CFStringRef kCGDisplaySamplesPerPixel;
/*
 *  kCGDisplayRefreshRate
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
extern CFStringRef kCGDisplayRefreshRate;
/*
 *  kCGDisplayModeUsableForDesktopGUI
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
extern CFStringRef kCGDisplayModeUsableForDesktopGUI;
/*
 *  kCGDisplayIOFlags
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
extern CFStringRef kCGDisplayIOFlags;
/*
 * Return a CFArray of CFDictionaries describing all display modes.
 * Returns NULL if the display is invalid.
 */
/*
 *  CGDisplayAvailableModes()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CFArrayRef )
CGDisplayAvailableModes(CGDirectDisplayID display);

/*
 * Try to find a display mode of specified depth with dimensions equal or greater than
 * specified.
 * If no depth match is found, try for the next larger depth with dimensions equal or greater
 * than specified.  If no luck, then just return the current mode.
 *
 * exactmatch, if not NULL, is set to 'true' if an exact match in width, height, and depth is found,
 * and 'false' otherwise.
 * Returns NULL if display is invalid.
 */
/*
 *  CGDisplayBestModeForParameters()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CFDictionaryRef )
CGDisplayBestModeForParameters(
  CGDirectDisplayID   display,
  size_t              bitsPerPixel,
  size_t              width,
  size_t              height,
  boolean_t *         exactMatch);

/*
 *  CGDisplayBestModeForParametersAndRefreshRate()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CFDictionaryRef )
CGDisplayBestModeForParametersAndRefreshRate(
  CGDirectDisplayID   display,
  size_t              bitsPerPixel,
  size_t              width,
  size_t              height,
  CGRefreshRate       refresh,
  boolean_t *         exactMatch);

/*
 * Return a CFDictionary describing the current display mode.
 * Returns NULL if display is invalid.
 */
/*
 *  CGDisplayCurrentMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CFDictionaryRef )
CGDisplayCurrentMode(CGDirectDisplayID display);

/*
 * Switch display mode.  Note that after switching,
 * display parameters and addresses may change.
 * The selected display mode persists for the life of the program, and automatically
 * reverts to the permanent setting made by Preferences when the program terminates.
 * The mode dictionary passed in must be a dictionary vended by other CGDirectDisplay
 * APIs such as CGDisplayBestModeForParameters() and CGDisplayAvailableModes().
 */
/*
 *  CGDisplaySwitchToMode()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGDisplaySwitchToMode(
  CGDirectDisplayID   display,
  CFDictionaryRef     mode);

/* Query parameters for current mode */
/*
 *  CGDisplayBitsPerPixel()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( size_t )
CGDisplayBitsPerPixel(CGDirectDisplayID display);

/*
 *  CGDisplayBitsPerSample()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( size_t )
CGDisplayBitsPerSample(CGDirectDisplayID display);

/*
 *  CGDisplaySamplesPerPixel()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( size_t )
CGDisplaySamplesPerPixel(CGDirectDisplayID display);

/*
 *  CGDisplayBytesPerRow()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( size_t )
CGDisplayBytesPerRow(CGDirectDisplayID display);

/*
 * Set a display gamma/transfer function from a formula specifying
 * min and max values and a gamma for each channel.
 * Gamma values must be greater than 0.0.
 * To get an antigamma of 1.6, one would specify a value of (1.0 / 1.6)
 * Min values must be greater than or equal to 0.0 and less than 1.0.
 * Max values must be greater than 0.0 and less than or equal to 1.0.
 * Out of range values, or Max greater than or equal to Min result
 * in a kCGSRangeCheck error.
 *
 * Values are computed by sampling a function for a range of indices from 0 through 1:
 *  value = Min + ((Max - Min) * pow(index, Gamma))
 * The resulting values are converted to a machine specific format
 * and loaded into hardware.
 */
typedef float                           CGGammaValue;
/*
 *  CGSetDisplayTransferByFormula()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGSetDisplayTransferByFormula(
  CGDirectDisplayID   display,
  CGGammaValue        redMin,
  CGGammaValue        redMax,
  CGGammaValue        redGamma,
  CGGammaValue        greenMin,
  CGGammaValue        greenMax,
  CGGammaValue        greenGamma,
  CGGammaValue        blueMin,
  CGGammaValue        blueMax,
  CGGammaValue        blueGamma);

/*
 *  CGGetDisplayTransferByFormula()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGGetDisplayTransferByFormula(
  CGDirectDisplayID   display,
  CGGammaValue *      redMin,
  CGGammaValue *      redMax,
  CGGammaValue *      redGamma,
  CGGammaValue *      greenMin,
  CGGammaValue *      greenMax,
  CGGammaValue *      greenGamma,
  CGGammaValue *      blueMin,
  CGGammaValue *      blueMax,
  CGGammaValue *      blueGamma);

/*
 * Set a display gamma/transfer function using tables of data for each channel.
 * Values within each table should have values in the range of 0.0 through 1.0.
 * The same table may be passed in for red, green, and blue channels. 'tableSize'
 * indicates the number of entries in each table.
 * The tables are interpolated as needed to generate the number of samples needed
 * by hardware.
 */
/*
 *  CGSetDisplayTransferByTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGSetDisplayTransferByTable(
  CGDirectDisplayID     display,
  CGTableCount          tableSize,
  const CGGammaValue *  redTable,
  const CGGammaValue *  greenTable,
  const CGGammaValue *  blueTable);

/*
 * Get transfer tables.  Capacity should contain the number of samples each
 * array can hold, and *sampleCount is filled in with the number of samples
 * actually copied in.
 */
/*
 *  CGGetDisplayTransferByTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGGetDisplayTransferByTable(
  CGDirectDisplayID   display,
  CGTableCount        capacity,
  CGGammaValue *      redTable,
  CGGammaValue *      greenTable,
  CGGammaValue *      blueTable,
  CGTableCount *      sampleCount);

/* As a convenience, allow setting of the gamma table by byte values */
/*
 *  CGSetDisplayTransferByByteTable()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGSetDisplayTransferByByteTable(
  CGDirectDisplayID    display,
  CGTableCount         tableSize,
  const CGByteValue *  redTable,
  const CGByteValue *  greenTable,
  const CGByteValue *  blueTable);

/* Restore gamma tables of system displays to the user's ColorSync specified values */
/*
 *  CGDisplayRestoreColorSyncSettings()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( void )
CGDisplayRestoreColorSyncSettings(void);

/* Display capture and release */
/*
 *  CGDisplayIsCaptured()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( boolean_t )
CGDisplayIsCaptured(CGDirectDisplayID display);

/*
 *  CGDisplayCapture()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGDisplayCapture(CGDirectDisplayID display);

/*
 *  CGDisplayRelease()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGDisplayRelease(CGDirectDisplayID display);

/*
 * Capture all displays; this has the nice effect of providing an immersive
 * environment, and preventing other apps from trying to adjust themselves
 * to display changes only needed by your app.
 */
/*
 *  CGCaptureAllDisplays()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGCaptureAllDisplays(void);

/*
 * Release all captured displays, and restore the display modes to the
 * user's preferences.  May be used in conjunction with CGDisplayCapture()
 * or CGCaptureAllDisplays().
 */
/*
 *  CGReleaseAllDisplays()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGReleaseAllDisplays(void);

/*
 * Returns CoreGraphics raw shield window ID or NULL if not shielded
 * This value may be used with drawing surface APIs.
 */
/*
 *  CGShieldingWindowID()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( void * )
CGShieldingWindowID(CGDirectDisplayID display);

/*
 * Returns the window level used for the shield window.
 * This value may be used with Cocoa windows to position the
 * Cocoa window in the same window level as the shield window.
 */
/*
 *  CGShieldingWindowLevel()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( int32_t )
CGShieldingWindowLevel(void);

/*
 * Returns base address of display or NULL for an invalid display.
 * If the display has not been captured, the returned address may refer
 * to read-only memory.
 */
/*
 *  CGDisplayBaseAddress()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( void * )
CGDisplayBaseAddress(CGDirectDisplayID display);

/*
 * return address for X,Y in screen coordinates;
 *  (0,0) represents the upper left corner of the display.
 * returns NULL for an invalid display or out of bounds coordinates
 * If the display has not been captured, the returned address may refer
 * to read-only memory.
 */
/*
 *  CGDisplayAddressForPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( void * )
CGDisplayAddressForPosition(
  CGDirectDisplayID   display,
  CGDisplayCoord      x,
  CGDisplayCoord      y);

/* Mouse Cursor controls */
/*
 *  CGDisplayHideCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGDisplayHideCursor(CGDirectDisplayID display);

/* increments hide cursor count */
/*
 *  CGDisplayShowCursor()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGDisplayShowCursor(CGDirectDisplayID display);

/* decrements hide cursor count  */
/*
 * Move the cursor to the specified point relative to the display origin
 * (the upper left corner of the display).  Returns CGDisplayNoErr on success.
 * No events are generated as a result of this move.
 * Points that would lie outside the desktop are clipped to the desktop.
 */
/*
 *  CGDisplayMoveCursorToPoint()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGDisplayMoveCursorToPoint(
  CGDirectDisplayID   display,
  CGPoint             point);

/*
 * Report the mouse position change associated with the last mouse move event
 * recieved by this application.
 */
/*
 *  CGGetLastMouseDelta()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( void )
CGGetLastMouseDelta(
  CGMouseDelta *  deltaX,
  CGMouseDelta *  deltaY);

/* Palette controls (8 bit pseudocolor only) */
/*
 * Returns TRUE if the current display mode supports palettes
 */
/*
 *  CGDisplayCanSetPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( boolean_t )
CGDisplayCanSetPalette(CGDirectDisplayID display);

/*
 * Set a palette.  The current gamma function is applied to the palette
 * elements before being loaded into hardware.
 */
/*
 *  CGDisplaySetPalette()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGDisplaySetPalette(
  CGDirectDisplayID    display,
  CGDirectPaletteRef   palette);

/*
 * Wait until the beam position is outside the range specified by upperScanLine and lowerScanLine.
 * Note that if upperScanLine and lowerScanLine encompass the entire display height,
 * the function returns an error.
 * lowerScanLine must be greater than or equal to upperScanLine.
 *
 * Some display systems may not conventional video vertical and horizontal sweep in painting.
 * These displays report a kCGDisplayRefreshRate of 0 in the CFDictionaryRef returned by
 * CGDisplayCurrentMode().  On such displays, this function returns at once.
 *
 * Some drivers may not implement support for this mechanism.
 * On such displays, this function returns at once.
 *
 * Returns CGDisplayNoErr on success, and an error if display or upperScanLine and
 * lowerScanLine are invalid.
 *
 * The app should set the values of upperScanLine and lowerScanLine to allow enough lead time
 * for the drawing operation to complete.  A common strategy is to wait for the beam to pass
 * the bottom of the drawing area, allowing almost a full vertical sweep period to perform drawing.
 * To do this, set upperScanLine to 0, and set lowerScanLine to the bottom of the bounding box:
 *  lowerScanLine = (CGBeamPosition)(cgrect.origin.y + cgrect.size.height);
 *
 * IOKit may implement this as a spin-loop on the beam position call used for CGDisplayBeamPosition().
 * On such system the function is CPU bound, and subject to all the usual scheduling pre-emption.
 * In particular, attempting to wait for the beam to hit a specific scanline may be an exercise in frustration.
 *
 * These functions are advisary in nature, and depend on IOKit and hardware specific drivers to implement
 * support. If you need extremely precise timing, or access to vertical blanking interrupts,
 * you should consider writing a device driver to tie into hardware-specific capabilities.
 */
/*
 *  CGDisplayWaitForBeamPositionOutsideLines()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGDisplayErr )
CGDisplayWaitForBeamPositionOutsideLines(
  CGDirectDisplayID   display,
  CGBeamPosition      upperScanLine,
  CGBeamPosition      lowerScanLine);

/*
 * Returns the current beam position on the display.  If display is invalid,
 * or the display does not implement conventional video vertical and horizontal
 * sweep in painting, or the driver does not implement this functionality, 0 is returned.
 */
/*
 *  CGDisplayBeamPosition()
 *
 *  Availability:
 *    Non-Carbon CFM:   not available
 *    CarbonLib:        not available
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API_C( CGBeamPosition )
CGDisplayBeamPosition(CGDirectDisplayID display);

#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif

#ifdef __cplusplus
}
#endif

#endif /* CGDIRECTDISPLAY_H_ */


text:
layout: "page"
---

    Yet Another Programming Podcast

{% for post in site.posts %}

        {{post.title}}
        {{ post.date | date: "%Y/%m/%d" }} - {{ post.time }}

      {{ post.excerpt }} Listen and read the bookmarks!

      {% for member in post.members %}

          {{ member }}

      {% endfor %}

{% endfor %}


text:
package com.example.mobilesafer.activity;

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

import android.app.Activity;
import android.app.ActivityManager;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.text.format.Formatter;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.example.mobilesafer.R;
import com.example.mobilesafer.bean.TaskInfo;
import com.example.mobilesafer.engine.TaskInfoParser;
import com.example.mobilesafer.utils.SystemInfoUtils;
import com.example.mobilesafer.utils.UIUtils;

/**
 * ½ø³Ì¹ÜÀíÒ³Ãæ
 *
 * @author admin
 *
 */
public class TaskManagerActivity extends Activity {
	private TextView tv_task_count;
	private TextView tv_Mem;
	private ListView lv_tasklist;
	private ArrayList<TaskInfo> userTask;
	private ArrayList<TaskInfo> systemTask;
	private TextView tv_taskkind;
	private TaskListAdapter adapter;

	Handler handler = new Handler() {

		public void handleMessage(android.os.Message msg) {
			if (adapter == null) {
				adapter = new TaskListAdapter();
				lv_tasklist.setAdapter(adapter);
			} else {
				adapter.notifyDataSetChanged();
			}
		};
	};
	private int count;
	private String fTotalMem;
	private String fAvailMem;
	private long availMem;
	private SharedPreferences sp;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		sp = getSharedPreferences("config", 0);
		initUI();
		initData();
	}

	@Override
	protected void onResume() {
		super.onResume();
		if(adapter != null) {
			adapter.notifyDataSetChanged();
		}
		boolean flag = sp.getBoolean("show_system_process", true);
		if(!flag) {
			tv_task_count.setText("µ±Ç°½ø³ÌÊý:" + userTask.size());
		} else {
			tv_task_count.setText("µ±Ç°½ø³ÌÊý:" + (userTask.size() + systemTask.size()));

		}
	}

	/**
	 * ³õ'»¯UI
	 */
	private void initUI() {
		setContentView(R.layout.activity_task_manager);
		tv_task_count = (TextView) findViewById(R.id.tv_task_count);
		tv_Mem = (TextView) findViewById(R.id.tv_Mem);
		lv_tasklist = (ListView) findViewById(R.id.lv_tasklist);
		tv_taskkind = (TextView) findViewById(R.id.tv_taskkind);

		lv_tasklist.setOnScrollListener(new OnScrollListener() {
			@Override
			public void onScrollStateChanged(AbsListView view, int scrollState) {
			}

			@Override
			public void onScroll(AbsListView view, int firstVisibleItem,
					int visibleItemCount, int totalItemCount) {
				if (userTask != null && systemTask != null) {
					if (firstVisibleItem < userTask.size() + 1) {
						tv_taskkind.setText("Óû§½ø³Ì(" + userTask.size() + ")");
					} else {
						tv_taskkind.setText("ϵͳ½ø³Ì(" + systemTask.size() + ")");
					}
				}
			}
		});
	}

	/**
	 * ³õ'»¯Êý¾Ý
	 */
	private void initData() {
		count = SystemInfoUtils.getProcessCount(this);
		tv_task_count.setText("µ±Ç°½ø³ÌÊý:" + count);
		/*
		 * ÉèÖÃÄÚ´æÇé¿ö
		 */
		long totalMem = SystemInfoUtils.getTotalMem(this);
		availMem = SystemInfoUtils.getAvailMem(this);
		fTotalMem = Formatter.formatFileSize(this, totalMem);
		fAvailMem = Formatter.formatFileSize(this, availMem);
		tv_Mem.setText("¿ÉÓÃ/×ܹ²:" + fAvailMem + "/" + fTotalMem);

		/*
		 * ¶Ô½ø³ÌÊý¾Ý½øÐд¦Àí
		 */
		userTask = new ArrayList<TaskInfo>();
		systemTask = new ArrayList<TaskInfo>();
		List<TaskInfo> taskInfos = TaskInfoParser.getTaskInfos(this);
		for (TaskInfo taskInfo : taskInfos) {
			boolean flag = taskInfo.isUserApp();
			if (flag) {
				userTask.add(taskInfo);
			} else {
				systemTask.add(taskInfo);
			}
		}

		handler.sendEmptyMessage(0);

	}

	/*
	 * ÓÃÓÚ½ø³ÌÁбíµÄadapter
	 */
	class TaskListAdapter extends BaseAdapter {

		@Override
		public int getCount() {
			boolean flag = sp.getBoolean("show_system_process", true);
			if(flag) {
				return userTask.size() + systemTask.size() + 2;
			} else{
				return userTask.size() + 1;
			}
		}

		@Override
		public Object getItem(int position) {
			// ½øÐнDZêÅжÏ
			if (position == 0 || position == userTask.size() + 1) {
				return null;
			}
			// ·µ»ØÓû§³ÌÐò
			if (position <= userTask.size() + 1) {
				System.out.println(userTask.get(position - 1).getAppName());
				return userTask.get(position - 1);
			} else {
				// System.out.println(systemTask.get(position - userTask.size()
				// - 2).getAppName());
				return systemTask.get(position - userTask.size() - 2);
			}
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(final int position, View convertView,
				ViewGroup parent) {
			if (position == 0) {
				TextView textView = new TextView(TaskManagerActivity.this);
				textView.setText("Óû§½ø³Ì£¨" + userTask.size() + ")");
				textView.setTextColor(Color.WHITE);
				textView.setBackgroundColor(Color.GRAY);
				textView.setTextSize(15);
				return textView;
			}
			if (position == userTask.size() + 1) {
				TextView textView = new TextView(TaskManagerActivity.this);
				textView.setText("ϵͳ½ø³Ì£¨" + systemTask.size() + ")");
				textView.setTextColor(Color.WHITE);
				textView.setBackgroundColor(Color.GRAY);
				textView.setTextSize(15);
				return textView;
			}

			View view;
			final ViewHolder holder;
			if (convertView == null || convertView instanceof TextView) {
				view = View.inflate(TaskManagerActivity.this,
						R.layout.item_task_manager, null);
				holder = new ViewHolder();
				holder.iv_icon = (ImageView) view.findViewById(R.id.iv_icon);
				holder.tv_task_name = (TextView) view
						.findViewById(R.id.tv_task_name);
				holder.tv_task_dirty_mem = (TextView) view
						.findViewById(R.id.tv_task_dirty_mem);
				holder.tv_app_status = (CheckBox) view
						.findViewById(R.id.tv_app_status);
				view.setTag(holder);
			} else {
				view = convertView;
				holder = (ViewHolder) convertView.getTag();
			}
			TaskInfo info = (TaskInfo) getItem(position);
			holder.iv_icon.setImageDrawable(info.getIcon());
			holder.tv_task_name.setText(info.getAppName());
			holder.tv_task_dirty_mem.setText(Formatter.formatFileSize(
					TaskManagerActivity.this, info.getMemorySize() * 1024));

			// ÅжÏcheckboxĬÈÏ״̬
			boolean checked = info.isChecked();
			if (checked) {
				holder.tv_app_status.setChecked(true);
			} else {
				holder.tv_app_status.setChecked(false);
			}

			holder.tv_app_status.setVisibility(View.VISIBLE);
			//Òþ²Ø×Ô¼ºµÄcheckbox,²¢Îªfalse
			if(info.getPackageName().equals(getPackageName())) {
				holder.tv_app_status.setVisibility(View.GONE);
				info.setChecked(false);
			}

			// ʵÏÖµ¥»÷¹´Ñ¡checkBox
			view.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					TaskInfo info = (TaskInfo) lv_tasklist
							.getItemAtPosition(position);
					boolean flag = info.isChecked();
					if (flag) {
						info.setChecked(false);
						holder.tv_app_status.setChecked(false);
					} else {
						info.setChecked(true);
						holder.tv_app_status.setChecked(true);
					}

					if(info.getPackageName().equals(getPackageName())) {
						info.setChecked(false);
					}
				}
			});
			return view;
		}

	}

	static class ViewHolder {
		ImageView iv_icon;
		TextView tv_task_name;
		TextView tv_task_dirty_mem;
		CheckBox tv_app_status;
	}

	/**
	 * È«Ñ¡
	 *
	 * @param v
	 */
	public void choseAll(View v) {
		// ¸Ä±äËùÓÐTaskInfoµÄcheckedÊý¾Ý
		if (userTask != null) {
			for (TaskInfo userTaskInfo : userTask) {
				userTaskInfo.setChecked(true);
				if(userTaskInfo.getPackageName().equals(getPackageName())) {
					userTaskInfo.setChecked(false);
				}
			}
		}
		if (systemTask != null) {
			for (TaskInfo systemTaskInfo : systemTask) {
				systemTaskInfo.setChecked(true);
			}
		}
		// ¸üÐÂUI
		handler.sendEmptyMessage(0);
	}

	/**
	 * ·´Ñ¡
	 */
	public void selectOppsite(View v) {
		// ¸Ä±äËùÓÐTaskInfoµÄcheckedÊý¾Ý
		if (userTask != null) {
			for (TaskInfo userTaskInfo : userTask) {
				if(userTaskInfo.isChecked()) {
					userTaskInfo.setChecked(false);
				} else {
					userTaskInfo.setChecked(true);
				}
				if(userTaskInfo.getPackageName().equals(getPackageName())) {
					userTaskInfo.setChecked(false);
				}
			}
		}
		if (systemTask != null) {
			for (TaskInfo systemTaskInfo : systemTask) {
				if(systemTaskInfo.isChecked()) {
					systemTaskInfo.setChecked(false);
				} else {
					systemTaskInfo.setChecked(true);
				}
			}
		}
		// ¸üÐÂUI
		handler.sendEmptyMessage(0);
	}

	/**
	 * ɱËÀ½ø³Ì
	 */
	public void killProcess(View v) {
		ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
		ArrayList<TaskInfo> killList = new ArrayList<TaskInfo>();
		long relessMem = 0;
		//ÅжÏÄÄЩ±»Ñ¡ÖÐÁË
		for(TaskInfo userInfo : userTask ) {
			if(userInfo.isChecked()) {
				killList.add(userInfo);
			}
		}
		for(TaskInfo systemInfo : systemTask) {
			if(systemInfo.isChecked()) {
				killList.add(systemInfo);
			}
		}
		// ɱËÀµÄÊýÁ¿
		int totalCount = killList.size();
		//¶ÔÐèÒª´¦ÀíµÄ½ø³Ì½øÐд¦Àí
		for(TaskInfo willKillProcess : killList) {
			relessMem = relessMem +  willKillProcess.getMemorySize();
			//½øÐÐÒƳý,ºÍɱËÀ
			if(willKillProcess.isUserApp()) {
				userTask.remove(willKillProcess);
				manager.killBackgroundProcesses(willKillProcess.getPackageName());
			} else {
				systemTask.remove(willKillProcess);
				manager.killBackgroundProcesses(willKillProcess.getPackageName());
			}
		}

		// ¸Ä±äÊý¾ÝÏÔʾ
		boolean flag = sp.getBoolean("show_system_process", true);
		int total = 0;
		if(flag) {
			total = userTask.size() + systemTask.size();
		} else {
			total = userTask.size();
		}
		tv_task_count.setText("µ±Ç°½ø³ÌÊý:" + total);

		long f=  relessMem + availMem;
		String fRelessMem = Formatter.formatFileSize(TaskManagerActivity.this, f);
		tv_Mem.setText("¿ÉÓÃ/×ܹ²:" + fRelessMem + "/" + fTotalMem);
		String sizeReless = Formatter.formatFileSize(TaskManagerActivity.this, relessMem *1024);
		UIUtils.showToast(TaskManagerActivity.this, "Ò»¹²Çå³ý" + totalCount+"¸ö½ø³Ì£¬Ò»¹²ÊÍ·Å"+sizeReless);
		handler.sendEmptyMessage(0);
	}

	/**
	 * ½øÐÐÉèÖÃ
	 */
	public void taskManagerSetting(View v) {
		Intent intent = new Intent(this , TaskManagerSettingActivity.class);
		startActivity(intent);
	}
}


text:
INCLUDE_DIRECTORIES(
  includes
  )

SET (IRRIMGUI_PUBLIC_HEADER_FILES
	includes/IrrIMGUI/Inject/IrrIMGUIInject.h
	includes/IrrIMGUI/Tools/CBasicMemoryLeakDetection.h
	includes/IrrIMGUI/UnitTest/IIMGUIHandleMock.h
	includes/IrrIMGUI/UnitTest/IncludeCppUTest.h
	includes/IrrIMGUI/UnitTest/MockHelper.h
	includes/IrrIMGUI/UnitTest/UnitTest.h
	includes/IrrIMGUI/CCharFifo.h
	includes/IrrIMGUI/CIMGUIEventReceiver.h
	includes/IrrIMGUI/CIMGUIEventStorage.h
	includes/IrrIMGUI/IGUITexture.h
	includes/IrrIMGUI/IIMGUIHandle.h
	includes/IrrIMGUI/IMGUIHelper.h
	includes/IrrIMGUI/IncludeIMGUI.h
	includes/IrrIMGUI/IncludeIrrlicht.h
	includes/IrrIMGUI/IReferenceCounter.h
	includes/IrrIMGUI/IrrIMGUI.h
	includes/IrrIMGUI/IrrIMGUIConfig.h
	includes/IrrIMGUI/IrrIMGUIConstants.h
	includes/IrrIMGUI/IrrIMGUIDebug.h
	includes/IrrIMGUI/SIMGUISettings.h
)

SET (IRRIMGUI_PRIVATE_HEADER_FILES
	source/private/CGUITexture.h
	source/private/IrrIMGUIDebug_priv.h
	source/private/IrrIMGUIInject_priv.h
	source/CIMGUIHandle.h
	source/CIrrlichtIMGUIDriver.h
	source/COpenGLIMGUIDriver.h
	source/IIMGUIDriver.h
)

SET (IRRIMGUI_SOURCE_FILES
	source/CBasicMemoryLeakDetection.cpp
	source/CChannelBuffer.cpp
	source/CCharFifo.cpp
	source/CGUITexture.cpp
	source/CIMGUIEventReceiver.cpp
	source/CIMGUIHandle.cpp
	source/CIrrlichtIMGUIDriver.cpp
	source/COpenGLIMGUIDriver.cpp
	source/IIMGUIDriver.cpp
	source/IMGUIHelper.cpp
	source/IReferenceCounter.cpp
	source/IrrIMGUIInject.cpp
	source/UnitTest.cpp
)


text:
import { ERROR_INVALID_SOURCE, VALID_SOURCE_TYPES } from './constants';
import type { ElementType, SourceDimensions, SourcePromise, StepParams } from './types';
import { createSource, getAsyncElement } from './utils';

export type LayerOptions = {
  source?: string | ElementType;
  imageSrc?: string;
  posX?: number;
  posY?: number;
  opacity?: number;
  isActive?: boolean;
  onStep?: (params: StepParams, layer: Layer) => void;
};

export const DEFAULT_LAYER_OPTIONS: Omit<LayerOptions, 'source'> = {
  isActive: true,
  opacity: 1,
  posX: 0,
  posY: 0,
  onStep: null,
};

type LayerState = Omit<LayerOptions, 'isActive' | 'source'> & {
  source?: ElementType;
  isActive: boolean;
  isReady: boolean;
  sourcePromise?: SourcePromise;
  size?: SourceDimensions;
};

export class Layer {
  #state: LayerState = {
    ...DEFAULT_LAYER_OPTIONS,
    isActive: false,
    isReady: false,
  };

  constructor(options: LayerOptions) {
    const { posX, posY, opacity, onStep, isActive, imageSrc, source } = {
      ...DEFAULT_LAYER_OPTIONS,
      ...options,
    };

    this.posX = posX;
    this.posY = posY;
    this.opacity = opacity;
    this.onStep = onStep;

    if (imageSrc) {
      this.#setSource(createSource(imageSrc), isActive);
    } else if (source) {
      this.#setSource(getAsyncElement(source, VALID_SOURCE_TYPES), isActive);
    }
  }

  #setSource = (sourcePromise: SourcePromise, isActive?: boolean) => {
    this.#state.sourcePromise = sourcePromise;

    this.#state.sourcePromise
      .then(({ element, ...size }) => {
        this.#state.source = element;
        this.#state.size = size;
        this.#state.isActive = isActive;
        this.#state.isReady = true;

        return { element, ...size };
      })
      .catch(() => console.error(ERROR_INVALID_SOURCE));
  };

  get sourcePromise() {
    return this.#state.sourcePromise;
  }

  get source() {
    return this.#state.source;
  }

  get size() {
    return this.#state.size;
  }

  get posX() {
    return this.#state.posX;
  }

  set posX(value) {
    if (typeof value === 'number') this.#state.posX = value;
  }

  get posY() {
    return this.#state.posY;
  }

  set posY(value) {
    if (typeof value === 'number') this.#state.posY = value;
  }

  get opacity() {
    return this.#state.opacity;
  }

  set opacity(opacity) {
    if (typeof opacity === 'number') this.#state.opacity = Math.max(0, Math.min(1, opacity));
  }

  get onStep() {
    return this.#state.onStep;
  }

  set onStep(handler) {
    this.#state.onStep = handler;
  }

  get isActive() {
    return this.#state.isActive;
  }

  set isActive(isActive) {
    if (this.#state.isReady) this.#state.isActive = !!isActive;
  }

  toggle() {
    this.isActive = !this.isActive;

    return this.isActive;
  }
}


text:
/*
 * EVE Swagger Interface
 *
 * An OpenAPI for EVE Online
 *
 * OpenAPI spec version: 1.12
 *
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 *
 * 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 esi

import (
	"time"
)

/* A list of GetCharactersCharacterIdSkillqueue200Ok. */
//easyjson:json
type GetCharactersCharacterIdSkillqueue200OkList []GetCharactersCharacterIdSkillqueue200Ok

/* 200 ok object */
//easyjson:json
type GetCharactersCharacterIdSkillqueue200Ok struct {
	FinishDate      time.Time `json:"finish_date,omitempty"`       /* Date on which training of the skill will complete. Omitted if the skill queue is paused. */
	FinishedLevel   int32     `json:"finished_level,omitempty"`    /* finished_level integer */
	LevelEndSp      int32     `json:"level_end_sp,omitempty"`      /* level_end_sp integer */
	LevelStartSp    int32     `json:"level_start_sp,omitempty"`    /* Amount of SP that was in the skill when it started training it's current level. Used to calculate % of current level complete. */
	QueuePosition   int32     `json:"queue_position,omitempty"`    /* queue_position integer */
	SkillId         int32     `json:"skill_id,omitempty"`          /* skill_id integer */
	StartDate       time.Time `json:"start_date,omitempty"`        /* start_date string */
	TrainingStartSp int32     `json:"training_start_sp,omitempty"` /* training_start_sp integer */
}


text:
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ProductManager.ViewData.Entity;

namespace ProductManager.ViewModel.SystemManager
{
    public class FileTypeWindowViewModel : NotifyPropertyChanged
    {
        private ChildWindow childWindow;

        public FileTypeEntity FileTypeEntity { get; set; }

        public ICommand OnOK { get; private set; }

        public ICommand OnCancel { get; private set; }

        public FileTypeWindowViewModel(ChildWindow aChildWindow, FileTypeEntity aFileTypeEntity)
        {
            childWindow = aChildWindow;
            FileTypeEntity = aFileTypeEntity;
            OnOK = new DelegateCommand(OnOKCommand);
            OnCancel = new DelegateCommand(OnCancelCommand);
        }

        public void OnOKCommand()
        {
            if (this.FileTypeEntity.Validate())
            {
                this.FileTypeEntity.DUpdate();
                this.childWindow.DialogResult = true;
            }
        }

        public void OnCancelCommand()
        {
            this.FileTypeEntity.Update();
            this.FileTypeEntity.RaisALL();
            this.childWindow.DialogResult = false;
        }
    }
}


text:
using System;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;

namespace PowerLib.System.ComponentModel
{
  public abstract class TypeInitializer
  {
    public abstract void Initialize(object obj, NameValueCollection coll);

    public abstract void Retrieve(object obj, NameValueCollection coll);

    private static readonly Lazy<TypeInitializer> @default = new Lazy<TypeInitializer>(() => new DefaultTypeInitializer());

    public static TypeInitializer Default { get { return @default.Value; } }

    private class DefaultTypeInitializer : TypeInitializer
    {
      public override void Initialize(object obj, NameValueCollection coll)
      {
        if (obj == null)
          return;

        foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(obj))
        {
          if (prop.IsReadOnly)
            continue;
          if (coll.Keys.OfType<string>().Any(k => k == prop.Name))
            prop.SetValue(obj, prop.Converter.ConvertFromString(coll.Get(prop.Name)));
        }
      }

      public override void Retrieve(object obj, NameValueCollection coll)
      {
        if (obj == null)
          return;

        foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(obj))
        {
          if (coll.Keys.OfType<string>().Any(k => k == prop.Name))
            coll[prop.Name] = prop.Converter.ConvertToString(prop.GetValue(obj));
        }
      }
    }
  }
}