text
stringlengths
4
5.48M
meta
stringlengths
14
6.54k
ACCEPTED #### According to World Register of Marine Species #### Published in null #### Original name null ### Remarks null
{'content_hash': 'a2673e7ecacb1b36e207897028efc91d', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 32, 'avg_line_length': 9.76923076923077, 'alnum_prop': 0.7007874015748031, 'repo_name': 'mdoering/backbone', 'id': '9e456f47e05ba44fb93f4ff14a8808189d48348e', 'size': '188', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Protozoa/Granuloreticulosea/Foraminiferida/Cibicididae/Discorbia/Discorbia candeiana/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []}
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/mcam_camera_fronted" android:state_pressed="true" /> <item android:drawable="@drawable/mcam_camera_front" /> </selector>
{'content_hash': '7cbbbb67e6f6e02a0f6c5d843c96ec37', 'timestamp': '', 'source': 'github', 'line_count': 5, 'max_line_length': 90, 'avg_line_length': 54.2, 'alnum_prop': 0.7195571955719557, 'repo_name': 'simonOrganization/safe', 'id': 'e49ab44f843459ad8a48d10d8fd267ccd8977fe2', 'size': '271', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'recordlib/src/main/res/drawable/mcam_front_selector.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '3457010'}, {'name': 'Makefile', 'bytes': '900'}, {'name': 'Shell', 'bytes': '608'}]}
<?php defined('C5_EXECUTE') or die("Access Denied."); class Concrete5_Model_AddBlockToAreaAreaPermissionKey extends AreaPermissionKey { public function copyFromPageToArea() { $db = Loader::db(); $inheritedPKID = $db->GetOne('select pkID from PermissionKeys where pkHandle = ?', array('add_block')); $r = $db->Execute('select peID, pa.paID from PermissionAssignments pa inner join PermissionAccessList pal on pa.paID = pal.paID where pkID = ?', array( $inheritedPKID )); if ($r) { while ($row = $r->FetchRow()) { $db->Replace('AreaPermissionAssignments', array( 'cID' => $this->permissionObject->getCollectionID(), 'arHandle' => $this->permissionObject->getAreaHandle(), 'pkID' => $this->getPermissionKeyID(), 'paID' => $row['paID'] ), array('cID', 'arHandle', 'pkID'), true); $rx = $db->Execute('select permission from BlockTypePermissionBlockTypeAccessList where paID = ? and peID = ?', array( $row['paID'], $row['peID'] )); while ($rowx = $rx->FetchRow()) { $db->Replace('AreaPermissionBlockTypeAccessList', array( 'peID' => $row['peID'], 'permission' => $rowx['permission'], 'paID' => $row['paID'] ), array('paID', 'peID'), true); } $db->Execute('delete from AreaPermissionBlockTypeAccessListCustom where paID = ?', array( $row['paID'] )); $rx = $db->Execute('select btID from BlockTypePermissionBlockTypeAccessListCustom where paID = ? and peID = ?', array( $row['paID'], $row['peID'] )); while ($rowx = $rx->FetchRow()) { $db->Replace('AreaPermissionBlockTypeAccessListCustom', array( 'paID' => $row['paID'], 'btID' => $rowx['btID'], 'peID' => $row['peID'] ), array('paID', 'peID', 'btID'), true); } } } } protected function getAllowedBlockTypeIDs() { $u = new User(); $pae = $this->getPermissionAccessObject(); if (!is_object($pae)) { return array(); } $accessEntities = $u->getUserAccessEntityObjects(); $accessEntities = $pae->validateAndFilterAccessEntities($accessEntities); $list = $this->getAccessListItems(AreaPermissionKey::ACCESS_TYPE_ALL, $accessEntities); $list = PermissionDuration::filterByActive($list); $db = Loader::db(); $dsh = Loader::helper('concrete/dashboard'); if ($dsh->inDashboard()) { $allBTIDs = $db->GetCol('select btID from BlockTypes'); } else { $allBTIDs = $db->GetCol('select btID from BlockTypes where btIsInternal = 0'); } $btIDs = array(); foreach($list as $l) { if ($l->getBlockTypesAllowedPermission() == 'N') { $btIDs = array(); } if ($l->getBlockTypesAllowedPermission() == 'C') { if ($l->getAccessType() == AreaPermissionKey::ACCESS_TYPE_EXCLUDE) { $btIDs = array_values(array_diff($btIDs, $l->getBlockTypesAllowedArray())); } else { $btIDs = array_unique(array_merge($btIDs, $l->getBlockTypesAllowedArray())); } } if ($l->getBlockTypesAllowedPermission() == 'A') { $btIDs = $allBTIDs; } } return $btIDs; } public function validate($bt = false) { $u = new User(); if ($u->isSuperUser()) { return true; } $types = $this->getAllowedBlockTypeIDs(); if ($bt != false) { return in_array($bt->getBlockTypeID(), $types); } else { return count($types) > 0; } } }
{'content_hash': 'be11432dd00da13a47b260aa98c73513', 'timestamp': '', 'source': 'github', 'line_count': 104, 'max_line_length': 153, 'avg_line_length': 32.99038461538461, 'alnum_prop': 0.59895074322355, 'repo_name': 'birsenkirgoz/alp_filtre', 'id': '5c8aa48f19ac44a531545a6642d89e5e661b1f53', 'size': '3431', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'concrete/core/models/permission/keys/custom/add_block_to_area.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ActionScript', 'bytes': '172889'}, {'name': 'JavaScript', 'bytes': '510826'}, {'name': 'PHP', 'bytes': '9216041'}]}
<?php namespace ZendTest\Log\Filter; use Zend\Log\Filter\Validator; use Zend\Validator\ValidatorChain; use Zend\Validator\Digits as DigitsFilter; use Zend\Validator\NotEmpty as NotEmptyFilter; /** * @group Zend_Log */ class ValidatorTest extends \PHPUnit_Framework_TestCase { public function testValidatorFilter() { $filter = new Validator(new DigitsFilter()); $this->assertTrue($filter->filter(['message' => '123'])); $this->assertFalse($filter->filter(['message' => 'test'])); $this->assertFalse($filter->filter(['message' => 'test123'])); $this->assertFalse($filter->filter(['message' => '(%$'])); } public function testValidatorChain() { $validatorChain = new ValidatorChain(); $validatorChain->attach(new NotEmptyFilter()); $validatorChain->attach(new DigitsFilter()); $filter = new Validator($validatorChain); $this->assertTrue($filter->filter(['message' => '123'])); $this->assertFalse($filter->filter(['message' => 'test'])); } }
{'content_hash': '4cfababbb1a465167d54b8a10e9dfb17', 'timestamp': '', 'source': 'github', 'line_count': 34, 'max_line_length': 70, 'avg_line_length': 31.235294117647058, 'alnum_prop': 0.6374764595103578, 'repo_name': 'nikolaposa/zend-log', 'id': '52867c50eda73b54cdadc0efaf55462cf6ce638b', 'size': '1364', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'test/Filter/ValidatorTest.php', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'HTML', 'bytes': '35'}, {'name': 'PHP', 'bytes': '269782'}]}
function bob(stimulus::AbstractString) stimulus = strip(stimulus) if issilence(stimulus) return "Fine. Be that way!" elseif isquestion(stimulus) && isshouting(stimulus) return "Calm down, I know what I'm doing!" elseif isshouting(stimulus) return "Whoa, chill out!" elseif isquestion(stimulus) return "Sure." else return "Whatever." end end issilence(stimulus::AbstractString) = isempty(stimulus) isquestion(stimulus::AbstractString) = endswith(stimulus, '?') function isshouting(stimulus::AbstractString) all(isuppercase, stimulus) && return true !any(isletter, stimulus) && return false for c in stimulus # ignore all non-letter chars if isletter(c) && !isuppercase(c) return false end end return true end
{'content_hash': 'd856ca1f81016ba0ebdfbcfd5e7dfa18', 'timestamp': '', 'source': 'github', 'line_count': 32, 'max_line_length': 62, 'avg_line_length': 26.15625, 'alnum_prop': 0.6571087216248507, 'repo_name': 'exercism/xjulia', 'id': 'e45dc2f5d7408e7ed1180df735729594942b4196', 'size': '837', 'binary': False, 'copies': '1', 'ref': 'refs/heads/dependabot/github_actions/actions/upload-artifact-2.3.1', 'path': 'exercises/practice/bob/.meta/example.jl', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Julia', 'bytes': '47909'}, {'name': 'Shell', 'bytes': '640'}]}
package fixtures.url.implementation; import retrofit2.Retrofit; import fixtures.url.Queries; import com.google.common.reflect.TypeToken; import com.microsoft.rest.CollectionFormat; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import fixtures.url.models.ErrorException; import fixtures.url.models.UriColor; import java.io.IOException; import java.util.List; import okhttp3.ResponseBody; import org.apache.commons.codec.binary.Base64; import org.joda.time.DateTime; import org.joda.time.LocalDate; import retrofit2.http.GET; import retrofit2.http.Headers; import retrofit2.http.Query; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; /** * An instance of this class provides access to all the operations defined * in Queries. */ public class QueriesImpl implements Queries { /** The Retrofit service to perform REST calls. */ private QueriesService service; /** The service client containing this operation class. */ private AutoRestUrlTestServiceImpl client; /** * Initializes an instance of Queries. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ public QueriesImpl(Retrofit retrofit, AutoRestUrlTestServiceImpl client) { this.service = retrofit.create(QueriesService.class); this.client = client; } /** * The interface defining all the services for Queries to be * used by Retrofit to perform actually REST calls. */ interface QueriesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries getBooleanTrue" }) @GET("queries/bool/true") Observable<Response<ResponseBody>> getBooleanTrue(@Query("boolQuery") boolean boolQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries getBooleanFalse" }) @GET("queries/bool/false") Observable<Response<ResponseBody>> getBooleanFalse(@Query("boolQuery") boolean boolQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries getBooleanNull" }) @GET("queries/bool/null") Observable<Response<ResponseBody>> getBooleanNull(@Query("boolQuery") Boolean boolQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries getIntOneMillion" }) @GET("queries/int/1000000") Observable<Response<ResponseBody>> getIntOneMillion(@Query("intQuery") int intQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries getIntNegativeOneMillion" }) @GET("queries/int/-1000000") Observable<Response<ResponseBody>> getIntNegativeOneMillion(@Query("intQuery") int intQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries getIntNull" }) @GET("queries/int/null") Observable<Response<ResponseBody>> getIntNull(@Query("intQuery") Integer intQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries getTenBillion" }) @GET("queries/long/10000000000") Observable<Response<ResponseBody>> getTenBillion(@Query("longQuery") long longQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries getNegativeTenBillion" }) @GET("queries/long/-10000000000") Observable<Response<ResponseBody>> getNegativeTenBillion(@Query("longQuery") long longQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries getLongNull" }) @GET("queries/long/null") Observable<Response<ResponseBody>> getLongNull(@Query("longQuery") Long longQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries floatScientificPositive" }) @GET("queries/float/1.034E+20") Observable<Response<ResponseBody>> floatScientificPositive(@Query("floatQuery") double floatQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries floatScientificNegative" }) @GET("queries/float/-1.034E-20") Observable<Response<ResponseBody>> floatScientificNegative(@Query("floatQuery") double floatQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries floatNull" }) @GET("queries/float/null") Observable<Response<ResponseBody>> floatNull(@Query("floatQuery") Double floatQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries doubleDecimalPositive" }) @GET("queries/double/9999999.999") Observable<Response<ResponseBody>> doubleDecimalPositive(@Query("doubleQuery") double doubleQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries doubleDecimalNegative" }) @GET("queries/double/-9999999.999") Observable<Response<ResponseBody>> doubleDecimalNegative(@Query("doubleQuery") double doubleQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries doubleNull" }) @GET("queries/double/null") Observable<Response<ResponseBody>> doubleNull(@Query("doubleQuery") Double doubleQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries stringUnicode" }) @GET("queries/string/unicode/") Observable<Response<ResponseBody>> stringUnicode(@Query("stringQuery") String stringQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries stringUrlEncoded" }) @GET("queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend") Observable<Response<ResponseBody>> stringUrlEncoded(@Query("stringQuery") String stringQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries stringEmpty" }) @GET("queries/string/empty") Observable<Response<ResponseBody>> stringEmpty(@Query("stringQuery") String stringQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries stringNull" }) @GET("queries/string/null") Observable<Response<ResponseBody>> stringNull(@Query("stringQuery") String stringQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries enumValid" }) @GET("queries/enum/green%20color") Observable<Response<ResponseBody>> enumValid(@Query("enumQuery") UriColor enumQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries enumNull" }) @GET("queries/enum/null") Observable<Response<ResponseBody>> enumNull(@Query("enumQuery") UriColor enumQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries byteMultiByte" }) @GET("queries/byte/multibyte") Observable<Response<ResponseBody>> byteMultiByte(@Query("byteQuery") String byteQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries byteEmpty" }) @GET("queries/byte/empty") Observable<Response<ResponseBody>> byteEmpty(@Query("byteQuery") String byteQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries byteNull" }) @GET("queries/byte/null") Observable<Response<ResponseBody>> byteNull(@Query("byteQuery") String byteQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries dateValid" }) @GET("queries/date/2012-01-01") Observable<Response<ResponseBody>> dateValid(@Query("dateQuery") LocalDate dateQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries dateNull" }) @GET("queries/date/null") Observable<Response<ResponseBody>> dateNull(@Query("dateQuery") LocalDate dateQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries dateTimeValid" }) @GET("queries/datetime/2012-01-01T01%3A01%3A01Z") Observable<Response<ResponseBody>> dateTimeValid(@Query("dateTimeQuery") DateTime dateTimeQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries dateTimeNull" }) @GET("queries/datetime/null") Observable<Response<ResponseBody>> dateTimeNull(@Query("dateTimeQuery") DateTime dateTimeQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries arrayStringCsvValid" }) @GET("queries/array/csv/string/valid") Observable<Response<ResponseBody>> arrayStringCsvValid(@Query("arrayQuery") String arrayQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries arrayStringCsvNull" }) @GET("queries/array/csv/string/null") Observable<Response<ResponseBody>> arrayStringCsvNull(@Query("arrayQuery") String arrayQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries arrayStringCsvEmpty" }) @GET("queries/array/csv/string/empty") Observable<Response<ResponseBody>> arrayStringCsvEmpty(@Query("arrayQuery") String arrayQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries arrayStringSsvValid" }) @GET("queries/array/ssv/string/valid") Observable<Response<ResponseBody>> arrayStringSsvValid(@Query("arrayQuery") String arrayQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries arrayStringTsvValid" }) @GET("queries/array/tsv/string/valid") Observable<Response<ResponseBody>> arrayStringTsvValid(@Query("arrayQuery") String arrayQuery); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.url.Queries arrayStringPipesValid" }) @GET("queries/array/pipes/string/valid") Observable<Response<ResponseBody>> arrayStringPipesValid(@Query("arrayQuery") String arrayQuery); } /** * Get true Boolean value on path. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getBooleanTrue() { getBooleanTrueWithServiceResponseAsync().toBlocking().single().body(); } /** * Get true Boolean value on path. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getBooleanTrueAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getBooleanTrueWithServiceResponseAsync(), serviceCallback); } /** * Get true Boolean value on path. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getBooleanTrueAsync() { return getBooleanTrueWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get true Boolean value on path. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getBooleanTrueWithServiceResponseAsync() { final boolean boolQuery = true; return service.getBooleanTrue(boolQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getBooleanTrueDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> getBooleanTrueDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get false Boolean value on path. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getBooleanFalse() { getBooleanFalseWithServiceResponseAsync().toBlocking().single().body(); } /** * Get false Boolean value on path. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getBooleanFalseAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getBooleanFalseWithServiceResponseAsync(), serviceCallback); } /** * Get false Boolean value on path. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getBooleanFalseAsync() { return getBooleanFalseWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get false Boolean value on path. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getBooleanFalseWithServiceResponseAsync() { final boolean boolQuery = false; return service.getBooleanFalse(boolQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getBooleanFalseDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> getBooleanFalseDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get null Boolean value on query (query string should be absent). * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getBooleanNull() { getBooleanNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get null Boolean value on query (query string should be absent). * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getBooleanNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getBooleanNullWithServiceResponseAsync(), serviceCallback); } /** * Get null Boolean value on query (query string should be absent). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getBooleanNullAsync() { return getBooleanNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null Boolean value on query (query string should be absent). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getBooleanNullWithServiceResponseAsync() { final Boolean boolQuery = null; return service.getBooleanNull(boolQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getBooleanNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get null Boolean value on query (query string should be absent). * * @param boolQuery null boolean value * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getBooleanNull(Boolean boolQuery) { getBooleanNullWithServiceResponseAsync(boolQuery).toBlocking().single().body(); } /** * Get null Boolean value on query (query string should be absent). * * @param boolQuery null boolean value * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getBooleanNullAsync(Boolean boolQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getBooleanNullWithServiceResponseAsync(boolQuery), serviceCallback); } /** * Get null Boolean value on query (query string should be absent). * * @param boolQuery null boolean value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getBooleanNullAsync(Boolean boolQuery) { return getBooleanNullWithServiceResponseAsync(boolQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null Boolean value on query (query string should be absent). * * @param boolQuery null boolean value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getBooleanNullWithServiceResponseAsync(Boolean boolQuery) { return service.getBooleanNull(boolQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getBooleanNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> getBooleanNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '1000000' integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getIntOneMillion() { getIntOneMillionWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '1000000' integer value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getIntOneMillionAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getIntOneMillionWithServiceResponseAsync(), serviceCallback); } /** * Get '1000000' integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getIntOneMillionAsync() { return getIntOneMillionWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '1000000' integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getIntOneMillionWithServiceResponseAsync() { final int intQuery = 1000000; return service.getIntOneMillion(intQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getIntOneMillionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> getIntOneMillionDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '-1000000' integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getIntNegativeOneMillion() { getIntNegativeOneMillionWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '-1000000' integer value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getIntNegativeOneMillionAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getIntNegativeOneMillionWithServiceResponseAsync(), serviceCallback); } /** * Get '-1000000' integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getIntNegativeOneMillionAsync() { return getIntNegativeOneMillionWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '-1000000' integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getIntNegativeOneMillionWithServiceResponseAsync() { final int intQuery = -1000000; return service.getIntNegativeOneMillion(intQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getIntNegativeOneMillionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> getIntNegativeOneMillionDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get null integer value (no query parameter). * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getIntNull() { getIntNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get null integer value (no query parameter). * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getIntNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getIntNullWithServiceResponseAsync(), serviceCallback); } /** * Get null integer value (no query parameter). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getIntNullAsync() { return getIntNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null integer value (no query parameter). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getIntNullWithServiceResponseAsync() { final Integer intQuery = null; return service.getIntNull(intQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getIntNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get null integer value (no query parameter). * * @param intQuery null integer value * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getIntNull(Integer intQuery) { getIntNullWithServiceResponseAsync(intQuery).toBlocking().single().body(); } /** * Get null integer value (no query parameter). * * @param intQuery null integer value * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getIntNullAsync(Integer intQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getIntNullWithServiceResponseAsync(intQuery), serviceCallback); } /** * Get null integer value (no query parameter). * * @param intQuery null integer value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getIntNullAsync(Integer intQuery) { return getIntNullWithServiceResponseAsync(intQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null integer value (no query parameter). * * @param intQuery null integer value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getIntNullWithServiceResponseAsync(Integer intQuery) { return service.getIntNull(intQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getIntNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> getIntNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '10000000000' 64 bit integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getTenBillion() { getTenBillionWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '10000000000' 64 bit integer value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getTenBillionAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getTenBillionWithServiceResponseAsync(), serviceCallback); } /** * Get '10000000000' 64 bit integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getTenBillionAsync() { return getTenBillionWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '10000000000' 64 bit integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getTenBillionWithServiceResponseAsync() { final long longQuery = 10000000000L; return service.getTenBillion(longQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getTenBillionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> getTenBillionDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '-10000000000' 64 bit integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getNegativeTenBillion() { getNegativeTenBillionWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '-10000000000' 64 bit integer value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getNegativeTenBillionAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getNegativeTenBillionWithServiceResponseAsync(), serviceCallback); } /** * Get '-10000000000' 64 bit integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getNegativeTenBillionAsync() { return getNegativeTenBillionWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '-10000000000' 64 bit integer value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getNegativeTenBillionWithServiceResponseAsync() { final long longQuery = -10000000000L; return service.getNegativeTenBillion(longQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getNegativeTenBillionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> getNegativeTenBillionDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get 'null 64 bit integer value (no query param in uri). * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getLongNull() { getLongNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get 'null 64 bit integer value (no query param in uri). * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getLongNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getLongNullWithServiceResponseAsync(), serviceCallback); } /** * Get 'null 64 bit integer value (no query param in uri). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getLongNullAsync() { return getLongNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get 'null 64 bit integer value (no query param in uri). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getLongNullWithServiceResponseAsync() { final Long longQuery = null; return service.getLongNull(longQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getLongNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get 'null 64 bit integer value (no query param in uri). * * @param longQuery null 64 bit integer value * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void getLongNull(Long longQuery) { getLongNullWithServiceResponseAsync(longQuery).toBlocking().single().body(); } /** * Get 'null 64 bit integer value (no query param in uri). * * @param longQuery null 64 bit integer value * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> getLongNullAsync(Long longQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(getLongNullWithServiceResponseAsync(longQuery), serviceCallback); } /** * Get 'null 64 bit integer value (no query param in uri). * * @param longQuery null 64 bit integer value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> getLongNullAsync(Long longQuery) { return getLongNullWithServiceResponseAsync(longQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get 'null 64 bit integer value (no query param in uri). * * @param longQuery null 64 bit integer value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> getLongNullWithServiceResponseAsync(Long longQuery) { return service.getLongNull(longQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = getLongNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> getLongNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '1.034E+20' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void floatScientificPositive() { floatScientificPositiveWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '1.034E+20' numeric value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> floatScientificPositiveAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(floatScientificPositiveWithServiceResponseAsync(), serviceCallback); } /** * Get '1.034E+20' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> floatScientificPositiveAsync() { return floatScientificPositiveWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '1.034E+20' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> floatScientificPositiveWithServiceResponseAsync() { final double floatQuery = 1.034E+20; return service.floatScientificPositive(floatQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = floatScientificPositiveDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> floatScientificPositiveDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '-1.034E-20' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void floatScientificNegative() { floatScientificNegativeWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '-1.034E-20' numeric value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> floatScientificNegativeAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(floatScientificNegativeWithServiceResponseAsync(), serviceCallback); } /** * Get '-1.034E-20' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> floatScientificNegativeAsync() { return floatScientificNegativeWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '-1.034E-20' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> floatScientificNegativeWithServiceResponseAsync() { final double floatQuery = -1.034E-20; return service.floatScientificNegative(floatQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = floatScientificNegativeDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> floatScientificNegativeDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get null numeric value (no query parameter). * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void floatNull() { floatNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get null numeric value (no query parameter). * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> floatNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(floatNullWithServiceResponseAsync(), serviceCallback); } /** * Get null numeric value (no query parameter). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> floatNullAsync() { return floatNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null numeric value (no query parameter). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> floatNullWithServiceResponseAsync() { final Double floatQuery = null; return service.floatNull(floatQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = floatNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get null numeric value (no query parameter). * * @param floatQuery null numeric value * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void floatNull(Double floatQuery) { floatNullWithServiceResponseAsync(floatQuery).toBlocking().single().body(); } /** * Get null numeric value (no query parameter). * * @param floatQuery null numeric value * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> floatNullAsync(Double floatQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(floatNullWithServiceResponseAsync(floatQuery), serviceCallback); } /** * Get null numeric value (no query parameter). * * @param floatQuery null numeric value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> floatNullAsync(Double floatQuery) { return floatNullWithServiceResponseAsync(floatQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null numeric value (no query parameter). * * @param floatQuery null numeric value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> floatNullWithServiceResponseAsync(Double floatQuery) { return service.floatNull(floatQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = floatNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> floatNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '9999999.999' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void doubleDecimalPositive() { doubleDecimalPositiveWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '9999999.999' numeric value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> doubleDecimalPositiveAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(doubleDecimalPositiveWithServiceResponseAsync(), serviceCallback); } /** * Get '9999999.999' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> doubleDecimalPositiveAsync() { return doubleDecimalPositiveWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '9999999.999' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> doubleDecimalPositiveWithServiceResponseAsync() { final double doubleQuery = 9999999.999; return service.doubleDecimalPositive(doubleQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = doubleDecimalPositiveDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> doubleDecimalPositiveDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '-9999999.999' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void doubleDecimalNegative() { doubleDecimalNegativeWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '-9999999.999' numeric value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> doubleDecimalNegativeAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(doubleDecimalNegativeWithServiceResponseAsync(), serviceCallback); } /** * Get '-9999999.999' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> doubleDecimalNegativeAsync() { return doubleDecimalNegativeWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '-9999999.999' numeric value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> doubleDecimalNegativeWithServiceResponseAsync() { final double doubleQuery = -9999999.999; return service.doubleDecimalNegative(doubleQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = doubleDecimalNegativeDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> doubleDecimalNegativeDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get null numeric value (no query parameter). * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void doubleNull() { doubleNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get null numeric value (no query parameter). * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> doubleNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(doubleNullWithServiceResponseAsync(), serviceCallback); } /** * Get null numeric value (no query parameter). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> doubleNullAsync() { return doubleNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null numeric value (no query parameter). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> doubleNullWithServiceResponseAsync() { final Double doubleQuery = null; return service.doubleNull(doubleQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = doubleNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get null numeric value (no query parameter). * * @param doubleQuery null numeric value * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void doubleNull(Double doubleQuery) { doubleNullWithServiceResponseAsync(doubleQuery).toBlocking().single().body(); } /** * Get null numeric value (no query parameter). * * @param doubleQuery null numeric value * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> doubleNullAsync(Double doubleQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(doubleNullWithServiceResponseAsync(doubleQuery), serviceCallback); } /** * Get null numeric value (no query parameter). * * @param doubleQuery null numeric value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> doubleNullAsync(Double doubleQuery) { return doubleNullWithServiceResponseAsync(doubleQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null numeric value (no query parameter). * * @param doubleQuery null numeric value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> doubleNullWithServiceResponseAsync(Double doubleQuery) { return service.doubleNull(doubleQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = doubleNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> doubleNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void stringUnicode() { stringUnicodeWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> stringUnicodeAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(stringUnicodeWithServiceResponseAsync(), serviceCallback); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> stringUnicodeAsync() { return stringUnicodeWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> stringUnicodeWithServiceResponseAsync() { final String stringQuery = "啊齄丂狛狜隣郎隣兀﨩"; return service.stringUnicode(stringQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = stringUnicodeDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> stringUnicodeDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get 'begin!*'();:@ &amp;=+$,/?#[]end. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void stringUrlEncoded() { stringUrlEncodedWithServiceResponseAsync().toBlocking().single().body(); } /** * Get 'begin!*'();:@ &amp;=+$,/?#[]end. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> stringUrlEncodedAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(stringUrlEncodedWithServiceResponseAsync(), serviceCallback); } /** * Get 'begin!*'();:@ &amp;=+$,/?#[]end. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> stringUrlEncodedAsync() { return stringUrlEncodedWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get 'begin!*'();:@ &amp;=+$,/?#[]end. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> stringUrlEncodedWithServiceResponseAsync() { final String stringQuery = "begin!*'();:@ &=+$,/?#[]end"; return service.stringUrlEncoded(stringQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = stringUrlEncodedDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> stringUrlEncodedDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get ''. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void stringEmpty() { stringEmptyWithServiceResponseAsync().toBlocking().single().body(); } /** * Get ''. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> stringEmptyAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(stringEmptyWithServiceResponseAsync(), serviceCallback); } /** * Get ''. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> stringEmptyAsync() { return stringEmptyWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get ''. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> stringEmptyWithServiceResponseAsync() { final String stringQuery = ""; return service.stringEmpty(stringQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = stringEmptyDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> stringEmptyDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get null (no query parameter in url). * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void stringNull() { stringNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get null (no query parameter in url). * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> stringNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(stringNullWithServiceResponseAsync(), serviceCallback); } /** * Get null (no query parameter in url). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> stringNullAsync() { return stringNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null (no query parameter in url). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> stringNullWithServiceResponseAsync() { final String stringQuery = null; return service.stringNull(stringQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = stringNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get null (no query parameter in url). * * @param stringQuery null string value * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void stringNull(String stringQuery) { stringNullWithServiceResponseAsync(stringQuery).toBlocking().single().body(); } /** * Get null (no query parameter in url). * * @param stringQuery null string value * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> stringNullAsync(String stringQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(stringNullWithServiceResponseAsync(stringQuery), serviceCallback); } /** * Get null (no query parameter in url). * * @param stringQuery null string value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> stringNullAsync(String stringQuery) { return stringNullWithServiceResponseAsync(stringQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null (no query parameter in url). * * @param stringQuery null string value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> stringNullWithServiceResponseAsync(String stringQuery) { return service.stringNull(stringQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = stringNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> stringNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get using uri with query parameter 'green color'. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void enumValid() { enumValidWithServiceResponseAsync().toBlocking().single().body(); } /** * Get using uri with query parameter 'green color'. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> enumValidAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(enumValidWithServiceResponseAsync(), serviceCallback); } /** * Get using uri with query parameter 'green color'. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> enumValidAsync() { return enumValidWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get using uri with query parameter 'green color'. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> enumValidWithServiceResponseAsync() { final UriColor enumQuery = null; return service.enumValid(enumQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = enumValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get using uri with query parameter 'green color'. * * @param enumQuery 'green color' enum value. Possible values include: 'red color', 'green color', 'blue color' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void enumValid(UriColor enumQuery) { enumValidWithServiceResponseAsync(enumQuery).toBlocking().single().body(); } /** * Get using uri with query parameter 'green color'. * * @param enumQuery 'green color' enum value. Possible values include: 'red color', 'green color', 'blue color' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> enumValidAsync(UriColor enumQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(enumValidWithServiceResponseAsync(enumQuery), serviceCallback); } /** * Get using uri with query parameter 'green color'. * * @param enumQuery 'green color' enum value. Possible values include: 'red color', 'green color', 'blue color' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> enumValidAsync(UriColor enumQuery) { return enumValidWithServiceResponseAsync(enumQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get using uri with query parameter 'green color'. * * @param enumQuery 'green color' enum value. Possible values include: 'red color', 'green color', 'blue color' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> enumValidWithServiceResponseAsync(UriColor enumQuery) { return service.enumValid(enumQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = enumValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> enumValidDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get null (no query parameter in url). * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void enumNull() { enumNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get null (no query parameter in url). * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> enumNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(enumNullWithServiceResponseAsync(), serviceCallback); } /** * Get null (no query parameter in url). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> enumNullAsync() { return enumNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null (no query parameter in url). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> enumNullWithServiceResponseAsync() { final UriColor enumQuery = null; return service.enumNull(enumQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = enumNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get null (no query parameter in url). * * @param enumQuery null string value. Possible values include: 'red color', 'green color', 'blue color' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void enumNull(UriColor enumQuery) { enumNullWithServiceResponseAsync(enumQuery).toBlocking().single().body(); } /** * Get null (no query parameter in url). * * @param enumQuery null string value. Possible values include: 'red color', 'green color', 'blue color' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> enumNullAsync(UriColor enumQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(enumNullWithServiceResponseAsync(enumQuery), serviceCallback); } /** * Get null (no query parameter in url). * * @param enumQuery null string value. Possible values include: 'red color', 'green color', 'blue color' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> enumNullAsync(UriColor enumQuery) { return enumNullWithServiceResponseAsync(enumQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null (no query parameter in url). * * @param enumQuery null string value. Possible values include: 'red color', 'green color', 'blue color' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> enumNullWithServiceResponseAsync(UriColor enumQuery) { return service.enumNull(enumQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = enumNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> enumNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void byteMultiByte() { byteMultiByteWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> byteMultiByteAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(byteMultiByteWithServiceResponseAsync(), serviceCallback); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> byteMultiByteAsync() { return byteMultiByteWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> byteMultiByteWithServiceResponseAsync() { final byte[] byteQuery = new byte[0]; String byteQueryConverted = Base64.encodeBase64String(byteQuery); return service.byteMultiByte(byteQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = byteMultiByteDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. * * @param byteQuery '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void byteMultiByte(byte[] byteQuery) { byteMultiByteWithServiceResponseAsync(byteQuery).toBlocking().single().body(); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. * * @param byteQuery '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> byteMultiByteAsync(byte[] byteQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(byteMultiByteWithServiceResponseAsync(byteQuery), serviceCallback); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. * * @param byteQuery '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> byteMultiByteAsync(byte[] byteQuery) { return byteMultiByteWithServiceResponseAsync(byteQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. * * @param byteQuery '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> byteMultiByteWithServiceResponseAsync(byte[] byteQuery) { String byteQueryConverted = Base64.encodeBase64String(byteQuery); return service.byteMultiByte(byteQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = byteMultiByteDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> byteMultiByteDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '' as byte array. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void byteEmpty() { byteEmptyWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '' as byte array. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> byteEmptyAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(byteEmptyWithServiceResponseAsync(), serviceCallback); } /** * Get '' as byte array. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> byteEmptyAsync() { return byteEmptyWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '' as byte array. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> byteEmptyWithServiceResponseAsync() { final byte[] byteQuery = "".getBytes(); String byteQueryConverted = Base64.encodeBase64String(byteQuery); return service.byteEmpty(byteQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = byteEmptyDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> byteEmptyDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get null as byte array (no query parameters in uri). * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void byteNull() { byteNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get null as byte array (no query parameters in uri). * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> byteNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(byteNullWithServiceResponseAsync(), serviceCallback); } /** * Get null as byte array (no query parameters in uri). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> byteNullAsync() { return byteNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null as byte array (no query parameters in uri). * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> byteNullWithServiceResponseAsync() { final byte[] byteQuery = new byte[0]; String byteQueryConverted = Base64.encodeBase64String(byteQuery); return service.byteNull(byteQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = byteNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get null as byte array (no query parameters in uri). * * @param byteQuery null as byte array (no query parameters in uri) * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void byteNull(byte[] byteQuery) { byteNullWithServiceResponseAsync(byteQuery).toBlocking().single().body(); } /** * Get null as byte array (no query parameters in uri). * * @param byteQuery null as byte array (no query parameters in uri) * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> byteNullAsync(byte[] byteQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(byteNullWithServiceResponseAsync(byteQuery), serviceCallback); } /** * Get null as byte array (no query parameters in uri). * * @param byteQuery null as byte array (no query parameters in uri) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> byteNullAsync(byte[] byteQuery) { return byteNullWithServiceResponseAsync(byteQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null as byte array (no query parameters in uri). * * @param byteQuery null as byte array (no query parameters in uri) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> byteNullWithServiceResponseAsync(byte[] byteQuery) { String byteQueryConverted = Base64.encodeBase64String(byteQuery); return service.byteNull(byteQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = byteNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> byteNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '2012-01-01' as date. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void dateValid() { dateValidWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '2012-01-01' as date. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> dateValidAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(dateValidWithServiceResponseAsync(), serviceCallback); } /** * Get '2012-01-01' as date. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> dateValidAsync() { return dateValidWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '2012-01-01' as date. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> dateValidWithServiceResponseAsync() { final LocalDate dateQuery = LocalDate.parse("2012-01-01"); return service.dateValid(dateQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = dateValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> dateValidDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get null as date - this should result in no query parameters in uri. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void dateNull() { dateNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get null as date - this should result in no query parameters in uri. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> dateNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(dateNullWithServiceResponseAsync(), serviceCallback); } /** * Get null as date - this should result in no query parameters in uri. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> dateNullAsync() { return dateNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null as date - this should result in no query parameters in uri. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> dateNullWithServiceResponseAsync() { final LocalDate dateQuery = null; return service.dateNull(dateQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = dateNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get null as date - this should result in no query parameters in uri. * * @param dateQuery null as date (no query parameters in uri) * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void dateNull(LocalDate dateQuery) { dateNullWithServiceResponseAsync(dateQuery).toBlocking().single().body(); } /** * Get null as date - this should result in no query parameters in uri. * * @param dateQuery null as date (no query parameters in uri) * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> dateNullAsync(LocalDate dateQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(dateNullWithServiceResponseAsync(dateQuery), serviceCallback); } /** * Get null as date - this should result in no query parameters in uri. * * @param dateQuery null as date (no query parameters in uri) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> dateNullAsync(LocalDate dateQuery) { return dateNullWithServiceResponseAsync(dateQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null as date - this should result in no query parameters in uri. * * @param dateQuery null as date (no query parameters in uri) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> dateNullWithServiceResponseAsync(LocalDate dateQuery) { return service.dateNull(dateQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = dateNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> dateNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get '2012-01-01T01:01:01Z' as date-time. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void dateTimeValid() { dateTimeValidWithServiceResponseAsync().toBlocking().single().body(); } /** * Get '2012-01-01T01:01:01Z' as date-time. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> dateTimeValidAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(dateTimeValidWithServiceResponseAsync(), serviceCallback); } /** * Get '2012-01-01T01:01:01Z' as date-time. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> dateTimeValidAsync() { return dateTimeValidWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get '2012-01-01T01:01:01Z' as date-time. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> dateTimeValidWithServiceResponseAsync() { final DateTime dateTimeQuery = DateTime.parse("2012-01-01T01:01:01Z"); return service.dateTimeValid(dateTimeQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = dateTimeValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> dateTimeValidDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get null as date-time, should result in no query parameters in uri. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void dateTimeNull() { dateTimeNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get null as date-time, should result in no query parameters in uri. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> dateTimeNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(dateTimeNullWithServiceResponseAsync(), serviceCallback); } /** * Get null as date-time, should result in no query parameters in uri. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> dateTimeNullAsync() { return dateTimeNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null as date-time, should result in no query parameters in uri. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> dateTimeNullWithServiceResponseAsync() { final DateTime dateTimeQuery = null; return service.dateTimeNull(dateTimeQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = dateTimeNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get null as date-time, should result in no query parameters in uri. * * @param dateTimeQuery null as date-time (no query parameters) * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void dateTimeNull(DateTime dateTimeQuery) { dateTimeNullWithServiceResponseAsync(dateTimeQuery).toBlocking().single().body(); } /** * Get null as date-time, should result in no query parameters in uri. * * @param dateTimeQuery null as date-time (no query parameters) * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> dateTimeNullAsync(DateTime dateTimeQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(dateTimeNullWithServiceResponseAsync(dateTimeQuery), serviceCallback); } /** * Get null as date-time, should result in no query parameters in uri. * * @param dateTimeQuery null as date-time (no query parameters) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> dateTimeNullAsync(DateTime dateTimeQuery) { return dateTimeNullWithServiceResponseAsync(dateTimeQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get null as date-time, should result in no query parameters in uri. * * @param dateTimeQuery null as date-time (no query parameters) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> dateTimeNullWithServiceResponseAsync(DateTime dateTimeQuery) { return service.dateTimeNull(dateTimeQuery) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = dateTimeNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> dateTimeNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringCsvValid() { arrayStringCsvValidWithServiceResponseAsync().toBlocking().single().body(); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringCsvValidAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringCsvValidWithServiceResponseAsync(), serviceCallback); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringCsvValidAsync() { return arrayStringCsvValidWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringCsvValidWithServiceResponseAsync() { final List<String> arrayQuery = null; String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.CSV); return service.arrayStringCsvValid(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringCsvValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringCsvValid(List<String> arrayQuery) { arrayStringCsvValidWithServiceResponseAsync(arrayQuery).toBlocking().single().body(); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringCsvValidAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringCsvValidWithServiceResponseAsync(arrayQuery), serviceCallback); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringCsvValidAsync(List<String> arrayQuery) { return arrayStringCsvValidWithServiceResponseAsync(arrayQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the csv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringCsvValidWithServiceResponseAsync(List<String> arrayQuery) { Validator.validate(arrayQuery); String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.CSV); return service.arrayStringCsvValid(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringCsvValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> arrayStringCsvValidDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get a null array of string using the csv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringCsvNull() { arrayStringCsvNullWithServiceResponseAsync().toBlocking().single().body(); } /** * Get a null array of string using the csv-array format. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringCsvNullAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringCsvNullWithServiceResponseAsync(), serviceCallback); } /** * Get a null array of string using the csv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringCsvNullAsync() { return arrayStringCsvNullWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get a null array of string using the csv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringCsvNullWithServiceResponseAsync() { final List<String> arrayQuery = null; String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.CSV); return service.arrayStringCsvNull(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringCsvNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get a null array of string using the csv-array format. * * @param arrayQuery a null array of string using the csv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringCsvNull(List<String> arrayQuery) { arrayStringCsvNullWithServiceResponseAsync(arrayQuery).toBlocking().single().body(); } /** * Get a null array of string using the csv-array format. * * @param arrayQuery a null array of string using the csv-array format * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringCsvNullAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringCsvNullWithServiceResponseAsync(arrayQuery), serviceCallback); } /** * Get a null array of string using the csv-array format. * * @param arrayQuery a null array of string using the csv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringCsvNullAsync(List<String> arrayQuery) { return arrayStringCsvNullWithServiceResponseAsync(arrayQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get a null array of string using the csv-array format. * * @param arrayQuery a null array of string using the csv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringCsvNullWithServiceResponseAsync(List<String> arrayQuery) { Validator.validate(arrayQuery); String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.CSV); return service.arrayStringCsvNull(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringCsvNullDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> arrayStringCsvNullDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get an empty array [] of string using the csv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringCsvEmpty() { arrayStringCsvEmptyWithServiceResponseAsync().toBlocking().single().body(); } /** * Get an empty array [] of string using the csv-array format. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringCsvEmptyAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringCsvEmptyWithServiceResponseAsync(), serviceCallback); } /** * Get an empty array [] of string using the csv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringCsvEmptyAsync() { return arrayStringCsvEmptyWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an empty array [] of string using the csv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringCsvEmptyWithServiceResponseAsync() { final List<String> arrayQuery = null; String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.CSV); return service.arrayStringCsvEmpty(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringCsvEmptyDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get an empty array [] of string using the csv-array format. * * @param arrayQuery an empty array [] of string using the csv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringCsvEmpty(List<String> arrayQuery) { arrayStringCsvEmptyWithServiceResponseAsync(arrayQuery).toBlocking().single().body(); } /** * Get an empty array [] of string using the csv-array format. * * @param arrayQuery an empty array [] of string using the csv-array format * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringCsvEmptyAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringCsvEmptyWithServiceResponseAsync(arrayQuery), serviceCallback); } /** * Get an empty array [] of string using the csv-array format. * * @param arrayQuery an empty array [] of string using the csv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringCsvEmptyAsync(List<String> arrayQuery) { return arrayStringCsvEmptyWithServiceResponseAsync(arrayQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an empty array [] of string using the csv-array format. * * @param arrayQuery an empty array [] of string using the csv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringCsvEmptyWithServiceResponseAsync(List<String> arrayQuery) { Validator.validate(arrayQuery); String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.CSV); return service.arrayStringCsvEmpty(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringCsvEmptyDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> arrayStringCsvEmptyDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringSsvValid() { arrayStringSsvValidWithServiceResponseAsync().toBlocking().single().body(); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringSsvValidAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringSsvValidWithServiceResponseAsync(), serviceCallback); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringSsvValidAsync() { return arrayStringSsvValidWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringSsvValidWithServiceResponseAsync() { final List<String> arrayQuery = null; String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.SSV); return service.arrayStringSsvValid(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringSsvValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringSsvValid(List<String> arrayQuery) { arrayStringSsvValidWithServiceResponseAsync(arrayQuery).toBlocking().single().body(); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringSsvValidAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringSsvValidWithServiceResponseAsync(arrayQuery), serviceCallback); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringSsvValidAsync(List<String> arrayQuery) { return arrayStringSsvValidWithServiceResponseAsync(arrayQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringSsvValidWithServiceResponseAsync(List<String> arrayQuery) { Validator.validate(arrayQuery); String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.SSV); return service.arrayStringSsvValid(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringSsvValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> arrayStringSsvValidDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringTsvValid() { arrayStringTsvValidWithServiceResponseAsync().toBlocking().single().body(); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringTsvValidAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringTsvValidWithServiceResponseAsync(), serviceCallback); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringTsvValidAsync() { return arrayStringTsvValidWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringTsvValidWithServiceResponseAsync() { final List<String> arrayQuery = null; String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.TSV); return service.arrayStringTsvValid(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringTsvValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringTsvValid(List<String> arrayQuery) { arrayStringTsvValidWithServiceResponseAsync(arrayQuery).toBlocking().single().body(); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringTsvValidAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringTsvValidWithServiceResponseAsync(arrayQuery), serviceCallback); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringTsvValidAsync(List<String> arrayQuery) { return arrayStringTsvValidWithServiceResponseAsync(arrayQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the tsv-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringTsvValidWithServiceResponseAsync(List<String> arrayQuery) { Validator.validate(arrayQuery); String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.TSV); return service.arrayStringTsvValid(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringTsvValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> arrayStringTsvValidDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringPipesValid() { arrayStringPipesValidWithServiceResponseAsync().toBlocking().single().body(); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringPipesValidAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringPipesValidWithServiceResponseAsync(), serviceCallback); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringPipesValidAsync() { return arrayStringPipesValidWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringPipesValidWithServiceResponseAsync() { final List<String> arrayQuery = null; String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.PIPES); return service.arrayStringPipesValid(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringPipesValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void arrayStringPipesValid(List<String> arrayQuery) { arrayStringPipesValidWithServiceResponseAsync(arrayQuery).toBlocking().single().body(); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> arrayStringPipesValidAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(arrayStringPipesValidWithServiceResponseAsync(arrayQuery), serviceCallback); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> arrayStringPipesValidAsync(List<String> arrayQuery) { return arrayStringPipesValidWithServiceResponseAsync(arrayQuery).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the pipes-array format * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> arrayStringPipesValidWithServiceResponseAsync(List<String> arrayQuery) { Validator.validate(arrayQuery); String arrayQueryConverted = this.client.serializerAdapter().serializeList(arrayQuery, CollectionFormat.PIPES); return service.arrayStringPipesValid(arrayQueryConverted) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = arrayStringPipesValidDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> arrayStringPipesValidDelegate(Response<ResponseBody> response) throws ErrorException, IOException { return this.client.restClient().responseBuilderFactory().<Void, ErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(ErrorException.class) .build(response); } }
{'content_hash': '55f8d2edcea2c70563d27320f305b878', 'timestamp': '', 'source': 'github', 'line_count': 3575, 'max_line_length': 140, 'avg_line_length': 46.16475524475524, 'alnum_prop': 0.6541605317531007, 'repo_name': 'jhancock93/autorest', 'id': '6048db0eacdb324e49cb898d2a05b17a5b7fb9e4', 'size': '165697', 'binary': False, 'copies': '13', 'ref': 'refs/heads/master', 'path': 'src/generator/AutoRest.Java.Tests/src/main/java/fixtures/url/implementation/QueriesImpl.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '12942'}, {'name': 'C#', 'bytes': '16215554'}, {'name': 'CSS', 'bytes': '110'}, {'name': 'Go', 'bytes': '142541'}, {'name': 'HTML', 'bytes': '274'}, {'name': 'Java', 'bytes': '6906819'}, {'name': 'JavaScript', 'bytes': '4715249'}, {'name': 'PowerShell', 'bytes': '67568'}, {'name': 'Python', 'bytes': '2375244'}, {'name': 'Ruby', 'bytes': '307745'}, {'name': 'Shell', 'bytes': '423'}, {'name': 'TypeScript', 'bytes': '179578'}]}
=encoding utf-8 =head1 Name resty.limit.traffic - Lua module for aggregating multiple instances of limiter classes =head1 Synopsis http { lua_shared_dict my_req_store 100m; lua_shared_dict my_conn_store 100m; server { location / { access_by_lua_block { local limit_conn = require "resty.limit.conn" local limit_req = require "resty.limit.req" local limit_traffic = require "resty.limit.traffic" local lim1, err = limit_req.new("my_req_store", 300, 200) assert(lim1, err) local lim2, err = limit_req.new("my_req_store", 200, 100) assert(lim2, err) local lim3, err = limit_conn.new("my_conn_store", 1000, 1000, 0.5) assert(lim3, err) local limiters = {lim1, lim2, lim3} local host = ngx.var.host local client = ngx.var.binary_remote_addr local keys = {host, client, client} local states = {} local delay, err = limit_traffic.combine(limiters, keys, states) if not delay then if err == "rejected" then return ngx.exit(503) end ngx.log(ngx.ERR, "failed to limit traffic: ", err) return ngx.exit(500) end if lim3:is_committed() then local ctx = ngx.ctx ctx.limit_conn = lim3 ctx.limit_conn_key = keys[3] end print("sleeping ", delay, " sec, states: ", table.concat(states, ", ")) if delay >= 0.001 then ngx.sleep(delay) end } # content handler goes here. if it is content_by_lua, then you can # merge the Lua code above in access_by_lua into your # content_by_lua's Lua handler to save a little bit of CPU time. log_by_lua_block { local ctx = ngx.ctx local lim = ctx.limit_conn if lim then -- if you are using an upstream module in the content phase, -- then you probably want to use $upstream_response_time -- instead of $request_time below. local latency = tonumber(ngx.var.request_time) local key = ctx.limit_conn_key assert(key) local conn, err = lim:leaving(key, latency) if not conn then ngx.log(ngx.ERR, "failed to record the connection leaving ", "request: ", err) return end end } } } } =head1 Description This module can combine multiple limiters at once. For example, you may want to use two request rate limiters for different keys (one for host names and one for the remote client''s IP address), as well as one limiter for concurrency level at a key of the remote client address. This module can take into account all the limiters involved without introducing any extra delays for the current request. The concrete limiters supplied can be an instance of the L<resty.limit.req|./req.md> class or an instance of the L<resty.limit.conn|./conn.md> class, or an instance of any user class which has a compatible API (see the L<combine> class method for more details). =head1 Methods =head2 combine B<syntax:> C<delay, err = class.combine(limiters, keys)> B<syntax:> C<delay, err = class.combine(limiters, keys, states)> Combines all the concrete limiter objects and the limiting keys specified, calculates the over-all delay across all the limiters, and (optionally) records any current state information returned by each concrete limiter object (if any). This method takes the following parameters: =over =item * C<limiters> is an array-shaped Lua table that holds all the concrete limiter objects (for example, instances of the L<resty.limit.req|lib/resty/limit/req.md> and/or L<resty.limit.conn|lib/resty/limit/conn.md> classes or other compatible objects). The limiter object must have a method named C<incoming> which takes two parameters, C<key> and C<commit>, just like the L<resty.limit.req|lib/resty/limit/req.md> objects. In addition, this C<incoming> method must return a delay and another opaque value representing the current state (or a string describing the error when the first return value is C<nil>). In addition, the limiter object should also take a method named C<uncommit> which can be used to undo whatever is committed in the C<incoming> method call (approximately if not possible to do precisely). =item * C<keys> is an array-shaped Lua table that holds all the user keys corresponding to each of the concrete limiter object specified in the (previous) C<limiters> parameter. The number of elements in this table must equate that of the C<limiters> table. =item * C<states> is an optional user-supplied Lua table that can be used to output all the state information returned by each of the concrete limiter object. For example, instances of the L<resty.limit.req|lib/resty/limit/req.md> class return the current number of excessive requests per second (if exceeding the rate threshold) while instances of the L<resty.limit.conn|lib/resty/conn.md> class return the current concurrency level. When missing or set to C<nil>, this method does not bother outputing any state information. =back This method returns the delay in seconds (the caller should sleep before processing the current request) across all the concrete limiter objects specified upon each of the corresponding limiting keys (under the hood, the delay is just the maximum of all the delays dictated by the limiters). If any of the limiters reject the current request immediately, then this method ensure the current request incoming event is not committed in any of these concrete limiters. In this case, this method returns C<nil> and the error string C<"rejected">. In case of other errors, it returns C<nil> and a string describing the error. Like each of concrete limiter objects, this method never sleeps itself. It simply returns a delay if necessary and requires the caller to later invoke the L<ngx.sleep|https://github.com/openresty/lua-nginx-module#ngxsleep> method to sleep. =head1 Instance Sharing This class itself carries no state information at all. The states are stored in each of the concrete limiter objects. Thus, as long as all those user-supplied concrete limiters support L<worker-level sharing|https://github.com/openresty/lua-nginx-module#data-sharing-within-an-nginx-worker>, this class does. =head1 Limiting Granularity All the concrete limiter objects must follow the same granularity (usually being the NGINX server instance level, across all its worker processes). Unmatched limiting granularity can cause unexpected results (which cannot happen if you limit yourself to the concrete limiter classes provided by this library, which is always on the NGINX server instance level). =head1 Installation Please see L<library installation instructions|../../../README.md#installation>. =head1 Community =head2 English Mailing List The L<openresty-en|https://groups.google.com/group/openresty-en> mailing list is for English speakers. =head2 Chinese Mailing List The L<openresty|https://groups.google.com/group/openresty> mailing list is for Chinese speakers. =head1 Bugs and Patches Please report bugs or submit patches by =over =item 1. creating a ticket on the L<GitHub Issue Tracker|https://github.com/openresty/lua-resty-limit-traffic/issues>, =item 2. or posting to the L<OpenResty community>. =back =head1 Author Yichun "agentzh" Zhang (章亦春) E<lt>[email protected]<gt>, CloudFlare Inc. =head1 Copyright and License This module is licensed under the BSD license. Copyright (C) 2015-2016, by Yichun "agentzh" Zhang, CloudFlare Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: =over =item * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. =back =over =item * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. =back THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =head1 See Also =over =item * module L<resty.limit.req|./req.md> =item * module L<resty.limit.conn|./conn.md> =item * library L<lua-resty-limit-traffic|../../../README.md> =item * the ngx_lua module: https://github.com/openresty/lua-nginx-module =item * OpenResty: https://openresty.org/ =back
{'content_hash': '6cda5da6f414fd9121b58fb8fefd413f', 'timestamp': '', 'source': 'github', 'line_count': 317, 'max_line_length': 755, 'avg_line_length': 31.820189274447948, 'alnum_prop': 0.6686824625755924, 'repo_name': 'LomoX-Offical/nginx-openresty-windows', 'id': 'd052621b2e2d5dc1b14cf04b1e0851d756e2f501', 'size': '10093', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/pod/lua-resty-limit-traffic-0.01/resty.limit.traffic.pod', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'Ada', 'bytes': '178158'}, {'name': 'Assembly', 'bytes': '951774'}, {'name': 'Batchfile', 'bytes': '165704'}, {'name': 'C', 'bytes': '55218965'}, {'name': 'C#', 'bytes': '108026'}, {'name': 'C++', 'bytes': '2901769'}, {'name': 'CMake', 'bytes': '95691'}, {'name': 'CSS', 'bytes': '10263'}, {'name': 'DIGITAL Command Language', 'bytes': '698640'}, {'name': 'DTrace', 'bytes': '4149'}, {'name': 'Emacs Lisp', 'bytes': '10594'}, {'name': 'Erlang', 'bytes': '1044'}, {'name': 'GDB', 'bytes': '8725'}, {'name': 'HTML', 'bytes': '2000171'}, {'name': 'JavaScript', 'bytes': '48992'}, {'name': 'Lua', 'bytes': '1486040'}, {'name': 'M4', 'bytes': '216644'}, {'name': 'Makefile', 'bytes': '2261503'}, {'name': 'Module Management System', 'bytes': '3090'}, {'name': 'Nginx', 'bytes': '12160'}, {'name': 'Objective-C', 'bytes': '25760'}, {'name': 'PLpgSQL', 'bytes': '4460'}, {'name': 'Pascal', 'bytes': '200868'}, {'name': 'Perl', 'bytes': '1986747'}, {'name': 'Perl 6', 'bytes': '4783690'}, {'name': 'Prolog', 'bytes': '653788'}, {'name': 'Protocol Buffer', 'bytes': '5528'}, {'name': 'Ragel', 'bytes': '26690'}, {'name': 'Roff', 'bytes': '1302697'}, {'name': 'Ruby', 'bytes': '388048'}, {'name': 'SAS', 'bytes': '3694'}, {'name': 'Scheme', 'bytes': '8498'}, {'name': 'Shell', 'bytes': '1274554'}, {'name': 'Vim script', 'bytes': '124420'}, {'name': 'XS', 'bytes': '29996'}, {'name': 'XSLT', 'bytes': '5400'}, {'name': 'eC', 'bytes': '10316'}]}
package org.kie.eclipse.navigator.preferences; import org.eclipse.jface.preference.FieldEditor; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; public class ReadonlyStringFieldEditor extends FieldEditor { /** * Text limit constant (value <code>-1</code>) indicating unlimited * text limit and width. */ public static int UNLIMITED = -1; /** * The text field, or <code>null</code> if none. */ Text textField; String textValue; /** * Width of text field in characters; initially unlimited. */ private int widthInChars = UNLIMITED; public ReadonlyStringFieldEditor() { // TODO Auto-generated constructor stub } public ReadonlyStringFieldEditor(String labelText, String textValue, Composite parent) { super("NONE", labelText, parent); this.textValue = textValue; } @Override protected void adjustForNumColumns(int numColumns) { GridData gd = (GridData) textField.getLayoutData(); gd.horizontalSpan = numColumns - 1; // We only grab excess space if we have to // If another field editor has more columns then // we assume it is setting the width. gd.grabExcessHorizontalSpace = gd.horizontalSpan == 1; } @Override protected void doFillIntoGrid(Composite parent, int numColumns) { getLabelControl(parent); textField = getTextControl(parent); GridData gd = new GridData(); gd.horizontalSpan = numColumns - 1; if (widthInChars != UNLIMITED) { GC gc = new GC(textField); try { Point extent = gc.textExtent("X");//$NON-NLS-1$ gd.widthHint = widthInChars * extent.x; } finally { gc.dispose(); } } else { gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; } textField.setLayoutData(gd); } public Text getTextControl(Composite parent) { if (textField == null) { textField = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); textField.setFont(parent.getFont()); } if (textValue!=null) textField.setText(textValue); return textField; } @Override protected void doLoad() { } @Override protected void doLoadDefault() { } @Override protected void doStore() { } @Override public int getNumberOfControls() { return 2; } }
{'content_hash': '47f12096324076c7d861f63078e73b5f', 'timestamp': '', 'source': 'github', 'line_count': 99, 'max_line_length': 89, 'avg_line_length': 26.747474747474747, 'alnum_prop': 0.6367069486404834, 'repo_name': 'droolsjbpm/droolsjbpm-tools', 'id': '4e64d38f283567974c524548c535eff43b67e859', 'size': '2648', 'binary': False, 'copies': '7', 'ref': 'refs/heads/master', 'path': 'drools-eclipse/org.kie.eclipse.navigator/src/main/java/org/kie/eclipse/navigator/preferences/ReadonlyStringFieldEditor.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '16322'}, {'name': 'Java', 'bytes': '3935583'}]}
<?php include("include/settings.php"); include("include/MailChimp.php"); if(isset($_GET['email'])){ $email = $_GET['email']; if($useMailChimp === "YES"){ $MailChimp = new MailChimp($APIKey); $result = $MailChimp->call('lists/subscribe', array( 'id' => $listID, 'email' => array( 'email' => $email ), 'merge_vars' => array(), 'double_optin' => false, 'update_existing' => true, 'replace_interests' => false )); if( $result === false ) { $status = 0; $message = "Ooops, there has been a technical error!"; } else if( isset($result->status) && $result->status == 'error' ) { // Error info: $result->status, $result->code, $result->name, $result->error $status = 0; $message = $result->error; } else{ $status = 1; $message = "You have been signed up!"; } } else{ $con = mysqli_connect($host, $username, $password, $database); // Check connection if (mysqli_connect_errno()) { $status = 0; // Failed to connect to MySQL $message = "Internal server error!" ; } else{ $existingSignup = mysqli_query($con, "SELECT * FROM signups WHERE signup_email_address='$email'"); if(mysqli_num_rows($existingSignup) < 1){ $timestamp = date('Y-m-d H:i:s'); $insertSignup = mysqli_query($con,"INSERT INTO signups (signup_email_address, signup_timestamp) VALUES ('$email','$timestamp')"); if($insertSignup) { $status = 1; $message = "You have been signed up!"; } else { $status = 0; $message = "Ooops, there has been a technical error!"; } } else { $status = 0; $message = "This email is already on list!"; } } mysqli_close($con); } $response = array( "status" => $status, "message" => $message ); echo json_encode($response); } ?>
{'content_hash': '43049795e1668dbed152c95f4dbdae45', 'timestamp': '', 'source': 'github', 'line_count': 76, 'max_line_length': 133, 'avg_line_length': 25.13157894736842, 'alnum_prop': 0.5486910994764398, 'repo_name': 'gianthat/lasttoshowfirsttogo', 'id': '7bfbb6c4184b5d2ddf01b4e83170d11315f37b6b', 'size': '1910', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'web/app/themes/lasttoshowfirsttogo/products-WB0460D1H/Site/Video/php/signupForm.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '7341'}, {'name': 'CSS', 'bytes': '463578'}, {'name': 'HTML', 'bytes': '43826'}, {'name': 'JavaScript', 'bytes': '677819'}, {'name': 'PHP', 'bytes': '103870'}, {'name': 'Ruby', 'bytes': '4007'}, {'name': 'Shell', 'bytes': '889'}]}
#include "SkFontHost.h" #include "SkDescriptor.h" #include "SkMMapStream.h" #include "SkOSFile.h" #include "SkPaint.h" #include "SkString.h" #include "SkStream.h" #include "SkThread.h" #include "SkTSearch.h" #include <stdio.h> #ifndef SK_FONT_FILE_PREFIX #define SK_FONT_FILE_PREFIX "/usr/share/fonts/truetype/msttcorefonts/" #endif bool find_name_and_attributes(SkStream* stream, SkString* name, SkTypeface::Style* style, bool* isFixedWidth); static void GetFullPathForSysFonts(SkString* full, const char name[]) { full->append(SK_FONT_FILE_PREFIX); full->append(name); } /////////////////////////////////////////////////////////////////////////////// struct FamilyRec; /* This guy holds a mapping of a name -> family, used for looking up fonts. Since it is stored in a stretchy array that doesn't preserve object semantics, we don't use constructor/destructors, but just have explicit helpers to manage our internal bookkeeping. */ struct NameFamilyPair { const char* fName; // we own this FamilyRec* fFamily; // we don't own this, we just reference it void construct(const char name[], FamilyRec* family) { fName = strdup(name); fFamily = family; // we don't own this, so just record the referene } void destruct() { free((char*)fName); // we don't own family, so just ignore our reference } }; // we use atomic_inc to grow this for each typeface we create static int32_t gUniqueFontID; // this is the mutex that protects these globals SK_DECLARE_STATIC_MUTEX(gFamilyMutex); static FamilyRec* gFamilyHead; static SkTDArray<NameFamilyPair> gNameList; struct FamilyRec { FamilyRec* fNext; SkTypeface* fFaces[4]; FamilyRec() { fNext = gFamilyHead; memset(fFaces, 0, sizeof(fFaces)); gFamilyHead = this; } }; static SkTypeface* find_best_face(const FamilyRec* family, SkTypeface::Style style) { SkTypeface* const* faces = family->fFaces; if (faces[style] != NULL) { // exact match return faces[style]; } // look for a matching bold style = (SkTypeface::Style)(style ^ SkTypeface::kItalic); if (faces[style] != NULL) { return faces[style]; } // look for the plain if (faces[SkTypeface::kNormal] != NULL) { return faces[SkTypeface::kNormal]; } // look for anything for (int i = 0; i < 4; i++) { if (faces[i] != NULL) { return faces[i]; } } // should never get here, since the faces list should not be empty SkDEBUGFAIL("faces list is empty"); return NULL; } static FamilyRec* find_family(const SkTypeface* member) { FamilyRec* curr = gFamilyHead; while (curr != NULL) { for (int i = 0; i < 4; i++) { if (curr->fFaces[i] == member) { return curr; } } curr = curr->fNext; } return NULL; } static SkTypeface* find_from_uniqueID(uint32_t uniqueID) { FamilyRec* curr = gFamilyHead; while (curr != NULL) { for (int i = 0; i < 4; i++) { SkTypeface* face = curr->fFaces[i]; if (face != NULL && face->uniqueID() == uniqueID) { return face; } } curr = curr->fNext; } return NULL; } static bool valid_uniqueID(uint32_t uniqueID) { return find_from_uniqueID(uniqueID) != NULL; } /* Remove reference to this face from its family. If the resulting family is empty (has no faces), return that family, otherwise return NULL */ static FamilyRec* remove_from_family(const SkTypeface* face) { FamilyRec* family = find_family(face); SkASSERT(family->fFaces[face->style()] == face); family->fFaces[face->style()] = NULL; for (int i = 0; i < 4; i++) { if (family->fFaces[i] != NULL) { // family is non-empty return NULL; } } return family; // return the empty family } // maybe we should make FamilyRec be doubly-linked static void detach_and_delete_family(FamilyRec* family) { FamilyRec* curr = gFamilyHead; FamilyRec* prev = NULL; while (curr != NULL) { FamilyRec* next = curr->fNext; if (curr == family) { if (prev == NULL) { gFamilyHead = next; } else { prev->fNext = next; } SkDELETE(family); return; } prev = curr; curr = next; } SkDEBUGFAIL("Yikes, couldn't find family in our list to remove/delete"); } static FamilyRec* find_familyrec(const char name[]) { const NameFamilyPair* list = gNameList.begin(); int index = SkStrLCSearch(&list[0].fName, gNameList.count(), name, sizeof(list[0])); return index >= 0 ? list[index].fFamily : NULL; } static SkTypeface* find_typeface(const char name[], SkTypeface::Style style) { FamilyRec* rec = find_familyrec(name); return rec ? find_best_face(rec, style) : NULL; } static SkTypeface* find_typeface(const SkTypeface* familyMember, SkTypeface::Style style) { const FamilyRec* family = find_family(familyMember); return family ? find_best_face(family, style) : NULL; } static void add_name(const char name[], FamilyRec* family) { SkAutoAsciiToLC tolc(name); name = tolc.lc(); NameFamilyPair* list = gNameList.begin(); int count = gNameList.count(); int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0])); if (index < 0) { list = gNameList.insert(~index); list->construct(name, family); } } static void remove_from_names(FamilyRec* emptyFamily) { #ifdef SK_DEBUG for (int i = 0; i < 4; i++) { SkASSERT(emptyFamily->fFaces[i] == NULL); } #endif SkTDArray<NameFamilyPair>& list = gNameList; // must go backwards when removing for (int i = list.count() - 1; i >= 0; --i) { NameFamilyPair* pair = &list[i]; if (pair->fFamily == emptyFamily) { pair->destruct(); list.remove(i); } } } /////////////////////////////////////////////////////////////////////////////// class FamilyTypeface : public SkTypeface { public: FamilyTypeface(Style style, bool sysFont, FamilyRec* family, bool isFixedWidth) : SkTypeface(style, sk_atomic_inc(&gUniqueFontID) + 1, isFixedWidth) { fIsSysFont = sysFont; SkAutoMutexAcquire ac(gFamilyMutex); if (NULL == family) { family = SkNEW(FamilyRec); } family->fFaces[style] = this; fFamilyRec = family; // just record it so we can return it if asked } virtual ~FamilyTypeface() { SkAutoMutexAcquire ac(gFamilyMutex); // remove us from our family. If the family is now empty, we return // that and then remove that family from the name list FamilyRec* family = remove_from_family(this); if (NULL != family) { remove_from_names(family); detach_and_delete_family(family); } } bool isSysFont() const { return fIsSysFont; } FamilyRec* getFamily() const { return fFamilyRec; } // openStream returns a SkStream that has been ref-ed virtual SkStream* openStream() = 0; virtual const char* getUniqueString() const = 0; private: FamilyRec* fFamilyRec; // we don't own this, just point to it bool fIsSysFont; typedef SkTypeface INHERITED; }; /////////////////////////////////////////////////////////////////////////////// /* This subclass is just a place holder for when we have no fonts available. It exists so that our globals (e.g. gFamilyHead) that expect *something* will not be null. */ class EmptyTypeface : public FamilyTypeface { public: EmptyTypeface() : INHERITED(SkTypeface::kNormal, true, NULL, false) {} // overrides virtual SkStream* openStream() { return NULL; } virtual const char* getUniqueString() const { return NULL; } private: typedef FamilyTypeface INHERITED; }; class StreamTypeface : public FamilyTypeface { public: StreamTypeface(Style style, bool sysFont, FamilyRec* family, SkStream* stream, bool isFixedWidth) : INHERITED(style, sysFont, family, isFixedWidth) { stream->ref(); fStream = stream; } virtual ~StreamTypeface() { fStream->unref(); } // overrides virtual SkStream* openStream() { // openStream returns a refed stream. fStream->ref(); return fStream; } virtual const char* getUniqueString() const { return NULL; } private: SkStream* fStream; typedef FamilyTypeface INHERITED; }; class FileTypeface : public FamilyTypeface { public: FileTypeface(Style style, bool sysFont, FamilyRec* family, const char path[], bool isFixedWidth) : INHERITED(style, sysFont, family, isFixedWidth) { fPath.set(path); } // overrides virtual SkStream* openStream() { SkStream* stream = SkNEW_ARGS(SkMMAPStream, (fPath.c_str())); // check for failure if (stream->getLength() <= 0) { SkDELETE(stream); // maybe MMAP isn't supported. try FILE stream = SkNEW_ARGS(SkFILEStream, (fPath.c_str())); if (stream->getLength() <= 0) { SkDELETE(stream); stream = NULL; } } return stream; } virtual const char* getUniqueString() const { const char* str = strrchr(fPath.c_str(), '/'); if (str) { str += 1; // skip the '/' } return str; } private: SkString fPath; typedef FamilyTypeface INHERITED; }; /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// static bool get_name_and_style(const char path[], SkString* name, SkTypeface::Style* style, bool* isFixedWidth) { SkMMAPStream stream(path); if (stream.getLength() > 0) { return find_name_and_attributes(&stream, name, style, isFixedWidth); } else { SkFILEStream stream(path); if (stream.getLength() > 0) { return find_name_and_attributes(&stream, name, style, isFixedWidth); } } SkDebugf("---- failed to open <%s> as a font\n", path); return false; } // these globals are assigned (once) by load_system_fonts() static SkTypeface* gFallBackTypeface; static FamilyRec* gDefaultFamily; static SkTypeface* gDefaultNormal; static void load_system_fonts() { // check if we've already be called if (NULL != gDefaultNormal) { // printf("---- default font %p\n", gDefaultNormal); return; } SkOSFile::Iter iter(SK_FONT_FILE_PREFIX, ".ttf"); SkString name; int count = 0; while (iter.next(&name, false)) { SkString filename; GetFullPathForSysFonts(&filename, name.c_str()); bool isFixedWidth; SkString realname; SkTypeface::Style style = SkTypeface::kNormal; // avoid uninitialized warning if (!get_name_and_style(filename.c_str(), &realname, &style, &isFixedWidth)) { SkDebugf("------ can't load <%s> as a font\n", filename.c_str()); continue; } // SkDebugf("font: <%s> %d <%s>\n", realname.c_str(), style, filename.c_str()); FamilyRec* family = find_familyrec(realname.c_str()); if (family && family->fFaces[style]) { // SkDebugf("---- skipping duplicate typeface %s style %d\n", // realname.c_str(), style); continue; } // this constructor puts us into the global gFamilyHead llist FamilyTypeface* tf = SkNEW_ARGS(FileTypeface, (style, true, // system-font (cannot delete) family, // what family to join filename.c_str(), isFixedWidth) // filename ); if (NULL == family) { add_name(realname.c_str(), tf->getFamily()); } count += 1; } if (0 == count) { SkNEW(EmptyTypeface); } // do this after all fonts are loaded. This is our default font, and it // acts as a sentinel so we only execute load_system_fonts() once static const char* gDefaultNames[] = { "Arial", "Verdana", "Times New Roman", NULL }; const char** names = gDefaultNames; while (*names) { SkTypeface* tf = find_typeface(*names++, SkTypeface::kNormal); if (tf) { gDefaultNormal = tf; break; } } // check if we found *something* if (NULL == gDefaultNormal) { if (NULL == gFamilyHead) { sk_throw(); } for (int i = 0; i < 4; i++) { if ((gDefaultNormal = gFamilyHead->fFaces[i]) != NULL) { break; } } } if (NULL == gDefaultNormal) { sk_throw(); } gFallBackTypeface = gDefaultNormal; gDefaultFamily = find_family(gDefaultNormal); // SkDebugf("---- default %p head %p family %p\n", gDefaultNormal, gFamilyHead, gDefaultFamily); } /////////////////////////////////////////////////////////////////////////////// void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) { #if 0 const char* name = ((FamilyTypeface*)face)->getUniqueString(); stream->write8((uint8_t)face->getStyle()); if (NULL == name || 0 == *name) { stream->writePackedUInt(0); // SkDebugf("--- fonthost serialize null\n"); } else { uint32_t len = strlen(name); stream->writePackedUInt(len); stream->write(name, len); // SkDebugf("--- fonthost serialize <%s> %d\n", name, face->getStyle()); } #endif sk_throw(); } SkTypeface* SkFontHost::Deserialize(SkStream* stream) { #if 0 load_system_fonts(); int style = stream->readU8(); int len = stream->readPackedUInt(); if (len > 0) { SkString str; str.resize(len); stream->read(str.writable_str(), len); const FontInitRec* rec = gSystemFonts; for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) { if (strcmp(rec[i].fFileName, str.c_str()) == 0) { // backup until we hit the fNames for (int j = i; j >= 0; --j) { if (rec[j].fNames != NULL) { return SkFontHost::CreateTypeface(NULL, rec[j].fNames[0], NULL, 0, (SkTypeface::Style)style); } } } } } return SkFontHost::CreateTypeface(NULL, NULL, NULL, 0, (SkTypeface::Style)style); #endif sk_throw(); return NULL; } /////////////////////////////////////////////////////////////////////////////// SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, const char familyName[], const void* data, size_t bytelength, SkTypeface::Style style) { load_system_fonts(); SkAutoMutexAcquire ac(gFamilyMutex); // clip to legal style bits style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic); SkTypeface* tf = NULL; if (NULL != familyFace) { tf = find_typeface(familyFace, style); } else if (NULL != familyName) { // SkDebugf("======= familyName <%s>\n", familyName); tf = find_typeface(familyName, style); } if (NULL == tf) { tf = find_best_face(gDefaultFamily, style); } SkSafeRef(tf); return tf; } SkStream* SkFontHost::OpenStream(uint32_t fontID) { FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID); SkStream* stream = tf ? tf->openStream() : NULL; if (stream && stream->getLength() == 0) { stream->unref(); stream = NULL; } return stream; } size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, int32_t* index) { SkDebugf("SkFontHost::GetFileName unimplemented\n"); return 0; } SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID) { return 0; } /////////////////////////////////////////////////////////////////////////////// SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { if (NULL == stream || stream->getLength() <= 0) { SkDELETE(stream); return NULL; } bool isFixedWidth; SkTypeface::Style style; if (find_name_and_attributes(stream, NULL, &style, &isFixedWidth)) { return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream, isFixedWidth)); } else { return NULL; } } SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) { SkTypeface* face = NULL; SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path)); if (stream->isValid()) { face = CreateTypefaceFromStream(stream); } stream->unref(); return face; }
{'content_hash': '13ee6bb245921e0d9c6858bcb1903672', 'timestamp': '', 'source': 'github', 'line_count': 589, 'max_line_length': 99, 'avg_line_length': 29.972835314091682, 'alnum_prop': 0.5508100147275405, 'repo_name': 'roalex/android_external_skia', 'id': 'be99576dcc7233da173854f945b2c4bad34c1e76', 'size': '17817', 'binary': False, 'copies': '28', 'ref': 'refs/heads/ics', 'path': 'src/ports/SkFontHost_linux.cpp', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Assembly', 'bytes': '48830'}, {'name': 'C', 'bytes': '900474'}, {'name': 'C++', 'bytes': '7554777'}, {'name': 'Java', 'bytes': '3416'}, {'name': 'Objective-C', 'bytes': '853'}, {'name': 'Python', 'bytes': '36205'}]}
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHAIN_PARAMS_H #define BITCOIN_CHAIN_PARAMS_H #include "bignum.h" #include "uint256.h" #include "util.h" #include <vector> using namespace std; #define MESSAGE_START_SIZE 4 typedef unsigned char MessageStartChars[MESSAGE_START_SIZE]; class CAddress; class CBlock; struct CDNSSeedData { string name, host; CDNSSeedData(const string &strName, const string &strHost) : name(strName), host(strHost) {} }; /** * CChainParams defines various tweakable parameters of a given instance of the * Bitcoin system. There are three: the main network on which people trade goods * and services, the public test network which gets reset from time to time and * a regression test mode which is intended for private networks only. It has * minimal difficulty to ensure that blocks can be found instantly. */ class CChainParams { public: enum Network { MAIN, TESTNET, REGTEST, MAX_NETWORK_TYPES }; enum Base58Type { PUBKEY_ADDRESS, SCRIPT_ADDRESS, SECRET_KEY, EXT_PUBLIC_KEY, EXT_SECRET_KEY, MAX_BASE58_TYPES }; const uint256& HashGenesisBlock() const { return hashGenesisBlock; } const MessageStartChars& MessageStart() const { return pchMessageStart; } const vector<unsigned char>& AlertKey() const { return vAlertPubKey; } int GetDefaultPort() const { return nDefaultPort; } const CBigNum& ProofOfWorkLimit() const { return bnProofOfWorkLimit; } const CBigNum& ProofOfStakeLimit() const { return bnProofOfStakeLimit; } int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; } virtual const CBlock& GenesisBlock() const = 0; virtual bool RequireRPCPassword() const { return true; } const string& DataDir() const { return strDataDir; } virtual Network NetworkID() const = 0; const vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; } const std::vector<unsigned char> &Base58Prefix(Base58Type type) const { return base58Prefixes[type]; } virtual const vector<CAddress>& FixedSeeds() const = 0; int RPCPort() const { return nRPCPort; } int64_t TargetSpacing() const { return nTargetSpacing; } int64_t TargetTimespan() const { return nTargetTimespan; } int LastPoWBlock() const { return nLastPoWBlock; } int StartPoSBlock() const { return nStartPoSBlock; } protected: CChainParams() {}; uint256 hashGenesisBlock; MessageStartChars pchMessageStart; // Raw pub key bytes for the broadcast alert signing key. vector<unsigned char> vAlertPubKey; int nDefaultPort; int nRPCPort; CBigNum bnProofOfWorkLimit; CBigNum bnProofOfStakeLimit; int nSubsidyHalvingInterval; string strDataDir; vector<CDNSSeedData> vSeeds; std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES]; int64_t nTargetSpacing; int64_t nTargetTimespan; int nLastPoWBlock; int nStartPoSBlock; }; /** * Return the currently selected parameters. This won't change after app startup * outside of the unit tests. */ const CChainParams &Params(); /** Sets the params returned by Params() to those for the given network. */ void SelectParams(CChainParams::Network network); /** * Looks for -regtest or -testnet and then calls SelectParams as appropriate. * Returns false if an invalid combination is given. */ bool SelectParamsFromCommandLine(); inline bool TestNet() { // Note: it's deliberate that this returns "false" for regression test mode. return Params().NetworkID() == CChainParams::TESTNET; } #endif
{'content_hash': '29fb86769d260caa44f67133d56c01bb', 'timestamp': '', 'source': 'github', 'line_count': 116, 'max_line_length': 106, 'avg_line_length': 32.80172413793103, 'alnum_prop': 0.7203679369250986, 'repo_name': 'kangaroobits/KangarooBits', 'id': '43b1c946b5f93aea31133630338ba0f797b19770', 'size': '3805', 'binary': False, 'copies': '7', 'ref': 'refs/heads/master', 'path': 'src/chainparams.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Assembly', 'bytes': '51312'}, {'name': 'C', 'bytes': '360995'}, {'name': 'C++', 'bytes': '3290667'}, {'name': 'CSS', 'bytes': '2254'}, {'name': 'HTML', 'bytes': '101242'}, {'name': 'Makefile', 'bytes': '20824'}, {'name': 'NSIS', 'bytes': '5914'}, {'name': 'Objective-C', 'bytes': '858'}, {'name': 'Objective-C++', 'bytes': '6899'}, {'name': 'Python', 'bytes': '54361'}, {'name': 'QMake', 'bytes': '14614'}, {'name': 'Shell', 'bytes': '16406'}]}
package org.onosproject.net.intent; import java.util.Objects; import static com.google.common.base.MoreObjects.toStringHelper; import static com.google.common.base.Preconditions.checkNotNull; /** * Abstraction of an intent-related operation, e.g. add, remove, replace. */ public final class IntentOperation { private final Type type; private final Intent intent; /** * Operation type. */ public enum Type { /** * Indicates that an intent should be added. */ SUBMIT, /** * Indicates that an intent should be removed. */ WITHDRAW, } /** * Creates an intent operation. * * @param type operation type * @param intent intent subject */ public IntentOperation(Type type, Intent intent) { this.type = checkNotNull(type); this.intent = intent; } /** * Returns the type of the operation. * * @return operation type */ public Type type() { return type; } /** * Returns the identifier of the intent to which this operation applies. * * @return intent identifier */ public IntentId intentId() { return intent.id(); } /** * Returns the key for this intent. * * @return key value */ public Key key() { return intent.key(); } /** * Returns the intent to which this operation applied. For remove, * this can be null. * * @return intent that is the subject of the operation; null for remove */ public Intent intent() { return intent; } @Override public int hashCode() { return Objects.hash(type, intent); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final IntentOperation other = (IntentOperation) obj; return Objects.equals(this.type, other.type) && Objects.equals(this.intent, other.intent); } @Override public String toString() { return toStringHelper(this) .add("type", type) .add("intent", intent) .toString(); } }
{'content_hash': 'c88c129f036c22ab332301e29da97309', 'timestamp': '', 'source': 'github', 'line_count': 107, 'max_line_length': 76, 'avg_line_length': 21.83177570093458, 'alnum_prop': 0.5582191780821918, 'repo_name': 'SmartInfrastructures/dreamer', 'id': 'ef16a694f19a6bde5769cc3e5fb0e817d83c6835', 'size': '2945', 'binary': False, 'copies': '3', 'ref': 'refs/heads/icona', 'path': 'core/api/src/main/java/org/onosproject/net/intent/IntentOperation.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '49724'}, {'name': 'HTML', 'bytes': '99297'}, {'name': 'Java', 'bytes': '6721862'}, {'name': 'JavaScript', 'bytes': '610426'}]}
/*global define*/ define([ './defaultValue', './defined', './DeveloperError', './freezeObject', './Math' ], function( defaultValue, defined, DeveloperError, freezeObject, CesiumMath) { "use strict"; /** * A 4D Cartesian point. * @alias Cartesian4 * @constructor * * @param {Number} [x=0.0] The X component. * @param {Number} [y=0.0] The Y component. * @param {Number} [z=0.0] The Z component. * @param {Number} [w=0.0] The W component. * * @see Cartesian2 * @see Cartesian3 * @see Packable */ var Cartesian4 = function(x, y, z, w) { /** * The X component. * @type {Number} * @default 0.0 */ this.x = defaultValue(x, 0.0); /** * The Y component. * @type {Number} * @default 0.0 */ this.y = defaultValue(y, 0.0); /** * The Z component. * @type {Number} * @default 0.0 */ this.z = defaultValue(z, 0.0); /** * The W component. * @type {Number} * @default 0.0 */ this.w = defaultValue(w, 0.0); }; /** * Creates a Cartesian4 instance from x, y, z and w coordinates. * * @param {Number} x The x coordinate. * @param {Number} y The y coordinate. * @param {Number} z The z coordinate. * @param {Number} w The w coordinate. * @param {Cartesian4} [result] The object onto which to store the result. * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided. */ Cartesian4.fromElements = function(x, y, z, w, result) { if (!defined(result)) { return new Cartesian4(x, y, z, w); } result.x = x; result.y = y; result.z = z; result.w = w; return result; }; /** * Creates a Cartesian4 instance from a {@link Color}. <code>red</code>, <code>green</code>, <code>blue</code>, * and <code>alpha</code> map to <code>x</code>, <code>y</code>, <code>z</code>, and <code>w</code>, respectively. * * @param {Color} color The source color. * @param {Cartesian4} [result] The object onto which to store the result. * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided. */ Cartesian4.fromColor = function(color, result) { //>>includeStart('debug', pragmas.debug); if (!defined(color)) { throw new DeveloperError('color is required'); } //>>includeEnd('debug'); if (!defined(result)) { return new Cartesian4(color.red, color.green, color.blue, color.alpha); } result.x = color.red; result.y = color.green; result.z = color.blue; result.w = color.alpha; return result; }; /** * Duplicates a Cartesian4 instance. * * @param {Cartesian4} cartesian The Cartesian to duplicate. * @param {Cartesian4} [result] The object onto which to store the result. * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided. (Returns undefined if cartesian is undefined) */ Cartesian4.clone = function(cartesian, result) { if (!defined(cartesian)) { return undefined; } if (!defined(result)) { return new Cartesian4(cartesian.x, cartesian.y, cartesian.z, cartesian.w); } result.x = cartesian.x; result.y = cartesian.y; result.z = cartesian.z; result.w = cartesian.w; return result; }; /** * The number of elements used to pack the object into an array. * @type {Number} */ Cartesian4.packedLength = 4; /** * Stores the provided instance into the provided array. * * @param {Cartesian4} value The value to pack. * @param {Number[]} array The array to pack into. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. */ Cartesian4.pack = function(value, array, startingIndex) { //>>includeStart('debug', pragmas.debug); if (!defined(value)) { throw new DeveloperError('value is required'); } if (!defined(array)) { throw new DeveloperError('array is required'); } //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); array[startingIndex++] = value.x; array[startingIndex++] = value.y; array[startingIndex++] = value.z; array[startingIndex] = value.w; }; /** * Retrieves an instance from a packed array. * * @param {Number[]} array The packed array. * @param {Number} [startingIndex=0] The starting index of the element to be unpacked. * @param {Cartesian4} [result] The object into which to store the result. * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided. */ Cartesian4.unpack = function(array, startingIndex, result) { //>>includeStart('debug', pragmas.debug); if (!defined(array)) { throw new DeveloperError('array is required'); } //>>includeEnd('debug'); startingIndex = defaultValue(startingIndex, 0); if (!defined(result)) { result = new Cartesian4(); } result.x = array[startingIndex++]; result.y = array[startingIndex++]; result.z = array[startingIndex++]; result.w = array[startingIndex]; return result; }; /** * Creates a Cartesian4 from four consecutive elements in an array. * @function * * @param {Number[]} array The array whose four consecutive elements correspond to the x, y, z, and w components, respectively. * @param {Number} [startingIndex=0] The offset into the array of the first element, which corresponds to the x component. * @param {Cartesian4} [result] The object onto which to store the result. * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided. * * @example * // Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0) * var v = [1.0, 2.0, 3.0, 4.0]; * var p = Cesium.Cartesian4.fromArray(v); * * // Create a Cartesian4 with (1.0, 2.0, 3.0, 4.0) using an offset into an array * var v2 = [0.0, 0.0, 1.0, 2.0, 3.0, 4.0]; * var p2 = Cesium.Cartesian4.fromArray(v2, 2); */ Cartesian4.fromArray = Cartesian4.unpack; /** * Computes the value of the maximum component for the supplied Cartesian. * * @param {Cartesian4} cartesian The cartesian to use. * @returns {Number} The value of the maximum component. */ Cartesian4.maximumComponent = function(cartesian) { //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } //>>includeEnd('debug'); return Math.max(cartesian.x, cartesian.y, cartesian.z, cartesian.w); }; /** * Computes the value of the minimum component for the supplied Cartesian. * * @param {Cartesian4} cartesian The cartesian to use. * @returns {Number} The value of the minimum component. */ Cartesian4.minimumComponent = function(cartesian) { //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } //>>includeEnd('debug'); return Math.min(cartesian.x, cartesian.y, cartesian.z, cartesian.w); }; /** * Compares two Cartesians and computes a Cartesian which contains the minimum components of the supplied Cartesians. * * @param {Cartesian4} first A cartesian to compare. * @param {Cartesian4} second A cartesian to compare. * @param {Cartesian4} result The object into which to store the result. * @returns {Cartesian4} A cartesian with the minimum components. */ Cartesian4.minimumByComponent = function(first, second, result) { //>>includeStart('debug', pragmas.debug); if (!defined(first)) { throw new DeveloperError('first is required.'); } if (!defined(second)) { throw new DeveloperError('second is required.'); } if (!defined(result)) { throw new DeveloperError('result is required.'); } //>>includeEnd('debug'); result.x = Math.min(first.x, second.x); result.y = Math.min(first.y, second.y); result.z = Math.min(first.z, second.z); result.w = Math.min(first.w, second.w); return result; }; /** * Compares two Cartesians and computes a Cartesian which contains the maximum components of the supplied Cartesians. * * @param {Cartesian4} first A cartesian to compare. * @param {Cartesian4} second A cartesian to compare. * @param {Cartesian4} result The object into which to store the result. * @returns {Cartesian4} A cartesian with the maximum components. */ Cartesian4.maximumByComponent = function(first, second, result) { //>>includeStart('debug', pragmas.debug); if (!defined(first)) { throw new DeveloperError('first is required.'); } if (!defined(second)) { throw new DeveloperError('second is required.'); } if (!defined(result)) { throw new DeveloperError('result is required.'); } //>>includeEnd('debug'); result.x = Math.max(first.x, second.x); result.y = Math.max(first.y, second.y); result.z = Math.max(first.z, second.z); result.w = Math.max(first.w, second.w); return result; }; /** * Computes the provided Cartesian's squared magnitude. * * @param {Cartesian4} cartesian The Cartesian instance whose squared magnitude is to be computed. * @returns {Number} The squared magnitude. */ Cartesian4.magnitudeSquared = function(cartesian) { //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } //>>includeEnd('debug'); return cartesian.x * cartesian.x + cartesian.y * cartesian.y + cartesian.z * cartesian.z + cartesian.w * cartesian.w; }; /** * Computes the Cartesian's magnitude (length). * * @param {Cartesian4} cartesian The Cartesian instance whose magnitude is to be computed. * @returns {Number} The magnitude. */ Cartesian4.magnitude = function(cartesian) { return Math.sqrt(Cartesian4.magnitudeSquared(cartesian)); }; var distanceScratch = new Cartesian4(); /** * Computes the 4-space distance between two points. * * @param {Cartesian4} left The first point to compute the distance from. * @param {Cartesian4} right The second point to compute the distance to. * @returns {Number} The distance between two points. * * @example * // Returns 1.0 * var d = Cesium.Cartesian4.distance( * new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0), * new Cesium.Cartesian4(2.0, 0.0, 0.0, 0.0)); */ Cartesian4.distance = function(left, right) { //>>includeStart('debug', pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } //>>includeEnd('debug'); Cartesian4.subtract(left, right, distanceScratch); return Cartesian4.magnitude(distanceScratch); }; /** * Computes the squared distance between two points. Comparing squared distances * using this function is more efficient than comparing distances using {@link Cartesian4#distance}. * * @param {Cartesian4} left The first point to compute the distance from. * @param {Cartesian4} right The second point to compute the distance to. * @returns {Number} The distance between two points. * * @example * // Returns 4.0, not 2.0 * var d = Cesium.Cartesian4.distance( * new Cesium.Cartesian4(1.0, 0.0, 0.0, 0.0), * new Cesium.Cartesian4(3.0, 0.0, 0.0, 0.0)); */ Cartesian4.distanceSquared = function(left, right) { //>>includeStart('debug', pragmas.debug); if (!defined(left) || !defined(right)) { throw new DeveloperError('left and right are required.'); } //>>includeEnd('debug'); Cartesian4.subtract(left, right, distanceScratch); return Cartesian4.magnitudeSquared(distanceScratch); }; /** * Computes the normalized form of the supplied Cartesian. * * @param {Cartesian4} cartesian The Cartesian to be normalized. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The modified result parameter. */ Cartesian4.normalize = function(cartesian, result) { //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (!defined(result)) { throw new DeveloperError('result is required'); } //>>includeEnd('debug'); var magnitude = Cartesian4.magnitude(cartesian); result.x = cartesian.x / magnitude; result.y = cartesian.y / magnitude; result.z = cartesian.z / magnitude; result.w = cartesian.w / magnitude; return result; }; /** * Computes the dot (scalar) product of two Cartesians. * * @param {Cartesian4} left The first Cartesian. * @param {Cartesian4} right The second Cartesian. * @returns {Number} The dot product. */ Cartesian4.dot = function(left, right) { //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } //>>includeEnd('debug'); return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w; }; /** * Computes the componentwise product of two Cartesians. * * @param {Cartesian4} left The first Cartesian. * @param {Cartesian4} right The second Cartesian. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The modified result parameter. */ Cartesian4.multiplyComponents = function(left, right, result) { //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } if (!defined(result)) { throw new DeveloperError('result is required'); } //>>includeEnd('debug'); result.x = left.x * right.x; result.y = left.y * right.y; result.z = left.z * right.z; result.w = left.w * right.w; return result; }; /** * Computes the componentwise sum of two Cartesians. * * @param {Cartesian4} left The first Cartesian. * @param {Cartesian4} right The second Cartesian. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The modified result parameter. */ Cartesian4.add = function(left, right, result) { //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } if (!defined(result)) { throw new DeveloperError('result is required'); } //>>includeEnd('debug'); result.x = left.x + right.x; result.y = left.y + right.y; result.z = left.z + right.z; result.w = left.w + right.w; return result; }; /** * Computes the componentwise difference of two Cartesians. * * @param {Cartesian4} left The first Cartesian. * @param {Cartesian4} right The second Cartesian. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The modified result parameter. */ Cartesian4.subtract = function(left, right, result) { //>>includeStart('debug', pragmas.debug); if (!defined(left)) { throw new DeveloperError('left is required'); } if (!defined(right)) { throw new DeveloperError('right is required'); } if (!defined(result)) { throw new DeveloperError('result is required'); } //>>includeEnd('debug'); result.x = left.x - right.x; result.y = left.y - right.y; result.z = left.z - right.z; result.w = left.w - right.w; return result; }; /** * Multiplies the provided Cartesian componentwise by the provided scalar. * * @param {Cartesian4} cartesian The Cartesian to be scaled. * @param {Number} scalar The scalar to multiply with. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The modified result parameter. */ Cartesian4.multiplyByScalar = function(cartesian, scalar, result) { //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } if (!defined(result)) { throw new DeveloperError('result is required'); } //>>includeEnd('debug'); result.x = cartesian.x * scalar; result.y = cartesian.y * scalar; result.z = cartesian.z * scalar; result.w = cartesian.w * scalar; return result; }; /** * Divides the provided Cartesian componentwise by the provided scalar. * * @param {Cartesian4} cartesian The Cartesian to be divided. * @param {Number} scalar The scalar to divide by. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The modified result parameter. */ Cartesian4.divideByScalar = function(cartesian, scalar, result) { //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (typeof scalar !== 'number') { throw new DeveloperError('scalar is required and must be a number.'); } if (!defined(result)) { throw new DeveloperError('result is required'); } //>>includeEnd('debug'); result.x = cartesian.x / scalar; result.y = cartesian.y / scalar; result.z = cartesian.z / scalar; result.w = cartesian.w / scalar; return result; }; /** * Negates the provided Cartesian. * * @param {Cartesian4} cartesian The Cartesian to be negated. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The modified result parameter. */ Cartesian4.negate = function(cartesian, result) { //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (!defined(result)) { throw new DeveloperError('result is required'); } //>>includeEnd('debug'); result.x = -cartesian.x; result.y = -cartesian.y; result.z = -cartesian.z; result.w = -cartesian.w; return result; }; /** * Computes the absolute value of the provided Cartesian. * * @param {Cartesian4} cartesian The Cartesian whose absolute value is to be computed. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The modified result parameter. */ Cartesian4.abs = function(cartesian, result) { //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required'); } if (!defined(result)) { throw new DeveloperError('result is required'); } //>>includeEnd('debug'); result.x = Math.abs(cartesian.x); result.y = Math.abs(cartesian.y); result.z = Math.abs(cartesian.z); result.w = Math.abs(cartesian.w); return result; }; var lerpScratch = new Cartesian4(); /** * Computes the linear interpolation or extrapolation at t using the provided cartesians. * * @param {Cartesian4} start The value corresponding to t at 0.0. * @param {Cartesian4}end The value corresponding to t at 1.0. * @param {Number} t The point along t at which to interpolate. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The modified result parameter. */ Cartesian4.lerp = function(start, end, t, result) { //>>includeStart('debug', pragmas.debug); if (!defined(start)) { throw new DeveloperError('start is required.'); } if (!defined(end)) { throw new DeveloperError('end is required.'); } if (typeof t !== 'number') { throw new DeveloperError('t is required and must be a number.'); } if (!defined(result)) { throw new DeveloperError('result is required.'); } //>>includeEnd('debug'); Cartesian4.multiplyByScalar(end, t, lerpScratch); result = Cartesian4.multiplyByScalar(start, 1.0 - t, result); return Cartesian4.add(lerpScratch, result, result); }; var mostOrthogonalAxisScratch = new Cartesian4(); /** * Returns the axis that is most orthogonal to the provided Cartesian. * * @param {Cartesian4} cartesian The Cartesian on which to find the most orthogonal axis. * @param {Cartesian4} result The object onto which to store the result. * @returns {Cartesian4} The most orthogonal axis. */ Cartesian4.mostOrthogonalAxis = function(cartesian, result) { //>>includeStart('debug', pragmas.debug); if (!defined(cartesian)) { throw new DeveloperError('cartesian is required.'); } if (!defined(result)) { throw new DeveloperError('result is required.'); } //>>includeEnd('debug'); var f = Cartesian4.normalize(cartesian, mostOrthogonalAxisScratch); Cartesian4.abs(f, f); if (f.x <= f.y) { if (f.x <= f.z) { if (f.x <= f.w) { result = Cartesian4.clone(Cartesian4.UNIT_X, result); } else { result = Cartesian4.clone(Cartesian4.UNIT_W, result); } } else if (f.z <= f.w) { result = Cartesian4.clone(Cartesian4.UNIT_Z, result); } else { result = Cartesian4.clone(Cartesian4.UNIT_W, result); } } else if (f.y <= f.z) { if (f.y <= f.w) { result = Cartesian4.clone(Cartesian4.UNIT_Y, result); } else { result = Cartesian4.clone(Cartesian4.UNIT_W, result); } } else if (f.z <= f.w) { result = Cartesian4.clone(Cartesian4.UNIT_Z, result); } else { result = Cartesian4.clone(Cartesian4.UNIT_W, result); } return result; }; /** * Compares the provided Cartesians componentwise and returns * <code>true</code> if they are equal, <code>false</code> otherwise. * * @param {Cartesian4} [left] The first Cartesian. * @param {Cartesian4} [right] The second Cartesian. * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise. */ Cartesian4.equals = function(left, right) { return (left === right) || ((defined(left)) && (defined(right)) && (left.x === right.x) && (left.y === right.y) && (left.z === right.z) && (left.w === right.w)); }; /** * Compares the provided Cartesians componentwise and returns * <code>true</code> if they pass an absolute or relative tolerance test, * <code>false</code> otherwise. * * @param {Cartesian4} [left] The first Cartesian. * @param {Cartesian4} [right] The second Cartesian. * @param {Number} relativeEpsilon The relative epsilon tolerance to use for equality testing. * @param {Number} [absoluteEpsilon=relativeEpsilon] The absolute epsilon tolerance to use for equality testing. * @returns {Boolean} <code>true</code> if left and right are within the provided epsilon, <code>false</code> otherwise. */ Cartesian4.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) { return (left === right) || (defined(left) && defined(right) && CesiumMath.equalsEpsilon(left.x, right.x, relativeEpsilon, absoluteEpsilon) && CesiumMath.equalsEpsilon(left.y, right.y, relativeEpsilon, absoluteEpsilon) && CesiumMath.equalsEpsilon(left.z, right.z, relativeEpsilon, absoluteEpsilon) && CesiumMath.equalsEpsilon(left.w, right.w, relativeEpsilon, absoluteEpsilon)); }; /** * An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 0.0). * * @type {Cartesian4} * @constant */ Cartesian4.ZERO = freezeObject(new Cartesian4(0.0, 0.0, 0.0, 0.0)); /** * An immutable Cartesian4 instance initialized to (1.0, 0.0, 0.0, 0.0). * * @type {Cartesian4} * @constant */ Cartesian4.UNIT_X = freezeObject(new Cartesian4(1.0, 0.0, 0.0, 0.0)); /** * An immutable Cartesian4 instance initialized to (0.0, 1.0, 0.0, 0.0). * * @type {Cartesian4} * @constant */ Cartesian4.UNIT_Y = freezeObject(new Cartesian4(0.0, 1.0, 0.0, 0.0)); /** * An immutable Cartesian4 instance initialized to (0.0, 0.0, 1.0, 0.0). * * @type {Cartesian4} * @constant */ Cartesian4.UNIT_Z = freezeObject(new Cartesian4(0.0, 0.0, 1.0, 0.0)); /** * An immutable Cartesian4 instance initialized to (0.0, 0.0, 0.0, 1.0). * * @type {Cartesian4} * @constant */ Cartesian4.UNIT_W = freezeObject(new Cartesian4(0.0, 0.0, 0.0, 1.0)); /** * Duplicates this Cartesian4 instance. * * @param {Cartesian4} [result] The object onto which to store the result. * @returns {Cartesian4} The modified result parameter or a new Cartesian4 instance if one was not provided. */ Cartesian4.prototype.clone = function(result) { return Cartesian4.clone(this, result); }; /** * Compares this Cartesian against the provided Cartesian componentwise and returns * <code>true</code> if they are equal, <code>false</code> otherwise. * * @param {Cartesian4} [right] The right hand side Cartesian. * @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise. */ Cartesian4.prototype.equals = function(right) { return Cartesian4.equals(this, right); }; /** * Compares this Cartesian against the provided Cartesian componentwise and returns * <code>true</code> if they are within the provided epsilon, * <code>false</code> otherwise. * * @param {Cartesian4} [right] The right hand side Cartesian. * @param {Number} epsilon The epsilon to use for equality testing. * @returns {Boolean} <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise. */ Cartesian4.prototype.equalsEpsilon = function(right, epsilon) { return Cartesian4.equalsEpsilon(this, right, epsilon); }; /** * Creates a string representing this Cartesian in the format '(x, y)'. * * @returns {String} A string representing the provided Cartesian in the format '(x, y)'. */ Cartesian4.prototype.toString = function() { return '(' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ')'; }; return Cartesian4; });
{'content_hash': '51a507838abb5e309c43a084e83da208', 'timestamp': '', 'source': 'github', 'line_count': 812, 'max_line_length': 158, 'avg_line_length': 35.69950738916256, 'alnum_prop': 0.5888643576652408, 'repo_name': 'linkitapps/linkit-cesium-app', 'id': '64056cb9235276213e45f5557669f68283f9b1e1', 'size': '28988', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'app/Cesium/Source/Core/Cartesian4.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '990969'}, {'name': 'Erlang', 'bytes': '2146'}, {'name': 'GLSL', 'bytes': '142361'}, {'name': 'HTML', 'bytes': '995507'}, {'name': 'JavaScript', 'bytes': '42360361'}, {'name': 'Shell', 'bytes': '291'}]}
// MESSAGE MOUNT_CONTROL PACKING #define MAVLINK_MSG_ID_MOUNT_CONTROL 157 typedef struct __mavlink_mount_control_t { int32_t input_a; ///< pitch(deg*100) or lat, depending on mount mode int32_t input_b; ///< roll(deg*100) or lon depending on mount mode int32_t input_c; ///< yaw(deg*100) or alt (in cm) depending on mount mode uint8_t target_system; ///< System ID uint8_t target_component; ///< Component ID uint8_t save_position; ///< if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) } mavlink_mount_control_t; #define MAVLINK_MSG_ID_MOUNT_CONTROL_LEN 15 #define MAVLINK_MSG_ID_157_LEN 15 #define MAVLINK_MSG_ID_MOUNT_CONTROL_CRC 21 #define MAVLINK_MSG_ID_157_CRC 21 #define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \ "MOUNT_CONTROL", \ 6, \ { { "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_mount_control_t, input_a) }, \ { "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_mount_control_t, input_b) }, \ { "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_mount_control_t, input_c) }, \ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_mount_control_t, target_system) }, \ { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_mount_control_t, target_component) }, \ { "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \ } \ } /** * @brief Pack a mount_control message * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * * @param target_system System ID * @param target_component Component ID * @param input_a pitch(deg*100) or lat, depending on mount mode * @param input_b roll(deg*100) or lon depending on mount mode * @param input_c yaw(deg*100) or alt (in cm) depending on mount mode * @param save_position if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_mount_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN]; _mav_put_int32_t(buf, 0, input_a); _mav_put_int32_t(buf, 4, input_b); _mav_put_int32_t(buf, 8, input_c); _mav_put_uint8_t(buf, 12, target_system); _mav_put_uint8_t(buf, 13, target_component); _mav_put_uint8_t(buf, 14, save_position); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #else mavlink_mount_control_t packet; packet.input_a = input_a; packet.input_b = input_b; packet.input_c = input_c; packet.target_system = target_system; packet.target_component = target_component; packet.save_position = save_position; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #endif msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL; #if MAVLINK_CRC_EXTRA return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); #else return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #endif } /** * @brief Pack a mount_control message on a channel * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param target_system System ID * @param target_component Component ID * @param input_a pitch(deg*100) or lat, depending on mount mode * @param input_b roll(deg*100) or lon depending on mount mode * @param input_c yaw(deg*100) or alt (in cm) depending on mount mode * @param save_position if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_mount_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t target_system,uint8_t target_component,int32_t input_a,int32_t input_b,int32_t input_c,uint8_t save_position) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN]; _mav_put_int32_t(buf, 0, input_a); _mav_put_int32_t(buf, 4, input_b); _mav_put_int32_t(buf, 8, input_c); _mav_put_uint8_t(buf, 12, target_system); _mav_put_uint8_t(buf, 13, target_component); _mav_put_uint8_t(buf, 14, save_position); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #else mavlink_mount_control_t packet; packet.input_a = input_a; packet.input_b = input_b; packet.input_c = input_c; packet.target_system = target_system; packet.target_component = target_component; packet.save_position = save_position; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #endif msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL; #if MAVLINK_CRC_EXTRA return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); #else return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #endif } /** * @brief Encode a mount_control struct * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * @param mount_control C-struct to read the message contents from */ static inline uint16_t mavlink_msg_mount_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control) { return mavlink_msg_mount_control_pack(system_id, component_id, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position); } /** * @brief Encode a mount_control struct on a channel * * @param system_id ID of this system * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message will be sent over * @param msg The MAVLink message to compress the data into * @param mount_control C-struct to read the message contents from */ static inline uint16_t mavlink_msg_mount_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control) { return mavlink_msg_mount_control_pack_chan(system_id, component_id, chan, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position); } /** * @brief Send a mount_control message * @param chan MAVLink channel to send the message * * @param target_system System ID * @param target_component Component ID * @param input_a pitch(deg*100) or lat, depending on mount mode * @param input_b roll(deg*100) or lon depending on mount mode * @param input_c yaw(deg*100) or alt (in cm) depending on mount mode * @param save_position if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS static inline void mavlink_msg_mount_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_MOUNT_CONTROL_LEN]; _mav_put_int32_t(buf, 0, input_a); _mav_put_int32_t(buf, 4, input_b); _mav_put_int32_t(buf, 8, input_c); _mav_put_uint8_t(buf, 12, target_system); _mav_put_uint8_t(buf, 13, target_component); _mav_put_uint8_t(buf, 14, save_position); #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #endif #else mavlink_mount_control_t packet; packet.input_a = input_a; packet.input_b = input_b; packet.input_c = input_c; packet.target_system = target_system; packet.target_component = target_component; packet.save_position = save_position; #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #endif #endif } #if MAVLINK_MSG_ID_MOUNT_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN /* This varient of _send() can be used to save stack space by re-using memory from the receive buffer. The caller provides a mavlink_message_t which is the size of a full mavlink message. This is usually the receive buffer for the channel, and allows a reply to an incoming message with minimum stack space usage. */ static inline void mavlink_msg_mount_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char *buf = (char *)msgbuf; _mav_put_int32_t(buf, 0, input_a); _mav_put_int32_t(buf, 4, input_b); _mav_put_int32_t(buf, 8, input_c); _mav_put_uint8_t(buf, 12, target_system); _mav_put_uint8_t(buf, 13, target_component); _mav_put_uint8_t(buf, 14, save_position); #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #endif #else mavlink_mount_control_t *packet = (mavlink_mount_control_t *)msgbuf; packet->input_a = input_a; packet->input_b = input_b; packet->input_c = input_c; packet->target_system = target_system; packet->target_component = target_component; packet->save_position = save_position; #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN, MAVLINK_MSG_ID_MOUNT_CONTROL_CRC); #else _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)packet, MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #endif #endif } #endif #endif // MESSAGE MOUNT_CONTROL UNPACKING /** * @brief Get field target_system from mount_control message * * @return System ID */ static inline uint8_t mavlink_msg_mount_control_get_target_system(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 12); } /** * @brief Get field target_component from mount_control message * * @return Component ID */ static inline uint8_t mavlink_msg_mount_control_get_target_component(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 13); } /** * @brief Get field input_a from mount_control message * * @return pitch(deg*100) or lat, depending on mount mode */ static inline int32_t mavlink_msg_mount_control_get_input_a(const mavlink_message_t* msg) { return _MAV_RETURN_int32_t(msg, 0); } /** * @brief Get field input_b from mount_control message * * @return roll(deg*100) or lon depending on mount mode */ static inline int32_t mavlink_msg_mount_control_get_input_b(const mavlink_message_t* msg) { return _MAV_RETURN_int32_t(msg, 4); } /** * @brief Get field input_c from mount_control message * * @return yaw(deg*100) or alt (in cm) depending on mount mode */ static inline int32_t mavlink_msg_mount_control_get_input_c(const mavlink_message_t* msg) { return _MAV_RETURN_int32_t(msg, 8); } /** * @brief Get field save_position from mount_control message * * @return if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) */ static inline uint8_t mavlink_msg_mount_control_get_save_position(const mavlink_message_t* msg) { return _MAV_RETURN_uint8_t(msg, 14); } /** * @brief Decode a mount_control message into a struct * * @param msg The message to decode * @param mount_control C-struct to decode the message contents into */ static inline void mavlink_msg_mount_control_decode(const mavlink_message_t* msg, mavlink_mount_control_t* mount_control) { #if MAVLINK_NEED_BYTE_SWAP mount_control->input_a = mavlink_msg_mount_control_get_input_a(msg); mount_control->input_b = mavlink_msg_mount_control_get_input_b(msg); mount_control->input_c = mavlink_msg_mount_control_get_input_c(msg); mount_control->target_system = mavlink_msg_mount_control_get_target_system(msg); mount_control->target_component = mavlink_msg_mount_control_get_target_component(msg); mount_control->save_position = mavlink_msg_mount_control_get_save_position(msg); #else memcpy(mount_control, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_MOUNT_CONTROL_LEN); #endif }
{'content_hash': '96e1ded5659d254b6bf96f48e1e7c58c', 'timestamp': '', 'source': 'github', 'line_count': 329, 'max_line_length': 245, 'avg_line_length': 40.79939209726444, 'alnum_prop': 0.7238322282649184, 'repo_name': 'jyhuh/cnuhawk', 'id': '72d6e241975cafaaa627875ac45964740dea93d0', 'size': '13423', 'binary': False, 'copies': '157', 'ref': 'refs/heads/master', 'path': 'libraries/GCS_MAVLink/include/mavlink/v1.0/ardupilotmega/mavlink_msg_mount_control.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '2910948'}, {'name': 'C#', 'bytes': '9917'}, {'name': 'C++', 'bytes': '5729472'}, {'name': 'CSS', 'bytes': '4289'}, {'name': 'Matlab', 'bytes': '4021'}, {'name': 'Objective-C', 'bytes': '64971'}, {'name': 'Perl', 'bytes': '13878'}, {'name': 'Processing', 'bytes': '681763'}, {'name': 'Python', 'bytes': '307074'}, {'name': 'Shell', 'bytes': '50998'}]}
<?php namespace Zephir; use Zephir\Detectors\ReadDetector; /** * MethodCall * * Call methods in a non-static context */ class MethodCall extends Call { /** * Function is called using a normal method name */ const CALL_NORMAL = 1; /** * Function is called using a dynamic variable as method name */ const CALL_DYNAMIC = 2; /** * Function is called using a dynamic string as method name */ const CALL_DYNAMIC_STRING = 3; /** * Examine internal class information and returns the method called * * @param CompilationContext $compilationContext * @param Variable $caller * @param string $methodName * @return array */ private function getRealCalledMethod(CompilationContext $compilationContext, Variable $caller, $methodName) { $compiler = $compilationContext->compiler; $numberPoly = 0; $method = null; if ($caller->getRealName() == 'this') { $classDefinition = $compilationContext->classDefinition; if ($classDefinition->hasMethod($methodName)) { $numberPoly++; $method = $classDefinition->getMethod($methodName); } } else { $classTypes = $caller->getClassTypes(); foreach ($classTypes as $classType) { if ($compiler->isClass($classType) || $compiler->isInterface($classType) || $compiler->isBundledClass($classType) || $compiler->isBundledInterface($classType)) { if ($compiler->isInterface($classType)) { continue; } if ($compiler->isClass($classType)) { $classDefinition = $compiler->getClassDefinition($classType); } else { $classDefinition = $compiler->getInternalClassDefinition($classType); } if (!$classDefinition) { continue; } if ($classDefinition->hasMethod($methodName) && !$classDefinition->isInterface()) { $numberPoly++; $method = $classDefinition->getMethod($methodName); } } } } return array($numberPoly, $method); } /** * Compiles a method call * * @param Expression $expr * @param CompilationContext $compilationContext */ public function compile(Expression $expr, CompilationContext $compilationContext) { $expression = $expr->getExpression(); $exprVariable = new Expression($expression['variable']); $exprVariable->setReadOnly(true); $exprCompiledVariable = $exprVariable->compile($compilationContext); $builtInType = false; switch ($exprCompiledVariable->getType()) { case 'variable': $variableVariable = $compilationContext->symbolTable->getVariableForRead($exprCompiledVariable->getCode(), $compilationContext, $expression); switch ($variableVariable->getType()) { case 'variable': $caller = $variableVariable; break; default: /* Check if there is a built-in type optimizer available */ $builtInTypeClass = 'Zephir\Types\\' . ucfirst($variableVariable->getType()) . 'Type'; if (class_exists($builtInTypeClass)) { /** * @var $builtInType \Zephir\Types\AbstractType */ $builtInType = new $builtInTypeClass; $caller = $exprCompiledVariable; } else { throw new CompilerException("Methods cannot be called on variable type: " . $variableVariable->getType(), $expression); } } break; default: /* Check if there is a built-in type optimizer available */ $builtInTypeClass = 'Zephir\Types\\' . ucfirst($exprCompiledVariable->getType()) . 'Type'; if (class_exists($builtInTypeClass)) { $builtInType = new $builtInTypeClass; $caller = $exprCompiledVariable; } else { throw new CompilerException("Cannot use expression: " . $exprCompiledVariable->getType() . " as method caller", $expression['variable']); } } $codePrinter = $compilationContext->codePrinter; $type = $expression['call-type']; /** * In normal method calls and dynamic string method calls we just use the name given by the user */ if ($type == self::CALL_NORMAL || $type == self::CALL_DYNAMIC_STRING) { $methodName = strtolower($expression['name']); } else { $variableMethod = $compilationContext->symbolTable->getVariableForRead($expression['name'], $compilationContext, $expression); if (is_object($builtInType)) { throw new CompilerException("Dynamic method invocation for type: " . $variableMethod->getType() . " is not supported", $expression); } if ($variableMethod->isNotVariableAndString()) { throw new CompilerException("Cannot use variable type: " . $variableMethod->getType() . " as dynamic method name", $expression); } } $symbolVariable = null; /** * Create temporary variable if needed */ $mustInit = false; $isExpecting = $expr->isExpectingReturn(); if ($isExpecting) { $symbolVariable = $expr->getExpectingVariable(); if (is_object($symbolVariable)) { $readDetector = new ReadDetector($expression); if ($caller == $symbolVariable || $readDetector->detect($symbolVariable->getName(), $expression)) { $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); } else { $mustInit = true; } } else { $symbolVariable = $compilationContext->symbolTable->getTempVariableForObserveOrNullify('variable', $compilationContext, $expression); } } /** * Method calls only return zvals so we need to validate the target variable is also a zval */ if (!$builtInType) { if ($isExpecting) { if (!$symbolVariable->isVariable()) { throw new CompilerException("Returned values by functions can only be assigned to variant variables", $expression); } /** * At this point, we don't know the exact dynamic type returned by the method call */ $symbolVariable->setDynamicTypes('undefined'); } } else { return $builtInType->invokeMethod($methodName, $caller, $compilationContext, $this, $expression); } $check = true; if (isset($expression['check'])) { $check = $expression['check']; } /** * Try to check if the method exist in the callee, only when method call is self::CALL_NORMAL */ if ($type == self::CALL_NORMAL) { if ($variableVariable->getRealName() == 'this') { $classDefinition = $compilationContext->classDefinition; if (!$classDefinition->hasMethod($methodName)) { if ($check) { $found = false; $interfaces = $classDefinition->isAbstract() ? $classDefinition->getImplementedInterfaces() : null; if (is_array($interfaces)) { $compiler = $compilationContext->compiler; foreach ($interfaces as $interface) { $classInterfaceDefinition = $compiler->getClassDefinition($interface); if ($classInterfaceDefinition->hasMethod($methodName)) { $found = true; $classMethod = $classInterfaceDefinition->getMethod($methodName); break; } } } if (!$found) { $possibleMethod = $classDefinition->getPossibleMethodName($expression['name']); if ($possibleMethod && $expression['name'] != $possibleMethod) { throw new CompilerException("Class '" . $classDefinition->getCompleteName() . "' does not implement method: '" . $expression['name'] . "'. Did you mean '" . $possibleMethod . "'?", $expression); } else { throw new CompilerException("Class '" . $classDefinition->getCompleteName() . "' does not implement method: '" . $expression['name'] . "'", $expression); } } } } else { if ($check) { $classMethod = $classDefinition->getMethod($methodName); } } if ($check) { /** * Private methods must be called in their declaration scope */ if ($classMethod->isPrivate()) { if ($classMethod->getClassDefinition() != $classDefinition) { throw new CompilerException("Cannot call private method '" . $expression['name'] . "' out of its scope", $expression); } } /** * Try to produce an exception if method is called with a wrong number of parameters */ if (isset($expression['parameters'])) { $callNumberParameters = count($expression['parameters']); } else { $callNumberParameters = 0; } $expectedNumberParameters = $classMethod->getNumberOfRequiredParameters(); if (!$expectedNumberParameters && $callNumberParameters > 0) { $numberParameters = $classMethod->getNumberOfParameters(); if ($callNumberParameters > $numberParameters) { throw new CompilerException("Method '" . $classDefinition->getCompleteName() . "::" . $expression['name'] . "' called with a wrong number of parameters, the method has: " . $expectedNumberParameters . ", passed: " . $callNumberParameters, $expression); } } if ($callNumberParameters < $expectedNumberParameters) { throw new CompilerException("Method '" . $classDefinition->getCompleteName() . "::" . $expression['name'] . "' called with a wrong number of parameters, the method has: " . $expectedNumberParameters . ", passed: " . $callNumberParameters, $expression); } $method = $classMethod; } } else { /** * Variables whose dynamic type is 'object' can be used * to determine method existence in compile time */ if ($check && $variableVariable->hasAnyDynamicType('object')) { $classTypes = $variableVariable->getClassTypes(); if (count($classTypes)) { $numberImplemented = 0; $compiler = $compilationContext->compiler; foreach ($classTypes as $classType) { if ($compiler->isClass($classType) || $compiler->isInterface($classType) || $compiler->isBundledClass($classType) || $compiler->isBundledInterface($classType)) { if ($compiler->isClass($classType) || $compiler->isInterface($classType)) { $classDefinition = $compiler->getClassDefinition($classType); } else { $classDefinition = $compiler->getInternalClassDefinition($classType); } if (!$classDefinition) { throw new CompilerException("Cannot locate class definition for class " . $classType, $expression); } if (!$classDefinition->hasMethod($methodName)) { if (!$classDefinition->isInterface()) { if (count($classTypes) == 1) { throw new CompilerException("Class '" . $classType . "' does not implement method: '" . $expression['name'] . "'", $expression); } } continue; } $method = $classDefinition->getMethod($methodName); /** * Private methods must be called in their declaration scope */ if ($method->isPrivate()) { if ($method->getClassDefinition() != $classDefinition) { throw new CompilerException("Cannot call private method '" . $expression['name'] . "' out of its scope", $expression); } } /** * Check visibility for protected methods */ if ($method->isProtected() && $method->getClassDefinition() != $classDefinition && $method->getClassDefinition() != $classDefinition->getExtendsClass()) { throw new CompilerException("Cannot call protected method '" . $expression['name'] . "' out of its scope", $expression); } /** * Try to produce an exception if a method is called with a wrong number of parameters * We only check extension parameters if methods are extension methods * Internal methods may have invalid Reflection information */ if ($method instanceof ClassMethod && !$method->isBundled()) { if (isset($expression['parameters'])) { $callNumberParameters = count($expression['parameters']); } else { $callNumberParameters = 0; } $classMethod = $classDefinition->getMethod($methodName); $expectedNumberParameters = $classMethod->getNumberOfRequiredParameters(); if (!$expectedNumberParameters && $callNumberParameters > 0) { $numberParameters = $classMethod->getNumberOfParameters(); if ($callNumberParameters > $numberParameters) { $className = $classDefinition->getCompleteName(); throw new CompilerException("Method '" . $className . "::" . $expression['name'] . "' called with a wrong number of parameters, the method has: " . $expectedNumberParameters . ", passed: " . $callNumberParameters, $expression); } } if ($callNumberParameters < $expectedNumberParameters) { throw new CompilerException("Method '" . $classDefinition->getCompleteName() . "::" . $expression['name'] . "' called with a wrong number of parameters, the method has: " . $expectedNumberParameters . ", passed: " . $callNumberParameters, $expression); } } /** * The method is checked in the first class that implements the method * We could probably have collisions here */ $numberImplemented++; break; } else { $numberImplemented++; $compilationContext->logger->warning("Class \"" . $classType . "\" does not exist at compile time", "nonexistent-class", $expression); } } if ($numberImplemented == 0) { if (!$classDefinition->isInterface()) { if (count($classTypes) > 1) { throw new CompilerException("None of classes: '" . join(' or ', $classTypes) . "' implement method: '" . $expression['name'] . "'", $expression); } else { throw new CompilerException("Class '" . $classTypes[0] . "' does not implement method: '" . $expression['name'] . "'", $expression); } } else { // @TODO, raise an exception here? } } } } } } if (isset($method)) { $this->_reflection = $method; } /** * Transfer the return type-hint to the returned variable */ if ($isExpecting) { if (isset($method)) { if ($method instanceof ClassMethod) { if ($method->isVoid()) { throw new CompilerException("Method '" . $classDefinition->getCompleteName() . "::" . $expression['name'] . "' is marked as 'void' and it does not return anything", $expression); } $returnClassTypes = $method->getReturnClassTypes(); if ($returnClassTypes !== null) { $symbolVariable->setDynamicTypes('object'); foreach ($returnClassTypes as &$returnClassType) { $returnClassType = $compilationContext->getFullName($returnClassType); } $symbolVariable->setClassTypes($returnClassTypes); } $returnTypes = $method->getReturnTypes(); if ($returnTypes !== null) { foreach ($returnTypes as $dataType => $returnType) { $symbolVariable->setDynamicTypes($dataType); } } } } } /** * Some parameters in internal methods receive parameters as references */ if (isset($expression['parameters'])) { $references = array(); if ($type == self::CALL_NORMAL || $type == self::CALL_DYNAMIC_STRING) { if (isset($method)) { if ($method instanceof \ReflectionMethod) { $position = 0; foreach ($method->getParameters() as $parameter) { if ($parameter->isPassedByReference()) { $references[$position] = true; } $position++; } } } } } /** * Include fcall header */ $compilationContext->headersManager->add('kernel/fcall'); /** * Call methods must grown the stack */ $compilationContext->symbolTable->mustGrownStack(true); /** * Mark references */ if (isset($expression['parameters'])) { $params = $this->getResolvedParams($expression['parameters'], $compilationContext, $expression, isset($method) ? $method : null); if (count($references)) { foreach ($params as $position => $param) { if (isset($references[$position])) { $compilationContext->codePrinter->output('Z_SET_ISREF_P(' . $param . ');'); } } } // We check here if a correct parameter type is passed to the called method if ($type == self::CALL_NORMAL) { if (isset($method) && $method instanceof ClassMethod && isset($expression['parameters'])) { $resolvedTypes = $this->getResolvedTypes(); $resolvedDynamicTypes = $this->getResolvedDynamicTypes(); //$typeInference = $method->getStaticTypeInferencePass(); foreach ($method->getParameters() as $n => $parameter) { if (isset($parameter['data-type'])) { if (!isset($resolvedTypes[$n])) { continue; } /** * If the passed parameter is different to the expected type we show a warning */ if ($resolvedTypes[$n] != $parameter['data-type']) { switch ($resolvedTypes[$n]) { case 'bool': case 'boolean': switch ($parameter['data-type']) { /* compatible types */ case 'bool': case 'boolean': case 'variable': break; default: $compilationContext->logger->warning("Passing possible incorrect type for parameter: " . $classDefinition->getCompleteName() . '::' . $method->getName() . '(' . $parameter['name'] . '), passing: ' . $resolvedDynamicTypes[$n] . ', ' . "expecting: " . $parameter['data-type'], "possible-wrong-parameter", $expression); break; } break; case 'array': switch ($parameter['data-type']) { /* compatible types */ case 'array': case 'variable': break; case 'callable': /** * Array can be a callable type, example: [$this, "method"] * * @todo we need to check this array if can... */ break; default: $compilationContext->logger->warning("Passing possible incorrect type for parameter: " . $classDefinition->getCompleteName() . '::' . $method->getName() . '(' . $parameter['name'] . '), passing: ' . $resolvedDynamicTypes[$n] . ', ' . "expecting: " . $parameter['data-type'], "possible-wrong-parameter", $expression); break; } break; case 'callable': switch ($parameter['data-type']) { /* compatible types */ case 'callable': case 'variable': break; default: $compilationContext->logger->warning("Passing possible incorrect type for parameter: " . $classDefinition->getCompleteName() . '::' . $method->getName() . '(' . $parameter['name'] . '), passing: ' . $resolvedDynamicTypes[$n] . ', ' . "expecting: " . $parameter['data-type'], "possible-wrong-parameter", $expression); break; } break; case 'string': switch ($parameter['data-type']) { /* compatible types */ case 'string': case 'variable': break; default: $compilationContext->logger->warning("Passing possible incorrect type for parameter: " . $classDefinition->getCompleteName() . '::' . $method->getName() . '(' . $parameter['name'] . '), passing: ' . $resolvedDynamicTypes[$n] . ', ' . "expecting: " . $parameter['data-type'], "possible-wrong-parameter", $expression); break; } break; /** * Passing polymorphic variables to static typed parameters * could lead to potential unexpected type coercions */ case 'variable': if ($resolvedDynamicTypes[$n] != $parameter['data-type']) { if ($resolvedDynamicTypes[$n] == 'undefined') { $compilationContext->logger->warning("Passing possible incorrect type to parameter: " . $classDefinition->getCompleteName() . '::' . $parameter[$n]['name'] . ', passing: ' . $resolvedDynamicTypes[$n] . ', ' . "expecting: " . $parameter[$n]['data-type'], "possible-wrong-parameter-undefined", $expression); } //echo '1: ', $resolvedTypes[$n], ' ', $resolvedDynamicTypes[$n], ' ', $parameter[0]['data-type'], ' ', PHP_EOL; } break; } } } } } } } else { $params = array(); } // Add the last call status to the current symbol table $this->addCallStatusFlag($compilationContext); // Initialize non-temporary variables if ($mustInit) { $symbolVariable->setMustInitNull(true); $symbolVariable->trackVariant($compilationContext); } // Generate the code according to the call type if ($type == self::CALL_NORMAL || $type == self::CALL_DYNAMIC_STRING) { $realMethod = $this->getRealCalledMethod($compilationContext, $variableVariable, $methodName); $isInternal = false; if (is_object($realMethod[1])) { $realMethod[1] = $realMethod[1]->getOptimizedMethod(); $method = $realMethod[1]; $isInternal = $realMethod[1]->isInternal(); if ($isInternal && $realMethod[0] > 1) { throw new CompilerException("Cannot resolve method: '" . $expression['name'] . "' in polymorphic variable", $expression); } } if (!$isInternal) { // Check if the method call can have an inline cache $methodCache = $compilationContext->cacheManager->getMethodCache(); $cachePointer = $methodCache->get( $compilationContext, $methodName, $variableVariable ); $compilationContext->backend->callMethod($isExpecting ? $symbolVariable : null, $variableVariable, $methodName, $cachePointer, count($params) ? $params : null, $compilationContext); } else { //TODO: also move to backend if ($isExpecting) { $symbolCode = $compilationContext->backend->getVariableCodePointer($symbolVariable); } $variableCode = $compilationContext->backend->getVariableCode($variableVariable); $paramCount = count($params); $paramsStr = $paramCount ? ', ' . join(', ', $params) : ''; if ($isExpecting) { if ($symbolVariable->getName() == 'return_value') { $macro = $compilationContext->backend->getFcallManager()->getMacro(false, true, $paramCount); $codePrinter->output($macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');'); } else { $macro = $compilationContext->backend->getFcallManager()->getMacro(false, 2, $paramCount); $codePrinter->output($macro . '(' . $symbolCode . ', ' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');'); } } else { $macro = $compilationContext->backend->getFcallManager()->getMacro(false, false, $paramCount); $codePrinter->output($macro . '(' . $variableCode . ', ' . $method->getInternalName() . $paramsStr . ');'); } } } else { if ($type == self::CALL_DYNAMIC) { switch ($variableMethod->getType()) { case 'string': case 'variable': break; default: throw new Exception('Cannot use variable type: ' . $variableMethod->getType() . ' as method caller'); } $cachePointer = 'NULL, 0'; $compilationContext->backend->callMethod($isExpecting ? $symbolVariable : null, $variableVariable, $variableMethod, $cachePointer, count($params) ? $params : null, $compilationContext); } } // Temporary variables must be copied if they have more than one reference foreach ($this->getMustCheckForCopyVariables() as $checkVariable) { $codePrinter->output('zephir_check_temp_parameter(' . $checkVariable . ');'); } // We can mark temporary variables generated as idle foreach ($this->getTemporalVariables() as $tempVariable) { $tempVariable->setIdle(true); } // Release parameters marked as references if (isset($expression['parameters'])) { if (count($references)) { foreach ($params as $position => $param) { if (isset($references[$position])) { $compilationContext->codePrinter->output('Z_UNSET_ISREF_P(' . $param . ');'); } } } } $this->addCallStatusOrJump($compilationContext); if ($isExpecting) { return new CompiledExpression('variable', $symbolVariable->getRealName(), $expression); } return new CompiledExpression('null', null, $expression); } }
{'content_hash': '4250c9c3081915e48866b4afffe8f750', 'timestamp': '', 'source': 'github', 'line_count': 649, 'max_line_length': 364, 'avg_line_length': 50.81201848998459, 'alnum_prop': 0.45304302999059953, 'repo_name': 'cesarmarinhorj/zephir', 'id': '853d34e39c40b665fb63d0d905ebdd347fd24710', 'size': '34074', 'binary': False, 'copies': '8', 'ref': 'refs/heads/master', 'path': 'Library/MethodCall.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '374'}, {'name': 'C', 'bytes': '2384731'}, {'name': 'C++', 'bytes': '4419'}, {'name': 'CSS', 'bytes': '6203'}, {'name': 'HTML', 'bytes': '14363'}, {'name': 'JavaScript', 'bytes': '4528'}, {'name': 'PHP', 'bytes': '2223037'}, {'name': 'Shell', 'bytes': '5121'}, {'name': 'Zephir', 'bytes': '194864'}]}
This topic demonstrates how to create a structural directive and provides conceptual information on how directives work, how Angular interprets shorthand, and how to add template guard properties to catch template type errors. <div class="alert is-helpful"> For the example application that this page describes, see the <live-example></live-example>. </div> For more information on Angular's built-in structural directives, such as `NgIf`, `NgForOf`, and `NgSwitch`, see [Built-in directives](guide/built-in-directives). {@a unless} ## Creating a structural directive This section guides you through creating an `UnlessDirective` and how to set `condition` values. The `UnlessDirective` does the opposite of `NgIf`, and `condition` values can be set to `true` or `false`. `NgIf` displays the template content when the condition is `true`. `UnlessDirective` displays the content when the condition is `false`. Following is the `UnlessDirective` selector, `appUnless`, applied to the paragraph element. When `condition` is `false`, the browser displays the sentence. <code-example path="structural-directives/src/app/app.component.html" header="src/app/app.component.html (appUnless-1)" region="appUnless-1"></code-example> 1. Using the Angular CLI, run the following command, where `unless` is the name of the directive: ```bash ng generate directive unless ``` Angular creates the directive class and specifies the CSS selector, `appUnless`, that identifies the directive in a template. 1. Import `Input`, `TemplateRef`, and `ViewContainerRef`. <code-example path="structural-directives/src/app/unless.directive.ts" header="src/app/unless.directive.ts (skeleton)" region="skeleton"></code-example> 1. Inject `TemplateRef` and `ViewContainerRef` in the directive constructor as private variables. <code-example path="structural-directives/src/app/unless.directive.ts" header="src/app/unless.directive.ts (ctor)" region="ctor"></code-example> The `UnlessDirective` creates an [embedded view](api/core/EmbeddedViewRef "API: EmbeddedViewRef") from the Angular-generated `<ng-template>` and inserts that view in a [view container](api/core/ViewContainerRef "API: ViewContainerRef") adjacent to the directive's original `<p>` host element. [`TemplateRef`](api/core/TemplateRef "API: TemplateRef") helps you get to the `<ng-template>` contents and [`ViewContainerRef`](api/core/ViewContainerRef "API: ViewContainerRef") accesses the view container. 1. Add an `appUnless` `@Input()` property with a setter. <code-example path="structural-directives/src/app/unless.directive.ts" header="src/app/unless.directive.ts (set)" region="set"></code-example> Angular sets the `appUnless` property whenever the value of the condition changes. * If the condition is falsy and Angular hasn't created the view previously, the setter causes the view container to create the embedded view from the template. * If the condition is truthy and the view is currently displayed, the setter clears the container, which disposes of the view. The complete directive is as follows: <code-example path="structural-directives/src/app/unless.directive.ts" header="src/app/unless.directive.ts (excerpt)" region="no-docs"></code-example> ### Testing the directive In this section, you'll update your application to test the `UnlessDirective`. 1. Add a `condition` set to `false` in the `AppComponent`. <code-example path="structural-directives/src/app/app.component.ts" header="src/app/app.component.ts (excerpt)" region="condition"></code-example> 1. Update the template to use the directive. Here, `*appUnless` is on two `<p>` tags with opposite `condition` values, one `true` and one `false`. <code-example path="structural-directives/src/app/app.component.html" header="src/app/app.component.html (appUnless)" region="appUnless"></code-example> The asterisk is shorthand that marks `appUnless` as a structural directive. When the `condition` is falsy, the top (A) paragraph appears and the bottom (B) paragraph disappears. When the `condition` is truthy, the top (A) paragraph disappears and the bottom (B) paragraph appears. 1. To change and display the value of `condition` in the browser, add markup that displays the status and a button. <code-example path="structural-directives/src/app/app.component.html" header="src/app/app.component.html" region="toggle-info"></code-example> To verify that the directive works, click the button to change the value of `condition`. <div class="lightbox"> <img src='generated/images/guide/structural-directives/unless-anim.gif' alt="UnlessDirective in action"> </div> {@a shorthand} {@a asterisk} ## Structural directive shorthand The asterisk, `*`, syntax on a structural directive, such as `*ngIf`, is shorthand that Angular interprets into a longer form. Angular transforms the asterisk in front of a structural directive into an `<ng-template>` that surrounds the host element and its descendants. The following is an example of `*ngIf` that displays the hero's name if `hero` exists: <code-example path="structural-directives/src/app/app.component.html" header="src/app/app.component.html (asterisk)" region="asterisk"></code-example> The `*ngIf` directive moves to the `<ng-template>` where it becomes a property binding in square brackets, `[ngIf]`. The rest of the `<div>`, including its class attribute, moves inside the `<ng-template>`. <code-example path="structural-directives/src/app/app.component.html" header="src/app/app.component.html (ngif-template)" region="ngif-template"></code-example> Angular does not create a real `<ng-template>` element, instead rendering only the `<div>` and a comment node placeholder to the DOM. ```html <!--bindings={ "ng-reflect-ng-if": "[object Object]" }--> <div _ngcontent-c0>Mr. Nice</div> ``` The following example compares the shorthand use of the asterisk in `*ngFor` with the longhand `<ng-template>` form: <code-example path="structural-directives/src/app/app.component.html" header="src/app/app.component.html (inside-ngfor)" region="inside-ngfor"></code-example> Here, everything related to the `ngFor` structural directive applies to the `<ng-template>`. All other bindings and attributes on the element apply to the `<div>` element within the `<ng-template>`. Other modifiers on the host element, in addition to the `ngFor` string, remain in place as the element moves inside the `<ng-template>`. In this example, the `[class.odd]="odd"` stays on the `<div>`. The `let` keyword declares a template input variable that you can reference within the template. The input variables in this example are `hero`, `i`, and `odd`. The parser translates `let hero`, `let i`, and `let odd` into variables named `let-hero`, `let-i`, and `let-odd`. The `let-i` and `let-odd` variables become `let i=index` and `let odd=odd`. Angular sets `i` and `odd` to the current value of the context's `index` and `odd` properties. The parser applies PascalCase to all directives and prefixes them with the directive's attribute name, such as ngFor. For example, the `ngFor` input properties, `of` and `trackBy`, map to `ngForOf` and `ngForTrackBy`. As the `NgFor` directive loops through the list, it sets and resets properties of its own context object. These properties can include, but aren't limited to, `index`, `odd`, and a special property named `$implicit`. Angular sets `let-hero` to the value of the context's `$implicit` property, which `NgFor` has initialized with the hero for the current iteration. For more information, see the [NgFor API](api/common/NgForOf "API: NgFor") and [NgForOf API](api/common/NgForOf) documentation. ### Creating template fragments with `<ng-template>` Angular's `<ng-template>` element defines a template that doesn't render anything by default. With `<ng-template>`, you can render the content manually for full control over how the content displays. If there is no structural directive and you wrap some elements in an `<ng-template>`, those elements disappear. In the following example, Angular does not render the middle "Hip!" in the phrase "Hip! Hip! Hooray!" because of the surrounding `<ng-template>`. <code-example path="structural-directives/src/app/app.component.html" header="src/app/app.component.html (template-tag)" region="template-tag"></code-example> <div class="lightbox"> <img src='generated/images/guide/structural-directives/template-rendering.png' alt="template tag rendering"> </div> ## Structural directive syntax reference When you write your own structural directives, use the following syntax: ``` *:prefix="( :let | :expression ) (';' | ',')? ( :let | :as | :keyExp )*" ``` The following tables describe each portion of the structural directive grammar: <table> <tr> <td><code>prefix</code></td> <td>HTML attribute key</td> </tr> <tr> <td><code>key</code></td> <td>HTML attribute key</td> </tr> <tr> <td><code>local</code></td> <td>local variable name used in the template</td> </tr> <tr> <td><code>export</code></td> <td>value exported by the directive under a given name</td> </tr> <tr> <td><code>expression</code></td> <td>standard Angular expression</td> </tr> </table> <table> <tr> <th></th> </tr> <tr> <td colspan="3"><code>keyExp = :key ":"? :expression ("as" :local)? ";"? </code></td> </tr> <tr> <td colspan="3"><code>let = "let" :local "=" :export ";"?</code></td> </tr> <tr> <td colspan="3"><code>as = :export "as" :local ";"?</code></td> </tr> </table> ### How Angular translates shorthand Angular translates structural directive shorthand into the normal binding syntax as follows: <table> <tr> <th>Shorthand</th> <th>Translation</th> </tr> <tr> <td><code>prefix</code> and naked <code>expression</code></td> <td><code>[prefix]="expression"</code></td> </tr> <tr> <td><code>keyExp</code></td> <td><code>[prefixKey] "expression" (let-prefixKey="export")</code> <br /> Notice that the <code>prefix</code> is added to the <code>key</code> </td> </tr> <tr> <td><code>let</code></td> <td><code>let-local="export"</code></td> </tr> </table> ### Shorthand examples The following table provides shorthand examples: <table> <tr> <th>Shorthand</th> <th>How Angular interprets the syntax</th> </tr> <tr> <td><code>*ngFor="let item of [1,2,3]"</code></td> <td><code>&lt;ng-template ngFor let-item [ngForOf]="[1,2,3]"&gt;</code></td> </tr> <tr> <td><code>*ngFor="let item of [1,2,3] as items; trackBy: myTrack; index as i"</code></td> <td><code>&lt;ng-template ngFor let-item [ngForOf]="[1,2,3]" let-items="ngForOf" [ngForTrackBy]="myTrack" let-i="index"&gt;</code> </td> </tr> <tr> <td><code>*ngIf="exp"</code></td> <td><code>&lt;ng-template [ngIf]="exp"&gt;</code></td> </tr> <tr> <td><code>*ngIf="exp as value"</code></td> <td><code>&lt;ng-template [ngIf]="exp" let-value="ngIf"&gt;</code></td> </tr> </table> {@a directive-type-checks} <!-- To do follow up PR: move this section to a more general location because it also applies to attribute directives. --> ## Improving template type checking for custom directives You can improve template type checking for custom directives by adding template guard properties to your directive definition. These properties help the Angular template type checker find mistakes in the template at compile time, which can avoid runtime errors. These properties are as follows: * A property `ngTemplateGuard_(someInputProperty)` lets you specify a more accurate type for an input expression within the template. * The `ngTemplateContextGuard` static property declares the type of the template context. This section provides examples of both kinds of type-guard property. For more information, see [Template type checking](guide/template-typecheck "Template type-checking guide"). {@a narrowing-input-types} ### Making in-template type requirements more specific with template guards A structural directive in a template controls whether that template is rendered at run time, based on its input expression. To help the compiler catch template type errors, you should specify as closely as possible the required type of a directive's input expression when it occurs inside the template. A type guard function narrows the expected type of an input expression to a subset of types that might be passed to the directive within the template at run time. You can provide such a function to help the type-checker infer the proper type for the expression at compile time. For example, the `NgIf` implementation uses type-narrowing to ensure that the template is only instantiated if the input expression to `*ngIf` is truthy. To provide the specific type requirement, the `NgIf` directive defines a [static property `ngTemplateGuard_ngIf: 'binding'`](api/common/NgIf#static-properties). The `binding` value is a special case for a common kind of type-narrowing where the input expression is evaluated in order to satisfy the type requirement. To provide a more specific type for an input expression to a directive within the template, add an `ngTemplateGuard_xx` property to the directive, where the suffix to the static property name, `xx`, is the `@Input()` field name. The value of the property can be either a general type-narrowing function based on its return type, or the string `"binding"`, as in the case of `NgIf`. For example, consider the following structural directive that takes the result of a template expression as an input: <code-example language="ts" header="IfLoadedDirective"> export type Loaded<T> = { type: 'loaded', data: T }; export type Loading = { type: 'loading' }; export type LoadingState<T> = Loaded<T> | Loading; export class IfLoadedDirective<T> { @Input('ifLoaded') set state(state: LoadingState<T>) {} static ngTemplateGuard_state<T>(dir: IfLoadedDirective<T>, expr: LoadingState<T>): expr is Loaded<T> { return true; }; } export interface Person { name: string; } @Component({ template: `&lt;div *ifLoaded="state">{{ state.data }}&lt;/div>`, }) export class AppComponent { state: LoadingState<Person>; } </code-example> In this example, the `LoadingState<T>` type permits either of two states, `Loaded<T>` or `Loading`. The expression used as the directive’s `state` input is of the umbrella type `LoadingState`, as it’s unknown what the loading state is at that point. The `IfLoadedDirective` definition declares the static field `ngTemplateGuard_state`, which expresses the narrowing behavior. Within the `AppComponent` template, the `*ifLoaded` structural directive should render this template only when `state` is actually `Loaded<Person>`. The type guard lets the type checker infer that the acceptable type of `state` within the template is a `Loaded<T>`, and further infer that `T` must be an instance of `Person`. {@a narrowing-context-type} ### Typing the directive's context If your structural directive provides a context to the instantiated template, you can properly type it inside the template by providing a static `ngTemplateContextGuard` function. The following snippet shows an example of such a function. <code-example language="ts" header="myDirective.ts"> @Directive({…}) export class ExampleDirective { // Make sure the template checker knows the type of the context with which the // template of this directive will be rendered static ngTemplateContextGuard(dir: ExampleDirective, ctx: unknown): ctx is ExampleContext { return true; }; // … } </code-example>
{'content_hash': '27268e1b06e2b0d3d7a969e6d72aa0d6', 'timestamp': '', 'source': 'github', 'line_count': 338, 'max_line_length': 294, 'avg_line_length': 46.35502958579882, 'alnum_prop': 0.7340439111564974, 'repo_name': 'manekinekko/angular', 'id': '923b51123839afad26525b0d876fa8721a05a935', 'size': '15709', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'aio/content/guide/structural-directives.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '339496'}, {'name': 'Dockerfile', 'bytes': '11884'}, {'name': 'HTML', 'bytes': '333378'}, {'name': 'JSONiq', 'bytes': '619'}, {'name': 'JavaScript', 'bytes': '823824'}, {'name': 'PHP', 'bytes': '7222'}, {'name': 'Python', 'bytes': '355591'}, {'name': 'Shell', 'bytes': '72400'}, {'name': 'TypeScript', 'bytes': '18489103'}]}
const mod1 = require('mod'); console.log(mod1.a); console.log(mod1.b);
{'content_hash': 'a3c4074dc4d22f5b7511ad7a6c9ffc84', 'timestamp': '', 'source': 'github', 'line_count': 4, 'max_line_length': 28, 'avg_line_length': 18.0, 'alnum_prop': 0.6805555555555556, 'repo_name': 'DHLau/NodeDemo', 'id': '1d78e5aa980d4fde5c1eaaaec9d8f66da79a3519', 'size': '72', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Demo/day08/1.js', 'mode': '33188', 'license': 'mit', 'language': []}
package br.com.caelum.vraptor.musicjungle.interceptor; import static java.util.Arrays.asList; import java.util.ResourceBundle; import javax.inject.Inject; import br.com.caelum.vraptor.Accepts; import br.com.caelum.vraptor.AroundCall; import br.com.caelum.vraptor.Intercepts; import br.com.caelum.vraptor.Result; import br.com.caelum.vraptor.controller.ControllerMethod; import br.com.caelum.vraptor.interceptor.SimpleInterceptorStack; import br.com.caelum.vraptor.musicjungle.controller.HomeController; import br.com.caelum.vraptor.musicjungle.dao.UserDao; import br.com.caelum.vraptor.musicjungle.model.User; import br.com.caelum.vraptor.validator.I18nMessage; /** * Interceptor to check if the user is in the session. */ @Intercepts public class AuthorizationInterceptor { private final UserInfo info; private final UserDao dao; private final Result result; private final ResourceBundle bundle; @Inject public AuthorizationInterceptor(UserInfo info, UserDao dao, Result result, ResourceBundle bundle) { this.info = info; this.dao = dao; this.result = result; this.bundle = bundle; } /** * @deprecated CDI eyes only */ public AuthorizationInterceptor() { this(null, null, null, null); } @Accepts public boolean accepts(ControllerMethod method) { return !method.containsAnnotation(Public.class); } /** * Intercepts the request and checks if there is a user logged in. */ @AroundCall public void intercept(SimpleInterceptorStack stack) { User current = info.getUser(); try { dao.refresh(current); } catch (Exception e) { // could happen if the user does not exist in the database or if there's no user logged in. } /** * You can use the result even in interceptors, but you can't use Validator.onError* methods because * they throw ValidationException. */ if (current == null) { // remember added parameters will survive one more request, when there is a redirect I18nMessage msg = new I18nMessage("user", "not_logged_user"); msg.setBundle(bundle); result.include("errors", asList(msg)); result.redirectTo(HomeController.class).login(); return; } stack.next(); } }
{'content_hash': '728fc51449d26ca452ad26f4b02b1fd1', 'timestamp': '', 'source': 'github', 'line_count': 81, 'max_line_length': 102, 'avg_line_length': 26.80246913580247, 'alnum_prop': 0.745278673422386, 'repo_name': 'khajavi/vraptor4', 'id': '66e9e4f071c1595af42fa87fedf18e0ecc77ead1', 'size': '2818', 'binary': False, 'copies': '13', 'ref': 'refs/heads/master', 'path': 'vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/interceptor/AuthorizationInterceptor.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '14683'}, {'name': 'HTML', 'bytes': '326283'}, {'name': 'Java', 'bytes': '1420238'}, {'name': 'JavaScript', 'bytes': '8696'}, {'name': 'Ruby', 'bytes': '9307'}, {'name': 'Shell', 'bytes': '305'}]}
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // This file was modified by Oracle on 2013, 2014, 2015. // Modifications copyright (c) 2013-2015 Oracle and/or its affiliates. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LINEAR_LINEAR_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LINEAR_LINEAR_HPP #include <boost/core/ignore_unused.hpp> #include <boost/geometry/util/condition.hpp> #include <boost/geometry/util/range.hpp> #include <boost/geometry/algorithms/detail/sub_range.hpp> #include <boost/geometry/algorithms/detail/single_geometry.hpp> #include <boost/geometry/algorithms/detail/relate/point_geometry.hpp> #include <boost/geometry/algorithms/detail/relate/turns.hpp> #include <boost/geometry/algorithms/detail/relate/boundary_checker.hpp> #include <boost/geometry/algorithms/detail/relate/follow_helpers.hpp> namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace relate { template <typename Result, typename BoundaryChecker, bool TransposeResult> class disjoint_linestring_pred { public: disjoint_linestring_pred(Result & res, BoundaryChecker const& boundary_checker) : m_result(res) , m_boundary_checker(boundary_checker) , m_flags(0) { if ( ! may_update<interior, exterior, '1', TransposeResult>(m_result) ) { m_flags |= 1; } if ( ! may_update<boundary, exterior, '0', TransposeResult>(m_result) ) { m_flags |= 2; } } template <typename Linestring> bool operator()(Linestring const& linestring) { if ( m_flags == 3 ) { return false; } std::size_t const count = boost::size(linestring); // invalid input if ( count < 2 ) { // ignore // TODO: throw an exception? return true; } // point-like linestring if ( count == 2 && equals::equals_point_point(range::front(linestring), range::back(linestring)) ) { update<interior, exterior, '0', TransposeResult>(m_result); } else { update<interior, exterior, '1', TransposeResult>(m_result); m_flags |= 1; // check if there is a boundary if ( m_flags < 2 && ( m_boundary_checker.template is_endpoint_boundary<boundary_front>(range::front(linestring)) || m_boundary_checker.template is_endpoint_boundary<boundary_back>(range::back(linestring)) ) ) { update<boundary, exterior, '0', TransposeResult>(m_result); m_flags |= 2; } } return m_flags != 3 && ! m_result.interrupt; } private: Result & m_result; BoundaryChecker const& m_boundary_checker; unsigned m_flags; }; template <typename Geometry1, typename Geometry2> struct linear_linear { static const bool interruption_enabled = true; typedef typename geometry::point_type<Geometry1>::type point1_type; typedef typename geometry::point_type<Geometry2>::type point2_type; template <typename Result> static inline void apply(Geometry1 const& geometry1, Geometry2 const& geometry2, Result & result) { // The result should be FFFFFFFFF relate::set<exterior, exterior, result_dimension<Geometry1>::value>(result);// FFFFFFFFd, d in [1,9] or T if ( BOOST_GEOMETRY_CONDITION( result.interrupt ) ) return; // get and analyse turns typedef typename turns::get_turns<Geometry1, Geometry2>::turn_info turn_type; std::vector<turn_type> turns; interrupt_policy_linear_linear<Result> interrupt_policy(result); turns::get_turns < Geometry1, Geometry2, detail::get_turns::get_turn_info_type<Geometry1, Geometry2, turns::assign_policy<true> > >::apply(turns, geometry1, geometry2, interrupt_policy); if ( BOOST_GEOMETRY_CONDITION( result.interrupt ) ) return; boundary_checker<Geometry1> boundary_checker1(geometry1); disjoint_linestring_pred<Result, boundary_checker<Geometry1>, false> pred1(result, boundary_checker1); for_each_disjoint_geometry_if<0, Geometry1>::apply(turns.begin(), turns.end(), geometry1, pred1); if ( BOOST_GEOMETRY_CONDITION( result.interrupt ) ) return; boundary_checker<Geometry2> boundary_checker2(geometry2); disjoint_linestring_pred<Result, boundary_checker<Geometry2>, true> pred2(result, boundary_checker2); for_each_disjoint_geometry_if<1, Geometry2>::apply(turns.begin(), turns.end(), geometry2, pred2); if ( BOOST_GEOMETRY_CONDITION( result.interrupt ) ) return; if ( turns.empty() ) return; // TODO: turns must be sorted and followed only if it's possible to go out and in on the same point // for linear geometries union operation must be detected which I guess would be quite often if ( may_update<interior, interior, '1'>(result) || may_update<interior, boundary, '0'>(result) || may_update<interior, exterior, '1'>(result) || may_update<boundary, interior, '0'>(result) || may_update<boundary, boundary, '0'>(result) || may_update<boundary, exterior, '0'>(result) ) { typedef turns::less<0, turns::less_op_linear_linear<0> > less; std::sort(turns.begin(), turns.end(), less()); turns_analyser<turn_type, 0> analyser; analyse_each_turn(result, analyser, turns.begin(), turns.end(), geometry1, geometry2, boundary_checker1, boundary_checker2); } if ( BOOST_GEOMETRY_CONDITION( result.interrupt ) ) return; if ( may_update<interior, interior, '1', true>(result) || may_update<interior, boundary, '0', true>(result) || may_update<interior, exterior, '1', true>(result) || may_update<boundary, interior, '0', true>(result) || may_update<boundary, boundary, '0', true>(result) || may_update<boundary, exterior, '0', true>(result) ) { typedef turns::less<1, turns::less_op_linear_linear<1> > less; std::sort(turns.begin(), turns.end(), less()); turns_analyser<turn_type, 1> analyser; analyse_each_turn(result, analyser, turns.begin(), turns.end(), geometry2, geometry1, boundary_checker2, boundary_checker1); } } template <typename Result> class interrupt_policy_linear_linear { public: static bool const enabled = true; explicit interrupt_policy_linear_linear(Result & result) : m_result(result) {} // TODO: since we update result for some operations here, we may not do it in the analyser! template <typename Range> inline bool apply(Range const& turns) { typedef typename boost::range_iterator<Range const>::type iterator; for (iterator it = boost::begin(turns) ; it != boost::end(turns) ; ++it) { if ( it->operations[0].operation == overlay::operation_intersection || it->operations[1].operation == overlay::operation_intersection ) { update<interior, interior, '1'>(m_result); } else if ( ( it->operations[0].operation == overlay::operation_union || it->operations[0].operation == overlay::operation_blocked || it->operations[1].operation == overlay::operation_union || it->operations[1].operation == overlay::operation_blocked ) && it->operations[0].position == overlay::position_middle && it->operations[1].position == overlay::position_middle ) { // TODO: here we could also check the boundaries and set IB,BI,BB at this point update<interior, interior, '0'>(m_result); } } return m_result.interrupt; } private: Result & m_result; }; // This analyser should be used like Input or SinglePass Iterator template <typename TurnInfo, std::size_t OpId> class turns_analyser { typedef typename TurnInfo::point_type turn_point_type; static const std::size_t op_id = OpId; static const std::size_t other_op_id = (OpId + 1) % 2; static const bool transpose_result = OpId != 0; public: turns_analyser() : m_previous_turn_ptr(NULL) , m_previous_operation(overlay::operation_none) , m_degenerated_turn_ptr(NULL) , m_collinear_spike_exit(false) {} template <typename Result, typename TurnIt, typename Geometry, typename OtherGeometry, typename BoundaryChecker, typename OtherBoundaryChecker> void apply(Result & res, TurnIt it, Geometry const& geometry, OtherGeometry const& other_geometry, BoundaryChecker const& boundary_checker, OtherBoundaryChecker const& other_boundary_checker) { overlay::operation_type const op = it->operations[op_id].operation; segment_identifier const& seg_id = it->operations[op_id].seg_id; segment_identifier const& other_id = it->operations[other_op_id].seg_id; bool const first_in_range = m_seg_watcher.update(seg_id); if ( op != overlay::operation_union && op != overlay::operation_intersection && op != overlay::operation_blocked ) { // degenerated turn if ( op == overlay::operation_continue && it->method == overlay::method_none && m_exit_watcher.is_outside(*it) /*&& ( m_exit_watcher.get_exit_operation() == overlay::operation_none || ! turn_on_the_same_ip<op_id>(m_exit_watcher.get_exit_turn(), *it) )*/ ) { // TODO: rewrite the above condition // WARNING! For spikes the above condition may be TRUE // When degenerated turns are be marked in a different way than c,c/c // different condition will be checked handle_degenerated(res, *it, geometry, other_geometry, boundary_checker, other_boundary_checker, first_in_range); // TODO: not elegant solution! should be rewritten. if ( it->operations[op_id].position == overlay::position_back ) { m_previous_operation = overlay::operation_blocked; m_exit_watcher.reset_detected_exit(); } } return; } // reset m_degenerated_turn_ptr = NULL; // handle possible exit bool fake_enter_detected = false; if ( m_exit_watcher.get_exit_operation() == overlay::operation_union ) { // real exit point - may be multiple // we know that we entered and now we exit if ( ! turn_on_the_same_ip<op_id>(m_exit_watcher.get_exit_turn(), *it) ) { m_exit_watcher.reset_detected_exit(); // not the last IP update<interior, exterior, '1', transpose_result>(res); } // fake exit point, reset state else if ( op == overlay::operation_intersection ) { m_exit_watcher.reset_detected_exit(); fake_enter_detected = true; } } else if ( m_exit_watcher.get_exit_operation() == overlay::operation_blocked ) { // ignore multiple BLOCKs if ( op == overlay::operation_blocked ) return; if ( op == overlay::operation_intersection && turn_on_the_same_ip<op_id>(m_exit_watcher.get_exit_turn(), *it) ) { fake_enter_detected = true; } m_exit_watcher.reset_detected_exit(); } // i/i, i/x, i/u if ( op == overlay::operation_intersection ) { bool const was_outside = m_exit_watcher.is_outside(); m_exit_watcher.enter(*it); // interiors overlaps update<interior, interior, '1', transpose_result>(res); bool const this_b = it->operations[op_id].position == overlay::position_front // ignore spikes! && is_ip_on_boundary<boundary_front>(it->point, it->operations[op_id], boundary_checker, seg_id); // going inside on boundary point // may be front only if ( this_b ) { // may be front and back bool const other_b = is_ip_on_boundary<boundary_any>(it->point, it->operations[other_op_id], other_boundary_checker, other_id); // it's also the boundary of the other geometry if ( other_b ) { update<boundary, boundary, '0', transpose_result>(res); } else { update<boundary, interior, '0', transpose_result>(res); } } // going inside on non-boundary point else { // if we didn't enter in the past, we were outside if ( was_outside && ! fake_enter_detected && it->operations[op_id].position != overlay::position_front && ! m_collinear_spike_exit ) { update<interior, exterior, '1', transpose_result>(res); // if it's the first IP then the first point is outside if ( first_in_range ) { bool const front_b = is_endpoint_on_boundary<boundary_front>( range::front(sub_range(geometry, seg_id)), boundary_checker); // if there is a boundary on the first point if ( front_b ) { update<boundary, exterior, '0', transpose_result>(res); } } } } m_collinear_spike_exit = false; } // u/i, u/u, u/x, x/i, x/u, x/x else if ( op == overlay::operation_union || op == overlay::operation_blocked ) { // TODO: is exit watcher still needed? // couldn't is_collinear and some going inside counter be used instead? bool const is_collinear = it->operations[op_id].is_collinear; bool const was_outside = m_exit_watcher.is_outside() && m_exit_watcher.get_exit_operation() == overlay::operation_none; // TODO: move the above condition into the exit_watcher? // to exit we must be currently inside and the current segment must be collinear if ( !was_outside && is_collinear ) { m_exit_watcher.exit(*it, false); // if the position is not set to back it must be a spike if ( it->operations[op_id].position != overlay::position_back ) { m_collinear_spike_exit = true; } } bool const op_blocked = op == overlay::operation_blocked; // we're inside and going out from inside // possibly going out right now if ( ! was_outside && is_collinear ) { if ( op_blocked && it->operations[op_id].position == overlay::position_back ) // ignore spikes! { // check if this is indeed the boundary point // NOTE: is_ip_on_boundary<>() should be called here but the result will be the same if ( is_endpoint_on_boundary<boundary_back>(it->point, boundary_checker) ) { // may be front and back bool const other_b = is_ip_on_boundary<boundary_any>(it->point, it->operations[other_op_id], other_boundary_checker, other_id); // it's also the boundary of the other geometry if ( other_b ) { update<boundary, boundary, '0', transpose_result>(res); } else { update<boundary, interior, '0', transpose_result>(res); } } } } // we're outside or intersects some segment from the outside else { // if we are truly outside if ( was_outside && it->operations[op_id].position != overlay::position_front && ! m_collinear_spike_exit /*&& !is_collinear*/ ) { update<interior, exterior, '1', transpose_result>(res); } // boundaries don't overlap - just an optimization if ( it->method == overlay::method_crosses ) { // the L1 is going from one side of the L2 to the other through the point update<interior, interior, '0', transpose_result>(res); // it's the first point in range if ( first_in_range ) { bool const front_b = is_endpoint_on_boundary<boundary_front>( range::front(sub_range(geometry, seg_id)), boundary_checker); // if there is a boundary on the first point if ( front_b ) { update<boundary, exterior, '0', transpose_result>(res); } } } // method other than crosses, check more conditions else { bool const this_b = is_ip_on_boundary<boundary_any>(it->point, it->operations[op_id], boundary_checker, seg_id); bool const other_b = is_ip_on_boundary<boundary_any>(it->point, it->operations[other_op_id], other_boundary_checker, other_id); // if current IP is on boundary of the geometry if ( this_b ) { // it's also the boundary of the other geometry if ( other_b ) { update<boundary, boundary, '0', transpose_result>(res); } else { update<boundary, interior, '0', transpose_result>(res); } } // if current IP is not on boundary of the geometry else { // it's also the boundary of the other geometry if ( other_b ) { update<interior, boundary, '0', transpose_result>(res); } else { update<interior, interior, '0', transpose_result>(res); } } // first IP on the last segment point - this means that the first point is outside if ( first_in_range && ( !this_b || op_blocked ) && was_outside && it->operations[op_id].position != overlay::position_front && ! m_collinear_spike_exit /*&& !is_collinear*/ ) { bool const front_b = is_endpoint_on_boundary<boundary_front>( range::front(sub_range(geometry, seg_id)), boundary_checker); // if there is a boundary on the first point if ( front_b ) { update<boundary, exterior, '0', transpose_result>(res); } } } } } // store ref to previously analysed (valid) turn m_previous_turn_ptr = boost::addressof(*it); // and previously analysed (valid) operation m_previous_operation = op; } // Called for last template <typename Result, typename TurnIt, typename Geometry, typename OtherGeometry, typename BoundaryChecker, typename OtherBoundaryChecker> void apply(Result & res, TurnIt first, TurnIt last, Geometry const& geometry, OtherGeometry const& /*other_geometry*/, BoundaryChecker const& boundary_checker, OtherBoundaryChecker const& /*other_boundary_checker*/) { boost::ignore_unused(first, last); //BOOST_ASSERT( first != last ); // here, the possible exit is the real one // we know that we entered and now we exit if ( /*m_exit_watcher.get_exit_operation() == overlay::operation_union // THIS CHECK IS REDUNDANT ||*/ m_previous_operation == overlay::operation_union || m_degenerated_turn_ptr ) { update<interior, exterior, '1', transpose_result>(res); BOOST_ASSERT(first != last); const TurnInfo * turn_ptr = NULL; if ( m_degenerated_turn_ptr ) turn_ptr = m_degenerated_turn_ptr; else if ( m_previous_turn_ptr ) turn_ptr = m_previous_turn_ptr; if ( turn_ptr ) { segment_identifier const& prev_seg_id = turn_ptr->operations[op_id].seg_id; //BOOST_ASSERT(!boost::empty(sub_range(geometry, prev_seg_id))); bool const prev_back_b = is_endpoint_on_boundary<boundary_back>( range::back(sub_range(geometry, prev_seg_id)), boundary_checker); // if there is a boundary on the last point if ( prev_back_b ) { update<boundary, exterior, '0', transpose_result>(res); } } } // Just in case, // reset exit watcher before the analysis of the next Linestring // note that if there are some enters stored there may be some error above m_exit_watcher.reset(); m_previous_turn_ptr = NULL; m_previous_operation = overlay::operation_none; m_degenerated_turn_ptr = NULL; // actually if this is set to true here there is some error // in get_turns_ll or relate_ll, an assert could be checked here m_collinear_spike_exit = false; } template <typename Result, typename Turn, typename Geometry, typename OtherGeometry, typename BoundaryChecker, typename OtherBoundaryChecker> void handle_degenerated(Result & res, Turn const& turn, Geometry const& geometry, OtherGeometry const& other_geometry, BoundaryChecker const& boundary_checker, OtherBoundaryChecker const& /*other_boundary_checker*/, bool first_in_range) { typename detail::single_geometry_return_type<Geometry const>::type ls1_ref = detail::single_geometry(geometry, turn.operations[op_id].seg_id); typename detail::single_geometry_return_type<OtherGeometry const>::type ls2_ref = detail::single_geometry(other_geometry, turn.operations[other_op_id].seg_id); // only one of those should be true: if ( turn.operations[op_id].position == overlay::position_front ) { // valid, point-sized if ( boost::size(ls2_ref) == 2 ) { bool const front_b = is_endpoint_on_boundary<boundary_front>(turn.point, boundary_checker); if ( front_b ) { update<boundary, interior, '0', transpose_result>(res); } else { update<interior, interior, '0', transpose_result>(res); } // operation 'c' should be last for the same IP so we know that the next point won't be the same update<interior, exterior, '1', transpose_result>(res); m_degenerated_turn_ptr = boost::addressof(turn); } } else if ( turn.operations[op_id].position == overlay::position_back ) { // valid, point-sized if ( boost::size(ls2_ref) == 2 ) { update<interior, exterior, '1', transpose_result>(res); bool const back_b = is_endpoint_on_boundary<boundary_back>(turn.point, boundary_checker); if ( back_b ) { update<boundary, interior, '0', transpose_result>(res); } else { update<interior, interior, '0', transpose_result>(res); } if ( first_in_range ) { //BOOST_ASSERT(!boost::empty(ls1_ref)); bool const front_b = is_endpoint_on_boundary<boundary_front>( range::front(ls1_ref), boundary_checker); if ( front_b ) { update<boundary, exterior, '0', transpose_result>(res); } } } } else if ( turn.operations[op_id].position == overlay::position_middle && turn.operations[other_op_id].position == overlay::position_middle ) { update<interior, interior, '0', transpose_result>(res); // here we don't know which one is degenerated bool const is_point1 = boost::size(ls1_ref) == 2 && equals::equals_point_point(range::front(ls1_ref), range::back(ls1_ref)); bool const is_point2 = boost::size(ls2_ref) == 2 && equals::equals_point_point(range::front(ls2_ref), range::back(ls2_ref)); // if the second one is degenerated if ( !is_point1 && is_point2 ) { update<interior, exterior, '1', transpose_result>(res); if ( first_in_range ) { //BOOST_ASSERT(!boost::empty(ls1_ref)); bool const front_b = is_endpoint_on_boundary<boundary_front>( range::front(ls1_ref), boundary_checker); if ( front_b ) { update<boundary, exterior, '0', transpose_result>(res); } } m_degenerated_turn_ptr = boost::addressof(turn); } } // NOTE: other.position == front and other.position == back // will be handled later, for the other geometry } private: exit_watcher<TurnInfo, OpId> m_exit_watcher; segment_watcher<same_single> m_seg_watcher; const TurnInfo * m_previous_turn_ptr; overlay::operation_type m_previous_operation; const TurnInfo * m_degenerated_turn_ptr; bool m_collinear_spike_exit; }; template <typename Result, typename TurnIt, typename Analyser, typename Geometry, typename OtherGeometry, typename BoundaryChecker, typename OtherBoundaryChecker> static inline void analyse_each_turn(Result & res, Analyser & analyser, TurnIt first, TurnIt last, Geometry const& geometry, OtherGeometry const& other_geometry, BoundaryChecker const& boundary_checker, OtherBoundaryChecker const& other_boundary_checker) { if ( first == last ) return; for ( TurnIt it = first ; it != last ; ++it ) { analyser.apply(res, it, geometry, other_geometry, boundary_checker, other_boundary_checker); if ( BOOST_GEOMETRY_CONDITION( res.interrupt ) ) return; } analyser.apply(res, first, last, geometry, other_geometry, boundary_checker, other_boundary_checker); } }; }} // namespace detail::relate #endif // DOXYGEN_NO_DETAIL }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LINEAR_LINEAR_HPP
{'content_hash': '241118a5cfdcbd30fc8fbabc957bd7cb', 'timestamp': '', 'source': 'github', 'line_count': 785, 'max_line_length': 116, 'avg_line_length': 42.66369426751592, 'alnum_prop': 0.4663640978173241, 'repo_name': 'rrpathak007/boost_ios_precompiled_lib', 'id': '20a22c3018ea27663984aab59a58f41581a74931', 'size': '33491', 'binary': False, 'copies': '19', 'ref': 'refs/heads/master', 'path': 'include/boost/geometry/algorithms/detail/relate/linear_linear.hpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '173687'}, {'name': 'C++', 'bytes': '98657163'}]}
module.exports = function(sails) { /** * Module dependencies. */ var _ = require('lodash'), util = require('sails-util'), Hook = require('../../index'); /** * Expose hook definition */ return { defaults: { // CSRF middleware protection, all non-GET requests must send '_csrf' parmeter // _csrf is a parameter for views, and is also available via GET at /csrfToken // TODO: move into csrf hook csrf: false }, configure: function () { if (sails.config.csrf === true) { sails.config.csrf = { grantTokenViaAjax: true, protectionEnabled: true, origin: '-', routesDisabled: '-' }; } else if (sails.config.csrf === false) { sails.config.csrf = { grantTokenViaAjax: false, protectionEnabled: false, origin: '-', routesDisabled: '-' }; } // If user provides ANY object (including empty object), enable all default // csrf protection. else { _.defaults(typeof sails.config.csrf === 'object' ? sails.config.csrf : {}, { grantTokenViaAjax: true, protectionEnabled: true, origin: '-', routesDisabled: '-' }); } // Add the csrfToken directly to the config'd routes, so that the CORS hook can process it sails.config.routes["/csrfToken"] = {target: csrfToken, cors: {origin: sails.config.csrf.origin, credentials:true}}; }, initialize: function(cb) { // Quick trim function--could move this into sails.util at some point function trim (str) {return str.trim();} // Add res.view() method to compatible middleware sails.on('router:before', function () { sails.router.bind('/*', function(req, res, next) { var allowCrossOriginCSRF = sails.config.csrf.origin.split(',').map(trim).indexOf(req.headers.origin) > -1; if (sails.config.csrf.protectionEnabled) { var connect = require('express/node_modules/connect'); return connect.csrf()(req, res, function(err) { var isRouteDisabled = sails.config.csrf.routesDisabled.split(',').map(trim).indexOf(req.path) > -1; if (util.isSameOrigin(req) || allowCrossOriginCSRF) { res.locals._csrf = req.csrfToken(); } else { res.locals._csrf = null; } if (err && !isRouteDisabled) { // Return an Access-Control-Allow-Origin header in case this is a xdomain request if (req.headers.origin) { res.set('Access-Control-Allow-Origin', req.headers.origin); res.set('Access-Control-Allow-Credentials', true); } return res.forbidden("CSRF mismatch"); } else { return next(); } }); } // Always ok res.locals._csrf = null; next(); }, null, {_middlewareType: 'CSRF HOOK: CSRF'}); }); sails.on('router:after', function() { sails.router.bind('/csrfToken', csrfToken, 'get', {cors: {origin: sails.config.csrf.origin, credentials: true}}); }); cb(); } }; }; function csrfToken (req, res, next) { // Allow this endpoint to be disabled by setting: // sails.config.csrf = { grantTokenViaAjax: false } if (!sails.config.csrf.grantTokenViaAjax) { return next(); } return res.json({ _csrf: res.locals._csrf }); }
{'content_hash': 'b02fd451d2f2c20dfbaf9f301e057bc3', 'timestamp': '', 'source': 'github', 'line_count': 122, 'max_line_length': 122, 'avg_line_length': 29.30327868852459, 'alnum_prop': 0.5518881118881119, 'repo_name': 'ky0615/sails', 'id': '05daa09b4ac5e3b98d5d7318a600b39174208b46', 'size': '3575', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'lib/hooks/csrf/index.js', 'mode': '33188', 'license': 'mit', 'language': []}
package org.apache.carbondata.core.datamap; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.carbondata.core.datamap.dev.DataMap; import org.apache.carbondata.core.datamap.dev.DataMapFactory; import org.apache.carbondata.core.events.ChangeEvent; import org.apache.carbondata.core.events.EventListener; import org.apache.carbondata.core.indexstore.Blocklet; import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier; import org.apache.carbondata.core.scan.filter.resolver.FilterResolverIntf; /** * DataMap at the table level, user can add any number of datamaps for one table. Depends * on the filter condition it can prune the blocklets. */ public final class TableDataMap implements EventListener { private AbsoluteTableIdentifier identifier; private String dataMapName; private DataMapFactory dataMapFactory; /** * It is called to initialize and load the required table datamap metadata. */ public TableDataMap(AbsoluteTableIdentifier identifier, String dataMapName, DataMapFactory dataMapFactory) { this.identifier = identifier; this.dataMapName = dataMapName; this.dataMapFactory = dataMapFactory; } /** * Pass the valid segments and prune the datamap using filter expression * * @param segmentIds * @param filterExp * @return */ public List<Blocklet> prune(List<String> segmentIds, FilterResolverIntf filterExp) throws IOException { List<Blocklet> blocklets = new ArrayList<>(); for (String segmentId : segmentIds) { List<DataMap> dataMaps = dataMapFactory.getDataMaps(segmentId); for (DataMap dataMap : dataMaps) { List<Blocklet> pruneBlocklets = dataMap.prune(filterExp); blocklets.addAll(addSegmentId(pruneBlocklets, segmentId)); } } return blocklets; } private List<Blocklet> addSegmentId(List<Blocklet> pruneBlocklets, String segmentId) { for (Blocklet blocklet : pruneBlocklets) { blocklet.setSegmentId(segmentId); } return pruneBlocklets; } /** * This is used for making the datamap distributable. * It takes the valid segments and returns all the datamaps as distributable objects so that * it can be distributed across machines. * * @return */ public List<DataMapDistributable> toDistributable(List<String> segmentIds) throws IOException { List<DataMapDistributable> distributables = new ArrayList<>(); for (String segmentsId : segmentIds) { List<DataMapDistributable> list = dataMapFactory.toDistributable(segmentsId); for (DataMapDistributable distributable: list) { distributable.setDataMapName(dataMapName); distributable.setSegmentId(segmentsId); distributable.setTablePath(identifier.getTablePath()); distributable.setDataMapFactoryClass(dataMapFactory.getClass().getName()); } distributables.addAll(list); } return distributables; } /** * This method is used from any machine after it is distributed. It takes the distributable object * to prune the filters. * * @param distributable * @param filterExp * @return */ public List<Blocklet> prune(DataMapDistributable distributable, FilterResolverIntf filterExp) { List<Blocklet> blocklets = dataMapFactory.getDataMap(distributable).prune(filterExp); for (Blocklet blocklet: blocklets) { blocklet.setSegmentId(distributable.getSegmentId()); } return blocklets; } @Override public void fireEvent(ChangeEvent event) { dataMapFactory.fireEvent(event); } /** * Clear only the datamaps of the segments * @param segmentIds */ public void clear(List<String> segmentIds) { for (String segmentId: segmentIds) { dataMapFactory.clear(segmentId); } } /** * Clears all datamap */ public void clear() { dataMapFactory.clear(); } /** * Get the unique name of datamap * * @return */ public String getDataMapName() { return dataMapName; } public DataMapFactory getDataMapFactory() { return dataMapFactory; } }
{'content_hash': '0f9d15dba9f637f54445c669f6aeaa03', 'timestamp': '', 'source': 'github', 'line_count': 135, 'max_line_length': 100, 'avg_line_length': 30.392592592592592, 'alnum_prop': 0.7238605898123325, 'repo_name': 'aniketadnaik/carbondataStreamIngest', 'id': '66bb257bcb5dc19c1f9d67d3231377dbe39aef20', 'size': '4903', 'binary': False, 'copies': '3', 'ref': 'refs/heads/streaming_ingest', 'path': 'core/src/main/java/org/apache/carbondata/core/datamap/TableDataMap.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '4889080'}, {'name': 'Python', 'bytes': '19915'}, {'name': 'Scala', 'bytes': '6633539'}, {'name': 'Shell', 'bytes': '3008'}, {'name': 'Smalltalk', 'bytes': '86'}, {'name': 'Thrift', 'bytes': '21635'}]}
import os from jsonpath_rw import parse from girder.utility.model_importer import ModelImporter from girder.constants import AccessType from girder.api.rest import getCurrentUser import cumulus from cumulus.common.jsonpath import get_property def retrieve_credentials(event): cluster_id = event.info['authKey'] user = event.info['user'] model = ModelImporter.model('cluster', 'cumulus') cluster = model.load(cluster_id, user=getCurrentUser(), level=AccessType.READ) event.stopPropagation() if not cluster: return username = parse('config.ssh.user').find(cluster)[0].value key_name = parse('config.ssh.key').find(cluster)[0].value key_path = os.path.join(cumulus.config.ssh.keyStore, key_name) passphrase = get_property('config.ssh.passphrase', cluster) if user != username: raise Exception('User doesn\'t match cluster user id ') event.addResponse((key_path, passphrase))
{'content_hash': 'c3095447f31d2ba0a6d9171427885405', 'timestamp': '', 'source': 'github', 'line_count': 30, 'max_line_length': 66, 'avg_line_length': 32.266666666666666, 'alnum_prop': 0.7055785123966942, 'repo_name': 'Kitware/cumulus', 'id': '04391d3ab959bfe776f22f98606913dafa92d561', 'size': '1762', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'girder/sftp/sftp/credentials.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CMake', 'bytes': '5997'}, {'name': 'Python', 'bytes': '852977'}, {'name': 'Shell', 'bytes': '13175'}]}
var HROGTreeModel = new eiTreeModel('ESUTTR30'); efform_onload = function () { efregion.show("ef_region_mtree"); efregion.show("ef_region_ntree"); } efcalendar_click = function (control_source, id) { var node = ef.getNodeById(id); efcalendar(control_source, node, 'yyyymmdd', true); } button_f4_onclick = function() { efgrid.submitInqu( "ef_grid_e", "es","ESHR01","queryEmpChange" ); } button_f5_onclick = function() { } /* Tree Related Stuffs */ function configOriginalTree(tree){ tree.nodeInitializer = originalTreeNodeInitializer; } function originalTreeNodeInitializer(node){ if ( node.top() ){ node.icon(efico.get("eftree.cu")); node.openIcon(efico.get("eftree.cu")); node.active(true); }; node.textClicked = function(){ originalTreeNodeClicked( node ); }; } function originalTreeNodeClicked(node){ var label = ""; if ( !node.top() ){ label = node.data().label } ef.get("inqu_status-0-parentOrgCodeT").value=label; ef.get("inqu_status-0-oldOrgCodeT").value=label; efgrid.submitInqu( "ef_grid_e", "es","ESHR01","queryEmpChange" ); } function configCurrentTree(tree){ tree.nodeInitializer = currentTreeNodeInitializer; } function currentTreeNodeInitializer(node){ if ( node.top() ){ node.icon(efico.get("eftree.cu")); node.openIcon(efico.get("eftree.cu")); node.active(true); }; node.textClicked = function(){ currentTreeNodeClicked( node ); }; } function currentTreeNodeClicked(node){ var label = ""; if ( !node.top() ){ label = node.data().label } ef.get("inqu_status-0-parentOrgCodeT").value = label; ef.get("inqu_status-0-newOrgCodeT").value = label; efgrid.submitInqu( "ef_grid_e", "es","ESHR01","queryEmpChange" ); }
{'content_hash': '853de470a9ef07c44eddf3a9cbb2129f', 'timestamp': '', 'source': 'github', 'line_count': 70, 'max_line_length': 68, 'avg_line_length': 25.857142857142858, 'alnum_prop': 0.6486187845303868, 'repo_name': 'stserp/erp1', 'id': '994114be46581ef1de01a398797e7edfffad952a', 'size': '1810', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'source/web/ES/ES92.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ASP', 'bytes': '44086'}, {'name': 'CSS', 'bytes': '305836'}, {'name': 'ColdFusion', 'bytes': '126937'}, {'name': 'HTML', 'bytes': '490616'}, {'name': 'Java', 'bytes': '21647120'}, {'name': 'JavaScript', 'bytes': '6599859'}, {'name': 'Lasso', 'bytes': '18060'}, {'name': 'PHP', 'bytes': '41541'}, {'name': 'Perl', 'bytes': '20182'}, {'name': 'Perl 6', 'bytes': '21700'}, {'name': 'Python', 'bytes': '39177'}, {'name': 'SourcePawn', 'bytes': '111'}, {'name': 'XSLT', 'bytes': '3404'}]}
var st = require('st'); var http = require('http'); var Router = require("routes-router"); var router = Router(); // The body module handles the async parsing of the data in a // POST/PUT/DELETE request: var parseBodyText = require('body'); function parseBody(req,res,opts,message) { //console.log(JSON.stringify(opts,null,2)); parseBodyText(req,res,function(err,body) { if (err) { res.statusCode = 418;// override default 200 return res.end("Request failed!") } console.log('body = '+body); res.end(message); }) } // Create api routes: router.addRoute("/api*", { // GET method receives data in opts.query: GET: function(req,res,opts) { console.log("\n---Getting---"); console.log(JSON.stringify(opts,null,2)); res.end("Got it!\n"); }, // Other three methods receive data in the request body, // using processBody callback: PUT: function(req,res,opts) { console.log("\n---Putting---"); parseBody(req,res,opts,"It's put!\n"); }, POST: function(req,res,opts) { console.log("\n---Posting---"); parseBody(req,res,opts,"It's posted!\n"); }, DELETE: function(req,res,opts) { console.log("\n---Deleting---"); parseBody(req,res,opts,"It's deleted!\n"); } }); // The static route pattern (/*) includes /api, // so it should be listed last, as an alternative to /api: var indexFile = process.argv[2] || 'testA'; router.addRoute("/*", st({ path: __dirname + "/public", index:'/'+indexFile+'.html' //allows alternative files })); var server = http.createServer(router); console.log('server listening on port # 1337'); server.listen(1337);
{'content_hash': '8a588b533adc3c24591efd72a739811d', 'timestamp': '', 'source': 'github', 'line_count': 64, 'max_line_length': 61, 'avg_line_length': 25.03125, 'alnum_prop': 0.651685393258427, 'repo_name': 'portlandcodeschool/jse-win15-samples', 'id': 'dbe1dcf949365288a51452514627a47395be1224', 'size': '1602', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'node/3-api-basics/server2-body.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '1215955'}, {'name': 'HTML', 'bytes': '19103'}, {'name': 'JavaScript', 'bytes': '1601666'}]}
<?php namespace gossi\formatter\tests\utils; use gossi\formatter\Formatter; trait SamplesTrait { protected function getContent($file) { return file_get_contents(sprintf(__DIR__ . '/../fixtures/samples/%s.php', $file)); } protected function getRawContent($file) { return $this->getContent('raw/' . $file); } protected function getDefaultContent($file) { return $this->getContent('default/' . $file); } protected function compareSample($sample) { $raw = $this->getRawContent($sample); $formatter = new Formatter(); // default coding style $code = $formatter->format($raw); // if ($sample == 'class') { // echo $code; // } $this->assertEquals($this->getDefaultContent($sample), $code); // psr2 coding style } }
{'content_hash': 'f1362bdd7c578abc8c5e3308bac55683', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 84, 'avg_line_length': 22.696969696969695, 'alnum_prop': 0.6675567423230975, 'repo_name': 'gossi/php-code-formatter', 'id': 'b1bed3e76d2f2369ca051b74cfb8574ef66a2482', 'size': '749', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'tests/utils/SamplesTrait.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'PHP', 'bytes': '56446'}]}
package com.github.soap2jms.reader.it; import static org.junit.Assert.assertEquals; import static org.junit.Assert.*; import java.util.Properties; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSContext; import javax.jms.JMSProducer; import javax.jms.Message; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.github.soap2jms.Constants; import com.github.soap2jms.model.S2JMessage; import com.github.soap2jms.pub.SoapToJmsClient; public class ITReaderConsumeMessage { private static final Logger log = LoggerFactory.getLogger(ITReaderConsumeMessage.class); private static final String DEFAULT_DESTINATION = "jms/soap2jms.reader"; private static final String DEFAULT_USERNAME = "test"; private static final String DEFAULT_PASSWORD = "test1"; private static final String INITIAL_CONTEXT_FACTORY = "org.jboss.naming.remote.client.InitialContextFactory"; private static final String PROVIDER_URL = "http-remoting://127.0.0.1:8080"; @Test public void testReadTextMessage() throws Exception { // send a message to a queue. sendMessage(1); // read the message with webservice SoapToJmsClient wsClient = new SoapToJmsClient(Constants.CTX_NAME); // TODO: map jms/soap2jms.reader to java:/comp/env/soap2jms in project // project_customization (web.xml). Message[] messages = wsClient.readMessages("soap2jms", null, 100); assertTrue("complete response", wsClient.retrieveComplete()); //List<WsJmsMessageAndStatus> jmsMessages = messages.getS2JMessageAndStatus(); assertEquals("Messages retrieved", 1, messages.length); final Message message = messages[0]; assertTrue("Message instanceof textMessage", message instanceof TextMessage); TextMessage textMessage =(TextMessage) message; assertEquals("message content", Constants.DEFAULT_CONTENT, textMessage.getText()); assertNotNull("MessageId not null", textMessage.getJMSMessageID()); log.info("JMS message id to acknowledge:" + textMessage.getJMSMessageID()); // acknowlege the message wsClient.acknowledge("soap2jms", messages); // the message is not in the queue Message[] messages2 = wsClient.readMessages("soap2jms", null, 100); assertEquals("Messages retrieved after acknowledge", 0, messages2.length); } @Test public void testAcknowledgeMessage2Times() { // send a message to a queue. // read the message with webservice // acknowlege the message // acknowledge the message OK } @Test public void testReadObjectMessage() { // send a message to a queue. // read the message with webservice // acknowlege the message // acknowledge the message OK } @Test public void testReadMapMessage() { // send a message to a queue. // read the message with webservice // acknowlege the message // acknowledge the message OK } private void sendMessage(int count) throws NamingException { Context namingContext = null; try { String userName = System.getProperty("username", DEFAULT_USERNAME); String password = System.getProperty("password", DEFAULT_PASSWORD); // Set up the namingContext for the JNDI lookup final Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, PROVIDER_URL)); // env.put(Context.SECURITY_PRINCIPAL, userName); // env.put(Context.SECURITY_CREDENTIALS, password); namingContext = new InitialContext(env); // Perform the JNDI lookups String connectionFactoryString = System.getProperty("connection.factory", Constants.DEFAULT_CONNECTION_FACTORY); log.info("Attempting to acquire connection factory \"" + connectionFactoryString + "\""); ConnectionFactory connectionFactory = (ConnectionFactory) namingContext.lookup(connectionFactoryString); log.info("Found connection factory \"" + connectionFactoryString + "\" in JNDI"); String destinationString = System.getProperty("destination", DEFAULT_DESTINATION); log.info("Attempting to acquire destination \"" + destinationString + "\""); Destination destination = (Destination) namingContext.lookup(destinationString); log.info("Found destination \"" + destinationString + "\" in JNDI"); String content = System.getProperty("message.content", Constants.DEFAULT_CONTENT); try (JMSContext context = connectionFactory.createContext(userName, password)) { log.info("Sending " + count + " messages with content: " + content); // Send the specified number of messages final JMSProducer producer = context.createProducer(); for (int i = 0; i < count; i++) { producer.send(destination, content); } /* * // Create the JMS consumer JMSConsumer consumer = * context.createConsumer(destination); // Then receive the same * number of messages that were sent for (int i = 0; i < count; * i++) { String text = consumer.receiveBody(String.class, * 5000); log.info("Received message with content " + text); } */ } } finally { if (namingContext != null) { try { namingContext.close(); } catch (NamingException e) { log.error(e.getMessage()); } } } } }
{'content_hash': 'c7c43bcb747534378eec701f0630e734', 'timestamp': '', 'source': 'github', 'line_count': 148, 'max_line_length': 115, 'avg_line_length': 36.060810810810814, 'alnum_prop': 0.7388045718568484, 'repo_name': 'jbricks/soap2jms', 'id': 'c80bf60a7bf5c3c28cc3376298fb6d240caddff0', 'size': '5337', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'integration/wildfly10/src/test/java/com/github/soap2jms/reader/it/ITReaderConsumeMessage.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '873'}, {'name': 'HTML', 'bytes': '1675'}, {'name': 'Java', 'bytes': '167798'}]}
<?xml version="1.0" ?><!DOCTYPE TS><TS language="pt_BR" version="2.1"> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About Vibranium</source> <translation>Sobre o Vibranium</translation> </message> <message> <location line="+39"/> <source>&lt;b&gt;Vibranium&lt;/b&gt; version</source> <translation>&lt;b&gt;Vibranium&lt;/b&gt; versao</translation> </message> <message> <location line="+41"/> <source>Copyright © 2009-2014 The Bitcoin developers Copyright © 2012-2014 The NovaCoin developers Copyright © 2014 The Vibranium developers</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or &lt;a href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&gt;http://www.opensource.org/licenses/mit-license.php&lt;/a&gt;. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (&lt;a href=&quot;https://www.openssl.org/&quot;&gt;https://www.openssl.org/&lt;/a&gt;) and cryptographic software written by Eric Young (&lt;a href=&quot;mailto:[email protected]&quot;&gt;[email protected]&lt;/a&gt;) and UPnP software written by Thomas Bernard.</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation>Livro de Endereços</translation> </message> <message> <location line="+22"/> <source>Double-click to edit address or label</source> <translation>Clique duas vezes para editar o endereço ou a etiqueta</translation> </message> <message> <location line="+24"/> <source>Create a new address</source> <translation>Criar um novo endereço</translation> </message> <message> <location line="+10"/> <source>Copy the currently selected address to the system clipboard</source> <translation>Copie o endereço selecionado para a área de transferência do sistema</translation> </message> <message> <location line="-7"/> <source>&amp;New Address</source> <translation>&amp;Novo Endereço</translation> </message> <message> <location line="-43"/> <source>These are your Vibranium addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation>Estes são os seus endereços Vibranium para receber pagamentos. Você pode dar um diferente a cada remetente para que você possa acompanhar quem está pagando.</translation> </message> <message> <location line="+53"/> <source>&amp;Copy Address</source> <translation>&amp;Copiar Endereço</translation> </message> <message> <location line="+7"/> <source>Show &amp;QR Code</source> <translation>Mostrar &amp;QR Code</translation> </message> <message> <location line="+7"/> <source>Sign a message to prove you own a Vibranium address</source> <translation>Assine a mensagem para provar que você possui um endereço Vibranium</translation> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation>Assinar &amp;Mensagem</translation> </message> <message> <location line="+17"/> <source>Delete the currently selected address from the list</source> <translation>Excluir os endereços selecionados da lista</translation> </message> <message> <location line="-10"/> <source>Verify a message to ensure it was signed with a specified Vibranium address</source> <translation>Verifique a mensagem para garantir que ela foi assinada com um endereço Vibranium específico</translation> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation>&amp;Verificar Mensagem</translation> </message> <message> <location line="+10"/> <source>&amp;Delete</source> <translation>&amp;Excluir</translation> </message> <message> <location filename="../addressbookpage.cpp" line="+65"/> <source>Copy &amp;Label</source> <translation>Copiar &amp;Etiqueta</translation> </message> <message> <location line="+2"/> <source>&amp;Edit</source> <translation>&amp;Editar</translation> </message> <message> <location line="+250"/> <source>Export Address Book Data</source> <translation>Exportar Dados do Livro de Endereços</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Arquivo separado por vírgulas (*. csv)</translation> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation>Erro ao exportar</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>Não foi possível escrever no arquivo %1.</translation> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+145"/> <source>Label</source> <translation>Rótulo</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Endereço</translation> </message> <message> <location line="+36"/> <source>(no label)</source> <translation>(Sem rótulo)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation>Janela da Frase de Segurança</translation> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation>Digite a frase de segurança</translation> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation>Nova frase de segurança</translation> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation>Repita a nova frase de segurança</translation> </message> <message> <location line="+33"/> <source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source> <translation>Serve para desativar o envio de dinheiro trivial quando conta do SO for comprometida. Não oferece segurança real.</translation> </message> <message> <location line="+3"/> <source>For staking only</source> <translation>Apenas para participação</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+38"/> <source>Encrypt wallet</source> <translation>Criptografar carteira</translation> </message> <message> <location line="+7"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>Esta operação precisa de sua frase de segurança para desbloquear a carteira.</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>Desbloquear carteira</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>Esta operação precisa de sua frase de segurança para descriptografar a carteira.</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>Descriptografar carteira</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>Alterar frase de segurança</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>Digite a frase de segurança antiga e nova para a carteira.</translation> </message> <message> <location line="+45"/> <source>Confirm wallet encryption</source> <translation>Confirmar criptografia da carteira</translation> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR COINS&lt;/b&gt;!</source> <translation>Aviso: Se você criptografar sua carteira e perder sua senha, você vai &lt;b&gt;PERDER TODAS AS SUAS MOEDAS&lt;/ b&gt;!</translation> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation>Tem certeza de que deseja criptografar sua carteira?</translation> </message> <message> <location line="+15"/> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation>IMPORTANTE: Qualquer backup prévio que você tenha feito do seu arquivo wallet deve ser substituído pelo novo e encriptado arquivo wallet gerado. Por razões de segurança, qualquer backup do arquivo wallet não criptografado se tornará inútil assim que você começar a usar uma nova carteira criptografada.</translation> </message> <message> <location line="+103"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation>Cuidado: A tecla Caps Lock está ligada!</translation> </message> <message> <location line="-133"/> <location line="+60"/> <source>Wallet encrypted</source> <translation>Carteira criptografada</translation> </message> <message> <location line="-140"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;ten or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <source>Vibranium will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source> <translation>Vibranium vai fechar agora para concluir o processo de criptografia. Lembre-se que a criptografia de sua carteira não pode proteger totalmente suas moedas de serem roubados por malwares infectem seu computador.</translation> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+44"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation>A criptografia da carteira falhou</translation> </message> <message> <location line="-56"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>A criptografia da carteira falhou devido a um erro interno. Sua carteira não estava criptografada.</translation> </message> <message> <location line="+7"/> <location line="+50"/> <source>The supplied passphrases do not match.</source> <translation>A frase de segurança fornecida não confere.</translation> </message> <message> <location line="-38"/> <source>Wallet unlock failed</source> <translation>A abertura da carteira falhou</translation> </message> <message> <location line="+1"/> <location line="+12"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>A frase de segurança digitada para a descriptografia da carteira estava incorreta.</translation> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation>A descriptografia da carteira falhou</translation> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation>A frase de segurança da carteira foi alterada com êxito.</translation> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="+297"/> <source>Sign &amp;message...</source> <translation>&amp;Assinar Mensagem...</translation> </message> <message> <location line="-64"/> <source>Show general overview of wallet</source> <translation>Mostrar visão geral da carteira</translation> </message> <message> <location line="+17"/> <source>&amp;Transactions</source> <translation>&amp;Transações</translation> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation>Navegar pelo histórico de transações</translation> </message> <message> <location line="+5"/> <source>&amp;Address Book</source> <translation>&amp;Livro de Endereços</translation> </message> <message> <location line="+1"/> <source>Edit the list of stored addresses and labels</source> <translation>Edite a lista de endereços armazenados e rótulos</translation> </message> <message> <location line="-18"/> <source>Show the list of addresses for receiving payments</source> <translation>Mostrar a lista de endereços para o recebimento de pagamentos</translation> </message> <message> <location line="+34"/> <source>E&amp;xit</source> <translation>S&amp;air</translation> </message> <message> <location line="+1"/> <source>Quit application</source> <translation>Sair da aplicação</translation> </message> <message> <location line="+4"/> <source>Show information about Vibranium</source> <translation>Mostrar informações sobre o Vibranium</translation> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation>Sobre &amp;Qt</translation> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation>Mostrar informações sobre o Qt</translation> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>&amp;Opções...</translation> </message> <message> <location line="+4"/> <source>&amp;Encrypt Wallet...</source> <translation>&amp;Criptografar Carteira...</translation> </message> <message> <location line="+2"/> <source>&amp;Backup Wallet...</source> <translation>&amp;Backup Carteira...</translation> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation>&amp;Mudar frase de segurança...</translation> </message> <message> <location line="+9"/> <source>&amp;Export...</source> <translation>&amp;Exportar...</translation> </message> <message> <location line="-55"/> <source>Send coins to a Vibranium address</source> <translation>Enviar moedas para um endereço Vibranium</translation> </message> <message> <location line="+39"/> <source>Modify configuration options for Vibranium</source> <translation>Modificar opções de configuração para Vibranium</translation> </message> <message> <location line="+17"/> <source>Export the data in the current tab to a file</source> <translation>Exportar os dados da guia atual para um arquivo</translation> </message> <message> <location line="-13"/> <source>Encrypt or decrypt wallet</source> <translation>Cryptografar ou Decryptografar carteira</translation> </message> <message> <location line="+2"/> <source>Backup wallet to another location</source> <translation>Fazer cópia de segurança da carteira para uma outra localização</translation> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation>Mudar a frase de segurança utilizada na criptografia da carteira</translation> </message> <message> <location line="+10"/> <source>&amp;Debug window</source> <translation>Janela de &amp;Depuração</translation> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation>Abrir console de depuração e diagnóstico</translation> </message> <message> <location line="-5"/> <source>&amp;Verify message...</source> <translation>&amp;Verificar mensagem...</translation> </message> <message> <location line="-214"/> <location line="+551"/> <source>Vibranium</source> <translation>Vibranium</translation> </message> <message> <location line="-551"/> <source>Wallet</source> <translation>Carteira</translation> </message> <message> <location line="+193"/> <source>&amp;About Vibranium</source> <translation>Sobre o Vibranium</translation> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation>&amp;Exibir/Ocultar</translation> </message> <message> <location line="+8"/> <source>Unlock wallet</source> <translation>Desbloquear carteira</translation> </message> <message> <location line="+1"/> <source>&amp;Lock Wallet</source> <translation>&amp;Bloquear Carteira</translation> </message> <message> <location line="+1"/> <source>Lock wallet</source> <translation>Bloquear Carteira</translation> </message> <message> <location line="+28"/> <source>&amp;File</source> <translation>&amp;Arquivo</translation> </message> <message> <location line="+8"/> <source>&amp;Settings</source> <translation>&amp;Configurações</translation> </message> <message> <location line="+8"/> <source>&amp;Help</source> <translation>&amp;Ajuda</translation> </message> <message> <location line="+17"/> <source>Tabs toolbar</source> <translation>Barra de ferramentas</translation> </message> <message> <location line="+46"/> <location line="+9"/> <source>[testnet]</source> <translation>[testnet]</translation> </message> <message> <location line="+0"/> <location line="+58"/> <source>Vibranium client</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+70"/> <source>%n active connection(s) to Vibranium network</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+488"/> <source>Staking.&lt;br&gt;Your weight is %1&lt;br&gt;Network weight is %2&lt;br&gt;Expected time to earn reward is %3</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Not staking because wallet is locked</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is offline</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because wallet is syncing</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Not staking because you don&apos;t have mature coins</source> <translation type="unfinished"/> </message> <message> <location line="-808"/> <source>&amp;Dashboard</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>&amp;Receive</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>&amp;Send</source> <translation type="unfinished"/> </message> <message> <location line="+49"/> <source>&amp;Unlock Wallet...</source> <translation type="unfinished"/> </message> <message> <location line="+273"/> <source>Up to date</source> <translation>Atualizado</translation> </message> <message> <location line="+43"/> <source>Catching up...</source> <translation>Recuperando o atraso ...</translation> </message> <message> <location line="+113"/> <source>Confirm transaction fee</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Sent transaction</source> <translation>Transação enviada</translation> </message> <message> <location line="+1"/> <source>Incoming transaction</source> <translation>Transação recebida</translation> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation>Data: %1 Quantidade: %2 Tipo: %3 Endereço: %4</translation> </message> <message> <location line="+100"/> <location line="+15"/> <source>URI handling</source> <translation type="unfinished"/> </message> <message> <location line="-15"/> <location line="+15"/> <source>URI can not be parsed! This can be caused by an invalid Vibranium address or malformed URI parameters.</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Wallet is &lt;b&gt;not encrypted&lt;/b&gt;</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>Carteira está &lt;b&gt;criptografada&lt;/b&gt; e atualmente &lt;b&gt;desbloqueada&lt;/b&gt;</translation> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>Carteira está &lt;b&gt;criptografada&lt;/b&gt; e atualmente &lt;b&gt;bloqueada&lt;/b&gt;</translation> </message> <message> <location line="+24"/> <source>Backup Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+91"/> <source>%n second(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n minute(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="-429"/> <location line="+433"/> <source>%n hour(s)</source> <translation><numerusform>%n hora</numerusform><numerusform>%n horas</numerusform></translation> </message> <message> <location line="-456"/> <source>Processed %1 blocks of transaction history.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+27"/> <location line="+433"/> <source>%n day(s)</source> <translation><numerusform>%n dia</numerusform><numerusform>%n dias</numerusform></translation> </message> <message numerus="yes"> <location line="-429"/> <location line="+6"/> <source>%n week(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+0"/> <source>%1 and %2</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+0"/> <source>%n year(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+5"/> <source>%1 behind</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Last received block was generated %1 ago.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Transactions after this will not yet be visible.</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location line="+69"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation type="unfinished"/> </message> <message> <location line="+324"/> <source>Not staking</source> <translation type="unfinished"/> </message> <message> <location filename="../bitcoin.cpp" line="+104"/> <source>A fatal error occurred. Vibranium can no longer continue safely and will quit.</source> <translation type="unfinished"/> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+110"/> <source>Network Alert</source> <translation>Alerta da Rede</translation> </message> </context> <context> <name>CoinControlDialog</name> <message> <location filename="../forms/coincontroldialog.ui" line="+14"/> <source>Coin Control</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Quantity:</source> <translation>Quantidade:</translation> </message> <message> <location line="+32"/> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <location line="+48"/> <source>Amount:</source> <translation>Quantia:</translation> </message> <message> <location line="+32"/> <source>Priority:</source> <translation>Prioridade:</translation> </message> <message> <location line="+48"/> <source>Fee:</source> <translation>Taxa:</translation> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation>Rendimento baixo:</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="+552"/> <source>no</source> <translation>não</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="+51"/> <source>After Fee:</source> <translation>Depois da taxa:</translation> </message> <message> <location line="+35"/> <source>Change:</source> <translation>trocar</translation> </message> <message> <location line="+69"/> <source>(un)select all</source> <translation>(de)selecionar tudo</translation> </message> <message> <location line="+13"/> <source>Tree mode</source> <translation>Modo árvore</translation> </message> <message> <location line="+16"/> <source>List mode</source> <translation>Modo lista</translation> </message> <message> <location line="+45"/> <source>Amount</source> <translation>Quantidade</translation> </message> <message> <location line="+5"/> <source>Label</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Address</source> <translation>Endereço</translation> </message> <message> <location line="+5"/> <source>Date</source> <translation>Data</translation> </message> <message> <location line="+5"/> <source>Confirmations</source> <translation>Confirmações</translation> </message> <message> <location line="+3"/> <source>Confirmed</source> <translation>Confirmado</translation> </message> <message> <location line="+5"/> <source>Priority</source> <translation>Prioridade</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="-515"/> <source>Copy address</source> <translation>Copiar endereço</translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>Copiar etiqueta</translation> </message> <message> <location line="+1"/> <location line="+26"/> <source>Copy amount</source> <translation>Copiar quantia</translation> </message> <message> <location line="-25"/> <source>Copy transaction ID</source> <translation>Copiar ID da transação</translation> </message> <message> <location line="+24"/> <source>Copy quantity</source> <translation>Copiar quantidade</translation> </message> <message> <location line="+2"/> <source>Copy fee</source> <translation>Copiar taxa</translation> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation>Copia pós-taxa</translation> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation>Copiar bytes</translation> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation>Copia prioridade</translation> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation>Copia saída de pouco valor</translation> </message> <message> <location line="+1"/> <source>Copy change</source> <translation>Copia alteração</translation> </message> <message> <location line="+317"/> <source>highest</source> <translation>mais alta possível</translation> </message> <message> <location line="+1"/> <source>high</source> <translation>alta</translation> </message> <message> <location line="+1"/> <source>medium-high</source> <translation>média-alta</translation> </message> <message> <location line="+1"/> <source>medium</source> <translation>média</translation> </message> <message> <location line="+4"/> <source>low-medium</source> <translation>média-baixa</translation> </message> <message> <location line="+1"/> <source>low</source> <translation>baixa</translation> </message> <message> <location line="+1"/> <source>lowest</source> <translation>a mais baixa possível</translation> </message> <message> <location line="+155"/> <source>DUST</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>yes</source> <translation>sim</translation> </message> <message> <location line="+10"/> <source>This label turns red, if the transaction size is bigger than 10000 bytes. This means a fee of at least %1 per kb is required. Can vary +/- 1 Byte per input.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transactions with higher priority get more likely into a block. This label turns red, if the priority is smaller than &quot;medium&quot;. This means a fee of at least %1 per kb is required.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if any recipient receives an amount smaller than %1. This means a fee of at least %2 is required. Amounts below 0.546 times the minimum relay fee are shown as DUST.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This label turns red, if the change is smaller than %1. This means a fee of at least %2 is required.</source> <translation type="unfinished"/> </message> <message> <location line="+36"/> <location line="+66"/> <source>(no label)</source> <translation>(Sem rótulo)</translation> </message> <message> <location line="-9"/> <source>change from %1 (%2)</source> <translation>troco de %1 (%2)</translation> </message> <message> <location line="+1"/> <source>(change)</source> <translation>(troco)</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>Editar Endereço</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation>&amp;Etiqueta</translation> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>&amp;Endereço</translation> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation type="unfinished"/> </message> <message> <location filename="../editaddressdialog.cpp" line="+21"/> <source>New receiving address</source> <translation>Novo endereço de recebimento</translation> </message> <message> <location line="+4"/> <source>New sending address</source> <translation>Novo endereço de envio</translation> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation>Editar endereço de recebimento</translation> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation>Editar endereço de envio</translation> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>O endereço digitado &quot;%1&quot; já se encontra no catálogo de endereços.</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid Vibranium address.</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation>Não foi possível destravar a carteira.</translation> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation>A geração de nova chave falhou.</translation> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+426"/> <location line="+12"/> <source>Vibranium-Qt</source> <translation type="unfinished"/> </message> <message> <location line="-12"/> <source>version</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Usage:</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>UI options</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation type="unfinished"/> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation>Opções</translation> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation>Principal</translation> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation>Pagar taxa de &amp;transação</translation> </message> <message> <location line="+31"/> <source>Reserved amount does not participate in staking and is therefore spendable at any time.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Reserve</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Automatically start Vibranium after logging in to the system.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Start Vibranium on system login</source> <translation type="unfinished"/> </message> <message> <location line="+21"/> <source>&amp;Network</source> <translation>Rede</translation> </message> <message> <location line="+6"/> <source>Automatically open the Vibranium client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation>Mapear porta usando &amp;UPnP</translation> </message> <message> <location line="+7"/> <source>Connect to the Vibranium network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation>&amp;IP do proxy:</translation> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation>&amp;Porta:</translation> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation>Porta do serviço de proxy (ex. 9050)</translation> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation>&amp;Versão do SOCKS:</translation> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation>Versão do proxy SOCKS (ex. 5)</translation> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation>&amp;Janela</translation> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation>Mostrar apenas um ícone na bandeja ao minimizar a janela.</translation> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation>&amp;Minimizar para a bandeja em vez da barra de tarefas.</translation> </message> <message> <location line="+7"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation>Minimizar em vez de sair do aplicativo quando a janela for fechada. Quando esta opção é escolhida, o aplicativo só será fechado selecionando Sair no menu Arquivo.</translation> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation>M&amp;inimizar ao sair</translation> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation>&amp;Mostrar</translation> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation>&amp;Língua da interface com usuário:</translation> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting Vibranium.</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation>&amp;Unidade usada para mostrar quantidades:</translation> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation>Escolha a unidade padrão de subdivisão para interface mostrar quando enviar bitcoins.</translation> </message> <message> <location line="+9"/> <source>Whether to show coin control features or not.</source> <translation>Mostrar ou não opções de controle da moeda.</translation> </message> <message> <location line="+3"/> <source>Display coin &amp;control features (experts only!)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Whether to select the coin outputs randomly or with minimal coin age.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Minimize weight consumption (experimental)</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Use black visual theme (requires restart)</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation>&amp;OK</translation> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation>&amp;Cancelar</translation> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation type="unfinished"/> </message> <message> <location filename="../optionsdialog.cpp" line="+53"/> <source>default</source> <translation>padrão</translation> </message> <message> <location line="+149"/> <location line="+9"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting Vibranium.</source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation>O endereço proxy fornecido é inválido.</translation> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation>Formulário</translation> </message> <message> <location line="+46"/> <location line="+247"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the Vibranium network after a connection is established, but this process has not completed yet.</source> <translation type="unfinished"/> </message> <message> <location line="-173"/> <source>Stake:</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Unconfirmed:</source> <translation type="unfinished"/> </message> <message> <location line="-113"/> <source>Wallet</source> <translation>Carteira</translation> </message> <message> <location line="+49"/> <source>Spendable:</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Your current spendable balance</source> <translation>Seu saldo atual spendable</translation> </message> <message> <location line="+80"/> <source>Immature:</source> <translation>Imaturo:</translation> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation>Saldo minerado que ainda não maturou</translation> </message> <message> <location line="+23"/> <source>Total:</source> <translation>Total:</translation> </message> <message> <location line="+16"/> <source>Your current total balance</source> <translation>Seu saldo total atual</translation> </message> <message> <location line="+50"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;Transações recentes&lt;/b&gt;</translation> </message> <message> <location line="-118"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location line="-32"/> <source>Total of coins that was staked, and do not yet count toward the current balance</source> <translation type="unfinished"/> </message> <message> <location filename="../overviewpage.cpp" line="+116"/> <location line="+1"/> <source>out of sync</source> <translation>fora de sincronia</translation> </message> </context> <context> <name>PaymentServer</name> <message> <location filename="../paymentserver.cpp" line="+107"/> <source>Cannot start Vibranium: click-to-pay handler</source> <translation type="unfinished"/> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation type="unfinished"/> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation type="unfinished"/> </message> <message> <location line="+56"/> <source>Amount:</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Label:</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Message:</source> <translation type="unfinished"/> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation type="unfinished"/> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation type="unfinished"/> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation>Nome do cliente</translation> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <source>N/A</source> <translation>N/A</translation> </message> <message> <location line="-194"/> <source>Client version</source> <translation>Versão do cliente</translation> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation>&amp;Informação</translation> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation>Usando OpenSSL versão</translation> </message> <message> <location line="+49"/> <source>Startup time</source> <translation>Horário de inicialização</translation> </message> <message> <location line="+29"/> <source>Network</source> <translation>Rede</translation> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation>Número de conexões</translation> </message> <message> <location line="+23"/> <source>On testnet</source> <translation type="unfinished"/> </message> <message> <location line="+23"/> <source>Block chain</source> <translation>Corrente de blocos</translation> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation>Quantidade atual de blocos</translation> </message> <message> <location line="+197"/> <source>&amp;Network Traffic</source> <translation type="unfinished"/> </message> <message> <location line="+52"/> <source>&amp;Clear</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Totals</source> <translation type="unfinished"/> </message> <message> <location line="+64"/> <source>In:</source> <translation type="unfinished"/> </message> <message> <location line="+80"/> <source>Out:</source> <translation type="unfinished"/> </message> <message> <location line="-383"/> <source>Last block time</source> <translation>Horário do último bloco</translation> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation>&amp;Abrir</translation> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Show the Vibranium-Qt help message to get a list with possible Vibranium command-line options.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation type="unfinished"/> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation>&amp;Console</translation> </message> <message> <location line="-237"/> <source>Build date</source> <translation>Data do &apos;build&apos;</translation> </message> <message> <location line="-104"/> <source>Vibranium - Debug window</source> <translation type="unfinished"/> </message> <message> <location line="+25"/> <source>Vibranium Core</source> <translation type="unfinished"/> </message> <message> <location line="+256"/> <source>Debug log file</source> <translation>Arquivo de log de Depuração</translation> </message> <message> <location line="+7"/> <source>Open the Vibranium debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation type="unfinished"/> </message> <message> <location line="+102"/> <source>Clear console</source> <translation>Limpar console</translation> </message> <message> <location filename="../rpcconsole.cpp" line="+325"/> <source>Welcome to the Vibranium RPC console.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation>Use as setas para cima e para baixo para navegar pelo histórico, e &lt;b&gt;Ctrl-L&lt;/b&gt; para limpar a tela.</translation> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>Digite &lt;b&gt;help&lt;/b&gt; para uma visão geral dos comandos disponíveis.</translation> </message> <message> <location line="+127"/> <source>%1 B</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 KB</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 MB</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 GB</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>%1 m</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>%1 h</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>%1 h %2 m</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+181"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation>Enviar dinheiro</translation> </message> <message> <location line="+76"/> <source>Coin Control Features</source> <translation>Opções de Controle da Moeda</translation> </message> <message> <location line="+20"/> <source>Inputs...</source> <translation>Entradas...</translation> </message> <message> <location line="+7"/> <source>automatically selected</source> <translation>automaticamente selecionado</translation> </message> <message> <location line="+19"/> <source>Insufficient funds!</source> <translation>Saldo insuficiente!</translation> </message> <message> <location line="+77"/> <source>Quantity:</source> <translation>Quantidade:</translation> </message> <message> <location line="+22"/> <location line="+35"/> <source>0</source> <translation type="unfinished"/> </message> <message> <location line="-19"/> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <location line="+51"/> <source>Amount:</source> <translation>Quantia:</translation> </message> <message> <location line="+22"/> <location line="+86"/> <location line="+86"/> <location line="+32"/> <source>0.00 XVI</source> <translation type="unfinished"/> </message> <message> <location line="-191"/> <source>Priority:</source> <translation>Prioridade:</translation> </message> <message> <location line="+19"/> <source>medium</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>Fee:</source> <translation>Taxa:</translation> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation>Rendimento baixo:</translation> </message> <message> <location line="+19"/> <source>no</source> <translation type="unfinished"/> </message> <message> <location line="+32"/> <source>After Fee:</source> <translation>Depois da taxa:</translation> </message> <message> <location line="+35"/> <source>Change</source> <translation type="unfinished"/> </message> <message> <location line="+50"/> <source>custom change address</source> <translation type="unfinished"/> </message> <message> <location line="+106"/> <source>Send to multiple recipients at once</source> <translation>Enviar para vários destinatários de uma só vez</translation> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation>Adicionar destinatário</translation> </message> <message> <location line="+16"/> <source>Remove all transaction fields</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation>Limpar Tudo</translation> </message> <message> <location line="+24"/> <source>Balance:</source> <translation>Saldo:</translation> </message> <message> <location line="+16"/> <source>123.456 XVI</source> <translation type="unfinished"/> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation>Confirmar o envio</translation> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation>Enviar</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-173"/> <source>Enter a Vibranium address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Copy quantity</source> <translation>Copiar quantidade</translation> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation>Copiar quantia</translation> </message> <message> <location line="+1"/> <source>Copy fee</source> <translation>Copiar taxa</translation> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation>Copia pós-taxa</translation> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation>Copiar bytes</translation> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation>Copia prioridade</translation> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation>Copia saída de pouco valor</translation> </message> <message> <location line="+1"/> <source>Copy change</source> <translation>Copia alteração</translation> </message> <message> <location line="+86"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation>Confirmar envio de dinheiro</translation> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source> and </source> <translation type="unfinished"/> </message> <message> <location line="+29"/> <source>The recipient address is not valid, please recheck.</source> <translation>O endereço do destinatário não é válido, favor verificar.</translation> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation>A quantidade a ser paga precisa ser maior que 0.</translation> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation>A quantidade excede seu saldo.</translation> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation>O total excede seu saldo quando uma taxa de transação de %1 é incluída.</translation> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation>Endereço duplicado: pode-se enviar para cada endereço apenas uma vez por transação.</translation> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed!</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+247"/> <source>WARNING: Invalid Vibranium address</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>(no label)</source> <translation>(Sem rótulo)</translation> </message> <message> <location line="+4"/> <source>WARNING: unknown change address</source> <translation type="unfinished"/> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation>Q&amp;uantidade:</translation> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation>Pagar &amp;Para:</translation> </message> <message> <location line="+34"/> <source>The address to send the payment to (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <location filename="../sendcoinsentry.cpp" line="+26"/> <source>Enter a label for this address to add it to your address book</source> <translation>Digite uma etiqueta para este endereço para adicioná-lo ao catálogo de endereços</translation> </message> <message> <location line="-78"/> <source>&amp;Label:</source> <translation>&amp;Etiqueta:</translation> </message> <message> <location line="+28"/> <source>Choose address from address book</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation>Colar o endereço da área de transferência</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation type="unfinished"/> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a Vibranium address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation type="unfinished"/> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation>Assinaturas - Assinar / Verificar uma mensagem</translation> </message> <message> <location line="+13"/> <location line="+124"/> <source>&amp;Sign Message</source> <translation>&amp;Assinar Mensagem</translation> </message> <message> <location line="-118"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>Você pode assinar mensagens com seus endereços para provar que você é o dono deles. Seja cuidadoso para não assinar algo vago, pois ataques de pishing podem tentar te enganar para dar sua assinatura de identidade para eles. Apenas assine afirmações completamente detalhadas com as quais você concorda.</translation> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation type="unfinished"/> </message> <message> <location line="+10"/> <location line="+203"/> <source>Choose an address from the address book</source> <translation type="unfinished"/> </message> <message> <location line="-193"/> <location line="+203"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="-193"/> <source>Paste address from clipboard</source> <translation>Colar o endereço da área de transferência</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation>Entre a mensagem que você quer assinar aqui</translation> </message> <message> <location line="+24"/> <source>Copy the current signature to the system clipboard</source> <translation>Copiar a assinatura para a área de transferência do sistema</translation> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this Vibranium address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all sign message fields</source> <translation>Limpar todos os campos de assinatura da mensagem</translation> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation>Limpar Tudo</translation> </message> <message> <location line="-87"/> <location line="+70"/> <source>&amp;Verify Message</source> <translation>&amp;Verificar Mensagem</translation> </message> <message> <location line="-64"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation>Forneça o endereço da assinatura, a mensagem (se assegure que você copiou quebras de linha, espaços, tabs, etc. exatamente) e a assinatura abaixo para verificar a mensagem. Cuidado para não ler mais na assinatura do que está escrito na mensagem propriamente, para evitar ser vítima de uma ataque do tipo &quot;man-in-the-middle&quot;.</translation> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation type="unfinished"/> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified Vibranium address</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Reset all verify message fields</source> <translation>Limpar todos os campos de assinatura da mensagem</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a Vibranium address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source> <translation type="unfinished"/> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation>Clique em &quot;Assinar Mensagem&quot; para gerar a assinatura</translation> </message> <message> <location line="+3"/> <source>Enter Vibranium signature</source> <translation type="unfinished"/> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation>O endereço fornecido é inválido.</translation> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation>Por favor, verifique o endereço e tente novamente.</translation> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation>O endereço fornecido não se refere a uma chave.</translation> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation>Destravamento da Carteira foi cancelado.</translation> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation>A chave privada para o endereço fornecido não está disponível.</translation> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation>Assinatura da mensagem falhou.</translation> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation>Mensagem assinada.</translation> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation>A assinatura não pode ser decodificada.</translation> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation>Por favor, verifique a assinatura e tente novamente.</translation> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation>A assinatura não corresponde ao &quot;resumo da mensagem&quot;.</translation> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation>Verificação da mensagem falhou.</translation> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation>Mensagem verificada.</translation> </message> </context> <context> <name>TrafficGraphWidget</name> <message> <location filename="../trafficgraphwidget.cpp" line="+75"/> <source>KB/s</source> <translation type="unfinished"/> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+25"/> <source>Open until %1</source> <translation>Aberto até %1</translation> </message> <message> <location line="+6"/> <source>conflicted</source> <translation>em conflito</translation> </message> <message> <location line="+2"/> <source>%1/offline</source> <translation>%1/offline</translation> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation>%1/não confirmadas</translation> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation>%1 confirmações</translation> </message> <message> <location line="+17"/> <source>Status</source> <translation>Status</translation> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation><numerusform>, difundir atráves de %n nó</numerusform><numerusform>, difundir atráves de %n nós</numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation>Data</translation> </message> <message> <location line="+7"/> <source>Source</source> <translation>Fonte</translation> </message> <message> <location line="+0"/> <source>Generated</source> <translation>Gerados</translation> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation>De</translation> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation>Para</translation> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation>seu próprio endereço</translation> </message> <message> <location line="-2"/> <source>label</source> <translation>etiqueta</translation> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation>Crédito</translation> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation><numerusform>matura em mais %n bloco</numerusform><numerusform>matura em mais %n blocos</numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation>não aceito</translation> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation>Débito</translation> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation>Taxa de transação</translation> </message> <message> <location line="+16"/> <source>Net amount</source> <translation>Valor líquido</translation> </message> <message> <location line="+6"/> <source>Message</source> <translation>Mensagem</translation> </message> <message> <location line="+2"/> <source>Comment</source> <translation>Comentário</translation> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation>ID da transação</translation> </message> <message> <location line="+3"/> <source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Debug information</source> <translation>Informação de depuração</translation> </message> <message> <location line="+8"/> <source>Transaction</source> <translation>Transação</translation> </message> <message> <location line="+5"/> <source>Inputs</source> <translation>Entradas</translation> </message> <message> <location line="+21"/> <source>Amount</source> <translation>Quantidade</translation> </message> <message> <location line="+1"/> <source>true</source> <translation>verdadeiro</translation> </message> <message> <location line="+0"/> <source>false</source> <translation>falso</translation> </message> <message> <location line="-209"/> <source>, has not been successfully broadcast yet</source> <translation>, ainda não foi propagada na rede com sucesso.</translation> </message> <message numerus="yes"> <location line="-36"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> </message> <message> <location line="+71"/> <source>unknown</source> <translation>desconhecido</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation>Detalhes da transação</translation> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation>Este painel mostra uma descrição detalhada da transação</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+231"/> <source>Date</source> <translation>Data</translation> </message> <message> <location line="+0"/> <source>Type</source> <translation>Tipo</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Endereço</translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation>Quantidade</translation> </message> <message> <location line="+52"/> <source>Open until %1</source> <translation>Aberto até %1</translation> </message> <message> <location line="+12"/> <source>Confirmed (%1 confirmations)</source> <translation>Confirmado (%1 confirmações)</translation> </message> <message numerus="yes"> <location line="-15"/> <source>Open for %n more block(s)</source> <translation><numerusform>Abrir para mais %n bloco</numerusform><numerusform>Abrir para mais %n blocos</numerusform></translation> </message> <message> <location line="+6"/> <source>Offline</source> <translation>Offline</translation> </message> <message> <location line="+3"/> <source>Unconfirmed</source> <translation>Não confirmado</translation> </message> <message> <location line="+3"/> <source>Confirming (%1 of %2 recommended confirmations)</source> <translation>Confirmando (%1 de %2 confirmações recomendadas)</translation> </message> <message> <location line="+6"/> <source>Conflicted</source> <translation>Conflitou</translation> </message> <message> <location line="+3"/> <source>Immature (%1 confirmations, will be available after %2)</source> <translation>Recém-criado (%1 confirmações, disponível somente após %2)</translation> </message> <message> <location line="+3"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation>Este bloco não foi recebido por nenhum outro participante da rede e provavelmente não será aceito!</translation> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation>Gerado mas não aceito</translation> </message> <message> <location line="+42"/> <source>Received with</source> <translation>Recebido por</translation> </message> <message> <location line="+2"/> <source>Received from</source> <translation>Recebido de</translation> </message> <message> <location line="+3"/> <source>Sent to</source> <translation>Enviado para</translation> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation>Pagamento para você mesmo</translation> </message> <message> <location line="+2"/> <source>Mined</source> <translation>Minerado</translation> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation>(n/a)</translation> </message> <message> <location line="+194"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>Status da transação. Passe o mouse sobre este campo para mostrar o número de confirmações.</translation> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation>Data e hora em que a transação foi recebida.</translation> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation>Tipo de transação.</translation> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation>Endereço de destino da transação.</translation> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation>Quantidade debitada ou creditada ao saldo.</translation> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+54"/> <location line="+17"/> <source>All</source> <translation>Todos</translation> </message> <message> <location line="-16"/> <source>Today</source> <translation>Hoje</translation> </message> <message> <location line="+1"/> <source>This week</source> <translation>Esta semana</translation> </message> <message> <location line="+1"/> <source>This month</source> <translation>Este mês</translation> </message> <message> <location line="+1"/> <source>Last month</source> <translation>Mês passado</translation> </message> <message> <location line="+1"/> <source>This year</source> <translation>Este ano</translation> </message> <message> <location line="+1"/> <source>Range...</source> <translation>Intervalo...</translation> </message> <message> <location line="+12"/> <source>Received with</source> <translation>Recebido por</translation> </message> <message> <location line="+2"/> <source>Sent to</source> <translation>Enviado para</translation> </message> <message> <location line="+2"/> <source>To yourself</source> <translation>Para você mesmo</translation> </message> <message> <location line="+1"/> <source>Mined</source> <translation>Minerado</translation> </message> <message> <location line="+1"/> <source>Other</source> <translation>Outro</translation> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation>Procure um endereço ou etiqueta</translation> </message> <message> <location line="+7"/> <source>Min amount</source> <translation>Quantidade mínima</translation> </message> <message> <location line="+34"/> <source>Copy address</source> <translation>Copiar endereço</translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>Copiar etiqueta</translation> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation>Copiar quantia</translation> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation>Copiar ID da transação</translation> </message> <message> <location line="+1"/> <source>Edit label</source> <translation>Editar etiqueta</translation> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation>Mostrar detalhes da transação</translation> </message> <message> <location line="+138"/> <source>Export Transaction Data</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Arquivo separado por vírgulas (*. csv)</translation> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation>Confirmado</translation> </message> <message> <location line="+1"/> <source>Date</source> <translation>Data</translation> </message> <message> <location line="+1"/> <source>Type</source> <translation>Tipo</translation> </message> <message> <location line="+1"/> <source>Label</source> <translation>Etiqueta</translation> </message> <message> <location line="+1"/> <source>Address</source> <translation>Endereço</translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation>Quantidade</translation> </message> <message> <location line="+1"/> <source>ID</source> <translation>ID</translation> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <source>Range:</source> <translation>Intervalo: </translation> </message> <message> <location line="+8"/> <source>to</source> <translation>para</translation> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+208"/> <source>Sending...</source> <translation type="unfinished"/> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+173"/> <source>Vibranium version</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Usage:</source> <translation>Uso:</translation> </message> <message> <location line="+1"/> <source>Send command to -server or Vibraniumd</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>List commands</source> <translation>Lista de comandos</translation> </message> <message> <location line="+1"/> <source>Get help for a command</source> <translation>Obtenha ajuda sobre um comando</translation> </message> <message> <location line="-147"/> <source>Options:</source> <translation>Opções:</translation> </message> <message> <location line="+2"/> <source>Specify configuration file (default: Vibranium.conf)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Specify pid file (default: Vibraniumd.pid)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify wallet file (within data directory)</source> <translation>Especifique o arquivo da carteira (dentro do diretório de dados)</translation> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation>Especificar diretório de dados</translation> </message> <message> <location line="-25"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=Vibraniumrpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. It is also recommended to set alertnotify so you are notified of problems; for example: alertnotify=echo %%s | mail -s &quot;Vibranium Alert&quot; [email protected] </source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>Definir o tamanho do cache do banco de dados em megabytes (padrão: 25)</translation> </message> <message> <location line="+1"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Listen for connections on &lt;port&gt; (default: 15714 or testnet: 25714)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>Manter no máximo &lt;n&gt; conexões aos peers (padrão: 125)</translation> </message> <message> <location line="+3"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>Conectar a um nó para receber endereços de participantes, e desconectar.</translation> </message> <message> <location line="+1"/> <source>Specify your own public address</source> <translation>Especificar seu próprio endereço público</translation> </message> <message> <location line="+4"/> <source>Bind to given address. Use [host]:port notation for IPv6</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Always query for peer addresses via DNS lookup (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation>Limite para desconectar peers mal comportados (padrão: 100)</translation> </message> <message> <location line="+1"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>Número de segundos para impedir que peers mal comportados reconectem (padrão: 86400)</translation> </message> <message> <location line="-37"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation>Um erro ocorreu ao configurar a porta RPC %u para escuta em IPv4: %s</translation> </message> <message> <location line="+65"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 15715 or testnet: 25715)</source> <translation type="unfinished"/> </message> <message> <location line="-17"/> <source>Accept command line and JSON-RPC commands</source> <translation>Aceitar linha de comando e comandos JSON-RPC</translation> </message> <message> <location line="+1"/> <source>Run in the background as a daemon and accept commands</source> <translation>Rodar em segundo plano como serviço e aceitar comandos</translation> </message> <message> <location line="+1"/> <source>Use the test network</source> <translation>Usar rede de teste</translation> </message> <message> <location line="-24"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation>Aceitar conexões externas (padrão: 1 se opções -proxy ou -connect não estiverem presentes)</translation> </message> <message> <location line="-29"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation>Um erro ocorreu ao configurar a porta RPC %u para escuta em IPv6, voltando ao IPv4: %s</translation> </message> <message> <location line="+96"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation>Cuidado: valor de -paytxfee escolhido é muito alto! Este é o valor da taxa de transação que você irá pagar se enviar a transação.</translation> </message> <message> <location line="-103"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong Vibranium will not work properly.</source> <translation type="unfinished"/> </message> <message> <location line="+132"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation>Cuidado: erro ao ler arquivo wallet.dat! Todas as chaves foram lidas corretamente, mas dados transações e do catálogo de endereços podem estar faltando ou estar incorretas.</translation> </message> <message> <location line="-18"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation>Aviso: wallet.dat corrompido, dados recuperados! Arquivo wallet.dat original salvo como wallet.{timestamp}.bak em %s; se seu saldo ou transações estiverem incorretos, você deve restauras o backup.</translation> </message> <message> <location line="-31"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation>Tentar recuperar chaves privadas de um arquivo wallet.dat corrompido</translation> </message> <message> <location line="+5"/> <source>Block creation options:</source> <translation>Opções de criação de blocos:</translation> </message> <message> <location line="-69"/> <source>Connect only to the specified node(s)</source> <translation>Conectar apenas a nó(s) específico(s)</translation> </message> <message> <location line="+4"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation>Descobrir os próprios endereços IP (padrão: 1 quando no modo listening e opção -externalip não estiver presente)</translation> </message> <message> <location line="+101"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation>Falha ao escutar em qualquer porta. Use -listen=0 se você quiser isso.</translation> </message> <message> <location line="-91"/> <source>Sync checkpoints policy (default: strict)</source> <translation type="unfinished"/> </message> <message> <location line="+89"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Invalid amount for -reservebalance=&lt;amount&gt;</source> <translation type="unfinished"/> </message> <message> <location line="-88"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation>Buffer máximo de recebimento por conexão, &lt;n&gt;*1000 bytes (padrão: 5000)</translation> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation>Buffer máximo de envio por conexão, &lt;n&gt;*1000 bytes (padrão: 1000)</translation> </message> <message> <location line="-17"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation>Apenas conectar em nós na rede &lt;net&gt; (IPv4, IPv6, ou Tor)</translation> </message> <message> <location line="+31"/> <source>Prepend debug output with timestamp</source> <translation type="unfinished"/> </message> <message> <location line="+41"/> <source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source> <translation>Opções SSL: (veja a Wiki do Bitcoin para instruções de configuração SSL)</translation> </message> <message> <location line="-81"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation>Mandar informação de trace/debug para o console em vez de para o arquivo debug.log</translation> </message> <message> <location line="+5"/> <source>Send trace/debug info to debugger</source> <translation type="unfinished"/> </message> <message> <location line="+30"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation>Determinar tamanho mínimo de bloco em bytes (padrão: 0)</translation> </message> <message> <location line="-35"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation>Encolher arquivo debug.log ao iniciar o cliente (padrão 1 se opção -debug não estiver presente)</translation> </message> <message> <location line="-43"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation>Especifique o tempo limite (timeout) da conexão em milissegundos (padrão: 5000) </translation> </message> <message> <location line="+116"/> <source>Unable to sign checkpoint, wrong checkpointkey? </source> <translation type="unfinished"/> </message> <message> <location line="-86"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation>Usar UPnP para mapear porta de escuta (padrão: 0)</translation> </message> <message> <location line="-1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation>Usar UPnP para mapear porta de escuta (padrão: 1 quando estiver escutando)</translation> </message> <message> <location line="-26"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation type="unfinished"/> </message> <message> <location line="+47"/> <source>Username for JSON-RPC connections</source> <translation>Nome de usuário para conexões JSON-RPC</translation> </message> <message> <location line="+51"/> <source>Verifying database integrity...</source> <translation type="unfinished"/> </message> <message> <location line="+44"/> <source>Error: Wallet locked, unable to create transaction!</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Error: Transaction creation failed!</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>WARNING: syncronized checkpoint violation detected, but skipped!</source> <translation type="unfinished"/> </message> <message> <location line="-1"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation>Cuidado: Esta versão está obsoleta, atualização exigida!</translation> </message> <message> <location line="-54"/> <source>wallet.dat corrupt, salvage failed</source> <translation>wallet.dat corrompido, recuperação falhou</translation> </message> <message> <location line="-56"/> <source>Password for JSON-RPC connections</source> <translation>Senha para conexões JSON-RPC</translation> </message> <message> <location line="-32"/> <source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source> <translation type="unfinished"/> </message> <message> <location line="+6"/> <source>Output debugging information (default: 0, supplying &lt;category&gt; is optional)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>If &lt;category&gt; is not supplied, output all debugging information.</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>&lt;category&gt; can be:</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>Permitir conexões JSON-RPC de endereços IP específicos</translation> </message> <message> <location line="+1"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation>Enviar comando para nó rodando em &lt;ip&gt; (pardão: 127.0.0.1)</translation> </message> <message> <location line="+1"/> <source>Wait for RPC server to start</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Set the number of threads to service RPC calls (default: 4)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>Executar comando quando o melhor bloco mudar (%s no comando será substituído pelo hash do bloco)</translation> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation>Executar comando quando uma transação da carteira mudar (%s no comando será substituído por TxID)</translation> </message> <message> <location line="+3"/> <source>Require a confirmations for change (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Upgrade wallet to latest format</source> <translation>Atualizar carteira para o formato mais recente</translation> </message> <message> <location line="+1"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation>Determinar tamanho do pool de endereços para &lt;n&gt; (padrão: 100)</translation> </message> <message> <location line="+1"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>Re-escanear blocos procurando por transações perdidas da carteira</translation> </message> <message> <location line="+3"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Imports blocks from external blk000?.dat file</source> <translation type="unfinished"/> </message> <message> <location line="+9"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>Usar OpenSSL (https) para conexões JSON-RPC</translation> </message> <message> <location line="+1"/> <source>Server certificate file (default: server.cert)</source> <translation>Arquivo de certificado do servidor (padrão: server.cert)</translation> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation>Chave privada do servidor (padrão: server.pem)</translation> </message> <message> <location line="+10"/> <source>Initialization sanity check failed. Vibranium is shutting down.</source> <translation type="unfinished"/> </message> <message> <location line="+50"/> <source>Error: Wallet unlocked for staking only, unable to create transaction.</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Error: Disk space is low!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source> <translation type="unfinished"/> </message> <message> <location line="-174"/> <source>This help message</source> <translation>Esta mensagem de ajuda</translation> </message> <message> <location line="+104"/> <source>Wallet %s resides outside data directory %s.</source> <translation type="unfinished"/> </message> <message> <location line="+37"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation>Impossível vincular a %s neste computador (bind retornou erro %d, %s)</translation> </message> <message> <location line="-133"/> <source>Connect through socks proxy</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation>Permitir consultas DNS para -addnode, -seednode e -connect</translation> </message> <message> <location line="+126"/> <source>Loading addresses...</source> <translation>Carregando endereços...</translation> </message> <message> <location line="-12"/> <source>Error loading blkindex.dat</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>Erro ao carregar wallet.dat: Carteira corrompida</translation> </message> <message> <location line="+4"/> <source>Error loading wallet.dat: Wallet requires newer version of Vibranium</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Wallet needed to be rewritten: restart Vibranium to complete</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading wallet.dat</source> <translation>Erro ao carregar wallet.dat</translation> </message> <message> <location line="-16"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation>Endereço -proxy inválido: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation>Rede desconhecida especificada em -onlynet: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation>Versão desconhecida do proxy -socks requisitada: %i</translation> </message> <message> <location line="+4"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation>Impossível encontrar o endereço -bind: &apos;%s&apos;</translation> </message> <message> <location line="+2"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation>Impossível encontrar endereço -externalip: &apos;%s&apos;</translation> </message> <message> <location line="-23"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>Quantidade inválida para -paytxfee=&lt;quantidade&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+60"/> <source>Sending...</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Invalid amount</source> <translation>Quantidade inválida</translation> </message> <message> <location line="+1"/> <source>Insufficient funds</source> <translation>Saldo insuficiente</translation> </message> <message> <location line="-40"/> <source>Loading block index...</source> <translation>Carregando índice de blocos...</translation> </message> <message> <location line="-110"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Adicionar um nó com o qual se conectar e tentar manter a conexão ativa</translation> </message> <message> <location line="+125"/> <source>Unable to bind to %s on this computer. Vibranium is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="-101"/> <source>Fee per KB to add to transactions you send</source> <translation type="unfinished"/> </message> <message> <location line="+34"/> <source>Minimize weight consumption (experimental) (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>How many blocks to check at startup (default: 500, 0 = all)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Keep at most &lt;n&gt; unconnectable blocks in memory (default: %u)</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: Deprecated argument -debugnet ignored, use -debug=net</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Invalid amount for -mininput=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Cannot obtain a lock on data directory %s. Vibranium is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error initializing wallet database environment %s!</source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>Loading wallet...</source> <translation>Carregando carteira...</translation> </message> <message> <location line="+8"/> <source>Cannot downgrade wallet</source> <translation>Não é possível fazer downgrade da carteira</translation> </message> <message> <location line="+1"/> <source>Cannot write default address</source> <translation>Não foi possível escrever no endereço padrão</translation> </message> <message> <location line="+1"/> <source>Rescanning...</source> <translation>Re-escaneando...</translation> </message> <message> <location line="+2"/> <source>Done loading</source> <translation>Carregamento terminado</translation> </message> <message> <location line="-161"/> <source>To use the %s option</source> <translation>Para usar a opção %s</translation> </message> <message> <location line="+188"/> <source>Error</source> <translation>Erro</translation> </message> <message> <location line="-18"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation>Você precisa especificar rpcpassword=&lt;senha&gt; no arquivo de configurações:⏎ %s⏎ Se o arquivo não existir, crie um com permissão de leitura apenas pelo dono</translation> </message> </context> </TS>
{'content_hash': '6315129504c8e273e947bd61d9f777e6', 'timestamp': '', 'source': 'github', 'line_count': 3368, 'max_line_length': 395, 'avg_line_length': 36.19210213776722, 'alnum_prop': 0.6111817547889578, 'repo_name': 'Viecoin/Vibranium', 'id': '756193f233303c77f873dcd51fa2e4bf080d1193', 'size': '122351', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/qt/locale/bitcoin_pt_BR.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Assembly', 'bytes': '51312'}, {'name': 'C', 'bytes': '105166'}, {'name': 'C++', 'bytes': '4368931'}, {'name': 'CSS', 'bytes': '1127'}, {'name': 'HTML', 'bytes': '50620'}, {'name': 'Makefile', 'bytes': '11753'}, {'name': 'NSIS', 'bytes': '5914'}, {'name': 'Objective-C', 'bytes': '858'}, {'name': 'Objective-C++', 'bytes': '3517'}, {'name': 'Python', 'bytes': '54355'}, {'name': 'QMake', 'bytes': '17698'}, {'name': 'Shell', 'bytes': '8509'}]}
<?php ######################################################### # Deutsches Sprachpaket (Informell) # # Version 1.6 # # Datum: 03.08.2010 # # MyBB-Version 1.6 # # Autor: MyBBoard.de | Webseite: http://www.mybboard.de # # (c) 2005-2010 MyBBoard.de | Alle Rechte vorbehalten! # # # # Die Lizenz/Nutzungsbedingungen finden Sie in der # # beiliegenden Readme. # ######################################################### $l['user_titles'] = "Benutzertitel"; $l['user_titles_desc'] = "Dieser Bereich erlaubt dir, die Benutzertitel zu verwalten. Die Benutzertitel werden anhand der Beitragszahl den Benutzern zugewiesen und erlauben bei Benutzern mit einer bestimmten Beitragsanzahl ein eigenes Sternenbild anzuzeigen."; $l['add_new_user_title'] = "Neuen Benutzertitel hinzufügen"; $l['add_new_user_title_desc'] = "Dieser Bereich erlaubt dir, neue Benutzertitel zu erstellen. <i>Hinweis: Dies ist <strong>nicht</strong> das <u><a href=\"index.php?module=user/group_promotions\">Benutzergruppen-Beförderungs-System.</a></u></i>"; $l['error_missing_title'] = "Du hast keinen Titel für diesen Benutzertitel eingegeben"; $l['error_missing_posts'] = "Du hast keine minimale Beitragsanzahl für diesen Benutzertitel eingegeben"; $l['error_invalid_user_title'] = "Du hast einen ungültigen Benutzertitel ausgewählt"; $l['success_user_title_created'] = "Der neue Benutzertitel wurde erfolgreich erstellt."; $l['success_user_title_updated'] = "Der Benutzertitel wurde erfolgreich aktualisiert."; $l['success_user_title_deleted'] = "Der ausgewählte Benutzertitel wurde erfolgreich gelöscht."; $l['title_to_assign'] = "Titel"; $l['title_to_assign_desc'] = "Dieser Titel wird unter dem Benutzernamen gezeigt, wenn du keinen eigenen Benutzertitel eingegeben hast."; $l['minimum_posts'] = "Minimale Beitragsanzahl"; $l['minimum_posts_desc'] = "Die minimale Zahl an Beiträgen, die Benutzer haben müssen, um diesen Titel zugewiesen zu bekommen."; $l['number_of_stars'] = "Anzahl der Sterne"; $l['number_of_stars_desc'] = "Gib die Anzahl an Sternen ein, die unter dem Benutzernamen angezeigt werden sollen (0 = keine Sterne)."; $l['star_image'] = "Sternenbild"; $l['star_image_desc'] = "Wenn der Benutzertitel Sterne einzeigen soll, gib hier den Pfad zum Sternenbild ein. Wenn leer, wird das Sternenbild der Gruppe verwendet. Benutze {theme}, um bei jedem Theme andere Sterne anzuzeigen."; $l['save_user_title'] = "Benutzertitel speichern"; $l['edit_user_title'] = "Benutzertitel bearbeiten"; $l['edit_user_title_desc'] = "Dieser Bereich erlaubt dir, einen Benutzertitel zu bearbeiten."; $l['user_title_deletion_confirmation'] = "Willst du diesen Benutzertitel wirklich löschen?"; $l['manage_user_titles'] = "Benutzertitel verwalten"; $l['user_title'] = "Benutzertitel"; $l['no_user_titles'] = "Es wurden bisher keine Benutzertitel definiert"; ?>
{'content_hash': '009add778595b9d2ed00bad7b23de8e4', 'timestamp': '', 'source': 'github', 'line_count': 43, 'max_line_length': 260, 'avg_line_length': 72.02325581395348, 'alnum_prop': 0.6509525347110107, 'repo_name': 'Flauschbaellchen/florensia-base', 'id': '5d5a838fddc054f562a469027a430840868a490f', 'size': '3108', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'forum/inc/languages/deutsch_du/admin/user_titles.lang.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ApacheConf', 'bytes': '10211'}, {'name': 'CSS', 'bytes': '78009'}, {'name': 'HTML', 'bytes': '174969'}, {'name': 'JavaScript', 'bytes': '699138'}, {'name': 'Makefile', 'bytes': '234'}, {'name': 'PHP', 'bytes': '43765928'}, {'name': 'Perl', 'bytes': '3172'}, {'name': 'Ruby', 'bytes': '113191'}, {'name': 'Shell', 'bytes': '218'}]}
require 'test_helper' class ChecklistsHelperTest < ActionView::TestCase end
{'content_hash': '407e83005a866ef8b8337e226fecbbb4', 'timestamp': '', 'source': 'github', 'line_count': 4, 'max_line_length': 49, 'avg_line_length': 19.25, 'alnum_prop': 0.8181818181818182, 'repo_name': 'cdebortoli/scpm', 'id': 'e42909150fbc1394c7f0390a4900140de4754902', 'size': '77', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'test/unit/helpers/checklists_helper_test.rb', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'CSS', 'bytes': '106615'}, {'name': 'JavaScript', 'bytes': '663978'}, {'name': 'Ruby', 'bytes': '626968'}, {'name': 'Shell', 'bytes': '459'}]}
// WARNING: This is an internal header file, included by other C++ // standard library headers. You should not attempt to use this header // file directly. #ifndef _STLP_INTERNAL_COLLATE_H #define _STLP_INTERNAL_COLLATE_H #ifndef _STLP_C_LOCALE_H # include <stl/c_locale.h> #endif #ifndef _STLP_INTERNAL_LOCALE_H # include <stl/_locale.h> #endif #ifndef _STLP_INTERNAL_STRING_H # include <stl/_string.h> #endif _STLP_BEGIN_NAMESPACE template <class _CharT> class collate {}; template <class _CharT> class collate_byname {}; _STLP_TEMPLATE_NULL class _STLP_CLASS_DECLSPEC collate<char> : public locale::facet { public: typedef char char_type; typedef string string_type; explicit collate(size_t __refs = 0) : locale::facet(__refs) {} int compare(const char* __low1, const char* __high1, const char* __low2, const char* __high2) const { return do_compare( __low1, __high1, __low2, __high2); } string_type transform(const char* __low, const char* __high) const { return do_transform(__low, __high); } long hash(const char* __low, const char* __high) const { return do_hash(__low, __high); } static _STLP_STATIC_DECLSPEC locale::id id; protected: ~collate(); virtual int do_compare(const char*, const char*, const char*, const char*) const; virtual string_type do_transform(const char*, const char*) const; virtual long do_hash(const char*, const char*) const; private: collate(const collate<char>&); collate<char>& operator =(const collate<char>&); }; # ifndef _STLP_NO_WCHAR_T _STLP_TEMPLATE_NULL class _STLP_CLASS_DECLSPEC collate<wchar_t> : public locale::facet { public: typedef wchar_t char_type; typedef wstring string_type; explicit collate(size_t __refs = 0) : locale::facet(__refs) {} int compare(const wchar_t* __low1, const wchar_t* __high1, const wchar_t* __low2, const wchar_t* __high2) const { return do_compare( __low1, __high1, __low2, __high2); } string_type transform(const wchar_t* __low, const wchar_t* __high) const { return do_transform(__low, __high); } long hash(const wchar_t* __low, const wchar_t* __high) const { return do_hash(__low, __high); } static _STLP_STATIC_DECLSPEC locale::id id; protected: ~collate(); virtual int do_compare(const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*) const; virtual string_type do_transform(const wchar_t*, const wchar_t*) const; virtual long do_hash(const wchar_t* __low, const wchar_t* __high) const; private: collate(const collate<wchar_t>&); collate<wchar_t>& operator = (const collate<wchar_t>&); }; # endif /* NO_WCHAR_T */ _STLP_TEMPLATE_NULL class _STLP_CLASS_DECLSPEC collate_byname<char>: public collate<char> { friend class _Locale_impl; public: explicit collate_byname(const char* __name, size_t __refs = 0); protected: ~collate_byname(); virtual int do_compare(const char*, const char*, const char*, const char*) const; virtual string_type do_transform(const char*, const char*) const; private: collate_byname(_Locale_collate *__coll) : _M_collate(__coll) {} _Locale_collate* _M_collate; collate_byname(const collate_byname<char>&); collate_byname<char>& operator =(const collate_byname<char>&); }; # ifndef _STLP_NO_WCHAR_T _STLP_TEMPLATE_NULL class _STLP_CLASS_DECLSPEC collate_byname<wchar_t>: public collate<wchar_t> { friend class _Locale_impl; public: explicit collate_byname(const char * __name, size_t __refs = 0); protected: ~collate_byname(); virtual int do_compare(const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*) const; virtual string_type do_transform(const wchar_t*, const wchar_t*) const; private: collate_byname(_Locale_collate *__coll) : _M_collate(__coll) {} _Locale_collate* _M_collate; collate_byname(const collate_byname<wchar_t>&); collate_byname<wchar_t>& operator =(const collate_byname<wchar_t>&); }; # endif /* NO_WCHAR_T */ template <class _CharT, class _Traits, class _Alloc> bool __locale_do_operator_call (const locale& __loc, const basic_string<_CharT, _Traits, _Alloc>& __x, const basic_string<_CharT, _Traits, _Alloc>& __y) { collate<_CharT> const& __coll = use_facet<collate<_CharT> >(__loc); return __coll.compare(__x.data(), __x.data() + __x.size(), __y.data(), __y.data() + __y.size()) < 0; } _STLP_END_NAMESPACE #endif /* _STLP_INTERNAL_COLLATE_H */ // Local Variables: // mode:C++ // End:
{'content_hash': 'a03d52b31afca16ea2543a574d125627', 'timestamp': '', 'source': 'github', 'line_count': 160, 'max_line_length': 78, 'avg_line_length': 28.80625, 'alnum_prop': 0.6465610761553482, 'repo_name': 'yongjhih/android_tools', 'id': '4384f2e92074c17ef2983e283caea871567639fd', 'size': '5210', 'binary': False, 'copies': '68', 'ref': 'refs/heads/master', 'path': 'ndk/sources/cxx-stl/stlport/stlport/stl/_collate.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'AppleScript', 'bytes': '18418'}, {'name': 'Assembly', 'bytes': '24557'}, {'name': 'Awk', 'bytes': '50769'}, {'name': 'C', 'bytes': '39685410'}, {'name': 'C++', 'bytes': '12962616'}, {'name': 'CSS', 'bytes': '5064'}, {'name': 'Emacs Lisp', 'bytes': '4737'}, {'name': 'IDL', 'bytes': '31867'}, {'name': 'Java', 'bytes': '2439907'}, {'name': 'JavaScript', 'bytes': '27699'}, {'name': 'Objective-C', 'bytes': '67267'}, {'name': 'Perl', 'bytes': '23717225'}, {'name': 'Python', 'bytes': '112279'}, {'name': 'Shell', 'bytes': '632979'}, {'name': 'TypeScript', 'bytes': '12540164'}, {'name': 'XC', 'bytes': '278878'}]}
package org.apache.hadoop.cli.util; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.PrintStream; import java.util.StringTokenizer; import org.apache.hadoop.cli.TestCLI; import org.apache.hadoop.cli.util.CLITestData.TestCmd; import org.apache.hadoop.cli.util.CLITestData.TestCmd.CommandType; import org.apache.hadoop.fs.FsShell; import org.apache.hadoop.hdfs.tools.DFSAdmin; import org.apache.hadoop.mapred.tools.MRAdmin; import org.apache.hadoop.util.ToolRunner; /** * * This class executed commands and captures the output */ public class CommandExecutor { private static String commandOutput = null; private static int exitCode = 0; private static Exception lastException = null; private static String cmdExecuted = null; private static String[] getCommandAsArgs(final String cmd, final String masterKey, final String master) { StringTokenizer tokenizer = new StringTokenizer(cmd, " "); String[] args = new String[tokenizer.countTokens()]; int i = 0; while (tokenizer.hasMoreTokens()) { args[i] = tokenizer.nextToken(); args[i] = args[i].replaceAll(masterKey, master); args[i] = args[i].replaceAll("CLITEST_DATA", new File(TestCLI.TEST_CACHE_DATA_DIR). toURI().toString().replace(' ', '+')); args[i] = args[i].replaceAll("TEST_DIR_ABSOLUTE", TestCLI.TEST_DIR_ABSOLUTE); args[i] = args[i].replaceAll("USERNAME", System.getProperty("user.name")); i++; } return args; } public static int executeCommand(final TestCmd cmd, final String namenode, final String jobtracker) throws Exception { switch(cmd.getType()) { case DFSADMIN: return CommandExecutor.executeDFSAdminCommand(cmd.getCmd(), namenode); case MRADMIN: return CommandExecutor.executeMRAdminCommand(cmd.getCmd(), jobtracker); case FS: return CommandExecutor.executeFSCommand(cmd.getCmd(), namenode); default: throw new Exception("Unknow type of Test command:"+ cmd.getType()); } } public static int executeDFSAdminCommand(final String cmd, final String namenode) { exitCode = 0; ByteArrayOutputStream bao = new ByteArrayOutputStream(); PrintStream origOut = System.out; PrintStream origErr = System.err; System.setOut(new PrintStream(bao)); System.setErr(new PrintStream(bao)); DFSAdmin shell = new DFSAdmin(); String[] args = getCommandAsArgs(cmd, "NAMENODE", namenode); cmdExecuted = cmd; try { ToolRunner.run(shell, args); } catch (Exception e) { e.printStackTrace(); lastException = e; exitCode = -1; } finally { System.setOut(origOut); System.setErr(origErr); } commandOutput = bao.toString(); return exitCode; } public static int executeMRAdminCommand(final String cmd, final String jobtracker) { exitCode = 0; ByteArrayOutputStream bao = new ByteArrayOutputStream(); PrintStream origOut = System.out; PrintStream origErr = System.err; System.setOut(new PrintStream(bao)); System.setErr(new PrintStream(bao)); MRAdmin mradmin = new MRAdmin(); String[] args = getCommandAsArgs(cmd, "JOBTRACKER", jobtracker); cmdExecuted = cmd; try { ToolRunner.run(mradmin, args); } catch (Exception e) { e.printStackTrace(); lastException = e; exitCode = -1; } finally { System.setOut(origOut); System.setErr(origErr); } commandOutput = bao.toString(); return exitCode; } public static int executeFSCommand(final String cmd, final String namenode) { exitCode = 0; ByteArrayOutputStream bao = new ByteArrayOutputStream(); PrintStream origOut = System.out; PrintStream origErr = System.err; System.setOut(new PrintStream(bao)); System.setErr(new PrintStream(bao)); FsShell shell = new FsShell(); String[] args = getCommandAsArgs(cmd, "NAMENODE", namenode); cmdExecuted = cmd; try { ToolRunner.run(shell, args); } catch (Exception e) { e.printStackTrace(); lastException = e; exitCode = -1; } finally { System.setOut(origOut); System.setErr(origErr); } commandOutput = bao.toString(); return exitCode; } public static String getLastCommandOutput() { return commandOutput; } public static int getLastExitCode() { return exitCode; } public static Exception getLastException() { return lastException; } public static String getLastCommand() { return cmdExecuted; } }
{'content_hash': '7446d215a69acc9d5dc01f318688115a', 'timestamp': '', 'source': 'github', 'line_count': 172, 'max_line_length': 85, 'avg_line_length': 28.02906976744186, 'alnum_prop': 0.6442646753785521, 'repo_name': 'YuMatsuzawa/HadoopEclipseProject', 'id': 'dafd2e111919437c7843afd0b0281ede11720219', 'size': '5627', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'hadoop-0.20.2-cdh3u5/src/test/org/apache/hadoop/cli/util/CommandExecutor.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'AspectJ', 'bytes': '129594'}, {'name': 'C', 'bytes': '959528'}, {'name': 'C++', 'bytes': '808438'}, {'name': 'CSS', 'bytes': '86078'}, {'name': 'Java', 'bytes': '32496084'}, {'name': 'JavaScript', 'bytes': '118244'}, {'name': 'Objective-C', 'bytes': '236546'}, {'name': 'PHP', 'bytes': '305110'}, {'name': 'Perl', 'bytes': '280784'}, {'name': 'Python', 'bytes': '2325852'}, {'name': 'Ruby', 'bytes': '56970'}, {'name': 'Shell', 'bytes': '2771110'}, {'name': 'Smalltalk', 'bytes': '113124'}, {'name': 'TeX', 'bytes': '51520'}, {'name': 'XSLT', 'bytes': '19116'}]}
import {listenOncePromise} from '../../src/event-helper'; import { ampdocServiceFor, videoManagerForDoc, viewerForDoc, } from '../../src/services'; import {isLayoutSizeDefined} from '../../src/layout'; import {PlayingStates, VideoEvents} from '../../src/video-interface'; import { installVideoManagerForDoc, supportsAutoplay, clearSupportsAutoplayCacheForTesting, } from '../../src/service/video-manager-impl'; import { runVideoPlayerIntegrationTests, } from '../integration/test-video-players-helper'; import * as sinon from 'sinon'; describe('Fake Video Player Integration Tests', () => { // We run the video player integration tests on a fake video player as part // of functional testing. Same tests run on real video players such as // `amp-video` and `amp-youtube` as part of integration testing. runVideoPlayerIntegrationTests(fixture => { fixture.win.AMP.registerElement('amp-test-fake-videoplayer', createFakeVideoPlayerClass(fixture.win)); return fixture.doc.createElement('amp-test-fake-videoplayer'); }); }); describes.fakeWin('VideoManager', { amp: { ampdoc: 'single', }, }, env => { let sandbox; let videoManager; let klass; let video; let impl; it('should register common actions', () => { const spy = sandbox.spy(impl, 'registerAction'); videoManager.register(impl); expect(spy).to.have.been.calledWith('play'); expect(spy).to.have.been.calledWith('pause'); expect(spy).to.have.been.calledWith('mute'); expect(spy).to.have.been.calledWith('unmute'); }); it('should be paused if autoplay is not set', () => { videoManager.register(impl); const entry = videoManager.getEntryForVideo_(impl); entry.isVisible_ = false; const curState = videoManager.getPlayingState(impl); expect(curState).to.equal(PlayingStates.PAUSED); }); it('autoplay - should be PLAYING_MANUAL if user interacted', () => { video.setAttribute('autoplay', ''); videoManager.register(impl); const entry = videoManager.getEntryForVideo_(impl); entry.userInteractedWithAutoPlay_ = true; entry.isVisible_ = true; entry.loaded_ = true; impl.play(); return listenOncePromise(video, VideoEvents.PLAYING).then(() => { const curState = videoManager.getPlayingState(impl); expect(curState).to.equal(PlayingStates.PLAYING_MANUAL); }); }); it('autoplay - should be PLAYING_AUTO if user did not interact', () => { video.setAttribute('autoplay', ''); videoManager.register(impl); const visibilityStub = sandbox.stub(viewerForDoc(env.ampdoc), 'isVisible'); visibilityStub.onFirstCall().returns(true); const entry = videoManager.getEntryForVideo_(impl); entry.isVisible_ = true; entry.loaded_ = true; entry.videoVisibilityChanged_(); return listenOncePromise(video, VideoEvents.PLAYING).then(() => { const curState = videoManager.getPlayingState(impl); expect(curState).to.equal(PlayingStates.PLAYING_AUTO); }); }); it('autoplay - autoplay not supported should behave like manual play', () => { video.setAttribute('autoplay', ''); videoManager.register(impl); const visibilityStub = sandbox.stub(viewerForDoc(env.ampdoc), 'isVisible'); visibilityStub.onFirstCall().returns(true); const entry = videoManager.getEntryForVideo_(impl); const supportsAutoplayStub = sandbox.stub(entry, 'boundSupportsAutoplay_'); supportsAutoplayStub.returns(Promise.reject()); entry.isVisible_ = true; entry.loaded_ = true; entry.videoVisibilityChanged_(); return new Promise(function(resolve, reject) { listenOncePromise(video, VideoEvents.PLAYING).then(() => { reject(); }); setTimeout(function() { const curState = videoManager.getPlayingState(impl); expect(curState).to.equal(PlayingStates.PAUSED); resolve('Video did not autoplay as expected'); }, 1000); }); }); it('autoplay - should be PAUSED if pause after playing', () => { video.setAttribute('autoplay', ''); videoManager.register(impl); impl.play(); const entry = videoManager.getEntryForVideo_(impl); entry.userInteractedWithAutoPlay_ = true; entry.isVisible_ = false; impl.pause(); return listenOncePromise(video, VideoEvents.PAUSE).then(() => { const curState = videoManager.getPlayingState(impl); expect(curState).to.equal(PlayingStates.PAUSED); }); }); it('autoplay - initially there should be no user interaction', () => { video.setAttribute('autoplay', ''); videoManager.register(impl); const entry = videoManager.getEntryForVideo_(impl); entry.isVisible_ = false; const userInteracted = videoManager.userInteractedWithAutoPlay(impl); expect(userInteracted).to.be.false; }); it('autoplay - PAUSED if autoplaying and video is outside of view', () => { video.setAttribute('autoplay', ''); videoManager.register(impl); const visibilityStub = sandbox.stub(viewerForDoc(env.ampdoc), 'isVisible'); visibilityStub.onFirstCall().returns(true); const entry = videoManager.getEntryForVideo_(impl); entry.isVisible_ = true; entry.loaded_ = true; entry.videoVisibilityChanged_(); entry.isVisible_ = false; entry.videoVisibilityChanged_(); const curState = videoManager.getPlayingState(impl); expect(curState).to.equal(PlayingStates.PAUSED); }); it(`no autoplay - should be paused if the user pressed pause after playing`, () => { videoManager.register(impl); const entry = videoManager.getEntryForVideo_(impl); entry.isVisible_ = false; impl.play(); return listenOncePromise(video, VideoEvents.PLAYING).then(() => { impl.pause(); listenOncePromise(video, VideoEvents.PAUSE).then(() => { const curState = videoManager.getPlayingState(impl); expect(curState).to.equal(PlayingStates.PAUSED); }); }); }); it('no autoplay - should be playing manual whenever video is playing', () => { videoManager.register(impl); const entry = videoManager.getEntryForVideo_(impl); entry.isVisible_ = false; impl.play(); return listenOncePromise(video, VideoEvents.PLAYING).then(() => { const curState = videoManager.getPlayingState(impl); expect(curState).to.equal(PlayingStates.PLAYING_MANUAL); }); }); beforeEach(() => { sandbox = sinon.sandbox.create(); klass = createFakeVideoPlayerClass(env.win); video = env.createAmpElement('amp-test-fake-videoplayer', klass); impl = video.implementation_; installVideoManagerForDoc(env.ampdoc); videoManager = videoManagerForDoc(env.ampdoc); }); afterEach(() => { sandbox.restore(); }); }); describe('Supports Autoplay', () => { let sandbox; let win; let video; let isLite; let createElementSpy; let setAttributeSpy; let playStub; it('should create an invisible test video element', () => { return supportsAutoplay(win, isLite).then(() => { expect(video.style.position).to.equal('fixed'); expect(video.style.top).to.equal('0'); expect(video.style.width).to.equal('0'); expect(video.style.height).to.equal('0'); expect(video.style.opacity).to.equal('0'); expect(setAttributeSpy).to.have.been.calledWith('muted', ''); expect(setAttributeSpy).to.have.been.calledWith('playsinline', ''); expect(setAttributeSpy).to.have.been.calledWith('webkit-playsinline', ''); expect(setAttributeSpy).to.have.been.calledWith('height', '0'); expect(setAttributeSpy).to.have.been.calledWith('width', '0'); expect(video.muted).to.be.true; expect(video.playsinline).to.be.true; expect(video.webkitPlaysinline).to.be.true; expect(createElementSpy.called).to.be.true; }); }); it('should return false if `paused` is true after `play()` call', () => { video.paused = true; return supportsAutoplay(win, isLite).then(supportsAutoplay => { expect(supportsAutoplay).to.be.false; expect(playStub.called).to.be.true; expect(createElementSpy.called).to.be.true; }); }); it('should return true if `paused` is false after `play()` call', () => { video.paused = false; return supportsAutoplay(win, isLite).then(supportsAutoplay => { expect(supportsAutoplay).to.be.true; expect(playStub.called).to.be.true; expect(createElementSpy.called).to.be.true; }); }); it('should suppress errors if detection play call throws', () => { playStub.throws(); video.paused = true; expect(supportsAutoplay(win, isLite)).not.to.throw; return supportsAutoplay(win, isLite).then(supportsAutoplay => { expect(supportsAutoplay).to.be.false; expect(playStub.called).to.be.true; expect(createElementSpy.called).to.be.true; }); }); it('should suppress errors if detection play call rejects a promise', () => { const p = Promise.reject('play() can only be initiated by a user gesture.'); const promiseCatchSpy = sandbox.spy(p, 'catch'); playStub.returns(p); video.paused = true; expect(supportsAutoplay(win, isLite)).not.to.throw; return supportsAutoplay(win, isLite).then(supportsAutoplay => { expect(promiseCatchSpy.called).to.be.true; expect(supportsAutoplay).to.be.false; expect(playStub.called).to.be.true; expect(createElementSpy.called).to.be.true; }); }); it('should be false when in amp-lite mode', () => { isLite = true; return supportsAutoplay(win, isLite).then(supportsAutoplay => { expect(supportsAutoplay).to.be.false; }); }); it('should cache the result', () => { const firstResultRef = supportsAutoplay(win, isLite); const secondResultRef = supportsAutoplay(win, isLite); expect(firstResultRef).to.equal(secondResultRef); clearSupportsAutoplayCacheForTesting(); const thirdResultRef = supportsAutoplay(win, isLite); expect(thirdResultRef).to.not.equal(firstResultRef); expect(thirdResultRef).to.not.equal(secondResultRef); }); beforeEach(() => { clearSupportsAutoplayCacheForTesting(); sandbox = sinon.sandbox.create(); video = { setAttribute() {}, style: { position: null, top: null, width: null, height: null, opacity: null, }, muted: null, playsinline: null, webkitPlaysinline: null, paused: false, play() {}, }; const doc = { createElement() { return video; }, }; win = { document: doc, }; isLite = false; createElementSpy = sandbox.spy(doc, 'createElement'); setAttributeSpy = sandbox.spy(video, 'setAttribute'); playStub = sandbox.stub(video, 'play'); }); afterEach(() => { sandbox.restore(); }); }); function createFakeVideoPlayerClass(win) { /** * @implements {../../src/video-interface.VideoInterface} */ return class FakeVideoPlayer extends win.AMP.BaseElement { /** @param {!AmpElement} element */ constructor(element) { super(element); } /** @override */ isLayoutSupported(layout) { return isLayoutSizeDefined(layout); } /** @override */ buildCallback() { const ampdoc = ampdocServiceFor(this.win).getAmpDoc(); installVideoManagerForDoc(ampdoc); videoManagerForDoc(this.win.document).register(this); } /** @override */ layoutCallback() { const iframe = this.element.ownerDocument.createElement('iframe'); this.element.appendChild(iframe); return Promise.resolve().then(() => { this.element.dispatchCustomEvent(VideoEvents.LOAD); }); } /** @override */ viewportCallback(visible) { this.element.dispatchCustomEvent(VideoEvents.VISIBILITY, {visible}); } // VideoInterface Implementation. See ../src/video-interface.VideoInterface /** * @override */ supportsPlatform() { return true; } /** * @override */ isInteractive() { return true; } /** * @override */ play(unusedIsAutoplay) { Promise.resolve().then(() => { this.element.dispatchCustomEvent(VideoEvents.PLAYING); }); } /** * @override */ pause() { Promise.resolve().then(() => { this.element.dispatchCustomEvent(VideoEvents.PAUSE); }); } /** * @override */ mute() { Promise.resolve().then(() => { this.element.dispatchCustomEvent(VideoEvents.MUTED); }); } /** * @override */ unmute() { Promise.resolve().then(() => { this.element.dispatchCustomEvent(VideoEvents.UNMUTED); }); } /** * @override */ showControls() { } /** * @override */ hideControls() { } }; }
{'content_hash': 'a4c4f14b48fad70e4c0a6ebe13a4040a', 'timestamp': '', 'source': 'github', 'line_count': 473, 'max_line_length': 80, 'avg_line_length': 27.298097251585624, 'alnum_prop': 0.6484665427509294, 'repo_name': 'sklobovskaya/amphtml', 'id': '817375e9d806079da30542db94539c258ddcf374', 'size': '13539', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'test/functional/test-video-manager.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '73680'}, {'name': 'Go', 'bytes': '7459'}, {'name': 'HTML', 'bytes': '876009'}, {'name': 'Java', 'bytes': '36596'}, {'name': 'JavaScript', 'bytes': '7538285'}, {'name': 'Protocol Buffer', 'bytes': '29210'}, {'name': 'Python', 'bytes': '82782'}, {'name': 'Ruby', 'bytes': '6079'}, {'name': 'Shell', 'bytes': '6942'}, {'name': 'Yacc', 'bytes': '20286'}]}
<?php abstract class AlmanacDeviceController extends AlmanacController { public function buildApplicationCrumbs() { $crumbs = parent::buildApplicationCrumbs(); $list_uri = $this->getApplicationURI('device/'); $crumbs->addTextCrumb(pht('Devices'), $list_uri); return $crumbs; } }
{'content_hash': '15cd4efee71920d3a4b584dbbfc73f3b', 'timestamp': '', 'source': 'github', 'line_count': 14, 'max_line_length': 66, 'avg_line_length': 21.714285714285715, 'alnum_prop': 0.7039473684210527, 'repo_name': 'WuJiahu/phabricator', 'id': '11c8855a5dcc02f3a464086523229fc7133545ef', 'size': '304', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/applications/almanac/controller/AlmanacDeviceController.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ActionScript', 'bytes': '50788'}, {'name': 'CSS', 'bytes': '284591'}, {'name': 'JavaScript', 'bytes': '685398'}, {'name': 'Makefile', 'bytes': '6426'}, {'name': 'PHP', 'bytes': '12220877'}, {'name': 'PLSQL', 'bytes': '80'}, {'name': 'Python', 'bytes': '7385'}, {'name': 'Shell', 'bytes': '8229'}]}
package com.coderedrobotics.tiberius; import com.coderedrobotics.tiberius.libs.Debug; import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj.camera.AxisCamera; import edu.wpi.first.wpilibj.camera.AxisCameraException; import edu.wpi.first.wpilibj.image.BinaryImage; import edu.wpi.first.wpilibj.image.ColorImage; import edu.wpi.first.wpilibj.image.NIVisionException; import edu.wpi.first.wpilibj.image.ParticleAnalysisReport; import java.util.Vector; public class ImageObject implements Runnable { private AxisCamera camera; private Thread thread; private boolean gettingImage = false; private boolean hot = false; private final int areaThreshold = 25; private final int brightnessThreshold = 50; ImageObject() { thread = new Thread(this); try { thread.start(); } catch (Exception ex) { Debug.println("CAMERA - FAILED TO INITIALIZE", Debug.WARNING); } } public void run() { camera = AxisCamera.getInstance(); camera.writeResolution(AxisCamera.ResolutionT.k320x240); Debug.println("CAMERA INITIALIZED", Debug.STANDARD); while (true) { if (gettingImage) { Debug.println("getting image", Debug.STANDARD); long startTime = System.currentTimeMillis(); hot = GetImage(); Debug.printDriverStationMessage(3, 1, String.valueOf(hot)); System.out.println(String.valueOf(hot)); System.out.println("Image Acquisition Time: " + String.valueOf(System.currentTimeMillis() - startTime)); cancelRequest(); } try { Thread.sleep(100); } catch (InterruptedException ex) { } } } private boolean GetImage() { if (camera != null && DriverStation.getInstance().isEnabled()) { ColorImage image = null; try { image = camera.getImage(); } catch (AxisCameraException ex) { } catch (NIVisionException ex) { Debug.println("error getting image", Debug.WARNING); } ParticleAnalysisReport[] particles; try { BinaryImage thresholdImage = image.thresholdRGB( brightnessThreshold, 255, brightnessThreshold, 255, brightnessThreshold, 255); // keep only bright objects particles = thresholdImage.getOrderedParticleAnalysisReports(); System.out.println("Number of particles: " + new Integer(particles.length)); for (int i = 0; i < particles.length; ++i) { if (((ParticleAnalysisReport) particles[i]).particleArea > areaThreshold && ((ParticleAnalysisReport) particles[i]).boundingRectWidth / ((ParticleAnalysisReport) particles[i]).boundingRectHeight > 3d) { System.out.println("ACCEPTED: \tX: " + particles[i].center_mass_x + "\tY: " + particles[i].center_mass_y); Debug.printDriverStationMessage(1, 1, particles[i].center_mass_x + " " + particles[i].center_mass_y); Debug.printDriverStationMessage(2, 1, particles[i].boundingRectWidth + " " + particles[i].boundingRectHeight); System.out.println("Particle: " + particles[i] + "\tWidth: " + particles[i].boundingRectWidth); Debug.println("Accepted" + i, Debug.EXTENDED); thresholdImage.free(); image.free(); return true; } else { //Debug.println("Rejected" + i, Debug.EXTENDED); } } thresholdImage.free(); image.free(); } catch (NIVisionException ex) { } } return false; } public void cancelRequest() { gettingImage = false; } public void request() { gettingImage = true; reset(); } public boolean isHot() { return hot; } public void reset() { hot = false; } }
{'content_hash': '5edde9815f76239b30ed3cc59bdce310', 'timestamp': '', 'source': 'github', 'line_count': 121, 'max_line_length': 134, 'avg_line_length': 36.53719008264463, 'alnum_prop': 0.5473874688984393, 'repo_name': 'CodeRed2771/Tiberius2014', 'id': '9cedf1d64e2df847ca01c17b206ac3397071ea85', 'size': '4421', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/com/coderedrobotics/tiberius/ImageObject.java', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Java', 'bytes': '119946'}]}
import Service from '@ember/service'; export default class extends Service { notify = () => void 0; }
{'content_hash': 'd1fd7964bda68ce38a5bcbdfd01ccc09', 'timestamp': '', 'source': 'github', 'line_count': 5, 'max_line_length': 38, 'avg_line_length': 21.0, 'alnum_prop': 0.6857142857142857, 'repo_name': 'alyiwang/WhereHows', 'id': '2edab3df59d051786b38923f2d210b0001f08596', 'size': '105', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'wherehows-web/tests/stubs/services/notifications.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '110036'}, {'name': 'Dockerfile', 'bytes': '2521'}, {'name': 'HTML', 'bytes': '130977'}, {'name': 'Java', 'bytes': '1307388'}, {'name': 'JavaScript', 'bytes': '146287'}, {'name': 'Python', 'bytes': '1419332'}, {'name': 'Shell', 'bytes': '2568'}, {'name': 'TypeScript', 'bytes': '637366'}]}
cask "standard-notes" do version "3.4.10" sha256 "6e6cadaacf6b48d5953664ab23c2bb0506ee76b835d4a5def946e4d139ea2822" # github.com/standardnotes/desktop/ was verified as official when first introduced to the cask url "https://github.com/standardnotes/desktop/releases/download/v#{version}/Standard-Notes-#{version}-mac.zip" appcast "https://github.com/standardnotes/desktop/releases.atom" name "Standard Notes" desc "Free, open-source, and completely encrypted notes app" homepage "https://standardnotes.org/" auto_updates true app "Standard Notes.app" zap trash: [ "~/Library/Application Support/Standard Notes", "~/Library/Caches/org.standardnotes.standardnotes", "~/Library/Caches/org.standardnotes.standardnotes.ShipIt", "~/Library/Preferences/org.standardnotes.standardnotes.plist", "~/Library/Preferences/org.standardnotes.standardnotes.helper.plist", "~/Library/Saved Application State/org.standardnotes.standardnotes.savedState", ] end
{'content_hash': 'f21be6702c285509eead53c93800557a', 'timestamp': '', 'source': 'github', 'line_count': 24, 'max_line_length': 112, 'avg_line_length': 41.416666666666664, 'alnum_prop': 0.7665995975855131, 'repo_name': 'jgarber623/homebrew-cask', 'id': '13efe5aa572b11868bcfe643bc582326eb889238', 'size': '994', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Casks/standard-notes.rb', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'Dockerfile', 'bytes': '249'}, {'name': 'Python', 'bytes': '3630'}, {'name': 'Ruby', 'bytes': '2281486'}, {'name': 'Shell', 'bytes': '32035'}]}
#import "UIView.h" @interface SBHomeScreenPreviewView : UIView { } + (void)cleanupPreview; + (id)preview; - (id)initWithFrame:(struct CGRect)arg1 iconController:(id)arg2; @end
{'content_hash': '027a46d7631fb9a164f7b4f79ba8fc8d', 'timestamp': '', 'source': 'github', 'line_count': 14, 'max_line_length': 64, 'avg_line_length': 13.0, 'alnum_prop': 0.7252747252747253, 'repo_name': 'matthewsot/CocoaSharp', 'id': '7f6135bfefafb29118ba21442833bf79fd000fab', 'size': '322', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Headers/SpringBoard/SBHomeScreenPreviewView.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '259784'}, {'name': 'C#', 'bytes': '2789005'}, {'name': 'C++', 'bytes': '252504'}, {'name': 'Objective-C', 'bytes': '24301417'}, {'name': 'Smalltalk', 'bytes': '167909'}]}
""" Backup driver with 'chunked' backup operations. """ from cinder.interface import backup_driver class BackupChunkedDriver(backup_driver.BackupDriver): """Backup driver that supports 'chunked' backups.""" def put_container(self, container): """Create the container if needed. No failure if it pre-exists. :param container: The container to write into. """ def get_container_entries(self, container, prefix): """Get container entry names. :param container: The container from which to get entries. :param prefix: The prefix used to match entries. """ def get_object_writer(self, container, object_name, extra_metadata=None): """Returns a writer which stores the chunk data in backup repository. :param container: The container to write to. :param object_name: The object name to write. :param extra_metadata: Extra metadata to be included. :returns: A context handler that can be used in a "with" context. """ def get_object_reader(self, container, object_name, extra_metadata=None): """Returns a reader object for the backed up chunk. :param container: The container to read from. :param object_name: The object name to read. :param extra_metadata: Extra metadata to be included. """ def delete_object(self, container, object_name): """Delete object from container. :param container: The container to modify. :param object_name: The object name delete. """ def update_container_name(self, backup, container): """Allows sub-classes to override container name. This method exists so that sub-classes can override the container name as it comes in to the driver in the backup object. Implementations should return None if no change to the container name is desired. """ def get_extra_metadata(self, backup, volume): """Return extra metadata to use in prepare_backup. This method allows for collection of extra metadata in prepare_backup() which will be passed to get_object_reader() and get_object_writer(). Subclass extensions can use this extra information to optimize data transfers. Return a json serializable object. """
{'content_hash': 'b8f1c0c76e44786932dd5252315f3310', 'timestamp': '', 'source': 'github', 'line_count': 63, 'max_line_length': 79, 'avg_line_length': 36.93650793650794, 'alnum_prop': 0.6729694886119467, 'repo_name': 'Hybrid-Cloud/cinder', 'id': '03f0a8bf8dd45d4d0389178eec5bccfed65ad2be', 'size': '2954', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'cinder/interface/backup_chunked_driver.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Python', 'bytes': '17513896'}, {'name': 'Shell', 'bytes': '8187'}]}
using System.Collections.Generic; using System.Linq; using CoreLocation; using Address = Plugin.Geolocator.Abstractions.Address; using System; using Foundation; namespace Plugin.Geolocator { public static class GeolocationUtils { internal static IEnumerable<Address> ToAddresses(this IEnumerable<CLPlacemark> addresses) { return addresses.Select(address => new Address { Longitude = address.Location.Coordinate.Longitude, Latitude = address.Location.Coordinate.Latitude, FeatureName = address.Name, PostalCode = address.PostalCode, SubLocality = address.SubLocality, CountryCode = address.IsoCountryCode, CountryName = address.Country, Thoroughfare = address.Thoroughfare, SubThoroughfare = address.SubThoroughfare, Locality = address.Locality, AdminArea = address.AdministrativeArea, SubAdminArea = address.SubAdministrativeArea }); } public static DateTime ToDateTime(this NSDate date) { return (DateTime)date; } } }
{'content_hash': '06019b6daae6de4558607709d68fa229', 'timestamp': '', 'source': 'github', 'line_count': 35, 'max_line_length': 91, 'avg_line_length': 28.4, 'alnum_prop': 0.7585513078470825, 'repo_name': 'jamesmontemagno/GeolocatorPlugin', 'id': '3818606b3f861e66538e06b96ef8ae4d0e7fb1d5', 'size': '994', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Geolocator.Plugin/Apple/GeolocationUtils.apple.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '110534'}, {'name': 'PowerShell', 'bytes': '9707'}, {'name': 'Shell', 'bytes': '2935'}]}
package com.amazonaws.services.autoscaling.model; import java.io.Serializable; /** * */ public class DescribeScalingProcessTypesResult implements Serializable, Cloneable { /** * <p> * The names of the process types. * </p> */ private com.amazonaws.internal.SdkInternalList<ProcessType> processes; /** * <p> * The names of the process types. * </p> * * @return The names of the process types. */ public java.util.List<ProcessType> getProcesses() { if (processes == null) { processes = new com.amazonaws.internal.SdkInternalList<ProcessType>(); } return processes; } /** * <p> * The names of the process types. * </p> * * @param processes * The names of the process types. */ public void setProcesses(java.util.Collection<ProcessType> processes) { if (processes == null) { this.processes = null; return; } this.processes = new com.amazonaws.internal.SdkInternalList<ProcessType>( processes); } /** * <p> * The names of the process types. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if * any). Use {@link #setProcesses(java.util.Collection)} or * {@link #withProcesses(java.util.Collection)} if you want to override the * existing values. * </p> * * @param processes * The names of the process types. * @return Returns a reference to this object so that method calls can be * chained together. */ public DescribeScalingProcessTypesResult withProcesses( ProcessType... processes) { if (this.processes == null) { setProcesses(new com.amazonaws.internal.SdkInternalList<ProcessType>( processes.length)); } for (ProcessType ele : processes) { this.processes.add(ele); } return this; } /** * <p> * The names of the process types. * </p> * * @param processes * The names of the process types. * @return Returns a reference to this object so that method calls can be * chained together. */ public DescribeScalingProcessTypesResult withProcesses( java.util.Collection<ProcessType> processes) { setProcesses(processes); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getProcesses() != null) sb.append("Processes: " + getProcesses()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeScalingProcessTypesResult == false) return false; DescribeScalingProcessTypesResult other = (DescribeScalingProcessTypesResult) obj; if (other.getProcesses() == null ^ this.getProcesses() == null) return false; if (other.getProcesses() != null && other.getProcesses().equals(this.getProcesses()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getProcesses() == null) ? 0 : getProcesses().hashCode()); return hashCode; } @Override public DescribeScalingProcessTypesResult clone() { try { return (DescribeScalingProcessTypesResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException( "Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
{'content_hash': 'b2668fe9ce5f98ca3bf11c1ceb5b3bfc', 'timestamp': '', 'source': 'github', 'line_count': 156, 'max_line_length': 90, 'avg_line_length': 27.365384615384617, 'alnum_prop': 0.567111735769501, 'repo_name': 'dump247/aws-sdk-java', 'id': '460e606637d13086d7e5808a2144975611ad4650', 'size': '4856', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'aws-java-sdk-autoscaling/src/main/java/com/amazonaws/services/autoscaling/model/DescribeScalingProcessTypesResult.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'FreeMarker', 'bytes': '117958'}, {'name': 'Java', 'bytes': '104374753'}, {'name': 'Scilab', 'bytes': '3375'}]}
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{'content_hash': '2cb2a1d7cc8c3fa0db3b739621ddbd1d', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 31, 'avg_line_length': 9.692307692307692, 'alnum_prop': 0.7063492063492064, 'repo_name': 'mdoering/backbone', 'id': 'b245bb5b73a5552cd8aebd8a4b425c9dbbddb9a3', 'size': '176', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Pyrrocoma/Pyrrocoma ciliolata/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []}
package org.apache.nutch.host; import java.io.IOException; import java.util.Collection; import java.util.HashSet; import org.apache.gora.mapreduce.GoraMapper; import org.apache.gora.mapreduce.GoraReducer; import org.apache.gora.query.Query; import org.apache.gora.store.DataStore; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import org.apache.nutch.metadata.Nutch; import org.apache.nutch.storage.Host; import org.apache.nutch.storage.StorageUtils; import org.apache.nutch.storage.WebPage; import org.apache.nutch.util.NutchConfiguration; import org.apache.nutch.util.NutchJob; import org.apache.nutch.util.TableUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Scans the web table and create host entries for each unique host. * * **/ public class HostDbUpdateJob implements Tool { public static final Logger LOG = LoggerFactory .getLogger(HostDbUpdateJob.class); private static final Collection<WebPage.Field> FIELDS = new HashSet<WebPage.Field>(); private Configuration conf; static { FIELDS.add(WebPage.Field.STATUS); } /** * Maps each WebPage to a host key. */ public static class Mapper extends GoraMapper<String, WebPage, Text, WebPage> { @Override protected void map(String key, WebPage value, Context context) throws IOException, InterruptedException { String reversedHost = TableUtil.getReversedHost(key); context.write(new Text(reversedHost), value); } } public HostDbUpdateJob() { } public HostDbUpdateJob(Configuration conf) { setConf(conf); } @Override public Configuration getConf() { return conf; } @Override public void setConf(Configuration conf) { this.conf = conf; } public void updateHosts(boolean buildLinkDb) throws Exception { if (buildLinkDb) { FIELDS.add(WebPage.Field.INLINKS); FIELDS.add(WebPage.Field.OUTLINKS); } NutchJob job = new NutchJob(getConf(), "hostdb-update"); // === Map === DataStore<String, WebPage> pageStore = StorageUtils.createWebStore( job.getConfiguration(), String.class, WebPage.class); Query<String, WebPage> query = pageStore.newQuery(); query.setFields(StorageUtils.toStringArray(FIELDS)); // Note: pages without // these fields are // skipped GoraMapper.initMapperJob(job, query, pageStore, Text.class, WebPage.class, HostDbUpdateJob.Mapper.class, null, true); // === Reduce === DataStore<String, Host> hostStore = StorageUtils.createWebStore( job.getConfiguration(), String.class, Host.class); GoraReducer.initReducerJob(job, hostStore, HostDbUpdateReducer.class); job.waitForCompletion(true); } @Override public int run(String[] args) throws Exception { boolean linkDb = false; for (int i = 0; i < args.length; i++) { if ("-linkDb".equals(args[i])) { linkDb = true; } else if ("-crawlId".equals(args[i])) { getConf().set(Nutch.CRAWL_ID_KEY, args[++i]); } else { throw new IllegalArgumentException("unrecognized arg " + args[i] + " usage: (-linkDb) (-crawlId <crawlId>)"); } } LOG.info("Updating HostDb. Adding links:" + linkDb); updateHosts(linkDb); return 0; } public static void main(String[] args) throws Exception { final int res = ToolRunner.run(NutchConfiguration.create(), new HostDbUpdateJob(), args); System.exit(res); } }
{'content_hash': 'f0f58ffff4d1288f9207899ab6ed823b', 'timestamp': '', 'source': 'github', 'line_count': 125, 'max_line_length': 87, 'avg_line_length': 29.256, 'alnum_prop': 0.6773311457478808, 'repo_name': 'zouzias/apache-nutch-2.3', 'id': 'f106ef35c8bf29e603570af95434b22325726fb4', 'size': '4615', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'nutch/src/java/org/apache/nutch/host/HostDbUpdateJob.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '14471'}, {'name': 'HTML', 'bytes': '13329446'}, {'name': 'Java', 'bytes': '2150015'}, {'name': 'Shell', 'bytes': '14602'}, {'name': 'XSLT', 'bytes': '1822'}]}
UPS Shipping API Bundle ======================= This bundle provides Shipping service to create shipments via UPS /ShipConfirm and /ShipAccept API endpoints using [UPS API library](https://github.com/gabrielbull/php-ups-api). Installation ------------ Add `eduard-sukharev/ups-shipment-bundle` to `require` section of your `composer.json`, e.g.: ``` "require": { ... "eduard-sukharev/ups-shipment-bundle": "~0.1", ... } ``` Add following parameters to your `app/config.yml`: ```yml opensoft_ups_shipment: credentials: ups_production_mode: true # true for production server, false for testing/integration server ups_access_key: YourUpsAccessKeyHere ups_username: UpsUserName ups_password: UpSpAsSwOrD ``` **Note:** When creating Shipment object, at some point you will also need to set ShipperNumber parameter, which can be found on UPS site: Log in, navigate to *My UPS* -> *Account Summary*, see section **UPS Account Details** for a 6-character string in **Number** column of desired UPS account.
{'content_hash': '357fb37ffa694d8036201accaf73d98c', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 118, 'avg_line_length': 32.54545454545455, 'alnum_prop': 0.6815642458100558, 'repo_name': 'eduard-sukharev/ups-shipment-bundle', 'id': '38a43c478118b241a5b85f7cacfb7dff2bd50df1', 'size': '1074', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '143'}, {'name': 'PHP', 'bytes': '7114'}]}
eugor-object-store ================== A DB wrapper for an MMO
{'content_hash': 'fac131f14ab70808f152338451d22304', 'timestamp': '', 'source': 'github', 'line_count': 4, 'max_line_length': 23, 'avg_line_length': 15.75, 'alnum_prop': 0.5396825396825397, 'repo_name': 'GreenKittyGames/eugor-object-store', 'id': '2298f80596ff255720a0cdb7c01157dee4d3fa72', 'size': '63', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CoffeeScript', 'bytes': '0'}, {'name': 'JavaScript', 'bytes': '0'}]}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_02) on Mon Apr 25 06:16:39 CEST 2016 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>Credentials (Gradle API 2.13)</title> <meta name="date" content="2016-04-25"> <link rel="stylesheet" type="text/css" href="../../../../javadoc.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Credentials (Gradle API 2.13)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/gradle/api/credentials/AwsCredentials.html" title="interface in org.gradle.api.credentials"><span class="strong">Prev Class</span></a></li> <li>Next Class</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/gradle/api/credentials/Credentials.html" target="_top">Frames</a></li> <li><a href="Credentials.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li>Method</li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li>Method</li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.gradle.api.credentials</div> <h2 title="Interface Credentials" class="title">Interface Credentials</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Known Subinterfaces:</dt> <dd><a href="../../../../org/gradle/api/credentials/AwsCredentials.html" title="interface in org.gradle.api.credentials">AwsCredentials</a>, <a href="../../../../org/gradle/api/artifacts/repositories/PasswordCredentials.html" title="interface in org.gradle.api.artifacts.repositories">PasswordCredentials</a></dd> </dl> <hr> <br> <pre><a href="../../../../org/gradle/api/Incubating.html" title="annotation in org.gradle.api">@Incubating</a> <a href="../../../../org/gradle/api/NonExtensible.html" title="annotation in org.gradle.api">@NonExtensible</a> public interface <span class="strong">Credentials</span></pre> <div class="block">Base interface for credentials used for different authentication purposes. (e.g authenticated <a href="../../../../org/gradle/api/artifacts/dsl/RepositoryHandler.html" title="interface in org.gradle.api.artifacts.dsl"><code>RepositoryHandler</code></a>)</div> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/gradle/api/credentials/AwsCredentials.html" title="interface in org.gradle.api.credentials"><span class="strong">Prev Class</span></a></li> <li>Next Class</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/gradle/api/credentials/Credentials.html" target="_top">Frames</a></li> <li><a href="Credentials.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li>Method</li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Constr&nbsp;|&nbsp;</li> <li>Method</li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{'content_hash': 'd347a67775fd4eb382184f391b3f142e', 'timestamp': '', 'source': 'github', 'line_count': 165, 'max_line_length': 313, 'avg_line_length': 35.18181818181818, 'alnum_prop': 0.6303186907838071, 'repo_name': 'HenryHarper/Acquire-Reboot', 'id': '2bb503baad5cdd42dbd70ceac7687f3a9532a810', 'size': '5805', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'gradle/docs/javadoc/org/gradle/api/credentials/Credentials.html', 'mode': '33188', 'license': 'mit', 'language': []}
using sync_file_system::SyncEventObserver; namespace extensions { ExtensionSyncEventObserver::ExtensionSyncEventObserver( Profile* profile) : profile_(profile), sync_service_(NULL) {} void ExtensionSyncEventObserver::InitializeForService( sync_file_system::SyncFileSystemService* sync_service) { DCHECK(sync_service); if (sync_service_ != NULL) { DCHECK_EQ(sync_service_, sync_service); return; } sync_service_ = sync_service; sync_service_->AddSyncEventObserver(this); } ExtensionSyncEventObserver::~ExtensionSyncEventObserver() {} void ExtensionSyncEventObserver::Shutdown() { if (sync_service_ != NULL) sync_service_->RemoveSyncEventObserver(this); } std::string ExtensionSyncEventObserver::GetExtensionId( const GURL& app_origin) { const Extension* app = ExtensionSystem::Get(profile_)->extension_service()-> GetInstalledApp(app_origin); if (!app) { // The app is uninstalled or disabled. return std::string(); } return app->id(); } void ExtensionSyncEventObserver::OnSyncStateUpdated( const GURL& app_origin, sync_file_system::SyncServiceState state, const std::string& description) { // Convert state and description into SyncState Object. api::sync_file_system::ServiceInfo service_info; service_info.state = SyncServiceStateToExtensionEnum(state); service_info.description = description; scoped_ptr<base::ListValue> params( api::sync_file_system::OnServiceStatusChanged::Create(service_info)); BroadcastOrDispatchEvent( app_origin, api::sync_file_system::OnServiceStatusChanged::kEventName, params.Pass()); } void ExtensionSyncEventObserver::OnFileSynced( const fileapi::FileSystemURL& url, sync_file_system::SyncFileStatus status, sync_file_system::SyncAction action, sync_file_system::SyncDirection direction) { scoped_ptr<base::ListValue> params(new base::ListValue()); // For now we always assume events come only for files (not directories). params->Append(CreateDictionaryValueForFileSystemEntry( url, sync_file_system::SYNC_FILE_TYPE_FILE)); // Status, SyncAction and any optional notes to go here. api::sync_file_system::FileStatus status_enum = SyncFileStatusToExtensionEnum(status); api::sync_file_system::SyncAction action_enum = SyncActionToExtensionEnum(action); api::sync_file_system::SyncDirection direction_enum = SyncDirectionToExtensionEnum(direction); params->AppendString(api::sync_file_system::ToString(status_enum)); params->AppendString(api::sync_file_system::ToString(action_enum)); params->AppendString(api::sync_file_system::ToString(direction_enum)); BroadcastOrDispatchEvent( url.origin(), api::sync_file_system::OnFileStatusChanged::kEventName, params.Pass()); } void ExtensionSyncEventObserver::BroadcastOrDispatchEvent( const GURL& app_origin, const std::string& event_name, scoped_ptr<base::ListValue> values) { // Check to see whether the event should be broadcasted to all listening // extensions or sent to a specific extension ID. bool broadcast_mode = app_origin.is_empty(); EventRouter* event_router = ExtensionSystem::Get(profile_)->event_router(); DCHECK(event_router); scoped_ptr<Event> event(new Event(event_name, values.Pass())); event->restrict_to_profile = profile_; // No app_origin, broadcast to all listening extensions for this event name. if (broadcast_mode) { event_router->BroadcastEvent(event.Pass()); return; } // Dispatch to single extension ID. const std::string extension_id = GetExtensionId(app_origin); if (extension_id.empty()) return; event_router->DispatchEventToExtension(extension_id, event.Pass()); } } // namespace extensions
{'content_hash': 'f0b0e64456d9c89f83ea59ca7156e7a6', 'timestamp': '', 'source': 'github', 'line_count': 110, 'max_line_length': 78, 'avg_line_length': 34.236363636363635, 'alnum_prop': 0.7318109399893786, 'repo_name': 'mogoweb/chromium-crosswalk', 'id': '3b93044091a68d7683ef6d4d4b2144daa57a4019', 'size': '4702', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ASP', 'bytes': '853'}, {'name': 'AppleScript', 'bytes': '6973'}, {'name': 'Arduino', 'bytes': '464'}, {'name': 'Assembly', 'bytes': '54831'}, {'name': 'Awk', 'bytes': '8660'}, {'name': 'C', 'bytes': '40940503'}, {'name': 'C#', 'bytes': '1132'}, {'name': 'C++', 'bytes': '182703853'}, {'name': 'CSS', 'bytes': '799795'}, {'name': 'DOT', 'bytes': '1873'}, {'name': 'Java', 'bytes': '4807735'}, {'name': 'JavaScript', 'bytes': '20714038'}, {'name': 'Mercury', 'bytes': '10299'}, {'name': 'Objective-C', 'bytes': '985558'}, {'name': 'Objective-C++', 'bytes': '6205987'}, {'name': 'PHP', 'bytes': '97817'}, {'name': 'Perl', 'bytes': '1213389'}, {'name': 'Python', 'bytes': '9735121'}, {'name': 'Rebol', 'bytes': '262'}, {'name': 'Shell', 'bytes': '1305641'}, {'name': 'Tcl', 'bytes': '277091'}, {'name': 'TypeScript', 'bytes': '1560024'}, {'name': 'XSLT', 'bytes': '13493'}, {'name': 'nesC', 'bytes': '14650'}]}
module Meshchat module Ui module Command module NodeFinder module_function def find_by_target(string, &block) search_key = string.start_with?('#') ? :uid : :alias_name nodes = Node.where(search_key => string) return Display.warning('No node by: ' + string) if nodes.empty? return yield(nodes.first) if nodes.length == 1 Display.warning I18n.t('node.multiple_with_alias', name: string) ask_for_specification(nodes, block) end def ask_for_specification(nodes, block) # there are now more than 1 nodes display_nodes(nodes) # insert a callback into the input handler to run the next # time a line is received # # TODO: this feels gross, is there a better way? # TODO: move this callback from ReadlineInput to the Input Base CLI::ReadlineInput.input_handler.callback_on_next_tick = lambda do |line| answer = line.to_i node = nodes[answer] # finally, send the mesasge # (or do whatever this is) # but usually, it sending the message block.call(node) end end def display_nodes(nodes) # write header Display.info "\t\t UID Last Seen" Display.info '-' * 60 # write nodes nodes.each_with_index do |node, index| i = index.to_s alias_name = node.alias_name uid = node.uid[0..5] last_seen = node.updated_at&.strftime('%B %e, %Y %H:%M:%S') || 'never' line = '%-2s | %-15s %-8s %s' % [i, alias_name, uid, last_seen] Display.info line end end end end end end
{'content_hash': 'bd4fa8fb7837a1b60dd19e48b8c109d2', 'timestamp': '', 'source': 'github', 'line_count': 55, 'max_line_length': 83, 'avg_line_length': 32.61818181818182, 'alnum_prop': 0.5423634336677815, 'repo_name': 'NullVoxPopuli/meshchat', 'id': 'e77a0527ecc7f67db667238891d054526f5ecfcb', 'size': '1824', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/meshchat/ui/command/node_finder.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '95711'}]}
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateClients extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('clients', function (Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('image'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('clients'); } }
{'content_hash': 'aa20ab0273765fba48241261438d8f73', 'timestamp': '', 'source': 'github', 'line_count': 32, 'max_line_length': 63, 'avg_line_length': 19.1875, 'alnum_prop': 0.5293159609120521, 'repo_name': 'gavchi/alalay', 'id': '969d6406269002595c7827631214553e7a9e8243', 'size': '614', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'database/migrations/2016_12_10_134224_create_clients.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '412'}, {'name': 'CSS', 'bytes': '180647'}, {'name': 'CoffeeScript', 'bytes': '103918'}, {'name': 'Go', 'bytes': '7075'}, {'name': 'HTML', 'bytes': '2915876'}, {'name': 'JavaScript', 'bytes': '3513729'}, {'name': 'Makefile', 'bytes': '285'}, {'name': 'PHP', 'bytes': '173666'}, {'name': 'Python', 'bytes': '38168'}, {'name': 'Shell', 'bytes': '740'}]}
package org.gradoop.temporal.model.impl.operators.aggregation.functions; import org.gradoop.common.exceptions.UnsupportedTypeException; import org.gradoop.common.model.impl.properties.PropertyValue; import org.gradoop.common.model.impl.properties.Type; import org.gradoop.flink.model.impl.operators.aggregation.functions.min.Min; import org.gradoop.temporal.model.api.TimeDimension; import org.gradoop.temporal.model.api.functions.TemporalAggregateFunction; import org.gradoop.temporal.model.impl.pojo.TemporalElement; import java.time.temporal.TemporalUnit; /** * Calculates the minimum duration of a {@link TimeDimension} of temporal elements. * * Time intervals with either the start or end time set to the respective default value are evaluated as zero. */ public class MinDuration extends AbstractDurationAggregateFunction implements Min, TemporalAggregateFunction { /** * Creates a new instance of this aggregate function. * * @param aggregatePropertyKey the property key of the new property where the aggregated value is stored * @param dimension the time dimension to consider * @param unit the temporal unit into which the result is converted. The supported units are specified in * {@link AbstractDurationAggregateFunction#SUPPORTED_UNITS}. */ public MinDuration(String aggregatePropertyKey, TimeDimension dimension, TemporalUnit unit) { super(aggregatePropertyKey, dimension, unit); } /** * Creates a new instance of this aggregate function. * * @param aggregatePropertyKey the property key of the new property where the aggregated value is stored * @param dimension the time dimension to consider */ public MinDuration(String aggregatePropertyKey, TimeDimension dimension) { super(aggregatePropertyKey, dimension, AbstractDurationAggregateFunction.DEFAULT_UNIT); } /** * Creates a new instance of this aggregate function. The the property key of the new property, where the * aggregated value is stored, will be defined as "minDuration_" + {dimension} + "_" + {unit}. Use * constructor {@link MinDuration#MinDuration(String, TimeDimension, TemporalUnit)} to specify a * user-defined key. * * @param dimension the time dimension to consider * @param unit the temporal unit into which the result is converted. The supported units are specified in * {@link AbstractDurationAggregateFunction#SUPPORTED_UNITS}. */ public MinDuration(TimeDimension dimension, TemporalUnit unit) { this("minDuration_" + dimension + "_" + unit, dimension, unit); } /** * Calculates the duration of a given element depending on the given {@link TimeDimension}. * Returns {@link Long#MAX_VALUE} if either the start or end time of the duration are default values. * * @param element the temporal element * @return the duration of the time interval */ @Override public PropertyValue getIncrement(TemporalElement element) { PropertyValue duration = getDuration(element); if (duration.getLong() == -1L) { return PropertyValue.create(TemporalElement.DEFAULT_TIME_TO); } return duration; } /** * Method to check whether all aggregated durations had been default values or need to be transformed to * another unit. * * @param result the result of the MinDuration aggregation as {@link Long} in milliseconds * @return By default (no time unit or the default unit [millis] is specified), the result of the * MinDuration Aggregation as {@link Long} in milliseconds is returned. If a different time unit is * given in {@link AbstractDurationAggregateFunction#timeUnit}, a {@link Double} of * the desired unit is returned. If the minimum duration is {@link TemporalElement#DEFAULT_TIME_TO}, * the value {@link PropertyValue#NULL_VALUE}is returned. * @throws UnsupportedTypeException if the type of the given property value is different from {@link Long}. */ @Override public PropertyValue postAggregate(PropertyValue result) throws UnsupportedTypeException { // First check if the aggregated result is of type long. if (!result.isLong()) { throw new UnsupportedTypeException("The result type of the min duration aggregation must be [" + Type.LONG + "], but is [" + result.getType() + "]."); } // If the result is a default value, set it as null. if (result.getLong() == TemporalElement.DEFAULT_TIME_TO) { return PropertyValue.NULL_VALUE; } // If a time unit is specified, convert it. if (timeUnit != AbstractDurationAggregateFunction.DEFAULT_UNIT) { result.setDouble((double) result.getLong() / timeUnit.getDuration().toMillis()); } return result; } }
{'content_hash': 'da0f45b7936efb2d32f64daaf39238cf', 'timestamp': '', 'source': 'github', 'line_count': 102, 'max_line_length': 110, 'avg_line_length': 46.490196078431374, 'alnum_prop': 0.734289329396879, 'repo_name': 'galpha/gradoop', 'id': '819bf64fe6ceec92ab5af88301ec5689c2f1ff95', 'size': '5379', 'binary': False, 'copies': '2', 'ref': 'refs/heads/develop', 'path': 'gradoop-temporal/src/main/java/org/gradoop/temporal/model/impl/operators/aggregation/functions/MinDuration.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '6550822'}, {'name': 'Shell', 'bytes': '2289'}]}
package proguard.evaluation.value; /** * This IntegerValue represents a integer value that is converted from another * scalar value. * * @author Eric Lafortune */ final class ConvertedIntegerValue extends SpecificIntegerValue { private final Value value; /** * Creates a new converted integer value of the given value. */ public ConvertedIntegerValue(Value value) { this.value = value; } // Implementations for Object. public boolean equals(Object object) { return this == object || super.equals(object) && this.value.equals(((ConvertedIntegerValue)object).value); } public int hashCode() { return super.hashCode() ^ value.hashCode(); } public String toString() { return "(int)("+value+")"; } }
{'content_hash': 'fa510d693e37fa4bf2a05911cb89f823', 'timestamp': '', 'source': 'github', 'line_count': 45, 'max_line_length': 78, 'avg_line_length': 19.044444444444444, 'alnum_prop': 0.6079346557759626, 'repo_name': 'werkt/bazel', 'id': '2ec9ab86098a75d5374adc0d497be7406072b983', 'size': '1741', 'binary': False, 'copies': '14', 'ref': 'refs/heads/master', 'path': 'third_party/java/proguard/proguard5.3.3/src/proguard/evaluation/value/ConvertedIntegerValue.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '2916'}, {'name': 'C', 'bytes': '16022'}, {'name': 'C++', 'bytes': '1171078'}, {'name': 'HTML', 'bytes': '20211'}, {'name': 'Java', 'bytes': '29573073'}, {'name': 'Makefile', 'bytes': '248'}, {'name': 'Objective-C', 'bytes': '8797'}, {'name': 'Objective-C++', 'bytes': '1043'}, {'name': 'PowerShell', 'bytes': '5536'}, {'name': 'Python', 'bytes': '1400777'}, {'name': 'Shell', 'bytes': '1169561'}, {'name': 'Smarty', 'bytes': '487938'}]}
/* * jQuery Custombox v1.0.2 - 2013-10-08 * jQuery Modal Window Effects. * http://dixso.github.io/custombox/ * (c) 2013 Julio De La Calle - http://dixso.net - @dixso9 * * Under MIT License - http://www.opensource.org/licenses/mit-license.php */ // the semi-colon before function invocation is a safety net against concatenated // scripts and/or other plugins which may not be closed properly. ;(function ( $, window, document, undefined ) { "use strict"; // undefined is used here as the undefined global variable in ECMAScript 3 is // mutable (ie. it can be changed by someone else). undefined isn't really being // passed in so we can ensure the value of it is truly undefined. In ES5, undefined // can no longer be modified. // window and document are passed through as local variable rather than global // as this (slightly) quickens the resolution process and can be more efficiently // minified (especially when both are regularly referenced in your plugin). // Create the defaults once. var cb = 'custombox', defaults = { url: null, // Set the URL, ID or Class. cache: false, // If set to false, it will force requested pages not to be cached by the browser only when send by AJAX. escKey: true, // Allows the user to close the modal by pressing 'ESC'. eClose: null, // Element ID or Class for to be close the modal. zIndex: 9999, // Overlay z-index: Number or auto. overlay: true, // Show the overlay. overlayColor: '#000', // Overlay color. overlayOpacity: 0.8, // The overlay opacity level. Range: 0 to 1. overlayClose: true, // Allows the user to close the modal by clicking the overlay. overlaySpeed: 200, // Sets the speed of the overlay, in milliseconds. customClass: null, // Custom class to modal. width: null, // Set a fixed total width. height: null, // Set a fixed total height. effect: 'fadein', // fadein | slide | newspaper | fall | sidefall | blur | flip | sign | superscaled | slit | rotate | letmein | makeway | slip | blur. position: null, // Only with effects: slide, flip and rotate. (top, right, bottom, left and center) | (vertical or horizontal). speed: 600, // Sets the speed of the transitions, in milliseconds. open: null, // Callback that fires right before begins to open. complete: null, // Callback that fires right after loaded content is displayed. close: null, // Callback that fires once is closed. error: 'Error 404!' // Text to be displayed when an error. }; // The plugin constructor. function Plugin ( element, options ) { this.element = element; // Get the max zIndex. if ( typeof this.element === 'object' && typeof options === 'object' && isNaN( options.zIndex ) && options.zIndex === 'auto' ) { options.zIndex = ( this._isIE() ? defaults.zIndex : this._zIndex() ); } // Merge objects. this.settings = this._extend( {}, defaults, options ); if ( typeof this.element === 'object' ) { // Private method. this._box.init( this ); } else { // Public method. this[this.element](); } } Plugin.prototype = { /* ---------------------------- Private methods ---------------------------- */ _overlay: function() { var rgba = this._hexToRgb(this.settings.overlayColor), styles = {}; // Only IE 8 if ( navigator.appVersion.indexOf('MSIE 8.') != -1 ) { styles.backgroundColor = this.settings.overlayColor; styles.zIndex = parseFloat(this.settings.zIndex) + 1; styles.filter = 'alpha(opacity=' + this.settings.overlayOpacity * 100 + ')'; } else { styles['background-color'] = 'rgba(' + rgba.r + ',' + rgba.g + ', ' + rgba.b + ',' + this.settings.overlayOpacity + ')'; styles['z-index'] = parseFloat(this.settings.zIndex) + 1; styles['transition'] = 'all ' + this.settings.overlaySpeed / 1000 + 's'; } document.getElementsByTagName('body')[0].appendChild(this._create({ id: 'overlay', eClass: 'overlay' }, styles)); }, _box: { init: function ( obj ) { // Check if callback 'open'. if ( obj.settings.open && typeof obj.settings.open === 'function' ) { obj.settings.open( undefined !== arguments[0] ? arguments[0] : '' ); } // Add generic class custombox. obj._addClass( document.getElementsByTagName( 'html' )[0], 'html' ); // Check if scrollbar is visible. var body = document.body, html = document.documentElement; var bodyHeight = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight), windowHeight = 'innerHeight' in window ? window.innerHeight : document.documentElement.offsetHeight; if ( bodyHeight > windowHeight ) { var outer = obj._create({},{ visibility: 'hidden', width: '100px' }); body.appendChild(outer); var widthNoScroll = outer.offsetWidth; // Force scrollbars outer.style.overflow = "scroll"; // Add inner div. var inner = obj._create({},{ width: '100%' }); outer.appendChild(inner); var widthWithScroll = inner.offsetWidth; // Remove divs outer.parentNode.removeChild(outer); // Hide scrollbar. obj._addClass( body, 'scrollbar' ); body.style.marginRight = widthNoScroll - widthWithScroll + 'px'; } // Check 'href'. if ( obj.settings.url === null ) { if ( obj.element !== null ) { obj.settings.url = obj.element.getAttribute('href'); } } if ( typeof obj.settings.url === 'string' ) { if ( obj.settings.url.charAt(0) === '#' || obj.settings.url.charAt(0) === '.' ) { // Inline. if ( document.querySelector(obj.settings.url) ) { obj._box.build( obj, document.querySelector(obj.settings.url).cloneNode(true) ); } else { obj._box.build( obj, null ); } } else { // Ajax. this.ajax( obj ); } } else { obj._box.build( obj, null ); } }, create: function ( obj ) { var styles = {}; if ( obj._isIE() ) { styles.zIndex = parseFloat(obj.settings.zIndex) + 2; } else { styles['z-index'] = parseFloat(obj.settings.zIndex) + 2; } var modal = obj._create({ id: 'modal', eClass: 'modal ' + obj._box.effect( obj ) + ( obj.settings.customClass ? ' ' + obj.settings.customClass : '' ) }, styles), content = obj._create({ id: 'modal-content', eClass: 'modal-content' }, { 'transition-duration': obj.settings.speed / 1000 + 's' }); // Insert modal to the content. modal.appendChild(content); // Insert modal just after the body. document.body.insertBefore(modal, document.body.firstChild); // Create overlay after the modal content. if ( obj.settings.overlay ) { obj._overlay(); } return [modal, content]; }, effect: function ( obj ) { var position = ['slide','flip','rotate'], perspective = ['letmein','makeway','slip','blur'], effect = cb + '-' + obj.settings.effect; // Position. for ( var i = 0, len1 = position.length; i < len1; i++ ) { if ( position[i] === obj.settings.effect ) { effect = cb + '-' + obj.settings.effect + '-' + obj.settings.position; } } // HTML head. for ( var x = 0, len2 = perspective.length; x < len2; x++ ) { if ( perspective[x] === obj.settings.effect ) { if ( obj.settings.effect !== 'blur' ) { // Add class. obj._addClass( document.getElementsByTagName( 'html' )[0], 'perspective' ); } var div = document.createElement('div'); div.className = cb + '-container'; // Move the body's children into this wrapper while ( document.body.firstChild ) { div.appendChild(document.body.firstChild); } // Append the wrapper to the body document.body.appendChild(div); } } return effect; }, build: function ( obj, modal ) { if ( obj.settings.error !== false && typeof obj.settings.error === 'string' ) { // If is null, show message error. if ( modal === null ) { modal = document.createElement('div'); obj._addClass( modal, 'error' ); modal.innerHTML = obj.settings.error; } // [0] => modal // [1] => content var tmp = obj._box.create( obj ); // Insert content to the modal. tmp[1].appendChild(modal); // Show the content. modal.style.display = 'block'; // Temporal sizes. var tmpSize = { width: parseInt(obj.settings.width, 0), height: parseInt(obj.settings.height, 0) }; // Check width: If it is a number and if not null. if ( !isNaN( tmpSize.width ) && tmpSize.width === obj.settings.width && tmpSize.width.toString() === obj.settings.width.toString() && tmpSize.width !== null ) { modal.style.width = tmpSize.width + 'px'; } // Check height: If it is a number and if not null. if ( !isNaN( tmpSize.height ) && tmpSize.height === obj.settings.height && tmpSize.height.toString() === obj.settings.height.toString() && tmpSize.height !== null ) { modal.style.height = tmpSize.height + 'px'; } // Only IE 8. if ( navigator.appVersion.indexOf('MSIE 8.') != -1 ) { modal.style.marginLeft = - modal.offsetWidth / 2 + 'px'; modal.style.marginTop = - modal.offsetHeight / 2 + 'px'; } // Show modal. setTimeout( function () { // Init listeners. obj._listeners(); // Show modal. tmp[0].className += ' ' + cb + '-show'; var script = tmp[1].getElementsByTagName('script'); // Execute the scripts. for ( var i = 0, len = script.length; i < len; i++ ) { new Function( script[i].text )(); } setTimeout( function () { // Check if callback 'complete'. if ( obj.settings.complete && typeof obj.settings.complete === 'function' ) { obj.settings.complete( undefined !== arguments[0] ? arguments[0] : '' ); } }, obj.settings.speed ); }, ( obj.settings.overlay ? obj.settings.overlaySpeed : 200 ) ); } }, ajax: function ( obj ) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { var completed = 4; if( xhr.readyState === completed ) { if( xhr.status === 200 ) { var modal = document.createElement('div'); modal.innerHTML = xhr.responseText; obj._box.build( obj, modal ); } else { obj._box.build( obj, null ); } } }; xhr.open('GET', obj.settings.url + ( !obj.settings.cache ? '?_=' + new Date().getTime() : '' ), true); xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhr.send(null); } }, _close: function () { var obj = this, d = document; obj._removeClass( ( obj._isIE() ? d.querySelectorAll('.' + cb + '-modal')[0] : d.getElementsByClassName(cb + '-modal')[0] ), cb + '-show' ); obj._removeClass( d.getElementsByTagName( 'html' )[0], cb + '-perspective' ); setTimeout( function () { // Remove classes. obj._removeClass( d.getElementsByTagName( 'html' )[0], cb + '-html' ); obj._removeClass( d.getElementsByTagName( 'body' )[0], cb + '-scrollbar' ); d.getElementsByTagName( 'body' )[0].style.marginRight = null; // Remove modal. var modal = ( obj._isIE() ? d.querySelectorAll('.' + cb + '-modal')[0] : d.getElementsByClassName(cb + '-modal')[0] ); obj._remove( modal ); // Remove overlay. if ( obj.settings.overlay ) { obj._remove( ( obj._isIE() ? d.querySelectorAll('.' + cb + '-overlay')[0] : d.getElementsByClassName(cb + '-overlay')[0] ) ); } // Check if callback 'close'. if ( obj.settings.close && typeof obj.settings.close === 'function' ) { obj.settings.close( undefined !== arguments[0] ? arguments[0] : '' ); } // Check if callback 'close' when the method is public. if ( modal.getAttribute('data-' + cb) !== null ) { var onClose = modal.getAttribute('data-' + cb), onCloseLaunch = new Function ( 'onClose', 'return ' + onClose )(onClose); onCloseLaunch(); } }, obj.settings.speed ); }, _listeners: function () { var obj = this; // Listener overlay. if ( obj._isIE() ) { if ( typeof document.querySelectorAll('.' + cb + '-overlay')[0] !== 'undefined' && obj.settings.overlayClose ) { document.querySelectorAll('.' + cb + '-overlay')[0].attachEvent('onclick', function () { obj._close(); }); } } else { if ( typeof document.getElementsByClassName(cb + '-overlay')[0] !== 'undefined' && obj.settings.overlayClose ) { document.getElementsByClassName(cb + '-overlay')[0].addEventListener('click', function () { obj._close(); }, false ); } } // Listener on tab key esc. if ( obj.settings.escKey ) { document.onkeydown = function ( evt ) { evt = evt || window.event; if ( evt.keyCode === 27 ) { obj._close(); } }; } // Listener on element close. if ( obj.settings.eClose !== null && typeof obj.settings.eClose === 'string' && obj.settings.eClose.charAt(0) === '#' || typeof obj.settings.eClose === 'string' && obj.settings.eClose.charAt(0) === '.' && document.querySelector(obj.settings.eClose) ) { document.querySelector(obj.settings.eClose).addEventListener('click', function () { obj._close(); }, false ); } // Check if callback 'close'. if ( obj.settings.close && typeof obj.settings.close === 'function' ) { var store = obj.settings.close; var modal = ( obj._isIE() ? document.querySelectorAll('.' + cb + '-modal')[0] : document.getElementsByClassName(cb + '-modal')[0] ); modal.setAttribute('data-' + cb, store); } }, /* ---------------------------- Utilities ---------------------------- */ _extend: function () { for( var i = 1, arg = arguments.length; i < arg; i++ ) { for( var key in arguments[i] ) { if( arguments[i].hasOwnProperty(key) ) { arguments[0][key] = arguments[i][key]; } } } return arguments[0]; }, _create: function ( attr, styles, element ) { var div = ( element === undefined || element === null ? document.createElement('div') : element ); if ( attr !== null ) { // Add the id. if ( attr.id !== null ) { div.id = cb + '-' + attr.id + new Date().getTime(); } // Add the class. if ( attr.eClass !== null ) { this._addClass( div, attr.eClass ); } } if ( styles !== null ) { // Loop with styles (obj). for ( var obj in styles ) { if ( styles.hasOwnProperty(obj) ) { // Insert browser dependent styles. if ( this._isIE() ) { div.style[obj] = styles[obj]; } else { div.style.setProperty( obj, styles[obj], null ); } if ( obj === 'transition-duration' && !this._isIE() ) { var prefix = [ '-webkit-', '-moz-', '-o-', '-ms-' ]; // Insert prefix. for ( var x = 0, pre = prefix.length; x < pre; x++ ) { div.style.setProperty( prefix[x] + obj, styles[obj], null ); } } } } } return div; }, _hexToRgb: function ( hex ) { // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") - http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; hex = hex.replace(shorthandRegex, function(m, r, g, b) { return r + r + g + g + b + b; }); var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; }, _addClass: function ( element, eClass ) { if ( !this._hasClass( element, eClass ) ) { element.className = ( element.className.length && element.className !== ' ' ? element.className + ' ' + cb + '-' + eClass : cb + '-' + eClass ); } }, _removeClass: function ( element, eClass ) { if ( this._hasClass( element, eClass ) ) { var reg = new RegExp('(\\s|^)' + eClass + '(\\s|$)'); element.className = element.className.replace(reg,' '); } }, _hasClass: function ( element, eClass ) { return ( element !== undefined ? element.className.match(new RegExp('(\\s|^)' + eClass + '(\\s|$)')) : false ); }, _remove: function ( element ) { if ( element !== undefined ) { element.parentNode.removeChild(element); } }, _zIndex: function () { var elems = document.getElementsByTagName('*'), zIndexMax = 0; for ( var i = 0, etotal = elems.length; i < etotal; i++ ) { var zindex = document.defaultView.getComputedStyle(elems[i],null).getPropertyValue('z-index'); if ( zindex > zIndexMax && zindex !== 'auto' ) { zIndexMax = zindex; } } return zIndexMax; }, _isIE: function () { return navigator.appVersion.indexOf('MSIE 9.') != -1 || navigator.appVersion.indexOf('MSIE 8.') != -1; }, /* ---------------------------- Public methods ---------------------------- */ close: function () { this._close(); } }; // A really lightweight plugin wrapper around the constructor, // preventing against multiple instantiations with jQuery. $.fn[ cb ] = function ( options ) { var args = arguments, isElement = typeof HTMLElement === 'object' ? options instanceof HTMLElement : options && typeof options === 'object' && options !== null && options.nodeType === 1 && typeof options.nodeName === 'string'; if ( options === undefined || typeof options === 'object' ) { if ( isElement ) { if ( navigator.appName === 'Microsoft Internet Explorer' ) { // Write a new regEx to find the version number. var re = new RegExp('MSIE ([0-9]{1,}[.0-9]{0,})'); // If the regEx through the userAgent is not null. if (re.exec(navigator.userAgent) != null) { //Set the IE version var version = parseInt(RegExp.$1); } } if ( typeof version === 'undefined' || version >= 10 ) { // Check time to avoid double click. if ( options.getAttribute('data-' + cb) !== null && parseInt(options.getAttribute('data-' + cb)) + 1 > Math.round( new Date().getTime() / 1000 )) { return; } // Set time to avoid double click. options.setAttribute('data-' + cb, Math.round( new Date().getTime() / 1000 ) ); } $(options).each( function () { $.data( this, cb, new Plugin( this, args[1] ) ); }); } else { new Plugin( null, args[0] ); } } else if ( typeof options === 'string' && options === 'close' ) { $.data( this, cb, new Plugin( args[0], args[1] ) ); } }; })( jQuery, window, document );
{'content_hash': 'f8ea5425d090a5220433f0cd827dcb37', 'timestamp': '', 'source': 'github', 'line_count': 560, 'max_line_length': 264, 'avg_line_length': 43.973214285714285, 'alnum_prop': 0.4415431472081218, 'repo_name': 'pvnr0082t/cdnjs', 'id': '78912db40018fb93a4395f24297cc9c333f9db5c', 'size': '24625', 'binary': False, 'copies': '20', 'ref': 'refs/heads/master', 'path': 'ajax/libs/custombox/1.0.2/custombox.js', 'mode': '33188', 'license': 'mit', 'language': []}
package no.dusken.momus.model; import javax.persistence.Entity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.ToString; @Entity @Data @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(of = {}, callSuper = true) @ToString(of = {"name", "color"}, callSuper = true) @Builder(toBuilder = true) public class ArticleReview extends AbstractEntity { private String name; private String color; }
{'content_hash': '3efbeba3b9a4c14d6a729d7c50655ab4', 'timestamp': '', 'source': 'github', 'line_count': 25, 'max_line_length': 51, 'avg_line_length': 20.8, 'alnum_prop': 0.7788461538461539, 'repo_name': 'Studentmediene/Momus', 'id': '23831535a611b150de24b88bc9666648d6f2e948', 'size': '1131', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'src/main/java/no/dusken/momus/model/ArticleReview.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '35650'}, {'name': 'Dockerfile', 'bytes': '1188'}, {'name': 'HTML', 'bytes': '199990'}, {'name': 'Java', 'bytes': '393363'}, {'name': 'JavaScript', 'bytes': '135224'}, {'name': 'Shell', 'bytes': '3219'}, {'name': 'TypeScript', 'bytes': '134615'}]}
class Imagemagick < Formula desc "Tools and libraries to manipulate images in many formats" homepage "http://www.imagemagick.org" url "http://www.imagemagick.org/download/releases/ImageMagick-6.9.2-3.tar.xz" mirror "http://ftp.nluug.nl/ImageMagick/ImageMagick-6.9.2-3.tar.xz" sha256 "e251574136e4a82128b3860b97c72b289df0a2030ce72900c91b67685a3298e4" head "http://git.imagemagick.org/repos/ImageMagick.git" bottle do sha256 "cd5edb53eae0271771df4a77a401a50e973b200ae875a04ef6a3f4d467ca2ef4" => :el_capitan sha256 "fbe139e4d7b540ce03fcde6a7735d9e79ed8652827cd7c877e551abcf804a494" => :yosemite sha256 "99f2f95739d3ee11535fea62440f1608ce0ee1ef22bda2f878353360ab45e9cc" => :mavericks end deprecated_option "enable-hdri" => "with-hdri" option "with-fftw", "Compile with FFTW support" option "with-hdri", "Compile with HDRI support" option "with-jp2", "Compile with Jpeg2000 support" option "with-openmp", "Compile with OpenMP support" option "with-perl", "enable build/install of PerlMagick" option "with-quantum-depth-8", "Compile with a quantum depth of 8 bit" option "with-quantum-depth-16", "Compile with a quantum depth of 16 bit" option "with-quantum-depth-32", "Compile with a quantum depth of 32 bit" option "without-opencl", "Disable OpenCL" option "without-magick-plus-plus", "disable build/install of Magick++" depends_on "xz" depends_on "libtool" => :run depends_on "pkg-config" => :build depends_on "jpeg" => :recommended depends_on "libpng" => :recommended depends_on "libtiff" => :recommended depends_on "freetype" => :recommended depends_on :x11 => :optional depends_on "fontconfig" => :optional depends_on "little-cms" => :optional depends_on "little-cms2" => :optional depends_on "libwmf" => :optional depends_on "librsvg" => :optional depends_on "liblqr" => :optional depends_on "openexr" => :optional depends_on "ghostscript" => :optional depends_on "webp" => :optional depends_on "homebrew/versions/openjpeg21" if build.with? "jp2" depends_on "fftw" => :optional depends_on "pango" => :optional needs :openmp if build.with? "openmp" skip_clean :la def install args = %W[ --disable-osx-universal-binary --prefix=#{prefix} --disable-dependency-tracking --disable-silent-rules --enable-shared --disable-static --with-modules ] if build.with? "openmp" args << "--enable-openmp" else args << "--disable-openmp" end args << "--disable-opencl" if build.without? "opencl" args << "--without-gslib" if build.without? "ghostscript" args << "--without-perl" if build.without? "perl" args << "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts" if build.without? "ghostscript" args << "--without-magick-plus-plus" if build.without? "magick-plus-plus" args << "--enable-hdri=yes" if build.with? "hdri" args << "--enable-fftw=yes" if build.with? "fftw" args << "--without-pango" if build.without? "pango" if build.with? "quantum-depth-32" quantum_depth = 32 elsif build.with? "quantum-depth-16" quantum_depth = 16 elsif build.with? "quantum-depth-8" quantum_depth = 8 end if build.with? "jp2" args << "--with-openjp2" else args << "--without-openjp2" end args << "--with-quantum-depth=#{quantum_depth}" if quantum_depth args << "--with-rsvg" if build.with? "librsvg" args << "--without-x" if build.without? "x11" args << "--with-fontconfig=yes" if build.with? "fontconfig" args << "--with-freetype=yes" if build.with? "freetype" args << "--with-webp=yes" if build.with? "webp" # versioned stuff in main tree is pointless for us inreplace "configure", "${PACKAGE_NAME}-${PACKAGE_VERSION}", "${PACKAGE_NAME}" system "./configure", *args system "make", "install" end def caveats s = <<-EOS.undent For full Perl support you must install the Image::Magick module from the CPAN. https://metacpan.org/module/Image::Magick The version of the Perl module and ImageMagick itself need to be kept in sync. If you upgrade one, you must upgrade the other. For this version of ImageMagick you should install version #{version} of the Image::Magick Perl module. EOS s if build.with? "perl" end test do system "#{bin}/identify", test_fixtures("test.png") end end
{'content_hash': '4ddad1c75dde384b70d78baf82d74f0e', 'timestamp': '', 'source': 'github', 'line_count': 125, 'max_line_length': 107, 'avg_line_length': 35.536, 'alnum_prop': 0.6773975686627646, 'repo_name': 'ctate/autocode-homebrew', 'id': '5ff62b041bcf0aabad7709403bbcbf685f13b727', 'size': '4442', 'binary': False, 'copies': '14', 'ref': 'refs/heads/master', 'path': 'Library/Formula/imagemagick.rb', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'Groff', 'bytes': '30621'}, {'name': 'HTML', 'bytes': '34743'}, {'name': 'Perl', 'bytes': '608'}, {'name': 'PostScript', 'bytes': '485'}, {'name': 'Ruby', 'bytes': '5556951'}, {'name': 'Shell', 'bytes': '22161'}]}
<!DOCTYPE html> <html lang=sl> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Težave, ki jih povzročijo skrbniške omejitve</title> <link rel="stylesheet" type="text/css" href="../vodnik_1404.css"> <script type="text/javascript" src="jquery.js"></script><script type="text/javascript" src="jquery.syntax.js"></script><script type="text/javascript" src="yelp.js"></script> </head> <body id="home"><div id="wrapper" class="hfeed"> <div id="header"> <div id="branding"> <div id="blog-title"><span><a rel="home" title="Ubuntu Slovenija | Uradna spletna stran slovenske skupnosti Linux distribucije Ubuntu" href="https://www.ubuntu.si">Ubuntu Slovenija | Uradna spletna stran slovenske skupnosti Linux distribucije Ubuntu</a></span></div> <h1 id="blog-description"></h1> </div> <div id="access"><div id="loco-header-menu"><ul id="primary-header-menu"><li class="widget-container widget_nav_menu" id="nav_menu-3"><div class="menu-glavni-meni-container"><ul class="menu" id="menu-glavni-meni"> <li id="menu-item-15" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-15"><a href="https://www.ubuntu.si">Novice</a></li> <li id="menu-item-16" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-16"><a href="https://www.ubuntu.si/punbb/">Forum</a></li> <li id="menu-item-19" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-19"><a href="https://www.ubuntu.si/kaj-je-ubuntu/">Kaj je Ubuntu?</a></li> <li id="menu-item-20" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20"><a href="https://www.ubuntu.si/pogosta_vprasanja/">Pogosta vprašanja</a></li> <li id="menu-item-17" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-17"><a href="https://www.ubuntu.si/skupnost/">Skupnost</a></li> <li id="menu-item-18" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18"><a href="https://www.ubuntu.si/povezave/">Povezave</a></li> </ul></div></li></ul></div></div> </div> <div id="main"><div id="cwt-content" class="clearfix content-area"><div id="page"> <div class="trails"><div class="trail"> » <a class="trail" href="index.html" title="Namizni vodnik Ubuntu"><span class="media media-image"><img src="figures/ubuntu-logo.png" height="16" width="16" alt="Pomoč"></span> Namizni vodnik Ubuntu</a> » <a class="trail" href="prefs.html" title="Uporabniške in sistemske nastavitve">Nastavitve</a> » <a class="trail" href="user-accounts.html" title="Uporabniški računi">Uporabniki</a> › <a class="trail" href="user-accounts.html#privileges" title="Uporabniška dovoljenja">Dovoljenja</a> » </div></div> <div id="content"> <!-- Piwik Image Tracker --><img src="https://piwik-ubuntusi.rhcloud.com/piwik.php?idsite=1&amp;rec=1" style="border:0" alt="" /><!-- End Piwik --> <div class="hgroup"><h1 class="title"><span class="title">Težave, ki jih povzročijo skrbniške omejitve</span></h1></div> <div class="region"> <div class="contents"> <p class="p">V primeru da nimate <span class=" link"><a href="user-admin-explain.html" title="Kako delujejo skrbniška dovoljenja?">skrbniških dovoljenj</a></span>, imate lahko nekaj težav. Nekatere stvari za delovanje od vas zahtevajo skrbniška dovoljenja:</p> <div class="list"><div class="inner"><div class="region"><ul class="list"> <li class="list"><p class="p">Povezava z omrežij/brezžičnimi omrežji</p></li> <li class="list"><p class="p">Ogled vsebine odstranljivega diska priklopljenega na računalnik ali vsebine drugega razdelka na disku (na primer, če imate razdelek Windows)</p></li> <li class="list"><p class="p">Nameščanje novih programov</p></li> </ul></div></div></div> <p class="p">Lahko <span class=" link"><a href="user-admin-change.html" title="Sprememba kdo ima skrbniška dovoljenja">spremenite osebo, ki ima skrbniška dovoljenja</a></span>.</p> </div> <div class="sect sect-links"> <div class="hgroup"></div> <div class="contents"><div class="links seealsolinks"><div class="inner"> <div class="title"><h2><span class="title">Več podrobnosti</span></h2></div> <div class="region"><ul><li class="links "><a href="user-accounts.html#privileges" title="Uporabniška dovoljenja">Uporabniška dovoljenja</a></li></ul></div> </div></div></div> </div> </div> <div class="clear"></div> </div> </div></div></div> <div id="footer"><img src="https://piwik-ubuntusi.rhcloud.com/piwik.php?idsite=1amp;rec=1" style="border:0"><div id="siteinfo"><p>Material v tem dokumentu je na voljo pod prosto licenco. To je prevod dokumentacije Ubuntu, ki jo je sestavila <a href="https://wiki.ubuntu.com/DocumentationTeam">Ubuntu dokumentacijska ekpa za Ubuntu</a>. V slovenščino jo je prevedla skupina <a href="https://wiki.lugos.si/slovenjenje:ubuntu">Ubuntu prevajalcev</a>. Za poročanje napak v prevodih v tej dokumentaciji ali Ubuntuju pošljite sporočilo na <a href="mailto:[email protected]?subject=Prijava%20napak%20v%20prevodih">dopisni seznam</a>.</p></div></div> </div></body> </html>
{'content_hash': '4bbed07bae03a4425648305201795ac6', 'timestamp': '', 'source': 'github', 'line_count': 52, 'max_line_length': 657, 'avg_line_length': 95.98076923076923, 'alnum_prop': 0.7184932879182528, 'repo_name': 'ubuntu-si/ubuntu.si', 'id': 'faff38610eccd8986d7bb680b3f72da58e9776de', 'size': '5036', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'vodnik/13.04/user-admin-problems.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '1814'}, {'name': 'CSS', 'bytes': '662090'}, {'name': 'HTML', 'bytes': '20513819'}, {'name': 'JavaScript', 'bytes': '768139'}, {'name': 'PHP', 'bytes': '437543'}, {'name': 'Shell', 'bytes': '22354'}, {'name': 'Smarty', 'bytes': '3767'}]}
<!DOCTYPE html> <html> <head> <link href="../../dist/phosphor.css" rel="stylesheet" type="text/css"> <link href="build/index.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="../../dist/phosphor.js"></script> <script type="text/javascript" src="build/index.js"></script> </head> <body> <div id="main"></div> </body> </html>
{'content_hash': '8442ed131798dbd949fdd3ff2c3b5389', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 72, 'avg_line_length': 29.916666666666668, 'alnum_prop': 0.6434540389972145, 'repo_name': 'KesterTong/phoshpor-notebook', 'id': '7ae860c128f15e543b633616afd1f40803b4b5d8', 'size': '359', 'binary': False, 'copies': '14', 'ref': 'refs/heads/master', 'path': 'examples/splitpanel/index.html', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'CSS', 'bytes': '20108'}, {'name': 'HTML', 'bytes': '5552'}, {'name': 'JavaScript', 'bytes': '5185'}, {'name': 'TypeScript', 'bytes': '440644'}]}
<wordbook> <item><word>toothpick</word></item> <item><word>distaste</word></item> <item><word>redistribution</word></item> <item><word>inpatient</word></item> <item><word>whisker</word></item> <item><word>sloping</word></item> <item><word>mascara</word></item> <item><word>rerun</word></item> <item><word>sanctity</word></item> <item><word>jot</word></item> <item><word>alternating</word></item> <item><word>apathy</word></item> <item><word>typing</word></item> <item><word>experiential</word></item> <item><word>limelight</word></item> <item><word>confessional</word></item> <item><word>diminished</word></item> <item><word>yearbook</word></item> <item><word>bran</word></item> <item><word>desegregation</word></item> <item><word>impeach</word></item> <item><word>exuberance</word></item> <item><word>recoup</word></item> <item><word>arab-israeli</word></item> <item><word>hush</word></item> <item><word>intractable</word></item> <item><word>predate</word></item> <item><word>enlarged</word></item> <item><word>sedentary</word></item> <item><word>decision-maker</word></item> <item><word>flip-flop</word></item> <item><word>stored</word></item> <item><word>sudanese</word></item> <item><word>separatist</word></item> <item><word>aristocracy</word></item> <item><word>pheasant</word></item> <item><word>tweed</word></item> <item><word>melodrama</word></item> <item><word>hurriedly</word></item> <item><word>font</word></item> <item><word>gloved</word></item> <item><word>time-out</word></item> <item><word>looking</word></item> <item><word>decode</word></item> <item><word>teeming</word></item> <item><word>dialectic</word></item> <item><word>andean</word></item> <item><word>persevere</word></item> <item><word>embroider</word></item> <item><word>traditionalist</word></item> <item><word>reservist</word></item> <item><word>screwdriver</word></item> <item><word>buttermilk</word></item> <item><word>esoteric</word></item> <item><word>wavy</word></item> <item><word>never-ending</word></item> <item><word>awash</word></item> <item><word>norman</word></item> <item><word>nudity</word></item> <item><word>dignitary</word></item> <item><word>twenty-nine</word></item> <item><word>oncoming</word></item> <item><word>revisionist</word></item> <item><word>sanitary</word></item> <item><word>grinding</word></item> <item><word>disengage</word></item> <item><word>appropriateness</word></item> <item><word>douse</word></item> <item><word>unspecified</word></item> <item><word>alarmed</word></item> <item><word>cove</word></item> <item><word>nonlinear</word></item> <item><word>snuggle</word></item> <item><word>deviate</word></item> <item><word>snowfall</word></item> <item><word>maize</word></item> <item><word>idyllic</word></item> <item><word>crunchy</word></item> <item><word>townhouse</word></item> <item><word>hereditary</word></item> <item><word>namesake</word></item> <item><word>safari</word></item> <item><word>sickly</word></item> <item><word>importer</word></item> <item><word>reputable</word></item> <item><word>filament</word></item> <item><word>abstain</word></item> <item><word>tactile</word></item> <item><word>immigrate</word></item> <item><word>blurry</word></item> <item><word>tequila</word></item> <item><word>acne</word></item> <item><word>gratifying</word></item> <item><word>unattractive</word></item> <item><word>obnoxious</word></item> <item><word>sclerosis</word></item> <item><word>cockroach</word></item> <item><word>cortex</word></item> <item><word>mistrust</word></item> <item><word>keynote</word></item> </wordbook>
{'content_hash': 'b306c8b724fb75ac92c9f89797cfab42', 'timestamp': '', 'source': 'github', 'line_count': 102, 'max_line_length': 41, 'avg_line_length': 34.69607843137255, 'alnum_prop': 0.6857869454648206, 'repo_name': 'jserz/feget', 'id': '13627bdf0ea0a8e2138a622d12ded3d45bb8b1ca', 'size': '3539', 'binary': False, 'copies': '2', 'ref': 'refs/heads/gh-pages', 'path': '专题/英语/wordFrequencyStatistics/20000wordbook124.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '10713672'}]}
package com.salesforce.dva.argus.service.metric.transform; import com.salesforce.dva.argus.entity.Metric; import org.junit.Test; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.junit.Assert.assertEquals; public class Diff_VTransformTest { private static final String TEST_SCOPE = "test-scope"; private static final String TEST_METRIC = "test-metric"; @Test(expected = IllegalArgumentException.class) public void testDiff_VTransformWithoutMetrics() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); List<Metric> metrics = null; diff_vTransform.transform(metrics); } @Test(expected = IllegalArgumentException.class) public void testDiff_VTransformWithOnlyOneMetric() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); List<Metric> metrics = new ArrayList<Metric>(); Metric metric = new Metric(TEST_SCOPE, TEST_METRIC); metrics.add(metric); diff_vTransform.transform(metrics); } @Test(expected = IllegalArgumentException.class) public void testDiff_VTransformWithConstants() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); List<Metric> metrics = new ArrayList<Metric>(); Metric metric = new Metric(TEST_SCOPE, TEST_METRIC); metrics.add(metric); List<String> constants = new ArrayList<String>(); diff_vTransform.transform(metrics, constants); } @Test(expected = IllegalArgumentException.class) public void testDiff_VTransformVectorWithoutPoints() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); Map<Long, String> datapoints = new HashMap<Long, String>(); datapoints.put(1000L, "1"); Metric metric = new Metric(TEST_SCOPE, TEST_METRIC); metric.setDatapoints(datapoints); Metric vector = new Metric(TEST_SCOPE, TEST_METRIC); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric); metrics.add(vector); diff_vTransform.transform(metrics); } @Test public void testDiff_VTransformWithSameLenVectorAgainstOneMetric() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); Map<Long, String> datapoints = new HashMap<Long, String>(); datapoints.put(1000L, "1"); datapoints.put(2000L, "2"); datapoints.put(3000L, "3"); Metric metric = new Metric(TEST_SCOPE, TEST_METRIC); metric.setDatapoints(datapoints); Map<Long, String> vector_datapoints = new HashMap<Long, String>(); vector_datapoints.put(1000L, "1"); vector_datapoints.put(2000L, "1"); vector_datapoints.put(3000L, "1"); Metric vector = new Metric(TEST_SCOPE, TEST_METRIC); vector.setDatapoints(vector_datapoints); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric); metrics.add(vector); Map<Long, String> expected = new HashMap<Long, String>(); expected.put(1000L, "0.0"); expected.put(2000L, "1.0"); expected.put(3000L, "2.0"); List<Metric> result = diff_vTransform.transform(metrics); assertEquals(result.get(0).getDatapoints().size(), 3); assertEquals(expected, result.get(0).getDatapoints()); } @Test public void testDiff_VTransformWithLongerLenVectorAgainstOneMetric() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); Map<Long, String> datapoints = new HashMap<Long, String>(); datapoints.put(1000L, "1"); datapoints.put(2000L, "2"); datapoints.put(3000L, "3"); Metric metric = new Metric(TEST_SCOPE, TEST_METRIC); metric.setDatapoints(datapoints); Map<Long, String> vector_datapoints = new HashMap<Long, String>(); vector_datapoints.put(1000L, "1"); vector_datapoints.put(2000L, "1"); vector_datapoints.put(3000L, "1"); vector_datapoints.put(4000L, "1"); Metric vector = new Metric(TEST_SCOPE, TEST_METRIC); vector.setDatapoints(vector_datapoints); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric); metrics.add(vector); Map<Long, String> expected = new HashMap<Long, String>(); expected.put(1000L, "0.0"); expected.put(2000L, "1.0"); expected.put(3000L, "2.0"); List<Metric> result = diff_vTransform.transform(metrics); assertEquals(result.get(0).getDatapoints().size(), 3); assertEquals(expected, result.get(0).getDatapoints()); } @Test public void testDiff_VTransformWithShorterLenVectorAgainstOneMetric() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); Map<Long, String> datapoints = new HashMap<Long, String>(); datapoints.put(1000L, "1"); datapoints.put(2000L, "2"); datapoints.put(3000L, "3"); Metric metric = new Metric(TEST_SCOPE, TEST_METRIC); metric.setDatapoints(datapoints); Map<Long, String> vector_datapoints = new HashMap<Long, String>(); vector_datapoints.put(1000L, "1"); vector_datapoints.put(2000L, "1"); Metric vector = new Metric(TEST_SCOPE, TEST_METRIC); vector.setDatapoints(vector_datapoints); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric); metrics.add(vector); Map<Long, String> expected = new HashMap<Long, String>(); expected.put(1000L, "0.0"); expected.put(2000L, "1.0"); expected.put(3000L, "3.0"); List<Metric> result = diff_vTransform.transform(metrics); assertEquals(result.get(0).getDatapoints().size(), 3); assertEquals(expected, result.get(0).getDatapoints()); } @Test public void testDiff_VTransformWithMidMissingPointVectorAgainstOneMetric() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); Map<Long, String> datapoints = new HashMap<Long, String>(); datapoints.put(1000L, "1"); datapoints.put(2000L, "2"); datapoints.put(3000L, "3"); Metric metric = new Metric(TEST_SCOPE, TEST_METRIC); metric.setDatapoints(datapoints); Map<Long, String> vector_datapoints = new HashMap<Long, String>(); vector_datapoints.put(1000L, "1"); vector_datapoints.put(3000L, "1"); Metric vector = new Metric(TEST_SCOPE, TEST_METRIC); vector.setDatapoints(vector_datapoints); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric); metrics.add(vector); Map<Long, String> expected = new HashMap<Long, String>(); expected.put(1000L, "0.0"); expected.put(2000L, "2.0"); expected.put(3000L, "2.0"); List<Metric> result = diff_vTransform.transform(metrics); assertEquals(result.get(0).getDatapoints().size(), 3); assertEquals(expected, result.get(0).getDatapoints()); } @Test public void testDiff_VTransformWithNullPointVectorAgainstOneMetric() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); Map<Long, String> datapoints = new HashMap<Long, String>(); datapoints.put(1000L, "1"); datapoints.put(2000L, "2"); datapoints.put(3000L, "3"); Metric metric = new Metric(TEST_SCOPE, TEST_METRIC); metric.setDatapoints(datapoints); Map<Long, String> vector_datapoints = new HashMap<Long, String>(); vector_datapoints.put(1000L, "1"); vector_datapoints.put(2000L, null); vector_datapoints.put(3000L, "1"); Metric vector = new Metric(TEST_SCOPE, TEST_METRIC); vector.setDatapoints(vector_datapoints); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric); metrics.add(vector); Map<Long, String> expected = new HashMap<Long, String>(); expected.put(1000L, "0.0"); expected.put(2000L, "2.0"); expected.put(3000L, "2.0"); List<Metric> result = diff_vTransform.transform(metrics); assertEquals(result.get(0).getDatapoints().size(), 3); assertEquals(expected, result.get(0).getDatapoints()); } @Test public void testDiff_VTransformWithVectorAgainstOneNullPointMetric() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); Map<Long, String> datapoints = new HashMap<Long, String>(); datapoints.put(1000L, "1"); datapoints.put(2000L, null); datapoints.put(3000L, "3"); Metric metric = new Metric(TEST_SCOPE, TEST_METRIC); metric.setDatapoints(datapoints); Map<Long, String> vector_datapoints = new HashMap<Long, String>(); vector_datapoints.put(1000L, "1"); vector_datapoints.put(2000L, "1"); vector_datapoints.put(3000L, "1"); Metric vector = new Metric(TEST_SCOPE, TEST_METRIC); vector.setDatapoints(vector_datapoints); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric); metrics.add(vector); Map<Long, String> expected = new HashMap<Long, String>(); expected.put(1000L, "0.0"); expected.put(2000L, "-1.0"); expected.put(3000L, "2.0"); List<Metric> result = diff_vTransform.transform(metrics); assertEquals(result.get(0).getDatapoints().size(), 3); assertEquals(expected, result.get(0).getDatapoints()); } @Test public void testDiff_VTransformWithSameShorterLongerVectorAgainstMetricList() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); Map<Long, String> datapoints_1 = new HashMap<Long, String>(); datapoints_1.put(1000L, "1"); datapoints_1.put(2000L, "2"); datapoints_1.put(3000L, "3"); Metric metric_1 = new Metric(TEST_SCOPE, TEST_METRIC); metric_1.setDatapoints(datapoints_1); Map<Long, String> datapoints_2 = new HashMap<Long, String>(); datapoints_2.put(1000L, "10"); datapoints_2.put(2000L, "100"); datapoints_2.put(3000L, "1000"); datapoints_2.put(4000L, "10000"); Metric metric_2 = new Metric(TEST_SCOPE, TEST_METRIC); metric_2.setDatapoints(datapoints_2); Map<Long, String> datapoints_3 = new HashMap<Long, String>(); datapoints_3.put(1000L, "0.1"); datapoints_3.put(2000L, "0.01"); Metric metric_3 = new Metric(TEST_SCOPE, TEST_METRIC); metric_3.setDatapoints(datapoints_3); Map<Long, String> vector_datapoints = new HashMap<Long, String>(); vector_datapoints.put(1000L, "1"); vector_datapoints.put(2000L, "1"); vector_datapoints.put(3000L, "1"); Metric vector = new Metric(TEST_SCOPE, TEST_METRIC); vector.setDatapoints(vector_datapoints); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric_1); metrics.add(metric_2); metrics.add(metric_3); metrics.add(vector); Map<Long, String> expected_1 = new HashMap<Long, String>(); expected_1.put(1000L, "0.0"); expected_1.put(2000L, "1.0"); expected_1.put(3000L, "2.0"); Map<Long, String> expected_2 = new HashMap<Long, String>(); expected_2.put(1000L, "9.0"); expected_2.put(2000L, "99.0"); expected_2.put(3000L, "999.0"); expected_2.put(4000L, "10000.0"); Map<Long, String> expected_3 = new HashMap<Long, String>(); expected_3.put(1000L, "-0.9"); expected_3.put(2000L, "-0.99"); List<Metric> result = diff_vTransform.transform(metrics); assertEquals(result.get(0).getDatapoints().size(), 3); assertEquals(expected_1, result.get(0).getDatapoints()); assertEquals(result.get(1).getDatapoints().size(), 4); assertEquals(expected_2, result.get(1).getDatapoints()); assertEquals(result.get(2).getDatapoints().size(), 2); assertEquals(expected_3, result.get(2).getDatapoints()); } @Test public void testDiff_VTransformWithMissingPointNullPointVectorAgainstNullPointMetricList() { Transform diff_vTransform = new MetricZipperTransform(new DiffValueZipper()); Map<Long, String> datapoints_1 = new HashMap<Long, String>(); datapoints_1.put(1000L, "1"); datapoints_1.put(2000L, "2"); datapoints_1.put(3000L, "3"); Metric metric_1 = new Metric(TEST_SCOPE, TEST_METRIC); metric_1.setDatapoints(datapoints_1); Map<Long, String> datapoints_2 = new HashMap<Long, String>(); datapoints_2.put(1000L, "10"); datapoints_2.put(2000L, "100"); datapoints_2.put(4000L, "1000"); datapoints_2.put(5000L, "10000"); Metric metric_2 = new Metric(TEST_SCOPE, TEST_METRIC); metric_2.setDatapoints(datapoints_2); Map<Long, String> datapoints_3 = new HashMap<Long, String>(); datapoints_3.put(1000L, "0.1"); datapoints_3.put(2000L, "0.01"); datapoints_3.put(4000L, "0.001"); datapoints_3.put(5000L, null); Metric metric_3 = new Metric(TEST_SCOPE, TEST_METRIC); metric_3.setDatapoints(datapoints_3); Map<Long, String> vector_datapoints = new HashMap<Long, String>(); vector_datapoints.put(1000L, "1"); vector_datapoints.put(2000L, "1"); vector_datapoints.put(4000L, "1"); vector_datapoints.put(5000L, null); Metric vector = new Metric(TEST_SCOPE, TEST_METRIC); vector.setDatapoints(vector_datapoints); List<Metric> metrics = new ArrayList<Metric>(); metrics.add(metric_1); metrics.add(metric_2); metrics.add(metric_3); metrics.add(vector); Map<Long, String> expected_1 = new HashMap<Long, String>(); expected_1.put(1000L, "0.0"); expected_1.put(2000L, "1.0"); expected_1.put(3000L, "3.0"); Map<Long, String> expected_2 = new HashMap<Long, String>(); expected_2.put(1000L, "9.0"); expected_2.put(2000L, "99.0"); expected_2.put(4000L, "999.0"); expected_2.put(5000L, "10000.0"); Map<Long, String> expected_3 = new HashMap<Long, String>(); expected_3.put(1000L, "-0.9"); expected_3.put(2000L, "-0.99"); expected_3.put(4000L, "-0.999"); expected_3.put(5000L, "0.0"); List<Metric> result = diff_vTransform.transform(metrics); assertEquals(result.get(0).getDatapoints().size(), 3); assertEquals(expected_1, result.get(0).getDatapoints()); assertEquals(result.get(1).getDatapoints().size(), 4); assertEquals(expected_2, result.get(1).getDatapoints()); assertEquals(result.get(2).getDatapoints().size(), 4); assertEquals(expected_3, result.get(2).getDatapoints()); } } /* Copyright (c) 2016, Salesforce.com, Inc. All rights reserved. */
{'content_hash': '45cd5fbc4143324ca8765861a82e9a48', 'timestamp': '', 'source': 'github', 'line_count': 469, 'max_line_length': 96, 'avg_line_length': 32.53091684434968, 'alnum_prop': 0.6307268794651635, 'repo_name': 'saaja-sfdc/Argus', 'id': 'ed0df617646a812937095c097a697aa280c30aa3', 'size': '16827', 'binary': False, 'copies': '7', 'ref': 'refs/heads/argus-sdk', 'path': 'ArgusCore/src/test/java/com/salesforce/dva/argus/service/metric/transform/Diff_VTransformTest.java', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'CSS', 'bytes': '7448'}, {'name': 'HTML', 'bytes': '42999'}, {'name': 'Java', 'bytes': '2980530'}, {'name': 'JavaScript', 'bytes': '152061'}, {'name': 'Shell', 'bytes': '479'}]}
import os from os.path import dirname, join, splitext, expanduser import logging from rdflib import Literal, URIRef, Namespace, ConjunctiveGraph, RDFS #======================================================================= _logger = logging.getLogger(name=__name__) # TODO: some of this has been moved to rdfextras.tools(.pathutils); # track that and depend on it instead when it has landed. def get_ext(fpath, lower=True): """Gets the file extension from a file(path); stripped of leading '.' and in lower case. Examples: >>> get_ext("path/to/file.txt") 'txt' >>> get_ext("OTHER.PDF") 'pdf' >>> get_ext("noext") '' """ ext = splitext(fpath)[-1] if lower: ext = ext.lower() if ext.startswith('.'): ext = ext[1:] return ext DEFAULT_FORMAT_MAP = { 'rdf': 'xml', 'rdfs': 'xml', 'owl': 'xml', 'n3': 'n3', 'ttl': 'n3', 'nt': 'nt', 'trix': 'trix', 'xhtml': 'rdfa', 'html': 'rdfa', } def get_format(fpath, fmap=None): """Guess RDF serialization based on file suffix. Uses ``DEFAULT_FORMAT_MAP`` unless ``fmap`` is provided. Examples: >>> get_format('path/to/file.rdf') 'xml' >>> get_format('path/to/file.owl') 'xml' >>> get_format('path/to/file.ttl') 'n3' >>> get_format('path/to/file.xhtml') 'rdfa' >>> get_format('path/to/file.xhtml', {'xhtml': 'grddl'}) 'grddl' """ fmap = fmap or DEFAULT_FORMAT_MAP return fmap.get(get_ext(fpath)) def get_uri_leaf(uri): """Get the "leaf" - fragment id or last segment - of a URI. Examples: >>> get_uri_leaf('http://example.org/ns/things#item') u'item' >>> get_uri_leaf('http://example.org/ns/stuff/item') u'item' >>> get_uri_leaf('http://example.org/ns/stuff/') u'' """ return unicode(uri).split('/')[-1].split('#')[-1] #----------------------------------------------------------------------- def collect_dir(basedir, loader, accept=None, getFormat=None, errorHandler=None): getFormat = getFormat or get_format for base, fdirs, fnames in os.walk(basedir): for fname in fnames: fpath = join(base, fname) if accept and not accept(fpath): _logger.debug("Not accepted: <%s>, skipping.", fpath) continue format = getFormat(fpath) if not format: _logger.debug("Unknown format: <%s>, skipping.", fpath) continue try: loader(fpath, format) except Exception, e: if errorHandler: errorHandler(e, fpath) else: raise # TODO: Brittle? Only fixes non-posix fpaths (unix fpaths work anyway), and # only on non-posix systems. Is the "fix" good enough? def fix_nonposix_path(fpath, sep=os.path.sep): if sep != '/': fpath = "file:///" + "/".join(fpath.split(sep)) return fpath #----------------------------------------------------------------------- def dir_to_graph(basedir, graph=None): """ Recursively loads file system directory into the given (or an in-memory) graph. Returns the graph. """ graph = graph or ConjunctiveGraph() allowedExts = DEFAULT_FORMAT_MAP.keys() def accept(fpath): ext = get_ext(fpath) return ext in allowedExts def loader(fpath, format): fpath = fix_nonposix_path(fpath) _logger.info("Loading: <%s>", fpath) graph.load(fpath, format=format) collect_dir(basedir, loader, accept) return graph def loader(graph, basedir=None, formatMap=None): if basedir: basedir = expanduser(basedir) def load_data(fpath): if basedir: fpath = join(basedir, fpath) load_if_modified(graph, fpath, format=get_format(fpath, formatMap)) return load_data #----------------------------------------------------------------------- # TODO: hook-in for basic inference? (subClassOf/subPropertyOf; with FuXi..) OUG_NS = Namespace('tag:oort.to,2006:system/util/graphs#') LAST_MOD = OUG_NS.lastmodified def load_if_modified(graph, fpath, format='xml', contextUri=None): """ Loads the given file (with optional given ``format``) into the ``graph``, using timestamps and named subgraphs to manage updates. The file will *only* be loaded if it has been changed since last load (if any). If loaded it will end up in a subgraph named by the contextUri, and the last modified time will be added for that context. If the contextUri exists in the graph and the stored timestamp is older than the file timestamp, the subgraph in that context will be removed and the file will be reloaded. ``contextUri`` an optional context uri to be used. If not supplied, graph.absolutize(filepath) will be used. """ modTime = os.stat(fpath).st_mtime fpath = fix_nonposix_path(fpath) contextUri = contextUri or graph.absolutize(fpath) try: loadedModValue = graph.value(contextUri, LAST_MOD) loadedModTime = float(loadedModValue) except TypeError: loadedModTime = -1 if modTime > loadedModTime: graph.remove((contextUri, LAST_MOD, loadedModValue)) graph.remove_context(graph.context_id(contextUri)) _logger.info('Loading <%s> into <%s>', fpath, contextUri) graph.load(fpath, publicID=contextUri, format=format) graph.add((contextUri, LAST_MOD, Literal(modTime))) def load_dir_if_modified(graph, basedir, accept=None, getFormat=None, errorHandler=None, computeContextUri=None): """ Loads a file system directory into the given graph. ``accept`` an optional callable returning wether a given file should be loaded. By default, all files with a computable format will be loaded. ``computeContextUri`` an optional callable returning the context uri to be used. It's given the arguments (graph, filepath). If not supplied, the default method of ``load_if_modified`` will be used. """ basedir = expanduser(basedir) def loader(fpath, format): if computeContextUri: contextUri = computeContextUri(graph, fpath) else: contextUri = None load_if_modified(graph, fpath, format, contextUri) collect_dir(basedir, loader, accept, getFormat, errorHandler) # TODO: backwards-compat; deprecate? def load_dir(graph, basedir, formatMap=None, errorHandler=None): formatMap = formatMap or DEFAULT_FORMAT_MAP getFormat = lambda fpath: get_format(fpath, fmap=formatMap) load_dir_if_modified( graph, basedir, None, getFormat, errorHandler) #----------------------------------------------------------------------- def replace_uri(graph, old, new, predicates=False): newGraph = ConjunctiveGraph() for pfx, ns in graph.namespace_manager.namespaces(): newGraph.namespace_manager.bind(pfx, ns) for s, p, o in graph: s = _change_uri(s, old, new) if predicates: p = _change_uri(p, old, new) if isinstance(o, URIRef): o = _change_uri(o, old, new) newGraph.add((s, p, o)) return newGraph def _change_uri(uri, old, new): uri = uri.replace(old, new, 1) return URIRef(uri)
{'content_hash': 'e38846dd61165f2b4f30064344aee6b9', 'timestamp': '', 'source': 'github', 'line_count': 235, 'max_line_length': 80, 'avg_line_length': 31.842553191489362, 'alnum_prop': 0.581184017105439, 'repo_name': 'tectronics/oort.python', 'id': 'a2642e7e08203b2466e61cdc8ec59b24f29f24a8', 'size': '7580', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'oort/util/graphs.py', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Python', 'bytes': '100048'}]}
class Chef module Mixin module FromFile # Source path from which the object was loaded attr_accessor :source_file # Loads a given ruby file, and runs instance_eval against it in the context of the current # object. # # Raises an IOError if the file cannot be found, or is not readable. def from_file(filename) self.source_file = filename if File.exists?(filename) && File.readable?(filename) instance_eval(IO.read(filename), filename, 1) else raise IOError, "Cannot open or read #{filename}!" end end # Loads a given ruby file, and runs class_eval against it in the context of the current # object. # # Raises an IOError if the file cannot be found, or is not readable. def class_from_file(filename) self.source_file = filename if File.exists?(filename) && File.readable?(filename) class_eval(IO.read(filename), filename, 1) else raise IOError, "Cannot open or read #{filename}!" end end end end end
{'content_hash': '907ddbb212cff25fe478524b311c4adf', 'timestamp': '', 'source': 'github', 'line_count': 36, 'max_line_length': 96, 'avg_line_length': 30.666666666666668, 'alnum_prop': 0.6186594202898551, 'repo_name': 'tomdoherty/chef', 'id': 'e19597dde84c60ac49930d59f619dc1f6d27e6c7', 'size': '1834', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'lib/chef/mixin/from_file.rb', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '2717'}, {'name': 'Dockerfile', 'bytes': '345'}, {'name': 'HTML', 'bytes': '37416'}, {'name': 'Makefile', 'bytes': '1326'}, {'name': 'Perl', 'bytes': '64'}, {'name': 'PowerShell', 'bytes': '17296'}, {'name': 'Python', 'bytes': '54260'}, {'name': 'Roff', 'bytes': '781'}, {'name': 'Ruby', 'bytes': '9422991'}, {'name': 'Shell', 'bytes': '24693'}]}
static NSString *const kPTKLocalizedStringsTableName = @"PaymentKit"; static NSString *const kPTKOldLocalizedStringsTableName = @"STPaymentLocalizable"; #import "PTKView.h" #import "PTKTextField.h" @interface PTKView () <PTKTextFieldDelegate> { @private BOOL _isInitialState; BOOL _isValidState; } @property (nonatomic, readonly, assign) UIResponder *firstResponderField; @property (nonatomic, readonly, assign) PTKTextField *firstInvalidField; @property (nonatomic, readonly, assign) PTKTextField *nextFirstResponder; - (void)setup; - (void)setupPlaceholderView; - (void)setupCardNumberField; - (void)setupCardExpiryField; - (void)setupCardCVCField; - (void)pkTextFieldDidBackSpaceWhileTextIsEmpty:(PTKTextField *)textField; - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString; - (BOOL)cardNumberFieldShouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString; - (BOOL)cardExpiryShouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString; - (BOOL)cardCVCShouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString; @property (nonatomic) UIView *opaqueOverGradientView; @property (nonatomic) PTKCardNumber *cardNumber; @property (nonatomic) PTKCardExpiry *cardExpiry; @property (nonatomic) PTKCardCVC *cardCVC; @property (nonatomic) PTKAddressZip *addressZip; @end #pragma mark - @implementation PTKView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self setup]; } return self; } - (void)awakeFromNib { [super awakeFromNib]; [self setup]; } - (void)setup { _isInitialState = YES; _isValidState = NO; self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, 290, 46); self.backgroundColor = [UIColor clearColor]; UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:self.bounds]; backgroundImageView.image = [[UIImage imageNamed:@"textfield"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 8, 0, 8)]; [self addSubview:backgroundImageView]; self.innerView = [[UIView alloc] initWithFrame:CGRectMake(40, 12, self.frame.size.width - 40, 20)]; self.innerView.clipsToBounds = YES; [self setupPlaceholderView]; [self setupCardNumberField]; [self setupCardExpiryField]; [self setupCardCVCField]; [self.innerView addSubview:self.cardNumberField]; UIImageView *gradientImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 12, 34)]; gradientImageView.image = [UIImage imageNamed:@"gradient"]; [self.innerView addSubview:gradientImageView]; self.opaqueOverGradientView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 9, 34)]; self.opaqueOverGradientView.backgroundColor = [UIColor colorWithRed:0.9686 green:0.9686 blue:0.9686 alpha:1.0000]; self.opaqueOverGradientView.alpha = 0.0; [self.innerView addSubview:self.opaqueOverGradientView]; [self addSubview:self.innerView]; [self addSubview:self.placeholderView]; [self stateCardNumber]; } - (void)setupPlaceholderView { self.placeholderView = [[UIImageView alloc] initWithFrame:CGRectMake(12, 13, 32, 20)]; self.placeholderView.backgroundColor = [UIColor clearColor]; self.placeholderView.image = [UIImage imageNamed:@"placeholder"]; CALayer *clip = [CALayer layer]; clip.frame = CGRectMake(32, 0, 4, 20); clip.backgroundColor = [UIColor clearColor].CGColor; [self.placeholderView.layer addSublayer:clip]; } - (void)setupCardNumberField { self.cardNumberField = [[PTKTextField alloc] initWithFrame:CGRectMake(12, 0, 170, 20)]; self.cardNumberField.delegate = self; self.cardNumberField.placeholder = [self.class localizedStringWithKey:@"placeholder.card_number" defaultValue:@"1234 5678 9012 3456"]; self.cardNumberField.keyboardType = UIKeyboardTypeNumberPad; self.cardNumberField.textColor = DarkGreyColor; self.cardNumberField.font = DefaultBoldFont; [self.cardNumberField.layer setMasksToBounds:YES]; } - (void)setupCardExpiryField { self.cardExpiryField = [[PTKTextField alloc] initWithFrame:CGRectMake(kPTKViewCardExpiryFieldStartX, 0, 60, 20)]; self.cardExpiryField.delegate = self; self.cardExpiryField.placeholder = [self.class localizedStringWithKey:@"placeholder.card_expiry" defaultValue:@"MM/YY"]; self.cardExpiryField.keyboardType = UIKeyboardTypeNumberPad; self.cardExpiryField.textColor = DarkGreyColor; self.cardExpiryField.font = DefaultBoldFont; [self.cardExpiryField.layer setMasksToBounds:YES]; } - (void)setupCardCVCField { self.cardCVCField = [[PTKTextField alloc] initWithFrame:CGRectMake(kPTKViewCardCVCFieldStartX, 0, 55, 20)]; self.cardCVCField.delegate = self; self.cardCVCField.placeholder = [self.class localizedStringWithKey:@"placeholder.card_cvc" defaultValue:@"CVC"]; self.cardCVCField.keyboardType = UIKeyboardTypeNumberPad; self.cardCVCField.textColor = DarkGreyColor; self.cardCVCField.font = DefaultBoldFont; [self.cardCVCField.layer setMasksToBounds:YES]; } // Checks both the old and new localization table (we switched in 3/14 to PaymentKit.strings). // Leave this in for a long while to preserve compatibility. + (NSString *)localizedStringWithKey:(NSString *)key defaultValue:(NSString *)defaultValue { NSString *value = NSLocalizedStringFromTable(key, kPTKLocalizedStringsTableName, nil); if (value && ![value isEqualToString:key]) { // key == no value return value; } else { value = NSLocalizedStringFromTable(key, kPTKOldLocalizedStringsTableName, nil); if (value && ![value isEqualToString:key]) { return value; } } return defaultValue; } #pragma mark - Accessors - (PTKCardNumber *)cardNumber { return [PTKCardNumber cardNumberWithString:self.cardNumberField.text]; } - (PTKCardExpiry *)cardExpiry { return [PTKCardExpiry cardExpiryWithString:self.cardExpiryField.text]; } - (PTKCardCVC *)cardCVC { return [PTKCardCVC cardCVCWithString:self.cardCVCField.text]; } #pragma mark - State - (void)stateCardNumber { if (!_isInitialState) { // Animate left _isInitialState = YES; [UIView animateWithDuration:0.05 delay:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.opaqueOverGradientView.alpha = 0.0; } completion:^(BOOL finished) { }]; [UIView animateWithDuration:0.400 delay:0 options:(UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction) animations:^{ self.cardExpiryField.frame = CGRectMake(kPTKViewCardExpiryFieldStartX, self.cardExpiryField.frame.origin.y, self.cardExpiryField.frame.size.width, self.cardExpiryField.frame.size.height); self.cardCVCField.frame = CGRectMake(kPTKViewCardCVCFieldStartX, self.cardCVCField.frame.origin.y, self.cardCVCField.frame.size.width, self.cardCVCField.frame.size.height); self.cardNumberField.frame = CGRectMake(12, self.cardNumberField.frame.origin.y, self.cardNumberField.frame.size.width, self.cardNumberField.frame.size.height); } completion:^(BOOL completed) { [self.cardExpiryField removeFromSuperview]; [self.cardCVCField removeFromSuperview]; }]; } [self.cardNumberField becomeFirstResponder]; } - (void)stateMeta { _isInitialState = NO; CGSize cardNumberSize; CGSize lastGroupSize; #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 if ([self.cardNumber.formattedString respondsToSelector:@selector(sizeWithAttributes:)]) { NSDictionary *attributes = @{NSFontAttributeName: DefaultBoldFont}; cardNumberSize = [self.cardNumber.formattedString sizeWithAttributes:attributes]; lastGroupSize = [self.cardNumber.lastGroup sizeWithAttributes:attributes]; } else { cardNumberSize = [self.cardNumber.formattedString sizeWithFont:DefaultBoldFont]; lastGroupSize = [self.cardNumber.lastGroup sizeWithFont:DefaultBoldFont]; } #else NSDictionary *attributes = @{NSFontAttributeName: DefaultBoldFont}; cardNumberSize = [self.cardNumber.formattedString sizeWithAttributes:attributes]; lastGroupSize = [self.cardNumber.lastGroup sizeWithAttributes:attributes]; #endif CGFloat frameX = self.cardNumberField.frame.origin.x - (cardNumberSize.width - lastGroupSize.width); [UIView animateWithDuration:0.05 delay:0.35 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.opaqueOverGradientView.alpha = 1.0; } completion:^(BOOL finished) { }]; [UIView animateWithDuration:0.400 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.cardExpiryField.frame = CGRectMake(kPTKViewCardExpiryFieldEndX, self.cardExpiryField.frame.origin.y, self.cardExpiryField.frame.size.width, self.cardExpiryField.frame.size.height); self.cardCVCField.frame = CGRectMake(kPTKViewCardCVCFieldEndX, self.cardCVCField.frame.origin.y, self.cardCVCField.frame.size.width, self.cardCVCField.frame.size.height); self.cardNumberField.frame = CGRectMake(frameX, self.cardNumberField.frame.origin.y, self.cardNumberField.frame.size.width, self.cardNumberField.frame.size.height); } completion:nil]; [self addSubview:self.placeholderView]; [self.innerView addSubview:self.cardExpiryField]; [self.innerView addSubview:self.cardCVCField]; [self.cardExpiryField becomeFirstResponder]; } - (void)stateCardCVC { [self.cardCVCField becomeFirstResponder]; } - (BOOL)isValid { return [self.cardNumber isValid] && [self.cardExpiry isValid] && [self.cardCVC isValidWithType:self.cardNumber.cardType]; } - (PTKCard *)card { PTKCard *card = [[PTKCard alloc] init]; card.number = [self.cardNumber string]; card.cvc = [self.cardCVC string]; card.expMonth = [self.cardExpiry month]; card.expYear = [self.cardExpiry year]; return card; } - (void)setPlaceholderViewImage:(UIImage *)image { if (![self.placeholderView.image isEqual:image]) { __block __unsafe_unretained UIView *previousPlaceholderView = self.placeholderView; [UIView animateWithDuration:kPTKViewPlaceholderViewAnimationDuration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.placeholderView.layer.opacity = 0.0; self.placeholderView.layer.transform = CATransform3DMakeScale(1.2, 1.2, 1.2); } completion:^(BOOL finished) { [previousPlaceholderView removeFromSuperview]; }]; self.placeholderView = nil; [self setupPlaceholderView]; self.placeholderView.image = image; self.placeholderView.layer.opacity = 0.0; self.placeholderView.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8); [self insertSubview:self.placeholderView belowSubview:previousPlaceholderView]; [UIView animateWithDuration:kPTKViewPlaceholderViewAnimationDuration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.placeholderView.layer.opacity = 1.0; self.placeholderView.layer.transform = CATransform3DIdentity; } completion:^(BOOL finished) { }]; } } - (void)setPlaceholderToCVC { PTKCardNumber *cardNumber = [PTKCardNumber cardNumberWithString:self.cardNumberField.text]; PTKCardType cardType = [cardNumber cardType]; if (cardType == PTKCardTypeAmex) { [self setPlaceholderViewImage:[UIImage imageNamed:@"cvc-amex"]]; } else { [self setPlaceholderViewImage:[UIImage imageNamed:@"cvc"]]; } } - (void)setPlaceholderToCardType { PTKCardNumber *cardNumber = [PTKCardNumber cardNumberWithString:self.cardNumberField.text]; PTKCardType cardType = [cardNumber cardType]; NSString *cardTypeName = @"placeholder"; switch (cardType) { case PTKCardTypeAmex: cardTypeName = @"amex"; break; case PTKCardTypeDinersClub: cardTypeName = @"diners"; break; case PTKCardTypeDiscover: cardTypeName = @"discover"; break; case PTKCardTypeJCB: cardTypeName = @"jcb"; break; case PTKCardTypeMasterCard: cardTypeName = @"mastercard"; break; case PTKCardTypeVisa: cardTypeName = @"visa"; break; default: break; } [self setPlaceholderViewImage:[UIImage imageNamed:cardTypeName]]; } #pragma mark - Delegates - (void)textFieldDidBeginEditing:(UITextField *)textField { if ([textField isEqual:self.cardCVCField]) { [self setPlaceholderToCVC]; } else { [self setPlaceholderToCardType]; } if ([textField isEqual:self.cardNumberField] && !_isInitialState) { [self stateCardNumber]; } } - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString { if ([textField isEqual:self.cardNumberField]) { return [self cardNumberFieldShouldChangeCharactersInRange:range replacementString:replacementString]; } if ([textField isEqual:self.cardExpiryField]) { return [self cardExpiryShouldChangeCharactersInRange:range replacementString:replacementString]; } if ([textField isEqual:self.cardCVCField]) { return [self cardCVCShouldChangeCharactersInRange:range replacementString:replacementString]; } return YES; } - (void)pkTextFieldDidBackSpaceWhileTextIsEmpty:(PTKTextField *)textField { if (textField == self.cardCVCField) [self.cardExpiryField becomeFirstResponder]; else if (textField == self.cardExpiryField) [self stateCardNumber]; } - (BOOL)cardNumberFieldShouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString { NSString *resultString = [self.cardNumberField.text stringByReplacingCharactersInRange:range withString:replacementString]; resultString = [PTKTextField textByRemovingUselessSpacesFromString:resultString]; PTKCardNumber *cardNumber = [PTKCardNumber cardNumberWithString:resultString]; if (![cardNumber isPartiallyValid]) return NO; if (replacementString.length > 0) { self.cardNumberField.text = [cardNumber formattedStringWithTrail]; } else { self.cardNumberField.text = [cardNumber formattedString]; } [self setPlaceholderToCardType]; if ([cardNumber isValid]) { [self textFieldIsValid:self.cardNumberField]; [self stateMeta]; } else if ([cardNumber isValidLength] && ![cardNumber isValidLuhn]) { [self textFieldIsInvalid:self.cardNumberField withErrors:YES]; } else if (![cardNumber isValidLength]) { [self textFieldIsInvalid:self.cardNumberField withErrors:NO]; } return NO; } - (BOOL)cardExpiryShouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString { NSString *resultString = [self.cardExpiryField.text stringByReplacingCharactersInRange:range withString:replacementString]; resultString = [PTKTextField textByRemovingUselessSpacesFromString:resultString]; PTKCardExpiry *cardExpiry = [PTKCardExpiry cardExpiryWithString:resultString]; if (![cardExpiry isPartiallyValid]) return NO; // Only support shorthand year if ([cardExpiry formattedString].length > 5) return NO; if (replacementString.length > 0) { self.cardExpiryField.text = [cardExpiry formattedStringWithTrail]; } else { self.cardExpiryField.text = [cardExpiry formattedString]; } if ([cardExpiry isValid]) { [self textFieldIsValid:self.cardExpiryField]; [self stateCardCVC]; } else if ([cardExpiry isValidLength] && ![cardExpiry isValidDate]) { [self textFieldIsInvalid:self.cardExpiryField withErrors:YES]; } else if (![cardExpiry isValidLength]) { [self textFieldIsInvalid:self.cardExpiryField withErrors:NO]; } return NO; } - (BOOL)cardCVCShouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementString { NSString *resultString = [self.cardCVCField.text stringByReplacingCharactersInRange:range withString:replacementString]; resultString = [PTKTextField textByRemovingUselessSpacesFromString:resultString]; PTKCardCVC *cardCVC = [PTKCardCVC cardCVCWithString:resultString]; PTKCardType cardType = [[PTKCardNumber cardNumberWithString:self.cardNumberField.text] cardType]; // Restrict length if (![cardCVC isPartiallyValidWithType:cardType]) return NO; // Strip non-digits self.cardCVCField.text = [cardCVC string]; if ([cardCVC isValidWithType:cardType]) { [self textFieldIsValid:self.cardCVCField]; } else { [self textFieldIsInvalid:self.cardCVCField withErrors:NO]; } return NO; } #pragma mark - Validations - (void)checkValid { if ([self isValid]) { _isValidState = YES; if ([self.delegate respondsToSelector:@selector(paymentView:withCard:isValid:)]) { [self.delegate paymentView:self withCard:self.card isValid:YES]; } } else if (![self isValid] && _isValidState) { _isValidState = NO; if ([self.delegate respondsToSelector:@selector(paymentView:withCard:isValid:)]) { [self.delegate paymentView:self withCard:self.card isValid:NO]; } } } - (void)textFieldIsValid:(UITextField *)textField { textField.textColor = DarkGreyColor; [self checkValid]; } - (void)textFieldIsInvalid:(UITextField *)textField withErrors:(BOOL)errors { if (errors) { textField.textColor = RedColor; } else { textField.textColor = DarkGreyColor; } [self checkValid]; } #pragma mark - #pragma mark UIResponder - (UIResponder *)firstResponderField; { NSArray *responders = @[self.cardNumberField, self.cardExpiryField, self.cardCVCField]; for (UIResponder *responder in responders) { if (responder.isFirstResponder) { return responder; } } return nil; } - (PTKTextField *)firstInvalidField; { if (![[PTKCardNumber cardNumberWithString:self.cardNumberField.text] isValid]) return self.cardNumberField; else if (![[PTKCardExpiry cardExpiryWithString:self.cardExpiryField.text] isValid]) return self.cardExpiryField; else if (![[PTKCardCVC cardCVCWithString:self.cardCVCField.text] isValid]) return self.cardCVCField; return nil; } - (PTKTextField *)nextFirstResponder; { if (self.firstInvalidField) return self.firstInvalidField; return self.cardCVCField; } - (BOOL)isFirstResponder; { return self.firstResponderField.isFirstResponder; } - (BOOL)canBecomeFirstResponder; { return self.nextFirstResponder.canBecomeFirstResponder; } - (BOOL)becomeFirstResponder; { return [self.nextFirstResponder becomeFirstResponder]; } - (BOOL)canResignFirstResponder; { return self.firstResponderField.canResignFirstResponder; } - (BOOL)resignFirstResponder; { return [self.firstResponderField resignFirstResponder]; } @end
{'content_hash': '87dc3e977e8d517a4fb960f0b680dd22', 'timestamp': '', 'source': 'github', 'line_count': 584, 'max_line_length': 138, 'avg_line_length': 34.886986301369866, 'alnum_prop': 0.6872975360753902, 'repo_name': 'JoeFerrucci/stripe-ios', 'id': '5ab6d24abbba9c0a18f4a20d5d3605f8500a3979', 'size': '20993', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'Example/Stripe iOS Example (Custom)/PaymentKit/PTKView.m', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '389'}, {'name': 'Objective-C', 'bytes': '625263'}, {'name': 'Ruby', 'bytes': '2656'}, {'name': 'Shell', 'bytes': '3171'}, {'name': 'Swift', 'bytes': '12347'}]}
import { ReactNode, SFC } from 'react'; import { AboutModal as PAboutModal } from '@patternfly/react-core'; export interface AboutModalProps { /** Content rendered inside the About Modal. */ children: ReactNode; /** Flag to show the About modal */ isOpen?: boolean; /** A callback for when the close button is clicked */ onClose?: Function; /** Product name */ productName: string; /** Trademark information */ trademark?: string; /** The URL of the image for the Brand */ brandImageSrc: string; /** The alternate text of the Brand image */ brandImageAlt: string; /** The URL of the image for the Logo */ logoImageSrc?: string; /** The alternate text of the Logo image */ logoImageAlt?: string; /** The URL of the image for the Hero */ heroImageSrc: string; /** The alternate text of the Hero image */ heroImageAlt?: string; } export default PAboutModal as SFC<AboutModalProps>;
{'content_hash': '0c70e8c88b12106d42f6eeeb2b852cee', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 67, 'avg_line_length': 31.896551724137932, 'alnum_prop': 0.6886486486486486, 'repo_name': 'fabric8-ui/fabric8-ui', 'id': '9c195a47d9decf69cf6b14bca58171028cf16516', 'size': '925', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'packages/components/react-widgets/src/components/AboutModal/AboutModal.tsx', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '173210'}, {'name': 'Dockerfile', 'bytes': '2373'}, {'name': 'HTML', 'bytes': '338577'}, {'name': 'JavaScript', 'bytes': '198400'}, {'name': 'Ruby', 'bytes': '2858'}, {'name': 'Shell', 'bytes': '65448'}, {'name': 'TypeScript', 'bytes': '2561363'}]}
require 'rails/all' require './lib/searchable' module Searchable class Application < Rails::Application end end ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') ActiveRecord::Schema.define do self.verbose = false create_table :movies, force: true do |t| t.string :title t.string :original_title t.boolean :published end end
{'content_hash': '153b753565f0f85d303da3a93194bec2', 'timestamp': '', 'source': 'github', 'line_count': 20, 'max_line_length': 81, 'avg_line_length': 19.2, 'alnum_prop': 0.7239583333333334, 'repo_name': 'moviepilot-de/searchable', 'id': '3384a624444fe7ffd1ce699f2f433af65e5d5efa', 'size': '384', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'spec/spec_helper.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '12450'}]}
- Elasticsearch 2.0 does not allow for dots in field names. This change changes to use sub-field syntax instead of dotted syntax. This is a breaking change. ## 2.0.2 - Fix test that used deprecated "tags" syntax ## 2.0.0 - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully, instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895 - Dependency on logstash-core update to 2.0
{'content_hash': '7f3025a8a4183ff843e94ce26887ea5a', 'timestamp': '', 'source': 'github', 'line_count': 10, 'max_line_length': 139, 'avg_line_length': 52.2, 'alnum_prop': 0.7624521072796935, 'repo_name': 'svanschalkwyk/datafari', 'id': 'c0b6979e754483caaf336dc756d2ce33d418454f', 'size': '531', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'debian7/elk/logstash/vendor/bundle/jruby/1.9/gems/logstash-filter-metrics-3.0.0/CHANGELOG.md', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'AMPL', 'bytes': '291'}, {'name': 'Batchfile', 'bytes': '166634'}, {'name': 'C', 'bytes': '3950596'}, {'name': 'C#', 'bytes': '8440'}, {'name': 'C++', 'bytes': '1806622'}, {'name': 'CSS', 'bytes': '996076'}, {'name': 'F#', 'bytes': '2310'}, {'name': 'Forth', 'bytes': '506'}, {'name': 'GLSL', 'bytes': '1040'}, {'name': 'Groff', 'bytes': '7328332'}, {'name': 'HTML', 'bytes': '3845976'}, {'name': 'Inno Setup', 'bytes': '15298'}, {'name': 'Java', 'bytes': '4071199'}, {'name': 'JavaScript', 'bytes': '11468742'}, {'name': 'Makefile', 'bytes': '38845'}, {'name': 'Mako', 'bytes': '13678'}, {'name': 'Mask', 'bytes': '969'}, {'name': 'Objective-C', 'bytes': '29733'}, {'name': 'PLSQL', 'bytes': '115000'}, {'name': 'PLpgSQL', 'bytes': '343922'}, {'name': 'Perl', 'bytes': '92722'}, {'name': 'Perl6', 'bytes': '206146'}, {'name': 'PowerShell', 'bytes': '38303'}, {'name': 'Python', 'bytes': '19597957'}, {'name': 'R', 'bytes': '2528'}, {'name': 'Ruby', 'bytes': '40275'}, {'name': 'SQLPL', 'bytes': '81817'}, {'name': 'Shell', 'bytes': '807009'}, {'name': 'Tcl', 'bytes': '2150885'}, {'name': 'Thrift', 'bytes': '40240'}, {'name': 'Visual Basic', 'bytes': '481'}, {'name': 'XS', 'bytes': '132994'}, {'name': 'XSLT', 'bytes': '13301'}]}
<!DOCTYPE HTML> <!-- Layered by Verta Verta.com | [email protected] License: Verta.com/license --> <html> <head> <title>Untitled</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]--> <link rel="stylesheet" href="assets/css/main.css" /> <!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]--> </head> <body class="left-sidebar"> <div id="page-wrapper"> <!-- Header --> <div id="header"> <div class="container"> <!-- Logo --> <div id="logo"> <h1><a href="index.html">Layered</a></h1> </div> <!-- Nav --> <nav id="nav"> <ul> <li><a href="index.html">Home</a></li> <li> <a href="#">Dropdown</a> <ul> <li><a href="#">Lorem ipsum dolor</a></li> <li><a href="#">Magna phasellus</a></li> <li><a href="#">Etiam dolore nisl</a></li> <li> <a href="#">Phasellus consequat</a> <ul> <li><a href="#">Magna phasellus</a></li> <li><a href="#">Lorem ipsum dolor</a></li> <li><a href="#">Phasellus consequat</a></li> <li><a href="#">Etiam dolore nisl</a></li> </ul> </li> <li><a href="#">Veroeros feugiat</a></li> </ul> </li> <li><a href="right-sidebar.html">Right Sidebar</a></li> <li class="active"><a href="left-sidebar.html">Left Sidebar</a></li> <li><a href="no-sidebar.html">No Sidebar</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </div> </div> <!-- Main --> <div id="main"> <div class="container"> <div class="row"> <!-- Sidebar --> <div id="sidebar" class="4u 12u(mobile)"> <section> <header> <h2>Integer gravida</h2> </header> <ul class="style2"> <li><a href="#">Amet turpis, feugiat et sit amet</a></li> <li><a href="#">Ornare in hendrerit in lectus</a></li> <li><a href="#">Semper mod quis eget mi dolore</a></li> <li><a href="#">Quam turpis feugiat sit dolor</a></li> <li><a href="#">Amet ornare in hendrerit in lectus</a></li> <li><a href="#">Consequat etiam lorem phasellus</a></li> <li><a href="#">Amet turpis, feugiat et sit amet</a></li> </ul> <a href="#" class="button">More</a> </section> <section> <header> <h2>Aenean metus iaculis</h2> </header> <a href="#" class="image featured"><img src="images/pic04.jpg" alt=""></a> <p>Praesent semper mod quis eget. Etiam eu ante risus. Aliquam erat volutpat. Pellentesque viverra vulputate enim.</p> <ul class="style2"> <li><a href="#">Semper mod quis eget mi dolore</a></li> <li><a href="#">Quam turpis feugiat sit dolor</a></li> <li><a href="#">Amet ornare in hendrerit in lectus</a></li> <li><a href="#">Consequat etiam lorem phasellus</a></li> </ul> <a href="#" class="button">More</a> </section> </div> <!-- Content --> <div id="content" class="8u 12u(mobile) important(mobile)"> <article> <header> <h2>Left Sidebar</h2> <span class="byline">Integer sit amet pede vel arcu aliquet pretium</span> </header> <a href="#" class="image full"><img src="images/pic01.jpg" alt=""></a> <h3>Hendrerit eu mollis imperdiet nibh ac hendrerit neque sed scelerisque bitur. Ligula consequat turpis feugiat penatibus ultrices ipsum.</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac purus ut ligula ultrices viverra. Donec non odio lectus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus posuere pulvinar cursus. Nullam id ultricies neque. Curabitur id tellus a metus consectetur. Nullam id sapien mi, iaculis imperdiet magna. Fusce lacus ipsum, rhoncus at placerat eu, condimentum eu arcu. Nullam id sapien mi, iaculis imperdiet magna. Fusce lacus ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac purus ut ligula ultrices viverra.</p> <h3>Feugiat auctor non consequat</h3> <p>Nullam id sapien mi, iaculis imperdiet magna. Fusce lacus ipsum, rhoncus at placerat eu, condimentum eu arcu. Ut viverra velit dictum est tempor eget rhoncus nulla pretium. In pretium purus nec est convallis ornare non ut tellus. Donec aliquam gravida enim interdum ultricies. Duis fringilla nisl non mi laoreet placerat. Nullam id sapien mi, iaculis imperdiet magna. Fusce lacus ipsum, rhoncus at placerat eu, condimentum eu arcu. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac purus ut ligula viverra. Donec non odio lectus. Vivamus posuere pulvinar cursus.</p> <p>Aliquam sem leo, vulputate sed, convallis at, ultricies quis, justo. Donec nonummy magna quis risus. Quisque eleifend. Phasellus tempor vehicula justo. Aliquam lacinia metus ut elit. Suspendisse iaculis mauris nec lorem. Donec leo. Vivamus fermentum nibh in augue. Praesent a lacus at urna congue rutrum. Nulla enim eros, porttitor eu, tempus id, varius non, nibh. Duis enim nulla, luctus eu, dapibus lacinia, venenatis id, quam. </p> </article> </div> </div> </div> </div> <!-- Footer --> <div id="footer"> <div class="container"> <!-- Copyright --> <div class="copyright"> <ul class="social"> <li><a href="#" class="icon fa-facebook"><span></span></a></li> <li><a href="#" class="icon fa-twitter"><span>Twitter</span></a></li> <li><a href="#" class="icon fa-google-plus"><span>Google+</span></a></li> <li><a href="#" class="icon fa-pinterest"><span>Pinterest</span></a></li> <li><a href="#" class="icon fa-linkedin"><span>Linkedin</span></a></li> <li><a href="#" class="icon fa-envelope"><span>Email</span></a></li> </ul> <span>&copy; Untitled. All rights reserved. Lorem ipsum dolor sit amet nullam.</span> </div> </div> </div> </div> <!-- Scripts --> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/jquery.dropotron.js"></script> <script src="assets/js/skel.min.js"></script> <script src="assets/js/util.js"></script> <!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]--> <script src="assets/js/main.js"></script> </body> </html>
{'content_hash': '77af81cc5597e7f9346c16f693592f09', 'timestamp': '', 'source': 'github', 'line_count': 155, 'max_line_length': 601, 'avg_line_length': 43.6, 'alnum_prop': 0.5819769162474104, 'repo_name': 'Verta-ie/verta-ie.github.io', 'id': '6191439420d1ff75ad01e6c97705c447b243014d', 'size': '6758', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'previews/john/Layered/orange/left-sidebar.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '2676776'}, {'name': 'HTML', 'bytes': '872921'}, {'name': 'JavaScript', 'bytes': '390579'}, {'name': 'PHP', 'bytes': '70193'}]}
var gulp = require( 'gulp' ); var mocha = require( 'gulp-mocha' ); var processhost = require( 'processhost' )(); var exec = require( 'child_process' ).exec; var istanbul = require( 'gulp-istanbul' ); var open = require( 'open' ); //jshint ignore : line function cover( done ) { gulp.src( [ './src/**/*.js' ] ) .pipe( istanbul() ) .pipe( istanbul.hookRequire() ) .on( 'finish', function() { done( runSpecs() ); } ); } function runSpecs() { // jshint ignore : line return gulp.src( [ './spec/behavior/*.spec.js', './spec/integration/integration.spec.js' ], { read: false } ) .pipe( mocha( { reporter: 'spec' } ) ); } function writeReport( cb, openBrowser, tests ) { tests .on( 'error', function( e ) { console.log( 'error occurred during testing', e.stack ); } ) .pipe( istanbul.writeReports() ) .on( 'end', function() { if ( openBrowser ) { open( './coverage/lcov-report/index.html' ); } cb(); } ); } gulp.task( 'continuous-coverage', function( cb ) { cover( writeReport.bind( undefined, cb, false ) ); } ); gulp.task( 'continuous-test', function() { return runSpecs() .on( 'end', function() { // console.log( process._getActiveRequests() ); // console.log( process._getActiveHandles() ); } ); } ); gulp.task( 'coverage', function( cb ) { cover( writeReport.bind( undefined, cb, true ) ); } ); gulp.task( 'coverage-watch', function() { gulp.watch( [ './src/**/*', './spec/**/*' ], [ 'continuous-coverage' ] ); } ); gulp.task( 'test', function() { return runSpecs() .on( 'end', process.exit.bind( process, 0 ) ) .on( 'error', process.exit.bind( process, 1 ) ); } ); gulp.task( 'sleep-and-test', function() { exec( "sleep 2", function( error, stdout, stderr ) { runSpecs() .on( 'end', function() { // console.log( process._getActiveRequests() ); // console.log( process._getActiveHandles() ); } ); } ); } ); gulp.task( 'host-watch', function() { gulp.watch( [ './src/**', './spec/**' ], [ 'restart', 'test' ] ); } ); gulp.task( 'restart', function() { console.log( 'restarting application' ); processhost.restart(); } ); gulp.task( 'host', function() { processhost.startProcess( 'rabbit', { command: 'rabbitmq-server', args: [], stdio: 'inherit' } ); } ); gulp.task( 'test-watch', function() { gulp.watch( [ './src/**/*', './spec/**/*' ], [ 'continuous-test' ] ); } ); gulp.task( 'default', [ 'continuous-coverage', 'coverage-watch' ], function() {} ); // gulp.task( 'specs', [ 'continuous-test', 'test-watch' ], function() {} ); gulp.task( 'specs', [ 'continuous-test', 'test-watch' ], function() {} ); gulp.task( 'server', [ 'host', 'host-watch', 'sleep-and-test' ], function() {} );
{'content_hash': 'daa5d76f3a785c9855455d86cad49b1f', 'timestamp': '', 'source': 'github', 'line_count': 98, 'max_line_length': 110, 'avg_line_length': 27.448979591836736, 'alnum_prop': 0.5892193308550185, 'repo_name': 'arobson/wascally', 'id': '81cd6499c62607f58de281ef8fee62cb273d75c6', 'size': '2690', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'gulpfile.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '135104'}]}
var sharedConfig = require('./karma-shared.conf'); module.exports = function(config) { sharedConfig(config, {testName: 'AngularJS: docs', logFile: 'karma-docs.log'}); config.set({ files: [ 'build/angular.js', 'build/angular-mocks.js', 'docs/app/src/**/*.js', 'docs/app/test/**/*Spec.js' ], junitReporter: { outputFile: 'test_out/docs.xml', suite: 'Docs' } }); };
{'content_hash': '9b356e4f042276c4b5eeb310e94e7daf', 'timestamp': '', 'source': 'github', 'line_count': 19, 'max_line_length': 81, 'avg_line_length': 22.31578947368421, 'alnum_prop': 0.5754716981132075, 'repo_name': 'lrlopez/angular.js', 'id': 'ea9dfb26a29e4bb3ef56daf7f79d21891b9d2cbb', 'size': '424', 'binary': False, 'copies': '23', 'ref': 'refs/heads/master', 'path': 'karma-docs.conf.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '20820'}, {'name': 'JavaScript', 'bytes': '3652269'}, {'name': 'Ruby', 'bytes': '223'}, {'name': 'Shell', 'bytes': '13033'}]}
<resources> <string name="app_name">OpenAtlasLauncher</string> </resources>
{'content_hash': '26e33c9cf7e1880d9649ea0a242be4c5', 'timestamp': '', 'source': 'github', 'line_count': 5, 'max_line_length': 54, 'avg_line_length': 16.4, 'alnum_prop': 0.7073170731707317, 'repo_name': 'xiaoshi316/OpenAtlas', 'id': '4e60664873cfb8f5be9f53a657734c13bc679130', 'size': '82', 'binary': False, 'copies': '18', 'ref': 'refs/heads/master', 'path': 'OpenAtlasLauncher/res/values/strings.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '54854'}, {'name': 'C++', 'bytes': '12857'}, {'name': 'Java', 'bytes': '729928'}, {'name': 'Makefile', 'bytes': '1047'}, {'name': 'Shell', 'bytes': '139'}]}
define(["jquery","underscore","marionette","bootstrap"], function($,_,Marionette) { Marionette.Region.Dialog = Marionette.Region.extend({ el:"#dialog-region", constructor:function(){ // _.bindAll(this,'showModal','hideModal','closeDialog'); Backbone.Marionette.Region.prototype.constructor.apply(this,arguments); this.on("show",this.showModal,this); }, showModal: function(view) { console.log("showModal"); $("#dialog-region").show(); this.listenTo(view, "dialog:close", function(){ console.log("dialog:close"); this.hideModal(); }); //view.on("close",this.hideModal(),this); //Have to differentiate the modal view next time. // this.$el.find("#myModal").modal('show'); // var self = this; // this.$el.dialog({ // modal: true, // title: view.title, // width: "auto", // close: function(e, ui) { // self.closeDialog(); // } // }); }, hideModal:function(){ console.log("hideModal"); $("#dialog-region").hide(); this.$el.modal('hide'); $('body').removeClass("modal-open"); $('.modal-backdrop').remove(); this.stopListening(); this.destroy(); }, closeDialog: function() { this.stopListening(); this.destroy(); this.$el.dialog("destroy"); } }); return Marionette.Region.Dialog; });
{'content_hash': 'f412533629d6364be375f3c0c9b56c89', 'timestamp': '', 'source': 'github', 'line_count': 48, 'max_line_length': 83, 'avg_line_length': 34.604166666666664, 'alnum_prop': 0.4822396146899458, 'repo_name': 'pointable/hitcamp', 'id': '935c4705483bb888825a48c7f903e787397d4ad7', 'size': '1661', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'public/webappCamp/js/apps/config/marionette/region/dialog.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '477060'}, {'name': 'HTML', 'bytes': '686756'}, {'name': 'JavaScript', 'bytes': '5737745'}, {'name': 'PHP', 'bytes': '2199'}, {'name': 'Shell', 'bytes': '321'}]}
require 'spec_helper' describe BroadcastMessage do subject { build(:broadcast_message) } it { is_expected.to be_valid } describe 'validations' do let(:triplet) { '#000' } let(:hex) { '#AABBCC' } it { is_expected.to allow_value(nil).for(:color) } it { is_expected.to allow_value(triplet).for(:color) } it { is_expected.to allow_value(hex).for(:color) } it { is_expected.not_to allow_value('000').for(:color) } it { is_expected.to allow_value(nil).for(:font) } it { is_expected.to allow_value(triplet).for(:font) } it { is_expected.to allow_value(hex).for(:font) } it { is_expected.not_to allow_value('000').for(:font) } end describe '.current', :use_clean_rails_memory_store_caching do it 'returns message if time match' do message = create(:broadcast_message) expect(described_class.current).to include(message) end it 'returns multiple messages if time match' do message1 = create(:broadcast_message) message2 = create(:broadcast_message) expect(described_class.current).to contain_exactly(message1, message2) end it 'returns empty list if time not come' do create(:broadcast_message, :future) expect(described_class.current).to be_empty end it 'returns empty list if time has passed' do create(:broadcast_message, :expired) expect(described_class.current).to be_empty end it 'caches the output of the query for two weeks' do create(:broadcast_message) expect(described_class).to receive(:current_and_future_messages).and_call_original.twice described_class.current Timecop.travel(3.weeks) do described_class.current end end it 'does not create new records' do create(:broadcast_message) expect { described_class.current }.not_to change { described_class.count } end it 'includes messages that need to be displayed in the future' do create(:broadcast_message) future = create( :broadcast_message, starts_at: Time.now + 10.minutes, ends_at: Time.now + 20.minutes ) expect(described_class.current.length).to eq(1) Timecop.travel(future.starts_at) do expect(described_class.current.length).to eq(2) end end it 'does not clear the cache if only a future message should be displayed' do create(:broadcast_message, :future) expect(Rails.cache).not_to receive(:delete).with(described_class::CACHE_KEY) expect(described_class.current.length).to eq(0) end end describe '#attributes' do it 'includes message_html field' do expect(subject.attributes.keys).to include("cached_markdown_version", "message_html") end end describe '#active?' do it 'is truthy when started and not ended' do message = build(:broadcast_message) expect(message).to be_active end it 'is falsey when ended' do message = build(:broadcast_message, :expired) expect(message).not_to be_active end it 'is falsey when not started' do message = build(:broadcast_message, :future) expect(message).not_to be_active end end describe '#started?' do it 'is truthy when starts_at has passed' do message = build(:broadcast_message) travel_to(3.days.from_now) do expect(message).to be_started end end it 'is falsey when starts_at is in the future' do message = build(:broadcast_message) travel_to(3.days.ago) do expect(message).not_to be_started end end end describe '#ended?' do it 'is truthy when ends_at has passed' do message = build(:broadcast_message) travel_to(3.days.from_now) do expect(message).to be_ended end end it 'is falsey when ends_at is in the future' do message = build(:broadcast_message) travel_to(3.days.ago) do expect(message).not_to be_ended end end end describe '#flush_redis_cache' do it 'flushes the Redis cache' do message = create(:broadcast_message) expect(Rails.cache).to receive(:delete).with(described_class::CACHE_KEY) message.flush_redis_cache end end end
{'content_hash': '5b7df9de074be67b2eaacb6d19fd7ac7', 'timestamp': '', 'source': 'github', 'line_count': 162, 'max_line_length': 94, 'avg_line_length': 26.22222222222222, 'alnum_prop': 0.6516007532956686, 'repo_name': 'stoplightio/gitlabhq', 'id': '020ada3c47a43c55e3cf490eaf6df4196215e443', 'size': '4279', 'binary': False, 'copies': '1', 'ref': 'refs/heads/stoplight/develop', 'path': 'spec/models/broadcast_message_spec.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '632980'}, {'name': 'Clojure', 'bytes': '79'}, {'name': 'Dockerfile', 'bytes': '1676'}, {'name': 'HTML', 'bytes': '1264236'}, {'name': 'JavaScript', 'bytes': '3425347'}, {'name': 'Ruby', 'bytes': '16497064'}, {'name': 'Shell', 'bytes': '34509'}, {'name': 'Vue', 'bytes': '752795'}]}
#ifndef StorageNamespace_h #define StorageNamespace_h #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> namespace WebCore { class Page; class SecurityOrigin; class StorageArea; class StorageNamespace : public RefCounted<StorageNamespace> { public: static PassRefPtr<StorageNamespace> localStorageNamespace(unsigned quota); static PassRefPtr<StorageNamespace> sessionStorageNamespace(Page*, unsigned quota); virtual ~StorageNamespace() { } virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) = 0; virtual PassRefPtr<StorageNamespace> copy() = 0; virtual void close() = 0; virtual void clearOriginForDeletion(SecurityOrigin*) = 0; virtual void clearAllOriginsForDeletion() = 0; virtual void sync() = 0; virtual void closeIdleLocalStorageDatabases() { } }; } // namespace WebCore #endif // StorageNamespace_h
{'content_hash': '2cce42749c9b2fe5871c521cd1175d68', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 87, 'avg_line_length': 27.484848484848484, 'alnum_prop': 0.7563395810363837, 'repo_name': 'windyuuy/opera', 'id': 'c60f09e3f8e39cf1d1a47656915663013736c817', 'size': '2237', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'chromium/src/third_party/WebKit/Source/core/storage/StorageNamespace.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ApacheConf', 'bytes': '25707'}, {'name': 'AppleScript', 'bytes': '6973'}, {'name': 'Assembly', 'bytes': '51642'}, {'name': 'Batchfile', 'bytes': '35942'}, {'name': 'C', 'bytes': '4303018'}, {'name': 'C#', 'bytes': '35203'}, {'name': 'C++', 'bytes': '207333360'}, {'name': 'CMake', 'bytes': '25089'}, {'name': 'CSS', 'bytes': '681256'}, {'name': 'Dart', 'bytes': '24294'}, {'name': 'Emacs Lisp', 'bytes': '25534'}, {'name': 'Groff', 'bytes': '5283'}, {'name': 'HTML', 'bytes': '10400943'}, {'name': 'IDL', 'bytes': '836'}, {'name': 'Java', 'bytes': '2821184'}, {'name': 'JavaScript', 'bytes': '14563996'}, {'name': 'Lua', 'bytes': '13749'}, {'name': 'Makefile', 'bytes': '55521'}, {'name': 'Objective-C', 'bytes': '1211523'}, {'name': 'Objective-C++', 'bytes': '6221908'}, {'name': 'PHP', 'bytes': '61320'}, {'name': 'Perl', 'bytes': '82949'}, {'name': 'Protocol Buffer', 'bytes': '280464'}, {'name': 'Python', 'bytes': '12627773'}, {'name': 'Rebol', 'bytes': '262'}, {'name': 'Ruby', 'bytes': '937'}, {'name': 'Scheme', 'bytes': '10604'}, {'name': 'Shell', 'bytes': '894814'}, {'name': 'VimL', 'bytes': '4953'}, {'name': 'XSLT', 'bytes': '418'}, {'name': 'nesC', 'bytes': '14650'}]}
import sys import importlib.abc import imp from urllib.request import urlopen from urllib.error import HTTPError, URLError from html.parser import HTMLParser # Debugging import logging log = logging.getLogger(__name__) # Get links from a given URL def _get_links(url): class LinkParser(HTMLParser): def handle_starttag(self, tag, attrs): if tag == 'a': attrs = dict(attrs) links.add(attrs.get('href').rstrip('/')) links = set() try: log.debug('Getting links from %s' % url) u = urlopen(url) parser = LinkParser() parser.feed(u.read().decode('utf-8')) except Exception as e: log.debug('Could not get links. %s', e) log.debug('links: %r', links) return links class UrlMetaFinder(importlib.abc.MetaPathFinder): def __init__(self, baseurl): self._baseurl = baseurl self._links = { } self._loaders = { baseurl : UrlModuleLoader(baseurl) } def find_module(self, fullname, path=None): log.debug('find_module: fullname=%r, path=%r', fullname, path) if path is None: baseurl = self._baseurl else: if not path[0].startswith(self._baseurl): return None baseurl = path[0] parts = fullname.split('.') basename = parts[-1] log.debug('find_module: baseurl=%r, basename=%r', baseurl, basename) # Check link cache if basename not in self._links: self._links[baseurl] = _get_links(baseurl) # Check if it's a package if basename in self._links[baseurl]: log.debug('find_module: trying package %r', fullname) fullurl = self._baseurl + '/' + basename # Attempt to load the package (which accesses __init__.py) loader = UrlPackageLoader(fullurl) try: loader.load_module(fullname) self._links[fullurl] = _get_links(fullurl) self._loaders[fullurl] = UrlModuleLoader(fullurl) log.debug('find_module: package %r loaded', fullname) except ImportError as e: log.debug('find_module: package failed. %s', e) loader = None return loader # A normal module filename = basename + '.py' if filename in self._links[baseurl]: log.debug('find_module: module %r found', fullname) return self._loaders[baseurl] else: log.debug('find_module: module %r not found', fullname) return None def invalidate_caches(self): log.debug('invalidating link cache') self._links.clear() # Module Loader for a URL class UrlModuleLoader(importlib.abc.SourceLoader): def __init__(self, baseurl): self._baseurl = baseurl self._source_cache = {} def module_repr(self, module): return '<urlmodule %r from %r>' % (module.__name__, module.__file__) # Required method def load_module(self, fullname): code = self.get_code(fullname) mod = sys.modules.setdefault(fullname, imp.new_module(fullname)) mod.__file__ = self.get_filename(fullname) mod.__loader__ = self mod.__package__ = fullname.rpartition('.')[0] exec(code, mod.__dict__) return mod # Optional extensions def get_code(self, fullname): src = self.get_source(fullname) return compile(src, self.get_filename(fullname), 'exec') def get_data(self, path): pass def get_filename(self, fullname): return self._baseurl + '/' + fullname.split('.')[-1] + '.py' def get_source(self, fullname): filename = self.get_filename(fullname) log.debug('loader: reading %r', filename) if filename in self._source_cache: log.debug('loader: cached %r', filename) return self._source_cache[filename] try: u = urlopen(filename) source = u.read().decode('utf-8') log.debug('loader: %r loaded', filename) self._source_cache[filename] = source return source except (HTTPError, URLError) as e: log.debug('loader: %r failed. %s', filename, e) raise ImportError("Can't load %s" % filename) def is_package(self, fullname): return False # Package loader for a URL class UrlPackageLoader(UrlModuleLoader): def load_module(self, fullname): mod = super().load_module(fullname) mod.__path__ = [ self._baseurl ] mod.__package__ = fullname def get_filename(self, fullname): return self._baseurl + '/' + '__init__.py' def is_package(self, fullname): return True # Utility functions for installing/uninstalling the loader _installed_meta_cache = { } def install_meta(address): if address not in _installed_meta_cache: finder = UrlMetaFinder(address) _installed_meta_cache[address] = finder sys.meta_path.append(finder) log.debug('%r installed on sys.meta_path', finder) def remove_meta(address): if address in _installed_meta_cache: finder = _installed_meta_cache.pop(address) sys.meta_path.remove(finder) log.debug('%r removed from sys.meta_path', finder) # Path finder class for a URL class UrlPathFinder(importlib.abc.PathEntryFinder): def __init__(self, baseurl): self._links = None self._loader = UrlModuleLoader(baseurl) self._baseurl = baseurl def find_loader(self, fullname): log.debug('find_loader: %r', fullname) parts = fullname.split('.') basename = parts[-1] # Check link cache if self._links is None: self._links = [] # See discussion self._links = _get_links(self._baseurl) # Check if it's a package if basename in self._links: log.debug('find_loader: trying package %r', fullname) fullurl = self._baseurl + '/' + basename # Attempt to load the package (which accesses __init__.py) loader = UrlPackageLoader(fullurl) try: loader.load_module(fullname) log.debug('find_loader: package %r loaded', fullname) except ImportError as e: log.debug('find_loader: %r is a namespace package', fullname) loader = None return (loader, [fullurl]) # A normal module filename = basename + '.py' if filename in self._links: log.debug('find_loader: module %r found', fullname) return (self._loader, []) else: log.debug('find_loader: module %r not found', fullname) return (None, []) def invalidate_caches(self): log.debug('invalidating link cache') self._links = None # Check path to see if it looks like a URL _url_path_cache = {} def handle_url(path): if path.startswith(('http://', 'https://')): log.debug('Handle path? %s. [Yes]', path) if path in _url_path_cache: finder = _url_path_cache[path] else: finder = UrlPathFinder(path) _url_path_cache[path] = finder return finder else: log.debug('Handle path? %s. [No]', path) def install_path_hook(): sys.path_hooks.append(handle_url) sys.path_importer_cache.clear() log.debug('Installing handle_url') def remove_path_hook(): sys.path_hooks.remove(handle_url) sys.path_importer_cache.clear() log.debug('Removing handle_url')
{'content_hash': '252f02761f2b2852755bb562562eb0e9', 'timestamp': '', 'source': 'github', 'line_count': 225, 'max_line_length': 77, 'avg_line_length': 33.94222222222222, 'alnum_prop': 0.5837370695299201, 'repo_name': 'huawei-cloud/compass-adapters', 'id': '96b6a57151fc05dff4cf63d8376d59a12e68738e', 'size': '7653', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'chef/cookbooks/python/src/10/loading_modules_from_a_remote_machine_using_import_hooks/urlimport.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '21125'}, {'name': 'CSS', 'bytes': '111630'}, {'name': 'Perl', 'bytes': '848'}, {'name': 'Python', 'bytes': '208453'}, {'name': 'Ruby', 'bytes': '1406351'}, {'name': 'Shell', 'bytes': '5072'}]}
#pragma once #include <kitBase/blocksBase/common/displayBlock.h> namespace nxt { namespace blocks { namespace details { class DrawCircleBlock : public kitBase::blocksBase::common::DisplayBlock { Q_OBJECT public: explicit DrawCircleBlock(kitBase::robotModel::RobotModelInterface &robotModel); private: void doJob(kitBase::robotModel::robotParts::Display &display) override; }; } } }
{'content_hash': 'fd4a57278f840620bb9f52562a83ee17', 'timestamp': '', 'source': 'github', 'line_count': 24, 'max_line_length': 80, 'avg_line_length': 16.375, 'alnum_prop': 0.7735368956743003, 'repo_name': 'Julia-Khramyshkina/qreal', 'id': '8a303ba11ef181d72a8df3988376a4625b47f749', 'size': '997', 'binary': False, 'copies': '12', 'ref': 'refs/heads/master', 'path': 'plugins/robots/common/nxtKit/src/blocks/details/drawCircleBlock.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '1181'}, {'name': 'C', 'bytes': '23858'}, {'name': 'C#', 'bytes': '18292'}, {'name': 'C++', 'bytes': '6430100'}, {'name': 'CSS', 'bytes': '13352'}, {'name': 'HTML', 'bytes': '302656'}, {'name': 'IDL', 'bytes': '913'}, {'name': 'JavaScript', 'bytes': '10863'}, {'name': 'Perl', 'bytes': '3704'}, {'name': 'Perl6', 'bytes': '34034'}, {'name': 'Prolog', 'bytes': '971'}, {'name': 'Python', 'bytes': '25813'}, {'name': 'QMake', 'bytes': '300194'}, {'name': 'Shell', 'bytes': '84443'}, {'name': 'Tcl', 'bytes': '21071'}, {'name': 'Turing', 'bytes': '112'}]}
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.flowable.bpmn.model; import java.util.ArrayList; import java.util.List; /** * @author Joram Barrez * @author Filip Hrisafov */ public class VariableAggregationDefinition { protected String implementationType; protected String implementation; protected String target; protected String targetExpression; protected List<Variable> definitions; protected boolean storeAsTransientVariable; protected boolean createOverviewVariable; public String getImplementationType() { return implementationType; } public void setImplementationType(String implementationType) { this.implementationType = implementationType; } public String getImplementation() { return implementation; } public void setImplementation(String implementation) { this.implementation = implementation; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public String getTargetExpression() { return targetExpression; } public void setTargetExpression(String targetExpression) { this.targetExpression = targetExpression; } public List<Variable> getDefinitions() { return definitions; } public void setDefinitions(List<Variable> definitions) { this.definitions = definitions; } public void addDefinition(Variable definition) { if (definitions == null) { definitions = new ArrayList<>(); } definitions.add(definition); } public boolean isStoreAsTransientVariable() { return storeAsTransientVariable; } public void setStoreAsTransientVariable(boolean storeAsTransientVariable) { this.storeAsTransientVariable = storeAsTransientVariable; } public boolean isCreateOverviewVariable() { return createOverviewVariable; } public void setCreateOverviewVariable(boolean createOverviewVariable) { this.createOverviewVariable = createOverviewVariable; } @Override public VariableAggregationDefinition clone() { VariableAggregationDefinition aggregation = new VariableAggregationDefinition(); aggregation.setValues(this); return aggregation; } public void setValues(VariableAggregationDefinition otherVariableDefinitionAggregation) { setImplementationType(otherVariableDefinitionAggregation.getImplementationType()); setImplementation(otherVariableDefinitionAggregation.getImplementation()); setTarget(otherVariableDefinitionAggregation.getTarget()); setTargetExpression(otherVariableDefinitionAggregation.getTargetExpression()); List<Variable> otherDefinitions = otherVariableDefinitionAggregation.getDefinitions(); if (otherDefinitions != null) { List<Variable> newDefinitions = new ArrayList<>(otherDefinitions.size()); for (Variable otherDefinition : otherDefinitions) { newDefinitions.add(otherDefinition.clone()); } setDefinitions(newDefinitions); } setStoreAsTransientVariable(otherVariableDefinitionAggregation.isStoreAsTransientVariable()); setCreateOverviewVariable(otherVariableDefinitionAggregation.isCreateOverviewVariable()); } public static class Variable { protected String source; protected String target; protected String targetExpression; protected String sourceExpression; public String getSource() { return source; } public void setSource(String source) { this.source = source; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public String getTargetExpression() { return targetExpression; } public void setTargetExpression(String targetExpression) { this.targetExpression = targetExpression; } public String getSourceExpression() { return sourceExpression; } public void setSourceExpression(String sourceExpression) { this.sourceExpression = sourceExpression; } @Override public Variable clone() { Variable definition = new Variable(); definition.setValues(this); return definition; } public void setValues(Variable otherDefinition) { setSource(otherDefinition.getSource()); setSourceExpression(otherDefinition.getSourceExpression()); setTarget(otherDefinition.getTarget()); setTargetExpression(otherDefinition.getTargetExpression()); } } }
{'content_hash': '4172aa819e8bf77de363b455dca9ac0d', 'timestamp': '', 'source': 'github', 'line_count': 177, 'max_line_length': 101, 'avg_line_length': 30.51412429378531, 'alnum_prop': 0.6848731716348825, 'repo_name': 'dbmalkovsky/flowable-engine', 'id': '7b6888a4847f45233c4c653f14e3dacb57345f0a', 'size': '5401', 'binary': False, 'copies': '2', 'ref': 'refs/heads/main', 'path': 'modules/flowable-bpmn-model/src/main/java/org/flowable/bpmn/model/VariableAggregationDefinition.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '166'}, {'name': 'CSS', 'bytes': '673786'}, {'name': 'Dockerfile', 'bytes': '477'}, {'name': 'Groovy', 'bytes': '482'}, {'name': 'HTML', 'bytes': '1201811'}, {'name': 'Handlebars', 'bytes': '6004'}, {'name': 'Java', 'bytes': '46660725'}, {'name': 'JavaScript', 'bytes': '12668702'}, {'name': 'Mustache', 'bytes': '2383'}, {'name': 'PLSQL', 'bytes': '268970'}, {'name': 'SQLPL', 'bytes': '238673'}, {'name': 'Shell', 'bytes': '12773'}, {'name': 'TSQL', 'bytes': '19452'}]}
// Test that verifies tensorflow/core/api_def/base_api/api_def*.pbtxt files // are correct. If api_def*.pbtxt do not match expected contents, run // tensorflow/core/api_def/base_api/update_api_def.sh script to update them. #include <ctype.h> #include <algorithm> #include <string> #include <unordered_map> #include <vector> #include "tensorflow/core/framework/api_def.pb.h" #include "tensorflow/core/framework/attr_value.pb.h" #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_def.pb.h" #include "tensorflow/core/framework/op_gen_lib.h" #include "tensorflow/core/framework/op_gen_overrides.pb.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/lib/core/status_test_util.h" #include "tensorflow/core/lib/io/path.h" #include "tensorflow/core/lib/strings/stringprintf.h" #include "tensorflow/core/platform/env.h" #include "tensorflow/core/platform/init_main.h" #include "tensorflow/core/platform/protobuf.h" #include "tensorflow/core/platform/test.h" #include "tensorflow/core/platform/types.h" #include "tensorflow/core/util/command_line_flags.h" namespace tensorflow { namespace { constexpr char kDefaultApiDefDir[] = "tensorflow/core/api_def/base_api"; constexpr char kOverridesFilePath[] = "tensorflow/cc/ops/op_gen_overrides.pbtxt"; constexpr char kApiDefFileFormat[] = "api_def_%c.pbtxt"; constexpr char kAlphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // Get map from first character to ApiDefs for ops // that start with that character. std::unordered_map<char, ApiDefs> GenerateApiDef( const OpList& ops, const OpGenOverrides& overrides) { std::unordered_map<string, OpGenOverride> name_to_override; for (const auto& op_override : overrides.op()) { name_to_override[op_override.name()] = op_override; } std::unordered_map<char, ApiDefs> api_defs_map; for (const auto& op : ops.op()) { CHECK(!op.name().empty()) << "Encountered empty op name: %s" << op.DebugString(); const char file_id = toupper(op.name()[0]); CHECK(isalpha(file_id)) << "Unexpected op name: " << op.name(); ApiDef* api_def = api_defs_map[file_id].add_op(); api_def->set_graph_op_name(op.name()); if (name_to_override.find(op.name()) != name_to_override.end()) { const auto& op_override = name_to_override[op.name()]; // Set visibility if (op_override.skip()) { api_def->set_visibility(ApiDef_Visibility_SKIP); } else if (op_override.hide()) { api_def->set_visibility(ApiDef_Visibility_HIDDEN); } // Add endpoints if (!op_override.rename_to().empty()) { auto* endpoint = api_def->add_endpoint(); endpoint->set_name(op_override.rename_to()); } else { auto* endpoint = api_def->add_endpoint(); endpoint->set_name(op.name()); } for (auto& alias : op_override.alias()) { auto* endpoint = api_def->add_endpoint(); endpoint->set_name(alias); } // Add attributes for (auto& attr : op.attr()) { auto* api_def_attr = api_def->add_attr(); api_def_attr->set_name(attr.name()); for (auto& attr_override : op_override.attr_default()) { if (attr.name() == attr_override.name()) { *(api_def_attr->mutable_default_value()) = attr_override.value(); } } for (auto& attr_rename : op_override.attr_rename()) { if (attr.name() == attr_rename.from()) { api_def_attr->set_rename_to(attr_rename.to()); } } } } else { auto* endpoint = api_def->add_endpoint(); endpoint->set_name(op.name()); } // Add docs api_def->set_summary(op.summary()); api_def->set_description(op.description()); } return api_defs_map; } // Reads golden api defs file with the given suffix. string GetGoldenApiDefsStr(Env* env, const string& api_files_dir, char suffix) { string file_path = strings::Printf( io::JoinPath(api_files_dir, kApiDefFileFormat).c_str(), suffix); if (env->FileExists(file_path).ok()) { string file_contents; TF_EXPECT_OK(ReadFileToString(env, file_path, &file_contents)); return file_contents; } return ""; } void RunApiTest(bool update_api_def, const string& api_files_dir) { // Read C++ overrides file string overrides_file_contents; Env* env = Env::Default(); TF_EXPECT_OK( ReadFileToString(env, kOverridesFilePath, &overrides_file_contents)); // Read all ops OpList ops; OpRegistry::Global()->Export(false, &ops); const std::vector<string> multi_line_fields = {"description"}; // Get expected ApiDefs OpGenOverrides overrides; auto new_api_defs_map = GenerateApiDef(ops, overrides); bool updated_at_least_one_file = false; for (char c : kAlphabet) { string golden_api_defs_str = GetGoldenApiDefsStr(env, api_files_dir, c); string new_api_defs_str = new_api_defs_map[c].DebugString(); new_api_defs_str = PBTxtToMultiline(new_api_defs_str, multi_line_fields); if (golden_api_defs_str == new_api_defs_str) { continue; } if (update_api_def) { string output_file_path = io::JoinPath(api_files_dir, strings::Printf(kApiDefFileFormat, c)); if (new_api_defs_str.empty()) { std::cout << "Deleting " << output_file_path << "..." << std::endl; TF_EXPECT_OK(env->DeleteFile(output_file_path)); } else { std::cout << "Updating " << output_file_path << "..." << std::endl; TF_EXPECT_OK( WriteStringToFile(env, output_file_path, new_api_defs_str)); } updated_at_least_one_file = true; } else { EXPECT_EQ(golden_api_defs_str, new_api_defs_str) << "To update golden API files, run " << "tensorflow/core/api_def/update_api_def.sh."; } } if (update_api_def && !updated_at_least_one_file) { std::cout << "Api def files are already up to date." << std::endl; } } TEST(ApiTest, GenerateBaseAPIDef) { RunApiTest(false, kDefaultApiDefDir); } } // namespace } // namespace tensorflow int main(int argc, char** argv) { bool update_api_def = false; tensorflow::string api_files_dir = tensorflow::kDefaultApiDefDir; std::vector<tensorflow::Flag> flag_list = { tensorflow::Flag( "update_api_def", &update_api_def, "Whether to update tensorflow/core/api_def/base_api/api_def*.pbtxt " "files if they differ from expected API."), tensorflow::Flag("api_def_dir", &api_files_dir, "Base directory of api_def*.pbtxt files.")}; std::string usage = tensorflow::Flags::Usage(argv[0], flag_list); bool parsed_values_ok = tensorflow::Flags::Parse(&argc, argv, flag_list); if (!parsed_values_ok) { std::cerr << usage << std::endl; return 2; } if (update_api_def) { tensorflow::port::InitMain(argv[0], &argc, &argv); tensorflow::RunApiTest(update_api_def, api_files_dir); return 0; } testing::InitGoogleTest(&argc, argv); // Run tests return RUN_ALL_TESTS(); }
{'content_hash': '846985b8af9f228a62c963cbbcf7e861', 'timestamp': '', 'source': 'github', 'line_count': 193, 'max_line_length': 80, 'avg_line_length': 36.35233160621762, 'alnum_prop': 0.6465222348916762, 'repo_name': 'shakamunyi/tensorflow', 'id': 'ceeb172fa0a9abf2ab7adcfc801b4bcb5fa04381', 'size': '7680', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'tensorflow/core/api_def/api_test.cc', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '8458'}, {'name': 'C', 'bytes': '359821'}, {'name': 'C++', 'bytes': '33069452'}, {'name': 'CMake', 'bytes': '647752'}, {'name': 'CSS', 'bytes': '3154'}, {'name': 'Go', 'bytes': '118797'}, {'name': 'HTML', 'bytes': '2041616'}, {'name': 'Java', 'bytes': '482397'}, {'name': 'JavaScript', 'bytes': '16442'}, {'name': 'Jupyter Notebook', 'bytes': '1833675'}, {'name': 'LLVM', 'bytes': '6536'}, {'name': 'Makefile', 'bytes': '41001'}, {'name': 'Objective-C', 'bytes': '14093'}, {'name': 'Objective-C++', 'bytes': '127352'}, {'name': 'Perl', 'bytes': '7546'}, {'name': 'PureBasic', 'bytes': '24932'}, {'name': 'Python', 'bytes': '34284975'}, {'name': 'Ruby', 'bytes': '327'}, {'name': 'Shell', 'bytes': '440650'}, {'name': 'TypeScript', 'bytes': '2974955'}]}
/** * @fileoverview Object representing a code comment. * @author [email protected] (Neil Fraser) */ 'use strict'; goog.provide('Blockly.Comment'); goog.require('Blockly.Bubble'); goog.require('Blockly.Icon'); /** * Class for a comment. * @param {!Blockly.Block} block The block associated with this comment. * @extends {Blockly.Icon} * @constructor */ Blockly.Comment = function(block) { Blockly.Comment.superClass_.constructor.call(this, block); this.createIcon_(); }; goog.inherits(Blockly.Comment, Blockly.Icon); /** * Comment text (if bubble is not visible). * @private */ Blockly.Comment.prototype.text_ = ''; /** * Width of bubble. * @private */ Blockly.Comment.prototype.width_ = 160; /** * Height of bubble. * @private */ Blockly.Comment.prototype.height_ = 80; /** * Create the icon on the block. * @private */ Blockly.Comment.prototype.createIcon_ = function() { Blockly.Icon.prototype.createIcon_.call(this); /* Here's the markup that will be generated: <circle class="blocklyIconShield" r="8" cx="8" cy="8"/> <text class="blocklyIconMark" x="8" y="13">?</text> */ var iconShield = Blockly.createSvgElement('circle', {'class': 'blocklyIconShield', 'r': Blockly.Icon.RADIUS, 'cx': Blockly.Icon.RADIUS, 'cy': Blockly.Icon.RADIUS}, this.iconGroup_); this.iconMark_ = Blockly.createSvgElement('text', {'class': 'blocklyIconMark', 'x': Blockly.Icon.RADIUS, 'y': 2 * Blockly.Icon.RADIUS - 3}, this.iconGroup_); this.iconMark_.appendChild(document.createTextNode('?')); }; /** * Create the editor for the comment's bubble. * @return {!Element} The top-level node of the editor. * @private */ Blockly.Comment.prototype.createEditor_ = function() { /* Create the editor. Here's the markup that will be generated: <foreignObject x="8" y="8" width="164" height="164"> <body xmlns="http://www.w3.org/1999/xhtml" class="blocklyMinimalBody"> <textarea xmlns="http://www.w3.org/1999/xhtml" class="blocklyCommentTextarea" style="height: 164px; width: 164px;"></textarea> </body> </foreignObject> */ this.foreignObject_ = Blockly.createSvgElement('foreignObject', {'x': Blockly.Bubble.BORDER_WIDTH, 'y': Blockly.Bubble.BORDER_WIDTH}, null); var body = document.createElementNS(Blockly.HTML_NS, 'body'); body.setAttribute('xmlns', Blockly.HTML_NS); body.className = 'blocklyMinimalBody'; this.textarea_ = document.createElementNS(Blockly.HTML_NS, 'textarea'); this.textarea_.className = 'blocklyCommentTextarea'; this.textarea_.setAttribute('dir', Blockly.RTL ? 'RTL' : 'LTR'); this.updateEditable(); body.appendChild(this.textarea_); this.foreignObject_.appendChild(body); Blockly.bindEvent_(this.textarea_, 'mouseup', this, this.textareaFocus_); return this.foreignObject_; }; /** * Add or remove editability of the textarea. * @override */ Blockly.Comment.prototype.updateEditable = function() { if (this.textarea_) { if (!this.block_.isEditable()) { this.textarea_.setAttribute('disabled', 'disabled'); this.textarea_.setAttribute('readonly', 'readonly'); } else { this.textarea_.removeAttribute('disabled'); this.textarea_.removeAttribute('readonly'); } } // Allow the icon to update. Blockly.Icon.prototype.updateEditable.call(this); }; /** * Callback function triggered when the bubble has resized. * Resize the text area accordingly. * @private */ Blockly.Comment.prototype.resizeBubble_ = function() { var size = this.bubble_.getBubbleSize(); var doubleBorderWidth = 2 * Blockly.Bubble.BORDER_WIDTH; this.foreignObject_.setAttribute('width', size.width - doubleBorderWidth); this.foreignObject_.setAttribute('height', size.height - doubleBorderWidth); this.textarea_.style.width = (size.width - doubleBorderWidth - 4) + 'px'; this.textarea_.style.height = (size.height - doubleBorderWidth - 4) + 'px'; }; /** * Show or hide the comment bubble. * @param {boolean} visible True if the bubble should be visible. */ Blockly.Comment.prototype.setVisible = function(visible) { if (visible == this.isVisible()) { // No change. return; } // Save the bubble stats before the visibility switch. var text = this.getText(); var size = this.getBubbleSize(); if (visible) { // Create the bubble. this.bubble_ = new Blockly.Bubble( /** @type {!Blockly.Workspace} */ (this.block_.workspace), this.createEditor_(), this.block_.svg_.svgGroup_, this.iconX_, this.iconY_, this.width_, this.height_); this.bubble_.registerResizeEvent(this, this.resizeBubble_); this.updateColour(); this.text_ = null; } else { // Dispose of the bubble. this.bubble_.dispose(); this.bubble_ = null; this.textarea_ = null; this.foreignObject_ = null; } // Restore the bubble stats after the visibility switch. this.setText(text); this.setBubbleSize(size.width, size.height); }; /** * Bring the comment to the top of the stack when clicked on. * @param {!Event} e Mouse up event. * @private */ Blockly.Comment.prototype.textareaFocus_ = function(e) { // Ideally this would be hooked to the focus event for the comment. // However doing so in Firefox swallows the cursor for unknown reasons. // So this is hooked to mouseup instead. No big deal. this.bubble_.promote_(); // Since the act of moving this node within the DOM causes a loss of focus, // we need to reapply the focus. this.textarea_.focus(); }; /** * Get the dimensions of this comment's bubble. * @return {!Object} Object with width and height properties. */ Blockly.Comment.prototype.getBubbleSize = function() { if (this.isVisible()) { return this.bubble_.getBubbleSize(); } else { return {width: this.width_, height: this.height_}; } }; /** * Size this comment's bubble. * @param {number} width Width of the bubble. * @param {number} height Height of the bubble. */ Blockly.Comment.prototype.setBubbleSize = function(width, height) { if (this.isVisible()) { this.bubble_.setBubbleSize(width, height); } else { this.width_ = width; this.height_ = height; } }; /** * Returns this comment's text. * @return {string} Comment text. */ Blockly.Comment.prototype.getText = function() { return this.isVisible() ? this.textarea_.value : this.text_; }; /** * Set this comment's text. * @param {string} text Comment text. */ Blockly.Comment.prototype.setText = function(text) { if (this.isVisible()) { this.textarea_.value = text; } else { this.text_ = text; } }; /** * Dispose of this comment. */ Blockly.Comment.prototype.dispose = function() { this.block_.comment = null; Blockly.Icon.prototype.dispose.call(this); };
{'content_hash': '11b966a8f912bfde87dd077e5a5b078f', 'timestamp': '', 'source': 'github', 'line_count': 231, 'max_line_length': 78, 'avg_line_length': 29.415584415584416, 'alnum_prop': 0.672111846946284, 'repo_name': 'gtay/blockly', 'id': '737e87c78afeda8f8fdb829179b7fe5ae0c4134c', 'size': '7462', 'binary': False, 'copies': '11', 'ref': 'refs/heads/master', 'path': 'core/comment.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '9070'}, {'name': 'JavaScript', 'bytes': '3147452'}, {'name': 'Python', 'bytes': '67338'}]}
package stat import ( "github.com/elastic/beats/libbeat/common" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/module/haproxy" "github.com/pkg/errors" ) const ( statsMethod = "stat" ) var ( debugf = logp.MakeDebug("haproxy-stat") ) // init registers the haproxy stat MetricSet. func init() { if err := mb.Registry.AddMetricSet("haproxy", statsMethod, New, haproxy.HostParser); err != nil { panic(err) } } // MetricSet for haproxy stats. type MetricSet struct { mb.BaseMetricSet } // New creates a new haproxy stat MetricSet. func New(base mb.BaseMetricSet) (mb.MetricSet, error) { return &MetricSet{BaseMetricSet: base}, nil } // Fetch methods returns a list of stats metrics. func (m *MetricSet) Fetch() ([]common.MapStr, error) { // haproxy doesn't accept a username or password so ignore them if they // are in the URL. hapc, err := haproxy.NewHaproxyClient(m.HostData().SanitizedURI) if err != nil { return nil, errors.Wrap(err, "failed creating haproxy client") } res, err := hapc.GetStat() if err != nil { return nil, errors.Wrap(err, "failed fetching haproxy stat") } return eventMapping(res), nil }
{'content_hash': 'b88251369c6426a056f8aef74e5e956e', 'timestamp': '', 'source': 'github', 'line_count': 52, 'max_line_length': 98, 'avg_line_length': 23.346153846153847, 'alnum_prop': 0.71499176276771, 'repo_name': 'christiangalsterer/httpbeat', 'id': '85656d472c8f0246c3fe2c2714cb57addc958498', 'size': '1214', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'vendor/github.com/elastic/beats/metricbeat/module/haproxy/stat/stat.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Go', 'bytes': '16011'}, {'name': 'Makefile', 'bytes': '1226'}]}
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.ComponentModel; using System.Runtime.InteropServices; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Notification; using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.LanguageServices.Implementation.Options; using Microsoft.VisualStudio.LanguageServices.Implementation.Options.Style; namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options { [Guid(Guids.CSharpOptionPageNamingStyleIdString)] internal class NamingStylesOptionPage : AbstractOptionPage { private NamingStyleOptionPageControl _grid; private INotificationService _notificationService; protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore) { var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel)); var workspace = componentModel.GetService<VisualStudioWorkspace>(); _notificationService = workspace.Services.GetService<INotificationService>(); _grid = new NamingStyleOptionPageControl(optionStore, _notificationService, LanguageNames.CSharp); return _grid; } protected override void OnDeactivate(CancelEventArgs e) { if (_grid.ContainsErrors()) { e.Cancel = true; _notificationService.SendNotification(ServicesVSResources.Some_naming_rules_are_incomplete_Please_complete_or_remove_them); } base.OnDeactivate(e); } } }
{'content_hash': '42530821796e2ddac5545cd3fe484d29', 'timestamp': '', 'source': 'github', 'line_count': 43, 'max_line_length': 139, 'avg_line_length': 41.53488372093023, 'alnum_prop': 0.7368421052631579, 'repo_name': 'jmarolf/roslyn', 'id': '856959d68d1275cca001603a0ba573c165f469ba', 'size': '1788', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'src/VisualStudio/CSharp/Impl/Options/NamingStylesOptionPage.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': '1C Enterprise', 'bytes': '257760'}, {'name': 'Batchfile', 'bytes': '9059'}, {'name': 'C#', 'bytes': '139027042'}, {'name': 'C++', 'bytes': '5602'}, {'name': 'CMake', 'bytes': '9153'}, {'name': 'Dockerfile', 'bytes': '2450'}, {'name': 'F#', 'bytes': '549'}, {'name': 'PowerShell', 'bytes': '243026'}, {'name': 'Shell', 'bytes': '92965'}, {'name': 'Visual Basic .NET', 'bytes': '71729344'}]}
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{'content_hash': '924d87a9c685d72801b68234b59af1d5', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 39, 'avg_line_length': 10.307692307692308, 'alnum_prop': 0.6940298507462687, 'repo_name': 'mdoering/backbone', 'id': '6a6c37e449d3ac89054967b82371d6eba631b0c5', 'size': '199', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Bryophyta/Bryopsida/Hypnales/Thuidiaceae/Thuidium/Thuidium pellucens/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []}
layout: post title: Getting Started with Node.js comments: true --- ### Getting Node.js There are different ways of getting Node.js: 1. Downloading installers or binaries - https://nodejs.org/en/download/ 2. Build from source code 3. For OSX and Linux environment, manage multiple version using `nvm` tool - We will be installing Node.js using the `nvm` tool for OSX ### Installing Node Version Manager `nvm` tool - Manual install of nvm: ```shell $ git clone https://github.com/creationix/nvm.git ~/nvm ``` - Use `source` command load function file(nvm.sh) into the command prompt: ```shell $ . ~/nvm/nvm.sh ``` - Test nvm: ```shell $ nvm ``` ### Installing Node.js using `nvm` tool - Install multiple versions of node: ```shell $ nvm install v4.4.2 $ nvm install v5.10.1 ``` - List installed node versions: ```shell $ nvm ls ``` - Display current version: ```shell $ node -v ``` - Switch node version: ```shell $ nvm use v4.2.2 ``` - Set Alias default: ```shell $ nvm alias default v5.10.1 ``` - Run node (Enters REPL[Read Eval Print Loop] Terminal): ```shell $ node > console.log("Node Intro"); Hello World undefined > (^C again to quit) > ## ``` ### Running a simple web server - Create a `server.js` file ```js const http = require('http'); const hostname = '127.0.0.1'; const port = 1337; http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Node Intro\n'); }).listen(port, hostname, () => { console.log('Server running at http://${hostname}:${port}/'); }); ``` - Then run `$ node server.js` - Open `http://127.0.0.1:1337` in browser to test your simple web server
{'content_hash': '44edfb46ebd5149ab62a4e4e812baa59', 'timestamp': '', 'source': 'github', 'line_count': 99, 'max_line_length': 76, 'avg_line_length': 18.03030303030303, 'alnum_prop': 0.6123249299719888, 'repo_name': 'andrewgurung/andrewgurung.github.io', 'id': '88eeacf49a3ac8d29eded647bf7a55ff900b29f7', 'size': '1790', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '_posts/2016-04-12-getting-started-with-nodejs.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '14636'}, {'name': 'HTML', 'bytes': '6174'}]}
var five = require("../lib/johnny-five"), board, shiftRegister; board = new five.Board(); // This works with the 74HC595 that comes with the SparkFun Inventor's kit. // Your mileage may vary with other chips. For more information on working // with shift registers, see http://arduino.cc/en/Tutorial/ShiftOut board.on("ready", function() { shiftRegister = new five.ShiftRegister({ pins: { data: 2, clock: 3, latch: 4 } }); var value = 0; function next() { value = value > 0x11 ? value >> 1 : 0x88; shiftRegister.send( value ); setTimeout(next, 200); } next(); });
{'content_hash': 'd15dedb78f4f37c3386565aeb3f1079f', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 75, 'avg_line_length': 21.551724137931036, 'alnum_prop': 0.6304, 'repo_name': 'garrows/johnny-five', 'id': '6c215cbb7639794b44a228a3f1b92b6c1c931297', 'size': '625', 'binary': False, 'copies': '12', 'ref': 'refs/heads/master', 'path': 'eg/shiftregister.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '126'}, {'name': 'JavaScript', 'bytes': '2128381'}]}
package seedu.todo.guitests; import static org.junit.Assert.*; import java.io.IOException; import java.time.LocalDateTime; import org.junit.Before; import org.junit.Test; import seedu.todo.commons.core.Config; import seedu.todo.commons.core.ConfigCenter; import seedu.todo.commons.util.DateUtil; import seedu.todo.guitests.guihandles.AliasItemHandle; import seedu.todo.models.Task; // @@author A0139812A public class AliasCommandTest extends GuiTest { // Fixtures private LocalDateTime twoDaysFromNow = LocalDateTime.now().plusDays(2); private String twoDaysFromNowIsoString = DateUtil.formatIsoDate(twoDaysFromNow); @Before public void beforeTest() { console.runCommand("clear"); try { ConfigCenter.getInstance().saveConfig(new Config()); } catch (IOException e) { fail("Failed to reset config."); } } @Test public void alias_view_success() { console.runCommand("alias"); assertTrue(aliasView.hasLoaded()); } @Test public void alias_toList_success() { console.runCommand("alias ls list"); assertAliasItemVisible("ls", "list"); console.runCommand("add Buy milk"); console.runCommand("alias"); // Move away from IndexView Task testTask = new Task(); testTask.setName("Buy milk"); console.runCommand("ls"); assertTaskVisible(testTask); assertValidCommand("ls"); } @Test public void alias_toAdd_success() { console.runCommand("alias a add"); assertAliasItemVisible("a", "add"); Task testTask = new Task(); testTask.setName("Buy milk"); console.runCommand("a Buy milk"); assertTaskVisible(testTask); } @Test public void alias_toAddTaskDeadline_success() { console.runCommand("alias a add"); assertAliasItemVisible("a", "add"); String command = String.format("a Buy milk by %s 5pm", twoDaysFromNowIsoString); Task testTask = new Task(); testTask.setName("Buy milk"); testTask.setDueDate(DateUtil.parseDateTime(String.format("%s 17:00:00", twoDaysFromNowIsoString))); console.runCommand(command); assertTaskVisible(testTask); } @Test public void alias_toInvalidCommand_isInvalid() { console.runCommand("alias invalidcommand ic"); assertAliasItemVisible("invalidcommand", "ic"); console.runCommand("ic"); assertInvalidCommand("ic"); } @Test public void alias_missingValue_disambiguate() { console.runCommand("alias list"); String disambiguation = "alias list <alias value>"; assertEquals(disambiguation, console.getConsoleInputText()); } @Test public void alias_tooManyArgs_disambiguate() { console.runCommand("alias show me the money"); String disambiguation = "alias show methemoney"; assertEquals(disambiguation, console.getConsoleInputText()); } /** * Helper function to assert that AliasItem is visible. */ private void assertAliasItemVisible(String aliasKey, String aliasValue) { // Make sure we can see the Alias View. assertTrue(aliasView.hasLoaded()); // Gets the matching AliasItem. Since it matches, if it's not null -> it definitely exists. AliasItemHandle aliasItem = aliasView.getAliasItem(aliasKey, aliasValue); assertNotNull(aliasItem); } }
{'content_hash': '50d272003953aecd709d37cc7d7de525', 'timestamp': '', 'source': 'github', 'line_count': 114, 'max_line_length': 107, 'avg_line_length': 31.210526315789473, 'alnum_prop': 0.6444631815626757, 'repo_name': 'CS2103AUG2016-F11-C1/main', 'id': 'c440b8c513f0ceb38b4202b8b3e513a6eed7062e', 'size': '3558', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/test/java/seedu/todo/guitests/AliasCommandTest.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '2972'}, {'name': 'Java', 'bytes': '379261'}, {'name': 'Python', 'bytes': '2649'}, {'name': 'XSLT', 'bytes': '6290'}]}
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>equations: Not compatible</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / extra-dev</a></li> <li class="active"><a href="">dev / equations - 1.0+8.7</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> equations <small> 1.0+8.7 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2021-04-03 04:38:32 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-04-03 04:38:32 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-gmp 3 Virtual package relying on a GMP lib system installation coq dev Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.11.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.11.1 Official release 4.11.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers # opam file: opam-version: &quot;2.0&quot; authors: [ &quot;Matthieu Sozeau &lt;[email protected]&gt;&quot; &quot;Cyprien Mangin &lt;[email protected]&gt;&quot; ] dev-repo: &quot;git+https://github.com/mattam82/Coq-Equations.git&quot; maintainer: &quot;[email protected]&quot; homepage: &quot;https://mattam82.github.io/Coq-Equations&quot; bug-reports: &quot;https://github.com/mattam82/Coq-Equations/issues&quot; license: &quot;LGPL 2.1&quot; build: [ [&quot;coq_makefile&quot; &quot;-f&quot; &quot;_CoqProject&quot; &quot;-o&quot; &quot;Makefile&quot;] [make &quot;-j%{jobs}%&quot;] ] install: [ [make &quot;install&quot;] ] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Equations&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.7&quot; &amp; &lt; &quot;8.8&quot;} ] synopsis: &quot;A function definition package for Coq&quot; description: &quot;&quot;&quot; Equations is a function definition plugin for Coq, that allows the definition of functions by dependent pattern-matching and well-founded, mutual or nested structural recursion and compiles them into core terms. It automatically derives the clauses equations, the graph of the function and its associated elimination principle.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/mattam82/Coq-Equations/archive/v1.0-8.7.tar.gz&quot; checksum: &quot;md5=3f9812ba4657f784038b9632478b5e9b&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-equations.1.0+8.7 coq.dev</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is dev). The following dependencies couldn&#39;t be met: - coq-equations -&gt; coq &lt; 8.8 -&gt; ocaml &lt; 4.10 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-equations.1.0+8.7</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{'content_hash': 'f7d408ad882f326637b4e3045266cbb1', 'timestamp': '', 'source': 'github', 'line_count': 173, 'max_line_length': 157, 'avg_line_length': 42.040462427745666, 'alnum_prop': 0.5553416746871992, 'repo_name': 'coq-bench/coq-bench.github.io', 'id': '05ce346d912b42334b5d4c973d50818ce52594f3', 'size': '7275', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'clean/Linux-x86_64-4.11.1-2.0.7/extra-dev/dev/equations/1.0+8.7.html', 'mode': '33188', 'license': 'mit', 'language': []}
myAppModule.controller('articleListController',['$scope','article','$timeout','$stateParams',function($scope,article,$timeout,$stateParams){ $scope.articleDatas = []; $scope.id = $stateParams.id; $scope.model = $stateParams.model; $scope.listData = function(data){ /*if(data){ $scope.articleDatas = data.datas } */ var url = "", data = {}; if($scope.model === 'selectList'){ //搜索文章后台selectLength字段 url = "/selectName"; data = { val : $scope.id, model : 'select' }; }else{ url = "/article/list"; data = { id : $scope.id }; } $("#pages").page({ url:url, dataLengthUrl:"/addArticle/articleListLength", data:data, callback:function(data){ $scope.articleDatas = data.datas.datas; $scope.$apply() } }) } $scope.listData() /* $timeout(function(){ if($scope.articleDatas.length === 0){ article.articleList(function(data){ $scope.articleDatas = data; console.log($scope.articleDatas) }); } },50) $timeout(function(){ if($scope.articleDatas.length === 0){ $("#pages").page({ url:"/addArticle/listNavClick", dataLengthUrl:"/addArticle/articleListLength", sort:true, id:$scope.id, callback:function(data){ $scope.articleDatas = data.datas.datas; $scope.$apply() } }) } },50) */ /* $scope.listNavClick = function(id){ article.listNavClick({ id:id, offsetNum:0 },function(data){ if(data.state == true){ $scope.articleDatas = data.datas; }else{ alert("没有数据") } }); } */ }])
{'content_hash': 'a5d1476f117115e2ee89480b1101ddd4', 'timestamp': '', 'source': 'github', 'line_count': 78, 'max_line_length': 140, 'avg_line_length': 28.44871794871795, 'alnum_prop': 0.4191077061739522, 'repo_name': 'mingkang1993/blogs', 'id': '9f82b4fb7114e0045f1b12fb1262a7ab388403a2', 'size': '2243', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/index/js/model/article/listController.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '43520'}, {'name': 'CSS', 'bytes': '355335'}, {'name': 'HTML', 'bytes': '168549'}, {'name': 'Java', 'bytes': '11028'}, {'name': 'JavaScript', 'bytes': '963063'}, {'name': 'PHP', 'bytes': '44496'}]}
var nop = function() {}; // Function params /** * @param {number} n */ var oneParam = function(n) {}; /** * @param {boolean} b * @param {string} s */ function twoParams(b, s) {} /** @param {!Array<?>=} list */ function withDefaultValue(list = []) {} // Function returns /** * @return {*} */ var anyReturn = function() { return "hello"; }; /** * @return {number} */ function typedReturn() { return 4; } /** * @param {number} n * @param {boolean} b */ var partiallyTyped = function(n, u1, b, u2) {}; // Both params and returns /** * @param {boolean} b * @param {string} s * @param {?} x * @return {string} */ var complex = function(b, s, x) { if (b) { return s; }}; // Undefined params /** * @param {undefined} u * @param {void} v */ var paramUndef = function(u, v) {}; // Void returns /** * @return {void} */ var retVoid = function() {}; /** * @return {undefined} */ var retUndef = function() {}; /** * @param {number} a * @return {number} */ const arrowWithJsDoc = a => { return a; }; const arrowNoJsDoc = a => { return a; }; const implicitReturnArrow = a => a;
{'content_hash': 'bd72ae80aec9530316bd8bf6195ca2be', 'timestamp': '', 'source': 'github', 'line_count': 72, 'max_line_length': 56, 'avg_line_length': 15.333333333333334, 'alnum_prop': 0.5652173913043478, 'repo_name': 'dpurp/clutz', 'id': '70bb0c3897f2df47b2602b7f0efd2103b26b72a1', 'size': '1104', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/test/java/com/google/javascript/gents/singleTests/functions.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '279027'}, {'name': 'JavaScript', 'bytes': '67844'}, {'name': 'TypeScript', 'bytes': '21951'}]}
Handle mirror meshes easily * [live example](http://jeromeetienne.github.com/tquery/plugins/mirror/examples/index.html) ## How to do a mirror ball ``` var mirror = tQuery.createMirrorBall().addTo(world) ``` * mirror inherit from ```tQuery.Object3D```. * [live example](http://jeromeetienne.github.com/tquery/plugins/mirror/examples/mirror-ball.html) ## How to do a mirror plane ``` var mirror = tQuery.createMirrorPlane().addTo(world) ``` * mirror inherit from ```tQuery.Object3D``` * [live example](http://jeromeetienne.github.com/tquery/plugins/mirror/examples/mirror-plane.html) * *TODO* close to the mirror, there is an artefact when the world camera got a big angle with the mirror * this is due to the rotation of the frustum vs the mirror's plane * this is reducable by computing the height of this artefact * then pushin mirror camera that much further from the mirror's plane ## about mirror plane and angle compensation * all computations are done in local-coordinates space of the mirror first some definitions * mirror plane: the THREE.Plane representing the mirror in the scene * mirror width: the width of the mirrorPlane * mirrorHalfWidth: mirrorWidth divided by 2 * user camera: the camera thru which the user is looking at the scene * mirror camera: the camera of 'what the mirror is seeing' * it has the z-symmetric position of the user camera * it looks at the center of the mirror plane * the near plane intersect the mirror plane * its fov matchs the mirror size * angle(mirrorPlane, userCamera): the angle between the mirror plane and the user camera * === angle(mirrorPlane, mirrorCamera)
{'content_hash': 'bb856a188ca131edf9df9eb6891f19d4', 'timestamp': '', 'source': 'github', 'line_count': 44, 'max_line_length': 98, 'avg_line_length': 37.31818181818182, 'alnum_prop': 0.756394640682095, 'repo_name': 'modulexcite/tquery', 'id': 'bd245d391b8eb0a149e37febbf225ba34cef203d', 'size': '1659', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'plugins/mirror/readme.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '303'}, {'name': 'CSS', 'bytes': '43714'}, {'name': 'HTML', 'bytes': '878509'}, {'name': 'Java', 'bytes': '553'}, {'name': 'JavaScript', 'bytes': '4312631'}, {'name': 'Makefile', 'bytes': '7946'}, {'name': 'PHP', 'bytes': '7474'}, {'name': 'Python', 'bytes': '6114'}, {'name': 'Ruby', 'bytes': '920'}, {'name': 'Shell', 'bytes': '154'}]}
#ifndef BOOST_SPIRIT_TREE_CALC_GRAMMAR_HPP_ #define BOOST_SPIRIT_TREE_CALC_GRAMMAR_HPP_ using namespace BOOST_SPIRIT_CLASSIC_NS; /////////////////////////////////////////////////////////////////////////////// // // Demonstrates the AST and parse trees. This is discussed in the // "Trees" chapter in the Spirit User's Guide. // /////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// // // Our calculator grammar // //////////////////////////////////////////////////////////////////////////// struct calculator : public grammar<calculator> { static const int integerID = 1; static const int factorID = 2; static const int termID = 3; static const int expressionID = 4; template <typename ScannerT> struct definition { definition(calculator const& /*self*/) { // Start grammar definition integer = leaf_node_d[ lexeme_d[ (!ch_p('-') >> +digit_p) ] ]; factor = integer | inner_node_d[ch_p('(') >> expression >> ch_p(')')] | (root_node_d[ch_p('-')] >> factor); term = factor >> *( (root_node_d[ch_p('*')] >> factor) | (root_node_d[ch_p('/')] >> factor) ); expression = term >> *( (root_node_d[ch_p('+')] >> term) | (root_node_d[ch_p('-')] >> term) ); // End grammar definition // turn on the debugging info. BOOST_SPIRIT_DEBUG_RULE(integer); BOOST_SPIRIT_DEBUG_RULE(factor); BOOST_SPIRIT_DEBUG_RULE(term); BOOST_SPIRIT_DEBUG_RULE(expression); } rule<ScannerT, parser_context<>, parser_tag<expressionID> > expression; rule<ScannerT, parser_context<>, parser_tag<termID> > term; rule<ScannerT, parser_context<>, parser_tag<factorID> > factor; rule<ScannerT, parser_context<>, parser_tag<integerID> > integer; rule<ScannerT, parser_context<>, parser_tag<expressionID> > const& start() const { return expression; } }; }; #endif
{'content_hash': 'ef2449aee3983e162911ce5996ad8fce', 'timestamp': '', 'source': 'github', 'line_count': 69, 'max_line_length': 81, 'avg_line_length': 34.89855072463768, 'alnum_prop': 0.4331395348837209, 'repo_name': 'huoxudong125/poedit', 'id': '26e4226184093be7f66b8183a49d469c65b385ca', 'size': '2835', 'binary': False, 'copies': '69', 'ref': 'refs/heads/master', 'path': 'deps/boost/libs/spirit/classic/example/fundamental/tree_calc_grammar.hpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '24909'}, {'name': 'C++', 'bytes': '883320'}, {'name': 'Inno Setup', 'bytes': '10952'}, {'name': 'Objective-C', 'bytes': '4458'}, {'name': 'Objective-C++', 'bytes': '14760'}, {'name': 'Python', 'bytes': '3040'}, {'name': 'Ruby', 'bytes': '232'}, {'name': 'Shell', 'bytes': '10489'}]}
import React, { Component, PureComponent } from 'react' import { Controller, config, Globals, animated } from 'react-spring' import PropTypes from 'prop-types' import isFunction from 'lodash/isFunction' import { throttle, debounce } from 'throttle-debounce' import ResizeObserver from 'resize-observer-polyfill' import scrollInitalState from './scrollInitalState' import nodeToScrollState from './nodeToScrollState' import nodeChildrenToScrollState from './nodeChildrenToScrollState' const View = Globals.defaultElement export default class Scroller extends Component { static defaultProps = { autoFrame: false, autoScroll: false, ScrollerNavigation: () => null } constructor(props) { super(props) this.state = { scroll: scrollInitalState } // debounce is used to mimiques start, move and end events that don't have this functions this.handleScrollStart = debounce(500, true, this.handleScrollStart) this.handleResizeMove = throttle(50, this.handleResizeMove) this.handleScrollEnd = debounce(500, this.handleScrollEnd) this.handleWheelStart = debounce(100, true, this.handleWheelStart) this.handleWheelEnd = debounce(100, this.handleWheelEnd) this.handleResizeStart = debounce(250, true, this.handleResizeStart) this.handleResizeEnd = debounce(250, this.handleResizeEnd) this.scrollToPrevDebounced = debounce(250, true, this.scrollToPrev) this.scrollToNextDebounced = debounce(250, true, this.scrollToNext) this.controller = new Controller({ scroll: 0 }) } componentWillUnmount() { this.deleteRef() } createRef = (ref) => { this.target = ref // add component to resize observer to detect changes on resize this.resizeObserver = new ResizeObserver((entries, observer) => { if (this.state.ready) { this.handleResize() } else { this.setStateScroll({ ready: true }) } }) if(this.target){ this.resizeObserver.observe(this.target) } this.props.scrollRef(this.connection) } deleteRef = () => { if (this.target) { this.resizeObserver.disconnect(this.target) } this.setStateScroll({ ready: false }) } get connection() { return { ...this.state.scroll, target: this.target, autoFrame: this.props.autoFrame, autoScroll: this.props.autoScroll, scrollToPosition: this.scrollToPosition, scrollToByIndex: this.scrollToByIndex, scrollToTop: this.scrollToTop, scrollToBottom: this.scrollToBottom, scrollToPrev: this.scrollToPrev, scrollToNext: this.scrollToNext, scrollToElement: this.scrollToElement, scrollToActive: this.scrollToActive, } } setStateScroll = (additionalStates) => { const { onScrollChange } = this.props; const newScroll = { ...this.state.scroll, ...nodeToScrollState(this.target), ...nodeChildrenToScrollState(this.target), ...additionalStates } this.setState({ scroll: newScroll }) if (onScrollChange) { onScrollChange(newScroll) } } setStateScrollStart = (additionalStates) => { const { position } = this.state.scroll this.setStateScroll({ originalPosition: position, timeStamp: Date.now(), ...additionalStates }) } setStateScrollMove = (additionalStates) => { this.setStateScroll({ moving: true, resting: false, ...additionalStates }) } setStateScrollRest = (additionalStates) => { this.setStateScroll({ moving: false, resting: true, ...additionalStates }) } setStateScrollEnd = (additionalStates) => { this.setStateScroll({ originalPosition: null, changedPosition: null, timeStamp: null, ...additionalStates }) } findChildOnView = () => { const { children } = this.state.scroll return children.find((child) => child.onView) } findChildIndexOnView = () => { const { children } = this.state.scroll return children.findIndex((child) => child.onView) } scrollToPosition = (position) => { this.controller.update({ scroll: position, onFrame: ({ scroll }) => (this.target.scrollTop = scroll), }) } scrollToByIndex = (index) => { const { children } = this.state.scroll this.scrollToPosition(children[index].start) } scrollToTop = () => { const { start } = this.state.scroll this.scrollToPosition(start) } scrollToBottom = () => { const { end } = this.state.scroll this.scrollToPosition(end) } previousOfIndex = ( i=this.findChildIndexOnView(), arr=this.state.scroll.children ) => { return arr[i > 0 ? i - 1 : i] } nextOfIndex = ( i=this.findChildIndexOnView(), arr=this.state.scroll.children ) => { return arr[i < arr.length - 1 ? i + 1 : i] } scrollToPrev = () => { const prevPosition = this.previousOfIndex().start this.scrollToPosition(prevPosition) } scrollToNext = () => { const nextPosition = this.nextOfIndex().start this.scrollToPosition(nextPosition) } scrollToElement = (element, options) => { const start = element.scrollTop this.scrollToPosition(start) } scrollToActive = () => { let newPosition = this.findChildOnView().start this.scrollToPosition(newPosition) } handleScroll = () => { this.handleScrollStart() this.handleScrollMove() this.handleScrollEnd() } handleScrollStart = () => { this.setStateScrollMove() } handleScrollMove = () => { this.setStateScroll() } handleScrollEnd = () => { this.setStateScrollRest() } handleResize = () => { this.handleResizeStart() this.handleResizeMove() this.handleResizeEnd() } handleResizeStart = () => { this.setStateScrollMove() } handleResizeMove = () => { this.handleScroll() } handleResizeEnd = () => { const { autoFrame } = this.props if (autoFrame) { this.scrollToActive() } } handleWheel = (e) => { const { autoScroll } = this.props if (autoScroll) { e.preventDefault() } this.handleWheelStart(e) this.handleWheelMove(e) this.handleWheelEnd(e) } handleWheelStart = (e) => { const { autoScroll } = this.props const { changedPosition } = this.state.scroll this.setStateScrollStart({ wheeling: true, changedPosition: !autoScroll ? null : changedPosition }) if (autoScroll) { const movingUpwards = e.deltaY > 0 const movingDownwards = e.deltaY < 0 if (movingDownwards) this.scrollToPrevDebounced() if (movingUpwards) this.scrollToNextDebounced() } } handleWheelMove = (e) => { const { autoScroll } = this.props if (autoScroll) { const prev = this.state.deltaY const next = e.deltaY const changed = Math.abs(next) > Math.abs(prev) if (changed) { const movingUpwards = next > 0 const movingDownwards = next < 0 if (movingDownwards) { this.scrollToPrevDebounced() } if (movingUpwards) { this.scrollToNextDebounced() } } } this.setState({ deltaY: e.deltaY }) } handleWheelEnd = (e) => { const { autoFrame } = this.state.scroll this.setStateScrollEnd({ wheeling: false, deltaY: null }) if (autoFrame) this.scrollToActive() } handleTouchStart = (e) => { this.setStateScrollStart({ touching: true, touches: e.touches, }) } handleTouchMove = (e) => { const { touches, originalPosition } = this.state.scroll let distanceFromTouchStart = e.changedTouches[0].clientY - touches[0].clientY let touchPosition = originalPosition - distanceFromTouchStart this.scrollToPosition(touchPosition) } handleTouchEnd = (e) => { const { timeStamp, touches } = this.state.scroll const timeLapse = Date.now() - timeStamp if (timeLapse < 200) { const movingUpwards = e.changedTouches[0].clientY < touches[0].clientY const movingDownwards = e.changedTouches[0].clientY > touches[0].clientY if (movingDownwards) this.scrollToPrev() if (movingUpwards) this.scrollToNext() } else { this.scrollToActive() } this.setStateScroll({ touching: false, }) } render() { const { children, autoFrame, autoScroll, ScrollerNavigation } = this.props const scroll = this.connection return ( <ScrollerContainer> <ScrollerNavigation scroll={scroll} /> <ScrollerContent scrollRef={this.createRef} scroll={this.state.scroll} onScroll={this.handleScroll} onWheel={this.handleWheel} onTouchStart={this.handleTouchStart} onTouchMove={this.handleTouchMove} onTouchEnd={this.handleTouchEnd} > {isFunction(children) ? children(scroll) : children} </ScrollerContent> </ScrollerContainer> ) } } const containerStyle = { height: '100%', width: '100%', } class ScrollerContainer extends PureComponent { render() { return <View style={containerStyle} {...this.props} /> } } class ScrollerContent extends PureComponent { render() { const { scroll, scrollRef, autoFrame, autoScroll, ...props } = this.props; const style = { height: '100%', width: '100%', overflowY: autoScroll || scroll.touching ? 'hidden' : 'auto', // TODO: investigar glich on touchScroll with overFlow // overflowScrolling: 'touch', // WebkitOverflowScrolling: 'touch', // overflowY: !autoScroll && !touching ? 'auto' : 'hidden', } return ( <View ref={scrollRef} style={style} {...props} /> ) } }
{'content_hash': 'ff7f2afa1a728640f0b3a3f38a6d3142', 'timestamp': '', 'source': 'github', 'line_count': 435, 'max_line_length': 93, 'avg_line_length': 22.777011494252875, 'alnum_prop': 0.6297941057731127, 'repo_name': 'du5rte/react-skroll', 'id': '8ae039f46ba97fc25011b9ff349fb0018decc8e7', 'size': '9908', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Scroller.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '14152'}]}
package com.yahoo.labs.samoa.moa.streams; import com.yahoo.labs.samoa.instances.InstancesHeader; import com.yahoo.labs.samoa.moa.MOAObject; import com.yahoo.labs.samoa.moa.core.Example; /** * Interface representing a data stream of examples. * * @author Richard Kirkby ([email protected]) * @version $Revision: 7 $ */ public interface ExampleStream<E extends Example> extends MOAObject { /** * Gets the header of this stream. * This is useful to know attributes and classes. * InstancesHeader is an extension of weka.Instances. * * @return the header of this stream */ public InstancesHeader getHeader(); /** * Gets the estimated number of remaining instances in this stream * * @return the estimated number of instances to get from this stream */ public long estimatedRemainingInstances(); /** * Gets whether this stream has more instances to output. * This is useful when reading streams from files. * * @return true if this stream has more instances to output */ public boolean hasMoreInstances(); /** * Gets the next example from this stream. * * @return the next example of this stream */ public E nextInstance(); /** * Gets whether this stream can restart. * * @return true if this stream can restart */ public boolean isRestartable(); /** * Restarts this stream. It must be similar to * starting a new stream from scratch. * */ public void restart(); }
{'content_hash': '2d94e7d5baffd9cc0d7ee53694ff25c2', 'timestamp': '', 'source': 'github', 'line_count': 61, 'max_line_length': 72, 'avg_line_length': 25.688524590163933, 'alnum_prop': 0.6566687938736439, 'repo_name': 'bikash/samoa', 'id': 'dbdeba3a5e7ba4e894ea308c78d8a9aa3bcfbf80', 'size': '2236', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ExampleStream.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '1463998'}, {'name': 'Shell', 'bytes': '20010'}]}
package org.apache.jackrabbit.oak.plugins.backup; import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE; import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import com.google.common.collect.ImmutableMap; import org.apache.jackrabbit.oak.plugins.segment.Compactor; import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeBuilder; import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState; import org.apache.jackrabbit.oak.plugins.segment.file.FileStore; import org.apache.jackrabbit.oak.spi.state.NodeState; import org.apache.jackrabbit.oak.spi.state.NodeStore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class FileStoreBackup { private static final Logger log = LoggerFactory .getLogger(FileStoreBackup.class); private static final long DEFAULT_LIFETIME = TimeUnit.HOURS.toMillis(1); static int MAX_FILE_SIZE = 256; public static void backup(NodeStore store, File destination) throws IOException { long s = System.currentTimeMillis(); // 1. create a new checkpoint with the current state String checkpoint = store.checkpoint(DEFAULT_LIFETIME, ImmutableMap.of( "creator", FileStoreBackup.class.getSimpleName(), "thread", Thread.currentThread().getName())); NodeState current = store.retrieve(checkpoint); if (current == null) { // unable to retrieve the checkpoint; use root state instead current = store.getRoot(); } // 2. init filestore FileStore backup = new FileStore(destination, MAX_FILE_SIZE, false); try { SegmentNodeState state = backup.getHead(); NodeState before = null; String beforeCheckpoint = state.getString("checkpoint"); if (beforeCheckpoint == null) { // 3.1 no stored checkpoint, so do the initial full backup before = EMPTY_NODE; } else { // 3.2 try to retrieve the previously backed up checkpoint before = store.retrieve(beforeCheckpoint); if (before == null) { // the previous checkpoint is no longer available, // so use the backed up state as the basis of the // incremental backup diff before = state.getChildNode("root"); } } Compactor compactor = new Compactor(backup.getTracker().getWriter()); SegmentNodeState after = compactor.compact(before, current); // 4. commit the backup SegmentNodeBuilder builder = state.builder(); builder.setProperty("checkpoint", checkpoint); builder.setChildNode("root", after); backup.setHead(state, builder.getNodeState()); } finally { backup.close(); } log.debug("Backup finished in {} ms.", System.currentTimeMillis() - s); } }
{'content_hash': 'f62acb802356745d7306ad761780c858', 'timestamp': '', 'source': 'github', 'line_count': 77, 'max_line_length': 81, 'avg_line_length': 39.467532467532465, 'alnum_prop': 0.6413293846660085, 'repo_name': 'bdelacretaz/jackrabbit-oak', 'id': '0f585fa1e65e068067dc9f1c9f39960fe1c86718', 'size': '3846', 'binary': False, 'copies': '7', 'ref': 'refs/heads/trunk', 'path': 'oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/backup/FileStoreBackup.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '913'}, {'name': 'Groovy', 'bytes': '85310'}, {'name': 'Java', 'bytes': '14371327'}, {'name': 'JavaScript', 'bytes': '33219'}, {'name': 'Perl', 'bytes': '7585'}, {'name': 'Shell', 'bytes': '14526'}]}
namespace gfx { TEST(SafeIntegerConversions, ToFlooredInt) { float max = std::numeric_limits<int>::max(); float min = std::numeric_limits<int>::min(); float infinity = std::numeric_limits<float>::infinity(); int int_max = std::numeric_limits<int>::max(); int int_min = std::numeric_limits<int>::min(); EXPECT_EQ(int_max, ToFlooredInt(infinity)); EXPECT_EQ(int_max, ToFlooredInt(max)); EXPECT_EQ(int_max, ToFlooredInt(max + 100)); EXPECT_EQ(-101, ToFlooredInt(-100.5f)); EXPECT_EQ(0, ToFlooredInt(0.f)); EXPECT_EQ(100, ToFlooredInt(100.5f)); EXPECT_EQ(int_min, ToFlooredInt(-infinity)); EXPECT_EQ(int_min, ToFlooredInt(min)); EXPECT_EQ(int_min, ToFlooredInt(min - 100)); } TEST(SafeIntegerConversions, ToCeiledInt) { float max = std::numeric_limits<int>::max(); float min = std::numeric_limits<int>::min(); float infinity = std::numeric_limits<float>::infinity(); int int_max = std::numeric_limits<int>::max(); int int_min = std::numeric_limits<int>::min(); EXPECT_EQ(int_max, ToCeiledInt(infinity)); EXPECT_EQ(int_max, ToCeiledInt(max)); EXPECT_EQ(int_max, ToCeiledInt(max + 100)); EXPECT_EQ(-100, ToCeiledInt(-100.5f)); EXPECT_EQ(0, ToCeiledInt(0.f)); EXPECT_EQ(101, ToCeiledInt(100.5f)); EXPECT_EQ(int_min, ToCeiledInt(-infinity)); EXPECT_EQ(int_min, ToCeiledInt(min)); EXPECT_EQ(int_min, ToCeiledInt(min - 100)); } TEST(SafeIntegerConversions, ToRoundedInt) { float max = std::numeric_limits<int>::max(); float min = std::numeric_limits<int>::min(); float infinity = std::numeric_limits<float>::infinity(); int int_max = std::numeric_limits<int>::max(); int int_min = std::numeric_limits<int>::min(); EXPECT_EQ(int_max, ToRoundedInt(infinity)); EXPECT_EQ(int_max, ToRoundedInt(max)); EXPECT_EQ(int_max, ToRoundedInt(max + 100)); EXPECT_EQ(-100, ToRoundedInt(-100.1f)); EXPECT_EQ(-101, ToRoundedInt(-100.5f)); EXPECT_EQ(-101, ToRoundedInt(-100.9f)); EXPECT_EQ(0, ToRoundedInt(0.f)); EXPECT_EQ(100, ToRoundedInt(100.1f)); EXPECT_EQ(101, ToRoundedInt(100.5f)); EXPECT_EQ(101, ToRoundedInt(100.9f)); EXPECT_EQ(int_min, ToRoundedInt(-infinity)); EXPECT_EQ(int_min, ToRoundedInt(min)); EXPECT_EQ(int_min, ToRoundedInt(min - 100)); } } // namespace gfx
{'content_hash': '9b4f61176e0c007e8544d81665fac518', 'timestamp': '', 'source': 'github', 'line_count': 70, 'max_line_length': 58, 'avg_line_length': 32.25714285714286, 'alnum_prop': 0.6815766164747564, 'repo_name': 'SaschaMester/delicium', 'id': '91bdbb8d3593020fc58df008040640b44cbb0d20', 'size': '2550', 'binary': False, 'copies': '36', 'ref': 'refs/heads/master', 'path': 'ui/gfx/geometry/safe_integer_conversions_unittest.cc', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'AppleScript', 'bytes': '6973'}, {'name': 'Arduino', 'bytes': '464'}, {'name': 'Assembly', 'bytes': '23829'}, {'name': 'Batchfile', 'bytes': '8451'}, {'name': 'C', 'bytes': '4171711'}, {'name': 'C++', 'bytes': '243066171'}, {'name': 'CSS', 'bytes': '935112'}, {'name': 'DM', 'bytes': '60'}, {'name': 'Groff', 'bytes': '2494'}, {'name': 'HTML', 'bytes': '27211018'}, {'name': 'Java', 'bytes': '14285999'}, {'name': 'JavaScript', 'bytes': '20413885'}, {'name': 'Makefile', 'bytes': '23496'}, {'name': 'Objective-C', 'bytes': '1725804'}, {'name': 'Objective-C++', 'bytes': '9880229'}, {'name': 'PHP', 'bytes': '97817'}, {'name': 'PLpgSQL', 'bytes': '178732'}, {'name': 'Perl', 'bytes': '63937'}, {'name': 'Protocol Buffer', 'bytes': '478406'}, {'name': 'Python', 'bytes': '8261413'}, {'name': 'Shell', 'bytes': '482077'}, {'name': 'Standard ML', 'bytes': '5034'}, {'name': 'XSLT', 'bytes': '418'}, {'name': 'nesC', 'bytes': '18347'}]}
#ifndef _H_CAnimal #define _H_CAnimal #include"afx.h" class CAnimal //the basic class of all the animals { private: public: ESpecies m_Species; //the specific species EHead m_Head; //the kinds of head ENeck m_Neck; //the kinds of neck EBody m_Body; //the kinds of body ETail m_Tail; //the kinds of tail CAnimal(); //initialize all the data member virtual ~CAnimal(); //do nothing void Touch(EOrgan Organ); //reaction for touch depending on different part virtual void Charateristic()=0; //need to reload to show specific animal }; #endif
{'content_hash': '2c99bdc64991ea0e7b841d625055fa16', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 76, 'avg_line_length': 21.88888888888889, 'alnum_prop': 0.676818950930626, 'repo_name': 'tobegit3hub/BlindZoo', 'id': 'd1e270d944721bb048bf09cfe1260e6aed9cce80', 'size': '604', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'BlindZoo/BlindZoo/CAnimal.h', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '48787'}]}
package test.service.impl.streamservice; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import java.util.List; import org.junit.Test; import javastrava.model.StravaStream; import javastrava.model.reference.StravaStreamResolutionType; import javastrava.model.reference.StravaStreamSeriesDownsamplingType; import javastrava.model.reference.StravaStreamType; import javastrava.service.Strava; import test.service.standardtests.ListMethodTest; import test.service.standardtests.callbacks.ListCallback; import test.service.standardtests.data.SegmentDataUtils; import test.service.standardtests.data.StreamDataUtils; import test.utils.RateLimitedTestRunner; import test.utils.TestUtils; /** * <p> * Specific tests for {@link Strava#getSegmentStreams(Integer)} methods * </p> * * @author Dan Shannon * */ public class GetSegmentStreamsTest extends ListMethodTest<StravaStream, Integer> { @Override protected Class<StravaStream> classUnderTest() { return StravaStream.class; } @Override protected Integer idInvalid() { return SegmentDataUtils.SEGMENT_INVALID_ID; } @Override protected Integer idPrivate() { return SegmentDataUtils.SEGMENT_PRIVATE_ID; } @Override protected Integer idPrivateBelongsToOtherUser() { return SegmentDataUtils.SEGMENT_OTHER_USER_PRIVATE_ID; } @Override protected Integer idValidWithEntries() { return SegmentDataUtils.SEGMENT_VALID_ID; } @Override protected Integer idValidWithoutEntries() { return null; } @Override protected ListCallback<StravaStream, Integer> lister() { return ((strava, id) -> strava.getSegmentStreams(id)); } /** * <p> * All stream types * </p> * * @throws Exception * if the test fails in an unexpected way */ @Test public void testGetSegmentStreams_allStreamTypes() throws Exception { RateLimitedTestRunner.run(() -> { final List<StravaStream> streams = TestUtils.strava().getSegmentStreams(SegmentDataUtils.SEGMENT_VALID_ID); validateList(streams); }); } /** * <p> * Downsampled by distance * </p> * * @throws Exception * if the test fails in an unexpected way */ @Test public void testGetSegmentStreams_downsampledByDistance() throws Exception { RateLimitedTestRunner.run(() -> { for (final StravaStreamResolutionType resolutionType : StravaStreamResolutionType.values()) { if ((resolutionType != StravaStreamResolutionType.UNKNOWN) && (resolutionType != null)) { final List<StravaStream> streams = TestUtils.strava().getSegmentStreams(SegmentDataUtils.SEGMENT_VALID_ID, resolutionType, StravaStreamSeriesDownsamplingType.DISTANCE); validateList(streams); } } }); } /** * <p> * Downsampled by time - can't be done for segment streams as there's no time element * </p> * * @throws Exception * if the test fails in an unexpected way */ @SuppressWarnings("static-method") @Test public void testGetSegmentStreams_downsampledByTime() throws Exception { RateLimitedTestRunner.run(() -> { for (final StravaStreamResolutionType resolutionType : StravaStreamResolutionType.values()) { if (resolutionType != StravaStreamResolutionType.UNKNOWN) { try { TestUtils.strava().getSegmentStreams(SegmentDataUtils.SEGMENT_VALID_ID, resolutionType, StravaStreamSeriesDownsamplingType.TIME); } catch (final IllegalArgumentException e) { // expected return; } fail("Can't return a segment stream which is downsampled by TIME!"); //$NON-NLS-1$ } } }); } /** * <p> * Invalid downsample resolution * </p> * * @throws Exception * if the test fails in an unexpected way */ @SuppressWarnings("static-method") @Test public void testGetSegmentStreams_invalidDownsampleResolution() throws Exception { RateLimitedTestRunner.run(() -> { try { TestUtils.strava().getSegmentStreams(SegmentDataUtils.SEGMENT_VALID_ID, StravaStreamResolutionType.UNKNOWN, null); } catch (final IllegalArgumentException e) { // Expected return; } fail("Didn't throw an exception when asking for an invalid downsample resolution"); //$NON-NLS-1$ }); } /** * <p> * Invalid downsample type * </p> * * @throws Exception * if the test fails in an unexpected way */ @SuppressWarnings("static-method") @Test public void testGetSegmentStreams_invalidDownsampleType() throws Exception { RateLimitedTestRunner.run(() -> { try { TestUtils.strava().getSegmentStreams(SegmentDataUtils.SEGMENT_VALID_ID, StravaStreamResolutionType.LOW, StravaStreamSeriesDownsamplingType.UNKNOWN); } catch (final IllegalArgumentException e) { // Expected return; } fail("Didn't throw an exception when asking for an invalid downsample type"); //$NON-NLS-1$ }); } /** * <p> * Invalid stream type * </p> * * @throws Exception * if the test fails in an unexpected way */ @SuppressWarnings("static-method") @Test public void testGetSegmentStreams_invalidStreamType() throws Exception { RateLimitedTestRunner.run(() -> { try { TestUtils.strava().getSegmentStreams(SegmentDataUtils.SEGMENT_VALID_ID, null, null, StravaStreamType.UNKNOWN); } catch (final IllegalArgumentException e) { // Expected return; } fail("Should have got an IllegalArgumentException, but didn't"); //$NON-NLS-1$ }); } /** * <p> * Only one stream type * </p> * * @throws Exception * if the test fails in an unexpected way */ @Test public void testGetSegmentStreams_oneStreamType() throws Exception { RateLimitedTestRunner.run(() -> { final List<StravaStream> streams = TestUtils.strava().getSegmentStreams(SegmentDataUtils.SEGMENT_VALID_ID, null, null, StravaStreamType.DISTANCE); assertNotNull(streams); assertEquals(1, streams.size()); assertEquals(StravaStreamType.DISTANCE, streams.get(0).getType()); validateList(streams); }); } @Override protected void validate(StravaStream object) { StreamDataUtils.validateStream(object); } }
{'content_hash': '81d19cce41a675d758ec8a3385a6a6ee', 'timestamp': '', 'source': 'github', 'line_count': 219, 'max_line_length': 173, 'avg_line_length': 27.945205479452056, 'alnum_prop': 0.7186274509803922, 'repo_name': 'danshannon/javastrava-test', 'id': '08269bed714fe2141610a669999c3a6f34f59606', 'size': '6120', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/test/service/impl/streamservice/GetSegmentStreamsTest.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '1092887'}]}
package org.schneider.DynamHAProxy; import java.lang.invoke.MethodHandles; import java.util.HashMap; import java.util.Map; import org.apache.commons.cli.BasicParser; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.GnuParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.config.DefaultConfiguration; /** * CommandLine entry point to the application. * * @author <a href="[email protected]">Ryan Schneider</a> */ public class Driver { public static final String JOINER_PROPERTY_PREFIX = "joiner."; @SuppressWarnings("static-access") public static void main( String[] args ) { System.setProperty(DefaultConfiguration.DEFAULT_LEVEL, "DEBUG"); Logger logger = LogManager.getLogger( MethodHandles.lookup().lookupClass() ); // create the command line parser CommandLineParser parser = new GnuParser(); // create the Options Options options = new Options(); options.addOption( OptionBuilder.withLongOpt("joiner") .isRequired() .hasArg() .withArgName("joiner") .withDescription("name of the joiner to use") .create() ); try { // parse the command line arguments CommandLine line = parser.parse( options, args ); DynamHAProxy service = new DynamHAProxy( line.getOptionValue("joiner"), retrieveJoinerProperties() ); service.start(); } catch( ParseException e ) { logger.fatal( "Problem trying to parse command line", e ); new HelpFormatter().printHelp( MethodHandles.lookup().lookupClass().getName(), options ); } catch( Exception e ) { logger.error( "Unexpected error, exiting", e ); e.printStackTrace(); } } public static Map<String,String> retrieveJoinerProperties() { HashMap<String,String> properties = new HashMap<>(); for( Object key : System.getProperties().keySet() ) { if( key.toString().startsWith(JOINER_PROPERTY_PREFIX) ) { properties.put( key.toString().replace(JOINER_PROPERTY_PREFIX, ""), System.getProperty(key.toString()) ); } } return properties; } }
{'content_hash': '61810e67c5005fd97d938a2a269b7295', 'timestamp': '', 'source': 'github', 'line_count': 73, 'max_line_length': 113, 'avg_line_length': 33.082191780821915, 'alnum_prop': 0.7002070393374741, 'repo_name': 'djschny/DynamHAProxy', 'id': '63a32fe2272ffe0c329cbb387a6d5c60b3ff240c', 'size': '2415', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/org/schneider/DynamHAProxy/Driver.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '18272'}]}
<?php declare(strict_types=1); namespace Application\Migrations; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; final class Version20211105154638 extends AbstractMigration { public function getDescription(): string { return ''; } public function up(Schema $schema): void { $this->addSql('ALTER TABLE user ALTER createdAt DROP DEFAULT'); $this->addSql('ALTER TABLE user ALTER updatedAt DROP DEFAULT'); } public function down(Schema $schema): void { } public function isTransactional(): bool { return false; } }
{'content_hash': '95caf52847401bf26f197009bbf6b21c', 'timestamp': '', 'source': 'github', 'line_count': 30, 'max_line_length': 71, 'avg_line_length': 20.833333333333332, 'alnum_prop': 0.672, 'repo_name': 'knutschsoft/swapp', 'id': '7ea8b1c9e6049d9017eac9af2b83ca556cb2db23', 'size': '625', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'web/src/Migrations/Version20211105154638.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Dockerfile', 'bytes': '5479'}, {'name': 'Gherkin', 'bytes': '279226'}, {'name': 'JavaScript', 'bytes': '104371'}, {'name': 'PHP', 'bytes': '413284'}, {'name': 'SCSS', 'bytes': '6555'}, {'name': 'Shell', 'bytes': '6505'}, {'name': 'Twig', 'bytes': '11129'}, {'name': 'Vue', 'bytes': '388570'}]}
package org.apereo.cas.adaptors.x509.authentication.handler.support; import org.apereo.cas.adaptors.x509.authentication.ExpiredCRLException; import org.apereo.cas.adaptors.x509.authentication.revocation.policy.ThresholdExpiredCRLRevocationPolicy; import org.apereo.cas.util.DateTimeUtils; import org.apereo.cas.adaptors.x509.util.MockX509CRL; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import javax.security.auth.x500.X500Principal; import java.security.GeneralSecurityException; import java.security.cert.X509CRL; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.Collection; /** * Unit test for {@link ThresholdExpiredCRLRevocationPolicy} class. * * @author Marvin S. Addison * @since 3.4.7 * */ @RunWith(Parameterized.class) public class ThresholdExpiredCRLRevocationPolicyTests { /** Policy instance under test. */ private final ThresholdExpiredCRLRevocationPolicy policy; /** CRL to test. */ private final X509CRL crl; /** Expected result of check; null for success */ private final GeneralSecurityException expected; /** * Creates a new test instance with given parameters. * * @param policy Policy to test. * @param crl CRL instance to apply policy to. * @param expected Expected result of policy application; null to indicate expected success. */ public ThresholdExpiredCRLRevocationPolicyTests( final ThresholdExpiredCRLRevocationPolicy policy, final X509CRL crl, final GeneralSecurityException expected) { this.policy = policy; this.expected = expected; this.crl = crl; } /** * Gets the unit test parameters. * * @return Test parameter data. * @throws Exception if there is an exception getting the test parameters. */ @Parameters public static Collection<Object[]> getTestParameters() throws Exception { final Collection<Object[]> params = new ArrayList<>(); final ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC); final ZonedDateTime twoHoursAgo = now.minusHours(2); final ZonedDateTime oneHourAgo = now.minusHours(1); final ZonedDateTime halfHourAgo = now.minusMinutes(30); final X500Principal issuer = new X500Principal("CN=CAS"); // Test case #1 // Expect expired for zero leniency on CRL expiring 1ms ago final ThresholdExpiredCRLRevocationPolicy zeroThreshold = new ThresholdExpiredCRLRevocationPolicy(0); params.add(new Object[] { zeroThreshold, new MockX509CRL(issuer, DateTimeUtils.dateOf(oneHourAgo), DateTimeUtils.dateOf(now.minusSeconds(1))), new ExpiredCRLException("CN=CAS", ZonedDateTime.now(ZoneOffset.UTC)), }); // Test case #2 // Expect expired for 1h leniency on CRL expired 1 hour 1ms ago final ThresholdExpiredCRLRevocationPolicy oneHourThreshold = new ThresholdExpiredCRLRevocationPolicy(3600); params.add(new Object[] { oneHourThreshold, new MockX509CRL(issuer, DateTimeUtils.dateOf(twoHoursAgo), DateTimeUtils.dateOf(oneHourAgo.minusSeconds(1))), new ExpiredCRLException("CN=CAS", ZonedDateTime.now(ZoneOffset.UTC)), }); // Test case #3 // Expect valid for 1h leniency on CRL expired 30m ago params.add(new Object[] { oneHourThreshold, new MockX509CRL(issuer, DateTimeUtils.dateOf(twoHoursAgo), DateTimeUtils.dateOf(halfHourAgo)), null, }); return params; } /** * Test method for {@link ThresholdExpiredCRLRevocationPolicy#apply(java.security.cert.X509CRL)}. */ @Test public void verifyApply() { try { this.policy.apply(this.crl); if (this.expected != null) { Assert.fail("Expected exception of type " + this.expected.getClass()); } } catch (final GeneralSecurityException e) { if (this.expected == null) { e.printStackTrace(); Assert.fail("Revocation check failed unexpectedly with exception: " + e); } else { final Class<?> expectedClass = this.expected.getClass(); final Class<?> actualClass = e.getClass(); Assert.assertTrue( String.format("Expected exception of type %s but got %s", expectedClass, actualClass), expectedClass.isAssignableFrom(actualClass)); } } } }
{'content_hash': '0d05f80b03cec8e32398377daeace623', 'timestamp': '', 'source': 'github', 'line_count': 127, 'max_line_length': 125, 'avg_line_length': 37.51968503937008, 'alnum_prop': 0.664218258132214, 'repo_name': 'mrluo735/cas-5.1.0', 'id': '193c09a3390b9596d447d4b4c74141dd21112b95', 'size': '4765', 'binary': False, 'copies': '7', 'ref': 'refs/heads/master', 'path': 'support/cas-server-support-x509-core/src/test/java/org/apereo/cas/adaptors/x509/authentication/handler/support/ThresholdExpiredCRLRevocationPolicyTests.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '176995'}, {'name': 'Groovy', 'bytes': '4583'}, {'name': 'HTML', 'bytes': '231541'}, {'name': 'Java', 'bytes': '6289667'}, {'name': 'JavaScript', 'bytes': '194710'}, {'name': 'Shell', 'bytes': '13985'}]}
using NUnit.Framework; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; using System; using Dexter.Analyzer.Tests.Helpers; using Dexter.Analyzer; namespace Dexter.Analyzer.Tests { [TestFixture] public class NoCommentFixProviderTest : CodeFixVerifier { [Test] public void NoCommentFixProvider_Fix_GivenClassTypeWithoutDoxygenComment() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { public class TestClass { } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> /// <code> /// /// </code> public class TestClass { } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenInterfaceTypeWithoutDoxygenComment() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { public interface Test { } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> public interface Test { } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenStructTypeWithoutDoxygenComment() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { public struct Test { } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> public struct Test { } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenEnumTypeWithoutDoxygenComment() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { public enum Test { Start, Stop } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> public enum Test { Start, Stop } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenMethodTypeWithNoParams_WithoutDoxygenComment() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { public void Test() { } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> public void Test() { } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenMethodTypeWithParams_WithoutDoxygenComment() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { public void Test(int start, int end) { } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> /// <param name=""start""> </param> /// <param name=""end""> </param> public void Test(int start, int end) { } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenMethodTypeWithThrows_WithoutDoxygenComment() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { public void Test(int n) { if (n == 1) { throw new Exception(""test""); } else { throw new ArgumentException(""test2""); } } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> /// <param name=""n""> </param> /// <exception cref=""Exception""> </exception> /// <exception cref=""ArgumentException""> </exception> public void Test(int n) { if (n == 1) { throw new Exception(""test""); } else { throw new ArgumentException(""test2""); } } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Ignore_GivenMethodTypeWithInvalidThrows() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { public void Test(int n) { if (n == 1) { throw; } else { throw GetException(""test""); } } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> /// <param name=""n""> </param> public void Test(int n) { if (n == 1) { throw; } else { throw GetException(""test""); } } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenMethodTypeWithValidReturnType() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { public int Test() { return 1; } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> /// <returns> </returns> public int Test() { return 1; } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenConstructorType() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> test </summary> /// <code> test </code> public class TestClass { public TestClass(int n) { } } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> test </summary> /// <code> test </code> public class TestClass { /// <summary> /// /// </summary> /// <param name=""n""> </param> public TestClass(int n) { } } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenPropertyType() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> test </summary> /// <code> test </code> public class TestClass { public int TestProperty { get; set; } } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> test </summary> /// <code> test </code> public class TestClass { /// <summary> /// /// </summary> public int TestProperty { get; set; } } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenPropertyType_WithExceptionInGetter() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> test </summary> /// <code> test </code> public class TestClass { public int TestProperty { get { throw new Exception(""test exception""); } set { throw new ArgumentException(""argument""); } } } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> test </summary> /// <code> test </code> public class TestClass { /// <summary> /// /// </summary> /// <exception cref=""Exception""> </exception> /// <exception cref=""ArgumentException""> </exception> public int TestProperty { get { throw new Exception(""test exception""); } set { throw new ArgumentException(""argument""); } } } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenClassType_WithoutSummary() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <code> test </code> public class TestClass { } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> /// <code> test </code> public class TestClass { } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenClassType_WithoutSummary_WithOneEmptyLine() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <code> test </code> public class TestClass { } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// /// </summary> /// <code> test </code> public class TestClass { } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenClassType_WithoutCode() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// test /// </summary> public class TestClass { } }"; var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { /// <summary> /// test /// </summary> /// <code> /// /// </code> public class TestClass { } }"; VerifyCSharpFix(test, fixtest); } [Test] public void NoCommentFixProvider_Fix_GivenMethodType_WithoutReturns() { var test = @" using System; namespace ConsoleApplication1 { /// <summary> test </summary> /// <code> test </code> public class TestClass { /// <summary> /// test /// </summary> public int test() { return 0; } } }"; var fixtest = @" using System; namespace ConsoleApplication1 { /// <summary> test </summary> /// <code> test </code> public class TestClass { /// <summary> /// test /// </summary> /// <returns> </returns> public int test() { return 0; } } }"; VerifyCSharpFix(test, fixtest); } protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() { return new NoCommentAnalyzer(); } protected override CodeFixProvider GetCSharpCodeFixProvider() { return new NoCommentFixProvider(); } } }
{'content_hash': 'cdf0d8fe5083311b2ee4dceef8b58eeb', 'timestamp': '', 'source': 'github', 'line_count': 717, 'max_line_length': 96, 'avg_line_length': 23.04602510460251, 'alnum_prop': 0.5236625514403292, 'repo_name': 'Minjung-Baek/Dexter', 'id': 'efe3874c497e751db03f0738712aafc858b98c28', 'size': '16526', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'project/dexter-vs/Dexter/Analyzer/Tests/NoCommentFixProviderTest.cs', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'Batchfile', 'bytes': '230'}, {'name': 'C', 'bytes': '160649'}, {'name': 'C#', 'bytes': '368383'}, {'name': 'C++', 'bytes': '934804'}, {'name': 'CSS', 'bytes': '140317'}, {'name': 'EmberScript', 'bytes': '96193'}, {'name': 'HTML', 'bytes': '2858148'}, {'name': 'Java', 'bytes': '1760529'}, {'name': 'JavaScript', 'bytes': '2287560'}, {'name': 'Perl', 'bytes': '4890'}, {'name': 'Python', 'bytes': '9200'}, {'name': 'Ruby', 'bytes': '565'}, {'name': 'Shell', 'bytes': '10474'}]}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="de"> <head> <!-- Generated by javadoc (1.8.0_171) on Tue May 29 11:22:22 CEST 2018 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class com.github.thorbenkuck.netcom2.logging.CallerReflectionLogging (NetCom2 1.1-SNAPSHOT API)</title> <meta name="date" content="2018-05-29"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class com.github.thorbenkuck.netcom2.logging.CallerReflectionLogging (NetCom2 1.1-SNAPSHOT API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../com/github/thorbenkuck/netcom2/logging/CallerReflectionLogging.html" title="class in com.github.thorbenkuck.netcom2.logging">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?com/github/thorbenkuck/netcom2/logging/class-use/CallerReflectionLogging.html" target="_top">Frames</a></li> <li><a href="CallerReflectionLogging.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class com.github.thorbenkuck.netcom2.logging.CallerReflectionLogging" class="title">Uses of Class<br>com.github.thorbenkuck.netcom2.logging.CallerReflectionLogging</h2> </div> <div class="classUseContainer">No usage of com.github.thorbenkuck.netcom2.logging.CallerReflectionLogging</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../com/github/thorbenkuck/netcom2/logging/CallerReflectionLogging.html" title="class in com.github.thorbenkuck.netcom2.logging">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?com/github/thorbenkuck/netcom2/logging/class-use/CallerReflectionLogging.html" target="_top">Frames</a></li> <li><a href="CallerReflectionLogging.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2018. All rights reserved.</small></p> </body> </html>
{'content_hash': '13ada0fed62dd1b50078197e9d4df982', 'timestamp': '', 'source': 'github', 'line_count': 126, 'max_line_length': 187, 'avg_line_length': 38.87301587301587, 'alnum_prop': 0.6284197631686402, 'repo_name': 'ThorbenKuck/NetCom2', 'id': '87b87a4de087dfbb2508612581d810ac3382eeb6', 'size': '4898', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'docs/apidocs/com/github/thorbenkuck/netcom2/logging/class-use/CallerReflectionLogging.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '847328'}]}
#ifndef _O_THEORA_H_ #define _O_THEORA_H_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include <stddef.h> /* for size_t */ /* KITWARE_OGGTHEORA_CHANGE make sure we include the right headers */ #include <vtkoggtheora/include/ogg/ogg.h> /** \file * The libtheora pre-1.0 legacy C API. * * \ingroup oldfuncs * * \section intro Introduction * * This is the documentation for the libtheora legacy C API, declared in * the theora.h header, which describes the old interface used before * the 1.0 release. This API was widely deployed for several years and * remains supported, but for new code we recommend the cleaner API * declared in theoradec.h and theoraenc.h. * * libtheora is the reference implementation for * <a href="http://www.theora.org/">Theora</a>, a free video codec. * Theora is derived from On2's VP3 codec with improved integration with * Ogg multimedia formats by <a href="http://www.xiph.org/">Xiph.Org</a>. * * \section overview Overview * * This library will both decode and encode theora packets to/from raw YUV * frames. In either case, the packets will most likely either come from or * need to be embedded in an Ogg stream. Use * <a href="http://xiph.org/ogg/">libogg</a> or * <a href="http://www.annodex.net/software/liboggz/index.html">liboggz</a> * to extract/package these packets. * * \section decoding Decoding Process * * Decoding can be separated into the following steps: * -# initialise theora_info and theora_comment structures using * theora_info_init() and theora_comment_init(): \verbatim theora_info info; theora_comment comment; theora_info_init(&info); theora_comment_init(&comment); \endverbatim * -# retrieve header packets from Ogg stream (there should be 3) and decode * into theora_info and theora_comment structures using * theora_decode_header(). See \ref identification for more information on * identifying which packets are theora packets. \verbatim int i; for (i = 0; i < 3; i++) { (get a theora packet "op" from the Ogg stream) theora_decode_header(&info, &comment, op); } \endverbatim * -# initialise the decoder based on the information retrieved into the * theora_info struct by theora_decode_header(). You will need a * theora_state struct. \verbatim theora_state state; theora_decode_init(&state, &info); \endverbatim * -# pass in packets and retrieve decoded frames! See the yuv_buffer * documentation for information on how to retrieve raw YUV data. \verbatim yuf_buffer buffer; while (last packet was not e_o_s) { (get a theora packet "op" from the Ogg stream) theora_decode_packetin(&state, op); theora_decode_YUVout(&state, &buffer); } \endverbatim * * * \subsection identification Identifying Theora Packets * * All streams inside an Ogg file have a unique serial_no attached to the * stream. Typically, you will want to * - retrieve the serial_no for each b_o_s (beginning of stream) page * encountered within the Ogg file; * - test the first (only) packet on that page to determine if it is a theora * packet; * - once you have found a theora b_o_s page then use the retrieved serial_no * to identify future packets belonging to the same theora stream. * * Note that you \e cannot use theora_packet_isheader() to determine if a * packet is a theora packet or not, as this function does not perform any * checking beyond whether a header bit is present. Instead, use the * theora_decode_header() function and check the return value; or examine the * header bytes at the beginning of the Ogg page. */ /** \defgroup oldfuncs Legacy pre-1.0 C API */ /* @{ */ /** * A YUV buffer for passing uncompressed frames to and from the codec. * This holds a Y'CbCr frame in planar format. The CbCr planes can be * subsampled and have their own separate dimensions and row stride * offsets. Note that the strides may be negative in some * configurations. For theora the width and height of the largest plane * must be a multiple of 16. The actual meaningful picture size and * offset are stored in the theora_info structure; frames returned by * the decoder may need to be cropped for display. * * All samples are 8 bits. Within each plane samples are ordered by * row from the top of the frame to the bottom. Within each row samples * are ordered from left to right. * * During decode, the yuv_buffer struct is allocated by the user, but all * fields (including luma and chroma pointers) are filled by the library. * These pointers address library-internal memory and their contents should * not be modified. * * Conversely, during encode the user allocates the struct and fills out all * fields. The user also manages the data addressed by the luma and chroma * pointers. See the encoder_example.c and dump_video.c example files in * theora/examples/ for more information. */ typedef struct { int y_width; /**< Width of the Y' luminance plane */ int y_height; /**< Height of the luminance plane */ int y_stride; /**< Offset in bytes between successive rows */ int uv_width; /**< Width of the Cb and Cr chroma planes */ int uv_height; /**< Height of the chroma planes */ int uv_stride; /**< Offset between successive chroma rows */ unsigned char *y; /**< Pointer to start of luminance data */ unsigned char *u; /**< Pointer to start of Cb data */ unsigned char *v; /**< Pointer to start of Cr data */ } yuv_buffer; /** * A Colorspace. */ typedef enum { OC_CS_UNSPECIFIED, /**< The colorspace is unknown or unspecified */ OC_CS_ITU_REC_470M, /**< This is the best option for 'NTSC' content */ OC_CS_ITU_REC_470BG, /**< This is the best option for 'PAL' content */ OC_CS_NSPACES /**< This marks the end of the defined colorspaces */ } theora_colorspace; /** * A Chroma subsampling * * These enumerate the available chroma subsampling options supported * by the theora format. See Section 4.4 of the specification for * exact definitions. */ typedef enum { OC_PF_420, /**< Chroma subsampling by 2 in each direction (4:2:0) */ OC_PF_RSVD, /**< Reserved value */ OC_PF_422, /**< Horizonatal chroma subsampling by 2 (4:2:2) */ OC_PF_444, /**< No chroma subsampling at all (4:4:4) */ } theora_pixelformat; /** * Theora bitstream info. * Contains the basic playback parameters for a stream, * corresponding to the initial 'info' header packet. * * Encoded theora frames must be a multiple of 16 in width and height. * To handle other frame sizes, a crop rectangle is specified in * frame_height and frame_width, offset_x and * offset_y. The offset * and size should still be a multiple of 2 to avoid chroma sampling * shifts. Offset values in this structure are measured from the * upper left of the image. * * Frame rate, in frames per second, is stored as a rational * fraction. Aspect ratio is also stored as a rational fraction, and * refers to the aspect ratio of the frame pixels, not of the * overall frame itself. * * See <a href="http://svn.xiph.org/trunk/theora/examples/encoder_example.c"> * examples/encoder_example.c</a> for usage examples of the * other parameters and good default settings for the encoder parameters. */ typedef struct { ogg_uint32_t width; /**< encoded frame width */ ogg_uint32_t height; /**< encoded frame height */ ogg_uint32_t frame_width; /**< display frame width */ ogg_uint32_t frame_height; /**< display frame height */ ogg_uint32_t offset_x; /**< horizontal offset of the displayed frame */ ogg_uint32_t offset_y; /**< vertical offset of the displayed frame */ ogg_uint32_t fps_numerator; /**< frame rate numerator **/ ogg_uint32_t fps_denominator; /**< frame rate denominator **/ ogg_uint32_t aspect_numerator; /**< pixel aspect ratio numerator */ ogg_uint32_t aspect_denominator; /**< pixel aspect ratio denominator */ theora_colorspace colorspace; /**< colorspace */ int target_bitrate; /**< nominal bitrate in bits per second */ int quality; /**< Nominal quality setting, 0-63 */ int quick_p; /**< Quick encode/decode */ /* decode only */ unsigned char version_major; unsigned char version_minor; unsigned char version_subminor; void *codec_setup; /* encode only */ int dropframes_p; int keyframe_auto_p; ogg_uint32_t keyframe_frequency; ogg_uint32_t keyframe_frequency_force; /* also used for decode init to get granpos shift correct */ ogg_uint32_t keyframe_data_target_bitrate; ogg_int32_t keyframe_auto_threshold; ogg_uint32_t keyframe_mindistance; ogg_int32_t noise_sensitivity; ogg_int32_t sharpness; theora_pixelformat pixelformat; /**< chroma subsampling mode to expect */ } theora_info; /** Codec internal state and context. */ typedef struct{ theora_info *i; ogg_int64_t granulepos; void *internal_encode; void *internal_decode; } theora_state; /** * Comment header metadata. * * This structure holds the in-stream metadata corresponding to * the 'comment' header packet. * * Meta data is stored as a series of (tag, value) pairs, in * length-encoded string vectors. The first occurence of the * '=' character delimits the tag and value. A particular tag * may occur more than once. The character set encoding for * the strings is always UTF-8, but the tag names are limited * to case-insensitive ASCII. See the spec for details. * * In filling in this structure, theora_decode_header() will * null-terminate the user_comment strings for safety. However, * the bitstream format itself treats them as 8-bit clean, * and so the length array should be treated as authoritative * for their length. */ typedef struct theora_comment{ char **user_comments; /**< An array of comment string vectors */ int *comment_lengths; /**< An array of corresponding string vector lengths in bytes */ int comments; /**< The total number of comment string vectors */ char *vendor; /**< The vendor string identifying the encoder, null terminated */ } theora_comment; /**\name theora_control() codes */ /* \anchor decctlcodes_old * These are the available request codes for theora_control() * when called with a decoder instance. * By convention decoder control codes are odd, to distinguish * them from \ref encctlcodes_old "encoder control codes" which * are even. * * Note that since the 1.0 release, both the legacy and the final * implementation accept all the same control codes, but only the * final API declares the newer codes. * * Keep any experimental or vendor-specific values above \c 0x8000.*/ /*@{*/ /**Get the maximum post-processing level. * The decoder supports a post-processing filter that can improve * the appearance of the decoded images. This returns the highest * level setting for this post-processor, corresponding to maximum * improvement and computational expense. */ #define TH_DECCTL_GET_PPLEVEL_MAX (1) /**Set the post-processing level. * Sets the level of post-processing to use when decoding the * compressed stream. This must be a value between zero (off) * and the maximum returned by TH_DECCTL_GET_PPLEVEL_MAX. */ #define TH_DECCTL_SET_PPLEVEL (3) /**Sets the maximum distance between key frames. * This can be changed during an encode, but will be bounded by * <tt>1<<th_info#keyframe_granule_shift</tt>. * If it is set before encoding begins, th_info#keyframe_granule_shift will * be enlarged appropriately. * * \param[in] buf <tt>ogg_uint32_t</tt>: The maximum distance between key * frames. * \param[out] buf <tt>ogg_uint32_t</tt>: The actual maximum distance set. * \retval OC_FAULT \a theora_state or \a buf is <tt>NULL</tt>. * \retval OC_EINVAL \a buf_sz is not <tt>sizeof(ogg_uint32_t)</tt>. * \retval OC_IMPL Not supported by this implementation.*/ #define TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE (4) /**Set the granule position. * Call this after a seek, to update the internal granulepos * in the decoder, to insure that subsequent frames are marked * properly. If you track timestamps yourself and do not use * the granule postion returned by the decoder, then you do * not need to use this control. */ #define TH_DECCTL_SET_GRANPOS (5) /**\anchor encctlcodes_old */ /**Sets the quantization parameters to use. * The parameters are copied, not stored by reference, so they can be freed * after this call. * <tt>NULL</tt> may be specified to revert to the default parameters. * * \param[in] buf #th_quant_info * \retval OC_FAULT \a theora_state is <tt>NULL</tt>. * \retval OC_EINVAL Encoding has already begun, the quantization parameters * are not acceptable to this version of the encoder, * \a buf is <tt>NULL</tt> and \a buf_sz is not zero, * or \a buf is non-<tt>NULL</tt> and \a buf_sz is * not <tt>sizeof(#th_quant_info)</tt>. * \retval OC_IMPL Not supported by this implementation.*/ #define TH_ENCCTL_SET_QUANT_PARAMS (2) /**Disables any encoder features that would prevent lossless transcoding back * to VP3. * This primarily means disabling block-level QI values and not using 4MV mode * when any of the luma blocks in a macro block are not coded. * It also includes using the VP3 quantization tables and Huffman codes; if you * set them explicitly after calling this function, the resulting stream will * not be VP3-compatible. * If you enable VP3-compatibility when encoding 4:2:2 or 4:4:4 source * material, or when using a picture region smaller than the full frame (e.g. * a non-multiple-of-16 width or height), then non-VP3 bitstream features will * still be disabled, but the stream will still not be VP3-compatible, as VP3 * was not capable of encoding such formats. * If you call this after encoding has already begun, then the quantization * tables and codebooks cannot be changed, but the frame-level features will * be enabled or disabled as requested. * * \param[in] buf <tt>int</tt>: a non-zero value to enable VP3 compatibility, * or 0 to disable it (the default). * \param[out] buf <tt>int</tt>: 1 if all bitstream features required for * VP3-compatibility could be set, and 0 otherwise. * The latter will be returned if the pixel format is not * 4:2:0, the picture region is smaller than the full frame, * or if encoding has begun, preventing the quantization * tables and codebooks from being set. * \retval OC_FAULT \a theora_state or \a buf is <tt>NULL</tt>. * \retval OC_EINVAL \a buf_sz is not <tt>sizeof(int)</tt>. * \retval OC_IMPL Not supported by this implementation.*/ #define TH_ENCCTL_SET_VP3_COMPATIBLE (10) /**Gets the maximum speed level. * Higher speed levels favor quicker encoding over better quality per bit. * Depending on the encoding mode, and the internal algorithms used, quality * may actually improve, but in this case bitrate will also likely increase. * In any case, overall rate/distortion performance will probably decrease. * The maximum value, and the meaning of each value, may change depending on * the current encoding mode (VBR vs. CQI, etc.). * * \param[out] buf int: The maximum encoding speed level. * \retval OC_FAULT \a theora_state or \a buf is <tt>NULL</tt>. * \retval OC_EINVAL \a buf_sz is not <tt>sizeof(int)</tt>. * \retval OC_IMPL Not supported by this implementation in the current * encoding mode.*/ #define TH_ENCCTL_GET_SPLEVEL_MAX (12) /**Sets the speed level. * By default a speed value of 1 is used. * * \param[in] buf int: The new encoding speed level. * 0 is slowest, larger values use less CPU. * \retval OC_FAULT \a theora_state or \a buf is <tt>NULL</tt>. * \retval OC_EINVAL \a buf_sz is not <tt>sizeof(int)</tt>, or the * encoding speed level is out of bounds. * The maximum encoding speed level may be * implementation- and encoding mode-specific, and can be * obtained via #TH_ENCCTL_GET_SPLEVEL_MAX. * \retval OC_IMPL Not supported by this implementation in the current * encoding mode.*/ #define TH_ENCCTL_SET_SPLEVEL (14) /*@}*/ #define OC_FAULT -1 /**< General failure */ #define OC_EINVAL -10 /**< Library encountered invalid internal data */ #define OC_DISABLED -11 /**< Requested action is disabled */ #define OC_BADHEADER -20 /**< Header packet was corrupt/invalid */ #define OC_NOTFORMAT -21 /**< Packet is not a theora packet */ #define OC_VERSION -22 /**< Bitstream version is not handled */ #define OC_IMPL -23 /**< Feature or action not implemented */ #define OC_BADPACKET -24 /**< Packet is corrupt */ #define OC_NEWPACKET -25 /**< Packet is an (ignorable) unhandled extension */ #define OC_DUPFRAME 1 /**< Packet is a dropped frame */ /** * Retrieve a human-readable string to identify the encoder vendor and version. * \returns A version string. */ extern const char *theora_version_string(void); /** * Retrieve a 32-bit version number. * This number is composed of a 16-bit major version, 8-bit minor version * and 8 bit sub-version, composed as follows: <pre> (VERSION_MAJOR<<16) + (VERSION_MINOR<<8) + (VERSION_SUB) </pre> * \returns The version number. */ extern ogg_uint32_t theora_version_number(void); /** * Initialize the theora encoder. * \param th The theora_state handle to initialize for encoding. * \param ti A theora_info struct filled with the desired encoding parameters. * \retval 0 Success */ extern int theora_encode_init(theora_state *th, theora_info *ti); /** * Submit a YUV buffer to the theora encoder. * \param t A theora_state handle previously initialized for encoding. * \param yuv A buffer of YUV data to encode. Note that both the yuv_buffer * struct and the luma/chroma buffers within should be allocated by * the user. * \retval OC_EINVAL Encoder is not ready, or is finished. * \retval -1 The size of the given frame differs from those previously input * \retval 0 Success */ extern int theora_encode_YUVin(theora_state *t, yuv_buffer *yuv); /** * Request the next packet of encoded video. * The encoded data is placed in a user-provided ogg_packet structure. * \param t A theora_state handle previously initialized for encoding. * \param last_p whether this is the last packet the encoder should produce. * \param op An ogg_packet structure to fill. libtheora will set all * elements of this structure, including a pointer to encoded * data. The memory for the encoded data is owned by libtheora. * \retval 0 No internal storage exists OR no packet is ready * \retval -1 The encoding process has completed * \retval 1 Success */ extern int theora_encode_packetout( theora_state *t, int last_p, ogg_packet *op); /** * Request a packet containing the initial header. * A pointer to the header data is placed in a user-provided ogg_packet * structure. * \param t A theora_state handle previously initialized for encoding. * \param op An ogg_packet structure to fill. libtheora will set all * elements of this structure, including a pointer to the header * data. The memory for the header data is owned by libtheora. * \retval 0 Success */ extern int theora_encode_header(theora_state *t, ogg_packet *op); /** * Request a comment header packet from provided metadata. * A pointer to the comment data is placed in a user-provided ogg_packet * structure. * \param tc A theora_comment structure filled with the desired metadata * \param op An ogg_packet structure to fill. libtheora will set all * elements of this structure, including a pointer to the encoded * comment data. The memory for the comment data is owned by * libtheora. * \retval 0 Success */ extern int theora_encode_comment(theora_comment *tc, ogg_packet *op); /** * Request a packet containing the codebook tables for the stream. * A pointer to the codebook data is placed in a user-provided ogg_packet * structure. * \param t A theora_state handle previously initialized for encoding. * \param op An ogg_packet structure to fill. libtheora will set all * elements of this structure, including a pointer to the codebook * data. The memory for the header data is owned by libtheora. * \retval 0 Success */ extern int theora_encode_tables(theora_state *t, ogg_packet *op); /** * Decode an Ogg packet, with the expectation that the packet contains * an initial header, comment data or codebook tables. * * \param ci A theora_info structure to fill. This must have been previously * initialized with theora_info_init(). If \a op contains an initial * header, theora_decode_header() will fill \a ci with the * parsed header values. If \a op contains codebook tables, * theora_decode_header() will parse these and attach an internal * representation to \a ci->codec_setup. * \param cc A theora_comment structure to fill. If \a op contains comment * data, theora_decode_header() will fill \a cc with the parsed * comments. * \param op An ogg_packet structure which you expect contains an initial * header, comment data or codebook tables. * * \retval OC_BADHEADER \a op is NULL; OR the first byte of \a op->packet * has the signature of an initial packet, but op is * not a b_o_s packet; OR this packet has the signature * of an initial header packet, but an initial header * packet has already been seen; OR this packet has the * signature of a comment packet, but the initial header * has not yet been seen; OR this packet has the signature * of a comment packet, but contains invalid data; OR * this packet has the signature of codebook tables, * but the initial header or comments have not yet * been seen; OR this packet has the signature of codebook * tables, but contains invalid data; * OR the stream being decoded has a compatible version * but this packet does not have the signature of a * theora initial header, comments, or codebook packet * \retval OC_VERSION The packet data of \a op is an initial header with * a version which is incompatible with this version of * libtheora. * \retval OC_NEWPACKET the stream being decoded has an incompatible (future) * version and contains an unknown signature. * \retval 0 Success * * \note The normal usage is that theora_decode_header() be called on the * first three packets of a theora logical bitstream in succession. */ extern int theora_decode_header(theora_info *ci, theora_comment *cc, ogg_packet *op); /** * Initialize a theora_state handle for decoding. * \param th The theora_state handle to initialize. * \param c A theora_info struct filled with the desired decoding parameters. * This is of course usually obtained from a previous call to * theora_decode_header(). * \retval 0 Success */ extern int theora_decode_init(theora_state *th, theora_info *c); /** * Input a packet containing encoded data into the theora decoder. * \param th A theora_state handle previously initialized for decoding. * \param op An ogg_packet containing encoded theora data. * \retval 0 Success * \retval OC_BADPACKET \a op does not contain encoded video data */ extern int theora_decode_packetin(theora_state *th,ogg_packet *op); /** * Output the next available frame of decoded YUV data. * \param th A theora_state handle previously initialized for decoding. * \param yuv A yuv_buffer in which libtheora should place the decoded data. * Note that the buffer struct itself is allocated by the user, but * that the luma and chroma pointers will be filled in by the * library. Also note that these luma and chroma regions should be * considered read-only by the user. * \retval 0 Success */ extern int theora_decode_YUVout(theora_state *th,yuv_buffer *yuv); /** * Report whether a theora packet is a header or not * This function does no verification beyond checking the header * flag bit so it should not be used for bitstream identification; * use theora_decode_header() for that. * * \param op An ogg_packet containing encoded theora data. * \retval 1 The packet is a header packet * \retval 0 The packet is not a header packet (and so contains frame data) * * Thus function was added in the 1.0alpha4 release. */ extern int theora_packet_isheader(ogg_packet *op); /** * Report whether a theora packet is a keyframe or not * * \param op An ogg_packet containing encoded theora data. * \retval 1 The packet contains a keyframe image * \retval 0 The packet is contains an interframe delta * \retval -1 The packet is not an image data packet at all * * Thus function was added in the 1.0alpha4 release. */ extern int theora_packet_iskeyframe(ogg_packet *op); /** * Report the granulepos shift radix * * When embedded in Ogg, Theora uses a two-part granulepos, * splitting the 64-bit field into two pieces. The more-significant * section represents the frame count at the last keyframe, * and the less-significant section represents the count of * frames since the last keyframe. In this way the overall * field is still non-decreasing with time, but usefuly encodes * a pointer to the last keyframe, which is necessary for * correctly restarting decode after a seek. * * This function reports the number of bits used to represent * the distance to the last keyframe, and thus how the granulepos * field must be shifted or masked to obtain the two parts. * * Since libtheora returns compressed data in an ogg_packet * structure, this may be generally useful even if the Theora * packets are not being used in an Ogg container. * * \param ti A previously initialized theora_info struct * \returns The bit shift dividing the two granulepos fields * * This function was added in the 1.0alpha5 release. */ int theora_granule_shift(theora_info *ti); /** * Convert a granulepos to an absolute frame index, starting at 0. * The granulepos is interpreted in the context of a given theora_state handle. * * Note that while the granulepos encodes the frame count (i.e. starting * from 1) this call returns the frame index, starting from zero. Thus * One can calculate the presentation time by multiplying the index by * the rate. * * \param th A previously initialized theora_state handle (encode or decode) * \param granulepos The granulepos to convert. * \returns The frame index corresponding to \a granulepos. * \retval -1 The given granulepos is undefined (i.e. negative) * * Thus function was added in the 1.0alpha4 release. */ extern ogg_int64_t theora_granule_frame(theora_state *th,ogg_int64_t granulepos); /** * Convert a granulepos to absolute time in seconds. The granulepos is * interpreted in the context of a given theora_state handle, and gives * the end time of a frame's presentation as used in Ogg mux ordering. * * \param th A previously initialized theora_state handle (encode or decode) * \param granulepos The granulepos to convert. * \returns The absolute time in seconds corresponding to \a granulepos. * This is the "end time" for the frame, or the latest time it should * be displayed. * It is not the presentation time. * \retval -1. The given granulepos is undefined (i.e. negative), or * \retval -1. The function has been disabled because floating * point support is not available. */ extern double theora_granule_time(theora_state *th,ogg_int64_t granulepos); /** * Initialize a theora_info structure. All values within the given theora_info * structure are initialized, and space is allocated within libtheora for * internal codec setup data. * \param c A theora_info struct to initialize. */ extern void theora_info_init(theora_info *c); /** * Clear a theora_info structure. All values within the given theora_info * structure are cleared, and associated internal codec setup data is freed. * \param c A theora_info struct to initialize. */ extern void theora_info_clear(theora_info *c); /** * Free all internal data associated with a theora_state handle. * \param t A theora_state handle. */ extern void theora_clear(theora_state *t); /** * Initialize an allocated theora_comment structure * \param tc An allocated theora_comment structure **/ extern void theora_comment_init(theora_comment *tc); /** * Add a comment to an initialized theora_comment structure * \param tc A previously initialized theora comment structure * \param comment A null-terminated string encoding the comment in the form * "TAG=the value" * * Neither theora_comment_add() nor theora_comment_add_tag() support * comments containing null values, although the bitstream format * supports this. To add such comments you will need to manipulate * the theora_comment structure directly. **/ extern void theora_comment_add(theora_comment *tc, char *comment); /** * Add a comment to an initialized theora_comment structure. * \param tc A previously initialized theora comment structure * \param tag A null-terminated string containing the tag * associated with the comment. * \param value The corresponding value as a null-terminated string * * Neither theora_comment_add() nor theora_comment_add_tag() support * comments containing null values, although the bitstream format * supports this. To add such comments you will need to manipulate * the theora_comment structure directly. **/ extern void theora_comment_add_tag(theora_comment *tc, char *tag, char *value); /** * Look up a comment value by tag. * \param tc Tn initialized theora_comment structure * \param tag The tag to look up * \param count The instance of the tag. The same tag can appear multiple * times, each with a distinct and ordered value, so an index * is required to retrieve them all. * \returns A pointer to the queried tag's value * \retval NULL No matching tag is found * * \note Use theora_comment_query_count() to get the legal range for the * count parameter. **/ extern char *theora_comment_query(theora_comment *tc, char *tag, int count); /** Look up the number of instances of a tag. * \param tc An initialized theora_comment structure * \param tag The tag to look up * \returns The number on instances of a particular tag. * * Call this first when querying for a specific tag and then interate * over the number of instances with separate calls to * theora_comment_query() to retrieve all instances in order. **/ extern int theora_comment_query_count(theora_comment *tc, char *tag); /** * Clear an allocated theora_comment struct so that it can be freed. * \param tc An allocated theora_comment structure. **/ extern void theora_comment_clear(theora_comment *tc); /**Encoder control function. * This is used to provide advanced control the encoding process. * \param th A #theora_state handle. * \param req The control code to process. * See \ref encctlcodes_old "the list of available * control codes" for details. * \param buf The parameters for this control code. * \param buf_sz The size of the parameter buffer.*/ extern int theora_control(theora_state *th,int req,void *buf,size_t buf_sz); /* @} */ /* end oldfuncs doxygen group */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _O_THEORA_H_ */
{'content_hash': '27a9ee27be96c2904c9fb88b0aa1036b', 'timestamp': '', 'source': 'github', 'line_count': 770, 'max_line_length': 98, 'avg_line_length': 43.1974025974026, 'alnum_prop': 0.6765077265347844, 'repo_name': 'hlzz/dotfiles', 'id': '810f14afc37ebaf587f7ff726082f3b6abf1712f', 'size': '34146', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'graphics/VTK-7.0.0/ThirdParty/oggtheora/vtkoggtheora/libtheora-1.1.1/include/theora/theora.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'AppleScript', 'bytes': '1240'}, {'name': 'Arc', 'bytes': '38'}, {'name': 'Assembly', 'bytes': '449468'}, {'name': 'Batchfile', 'bytes': '16152'}, {'name': 'C', 'bytes': '102303195'}, {'name': 'C++', 'bytes': '155056606'}, {'name': 'CMake', 'bytes': '7200627'}, {'name': 'CSS', 'bytes': '179330'}, {'name': 'Cuda', 'bytes': '30026'}, {'name': 'D', 'bytes': '2152'}, {'name': 'Emacs Lisp', 'bytes': '14892'}, {'name': 'FORTRAN', 'bytes': '5276'}, {'name': 'Forth', 'bytes': '3637'}, {'name': 'GAP', 'bytes': '14495'}, {'name': 'GLSL', 'bytes': '438205'}, {'name': 'Gnuplot', 'bytes': '327'}, {'name': 'Groff', 'bytes': '518260'}, {'name': 'HLSL', 'bytes': '965'}, {'name': 'HTML', 'bytes': '2003175'}, {'name': 'Haskell', 'bytes': '10370'}, {'name': 'IDL', 'bytes': '2466'}, {'name': 'Java', 'bytes': '219109'}, {'name': 'JavaScript', 'bytes': '1618007'}, {'name': 'Lex', 'bytes': '119058'}, {'name': 'Lua', 'bytes': '23167'}, {'name': 'M', 'bytes': '1080'}, {'name': 'M4', 'bytes': '292475'}, {'name': 'Makefile', 'bytes': '7112810'}, {'name': 'Matlab', 'bytes': '1582'}, {'name': 'NSIS', 'bytes': '34176'}, {'name': 'Objective-C', 'bytes': '65312'}, {'name': 'Objective-C++', 'bytes': '269995'}, {'name': 'PAWN', 'bytes': '4107117'}, {'name': 'PHP', 'bytes': '2690'}, {'name': 'Pascal', 'bytes': '5054'}, {'name': 'Perl', 'bytes': '485508'}, {'name': 'Pike', 'bytes': '1338'}, {'name': 'Prolog', 'bytes': '5284'}, {'name': 'Python', 'bytes': '16799659'}, {'name': 'QMake', 'bytes': '89858'}, {'name': 'Rebol', 'bytes': '291'}, {'name': 'Ruby', 'bytes': '21590'}, {'name': 'Scilab', 'bytes': '120244'}, {'name': 'Shell', 'bytes': '2266191'}, {'name': 'Slash', 'bytes': '1536'}, {'name': 'Smarty', 'bytes': '1368'}, {'name': 'Swift', 'bytes': '331'}, {'name': 'Tcl', 'bytes': '1911873'}, {'name': 'TeX', 'bytes': '11981'}, {'name': 'Verilog', 'bytes': '3893'}, {'name': 'VimL', 'bytes': '595114'}, {'name': 'XSLT', 'bytes': '62675'}, {'name': 'Yacc', 'bytes': '307000'}, {'name': 'eC', 'bytes': '366863'}]}
import { Component } from '@angular/core'; @Component({ templateUrl: 'components.inputs.stacked-labels.html' }) export class ComponentsInputsStackedLabelsPage { }
{'content_hash': 'f0aba5d321fe10b591bbc5716bafd513', 'timestamp': '', 'source': 'github', 'line_count': 9, 'max_line_length': 54, 'avg_line_length': 18.666666666666668, 'alnum_prop': 0.7559523809523809, 'repo_name': 'Arkord/runcanrol', 'id': '0f50b56ef9582448691fdb59a10e161bb47bc452', 'size': '168', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/pages/components/inputs/stacked-labels/components.inputs.stacked-labels.page.ts', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '16826'}, {'name': 'HTML', 'bytes': '61782'}, {'name': 'JavaScript', 'bytes': '6385'}, {'name': 'TypeScript', 'bytes': '110014'}]}
set -eu # Get pip version number PIPVER=`pip --version | awk '{print $2}'` ARGS="" echo "peep.sh: Using pip $PIPVER" # Add pip arguments that vary according to the version of pip, here: case $PIPVER in 1.5*|6.*) # Pip uses the wheel format packages by default in pip 1.5+. # However in pip < 6.0+ wheel support is broken, and even with pip 6.0+ # we intentionally don't use the wheel packages, since otherwise each # package in the requirements files would need multiple hashes. echo "peep.sh: Wheel-using pip detected, so passing --no-use-wheel." ARGS="$ARGS --no-use-wheel" ;; 7.*) echo "peep.sh: Binary-using pip detected, so passing --no-binary=:all:" ARGS="$ARGS --no-binary=:all:" ;; 1.*) # A version of pip that won't automatically use wheels. ;; *) echo "peep.sh: Unrecognized version of pip: $PIPVER". echo "peep.sh: I don't know what to do about that." echo "peep.sh: Maybe try to install pip 7?" echo "peep.sh: \"pip install -U 'pip==7'\"" exit 1 ;; esac # Add the version specific arguments to those passed on the command line. python ./scripts/peep.py "$@" $ARGS echo "peep.sh: Done!"
{'content_hash': 'e3eda052af498ef6f7a808bf3e50a80d', 'timestamp': '', 'source': 'github', 'line_count': 38, 'max_line_length': 79, 'avg_line_length': 33.23684210526316, 'alnum_prop': 0.6088677751385589, 'repo_name': 'mythmon/kitsune', 'id': '687691f4c6fd00aa6ffe96549fd77b0a8310c7e5', 'size': '1276', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'peep.sh', 'mode': '33261', 'license': 'bsd-3-clause', 'language': [{'name': 'ApacheConf', 'bytes': '2694'}, {'name': 'CSS', 'bytes': '281386'}, {'name': 'HTML', 'bytes': '624493'}, {'name': 'JavaScript', 'bytes': '750034'}, {'name': 'Python', 'bytes': '2721930'}, {'name': 'Shell', 'bytes': '10281'}, {'name': 'Smarty', 'bytes': '2062'}]}