text stringlengths 2 1.04M | meta dict |
|---|---|
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_exception
from nssrc.com.citrix.netscaler.nitro.util.nitro_util import nitro_util
class gslbvserver_gslbservice_binding(base_resource) :
""" Binding class showing the gslbservice that can be bound to gslbvserver.
"""
def __init__(self) :
self._servicename = ""
self._weight = 0
self._cnameentry = ""
self._ipaddress = ""
self._port = 0
self._gslbboundsvctype = ""
self._curstate = ""
self._dynamicconfwt = 0
self._cumulativeweight = 0
self._svreffgslbstate = ""
self._gslbthreshold = 0
self._preferredlocation = ""
self._thresholdvalue = 0
self._iscname = ""
self._domainname = ""
self._sitepersistcookie = ""
self._svcsitepersistence = ""
self._name = ""
self.___count = 0
@property
def weight(self) :
ur"""Weight to assign to the GSLB service.<br/>Minimum value = 1<br/>Maximum value = 100.
"""
try :
return self._weight
except Exception as e:
raise e
@weight.setter
def weight(self, weight) :
ur"""Weight to assign to the GSLB service.<br/>Minimum value = 1<br/>Maximum value = 100
"""
try :
self._weight = weight
except Exception as e:
raise e
@property
def name(self) :
ur"""Name of the virtual server on which to perform the binding operation.<br/>Minimum length = 1.
"""
try :
return self._name
except Exception as e:
raise e
@name.setter
def name(self, name) :
ur"""Name of the virtual server on which to perform the binding operation.<br/>Minimum length = 1
"""
try :
self._name = name
except Exception as e:
raise e
@property
def servicename(self) :
ur"""Name of the GSLB service for which to change the weight.<br/>Minimum length = 1.
"""
try :
return self._servicename
except Exception as e:
raise e
@servicename.setter
def servicename(self, servicename) :
ur"""Name of the GSLB service for which to change the weight.<br/>Minimum length = 1
"""
try :
self._servicename = servicename
except Exception as e:
raise e
@property
def domainname(self) :
ur"""Domain name for which to change the time to live (TTL) and/or backup service IP address.<br/>Minimum length = 1.
"""
try :
return self._domainname
except Exception as e:
raise e
@domainname.setter
def domainname(self, domainname) :
ur"""Domain name for which to change the time to live (TTL) and/or backup service IP address.<br/>Minimum length = 1
"""
try :
self._domainname = domainname
except Exception as e:
raise e
@property
def cnameentry(self) :
ur"""The cname of the gslb service.
"""
try :
return self._cnameentry
except Exception as e:
raise e
@property
def svcsitepersistence(self) :
ur"""Type of Site Persistence set on the bound service.<br/>Possible values = ConnectionProxy, HTTPRedirect, NONE.
"""
try :
return self._svcsitepersistence
except Exception as e:
raise e
@property
def gslbboundsvctype(self) :
ur"""Protocol used by services bound to the GSLBvirtual server.<br/>Possible values = HTTP, FTP, TCP, UDP, SSL, SSL_BRIDGE, SSL_TCP, NNTP, ANY, SIP_UDP, RADIUS, RDP, RTSP, MYSQL, MSSQL, ORACLE.
"""
try :
return self._gslbboundsvctype
except Exception as e:
raise e
@property
def preferredlocation(self) :
ur"""The target site to be returned in the DNS response when a policy is successfully evaluated against the incoming DNS request. Target site is specified in dotted notation with up to 6 qualifiers. Wildcard `*' is accepted as a valid qualifier token.
"""
try :
return self._preferredlocation
except Exception as e:
raise e
@property
def dynamicconfwt(self) :
ur"""Weight obtained by the virtue of bound service count or weight.
"""
try :
return self._dynamicconfwt
except Exception as e:
raise e
@property
def cumulativeweight(self) :
ur"""Cumulative weight is the weight of GSLB service considering both its configured weight and dynamic weight. It is equal to product of dynamic weight and configured weight of the gslb service .
"""
try :
return self._cumulativeweight
except Exception as e:
raise e
@property
def gslbthreshold(self) :
ur"""Indicates if gslb svc has reached threshold.
"""
try :
return self._gslbthreshold
except Exception as e:
raise e
@property
def sitepersistcookie(self) :
ur"""This field is introduced for displaying the cookie in cluster setup.<br/>Minimum length = 1.
"""
try :
return self._sitepersistcookie
except Exception as e:
raise e
@property
def port(self) :
ur"""Port number.<br/>Range 1 - 65535.
"""
try :
return self._port
except Exception as e:
raise e
@property
def iscname(self) :
ur"""is cname feature set on vserver.<br/>Possible values = ENABLED, DISABLED.
"""
try :
return self._iscname
except Exception as e:
raise e
@property
def curstate(self) :
ur"""State of the gslb vserver.<br/>Possible values = UP, DOWN, UNKNOWN, BUSY, OUT OF SERVICE, GOING OUT OF SERVICE, DOWN WHEN GOING OUT OF SERVICE, NS_EMPTY_STR, Unknown, DISABLED.
"""
try :
return self._curstate
except Exception as e:
raise e
@property
def svreffgslbstate(self) :
ur"""Effective state of the gslb svc.<br/>Possible values = UP, DOWN, UNKNOWN, BUSY, OUT OF SERVICE, GOING OUT OF SERVICE, DOWN WHEN GOING OUT OF SERVICE, NS_EMPTY_STR, Unknown, DISABLED.
"""
try :
return self._svreffgslbstate
except Exception as e:
raise e
@property
def thresholdvalue(self) :
ur"""Tells whether threshold exceeded for this service participating in CUSTOMLB.
"""
try :
return self._thresholdvalue
except Exception as e:
raise e
@property
def ipaddress(self) :
ur"""IP address.
"""
try :
return self._ipaddress
except Exception as e:
raise e
def _get_nitro_response(self, service, response) :
ur""" converts nitro response into object and returns the object array in case of get request.
"""
try :
result = service.payload_formatter.string_to_resource(gslbvserver_gslbservice_binding_response, response, self.__class__.__name__)
if(result.errorcode != 0) :
if (result.errorcode == 444) :
service.clear_session(self)
if result.severity :
if (result.severity == "ERROR") :
raise nitro_exception(result.errorcode, str(result.message), str(result.severity))
else :
raise nitro_exception(result.errorcode, str(result.message), str(result.severity))
return result.gslbvserver_gslbservice_binding
except Exception as e :
raise e
def _get_object_name(self) :
ur""" Returns the value of object identifier argument
"""
try :
if self.name is not None :
return str(self.name)
return None
except Exception as e :
raise e
@classmethod
def add(cls, client, resource) :
try :
if resource and type(resource) is not list :
updateresource = gslbvserver_gslbservice_binding()
updateresource.name = resource.name
updateresource.servicename = resource.servicename
updateresource.weight = resource.weight
updateresource.domainname = resource.domainname
return updateresource.update_resource(client)
else :
if resource and len(resource) > 0 :
updateresources = [gslbvserver_gslbservice_binding() for _ in range(len(resource))]
for i in range(len(resource)) :
updateresources[i].name = resource[i].name
updateresources[i].servicename = resource[i].servicename
updateresources[i].weight = resource[i].weight
updateresources[i].domainname = resource[i].domainname
return cls.update_bulk_request(client, updateresources)
except Exception as e :
raise e
@classmethod
def delete(cls, client, resource) :
try :
if resource and type(resource) is not list :
deleteresource = gslbvserver_gslbservice_binding()
deleteresource.name = resource.name
deleteresource.servicename = resource.servicename
deleteresource.domainname = resource.domainname
return deleteresource.delete_resource(client)
else :
if resource and len(resource) > 0 :
deleteresources = [gslbvserver_gslbservice_binding() for _ in range(len(resource))]
for i in range(len(resource)) :
deleteresources[i].name = resource[i].name
deleteresources[i].servicename = resource[i].servicename
deleteresources[i].domainname = resource[i].domainname
return cls.delete_bulk_request(client, deleteresources)
except Exception as e :
raise e
@classmethod
def get(cls, service, name) :
ur""" Use this API to fetch gslbvserver_gslbservice_binding resources.
"""
try :
obj = gslbvserver_gslbservice_binding()
obj.name = name
response = obj.get_resources(service)
return response
except Exception as e:
raise e
@classmethod
def get_filtered(cls, service, name, filter_) :
ur""" Use this API to fetch filtered set of gslbvserver_gslbservice_binding resources.
Filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
"""
try :
obj = gslbvserver_gslbservice_binding()
obj.name = name
option_ = options()
option_.filter = filter_
response = obj.getfiltered(service, option_)
return response
except Exception as e:
raise e
@classmethod
def count(cls, service, name) :
ur""" Use this API to count gslbvserver_gslbservice_binding resources configued on NetScaler.
"""
try :
obj = gslbvserver_gslbservice_binding()
obj.name = name
option_ = options()
option_.count = True
response = obj.get_resources(service, option_)
if response :
return response[0].__dict__['___count']
return 0
except Exception as e:
raise e
@classmethod
def count_filtered(cls, service, name, filter_) :
ur""" Use this API to count the filtered set of gslbvserver_gslbservice_binding resources.
Filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
"""
try :
obj = gslbvserver_gslbservice_binding()
obj.name = name
option_ = options()
option_.count = True
option_.filter = filter_
response = obj.getfiltered(service, option_)
if response :
return response[0].__dict__['___count']
return 0
except Exception as e:
raise e
class Svcsitepersistence:
ConnectionProxy = "ConnectionProxy"
HTTPRedirect = "HTTPRedirect"
NONE = "NONE"
class Svreffgslbstate:
UP = "UP"
DOWN = "DOWN"
UNKNOWN = "UNKNOWN"
BUSY = "BUSY"
OUT_OF_SERVICE = "OUT OF SERVICE"
GOING_OUT_OF_SERVICE = "GOING OUT OF SERVICE"
DOWN_WHEN_GOING_OUT_OF_SERVICE = "DOWN WHEN GOING OUT OF SERVICE"
NS_EMPTY_STR = "NS_EMPTY_STR"
Unknown = "Unknown"
DISABLED = "DISABLED"
class Type:
REQUEST = "REQUEST"
RESPONSE = "RESPONSE"
class Gslbboundsvctype:
HTTP = "HTTP"
FTP = "FTP"
TCP = "TCP"
UDP = "UDP"
SSL = "SSL"
SSL_BRIDGE = "SSL_BRIDGE"
SSL_TCP = "SSL_TCP"
NNTP = "NNTP"
ANY = "ANY"
SIP_UDP = "SIP_UDP"
RADIUS = "RADIUS"
RDP = "RDP"
RTSP = "RTSP"
MYSQL = "MYSQL"
MSSQL = "MSSQL"
ORACLE = "ORACLE"
class Iscname:
ENABLED = "ENABLED"
DISABLED = "DISABLED"
class Curstate:
UP = "UP"
DOWN = "DOWN"
UNKNOWN = "UNKNOWN"
BUSY = "BUSY"
OUT_OF_SERVICE = "OUT OF SERVICE"
GOING_OUT_OF_SERVICE = "GOING OUT OF SERVICE"
DOWN_WHEN_GOING_OUT_OF_SERVICE = "DOWN WHEN GOING OUT OF SERVICE"
NS_EMPTY_STR = "NS_EMPTY_STR"
Unknown = "Unknown"
DISABLED = "DISABLED"
class gslbvserver_gslbservice_binding_response(base_response) :
def __init__(self, length=1) :
self.gslbvserver_gslbservice_binding = []
self.errorcode = 0
self.message = ""
self.severity = ""
self.sessionid = ""
self.gslbvserver_gslbservice_binding = [gslbvserver_gslbservice_binding() for _ in range(length)]
| {
"content_hash": "1296feb3287688ce9caf616ef34d6ec7",
"timestamp": "",
"source": "github",
"line_count": 425,
"max_line_length": 253,
"avg_line_length": 28.103529411764708,
"alnum_prop": 0.6940723375753517,
"repo_name": "benfinke/ns_python",
"id": "5298bb68dbbfebd46a1ba6d935526e5e6679cac9",
"size": "12558",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "build/lib/nssrc/com/citrix/netscaler/nitro/resource/config/gslb/gslbvserver_gslbservice_binding.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "21836782"
},
{
"name": "Shell",
"bytes": "513"
}
],
"symlink_target": ""
} |
<?php
namespace Shop\Model;
use Think\Model\RelationModel;
/**
* Created by PhpStorm.
* User: an
* Date: 2015/8/20
* Time: 17:34
*/
class OrderRefundModel extends RelationModel{
} | {
"content_hash": "3c5fb47545a0d361b96c3f374e196113",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 45,
"avg_line_length": 12.8,
"alnum_prop": 0.6770833333333334,
"repo_name": "h136799711/baseItboye",
"id": "966d1dafccce56d2172bff98631f38cbb3fbee54",
"size": "192",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Application/Shop/Model/OrderRefundModel.class.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "161957"
},
{
"name": "HTML",
"bytes": "1494133"
},
{
"name": "JavaScript",
"bytes": "1532019"
},
{
"name": "PHP",
"bytes": "4394465"
}
],
"symlink_target": ""
} |
#include "UnitTestPCH.h"
#include <assimp/cexport.h>
#include <assimp/Exporter.hpp>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#ifndef ASSIMP_BUILD_NO_EXPORT
class ColladaExportLight : public ::testing::Test {
public:
virtual void SetUp()
{
ex = new Assimp::Exporter();
im = new Assimp::Importer();
}
virtual void TearDown()
{
delete ex;
delete im;
}
protected:
Assimp::Exporter* ex;
Assimp::Importer* im;
};
// ------------------------------------------------------------------------------------------------
TEST_F(ColladaExportLight, testExportLight)
{
const char* file = "lightsExp.dae";
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/lights.dae",0);
ASSERT_TRUE(pTest!=NULL);
ASSERT_TRUE(pTest->HasLights());
const unsigned int origNumLights( pTest->mNumLights );
std::unique_ptr<aiLight[]> origLights( new aiLight[ origNumLights ] );
std::vector<std::string> origNames;
for (size_t i = 0; i < origNumLights; i++) {
origNames.push_back( pTest->mLights[ i ]->mName.C_Str() );
origLights[ i ] = *(pTest->mLights[ i ]);
}
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
const aiScene* imported = im->ReadFile(file,0);
ASSERT_TRUE(imported!=NULL);
EXPECT_TRUE(imported->HasLights());
EXPECT_EQ( origNumLights,imported->mNumLights );
for(size_t i=0; i< origNumLights; i++) {
const aiLight *orig = &origLights[ i ];
const aiLight *read = imported->mLights[i];
EXPECT_EQ( 0,strncmp(origNames[ i ].c_str(),read->mName.C_Str(), origNames[ i ].size() ) );
EXPECT_EQ( orig->mType,read->mType);
EXPECT_FLOAT_EQ(orig->mAttenuationConstant,read->mAttenuationConstant);
EXPECT_FLOAT_EQ(orig->mAttenuationLinear,read->mAttenuationLinear);
EXPECT_NEAR(orig->mAttenuationQuadratic,read->mAttenuationQuadratic, 0.001f);
EXPECT_FLOAT_EQ(orig->mColorAmbient.r,read->mColorAmbient.r);
EXPECT_FLOAT_EQ(orig->mColorAmbient.g,read->mColorAmbient.g);
EXPECT_FLOAT_EQ(orig->mColorAmbient.b,read->mColorAmbient.b);
EXPECT_FLOAT_EQ(orig->mColorDiffuse.r,read->mColorDiffuse.r);
EXPECT_FLOAT_EQ(orig->mColorDiffuse.g,read->mColorDiffuse.g);
EXPECT_FLOAT_EQ(orig->mColorDiffuse.b,read->mColorDiffuse.b);
EXPECT_FLOAT_EQ(orig->mColorSpecular.r,read->mColorSpecular.r);
EXPECT_FLOAT_EQ(orig->mColorSpecular.g,read->mColorSpecular.g);
EXPECT_FLOAT_EQ(orig->mColorSpecular.b,read->mColorSpecular.b);
EXPECT_NEAR(orig->mAngleInnerCone,read->mAngleInnerCone,0.001);
EXPECT_NEAR(orig->mAngleOuterCone,read->mAngleOuterCone,0.001);
}
}
#endif // ASSIMP_BUILD_NO_EXPORT
| {
"content_hash": "1043d818072efd0199b4fe68930db06b",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 99,
"avg_line_length": 34.370370370370374,
"alnum_prop": 0.6382902298850575,
"repo_name": "minimumcut/UnnamedEngine",
"id": "2c502b987fad4ee818e912f9fc1e806ecf5b6c64",
"size": "4569",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "UnnamedEngine/Vendor/assimp/test/unit/utColladaExportLight.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1968"
},
{
"name": "C++",
"bytes": "127371"
},
{
"name": "CMake",
"bytes": "4210"
},
{
"name": "GLSL",
"bytes": "1580"
}
],
"symlink_target": ""
} |
var marked = require('marked');
var ready = () => {
var markabletext = $(".markabletext");
if (markabletext.length) {
var html_content = markabletext.html();
markabletext.html(marked(html_content));
markabletext.removeClass(".markabletext");
}
}
$(document).ready(ready);
$(document).on('turbolinks:load', ready);
| {
"content_hash": "801bd87066ef014896339b393bc06da9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 46,
"avg_line_length": 23.928571428571427,
"alnum_prop": 0.6626865671641791,
"repo_name": "wilfriedE/LearnIt",
"id": "42cb91b7695cf38bbc99730eca1ec5038b637523",
"size": "335",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/javascript/markdown/markabletext.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "262972"
},
{
"name": "CoffeeScript",
"bytes": "211"
},
{
"name": "HTML",
"bytes": "64116"
},
{
"name": "JavaScript",
"bytes": "2844392"
},
{
"name": "Ruby",
"bytes": "200100"
}
],
"symlink_target": ""
} |
using System;
namespace Lucene.Net.Search
{
using Attribute = Lucene.Net.Util.Attribute;
using IAttribute = Lucene.Net.Util.IAttribute;
using BytesRef = Lucene.Net.Util.BytesRef;
/// <summary>
/// Implementation class for <see cref="IMaxNonCompetitiveBoostAttribute"/>.
/// <para/>
/// @lucene.internal
/// </summary>
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public sealed class MaxNonCompetitiveBoostAttribute : Attribute, IMaxNonCompetitiveBoostAttribute
{
private float maxNonCompetitiveBoost = float.NegativeInfinity;
private BytesRef competitiveTerm = null;
public float MaxNonCompetitiveBoost
{
get => maxNonCompetitiveBoost;
set => this.maxNonCompetitiveBoost = value;
}
public BytesRef CompetitiveTerm
{
get => competitiveTerm;
set => this.competitiveTerm = value;
}
public override void Clear()
{
maxNonCompetitiveBoost = float.NegativeInfinity;
competitiveTerm = null;
}
public override void CopyTo(IAttribute target)
{
MaxNonCompetitiveBoostAttribute t = (MaxNonCompetitiveBoostAttribute)target;
t.MaxNonCompetitiveBoost = maxNonCompetitiveBoost;
t.CompetitiveTerm = competitiveTerm;
}
}
} | {
"content_hash": "f9c79922c38dd90423472acc33adcfb9",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 101,
"avg_line_length": 28.285714285714285,
"alnum_prop": 0.6406926406926406,
"repo_name": "sisve/lucenenet",
"id": "19ce2115ac964f0d82c2688657c3e292440faf15",
"size": "2247",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Lucene.Net/Search/MaxNonCompetitiveBoostAttributeImpl.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4805"
},
{
"name": "C#",
"bytes": "41089129"
},
{
"name": "Gnuplot",
"bytes": "2444"
},
{
"name": "HTML",
"bytes": "79746"
},
{
"name": "PowerShell",
"bytes": "73932"
},
{
"name": "XSLT",
"bytes": "21773"
}
],
"symlink_target": ""
} |
package ir.hphamid.instagram.activities;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import com.bumptech.glide.Glide;
import ir.hphamid.instagram.R;
import ir.hphamid.instagram.fragments.ImageListFragment;
/**
* Created on 1/24/17 at 2:49 PM.
* Project: instagram
*
* @author hamid
*/
public class HomeActivity extends AppCompatActivity{
private FloatingActionButton share;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
FragmentTransaction transaction =getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.home_fragment_container, new ImageListFragment());
transaction.commit();
share = (FloatingActionButton) findViewById(R.id.home_share);
share.setRippleColor(Color.BLUE);
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent loginActivityIntent = new Intent(HomeActivity.this, ShareImageActivity.class);
startActivity(loginActivityIntent);
}
});
}
}
| {
"content_hash": "7445eac001abae130a7a09e0f7b3ea1c",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 101,
"avg_line_length": 31.347826086956523,
"alnum_prop": 0.7246879334257975,
"repo_name": "hphamid/maktabkhoone-instagram",
"id": "9ea42a02025e90695c69ada00bdaa1906a299c2b",
"size": "1442",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/ir/hphamid/instagram/activities/HomeActivity.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "67336"
}
],
"symlink_target": ""
} |
<!DOCTYPE html >
<html>
<head>
<title></title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="../lib/ref-index.css" media="screen" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../lib/jquery.js"></script>
</head>
<body><div class="entry">
<div class="name">filter</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">filterNot</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">finallyDo</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">first</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> <a href="../rx/lang/scala/observables/BlockingObservable.html" class="extype" name="rx.lang.scala.observables.BlockingObservable">BlockingObservable</a> </div>
</div><div class="entry">
<div class="name">firstOrElse</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">flatMap</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">flatMapIterable</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">flatMapIterableWith</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">flatMapWith</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">flatMapWithMaxConcurrent</div>
<div class="occurrences"><a href="../rx/lang/scala/ExperimentalObservable.html" class="extype" name="rx.lang.scala.ExperimentalObservable">ExperimentalObservable</a> </div>
</div><div class="entry">
<div class="name">flatten</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">flattenDelayError</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">foldLeft</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">forall</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div><div class="entry">
<div class="name">foreach</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable.html" class="extype" name="rx.lang.scala.Observable">Observable</a> <a href="../rx/lang/scala/observables/BlockingObservable.html" class="extype" name="rx.lang.scala.observables.BlockingObservable">BlockingObservable</a> </div>
</div><div class="entry">
<div class="name">from</div>
<div class="occurrences"><a href="../rx/lang/scala/Observable$.html" class="extype" name="rx.lang.scala.Observable">Observable</a> </div>
</div></body>
</html> | {
"content_hash": "74f70f4b90ddde5be96403f4d6d3055c",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 295,
"avg_line_length": 68.38709677419355,
"alnum_prop": 0.6537735849056604,
"repo_name": "zsxwing/reactivex.github.io",
"id": "c86ab5039cc3e6b09b22c55d6edba7adee4d0c5f",
"size": "4240",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "rxscala/scaladoc/index/index-f.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "166463"
},
{
"name": "Clojure",
"bytes": "103"
},
{
"name": "Groovy",
"bytes": "109"
},
{
"name": "HTML",
"bytes": "10441878"
},
{
"name": "Java",
"bytes": "234"
},
{
"name": "JavaScript",
"bytes": "16946936"
}
],
"symlink_target": ""
} |
layout: post
title: "Freedom of Movement"
date: 2017-3-22
source: PHB.244
tags: [bard, cleric, druid, paladin (devotion), ranger, level4, abjuration]
categories:
- spells
---
**4th-level abjuration**
**Casting Time**: 1 action
**Range**: Touch
**Components**: V, S, M (a leather strap, bound around the arm or a similar appendage)
**Duration**: 1 hour
You touch a willing creature. For the duration, the target's movement is unaffected by difficult terrain, and spells and other magical effects can neither reduce the target's speed nor cause the target to be paralyzed or restrained.
The target can also spend 5 feet of movement to automatically escape from nonmagical restraints, such as manacles or a creature that has it grappled. Finally, being underwater imposes no penalties on the target's movement or attacks.
| {
"content_hash": "5ceb483ef0246bce160e2264e056ae8a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 233,
"avg_line_length": 37.54545454545455,
"alnum_prop": 0.7627118644067796,
"repo_name": "dylanbaumann/dylanbaumann.github.io",
"id": "34f7a02c2cf0c57aa2659579040ac60b97c42552",
"size": "830",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/spells/2017-03-22-freedom-of-movement.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "65360"
},
{
"name": "HTML",
"bytes": "6340"
}
],
"symlink_target": ""
} |
<aside id="alerts">
<div ng-repeat="message in alertMessages" class="alert alert-{{message.type}}">
<button ng-click="disposeAlert(message.id)" type="button" class="close">×</button>
<strong>{{message.type}}</strong> <span>{{message.text}}</span>
</div>
</aside>
| {
"content_hash": "83f7f65c96a0340e3fec0f7b3cfdc2d2",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 86,
"avg_line_length": 45.833333333333336,
"alnum_prop": 0.6618181818181819,
"repo_name": "lucassus/mongo_browser",
"id": "ebe0ff4b6f11d34bcff4688c56245d406ba82bd3",
"size": "276",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "public/ng/templates/alerts.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "72833"
},
{
"name": "JavaScript",
"bytes": "961340"
},
{
"name": "Racket",
"bytes": "60"
},
{
"name": "Ruby",
"bytes": "38703"
},
{
"name": "Shell",
"bytes": "793"
}
],
"symlink_target": ""
} |
<?php
abstract class PhabricatorCalendarController extends PhabricatorController {
protected function buildSideNavView(PhabricatorCalendarEvent $status = null) {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$nav->addLabel(pht('Calendar'));
$nav->addFilter('/', pht('My Events'));
$nav->addFilter('all/', pht('View All'));
$nav->addFilter('event/create/', pht('Create Event'));
if ($status && $status->getID()) {
$nav->addFilter('event/edit/'.$status->getID().'/', pht('Edit Event'));
}
$nav->addFilter('event/', pht('Upcoming Events'));
return $nav;
}
public function buildApplicationMenu() {
return $this->buildSideNavView()->getMenu();
}
public function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addAction(
id(new PHUIListItemView())
->setName(pht('Create Event'))
->setHref($this->getApplicationURI().'event/create')
->setIcon('fa-plus-square'));
return $crumbs;
}
}
| {
"content_hash": "2c728b9a94215cc6f624ead141b6370c",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 80,
"avg_line_length": 27.641025641025642,
"alnum_prop": 0.6428571428571429,
"repo_name": "huaban/phabricator",
"id": "d70b7f69978ba74af421cebcdf22923763837a78",
"size": "1078",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/applications/calendar/controller/PhabricatorCalendarController.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": "10803685"
},
{
"name": "Python",
"bytes": "7385"
},
{
"name": "Shell",
"bytes": "8229"
}
],
"symlink_target": ""
} |
#ifndef ScriptProcessorNode_h
#define ScriptProcessorNode_h
#include "modules/webaudio/AudioNode.h"
#include "platform/audio/AudioBus.h"
#include "wtf/Forward.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
namespace blink {
class AudioBuffer;
class AudioContext;
// ScriptProcessorNode is an AudioNode which allows for arbitrary synthesis or processing directly using JavaScript.
// The API allows for a variable number of inputs and outputs, although it must have at least one input or output.
// This basic implementation supports no more than one input and output.
// The "onaudioprocess" attribute is an event listener which will get called periodically with an AudioProcessingEvent which has
// AudioBuffers for each input and output.
class ScriptProcessorHandler final : public AudioHandler {
public:
static PassRefPtr<ScriptProcessorHandler> create(AudioNode&, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels);
~ScriptProcessorHandler() override;
// AudioHandler
void process(size_t framesToProcess) override;
void initialize() override;
size_t bufferSize() const { return m_bufferSize; }
void setChannelCount(unsigned long, ExceptionState&) override;
void setChannelCountMode(const String&, ExceptionState&) override;
virtual unsigned numberOfOutputChannels() const { return m_numberOfOutputChannels; }
private:
ScriptProcessorHandler(AudioNode&, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels);
double tailTime() const override;
double latencyTime() const override;
void fireProcessEvent();
// Double buffering
unsigned doubleBufferIndex() const { return m_doubleBufferIndex; }
void swapBuffers() { m_doubleBufferIndex = 1 - m_doubleBufferIndex; }
unsigned m_doubleBufferIndex;
unsigned m_doubleBufferIndexForEvent;
// These Persistent don't make reference cycles including the owner
// ScriptProcessorNode.
PersistentHeapVector<Member<AudioBuffer>> m_inputBuffers;
PersistentHeapVector<Member<AudioBuffer>> m_outputBuffers;
size_t m_bufferSize;
unsigned m_bufferReadWriteIndex;
unsigned m_numberOfInputChannels;
unsigned m_numberOfOutputChannels;
RefPtr<AudioBus> m_internalInputBus;
// Synchronize process() with fireProcessEvent().
mutable Mutex m_processEventLock;
// TODO(tkent): Use FRIEND_TEST macro provided by gtest_prod.h
friend class ScriptProcessorNodeTest_BufferLifetime_Test;
};
class ScriptProcessorNode final : public AudioNode {
DEFINE_WRAPPERTYPEINFO();
public:
// bufferSize must be one of the following values: 256, 512, 1024, 2048,
// 4096, 8192, 16384.
// This value controls how frequently the onaudioprocess event handler is
// called and how many sample-frames need to be processed each call.
// Lower numbers for bufferSize will result in a lower (better)
// latency. Higher numbers will be necessary to avoid audio breakup and
// glitches.
// The value chosen must carefully balance between latency and audio quality.
static ScriptProcessorNode* create(AudioContext&, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels);
DEFINE_ATTRIBUTE_EVENT_LISTENER(audioprocess);
size_t bufferSize() const;
private:
ScriptProcessorNode(AudioContext&, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels);
};
} // namespace blink
#endif // ScriptProcessorNode_h
| {
"content_hash": "8248344c6f7c1b0907259d4830349fc2",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 167,
"avg_line_length": 38.946236559139784,
"alnum_prop": 0.7691882937603534,
"repo_name": "zero-rp/miniblink49",
"id": "064b6d2dbc13a971d661cd7af6bc2ddeb5344d12",
"size": "4977",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "third_party/WebKit/Source/modules/webaudio/ScriptProcessorNode.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "11324414"
},
{
"name": "Batchfile",
"bytes": "52488"
},
{
"name": "C",
"bytes": "31014938"
},
{
"name": "C++",
"bytes": "281193388"
},
{
"name": "CMake",
"bytes": "88548"
},
{
"name": "CSS",
"bytes": "20839"
},
{
"name": "DIGITAL Command Language",
"bytes": "226954"
},
{
"name": "HTML",
"bytes": "202637"
},
{
"name": "JavaScript",
"bytes": "32544926"
},
{
"name": "Lua",
"bytes": "32432"
},
{
"name": "M4",
"bytes": "125191"
},
{
"name": "Makefile",
"bytes": "1517330"
},
{
"name": "Objective-C",
"bytes": "87691"
},
{
"name": "Objective-C++",
"bytes": "35037"
},
{
"name": "PHP",
"bytes": "307541"
},
{
"name": "Perl",
"bytes": "3283676"
},
{
"name": "Prolog",
"bytes": "29177"
},
{
"name": "Python",
"bytes": "4308928"
},
{
"name": "R",
"bytes": "10248"
},
{
"name": "Scheme",
"bytes": "25457"
},
{
"name": "Shell",
"bytes": "264021"
},
{
"name": "TypeScript",
"bytes": "162421"
},
{
"name": "Vim script",
"bytes": "11362"
},
{
"name": "XS",
"bytes": "4319"
},
{
"name": "eC",
"bytes": "4383"
}
],
"symlink_target": ""
} |
var requirejs = module.exports; | {
"content_hash": "a793b5504a1faae2bf8b621ff61178f4",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 31,
"alnum_prop": 0.8064516129032258,
"repo_name": "ajthor/generator-template",
"id": "c5644e87b426725180ebaddda7847d6e92b01ed6",
"size": "31",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/templates/lib/util/requirejs.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "0"
},
{
"name": "JavaScript",
"bytes": "16819"
}
],
"symlink_target": ""
} |
import numpy as np
import base64
import json
from galry import CompoundVisual
__all__ = ['SceneCreator',
'encode_data', 'decode_data', 'serialize', 'deserialize', ]
# Scene creator
# -------------
class SceneCreator(object):
"""Construct a scene with `add_*` methods."""
def __init__(self, constrain_ratio=False,):
"""Initialize the scene."""
# options
self.constrain_ratio = constrain_ratio
# create an empty scene
self.scene = {'visuals': [], 'renderer_options': {}}
self.visual_objects = {}
# Visual methods
# --------------
def get_visuals(self):
"""Return all visuals defined in the scene."""
return self.scene['visuals']
def get_visual_object(self, name):
"""Get a visual object from its name."""
return self.visual_objects[name]
def get_visual(self, name):
"""Get a visual dictionary from its name."""
visuals = [v for v in self.get_visuals() if v.get('name', '') == name]
if not visuals:
return None
return visuals[0]
# Visual creation methods
# -----------------------
def add_visual(self, visual_class, *args, **kwargs):
"""Add a visual. This method should be called in `self.initialize`.
A visual is an instanciation of a `Visual`. A Visual
defines a pattern for one, or a homogeneous set of plotting objects.
Example: a text string, a set of rectangles, a set of triangles,
a set of curves, a set of points. A set of points and rectangles
does not define a visual since it is not an homogeneous set of
objects. The technical reason for this distinction is that OpenGL
allows for very fast rendering of homogeneous objects by calling
a single rendering command (even if several objects of the same type
need to be rendered, e.g. several rectangles). The lower the number
of rendering calls, the better the performance.
Hence, a visual is defined by a particular Visual, and by
specification of fields in this visual (positions of the points,
colors, text string for the example of the TextVisual, etc.). It
also comes with a number `N` which is the number of vertices contained
in the visual (N=4 for one rectangle, N=len(text) for a text since
every character is rendered independently, etc.)
Several visuals can be created in the PaintManager, but performance
decreases with the number of visuals, so that all homogeneous
objects to be rendered on the screen at the same time should be
grouped into a single visual (e.g. multiple line plots).
Arguments:
* visual_class=None: the visual class, deriving from
`Visual` (or directly from the base class `Visual`
if you don't want the navigation-related functionality).
* visible=True: whether this visual should be rendered. Useful
for showing/hiding a transient element. When hidden, the visual
does not go through the rendering pipeline at all.
* **kwargs: keyword arguments for the visual `initialize` method.
Returns:
* visual: a dictionary containing all the information about
the visual, and that can be used in `set_data`.
"""
if 'name' not in kwargs:
kwargs['name'] = 'visual%d' % (len(self.get_visuals()))
# handle compound visual, where we add all sub visuals
# as defined in CompoundVisual.initialize()
if issubclass(visual_class, CompoundVisual):
visual = visual_class(self.scene, *args, **kwargs)
for sub_cls, sub_args, sub_kwargs in visual.visuals:
self.add_visual(sub_cls, *sub_args, **sub_kwargs)
return visual
# get the name of the visual from kwargs
name = kwargs.pop('name')
if self.get_visual(name):
raise ValueError("Visual name '%s' already exists." % name)
# pass constrain_ratio to all visuals
if 'constrain_ratio' not in kwargs:
kwargs['constrain_ratio'] = self.constrain_ratio
# create the visual object
visual = visual_class(self.scene, *args, **kwargs)
# get the dictionary version
dic = visual.get_dic()
dic['name'] = name
# append the dic to the visuals list of the scene
self.get_visuals().append(dic)
# also, record the visual object
self.visual_objects[name] = visual
return visual
# Output methods
# --------------
def get_scene(self):
"""Return the scene dictionary."""
return self.scene
def serialize(self, **kwargs):
"""Return the JSON representation of the scene."""
self.scene.update(**kwargs)
return serialize(self.scene)
def from_json(self, scene_json):
"""Import the scene from a JSON string."""
self.scene = deserialize(scene_json)
# Scene serialization methods
# ---------------------------
def encode_data(data):
"""Return the Base64 encoding of a Numpy array."""
return base64.b64encode(data)
def decode_data(s, dtype=np.float32):
"""Return a Numpy array from its encoded Base64 string. The dtype
must be provided (float32 by default)."""
return np.fromstring(base64.b64decode(s), dtype=dtype)
class ArrayEncoder(json.JSONEncoder):
"""JSON encoder that handles Numpy arrays and serialize them with base64
encoding."""
def default(self, obj):
if isinstance(obj, np.ndarray):
return encode_data(obj)
return json.JSONEncoder.default(self, obj)
def is_str(obj):
tp = type(obj)
return tp == str or tp == unicode
def serialize(scene):
"""Serialize a scene."""
# HACK: force all attributes to float32
# for visual in scene.get('visuals', []):
# if isinstance(visual.get('bounds', None), np.ndarray):
# visual['bounds'] = encode_data(visual['bounds'])
# for variable in visual.get('variables', []):
# if isinstance(variable.get('data', None), np.ndarray):
# # vartype = variable.get('vartype', 'float')
# # if vartype == 'int':
# # dtype = np.int32
# # elif vartype == 'float':
# # dtype = np.float32
# variable['data'] = encode_data(np.array(variable['data'], dtype=np.float32))
scene_json = json.dumps(scene, cls=ArrayEncoder, ensure_ascii=True)
# scene_json = scene_json.replace('\\n', '\\\\n')
return scene_json
def deserialize(scene_json):
"""Deserialize a scene."""
scene = json.loads(scene_json)
for visual in scene.get('visuals', []):
if is_str(visual.get('bounds', None)):
visual['bounds'] = decode_data(visual['bounds'], np.int32)
for variable in visual.get('variables', []):
if is_str(variable.get('data', None)):
vartype = variable.get('vartype', 'float')
if vartype == 'int':
dtype = np.int32
elif vartype == 'float':
dtype = np.float32
variable['data'] = decode_data(variable['data'], dtype)
return scene
| {
"content_hash": "72951eac31101ccabc20af52f0e33708",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 94,
"avg_line_length": 39.307291666666664,
"alnum_prop": 0.5877832251225653,
"repo_name": "rossant/galry",
"id": "859b4ec505bdc0cd2753f69bcb57fc77a17da20e",
"size": "7547",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "galry/scene.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "24569"
},
{
"name": "Python",
"bytes": "397431"
},
{
"name": "Shell",
"bytes": "57"
}
],
"symlink_target": ""
} |
using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Rewrite.UrlActions;
internal sealed class ForbiddenAction : UrlAction
{
public override void ApplyAction(RewriteContext context, BackReferenceCollection? ruleBackReferences, BackReferenceCollection? conditionBackReferences)
{
context.HttpContext.Response.StatusCode = StatusCodes.Status403Forbidden;
context.Result = RuleResult.EndResponse;
}
}
| {
"content_hash": "e3f55c50ebb1b9e6cafae311463f559d",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 155,
"avg_line_length": 36.583333333333336,
"alnum_prop": 0.8018223234624146,
"repo_name": "aspnet/AspNetCore",
"id": "9984cc931d7a2901e85351318ec9a8a13426008c",
"size": "577",
"binary": false,
"copies": "1",
"ref": "refs/heads/darc-main-3ce916a7-9d9b-4849-8f14-6703adcb3cb2",
"path": "src/Middleware/Rewrite/src/UrlActions/ForbiddenAction.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "109"
},
{
"name": "Batchfile",
"bytes": "19526"
},
{
"name": "C",
"bytes": "213916"
},
{
"name": "C#",
"bytes": "47455169"
},
{
"name": "C++",
"bytes": "1900454"
},
{
"name": "CMake",
"bytes": "7955"
},
{
"name": "CSS",
"bytes": "62326"
},
{
"name": "Dockerfile",
"bytes": "3584"
},
{
"name": "F#",
"bytes": "7982"
},
{
"name": "Groovy",
"bytes": "1529"
},
{
"name": "HTML",
"bytes": "1130653"
},
{
"name": "Java",
"bytes": "297552"
},
{
"name": "JavaScript",
"bytes": "2726829"
},
{
"name": "Lua",
"bytes": "4904"
},
{
"name": "Makefile",
"bytes": "220"
},
{
"name": "Objective-C",
"bytes": "222"
},
{
"name": "PowerShell",
"bytes": "241706"
},
{
"name": "Python",
"bytes": "19476"
},
{
"name": "Roff",
"bytes": "6044"
},
{
"name": "Shell",
"bytes": "142293"
},
{
"name": "Smalltalk",
"bytes": "3"
},
{
"name": "TypeScript",
"bytes": "797435"
}
],
"symlink_target": ""
} |
package com.google.zxing.common.detector;
import com.google.zxing.NotFoundException;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.BitMatrix;
/**
* <p>A somewhat generic detector that looks for a barcode-like rectangular region within an image.
* It looks within a mostly white region of an image for a region of black and white, but mostly
* black. It returns the four corners of the region, as best it can determine.</p>
*
* @author Sean Owen
*/
public final class MonochromeRectangleDetector {
private static final int MAX_MODULES = 32;
private final BitMatrix image;
public MonochromeRectangleDetector(BitMatrix image) {
this.image = image;
}
/**
* <p>Detects a rectangular region of black and white -- mostly black -- with a region of mostly
* white, in an image.</p>
*
* @return {@link com.google.zxing.ResultPoint}[] describing the corners of the rectangular region. The first and
* last points are opposed on the diagonal, as are the second and third. The first point will be
* the topmost point and the last, the bottommost. The second point will be leftmost and the
* third, the rightmost
* @throws com.google.zxing.NotFoundException if no Data Matrix Code can be found
*/
public ResultPoint[] detect() throws NotFoundException {
int height = image.getHeight();
int width = image.getWidth();
int halfHeight = height / 2;
int halfWidth = width / 2;
int deltaY = Math.max(1, height / (MAX_MODULES * 8));
int deltaX = Math.max(1, width / (MAX_MODULES * 8));
int top = 0;
int bottom = height;
int left = 0;
int right = width;
ResultPoint pointA = findCornerFromCenter(halfWidth, 0, left, right,
halfHeight, -deltaY, top, bottom, halfWidth / 2);
top = (int) pointA.getY() - 1;
ResultPoint pointB = findCornerFromCenter(halfWidth, -deltaX, left, right,
halfHeight, 0, top, bottom, halfHeight / 2);
left = (int) pointB.getX() - 1;
ResultPoint pointC = findCornerFromCenter(halfWidth, deltaX, left, right,
halfHeight, 0, top, bottom, halfHeight / 2);
right = (int) pointC.getX() + 1;
ResultPoint pointD = findCornerFromCenter(halfWidth, 0, left, right,
halfHeight, deltaY, top, bottom, halfWidth / 2);
bottom = (int) pointD.getY() + 1;
// Go try to find point A again with better information -- might have been off at first.
pointA = findCornerFromCenter(halfWidth, 0, left, right,
halfHeight, -deltaY, top, bottom, halfWidth / 4);
return new ResultPoint[] { pointA, pointB, pointC, pointD };
}
/**
* Attempts to locate a corner of the barcode by scanning up, down, left or right from a center
* point which should be within the barcode.
*
* @param centerX center's x component (horizontal)
* @param deltaX same as deltaY but change in x per step instead
* @param left minimum value of x
* @param right maximum value of x
* @param centerY center's y component (vertical)
* @param deltaY change in y per step. If scanning up this is negative; down, positive;
* left or right, 0
* @param top minimum value of y to search through (meaningless when di == 0)
* @param bottom maximum value of y
* @param maxWhiteRun maximum run of white pixels that can still be considered to be within
* the barcode
* @return a {@link com.google.zxing.ResultPoint} encapsulating the corner that was found
* @throws com.google.zxing.NotFoundException if such a point cannot be found
*/
private ResultPoint findCornerFromCenter(int centerX,
int deltaX,
int left,
int right,
int centerY,
int deltaY,
int top,
int bottom,
int maxWhiteRun) throws NotFoundException {
int[] lastRange = null;
for (int y = centerY, x = centerX;
y < bottom && y >= top && x < right && x >= left;
y += deltaY, x += deltaX) {
int[] range;
if (deltaX == 0) {
// horizontal slices, up and down
range = blackWhiteRange(y, maxWhiteRun, left, right, true);
} else {
// vertical slices, left and right
range = blackWhiteRange(x, maxWhiteRun, top, bottom, false);
}
if (range == null) {
if (lastRange == null) {
throw NotFoundException.getNotFoundInstance();
}
// lastRange was found
if (deltaX == 0) {
int lastY = y - deltaY;
if (lastRange[0] < centerX) {
if (lastRange[1] > centerX) {
// straddle, choose one or the other based on direction
return new ResultPoint(deltaY > 0 ? lastRange[0] : lastRange[1], lastY);
}
return new ResultPoint(lastRange[0], lastY);
} else {
return new ResultPoint(lastRange[1], lastY);
}
} else {
int lastX = x - deltaX;
if (lastRange[0] < centerY) {
if (lastRange[1] > centerY) {
return new ResultPoint(lastX, deltaX < 0 ? lastRange[0] : lastRange[1]);
}
return new ResultPoint(lastX, lastRange[0]);
} else {
return new ResultPoint(lastX, lastRange[1]);
}
}
}
lastRange = range;
}
throw NotFoundException.getNotFoundInstance();
}
/**
* Computes the start and end of a region of pixels, either horizontally or vertically, that could
* be part of a Data Matrix barcode.
*
* @param fixedDimension if scanning horizontally, this is the row (the fixed vertical location)
* where we are scanning. If scanning vertically it's the column, the fixed horizontal location
* @param maxWhiteRun largest run of white pixels that can still be considered part of the
* barcode region
* @param minDim minimum pixel location, horizontally or vertically, to consider
* @param maxDim maximum pixel location, horizontally or vertically, to consider
* @param horizontal if true, we're scanning left-right, instead of up-down
* @return int[] with start and end of found range, or null if no such range is found
* (e.g. only white was found)
*/
private int[] blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim, boolean horizontal) {
int center = (minDim + maxDim) / 2;
// Scan left/up first
int start = center;
while (start >= minDim) {
if (horizontal ? image.get(start, fixedDimension) : image.get(fixedDimension, start)) {
start--;
} else {
int whiteRunStart = start;
do {
start--;
} while (start >= minDim && !(horizontal ? image.get(start, fixedDimension) :
image.get(fixedDimension, start)));
int whiteRunSize = whiteRunStart - start;
if (start < minDim || whiteRunSize > maxWhiteRun) {
start = whiteRunStart;
break;
}
}
}
start++;
// Then try right/down
int end = center;
while (end < maxDim) {
if (horizontal ? image.get(end, fixedDimension) : image.get(fixedDimension, end)) {
end++;
} else {
int whiteRunStart = end;
do {
end++;
} while (end < maxDim && !(horizontal ? image.get(end, fixedDimension) :
image.get(fixedDimension, end)));
int whiteRunSize = end - whiteRunStart;
if (end >= maxDim || whiteRunSize > maxWhiteRun) {
end = whiteRunStart;
break;
}
}
}
end--;
return end > start ? new int[]{start, end} : null;
}
} | {
"content_hash": "d007696b734aa1b78b0f3aa08896a7fb",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 115,
"avg_line_length": 39.01990049751244,
"alnum_prop": 0.6074206298610225,
"repo_name": "luisnatividad/LectorQR",
"id": "aff093ea67ea31b849a51d874cd3f3c8298ea72f",
"size": "8440",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/google/zxing/common/detector/MonochromeRectangleDetector.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "340"
},
{
"name": "HTML",
"bytes": "103663"
},
{
"name": "Java",
"bytes": "1654682"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Moq;
using System.Reflection;
namespace Moqzilla
{
/// <summary>
/// A container for dynamically creating mocks.
/// </summary>
public class Mocker
{
/// <summary>
/// Mock repository. Values are Mock of T
/// </summary>
private readonly IDictionary<Type, object> _mockRepository;
/// <summary>
/// Activator repository. Values are Action of T
/// </summary>
private readonly IDictionary<Type, object> _activatorRepository;
/// <summary>
/// Concrete implementation repository. Values are T.
/// </summary>
private readonly IDictionary<Type, object> _concreteRepository;
/// <summary>
/// Cached empty Type array.
/// </summary>
private static readonly Type[] EmptyTypeArray = { };
/// <summary>
/// Cached empty object array.
/// </summary>
private static readonly object[] EmptyObjectArray = { };
/// <summary>
/// Create a Moqzilla container.
/// </summary>
public Mocker()
{
_mockRepository = new Dictionary<Type, object>();
_activatorRepository = new Dictionary<Type, object>();
_concreteRepository = new Dictionary<Type, object>();
}
/// <summary>
/// Returns TRUE if the specified type is an interface type.
/// </summary>
private static bool TypeIsInterface(Type type)
{
return type.GetTypeInfo().IsInterface;
}
/// <summary>
/// Creates an object, mocking up all dependencies in the constructor.
/// </summary>
/// <exception cref="MockerException">Thrown when no mockable constructor could be found.</exception>
public TSubject Create<TSubject>()
where TSubject : class
{
// Cache constructor parameters.
var type = typeof(TSubject);
var constructors = type.GetConstructors();
var parameters = constructors
.ToDictionary(c => c, c => c.GetParameters());
// Determine which constructors we can use.
var validConstructors = constructors
.Where(c => parameters[c]
.All(p => TypeIsInterface(p.ParameterType)))
.ToArray();
// If there are no constructors, fail.
if (!validConstructors.Any())
throw new MockerException(MockerExceptionType.NoValidConstructors);
// Choose the constructor with the most dependencies.
var mostSpecificConstructor = constructors
.OrderByDescending(c => parameters[c].Length)
.First();
// Pull mocked objects for the constructor from the repository.
var constructorArguments = parameters[mostSpecificConstructor]
.Select(p => GetConcrete(p.ParameterType) ?? Get(p.ParameterType).Object)
.ToArray();
// Run activations.
foreach (var parameter in parameters[mostSpecificConstructor])
{
if (!_activatorRepository.ContainsKey(parameter.ParameterType))
continue;
// Don't activate concrete implementations.
if (_concreteRepository.ContainsKey(parameter.ParameterType))
continue;
var activator = _activatorRepository[parameter.ParameterType];
var activatorType = activator.GetType();
activatorType.GetMethod("Invoke")?.Invoke(activator, new object[] { Get(parameter.ParameterType) });
}
// Instantiate the object.
return (TSubject)mostSpecificConstructor.Invoke(constructorArguments);
}
/// <summary>
/// Get a concrete implementation from the repository for a type determined at runtime.
/// </summary>
protected object GetConcrete(Type type)
{
return _concreteRepository.ContainsKey(type)
? _concreteRepository[type]
: null;
}
/// <summary>
/// Get a mock from the repository for a type determined at runtime.
/// </summary>
protected Mock Get(Type type)
{
// Return a cached mock, if we have one.
if (_mockRepository.ContainsKey(type))
return (Mock)_mockRepository[type];
// Create a mock - reflection is needed for invocation due to how Moq works.
var mock = typeof(Mock<>)
.MakeGenericType(type)
.GetConstructor(EmptyTypeArray)
?.Invoke(EmptyObjectArray);
_mockRepository[type] = mock;
return (Mock)mock;
}
/// <summary>
/// Get a mock from the container.
/// </summary>
public Mock<TSubject> Mock<TSubject>()
where TSubject : class
{
var type = typeof(TSubject);
if (_mockRepository.ContainsKey(type))
return (Mock<TSubject>) _mockRepository[type];
var mock = new Mock<TSubject>();
_mockRepository[type] = mock;
return mock;
}
/// <summary>
/// Set up a mock within the container. This allows you to pass in
/// a block solely for the purpose of configuring a mock.
/// </summary>
public Mock<TSubject> Mock<TSubject>(Action<Mock<TSubject>> setupMethod)
where TSubject : class
{
var mock = Mock<TSubject>();
setupMethod?.Invoke(mock);
return mock;
}
/// <summary>
/// Removes all mocks from the container. Objects created with
/// <see cref="Create{TSubject}"/> prior to this call are not affected.
/// This does not clear activations.
/// </summary>
public void Reset()
{
_mockRepository.Clear();
}
/// <summary>
/// Removes a single mock from the container. Objects created with
/// <see cref="Create{TSubject}"/> prior to this call are not affected.
/// This does not clear activations.
/// </summary>
public void Reset<TSubject>()
{
_mockRepository.Remove(typeof(TSubject));
}
/// <summary>
/// Injects a mock into the container. Objects created with
/// <see cref="Create{TSubject}"/> prior to this call are not affected.
/// </summary>
/// <exception cref="ArgumentNullException">Thrown when the specified mock is null.</exception>
public void Inject<TSubject>(Mock<TSubject> mock)
where TSubject : class
{
_mockRepository[typeof(TSubject)] = mock
?? throw new ArgumentNullException(nameof(mock));
}
/// <summary>
/// Injects a concrete implementation into the container. Objects created with
/// <see cref="Create{TSubject}"/> prior to this call are not affected.
/// </summary>
/// <exception cref="ArgumentNullException">Thrown when the specified object is null.</exception>
public void Implement<TSubject>(TSubject obj)
where TSubject : class
{
_concreteRepository[typeof(TSubject)] = obj
?? throw new ArgumentNullException(nameof(obj));
}
/// <summary>
/// Registers an activation. When <see cref="Create{TSubject}"/> is invoked,
/// activations are invoked before object creation. This is used to set up consistent parts
/// of a mock.
/// </summary>
public void Activate<TSubject>(Action<Mock<TSubject>> activator)
where TSubject : class
{
var type = typeof(TSubject);
if (_activatorRepository.ContainsKey(type))
{
// Chain existing activations.
var currentActivation = (Action<Mock<TSubject>>)_activatorRepository[type];
_activatorRepository[type] = (Action<Mock<TSubject>>)(mock =>
{
currentActivation(mock);
activator(mock);
});
}
else
{
_activatorRepository[type] = activator;
}
}
}
}
| {
"content_hash": "9d63e9db391c1a114643c0563cb71bd6",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 116,
"avg_line_length": 36.0126582278481,
"alnum_prop": 0.5600468658465143,
"repo_name": "SaxxonPike/Moqzilla",
"id": "78810ef9e00088b57d966337e552ea16ab964b1e",
"size": "8537",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Moqzilla/Mocker.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "20338"
}
],
"symlink_target": ""
} |
@class IOSLongArray;
@class JavaNioByteOrder;
#include "J2ObjC_header.h"
#include "java/nio/LongBuffer.h"
@interface JavaNioLongArrayBuffer : JavaNioLongBuffer {
}
- (instancetype)initWithLongArray:(IOSLongArray *)array;
- (JavaNioLongBuffer *)asReadOnlyBuffer;
- (JavaNioLongBuffer *)compact;
- (JavaNioLongBuffer *)duplicate;
- (JavaNioLongBuffer *)slice;
- (jboolean)isReadOnly;
- (IOSLongArray *)protectedArray;
- (jint)protectedArrayOffset;
- (jboolean)protectedHasArray;
- (jlong)get;
- (jlong)getWithInt:(jint)index;
- (JavaNioLongBuffer *)getWithLongArray:(IOSLongArray *)dst
withInt:(jint)dstOffset
withInt:(jint)longCount;
- (jboolean)isDirect;
- (JavaNioByteOrder *)order;
- (JavaNioLongBuffer *)putWithLong:(jlong)c;
- (JavaNioLongBuffer *)putWithInt:(jint)index
withLong:(jlong)c;
- (JavaNioLongBuffer *)putWithLongArray:(IOSLongArray *)src
withInt:(jint)srcOffset
withInt:(jint)longCount;
@end
J2OBJC_EMPTY_STATIC_INIT(JavaNioLongArrayBuffer)
CF_EXTERN_C_BEGIN
CF_EXTERN_C_END
J2OBJC_TYPE_LITERAL_HEADER(JavaNioLongArrayBuffer)
#endif // _JavaNioLongArrayBuffer_H_
| {
"content_hash": "3970e3d3e7a72f0c1bc4b6bd6fe625ae",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 59,
"avg_line_length": 21.655172413793103,
"alnum_prop": 0.6759554140127388,
"repo_name": "hambroperks/pollexor",
"id": "f309989d00b5218e66e0192df2935a9ffad23177",
"size": "1465",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Pods/J2ObjC/dist/include/java/nio/LongArrayBuffer.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1040"
},
{
"name": "HTML",
"bytes": "4169"
},
{
"name": "Java",
"bytes": "59016"
},
{
"name": "Objective-C",
"bytes": "87524"
},
{
"name": "Ruby",
"bytes": "1420"
},
{
"name": "Shell",
"bytes": "2482"
}
],
"symlink_target": ""
} |
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
#include "config.h"
#include "V8HTMLObjectElement.h"
#include "bindings/core/v8/BindingSecurity.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8Document.h"
#include "bindings/core/v8/V8HTMLFormElement.h"
#include "bindings/core/v8/V8Node.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "bindings/core/v8/V8ValidityState.h"
#include "core/HTMLNames.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h"
#include "core/dom/custom/CustomElementProcessingStack.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/TraceEvent.h"
#include "wtf/GetPtr.h"
#include "wtf/RefPtr.h"
namespace blink {
// Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
const WrapperTypeInfo V8HTMLObjectElement::wrapperTypeInfo = { gin::kEmbedderBlink, V8HTMLObjectElement::domTemplate, V8HTMLObjectElement::refObject, V8HTMLObjectElement::derefObject, V8HTMLObjectElement::trace, 0, 0, V8HTMLObjectElement::preparePrototypeObject, V8HTMLObjectElement::installConditionallyEnabledProperties, "HTMLObjectElement", &V8HTMLElement::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::NodeClassId, WrapperTypeInfo::InheritFromEventTarget, WrapperTypeInfo::Dependent, WrapperTypeInfo::WillBeGarbageCollectedObject };
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
// This static member must be declared by DEFINE_WRAPPERTYPEINFO in HTMLObjectElement.h.
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
// bindings/core/v8/ScriptWrappable.h.
const WrapperTypeInfo& HTMLObjectElement::s_wrapperTypeInfo = V8HTMLObjectElement::wrapperTypeInfo;
namespace HTMLObjectElementV8Internal {
static void dataAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
v8SetReturnValueString(info, impl->getURLAttribute(HTMLNames::dataAttr), info.GetIsolate());
}
static void dataAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::dataAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void dataAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::dataAttr, cppValue);
}
static void dataAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::dataAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void typeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::typeAttr), info.GetIsolate());
}
static void typeAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::typeAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void typeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::typeAttr, cppValue);
}
static void typeAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::typeAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void nameAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->getNameAttribute(), info.GetIsolate());
}
static void nameAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::nameAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void nameAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::nameAttr, cppValue);
}
static void nameAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::nameAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void useMapAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::usemapAttr), info.GetIsolate());
}
static void useMapAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::useMapAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void useMapAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::usemapAttr, cppValue);
}
static void useMapAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::useMapAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void formAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->formOwner()), impl);
}
static void formAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::formAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void widthAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::widthAttr), info.GetIsolate());
}
static void widthAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::widthAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void widthAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::widthAttr, cppValue);
}
static void widthAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::widthAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void heightAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::heightAttr), info.GetIsolate());
}
static void heightAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::heightAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void heightAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::heightAttr, cppValue);
}
static void heightAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::heightAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void contentDocumentAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
ExceptionState exceptionState(ExceptionState::GetterContext, "contentDocument", "HTMLObjectElement", holder, info.GetIsolate());
if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->contentDocument(), exceptionState)) {
v8SetReturnValueNull(info);
exceptionState.throwIfNeeded();
return;
}
v8SetReturnValueFast(info, WTF::getPtr(impl->contentDocument()), impl);
}
static void contentDocumentAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::contentDocumentAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void willValidateAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
v8SetReturnValueBool(info, impl->willValidate());
}
static void willValidateAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::willValidateAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void validityAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->validity()), impl);
}
static void validityAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::validityAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void validationMessageAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
v8SetReturnValueString(info, impl->validationMessage(), info.GetIsolate());
}
static void validationMessageAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::validationMessageAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void alignAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::alignAttr), info.GetIsolate());
}
static void alignAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::alignAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void alignAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::alignAttr, cppValue);
}
static void alignAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::alignAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void archiveAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::archiveAttr), info.GetIsolate());
}
static void archiveAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::archiveAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void archiveAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::archiveAttr, cppValue);
}
static void archiveAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::archiveAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void codeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::codeAttr), info.GetIsolate());
}
static void codeAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::codeAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void codeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::codeAttr, cppValue);
}
static void codeAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::codeAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void declareAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
v8SetReturnValueBool(info, impl->fastHasAttribute(HTMLNames::declareAttr));
}
static void declareAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::declareAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void declareAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "declare", "HTMLObjectElement", holder, info.GetIsolate());
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
bool cppValue = toBoolean(info.GetIsolate(), v8Value, exceptionState);
if (exceptionState.throwIfNeeded())
return;
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
impl->setBooleanAttribute(HTMLNames::declareAttr, cppValue);
}
static void declareAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::declareAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void hspaceAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
v8SetReturnValueInt(info, impl->getIntegralAttribute(HTMLNames::hspaceAttr));
}
static void hspaceAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::hspaceAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void hspaceAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "hspace", "HTMLObjectElement", holder, info.GetIsolate());
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
impl->setIntegralAttribute(HTMLNames::hspaceAttr, cppValue);
}
static void hspaceAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::hspaceAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void standbyAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::standbyAttr), info.GetIsolate());
}
static void standbyAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::standbyAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void standbyAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::standbyAttr, cppValue);
}
static void standbyAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::standbyAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void vspaceAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
v8SetReturnValueInt(info, impl->getIntegralAttribute(HTMLNames::vspaceAttr));
}
static void vspaceAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::vspaceAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void vspaceAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "vspace", "HTMLObjectElement", holder, info.GetIsolate());
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
if (exceptionState.throwIfNeeded())
return;
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
impl->setIntegralAttribute(HTMLNames::vspaceAttr, cppValue);
}
static void vspaceAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::vspaceAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void codeBaseAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(holder);
v8SetReturnValueString(info, impl->getURLAttribute(HTMLNames::codebaseAttr), info.GetIsolate());
}
static void codeBaseAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::codeBaseAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void codeBaseAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::codebaseAttr, cppValue);
}
static void codeBaseAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::codeBaseAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void codeTypeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::codetypeAttr), info.GetIsolate());
}
static void codeTypeAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::codeTypeAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void codeTypeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::codetypeAttr, cppValue);
}
static void codeTypeAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::codeTypeAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void borderAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
v8SetReturnValueString(info, impl->fastGetAttribute(HTMLNames::borderAttr), info.GetIsolate());
}
static void borderAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLObjectElementV8Internal::borderAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void borderAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
Element* impl = V8Element::toImpl(holder);
V8StringResource<TreatNullAsEmptyString> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setAttribute(HTMLNames::borderAttr, cppValue);
}
static void borderAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
HTMLObjectElementV8Internal::borderAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void getSVGDocumentMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "getSVGDocument", "HTMLObjectElement", info.Holder(), info.GetIsolate());
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(info.Holder());
if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->getSVGDocument(exceptionState), exceptionState)) {
v8SetReturnValueNull(info);
exceptionState.throwIfNeeded();
return;
}
RefPtrWillBeRawPtr<Document> result = impl->getSVGDocument(exceptionState);
if (exceptionState.hadException()) {
exceptionState.throwIfNeeded();
return;
}
v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
}
static void getSVGDocumentMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
HTMLObjectElementV8Internal::getSVGDocumentMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void checkValidityMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(info.Holder());
v8SetReturnValueBool(info, impl->checkValidity());
}
static void checkValidityMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
HTMLObjectElementV8Internal::checkValidityMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void reportValidityMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(info.Holder());
v8SetReturnValueBool(info, impl->reportValidity());
}
static void reportValidityMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
HTMLObjectElementV8Internal::reportValidityMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void setCustomValidityMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
if (UNLIKELY(info.Length() < 1)) {
V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "setCustomValidity", "HTMLObjectElement", 1, info.Length()), info.GetIsolate());
return;
}
HTMLObjectElement* impl = V8HTMLObjectElement::toImpl(info.Holder());
V8StringResource<> error;
{
error = info[0];
if (!error.prepare())
return;
}
impl->setCustomValidity(error);
}
static void setCustomValidityMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
HTMLObjectElementV8Internal::setCustomValidityMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
V8HTMLObjectElement::indexedPropertyGetterCustom(index, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty");
V8HTMLObjectElement::indexedPropertySetterCustom(index, v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
V8HTMLObjectElement::namedPropertyGetterCustom(name, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
V8HTMLObjectElement::namedPropertySetterCustom(name, v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
} // namespace HTMLObjectElementV8Internal
// Suppress warning: global constructors, because AttributeConfiguration is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
static const V8DOMConfiguration::AttributeConfiguration V8HTMLObjectElementAttributes[] = {
{"data", HTMLObjectElementV8Internal::dataAttributeGetterCallback, HTMLObjectElementV8Internal::dataAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"type", HTMLObjectElementV8Internal::typeAttributeGetterCallback, HTMLObjectElementV8Internal::typeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"name", HTMLObjectElementV8Internal::nameAttributeGetterCallback, HTMLObjectElementV8Internal::nameAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"useMap", HTMLObjectElementV8Internal::useMapAttributeGetterCallback, HTMLObjectElementV8Internal::useMapAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"form", HTMLObjectElementV8Internal::formAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"width", HTMLObjectElementV8Internal::widthAttributeGetterCallback, HTMLObjectElementV8Internal::widthAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"height", HTMLObjectElementV8Internal::heightAttributeGetterCallback, HTMLObjectElementV8Internal::heightAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"contentDocument", HTMLObjectElementV8Internal::contentDocumentAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"willValidate", HTMLObjectElementV8Internal::willValidateAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"validity", HTMLObjectElementV8Internal::validityAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"validationMessage", HTMLObjectElementV8Internal::validationMessageAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"align", HTMLObjectElementV8Internal::alignAttributeGetterCallback, HTMLObjectElementV8Internal::alignAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"archive", HTMLObjectElementV8Internal::archiveAttributeGetterCallback, HTMLObjectElementV8Internal::archiveAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"code", HTMLObjectElementV8Internal::codeAttributeGetterCallback, HTMLObjectElementV8Internal::codeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"declare", HTMLObjectElementV8Internal::declareAttributeGetterCallback, HTMLObjectElementV8Internal::declareAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"hspace", HTMLObjectElementV8Internal::hspaceAttributeGetterCallback, HTMLObjectElementV8Internal::hspaceAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"standby", HTMLObjectElementV8Internal::standbyAttributeGetterCallback, HTMLObjectElementV8Internal::standbyAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"vspace", HTMLObjectElementV8Internal::vspaceAttributeGetterCallback, HTMLObjectElementV8Internal::vspaceAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"codeBase", HTMLObjectElementV8Internal::codeBaseAttributeGetterCallback, HTMLObjectElementV8Internal::codeBaseAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"codeType", HTMLObjectElementV8Internal::codeTypeAttributeGetterCallback, HTMLObjectElementV8Internal::codeTypeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
{"border", HTMLObjectElementV8Internal::borderAttributeGetterCallback, HTMLObjectElementV8Internal::borderAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
};
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
static const V8DOMConfiguration::MethodConfiguration V8HTMLObjectElementMethods[] = {
{"getSVGDocument", HTMLObjectElementV8Internal::getSVGDocumentMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
{"checkValidity", HTMLObjectElementV8Internal::checkValidityMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
{"reportValidity", HTMLObjectElementV8Internal::reportValidityMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
{"setCustomValidity", HTMLObjectElementV8Internal::setCustomValidityMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
};
static void installV8HTMLObjectElementTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{
functionTemplate->ReadOnlyPrototype();
v8::Local<v8::Signature> defaultSignature;
defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "HTMLObjectElement", V8HTMLElement::domTemplate(isolate), V8HTMLObjectElement::internalFieldCount,
V8HTMLObjectElementAttributes, WTF_ARRAY_LENGTH(V8HTMLObjectElementAttributes),
0, 0,
V8HTMLObjectElementMethods, WTF_ARRAY_LENGTH(V8HTMLObjectElementMethods));
v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
ALLOW_UNUSED_LOCAL(instanceTemplate);
v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
ALLOW_UNUSED_LOCAL(prototypeTemplate);
{
v8::IndexedPropertyHandlerConfiguration config(HTMLObjectElementV8Internal::indexedPropertyGetterCallback, HTMLObjectElementV8Internal::indexedPropertySetterCallback, 0, 0, 0);
functionTemplate->InstanceTemplate()->SetHandler(config);
}
{
v8::NamedPropertyHandlerConfiguration config(HTMLObjectElementV8Internal::namedPropertyGetterCallback, HTMLObjectElementV8Internal::namedPropertySetterCallback, 0, 0, 0);
config.flags = static_cast<v8::PropertyHandlerFlags>(static_cast<int>(config.flags) | static_cast<int>(v8::PropertyHandlerFlags::kOnlyInterceptStrings));
functionTemplate->InstanceTemplate()->SetHandler(config);
}
functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLObjectElement::legacyCallCustom);
// Custom toString template
functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
}
v8::Local<v8::FunctionTemplate> V8HTMLObjectElement::domTemplate(v8::Isolate* isolate)
{
return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8HTMLObjectElementTemplate);
}
bool V8HTMLObjectElement::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}
v8::Local<v8::Object> V8HTMLObjectElement::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}
HTMLObjectElement* V8HTMLObjectElement::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
{
return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0;
}
void V8HTMLObjectElement::refObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
scriptWrappable->toImpl<HTMLObjectElement>()->ref();
#endif
}
void V8HTMLObjectElement::derefObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
scriptWrappable->toImpl<HTMLObjectElement>()->deref();
#endif
}
// void V8HTMLObjectElement::indexedPropertyGetterCustom(uint32_t, const v8::PropertyCallbackInfo<v8::Value>&) { notImplemented(); }
// void V8HTMLObjectElement::indexedPropertySetterCustom(uint32_t, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&) { notImplemented(); }
// void V8HTMLObjectElement::namedPropertyGetterCustom(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&) { notImplemented(); }
// void V8HTMLObjectElement::namedPropertySetterCustom(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&) { notImplemented(); }
// void V8HTMLObjectElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>&) { notImplemented(); }
} // namespace blink
| {
"content_hash": "ad4dd6a30d8a446cf377db56904e0543",
"timestamp": "",
"source": "github",
"line_count": 849,
"max_line_length": 569,
"avg_line_length": 52.207302709069495,
"alnum_prop": 0.7515567187076979,
"repo_name": "zero-rp/miniblink49",
"id": "0183bd34ae63416f76eb02beb6beaa68671bc37f",
"size": "44492",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "gen/blink/bindings/core/v8/V8HTMLObjectElement.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "11324414"
},
{
"name": "Batchfile",
"bytes": "52488"
},
{
"name": "C",
"bytes": "31014938"
},
{
"name": "C++",
"bytes": "281193388"
},
{
"name": "CMake",
"bytes": "88548"
},
{
"name": "CSS",
"bytes": "20839"
},
{
"name": "DIGITAL Command Language",
"bytes": "226954"
},
{
"name": "HTML",
"bytes": "202637"
},
{
"name": "JavaScript",
"bytes": "32544926"
},
{
"name": "Lua",
"bytes": "32432"
},
{
"name": "M4",
"bytes": "125191"
},
{
"name": "Makefile",
"bytes": "1517330"
},
{
"name": "Objective-C",
"bytes": "87691"
},
{
"name": "Objective-C++",
"bytes": "35037"
},
{
"name": "PHP",
"bytes": "307541"
},
{
"name": "Perl",
"bytes": "3283676"
},
{
"name": "Prolog",
"bytes": "29177"
},
{
"name": "Python",
"bytes": "4308928"
},
{
"name": "R",
"bytes": "10248"
},
{
"name": "Scheme",
"bytes": "25457"
},
{
"name": "Shell",
"bytes": "264021"
},
{
"name": "TypeScript",
"bytes": "162421"
},
{
"name": "Vim script",
"bytes": "11362"
},
{
"name": "XS",
"bytes": "4319"
},
{
"name": "eC",
"bytes": "4383"
}
],
"symlink_target": ""
} |
package org.onosproject.net;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import java.util.Set;
/**
* Abstraction of an end-station host on the network, essentially a NIC.
*/
public interface Host extends Element {
/**
* Host identification.
*
* @return host id
*/
@Override
HostId id();
/**
* Returns the host MAC address.
*
* @return mac address
*/
MacAddress mac();
/**
* Returns the VLAN ID tied to this host.
*
* @return VLAN ID value
*/
VlanId vlan();
/**
* Returns set of IP addresses currently bound to the host MAC address.
*
* @return set of IP addresses; empty if no IP address is bound
*/
Set<IpAddress> ipAddresses();
/**
* Returns the most recent host location where the host attaches to the
* network edge.
*
* @return host location
*/
HostLocation location();
// TODO: explore capturing list of recent locations to aid in mobility
}
| {
"content_hash": "eb418851c2645118e7de19ba74af9230",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 75,
"avg_line_length": 19.87037037037037,
"alnum_prop": 0.614165890027959,
"repo_name": "VinodKumarS-Huawei/ietf96yang",
"id": "b9621b7c7f1b9916a6f673e03266f04553e3202f",
"size": "1690",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "core/api/src/main/java/org/onosproject/net/Host.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "74069"
},
{
"name": "CSS",
"bytes": "192215"
},
{
"name": "Groff",
"bytes": "1090"
},
{
"name": "HTML",
"bytes": "170763"
},
{
"name": "Java",
"bytes": "26926510"
},
{
"name": "JavaScript",
"bytes": "3066650"
},
{
"name": "Protocol Buffer",
"bytes": "7499"
},
{
"name": "Python",
"bytes": "121312"
},
{
"name": "Shell",
"bytes": "913"
}
],
"symlink_target": ""
} |
/* */
'use strict';
module.exports.definition = {
set: function (v) {
this._setProperty('-webkit-max-logical-height', v);
},
get: function () {
return this.getPropertyValue('-webkit-max-logical-height');
},
enumerable: true,
configurable: true
};
| {
"content_hash": "81ea9f33e0a7eb187b2344c04d6f9a84",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 67,
"avg_line_length": 22.23076923076923,
"alnum_prop": 0.5916955017301038,
"repo_name": "TelerikFrenchConnection/JS-Applications-Teamwork",
"id": "17013a0ea0bc0819759e654a6dd8525853b4d856",
"size": "289",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/npm/cssstyle@0.2.29/lib/properties/webkitMaxLogicalHeight.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "23835"
},
{
"name": "CSS",
"bytes": "191534"
},
{
"name": "CoffeeScript",
"bytes": "2294"
},
{
"name": "HTML",
"bytes": "59769"
},
{
"name": "JavaScript",
"bytes": "10601959"
},
{
"name": "Makefile",
"bytes": "1715"
},
{
"name": "Ruby",
"bytes": "3945"
},
{
"name": "Shell",
"bytes": "470"
}
],
"symlink_target": ""
} |
var SettingsGeneralController = Ember.ObjectController.extend({
isDatedPermalinks: function (key, value) {
// setter
if (arguments.length > 1) {
this.set('permalinks', value ? '/:year/:month/:day/:slug/' : '/:slug/');
}
// getter
var slugForm = this.get('permalinks');
return slugForm !== '/:slug/';
}.property('permalinks'),
themes: function () {
return this.get('availableThemes').reduce(function (themes, t) {
var theme = {};
theme.name = t.name;
theme.label = t.package ? t.package.name + ' - ' + t.package.version : t.name;
theme.package = t.package;
theme.active = !!t.active;
themes.push(theme);
return themes;
}, []);
}.property().readOnly(),
actions: {
save: function () {
var self = this;
return this.get('model').save().then(function (model) {
self.notifications.showSuccess('Settings successfully saved.');
return model;
}).catch(function (errors) {
self.notifications.showErrors(errors);
});
},
}
});
export default SettingsGeneralController;
| {
"content_hash": "b1f142a3e601d027097dcd7df1da6531",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 90,
"avg_line_length": 28.681818181818183,
"alnum_prop": 0.5253565768621236,
"repo_name": "nakamuraapp/new-ghost",
"id": "fbe87e8416e222a89ec91648ea1cc5ad6d175965",
"size": "1262",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "core/client/controllers/settings/general.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "213478"
},
{
"name": "JavaScript",
"bytes": "5678411"
}
],
"symlink_target": ""
} |
package org.kuali.rice.kew.server;
import org.apache.commons.lang.StringUtils;
import org.joda.time.DateTime;
import org.junit.Test;
import org.kuali.rice.kew.actionitem.ActionItem;
import org.kuali.rice.kew.api.action.DelegationType;
import org.kuali.rice.kew.api.document.DocumentContent;
import org.kuali.rice.kew.api.document.DocumentContentUpdate;
import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
import org.kuali.rice.kew.dto.DTOConverter;
import org.kuali.rice.kew.rule.TestRuleAttribute;
import org.kuali.rice.kew.test.KEWTestCase;
import org.kuali.rice.kew.util.KEWConstants;
import org.kuali.rice.kim.api.KimConstants;
import org.kuali.rice.kim.api.group.Group;
import org.kuali.rice.kim.api.services.KimApiServiceLocator;
import java.sql.Timestamp;
import java.util.Date;
import static org.junit.Assert.*;
public class BeanConverterTester extends KEWTestCase {
private static final String DOCUMENT_CONTENT = KEWConstants.DOCUMENT_CONTENT_ELEMENT;
private static final String ATTRIBUTE_CONTENT = KEWConstants.ATTRIBUTE_CONTENT_ELEMENT;
private static final String SEARCHABLE_CONTENT = KEWConstants.SEARCHABLE_CONTENT_ELEMENT;
private static final String APPLICATION_CONTENT = KEWConstants.APPLICATION_CONTENT_ELEMENT;
/**
* Tests the conversion of a String into a DocumentContentVO object which should split the
* String into it's 3 distinct components.
*/
@Test public void testConvertDocumentContent() throws Exception {
// test null content
String attributeContent = null;
String searchableContent = null;
String applicationContent = null;
String xmlContent = constructContent(attributeContent, searchableContent, applicationContent);
DocumentContent.Builder builder = DocumentContent.Builder.create("-1234");
builder.setApplicationContent(applicationContent);
builder.setAttributeContent(attributeContent);
builder.setSearchableContent(searchableContent);
DocumentContent content = builder.build();
assertFalse("Content cannot be empty.", org.apache.commons.lang.StringUtils.isEmpty(content.getFullContent()));
assertEquals("Attribute content is invalid.", null, content.getAttributeContent());
assertEquals("Searchable content is invalid.", null, content.getSearchableContent());
assertEquals("Application content is invalid.", null, content.getApplicationContent());
assertEquals("Should have fake document id.", "-1234", content.getDocumentId());
// test empty content
attributeContent = "";
searchableContent = "";
applicationContent = "";
builder = DocumentContent.Builder.create("testId");
builder.setApplicationContent(applicationContent);
builder.setAttributeContent(attributeContent);
builder.setSearchableContent(searchableContent);
content = builder.build();
assertContent(content, attributeContent, searchableContent, applicationContent);
// test fancy dancy content
attributeContent = "<iEnjoyFlexContent><id>1234</id></iEnjoyFlexContent>";
searchableContent = "<thisIdBeWarrenG>Warren G</thisIdBeWarrenG><whatsMyName>Snoop</whatsMyName>";
applicationContent = "<thisIsTotallyRad><theCoolestContentInTheWorld qualify=\"iSaidSo\">it's marvelous!</theCoolestContentInTheWorld></thisIsTotallyRad>";
builder = DocumentContent.Builder.create("testId");
builder.setApplicationContent(applicationContent);
builder.setAttributeContent(attributeContent);
builder.setSearchableContent(searchableContent);
content = builder.build();
assertContent(content, attributeContent, searchableContent, applicationContent);
/*attributeContent = "invalid<xml, I can't believe you would do such a thing<<<";
try {
builder = DocumentContent.Builder.create("testId");
builder.setApplicationContent(applicationContent);
builder.setAttributeContent(attributeContent);
builder.setSearchableContent(searchableContent);
content = builder.build();
fail("Parsing bad xml should have thrown an XmlException.");
} catch (XmlException e) {
log.info("Expected XmlException was thrown.");
// if we got the exception we are good to go
}*/
// test an older style document
/*String appSpecificXml = "<iAmAnOldSchoolApp><myDocContent type=\"custom\">is totally app specific</myDocContent><howIroll>old school, that's how I roll</howIroll></iAmAnOldSchoolApp>";
contentVO = DTOConverter.convertDocumentContent(appSpecificXml, null);
assertContent(contentVO, "", "", appSpecificXml);*/
// test the old school (Workflow 1.6) flex document XML
/*String fleXml = "<flexdoc><meinAttribute>nein</meinAttribute></flexdoc>";
contentVO = DTOConverter.convertDocumentContent(fleXml, null);
assertFalse("Content cannot be empty.", org.apache.commons.lang.StringUtils.isEmpty(contentVO.getFullContent()));
assertEquals("Attribute content is invalid.", fleXml, contentVO.getAttributeContent());
assertEquals("Searchable content is invalid.", "", contentVO.getSearchableContent());
assertEquals("Application content is invalid.", "", contentVO.getApplicationContent());*/
}
/**
* Tests the conversion of a DocumentContentVO object into an XML String. Includes generating content
* for any attributes which are on the DocumentContentVO object.
*
* TODO there is some crossover between this test and the DocumentContentTest, do we really need both of them???
*/
@Test public void testBuildUpdatedDocumentContent() throws Exception {
String startContent = "<"+DOCUMENT_CONTENT+">";
String endContent = "</"+DOCUMENT_CONTENT+">";
/*
* // test no content, this should return null which indicates an unchanged document content VO
* //RouteHeaderVO routeHeaderVO = new RouteHeaderVO();
*/
// test no content, this should return empty document content
DocumentContent contentVO = DocumentContent.Builder.create("1234").build();
String content = contentVO.getFullContent();
assertEquals("Invalid content conversion.", KEWConstants.DEFAULT_DOCUMENT_CONTENT, content);
// test simple case, no attributes
String attributeContent = "<attribute1><id value=\"3\"/></attribute1>";
String searchableContent = "<searchable1><data>hello</data></searchable1>";
DocumentContent.Builder contentBuilder = DocumentContent.Builder.create("1234");
contentBuilder.setAttributeContent(constructContent(ATTRIBUTE_CONTENT, attributeContent));
contentBuilder.setSearchableContent(constructContent(SEARCHABLE_CONTENT, searchableContent));
contentVO = contentBuilder.build();
content = contentVO.getFullContent();
String fullContent = startContent+constructContent(ATTRIBUTE_CONTENT, attributeContent)+constructContent(SEARCHABLE_CONTENT, searchableContent)+endContent;
assertEquals("Invalid content conversion.", StringUtils.deleteWhitespace(fullContent), StringUtils.deleteWhitespace(content));
// now, add an attribute
String testAttributeContent = new TestRuleAttribute().getDocContent();
WorkflowAttributeDefinition attributeDefinition = WorkflowAttributeDefinition.Builder.create(TestRuleAttribute.class.getName()).build();
DocumentContentUpdate.Builder contentUpdate = DocumentContentUpdate.Builder.create();
contentUpdate.getAttributeDefinitions().add(attributeDefinition);
content = DTOConverter.buildUpdatedDocumentContent(KEWConstants.DEFAULT_DOCUMENT_CONTENT, contentUpdate.build(), null);
fullContent = startContent+
constructContent(ATTRIBUTE_CONTENT, attributeContent+testAttributeContent)+
constructContent(SEARCHABLE_CONTENT, searchableContent)+
endContent;
assertEquals("Invalid content conversion.", StringUtils.deleteWhitespace(fullContent), StringUtils.deleteWhitespace(content));
}
private String constructContent(String type, String content) {
if (org.apache.commons.lang.StringUtils.isEmpty(content)) {
return "";
}
return "<"+type+">"+content+"</"+type+">";
}
private String constructContent(String attributeContent, String searchableContent, String applicationContent) {
return "<"+DOCUMENT_CONTENT+">"+
constructContent(ATTRIBUTE_CONTENT, attributeContent)+
constructContent(SEARCHABLE_CONTENT, searchableContent)+
constructContent(APPLICATION_CONTENT, applicationContent)+
"</"+DOCUMENT_CONTENT+">";
}
private void assertContent(DocumentContent contentVO, String attributeContent, String searchableContent, String applicationContent) throws Exception{
/*if (org.apache.commons.lang.StringUtils.isEmpty(attributeContent)) {
attributeContent = "";
} else {
attributeContent = "<"+ATTRIBUTE_CONTENT+">"+attributeContent+"</"+ATTRIBUTE_CONTENT+">";
}
if (org.apache.commons.lang.StringUtils.isEmpty(searchableContent)) {
searchableContent = "";
} else {
searchableContent = "<"+SEARCHABLE_CONTENT+">"+searchableContent+"</"+SEARCHABLE_CONTENT+">";
}*/
assertFalse("Content cannot be empty.", org.apache.commons.lang.StringUtils.isEmpty(contentVO.getFullContent()));
assertEquals("Attribute content is invalid.", attributeContent.replaceAll("\n", ""),
contentVO.getAttributeContent().replaceAll("\n", ""));
assertEquals("Searchable content is invalid.", searchableContent.replaceAll("\n", ""), contentVO.getSearchableContent().replaceAll(
"\n", ""));
assertEquals("Application content is invalid.", applicationContent.replaceAll("\n", ""), contentVO.getApplicationContent().replaceAll(
"\n", ""));
/*assertEquals("Incorrect number of attribute definitions.", 0, contentVO.get.getAttributeDefinitions().length);
assertEquals("Incorrect number of searchable attribute definitions.", 0, contentVO.getSearchableDefinitions().length);*/
}
@Test public void testConvertActionItem() throws Exception {
// get test data
String testWorkgroupName = "TestWorkgroup";
Group testWorkgroup = KimApiServiceLocator.getGroupService().getGroupByNameAndNamespaceCode(
KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, testWorkgroupName);
String testWorkgroupId = testWorkgroup.getId();
assertTrue("Test workgroup '" + testWorkgroupName + "' should have at least one user", KimApiServiceLocator.getGroupService().getDirectMemberPrincipalIds(
testWorkgroup.getId()).size() > 0);
String workflowId = KimApiServiceLocator.getGroupService().getDirectMemberPrincipalIds(testWorkgroup.getId()).get(0);
assertNotNull("User from workgroup should not be null", workflowId);
String actionRequestCd = KEWConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ;
String actionRequestId = "4";
String docName = "dummy";
String roleName = "fakeRole";
String documentId = "abc23";
Timestamp dateAssigned = new Timestamp(new Date().getTime());
String docHandlerUrl = "http://this.is.not.us";
String docTypeLabel = "Label Me";
String docTitle = "Title me";
String responsibilityId = "35";
String delegationType = DelegationType.PRIMARY.getCode();
// create fake action item
ActionItem actionItem = new ActionItem();
actionItem.setActionRequestCd(actionRequestCd);
actionItem.setActionRequestId(actionRequestId);
actionItem.setDocName(docName);
actionItem.setRoleName(roleName);
actionItem.setPrincipalId(workflowId);
actionItem.setDocumentId(documentId);
actionItem.setDateAssigned(dateAssigned);
actionItem.setDocHandlerURL(docHandlerUrl);
actionItem.setDocLabel(docTypeLabel);
actionItem.setDocTitle(docTitle);
actionItem.setGroupId(testWorkgroupId);
actionItem.setResponsibilityId(responsibilityId);
actionItem.setDelegationType(delegationType);
actionItem.setDelegatorPrincipalId(workflowId);
actionItem.setDelegatorGroupId(testWorkgroupId);
// convert to action item vo object and verify
org.kuali.rice.kew.api.action.ActionItem actionItemVO = ActionItem.to(actionItem);
assertEquals("Action Item VO object has incorrect value", actionRequestCd, actionItemVO.getActionRequestCd());
assertEquals("Action Item VO object has incorrect value", actionRequestId, actionItemVO.getActionRequestId());
assertEquals("Action Item VO object has incorrect value", docName, actionItemVO.getDocName());
assertEquals("Action Item VO object has incorrect value", roleName, actionItemVO.getRoleName());
assertEquals("Action Item VO object has incorrect value", workflowId, actionItemVO.getPrincipalId());
assertEquals("Action Item VO object has incorrect value", documentId, actionItemVO.getDocumentId());
assertEquals("Action Item VO object has incorrect value", new DateTime(dateAssigned.getTime()), actionItemVO.getDateTimeAssigned());
assertEquals("Action Item VO object has incorrect value", docHandlerUrl, actionItemVO.getDocHandlerURL());
assertEquals("Action Item VO object has incorrect value", docTypeLabel, actionItemVO.getDocLabel());
assertEquals("Action Item VO object has incorrect value", docTitle, actionItemVO.getDocTitle());
assertEquals("Action Item VO object has incorrect value", "" + testWorkgroupId, actionItemVO.getGroupId());
assertEquals("Action Item VO object has incorrect value", responsibilityId, actionItemVO.getResponsibilityId());
assertEquals("Action Item VO object has incorrect value", delegationType, actionItemVO.getDelegationType());
assertEquals("Action Item VO object has incorrect value", workflowId, actionItemVO.getDelegatorPrincipalId());
assertEquals("Action Item VO object has incorrect value", testWorkgroupId, actionItemVO.getDelegatorGroupId());
}
}
| {
"content_hash": "4974b8cb729a1260082d794ddea462db",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 194,
"avg_line_length": 59.21311475409836,
"alnum_prop": 0.7187153931339978,
"repo_name": "sbower/kuali-rice-1",
"id": "4ea22b582b0e913caa7e2bec8c98865ed0f3dcf0",
"size": "15071",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "it/kew/src/test/java/org/kuali/rice/kew/server/BeanConverterTester.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/* +---------------------------------------------------------------------------+
| Open MORA (MObile Robot Arquitecture) |
+---------------------------------------------------------------------------+ */
#define MORA_APP_CLASS CLocalizationFusionApp
#define MORA_APP_NAME "LocalizationFusion" // Default MOOSApp app name
#include <mora_main.h>
| {
"content_hash": "8e04ab5676930e13701efbe14ab05687",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 83,
"avg_line_length": 45.44444444444444,
"alnum_prop": 0.34963325183374083,
"repo_name": "OpenMORA/nav-slam-pkg",
"id": "d033efaa6fd366fe9f2e457e7f7c6ef679c97272",
"size": "409",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Localization2D_Fusion/main.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C++",
"bytes": "201220"
}
],
"symlink_target": ""
} |
var mongojs = require('mongojs');
/* istanbul ignore next */
var Mongo = (function() {
'use strict';
var _connection = function(env) {
var username = env.MONGO_USERNAME || '',
password = env.MONGO_PASSWORD || '',
server = env.MONGO_SERVER || '192.168.1.5',
port = env.MONGO_PORT || '27017',
database = env.MONGO_DATABASE || 'buscaza',
auth = username ? username + ':' + password + '@' : '';
return 'mongodb://' + auth + server + ':' + port + '/' + database;
};
var db;
var module = {
_init: function() {
var url = _connection(process.env);
console.log(url);
db = mongojs(url);
// db.on('error', function(err) {
// });
},
findOne: function( collection, query, callback) {
db.collection(collection).findOne(query, callback);
},
insert: function( collection,data, callback) {
db.collection(collection).insert(data, callback);
}
}
module._init();
return module;
}());
module.exports = Mongo; | {
"content_hash": "865cec0b4c0247e9ca0fe49ca8939839",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 70,
"avg_line_length": 20.97872340425532,
"alnum_prop": 0.5862068965517241,
"repo_name": "Cendrao/buscaza",
"id": "f73829d063b26e3eb685886638cb3e69611bcacc",
"size": "986",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/Mongo.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "437"
},
{
"name": "HTML",
"bytes": "2230"
},
{
"name": "JavaScript",
"bytes": "10186"
}
],
"symlink_target": ""
} |
/* First created by JCasGen Sat Oct 02 22:03:55 CEST 2010 */
package example.types.target;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSGenerator;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
/**
* Updated by JCasGen Mon Mar 28 15:53:10 CEST 2011
* @generated */
public class Annotation_Type extends org.apache.uima.jcas.tcas.Annotation_Type {
/** @generated */
protected FSGenerator getFSGenerator() {return fsGenerator;}
/** @generated */
private final FSGenerator fsGenerator =
new FSGenerator() {
public FeatureStructure createFS(int addr, CASImpl cas) {
if (Annotation_Type.this.useExistingInstance) {
// Return eq fs instance if already created
FeatureStructure fs = Annotation_Type.this.jcas.getJfsFromCaddr(addr);
if (null == fs) {
fs = new Annotation(addr, Annotation_Type.this);
Annotation_Type.this.jcas.putJfsFromCaddr(addr, fs);
return fs;
}
return fs;
} else return new Annotation(addr, Annotation_Type.this);
}
};
/** @generated */
public final static int typeIndexID = Annotation.typeIndexID;
/** @generated
@modifiable */
public final static boolean featOkTst = JCasRegistry.getFeatOkTst("example.types.target.Annotation");
/** initialize variables to correspond with Cas Type and Features
* @generated */
public Annotation_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
}
}
| {
"content_hash": "750b747a33561f0188be11dd7f38bd91",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 103,
"avg_line_length": 32.05555555555556,
"alnum_prop": 0.7024841132293472,
"repo_name": "nicolashernandez/dev-star",
"id": "e02c02aadabb65b461bcd2349863020f2821d603",
"size": "1731",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "uima-star/uima-mapper/src/main/java/example/types/target/Annotation_Type.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2511442"
}
],
"symlink_target": ""
} |
package rheimus;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.imageio.ImageIO;
import rheimus.reference.Directories;
import rheimus.reference.TerrainMaps;
public class Main {
private static BufferedImage image;
private static BufferedImage[] imgs;
private static Path workingDirectory, terrainImage, output;
private static String outputPath, mod = "";
private static String[] names = TerrainMaps.v1_4_5; // pc_stage, blank,
// cake_item, water,
// anvil, unknown
public static void main(String[] args) {
workingDirectory = Paths.get("");
terrainImage = Paths.get(workingDirectory.toAbsolutePath().toString() + File.separator + "terrain.png");
output = Paths.get(workingDirectory.toAbsolutePath().toString() + File.separator + "terrain" + File.separator);
try {
Files.createDirectories(output);
image = ImageIO.read(terrainImage.toFile());
} catch (IOException e1) {
e1.printStackTrace();
return;
}
int rows = 16;
int cols = 16;
int chunks = rows * cols;
int chunkWidth = image.getWidth() / cols; // determines the chunk width
// and height
int chunkHeight = image.getHeight() / rows;
int count = 0;
imgs = new BufferedImage[chunks]; // Image array to hold
// image chunks
for (int x = 0; x < rows; x++) {
for (int y = 0; y < cols; y++) {
// Initialize the image array with image chunks
imgs[count] = new BufferedImage(chunkWidth, chunkHeight, image.getType());
// draws the image chunk
Graphics2D gr = imgs[count++].createGraphics();
gr.drawImage(image, 0, 0, chunkWidth, chunkHeight, chunkWidth * y, chunkHeight * x,
chunkWidth * y + chunkWidth, chunkHeight * x + chunkHeight, null);
gr.dispose();
}
}
System.out.println("Splitting done");
int namesLength = names.length;
int blanks = 0;
outputPath = output.toAbsolutePath().toString();
// writing mini images into image files
for (int i = 0; i < imgs.length; i++) {
try {
if (i < namesLength) {
String fileName = names[i];
if (fileName.matches("(water_|lava_|anvil_|chest_)+.?")) {
System.out.println("matched workable items");
mod = "workable";
writeImage(i, fileName);
} else if (fileName.matches("(unknown_|blank)+.?")) {
mod = "misc";
writeImage(i, fileName + blanks++);
} else if (fileName.matches("(pc_stage_)+.+")) {
System.out.println("splitting potatoes and carrots");
mod = Directories.BlocksDirectory;
writeImage(i, fileName.replace("pc_", "potatoes_"));
writeImage(i, fileName.replace("pc_", "carrots_"));
} else if (fileName.matches("(cake_item)+")) {
System.out.println("found cake");
mod = Directories.ItemsDirectory;
writeImage(i, "cake");
} else {
mod = Directories.BlocksDirectory;
writeImage(i, fileName);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("Mini images created");
}
private static void writeImage(int currentFile, String fileName) throws IOException {
Path dir = Paths.get(outputPath + File.separator + mod + File.separator);
Files.createDirectories(dir);
ImageIO.write(imgs[currentFile], "PNG", new File(dir.toAbsolutePath().toString(), fileName + ".png"));
}
}
| {
"content_hash": "e5b99044f65307db78e9f7ea174262e3",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 113,
"avg_line_length": 32.58490566037736,
"alnum_prop": 0.6595251881876085,
"repo_name": "rheimus/texturepack-converter",
"id": "dfe7bf6b48e22c9325a8dfb9d91d8eef4eb556f5",
"size": "3454",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/rheimus/Main.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "20748"
}
],
"symlink_target": ""
} |
---
id: reusable-components
title: Reusable Components
permalink: reusable-components.html
prev: multiple-components.html
next: transferring-props.html
---
When designing interfaces, break down the common design elements (buttons, form fields, layout components, etc.) into reusable components with well-defined interfaces. That way, the next time you need to build some UI, you can write much less code. This means faster development time, fewer bugs, and fewer bytes down the wire.
## Prop Validation
As your app grows it's helpful to ensure that your components are used correctly. We do this by allowing you to specify `propTypes`. `React.PropTypes` exports a range of validators that can be used to make sure the data you receive is valid. When an invalid value is provided for a prop, a warning will be shown in the JavaScript console. Note that for performance reasons `propTypes` is only checked in development mode. Here is an example documenting the different validators provided:
```javascript
React.createClass({
propTypes: {
// You can declare that a prop is a specific JS primitive. By default, these
// are all optional.
optionalArray: React.PropTypes.array,
optionalBool: React.PropTypes.bool,
optionalFunc: React.PropTypes.func,
optionalNumber: React.PropTypes.number,
optionalObject: React.PropTypes.object,
optionalString: React.PropTypes.string,
// Anything that can be rendered: numbers, strings, elements or an array
// (or fragment) containing these types.
optionalNode: React.PropTypes.node,
// A React element.
optionalElement: React.PropTypes.element,
// You can also declare that a prop is an instance of a class. This uses
// JS's instanceof operator.
optionalMessage: React.PropTypes.instanceOf(Message),
// You can ensure that your prop is limited to specific values by treating
// it as an enum.
optionalEnum: React.PropTypes.oneOf(['News', 'Photos']),
// An object that could be one of many types
optionalUnion: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number,
React.PropTypes.instanceOf(Message)
]),
// An array of a certain type
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
// An object with property values of a certain type
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
// An object taking on a particular shape
optionalObjectWithShape: React.PropTypes.shape({
color: React.PropTypes.string,
fontSize: React.PropTypes.number
}),
// You can chain any of the above with `isRequired` to make sure a warning
// is shown if the prop isn't provided.
requiredFunc: React.PropTypes.func.isRequired,
// A value of any data type
requiredAny: React.PropTypes.any.isRequired,
// You can also specify a custom validator. It should return an Error
// object if the validation fails. Don't `console.warn` or throw, as this
// won't work inside `oneOfType`.
customProp: function(props, propName, componentName) {
if (!/matchme/.test(props[propName])) {
return new Error('Validation failed!');
}
}
},
/* ... */
});
```
### Single Child
With `React.PropTypes.element` you can specify that only a single child can be passed to a component as children.
```javascript
var MyComponent = React.createClass({
propTypes: {
children: React.PropTypes.element.isRequired
},
render: function() {
return (
<div>
{this.props.children} // This must be exactly one element or it will warn.
</div>
);
}
});
```
## Default Prop Values
React lets you define default values for your `props` in a very declarative way:
```javascript
var ComponentWithDefaultProps = React.createClass({
getDefaultProps: function() {
return {
value: 'default value'
};
}
/* ... */
});
```
The result of `getDefaultProps()` will be cached and used to ensure that `this.props.value` will have a value if it was not specified by the parent component. This allows you to safely just use your props without having to write repetitive and fragile code to handle that yourself.
## Transferring Props: A Shortcut
A common type of React component is one that extends a basic HTML element in a simple way. Often you'll want to copy any HTML attributes passed to your component to the underlying HTML element. To save typing, you can use the JSX _spread_ syntax to achieve this:
```javascript
var CheckLink = React.createClass({
render: function() {
// This takes any props passed to CheckLink and copies them to <a>
return <a {...this.props}>{'√ '}{this.props.children}</a>;
}
});
ReactDOM.render(
<CheckLink href="/checked.html">
Click here!
</CheckLink>,
document.getElementById('example')
);
```
## Mixins
Components are the best way to reuse code in React, but sometimes very different components may share some common functionality. These are sometimes called [cross-cutting concerns](https://en.wikipedia.org/wiki/Cross-cutting_concern). React provides `mixins` to solve this problem.
One common use case is a component wanting to update itself on a time interval. It's easy to use `setInterval()`, but it's important to cancel your interval when you don't need it anymore to save memory. React provides [lifecycle methods](/react/docs/working-with-the-browser.html#component-lifecycle) that let you know when a component is about to be created or destroyed. Let's create a simple mixin that uses these methods to provide an easy `setInterval()` function that will automatically get cleaned up when your component is destroyed.
```javascript
var SetIntervalMixin = {
componentWillMount: function() {
this.intervals = [];
},
setInterval: function() {
this.intervals.push(setInterval.apply(null, arguments));
},
componentWillUnmount: function() {
this.intervals.forEach(clearInterval);
}
};
var TickTock = React.createClass({
mixins: [SetIntervalMixin], // Use the mixin
getInitialState: function() {
return {seconds: 0};
},
componentDidMount: function() {
this.setInterval(this.tick, 1000); // Call a method on the mixin
},
tick: function() {
this.setState({seconds: this.state.seconds + 1});
},
render: function() {
return (
<p>
React has been running for {this.state.seconds} seconds.
</p>
);
}
});
ReactDOM.render(
<TickTock />,
document.getElementById('example')
);
```
A nice feature of mixins is that if a component is using multiple mixins and several mixins define the same lifecycle method (i.e. several mixins want to do some cleanup when the component is destroyed), all of the lifecycle methods are guaranteed to be called. Methods defined on mixins run in the order mixins were listed, followed by a method call on the component.
## ES6 Classes
You may also define your React classes as a plain JavaScript class. For example using ES6 class syntax:
```javascript
class HelloMessage extends React.Component {
render() {
return <div>Hello {this.props.name}</div>;
}
}
ReactDOM.render(<HelloMessage name="Sebastian" />, mountNode);
```
The API is similar to `React.createClass` with the exception of `getInitialState`. Instead of providing a separate `getInitialState` method, you set up your own `state` property in the constructor.
Another difference is that `propTypes` and `defaultProps` are defined as properties on the constructor instead of in the class body.
```javascript
export class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {count: props.initialCount};
}
tick() {
this.setState({count: this.state.count + 1});
}
render() {
return (
<div onClick={this.tick.bind(this)}>
Clicks: {this.state.count}
</div>
);
}
}
Counter.propTypes = { initialCount: React.PropTypes.number };
Counter.defaultProps = { initialCount: 0 };
```
### No Autobinding
Methods follow the same semantics as regular ES6 classes, meaning that they don't automatically bind `this` to the instance. You'll have to explicitly use `.bind(this)` or [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) `=>`.
### No Mixins
Unfortunately ES6 launched without any mixin support. Therefore, there is no support for mixins when you use React with ES6 classes. Instead, we're working on making it easier to support such use cases without resorting to mixins.
## Stateless Functions
You may also define your React classes as a plain JavaScript function. For example using the stateless function syntax:
```javascript
function HelloMessage(props) {
return <div>Hello {props.name}</div>;
}
ReactDOM.render(<HelloMessage name="Sebastian" />, mountNode);
```
Or using the new ES6 arrow syntax:
```javascript
var HelloMessage = (props) => <div>Hello {props.name}</div>;
ReactDOM.render(<HelloMessage name="Sebastian" />, mountNode);
```
This simplified component API is intended for components that are pure functions of their props. These components must not retain internal state, do not have backing instances, and do not have the component lifecycle methods. They are pure functional transforms of their input, with zero boilerplate.
However, you may still specify `.propTypes` and `.defaultProps` by setting them as properties on the function, just as you would set them on an ES6 class.
> NOTE:
>
> Because stateless functions don't have a backing instance, you can't attach a ref to a stateless function component. Normally this isn't an issue, since stateless functions do not provide an imperative API. Without an imperative API, there isn't much you could do with an instance anyway. However, if a user wants to find the DOM node of a stateless function component, they must wrap the component in a stateful component (eg. ES6 class component) and attach the ref to the stateful wrapper component.
In an ideal world, most of your components would be stateless functions because these stateless components can follow a faster code path within the React core. This is the recommended pattern, when possible.
| {
"content_hash": "d3bc6903a295d3b3acc5bd819f796e7b",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 542,
"avg_line_length": 39.78599221789883,
"alnum_prop": 0.731638141809291,
"repo_name": "dortonway/react",
"id": "0808d1028f5d4842b36f948d2c326ae2b42ef6f2",
"size": "10227",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "docs/docs/05-reusable-components.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "5338"
},
{
"name": "C++",
"bytes": "44951"
},
{
"name": "CoffeeScript",
"bytes": "11778"
},
{
"name": "JavaScript",
"bytes": "1973913"
},
{
"name": "Makefile",
"bytes": "189"
},
{
"name": "Python",
"bytes": "8289"
},
{
"name": "Shell",
"bytes": "525"
},
{
"name": "TypeScript",
"bytes": "15442"
}
],
"symlink_target": ""
} |
package madgik.exareme.common.schema;
import madgik.exareme.common.schema.expression.SQLSelect;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
/**
* @author herald
* @author Christoforos Svingos
*/
public class Select extends Query {
private static final long serialVersionUID = 1L;
private String comments = null;
private TableView outputTable = null;
private ArrayList<TableView> inputTables = null;
private HashMap<String, TableView> inputTablesMap = null;
private SQLSelect parsedSqlQuery = null;
private List<String> queryStatements = null;
private String createIndex = null;
private String extraCommands = null;
public Select(int id, SQLSelect sqlQuery, TableView outputTable) {
super(id, sqlQuery.getSql(), sqlQuery.getComments().toString());
this.outputTable = outputTable;
this.parsedSqlQuery = sqlQuery;
this.comments = parsedSqlQuery.getComments().toString();
this.inputTables = new ArrayList<>();
this.inputTablesMap = new HashMap<>();
this.queryStatements = new ArrayList<>();
}
public void addInput(TableView input) {
inputTables.add(input);
inputTablesMap.put(input.getName(), input);
}
public void addQueryStatement(String query) {
this.queryStatements.add(query);
}
public void clearQueryStatement() {
this.queryStatements.clear();
}
public List<String> getQueryStatements() {
return this.queryStatements;
}
public String getSelectQueryStatement() {
String query;
if (this.queryStatements.size() == 0) {
query = getQuery();
} else {
query = this.queryStatements.get(this.queryStatements.size() - 1);
}
return query;
}
public TableView getOutputTable() {
return outputTable;
}
public void setOutputTable(TableView outputTable) {
this.outputTable = outputTable;
}
public List<TableView> getInputTables() {
return Collections.unmodifiableList(inputTables);
}
public void clearInputTables() {
inputTables.clear();
inputTablesMap.clear();
}
public SQLSelect getParsedSqlQuery() {
return parsedSqlQuery;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Database : " + getDatabaseDir() + "\n");
if (outputTable != null) {
sb.append("Output : " + outputTable.toString() + "\n");
} else {
sb.append("Output : --\n");
}
sb.append("Inputs : " + inputTables.size() + "\n");
for (TableView in : inputTables) {
sb.append(" -> : " + in.toString() + "\n");
}
if (comments != null) {
sb.append(comments);
}
sb.append(getQuery() + ";");
return sb.toString();
}
public void setIndexCommand(String query) {
this.createIndex = query;
}
public String getIndexCommand() {
return this.createIndex;
}
public void setExtraCommand(String cm) {
this.extraCommands = cm;
}
public String getExtraCommand() {
return extraCommands;
}
}
| {
"content_hash": "7ad91e6b4197ac8a9247e001531ef68a",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 69,
"avg_line_length": 22.874015748031496,
"alnum_prop": 0.7049913941480207,
"repo_name": "XristosMallios/cache",
"id": "6dba6d7e824f6fc9ae6305a73c43cc0a63515c23",
"size": "2951",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "exareme-common/src/main/java/madgik/exareme/common/schema/Select.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "66130"
},
{
"name": "HTML",
"bytes": "1330883"
},
{
"name": "Java",
"bytes": "4022490"
},
{
"name": "JavaScript",
"bytes": "6100034"
},
{
"name": "PHP",
"bytes": "124335"
},
{
"name": "Python",
"bytes": "2478415"
},
{
"name": "R",
"bytes": "671"
},
{
"name": "Shell",
"bytes": "15240"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace Sannel.House.Thermostat.Converters
{
public class BooleanNotVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
bool? b = value as bool?;
if (b == false)
{
return Visibility.Visible;
}
else
{
return Visibility.Collapsed;
}
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
| {
"content_hash": "54301d6713f88c16f65245561d421d3d",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 93,
"avg_line_length": 21.516129032258064,
"alnum_prop": 0.7301349325337332,
"repo_name": "holtsoftware/House",
"id": "5456b07b12087c65ad2d2465bd0f7bd4214f8578",
"size": "669",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Sannel.House.ThermostatOld/Sannel.House.Thermostat/Converters/BooleanNotVisibilityConverter.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "881838"
},
{
"name": "CSS",
"bytes": "150889"
},
{
"name": "Eagle",
"bytes": "137047"
},
{
"name": "HTML",
"bytes": "6663"
},
{
"name": "JavaScript",
"bytes": "5025"
},
{
"name": "OpenSCAD",
"bytes": "5157"
},
{
"name": "PowerShell",
"bytes": "49409"
},
{
"name": "TypeScript",
"bytes": "3847"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<!-- global suppressions -->
<suppress checks="AbbreviationAsWordInName" files="^src[\\/](main|test)[\\/]java"/>
<suppress checks="JavadocMethod" files="^src[\\/](main|test)[\\/]java"/>
<suppress checks="Indentation" files="^src[\\/](main|test)[\\/]java"/>
<suppress checks="JavadocMethod" files="^src[\\/](main|test)[\\/]java"/>
</suppressions>
| {
"content_hash": "a97e57838ac703f285393197ec5106bc",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 127,
"avg_line_length": 54.9,
"alnum_prop": 0.6520947176684881,
"repo_name": "BlockJamMC/BlockJamCore",
"id": "29054aa13cb4efa4702c65ae99ea9f695f896bc4",
"size": "549",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "etc/checkstyle-suppressions.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "26005"
}
],
"symlink_target": ""
} |
'use strict';
function pickValues(obj, keys){
if(!Array.isArray(keys)){
keys = [keys];
}
return keys.map(function(key){
return obj[key];
});
}
module.exports = pickValues;
| {
"content_hash": "041bb5e21c0cb23e6dd21e75d1e21ace",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 32,
"avg_line_length": 14.692307692307692,
"alnum_prop": 0.6230366492146597,
"repo_name": "phated/pick-values",
"id": "7b46f1743488d2b072e648efc4579741da6ebd17",
"size": "191",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1387"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--build.xml generated by maven from project.xml version 0.1-SNAPSHOT
on date August 3 2006, time 2311-->
<project default="jar" name="commons-id" basedir=".">
<!--Load local and user build preferences-->
<property file="build.properties">
</property>
<property file="${user.home}/build.properties">
</property>
<!--Build properties-->
<property name="defaulttargetdir" value="${basedir}/target">
</property>
<property name="libdir" value="${user.home}/.maven/repository">
</property>
<property name="classesdir" value="${basedir}/target/classes">
</property>
<property name="testclassesdir" value="${basedir}/target/test-classes">
</property>
<property name="testreportdir" value="${basedir}/target/test-reports">
</property>
<property name="distdir" value="${basedir}/dist">
</property>
<property name="javadocdir" value="${basedir}/dist/docs/api">
</property>
<property name="final.name" value="commons-id-0.1-SNAPSHOT">
</property>
<property name="proxy.host" value="">
</property>
<property name="proxy.port" value="">
</property>
<property name="proxy.username" value="">
</property>
<property name="proxy.password" value="">
</property>
<path id="build.classpath">
<pathelement location="${libdir}/commons-discovery/jars/commons-discovery-0.2.jar">
</pathelement>
<pathelement location="${libdir}/commons-logging/jars/commons-logging-1.0.3.jar">
</pathelement>
<pathelement location="${libdir}/ant/jars/ant-1.5.3-1.jar">
</pathelement>
<pathelement location="${libdir}/junit/jars/junit-3.8.1.jar">
</pathelement>
<pathelement location="${libdir}/maven-plugins/plugins/maven-cobertura-plugin-1.1.1.jar">
</pathelement>
<pathelement location="${libdir}/maven/plugins/maven-xdoc-plugin-1.9.2.jar">
</pathelement>
</path>
<target name="init" description="o Initializes some properties">
<mkdir dir="${libdir}">
</mkdir>
<condition property="noget">
<equals arg2="only" arg1="${build.sysclasspath}">
</equals>
</condition>
<!--Test if JUNIT is present in ANT classpath-->
<available property="Junit.present" classname="junit.framework.Test">
</available>
<!--Test if user defined a proxy-->
<condition property="useProxy">
<and>
<isset property="proxy.host">
</isset>
<not>
<equals trim="true" arg2="" arg1="${proxy.host}">
</equals>
</not>
</and>
</condition>
</target>
<target name="compile" description="o Compile the code" depends="get-deps">
<mkdir dir="${classesdir}">
</mkdir>
<javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
<src>
<pathelement location="${basedir}/src/java">
</pathelement>
</src>
<classpath refid="build.classpath">
</classpath>
</javac>
</target>
<target name="jar" description="o Create the jar" depends="compile,test">
<jar jarfile="${defaulttargetdir}/${final.name}.jar" excludes="**/package.html" basedir="${classesdir}">
</jar>
</target>
<target name="clean" description="o Clean up the generated directories">
<delete dir="${defaulttargetdir}">
</delete>
<delete dir="${distdir}">
</delete>
</target>
<target name="dist" description="o Create a distribution" depends="jar, javadoc">
<mkdir dir="dist">
</mkdir>
<copy todir="dist">
<fileset dir="${defaulttargetdir}" includes="*.jar">
</fileset>
<fileset dir="${basedir}" includes="LICENSE*, README*">
</fileset>
</copy>
</target>
<target name="test" description="o Run the test cases" if="test.failure" depends="internal-test">
<fail message="There were test failures.">
</fail>
</target>
<target name="internal-test" if="Junit.present" depends="junit-present,compile-tests">
<mkdir dir="${testreportdir}">
</mkdir>
<junit dir="${basedir}" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
<sysproperty key="basedir" value=".">
</sysproperty>
<formatter type="xml">
</formatter>
<formatter usefile="false" type="plain">
</formatter>
<classpath>
<path refid="build.classpath">
</path>
<pathelement path="${testclassesdir}">
</pathelement>
<pathelement path="${classesdir}">
</pathelement>
</classpath>
<batchtest todir="${testreportdir}">
<fileset dir="${basedir}/src/test">
<include name="**/*Test.*">
</include>
</fileset>
</batchtest>
</junit>
</target>
<target name="junit-present" unless="Junit.present" depends="init">
<echo>================================= WARNING ================================</echo>
<echo>Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed.</echo>
<echo>==========================================================================</echo>
</target>
<target name="compile-tests" if="Junit.present" depends="junit-present,compile">
<mkdir dir="${testclassesdir}">
</mkdir>
<javac destdir="${testclassesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
<src>
<pathelement location="${basedir}/src/test">
</pathelement>
</src>
<classpath>
<path refid="build.classpath">
</path>
<pathelement path="${classesdir}">
</pathelement>
</classpath>
</javac>
<copy todir="${testclassesdir}">
<fileset dir="${basedir}/src/test-conf">
<include name="*.state">
</include>
</fileset>
</copy>
</target>
<target name="javadoc" description="o Generate javadoc" depends="get-deps">
<mkdir dir="${javadocdir}">
</mkdir>
<tstamp>
<format pattern="2003-yyyy" property="year">
</format>
</tstamp>
<property name="copyright" value="Copyright &copy; The Apache Software Foundation. All Rights Reserved.">
</property>
<property name="title" value="Commons Id 0.1-SNAPSHOT API">
</property>
<javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="${basedir}/src/java" packagenames="org.apache.commons.id.*">
<classpath>
<path refid="build.classpath">
</path>
</classpath>
</javadoc>
</target>
<target name="get-dep-commons-discovery.jar" description="o Download the dependency : commons-discovery.jar" unless="commons-discovery.jar" depends="init,setProxy,noProxy,get-custom-dep-commons-discovery.jar">
<mkdir dir="${libdir}/commons-discovery/jars/">
</mkdir>
<get dest="${libdir}/commons-discovery/jars/commons-discovery-0.2.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven2/commons-discovery/commons-discovery/0.2/commons-discovery-0.2.jar">
</get>
</target>
<target name="get-custom-dep-commons-discovery.jar" if="commons-discovery.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/commons-discovery/jars/">
</mkdir>
<get dest="${libdir}/commons-discovery/jars/commons-discovery-0.2.jar" usetimestamp="true" ignoreerrors="true" src="${commons-discovery.jar}">
</get>
</target>
<target name="get-dep-commons-logging.jar" description="o Download the dependency : commons-logging.jar" unless="commons-logging.jar" depends="init,setProxy,noProxy,get-custom-dep-commons-logging.jar">
<mkdir dir="${libdir}/commons-logging/jars/">
</mkdir>
<get dest="${libdir}/commons-logging/jars/commons-logging-1.0.3.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven2/commons-logging/commons-logging/1.0.3/commons-logging-1.0.3.jar">
</get>
</target>
<target name="get-custom-dep-commons-logging.jar" if="commons-logging.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/commons-logging/jars/">
</mkdir>
<get dest="${libdir}/commons-logging/jars/commons-logging-1.0.3.jar" usetimestamp="true" ignoreerrors="true" src="${commons-logging.jar}">
</get>
</target>
<target name="get-dep-ant.jar" description="o Download the dependency : ant.jar" unless="ant.jar" depends="init,setProxy,noProxy,get-custom-dep-ant.jar">
<mkdir dir="${libdir}/ant/jars/">
</mkdir>
<get dest="${libdir}/ant/jars/ant-1.5.3-1.jar" usetimestamp="true" ignoreerrors="true" src="http://mirrors.ibiblio.org/pub/mirrors/maven/ant/jars/ant-1.5.3-1.jar">
</get>
</target>
<target name="get-custom-dep-ant.jar" if="ant.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/ant/jars/">
</mkdir>
<get dest="${libdir}/ant/jars/ant-1.5.3-1.jar" usetimestamp="true" ignoreerrors="true" src="${ant.jar}">
</get>
</target>
<target name="get-dep-junit.jar" description="o Download the dependency : junit.jar" unless="junit.jar" depends="init,setProxy,noProxy,get-custom-dep-junit.jar">
<mkdir dir="${libdir}/junit/jars/">
</mkdir>
<get dest="${libdir}/junit/jars/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://mirrors.ibiblio.org/pub/mirrors/maven/junit/jars/junit-3.8.1.jar">
</get>
</target>
<target name="get-custom-dep-junit.jar" if="junit.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/junit/jars/">
</mkdir>
<get dest="${libdir}/junit/jars/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="${junit.jar}">
</get>
</target>
<target name="get-dep-maven-cobertura-plugin.jar" description="o Download the dependency : maven-cobertura-plugin.jar" unless="maven-cobertura-plugin.jar" depends="init,setProxy,noProxy,get-custom-dep-maven-cobertura-plugin.jar">
<mkdir dir="${libdir}/maven-plugins/plugins/">
</mkdir>
<get dest="${libdir}/maven-plugins/plugins/maven-cobertura-plugin-1.1.1.jar" usetimestamp="true" ignoreerrors="true" src="http://mirrors.ibiblio.org/pub/mirrors/maven/maven-plugins/plugins/maven-cobertura-plugin-1.1.1.jar">
</get>
</target>
<target name="get-custom-dep-maven-cobertura-plugin.jar" if="maven-cobertura-plugin.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/maven-plugins/plugins/">
</mkdir>
<get dest="${libdir}/maven-plugins/plugins/maven-cobertura-plugin-1.1.1.jar" usetimestamp="true" ignoreerrors="true" src="${maven-cobertura-plugin.jar}">
</get>
</target>
<target name="get-dep-maven-xdoc-plugin.jar" description="o Download the dependency : maven-xdoc-plugin.jar" unless="maven-xdoc-plugin.jar" depends="init,setProxy,noProxy,get-custom-dep-maven-xdoc-plugin.jar">
<mkdir dir="${libdir}/maven/plugins/">
</mkdir>
<get dest="${libdir}/maven/plugins/maven-xdoc-plugin-1.9.2.jar" usetimestamp="true" ignoreerrors="true" src="http://mirrors.ibiblio.org/pub/mirrors/maven/maven/plugins/maven-xdoc-plugin-1.9.2.jar">
</get>
</target>
<target name="get-custom-dep-maven-xdoc-plugin.jar" if="maven-xdoc-plugin.jar" depends="init,setProxy,noProxy">
<mkdir dir="${libdir}/maven/plugins/">
</mkdir>
<get dest="${libdir}/maven/plugins/maven-xdoc-plugin-1.9.2.jar" usetimestamp="true" ignoreerrors="true" src="${maven-xdoc-plugin.jar}">
</get>
</target>
<target name="get-deps" unless="noget" depends="get-dep-commons-discovery.jar,get-dep-commons-logging.jar,get-dep-ant.jar,get-dep-junit.jar,get-dep-maven-cobertura-plugin.jar,get-dep-maven-xdoc-plugin.jar">
</target>
<target name="setProxy" if="useProxy" depends="init">
<!--Proxy settings works only with a JDK 1.2 and higher.-->
<echo>Proxy used :</echo>
<echo>Proxy host [${proxy.host}]</echo>
<echo>Proxy port [${proxy.port}]</echo>
<echo>Proxy user [${proxy.username}]</echo>
<setproxy proxyuser="${proxy.username}" proxyport="${proxy.port}" proxypassword="${proxy.password}" proxyhost="${proxy.host}">
</setproxy>
</target>
<target name="noProxy" unless="useProxy" depends="init">
<echo>Proxy not used.</echo>
</target>
<target name="install-maven">
<get dest="${user.home}/maven-install-latest.jar" usetimestamp="true" src="${repo}/maven/maven-install-latest.jar">
</get>
<unjar dest="${maven.home}" src="${user.home}/maven-install-latest.jar">
</unjar>
</target>
</project>
| {
"content_hash": "4488157686223a87b9debccaaff4bf4b",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 231,
"avg_line_length": 44.57761732851986,
"alnum_prop": 0.6512795594428248,
"repo_name": "glinmac/commons-id",
"id": "c6b667fdbf9fadeb682fea732ddb5c6ac08ec55d",
"size": "12348",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "build.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "315264"
}
],
"symlink_target": ""
} |
/*!
* # Semantic UI 2.2.7 - Sidebar
* http://github.com/semantic-org/semantic-ui/
*
*
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
/*******************************
Sidebar
*******************************/
/* Sidebar Menu */
.ui.sidebar {
position: fixed;
top: 0;
right: 0;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: none;
transition: none;
will-change: transform;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: hidden;
-webkit-overflow-scrolling: touch;
height: 100% !important;
max-height: 100%;
border-radius: 0em !important;
margin: 0em !important;
overflow-y: auto !important;
z-index: 102;
}
/* GPU Layers for Child Elements */
.ui.sidebar > * {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
/*--------------
Direction
---------------*/
.ui.left.sidebar {
left: auto;
right: 0px;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
.ui.right.sidebar {
left: 0px !important;
right: auto !important;
-webkit-transform: translate3d(-100%, 0%, 0);
transform: translate3d(-100%, 0%, 0);
}
.ui.top.sidebar,
.ui.bottom.sidebar {
width: 100% !important;
height: auto !important;
}
.ui.top.sidebar {
top: 0px !important;
bottom: auto !important;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
.ui.bottom.sidebar {
top: auto !important;
bottom: 0px !important;
-webkit-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
/*--------------
Pushable
---------------*/
.pushable {
height: 100%;
overflow-x: hidden;
padding: 0em !important;
}
/* Whole Page */
body.pushable {
background: #545454 !important;
}
/* Page Context */
.pushable:not(body) {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.pushable:not(body) > .ui.sidebar,
.pushable:not(body) > .fixed,
.pushable:not(body) > .pusher:after {
position: absolute;
}
/*--------------
Fixed
---------------*/
.pushable > .fixed {
position: fixed;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 500ms ease;
transition: -webkit-transform 500ms ease;
transition: transform 500ms ease;
transition: transform 500ms ease, -webkit-transform 500ms ease;
will-change: transform;
z-index: 101;
}
/*--------------
Page
---------------*/
.pushable > .pusher {
position: relative;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
overflow: hidden;
min-height: 100%;
-webkit-transition: -webkit-transform 500ms ease;
transition: -webkit-transform 500ms ease;
transition: transform 500ms ease;
transition: transform 500ms ease, -webkit-transform 500ms ease;
z-index: 2;
}
body.pushable > .pusher {
background: #FFFFFF;
}
/* Pusher should inherit background from context */
.pushable > .pusher {
background: inherit;
}
/*--------------
Dimmer
---------------*/
.pushable > .pusher:after {
position: fixed;
top: 0px;
left: 0px;
content: '';
background-color: rgba(0, 0, 0, 0.4);
overflow: hidden;
opacity: 0;
-webkit-transition: opacity 500ms;
transition: opacity 500ms;
will-change: opacity;
z-index: 1000;
}
/*--------------
Coupling
---------------*/
.ui.sidebar.menu .item {
border-radius: 0em !important;
}
/*******************************
States
*******************************/
/*--------------
Dimmed
---------------*/
.pushable > .pusher.dimmed:after {
width: 100% !important;
height: 100% !important;
opacity: 1 !important;
}
/*--------------
Animating
---------------*/
.ui.animating.sidebar {
visibility: visible;
}
/*--------------
Visible
---------------*/
.ui.visible.sidebar {
visibility: visible;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
/* Shadow Direction */
.ui.left.visible.sidebar,
.ui.right.visible.sidebar {
box-shadow: 0px 0px 20px rgba(34, 36, 38, 0.15);
}
.ui.top.visible.sidebar,
.ui.bottom.visible.sidebar {
box-shadow: 0px 0px 20px rgba(34, 36, 38, 0.15);
}
/* Visible On Load */
.ui.visible.left.sidebar ~ .fixed,
.ui.visible.left.sidebar ~ .pusher {
-webkit-transform: translate3d(-260px, 0, 0);
transform: translate3d(-260px, 0, 0);
}
.ui.visible.right.sidebar ~ .fixed,
.ui.visible.right.sidebar ~ .pusher {
-webkit-transform: translate3d(260px, 0, 0);
transform: translate3d(260px, 0, 0);
}
.ui.visible.top.sidebar ~ .fixed,
.ui.visible.top.sidebar ~ .pusher {
-webkit-transform: translate3d(0, 36px, 0);
transform: translate3d(0, 36px, 0);
}
.ui.visible.bottom.sidebar ~ .fixed,
.ui.visible.bottom.sidebar ~ .pusher {
-webkit-transform: translate3d(0, -36px, 0);
transform: translate3d(0, -36px, 0);
}
/* opposite sides visible forces content overlay */
.ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .fixed,
.ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher,
.ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .fixed,
.ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
/*--------------
iOS
---------------*/
/*
iOS incorrectly sizes document when content
is presented outside of view with 2Dtranslate
*/
html.ios {
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
}
html.ios,
html.ios body {
height: initial !important;
}
/*******************************
Variations
*******************************/
/*--------------
Width
---------------*/
/* Left / Right */
.ui.thin.left.sidebar,
.ui.thin.right.sidebar {
width: 150px;
}
.ui[class*="very thin"].left.sidebar,
.ui[class*="very thin"].right.sidebar {
width: 60px;
}
.ui.left.sidebar,
.ui.right.sidebar {
width: 260px;
}
.ui.wide.left.sidebar,
.ui.wide.right.sidebar {
width: 350px;
}
.ui[class*="very wide"].left.sidebar,
.ui[class*="very wide"].right.sidebar {
width: 475px;
}
/* Left Visible */
.ui.visible.thin.left.sidebar ~ .fixed,
.ui.visible.thin.left.sidebar ~ .pusher {
-webkit-transform: translate3d(-150px, 0, 0);
transform: translate3d(-150px, 0, 0);
}
.ui.visible[class*="very thin"].left.sidebar ~ .fixed,
.ui.visible[class*="very thin"].left.sidebar ~ .pusher {
-webkit-transform: translate3d(-60px, 0, 0);
transform: translate3d(-60px, 0, 0);
}
.ui.visible.wide.left.sidebar ~ .fixed,
.ui.visible.wide.left.sidebar ~ .pusher {
-webkit-transform: translate3d(-350px, 0, 0);
transform: translate3d(-350px, 0, 0);
}
.ui.visible[class*="very wide"].left.sidebar ~ .fixed,
.ui.visible[class*="very wide"].left.sidebar ~ .pusher {
-webkit-transform: translate3d(-475px, 0, 0);
transform: translate3d(-475px, 0, 0);
}
/* Right Visible */
.ui.visible.thin.right.sidebar ~ .fixed,
.ui.visible.thin.right.sidebar ~ .pusher {
-webkit-transform: translate3d(150px, 0, 0);
transform: translate3d(150px, 0, 0);
}
.ui.visible[class*="very thin"].right.sidebar ~ .fixed,
.ui.visible[class*="very thin"].right.sidebar ~ .pusher {
-webkit-transform: translate3d(60px, 0, 0);
transform: translate3d(60px, 0, 0);
}
.ui.visible.wide.right.sidebar ~ .fixed,
.ui.visible.wide.right.sidebar ~ .pusher {
-webkit-transform: translate3d(350px, 0, 0);
transform: translate3d(350px, 0, 0);
}
.ui.visible[class*="very wide"].right.sidebar ~ .fixed,
.ui.visible[class*="very wide"].right.sidebar ~ .pusher {
-webkit-transform: translate3d(475px, 0, 0);
transform: translate3d(475px, 0, 0);
}
/*******************************
Animations
*******************************/
/*--------------
Overlay
---------------*/
/* Set-up */
.ui.overlay.sidebar {
z-index: 102;
}
/* Initial */
.ui.left.overlay.sidebar {
-webkit-transform: translate3d(100%, 0%, 0);
transform: translate3d(100%, 0%, 0);
}
.ui.right.overlay.sidebar {
-webkit-transform: translate3d(-100%, 0%, 0);
transform: translate3d(-100%, 0%, 0);
}
.ui.top.overlay.sidebar {
-webkit-transform: translate3d(0%, -100%, 0);
transform: translate3d(0%, -100%, 0);
}
.ui.bottom.overlay.sidebar {
-webkit-transform: translate3d(0%, 100%, 0);
transform: translate3d(0%, 100%, 0);
}
/* Animation */
.animating.ui.overlay.sidebar,
.ui.visible.overlay.sidebar {
-webkit-transition: -webkit-transform 500ms ease;
transition: -webkit-transform 500ms ease;
transition: transform 500ms ease;
transition: transform 500ms ease, -webkit-transform 500ms ease;
}
/* End - Sidebar */
.ui.visible.left.overlay.sidebar {
-webkit-transform: translate3d(0%, 0%, 0);
transform: translate3d(0%, 0%, 0);
}
.ui.visible.right.overlay.sidebar {
-webkit-transform: translate3d(0%, 0%, 0);
transform: translate3d(0%, 0%, 0);
}
.ui.visible.top.overlay.sidebar {
-webkit-transform: translate3d(0%, 0%, 0);
transform: translate3d(0%, 0%, 0);
}
.ui.visible.bottom.overlay.sidebar {
-webkit-transform: translate3d(0%, 0%, 0);
transform: translate3d(0%, 0%, 0);
}
/* End - Pusher */
.ui.visible.overlay.sidebar ~ .fixed,
.ui.visible.overlay.sidebar ~ .pusher {
-webkit-transform: none !important;
transform: none !important;
}
/*--------------
Push
---------------*/
/* Initial */
.ui.push.sidebar {
-webkit-transition: -webkit-transform 500ms ease;
transition: -webkit-transform 500ms ease;
transition: transform 500ms ease;
transition: transform 500ms ease, -webkit-transform 500ms ease;
z-index: 102;
}
/* Sidebar - Initial */
.ui.left.push.sidebar {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
.ui.right.push.sidebar {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
.ui.top.push.sidebar {
-webkit-transform: translate3d(0%, -100%, 0);
transform: translate3d(0%, -100%, 0);
}
.ui.bottom.push.sidebar {
-webkit-transform: translate3d(0%, 100%, 0);
transform: translate3d(0%, 100%, 0);
}
/* End */
.ui.visible.push.sidebar {
-webkit-transform: translate3d(0%, 0, 0);
transform: translate3d(0%, 0, 0);
}
/*--------------
Uncover
---------------*/
/* Initial */
.ui.uncover.sidebar {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
z-index: 1;
}
/* End */
.ui.visible.uncover.sidebar {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-transition: -webkit-transform 500ms ease;
transition: -webkit-transform 500ms ease;
transition: transform 500ms ease;
transition: transform 500ms ease, -webkit-transform 500ms ease;
}
/*--------------
Slide Along
---------------*/
/* Initial */
.ui.slide.along.sidebar {
z-index: 1;
}
/* Sidebar - Initial */
.ui.left.slide.along.sidebar {
-webkit-transform: translate3d(50%, 0, 0);
transform: translate3d(50%, 0, 0);
}
.ui.right.slide.along.sidebar {
-webkit-transform: translate3d(-50%, 0, 0);
transform: translate3d(-50%, 0, 0);
}
.ui.top.slide.along.sidebar {
-webkit-transform: translate3d(0, -50%, 0);
transform: translate3d(0, -50%, 0);
}
.ui.bottom.slide.along.sidebar {
-webkit-transform: translate3d(0%, 50%, 0);
transform: translate3d(0%, 50%, 0);
}
/* Animation */
.ui.animating.slide.along.sidebar {
-webkit-transition: -webkit-transform 500ms ease;
transition: -webkit-transform 500ms ease;
transition: transform 500ms ease;
transition: transform 500ms ease, -webkit-transform 500ms ease;
}
/* End */
.ui.visible.slide.along.sidebar {
-webkit-transform: translate3d(0%, 0, 0);
transform: translate3d(0%, 0, 0);
}
/*--------------
Slide Out
---------------*/
/* Initial */
.ui.slide.out.sidebar {
z-index: 1;
}
/* Sidebar - Initial */
.ui.left.slide.out.sidebar {
-webkit-transform: translate3d(-50%, 0, 0);
transform: translate3d(-50%, 0, 0);
}
.ui.right.slide.out.sidebar {
-webkit-transform: translate3d(50%, 0, 0);
transform: translate3d(50%, 0, 0);
}
.ui.top.slide.out.sidebar {
-webkit-transform: translate3d(0%, 50%, 0);
transform: translate3d(0%, 50%, 0);
}
.ui.bottom.slide.out.sidebar {
-webkit-transform: translate3d(0%, -50%, 0);
transform: translate3d(0%, -50%, 0);
}
/* Animation */
.ui.animating.slide.out.sidebar {
-webkit-transition: -webkit-transform 500ms ease;
transition: -webkit-transform 500ms ease;
transition: transform 500ms ease;
transition: transform 500ms ease, -webkit-transform 500ms ease;
}
/* End */
.ui.visible.slide.out.sidebar {
-webkit-transform: translate3d(0%, 0, 0);
transform: translate3d(0%, 0, 0);
}
/*--------------
Scale Down
---------------*/
/* Initial */
.ui.scale.down.sidebar {
-webkit-transition: -webkit-transform 500ms ease;
transition: -webkit-transform 500ms ease;
transition: transform 500ms ease;
transition: transform 500ms ease, -webkit-transform 500ms ease;
z-index: 102;
}
/* Sidebar - Initial */
.ui.left.scale.down.sidebar {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
.ui.right.scale.down.sidebar {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
}
.ui.top.scale.down.sidebar {
-webkit-transform: translate3d(0%, -100%, 0);
transform: translate3d(0%, -100%, 0);
}
.ui.bottom.scale.down.sidebar {
-webkit-transform: translate3d(0%, 100%, 0);
transform: translate3d(0%, 100%, 0);
}
/* Pusher - Initial */
.ui.scale.down.left.sidebar ~ .pusher {
-webkit-transform-origin: 25% 50%;
transform-origin: 25% 50%;
}
.ui.scale.down.right.sidebar ~ .pusher {
-webkit-transform-origin: 75% 50%;
transform-origin: 75% 50%;
}
.ui.scale.down.top.sidebar ~ .pusher {
-webkit-transform-origin: 50% 75%;
transform-origin: 50% 75%;
}
.ui.scale.down.bottom.sidebar ~ .pusher {
-webkit-transform-origin: 50% 25%;
transform-origin: 50% 25%;
}
/* Animation */
.ui.animating.scale.down > .visible.ui.sidebar {
-webkit-transition: -webkit-transform 500ms ease;
transition: -webkit-transform 500ms ease;
transition: transform 500ms ease;
transition: transform 500ms ease, -webkit-transform 500ms ease;
}
.ui.visible.scale.down.sidebar ~ .pusher,
.ui.animating.scale.down.sidebar ~ .pusher {
display: block !important;
width: 100%;
height: 100%;
overflow: hidden !important;
}
/* End */
.ui.visible.scale.down.sidebar {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
.ui.visible.scale.down.sidebar ~ .pusher {
-webkit-transform: scale(0.75);
transform: scale(0.75);
}
/*******************************
Theme Overrides
*******************************/
/*******************************
Site Overrides
*******************************/
| {
"content_hash": "4f4e585614f39210e8cccd83f6313359",
"timestamp": "",
"source": "github",
"line_count": 638,
"max_line_length": 65,
"avg_line_length": 23.863636363636363,
"alnum_prop": 0.6096551724137931,
"repo_name": "mban94/frapid",
"id": "0f009d0f0edcb39741d25b2ebe966072b4a02923",
"size": "15225",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "src/Frapid.Web/scripts/semantic-ui/components/sidebar.rtl.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ABAP",
"bytes": "962"
},
{
"name": "ActionScript",
"bytes": "1133"
},
{
"name": "Ada",
"bytes": "99"
},
{
"name": "Assembly",
"bytes": "549"
},
{
"name": "AutoHotkey",
"bytes": "720"
},
{
"name": "Batchfile",
"bytes": "14568"
},
{
"name": "C#",
"bytes": "1657757"
},
{
"name": "C++",
"bytes": "806"
},
{
"name": "COBOL",
"bytes": "4"
},
{
"name": "CSS",
"bytes": "6041337"
},
{
"name": "Cirru",
"bytes": "520"
},
{
"name": "Clojure",
"bytes": "794"
},
{
"name": "CoffeeScript",
"bytes": "403"
},
{
"name": "ColdFusion",
"bytes": "86"
},
{
"name": "Common Lisp",
"bytes": "632"
},
{
"name": "D",
"bytes": "324"
},
{
"name": "Dart",
"bytes": "489"
},
{
"name": "Eiffel",
"bytes": "375"
},
{
"name": "Elixir",
"bytes": "692"
},
{
"name": "Elm",
"bytes": "487"
},
{
"name": "Erlang",
"bytes": "487"
},
{
"name": "Forth",
"bytes": "979"
},
{
"name": "FreeMarker",
"bytes": "1017"
},
{
"name": "GLSL",
"bytes": "512"
},
{
"name": "Gherkin",
"bytes": "699"
},
{
"name": "Go",
"bytes": "641"
},
{
"name": "Groovy",
"bytes": "1080"
},
{
"name": "HTML",
"bytes": "713250"
},
{
"name": "Haskell",
"bytes": "512"
},
{
"name": "Haxe",
"bytes": "447"
},
{
"name": "Io",
"bytes": "140"
},
{
"name": "JSONiq",
"bytes": "4"
},
{
"name": "Java",
"bytes": "1550"
},
{
"name": "JavaScript",
"bytes": "30121230"
},
{
"name": "Julia",
"bytes": "210"
},
{
"name": "LSL",
"bytes": "2080"
},
{
"name": "Lean",
"bytes": "213"
},
{
"name": "Liquid",
"bytes": "1883"
},
{
"name": "LiveScript",
"bytes": "5790"
},
{
"name": "Lua",
"bytes": "981"
},
{
"name": "Makefile",
"bytes": "5929"
},
{
"name": "Mask",
"bytes": "597"
},
{
"name": "Matlab",
"bytes": "203"
},
{
"name": "Nix",
"bytes": "2212"
},
{
"name": "OCaml",
"bytes": "539"
},
{
"name": "Objective-C",
"bytes": "2672"
},
{
"name": "OpenSCAD",
"bytes": "333"
},
{
"name": "PHP",
"bytes": "7793"
},
{
"name": "PLpgSQL",
"bytes": "720523"
},
{
"name": "Pascal",
"bytes": "267634"
},
{
"name": "Perl",
"bytes": "678"
},
{
"name": "PowerShell",
"bytes": "417452"
},
{
"name": "Protocol Buffer",
"bytes": "274"
},
{
"name": "Puppet",
"bytes": "1944"
},
{
"name": "Python",
"bytes": "478"
},
{
"name": "R",
"bytes": "2445"
},
{
"name": "Roff",
"bytes": "2072"
},
{
"name": "Ruby",
"bytes": "531"
},
{
"name": "Rust",
"bytes": "495"
},
{
"name": "SQLPL",
"bytes": "239383"
},
{
"name": "Scala",
"bytes": "1541"
},
{
"name": "Scheme",
"bytes": "559"
},
{
"name": "Shell",
"bytes": "1154"
},
{
"name": "Swift",
"bytes": "476"
},
{
"name": "Tcl",
"bytes": "899"
},
{
"name": "TeX",
"bytes": "1345"
},
{
"name": "TypeScript",
"bytes": "1607"
},
{
"name": "VHDL",
"bytes": "830"
},
{
"name": "Vala",
"bytes": "485"
},
{
"name": "Verilog",
"bytes": "274"
},
{
"name": "Visual Basic",
"bytes": "916"
},
{
"name": "XQuery",
"bytes": "114"
}
],
"symlink_target": ""
} |
// Template Source: BaseEntity.java.tt
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.models;
import com.microsoft.graph.serializer.ISerializer;
import com.microsoft.graph.serializer.IJsonBackedObject;
import com.microsoft.graph.serializer.AdditionalDataManager;
import java.util.EnumSet;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Thumbnail Column.
*/
public class ThumbnailColumn implements IJsonBackedObject {
/** the OData type of the object as returned by the service */
@SerializedName("@odata.type")
@Expose
@Nullable
public String oDataType;
private transient AdditionalDataManager additionalDataManager = new AdditionalDataManager(this);
@Override
@Nonnull
public final AdditionalDataManager additionalDataManager() {
return additionalDataManager;
}
/**
* Sets the raw JSON object
*
* @param serializer the serializer
* @param json the JSON object to set this object to
*/
public void setRawObject(@Nonnull final ISerializer serializer, @Nonnull final JsonObject json) {
}
}
| {
"content_hash": "1489539811566493247c3f5cbd1c66db",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 152,
"avg_line_length": 32.8,
"alnum_prop": 0.676829268292683,
"repo_name": "microsoftgraph/msgraph-sdk-java",
"id": "1416c345f97c4cf374fbd561fe1b7b7176f056ef",
"size": "1640",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "src/main/java/com/microsoft/graph/models/ThumbnailColumn.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "27286837"
},
{
"name": "PowerShell",
"bytes": "5635"
}
],
"symlink_target": ""
} |
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/gcm_driver/instance_id/instance_id_android.h"
#include <stdint.h>
#include <memory>
#include <numeric>
#include "base/android/jni_android.h"
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "components/gcm_driver/instance_id/android/jni_headers/InstanceIDBridge_jni.h"
using base::android::AttachCurrentThread;
using base::android::ConvertJavaStringToUTF8;
using base::android::ConvertUTF8ToJavaString;
namespace instance_id {
InstanceIDAndroid::ScopedBlockOnAsyncTasksForTesting::
ScopedBlockOnAsyncTasksForTesting() {
JNIEnv* env = AttachCurrentThread();
previous_value_ =
Java_InstanceIDBridge_setBlockOnAsyncTasksForTesting(env, true);
}
InstanceIDAndroid::ScopedBlockOnAsyncTasksForTesting::
~ScopedBlockOnAsyncTasksForTesting() {
JNIEnv* env = AttachCurrentThread();
Java_InstanceIDBridge_setBlockOnAsyncTasksForTesting(env, previous_value_);
}
// static
std::unique_ptr<InstanceID> InstanceID::CreateInternal(
const std::string& app_id,
gcm::GCMDriver* gcm_driver) {
return std::make_unique<InstanceIDAndroid>(app_id, gcm_driver);
}
InstanceIDAndroid::InstanceIDAndroid(const std::string& app_id,
gcm::GCMDriver* gcm_driver)
: InstanceID(app_id, gcm_driver) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!app_id.empty()) << "Empty app_id is not supported";
// The |app_id| is stored in GCM's category field by the desktop InstanceID
// implementation, but because the category is reserved for the app's package
// name on Android the subtype field is used instead.
std::string subtype = app_id;
JNIEnv* env = AttachCurrentThread();
java_ref_.Reset(
Java_InstanceIDBridge_create(env, reinterpret_cast<intptr_t>(this),
ConvertUTF8ToJavaString(env, subtype)));
}
InstanceIDAndroid::~InstanceIDAndroid() {
DCHECK(thread_checker_.CalledOnValidThread());
JNIEnv* env = AttachCurrentThread();
Java_InstanceIDBridge_destroy(env, java_ref_);
}
void InstanceIDAndroid::GetID(GetIDCallback callback) {
DCHECK(thread_checker_.CalledOnValidThread());
int32_t request_id = get_id_callbacks_.Add(
std::make_unique<GetIDCallback>(std::move(callback)));
JNIEnv* env = AttachCurrentThread();
Java_InstanceIDBridge_getId(env, java_ref_, request_id);
}
void InstanceIDAndroid::GetCreationTime(GetCreationTimeCallback callback) {
DCHECK(thread_checker_.CalledOnValidThread());
int32_t request_id = get_creation_time_callbacks_.Add(
std::make_unique<GetCreationTimeCallback>(std::move(callback)));
JNIEnv* env = AttachCurrentThread();
Java_InstanceIDBridge_getCreationTime(env, java_ref_, request_id);
}
void InstanceIDAndroid::GetToken(
const std::string& authorized_entity,
const std::string& scope,
base::TimeDelta time_to_live,
const std::map<std::string, std::string>& options,
std::set<Flags> flags,
GetTokenCallback callback) {
DCHECK(thread_checker_.CalledOnValidThread());
UMA_HISTOGRAM_COUNTS_100("InstanceID.GetToken.OptionsCount", options.size());
if (!time_to_live.is_zero()) {
LOG(WARNING) << "Non-zero TTL requested for InstanceID token, while TTLs"
" are not supported by Android Firebase IID API.";
}
int32_t request_id = get_token_callbacks_.Add(
std::make_unique<GetTokenCallback>(std::move(callback)));
std::vector<std::string> options_strings;
for (const auto& entry : options) {
options_strings.push_back(entry.first);
options_strings.push_back(entry.second);
}
int java_flags = std::accumulate(
flags.begin(), flags.end(), 0,
[](int sum, Flags flag) { return sum + static_cast<int>(flag); });
JNIEnv* env = AttachCurrentThread();
Java_InstanceIDBridge_getToken(
env, java_ref_, request_id,
ConvertUTF8ToJavaString(env, authorized_entity),
ConvertUTF8ToJavaString(env, scope),
base::android::ToJavaArrayOfStrings(env, options_strings), java_flags);
}
void InstanceIDAndroid::ValidateToken(const std::string& authorized_entity,
const std::string& scope,
const std::string& token,
ValidateTokenCallback callback) {
// gcm_driver doesn't store tokens on Android, so assume it's valid.
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), true /* is_valid */));
}
void InstanceIDAndroid::DeleteTokenImpl(const std::string& authorized_entity,
const std::string& scope,
DeleteTokenCallback callback) {
DCHECK(thread_checker_.CalledOnValidThread());
int32_t request_id = delete_token_callbacks_.Add(
std::make_unique<DeleteTokenCallback>(std::move(callback)));
JNIEnv* env = AttachCurrentThread();
Java_InstanceIDBridge_deleteToken(
env, java_ref_, request_id,
ConvertUTF8ToJavaString(env, authorized_entity),
ConvertUTF8ToJavaString(env, scope));
}
void InstanceIDAndroid::DeleteIDImpl(DeleteIDCallback callback) {
DCHECK(thread_checker_.CalledOnValidThread());
int32_t request_id = delete_id_callbacks_.Add(
std::make_unique<DeleteIDCallback>(std::move(callback)));
JNIEnv* env = AttachCurrentThread();
Java_InstanceIDBridge_deleteInstanceID(env, java_ref_, request_id);
}
void InstanceIDAndroid::DidGetID(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint request_id,
const base::android::JavaParamRef<jstring>& jid) {
DCHECK(thread_checker_.CalledOnValidThread());
GetIDCallback* callback = get_id_callbacks_.Lookup(request_id);
DCHECK(callback);
std::move(*callback).Run(ConvertJavaStringToUTF8(jid));
get_id_callbacks_.Remove(request_id);
}
void InstanceIDAndroid::DidGetCreationTime(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint request_id,
jlong creation_time_unix_ms) {
DCHECK(thread_checker_.CalledOnValidThread());
base::Time creation_time;
// If the InstanceID's getId, getToken and deleteToken methods have never been
// called, or deleteInstanceID has cleared it since, creation time will be 0.
if (creation_time_unix_ms) {
creation_time = base::Time::UnixEpoch() +
base::TimeDelta::FromMilliseconds(creation_time_unix_ms);
}
GetCreationTimeCallback* callback =
get_creation_time_callbacks_.Lookup(request_id);
DCHECK(callback);
std::move(*callback).Run(creation_time);
get_creation_time_callbacks_.Remove(request_id);
}
void InstanceIDAndroid::DidGetToken(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint request_id,
const base::android::JavaParamRef<jstring>& jtoken) {
DCHECK(thread_checker_.CalledOnValidThread());
GetTokenCallback* callback = get_token_callbacks_.Lookup(request_id);
DCHECK(callback);
std::string token = ConvertJavaStringToUTF8(jtoken);
std::move(*callback).Run(
token, token.empty() ? InstanceID::UNKNOWN_ERROR : InstanceID::SUCCESS);
get_token_callbacks_.Remove(request_id);
}
void InstanceIDAndroid::DidDeleteToken(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint request_id,
jboolean success) {
DCHECK(thread_checker_.CalledOnValidThread());
DeleteTokenCallback* callback = delete_token_callbacks_.Lookup(request_id);
DCHECK(callback);
std::move(*callback).Run(success ? InstanceID::SUCCESS
: InstanceID::UNKNOWN_ERROR);
delete_token_callbacks_.Remove(request_id);
}
void InstanceIDAndroid::DidDeleteID(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jint request_id,
jboolean success) {
DCHECK(thread_checker_.CalledOnValidThread());
DeleteIDCallback* callback = delete_id_callbacks_.Lookup(request_id);
DCHECK(callback);
std::move(*callback).Run(success ? InstanceID::SUCCESS
: InstanceID::UNKNOWN_ERROR);
delete_id_callbacks_.Remove(request_id);
}
} // namespace instance_id
| {
"content_hash": "0b3b28f9f32ee109d882bc6491c0f4bc",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 87,
"avg_line_length": 35.27685950413223,
"alnum_prop": 0.7021201827339815,
"repo_name": "endlessm/chromium-browser",
"id": "0ab04e1fce4261474e9e611584cea4d2ed255aa5",
"size": "8537",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/gcm_driver/instance_id/instance_id_android.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<!-- Begin Template: footer.php -->
<div id="footer">
<div class="wrapper">
<div class="widgets">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Widgets') ) {} ?>
</div> <!-- END .widget menu footer -->
</div> <!-- END .wrapper -->
<div class="copy">
<p>© <?php echo date('Y'); ?> <?php bloginfo('name'); ?>, All Rights Reserved.</p>
</div> <!-- END .copy -->
</div> <!-- END #footer -->
</div> <!-- END .mainwrapper -->
<?php wp_footer(); ?>
<!-- Include Scripts -->
<?php include 'libs/scripts.php';?>
</body>
</html> | {
"content_hash": "b8dc76da7e2920521071c65460d76c74",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 96,
"avg_line_length": 29.238095238095237,
"alnum_prop": 0.5146579804560261,
"repo_name": "nateude/skeleton",
"id": "0bebbfa2ccedd9ca4a8d1d3216aad42abd4b3370",
"size": "614",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "footer.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "25572"
},
{
"name": "PHP",
"bytes": "248598"
},
{
"name": "Ruby",
"bytes": "917"
}
],
"symlink_target": ""
} |
package com.cody.xf;
import android.support.multidex.MultiDexApplication;
import com.cody.xf.common.LoginBroadcastReceiver;
import com.cody.xf.utils.http.ILoginStatusListener;
import com.cody.xf.widget.pickerview.region.RegionPicker;
import com.cody.xf.widget.swipebacklayout.BGASwipeBackHelper;
import com.squareup.leakcanary.LeakCanary;
/**
* Created by cody.yi on 2016/7/12.
* Application 基类
*/
public abstract class XFApplication extends MultiDexApplication implements ILoginStatusListener {
private LoginBroadcastReceiver mReceiver;
@Override
public void onCreate() {
super.onCreate();
XFoundation.install(this);
LeakCanary.install(this);
RegionPicker.initData();
mReceiver = LoginBroadcastReceiver.register();
/**
* 必须在 Application 的 onCreate 方法中执行 BGASwipeBackHelper.init 来初始化滑动返回
* 第一个参数:应用程序上下文
* 第二个参数:如果发现滑动返回后立即触摸界面时应用崩溃,请把该界面里比较特殊的 View 的 class 添加到该集合中,目前在库中已经添加了 WebView 和 SurfaceView
*/
BGASwipeBackHelper.init(this, null);
}
@Override
public void onTerminate() {
super.onTerminate();
XFoundation.uninstall();
LoginBroadcastReceiver.unRegister(mReceiver);
}
}
| {
"content_hash": "0ef0a64e4774b22b18fbbfa538500817",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 103,
"avg_line_length": 30.7,
"alnum_prop": 0.7182410423452769,
"repo_name": "codyer/CleanFramework",
"id": "c669e6f29eacc6a14b9507155cc5b2821d22cc57",
"size": "1408",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "xfoundation/src/main/java/com/cody/xf/XFApplication.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "19368"
},
{
"name": "Java",
"bytes": "1303415"
},
{
"name": "JavaScript",
"bytes": "4480"
}
],
"symlink_target": ""
} |
<div class="get-started">
<div class="wrap">
<h1>Get started</h1>
<section>
<h2>Using NPM</h2>
<p>Run the following command:</p>
{{#example-code}}
npm install --save leonardo-ui
{{/example-code}}
<p>
Add the following to your HTML:
</p>
<p>
{{#example-code}}
<head>
<link rel="stylesheet" href="node_modules/leonardo-ui/dist/leonardo-ui.css" type="text/css"/>
</head>
<body>
<!-- Page content -->
<script src="node_modules/leonardo-ui/dist/leonardo-ui.js" type="text/javascript"></script>
</body>
{{/example-code}}
</p>
<p>
To use the icon font (optional), add this to your CSS:
</p>
<p>
{{#example-code}}
@font-face {
font-family: "LUI icons";
src: url(node_modules/leonardo-ui/dist/lui-icons.woff) format('woff'),
url(node_modules/leonardo-ui/dist/lui-icons.ttf) format('truetype');
}
{{/example-code}}
</p>
</section>
<section>
<h2>Bundle</h2>
<p>
Alternatively, you can download a bundle and follow the instructions above. Replace the paths starting
with node_modules. The bundle includes the same artifacts as the NPM package plus some code examples.
</p>
<div class="center" style="margin-top: 30px; padding: 0 10px;">
<a href="https://www.npmjs.com/package/leonardo-ui/-/leonardo-ui-{{luiVersion}}.tgz">
<button class="lui-button lui-button--info lui-button--block lui-button--x-large">Download Leonardo UI {{luiVersion}}</button>
</a>
</div>
</section>
<section>
<h2>Artifacts</h2>
<p>You may include any version of these artifacts. Notice that using Javascripts is optional and you are
free to provide your own custom implementation.</p>
<table class="options">
<thead>
<tr>
<th>Artifact</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>leonardo-ui.min.css</td>
<td>Minified CSS file to use in production</td>
</tr>
<tr>
<td>leonardo-ui.css</td>
<td>CSS</td>
</tr>
<tr>
<td>leonardo-ui.css.map</td>
<td>Source maps for CSS</td>
</tr>
<tr>
<td>leonardo-ui.min.js</td>
<td>Minified JS file to use in production</td>
</tr>
<tr>
<td>leonardo-ui.js</td>
<td>JS</td>
</tr>
<tr>
<td>leonardo-ui.js.map</td>
<td>Source maps for JS</td>
</tr>
<tr>
<td>colors.less</td>
<td>Color palette variables</td>
</tr>
<tr>
<td>variables.less</td>
<td>General variables plus component specific variables (work ongoing)</td>
</tr>
<tr>
<td>lui-icons.ttf</td>
<td>Truetype icon font</td>
</tr>
<tr>
<td>lui-icons.woff</td>
<td>WOFF icon font</td>
</tr>
</tbody>
</table>
</section>
</div>
</div>
| {
"content_hash": "15189f85ceae4f1348491cbe8ee00d21",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 139,
"avg_line_length": 30.21698113207547,
"alnum_prop": 0.5138932251014674,
"repo_name": "qlik-oss/leonardo-ui",
"id": "32098208090651c949d5d93a555d89e7b36f6e56",
"size": "3203",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/src/pages/get-started.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "83295"
},
{
"name": "JavaScript",
"bytes": "29979"
},
{
"name": "Shell",
"bytes": "309"
}
],
"symlink_target": ""
} |
namespace Microsoft.Azure.Management.SecurityInsights.Models
{
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Action for alert rule.
/// </summary>
[Rest.Serialization.JsonTransformation]
public partial class ActionRequest : ResourceWithEtag
{
/// <summary>
/// Initializes a new instance of the ActionRequest class.
/// </summary>
public ActionRequest()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the ActionRequest class.
/// </summary>
/// <param name="logicAppResourceId">Logic App Resource Id,
/// /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}.</param>
/// <param name="triggerUri">Logic App Callback URL for this specific
/// workflow.</param>
/// <param name="id">Azure resource Id</param>
/// <param name="name">Azure resource name</param>
/// <param name="type">Azure resource type</param>
/// <param name="etag">Etag of the azure resource</param>
public ActionRequest(string logicAppResourceId, string triggerUri, string id = default(string), string name = default(string), string type = default(string), string etag = default(string))
: base(id, name, type, etag)
{
LogicAppResourceId = logicAppResourceId;
TriggerUri = triggerUri;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets logic App Resource Id,
/// /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}.
/// </summary>
[JsonProperty(PropertyName = "properties.logicAppResourceId")]
public string LogicAppResourceId { get; set; }
/// <summary>
/// Gets or sets logic App Callback URL for this specific workflow.
/// </summary>
[JsonProperty(PropertyName = "properties.triggerUri")]
public string TriggerUri { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (LogicAppResourceId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "LogicAppResourceId");
}
if (TriggerUri == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "TriggerUri");
}
}
}
}
| {
"content_hash": "51c9f1c62317920ca81d9ee1d95119ba",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 196,
"avg_line_length": 38.103896103896105,
"alnum_prop": 0.5995228357191548,
"repo_name": "jackmagic313/azure-sdk-for-net",
"id": "248caaf74c61ccfecfa62a0f123b1721596b4cb4",
"size": "3287",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionRequest.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "15958"
},
{
"name": "C#",
"bytes": "175000108"
},
{
"name": "CSS",
"bytes": "5585"
},
{
"name": "HTML",
"bytes": "225966"
},
{
"name": "JavaScript",
"bytes": "13014"
},
{
"name": "PowerShell",
"bytes": "201417"
},
{
"name": "Shell",
"bytes": "13061"
},
{
"name": "Smarty",
"bytes": "11127"
},
{
"name": "TypeScript",
"bytes": "141835"
}
],
"symlink_target": ""
} |
class CPageShopEventListener : public IUIElementEventListener
{
public:
// IUIElementEventListener
virtual void OnUIEvent(IUIElement* pSender, const SUIEventDesc& event, const SUIArguments& args);
// ~IUIElementEventListener
};
class CPageShop : public IUIPage
{
public:
CPageShop(const char* name) : IUIPage(name, &m_EventListener) {}
public:
// IUIPage
virtual void OnLoadPage(bool loaded) override
{
if (loaded)
{
// Call load background function
SUIArguments args;
args.AddArgument("backgrounds/error.png");
pElement->CallFunction("LoadBackground", args);
}
}
// ~IUIPage
private:
CPageShopEventListener m_EventListener;
}; | {
"content_hash": "ac6ffb77300fde52c9f9e212e6c0b9a8",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 98,
"avg_line_length": 23.428571428571427,
"alnum_prop": 0.75,
"repo_name": "BeatGames/EasyShooter",
"id": "98a71733fc1e2051e289bac0d119caa9a4706888",
"size": "871",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Code/UI/Menu/PageShop.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ada",
"bytes": "1046"
},
{
"name": "Batchfile",
"bytes": "613"
},
{
"name": "C",
"bytes": "1936"
},
{
"name": "C++",
"bytes": "131698"
},
{
"name": "CMake",
"bytes": "4771"
},
{
"name": "Mathematica",
"bytes": "1652"
},
{
"name": "Objective-C",
"bytes": "181"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace travel_app.Services
{
public interface IMailService
{
void SendMail(string to, string from, string subject, string body);
}
}
| {
"content_hash": "1820a4896130c44c5e40e310c9c30aac",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 75,
"avg_line_length": 21.076923076923077,
"alnum_prop": 0.7335766423357665,
"repo_name": "savajesus/travel-app",
"id": "2a42f50302fcbdd7453535c43525898d564de224",
"size": "276",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/travel-app/Services/IMailService.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "62745"
},
{
"name": "CSS",
"bytes": "1285"
},
{
"name": "HTML",
"bytes": "10202"
},
{
"name": "JavaScript",
"bytes": "4000"
}
],
"symlink_target": ""
} |
<?php
namespace Symfony\Tests\Component\Validator\Fixtures;
use Symfony\Component\Validator\Constraint;
class FailingConstraint extends Constraint
{
public $message = '';
public function targets()
{
return array(self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT);
}
} | {
"content_hash": "4aa59c2ef6446f99b2d6879f63484976",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 72,
"avg_line_length": 19.666666666666668,
"alnum_prop": 0.7220338983050848,
"repo_name": "l3l0/BehatExamples",
"id": "da2b37d67bc2ec4aba87e01357a494af06ee35ca",
"size": "295",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "vendor_full/symfony/tests/Symfony/Tests/Component/Validator/Fixtures/FailingConstraint.php",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
#ifndef _THRIFT_TRANSPORT_THTTPSERVER_H_
#define _THRIFT_TRANSPORT_THTTPSERVER_H_ 1
#include <thrift/transport/THttpTransport.h>
namespace apache {
namespace thrift {
namespace transport {
class THttpServer : public THttpTransport {
public:
THttpServer(std::shared_ptr<TTransport> transport, std::shared_ptr<TConfiguration> config = nullptr);
~THttpServer() override;
void flush() override;
protected:
virtual std::string getHeader(uint32_t len);
void readHeaders();
void parseHeader(char* header) override;
bool parseStatusLine(char* status) override;
std::string getTimeRFC1123();
};
/**
* Wraps a transport into HTTP protocol
*/
class THttpServerTransportFactory : public TTransportFactory {
public:
THttpServerTransportFactory() = default;
~THttpServerTransportFactory() override = default;
/**
* Wraps the transport into a buffered one.
*/
std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override {
return std::shared_ptr<TTransport>(new THttpServer(trans));
}
};
}
}
} // apache::thrift::transport
#endif // #ifndef _THRIFT_TRANSPORT_THTTPSERVER_H_
| {
"content_hash": "ec82c1ab95c57133fd446e2321c10599",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 103,
"avg_line_length": 23.604166666666668,
"alnum_prop": 0.7405119152691968,
"repo_name": "strava/thrift",
"id": "bc98986d7cf3c2e9d5c18379e271ce92a404f223",
"size": "1936",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "lib/cpp/src/thrift/transport/THttpServer.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "32981"
},
{
"name": "C",
"bytes": "1043838"
},
{
"name": "C#",
"bytes": "526808"
},
{
"name": "C++",
"bytes": "4660761"
},
{
"name": "CMake",
"bytes": "128913"
},
{
"name": "Common Lisp",
"bytes": "39679"
},
{
"name": "D",
"bytes": "654763"
},
{
"name": "Dart",
"bytes": "165088"
},
{
"name": "Dockerfile",
"bytes": "64956"
},
{
"name": "Emacs Lisp",
"bytes": "5361"
},
{
"name": "Erlang",
"bytes": "322899"
},
{
"name": "Go",
"bytes": "669651"
},
{
"name": "HTML",
"bytes": "36484"
},
{
"name": "Haxe",
"bytes": "323115"
},
{
"name": "Java",
"bytes": "1299883"
},
{
"name": "JavaScript",
"bytes": "444069"
},
{
"name": "Lex",
"bytes": "10804"
},
{
"name": "Lua",
"bytes": "81630"
},
{
"name": "M4",
"bytes": "171969"
},
{
"name": "Makefile",
"bytes": "215820"
},
{
"name": "OCaml",
"bytes": "34380"
},
{
"name": "PHP",
"bytes": "353558"
},
{
"name": "Pascal",
"bytes": "594476"
},
{
"name": "Perl",
"bytes": "133007"
},
{
"name": "Python",
"bytes": "498010"
},
{
"name": "Ruby",
"bytes": "395812"
},
{
"name": "Rust",
"bytes": "355648"
},
{
"name": "Shell",
"bytes": "54204"
},
{
"name": "Smalltalk",
"bytes": "22944"
},
{
"name": "Swift",
"bytes": "165395"
},
{
"name": "Thrift",
"bytes": "419608"
},
{
"name": "TypeScript",
"bytes": "61760"
},
{
"name": "Vim script",
"bytes": "2846"
},
{
"name": "Yacc",
"bytes": "27511"
}
],
"symlink_target": ""
} |
@class GeoMapScrollView;
@class GeoMapImageView;
@class GeoMapGCP;
@class GeoMapMetadataViewController;
// A document type for georeferencing an image.
@interface GeoMapDocument : NSDocument
<NSToolbarDelegate,
NSTableViewDelegate,
NSPopoverDelegate>
// The input file.
@property (strong) NSString * input;
// The image itself.
@property (strong) NSImage * image;
// The image size.
@property (assign) NSSize imageSize;
// Some views for displaying an image nicely.
@property (strong) IBOutlet GeoMapScrollView * imageScrollView;
@property (strong) IBOutlet GeoMapImageView * imageView;
// The current tool mode.
@property (assign) NSUInteger toolMode;
// Cursors to refect the tool mode.
@property (strong) NSCursor * zoomInCursor;
@property (strong) NSCursor * zoomOutCursor;
@property (strong) NSCursor * addGCPCursor;
// Only do setup once per document.
@property (assign) BOOL isSetup;
// Toolbars.
@property (assign) IBOutlet NSView * imageControlsToolbarItemView;
@property (assign) IBOutlet NSButton * panModeButton;
@property (assign) IBOutlet NSButton * zoomModeButton;
@property (assign) IBOutlet NSView * GCPControlsToolbarItemView;
@property (assign) IBOutlet NSButton * selectGCPModeButton;
@property (assign) IBOutlet NSButton * addGCPModeButton;
// GCPs.
@property (strong) NSMutableArray * GCPs;
@property (strong) IBOutlet NSArrayController * GCPController;
@property (strong) IBOutlet NSTableView * GCPTableView;
@property (strong) NSImage * GCPImage;
@property (strong) NSImage * GCPToolbarImage;
@property (strong) GeoMapGCP * currentGCP;
@property (assign) BOOL saveable;
// Metadata.
@property (strong) NSMutableArray * metadata;
@property (strong) IBOutlet NSArrayController * metadataController;
@property (strong) IBOutlet NSTableView * metadataTableView;
@property (readonly) NSPopover * metadataPopover;
@property (strong) IBOutlet
GeoMapMetadataViewController * metadataViewController;
// Preview/Export.
@property (strong) IBOutlet WebView * mapView;
@property (assign) BOOL canPreview;
@property (strong) IBOutlet NSButton * previewButton;
@property (strong) IBOutlet NSButton * exportButton;
@property (strong) IBOutlet NSButton * cancelExportButton;
@property (strong) IBOutlet NSTextField * opacityLabel;
@property (strong) IBOutlet NSSlider * opacitySlider;
@property (strong) NSString * previewPath;
@property (strong) NSArray * coordinates;
@property (assign) double opacity;
@property (assign) BOOL previewing;
@property (strong) dispatch_semaphore_t previewReady;
@property (strong) NSNumber * progress;
@property (strong) IBOutlet NSPanel * progressPanel;
@property (strong) IBOutlet NSProgressIndicator * progressIndicator;
@property (strong) NSString * progressLabel;
@property (strong) NSTimer * progressTimer;
@property (assign) double previewScale;
@property (assign) NSUInteger formatIndex;
@property (strong) NSString * format;
@property (assign) NSUInteger datumIndex;
@property (strong) NSString * datum;
@property (assign) BOOL srsEnabled;
@property (strong) NSString * srs;
@property (strong) NSSavePanel * savePanel;
@property (strong) IBOutlet NSView * saveOptionslPanel;
- (IBAction) setTool: (id) sender;
- (IBAction) previewMap: (id) sender;
- (IBAction) exportMap: (id) sender;
- (IBAction) cancelExportMap: (id) sender;
- (void) addGCP: (NSPoint) point;
- (IBAction) removeGCP: (id) sender;
- (void) selectGCPAt: (NSPoint) point;
- (IBAction) commitLatitude: (id) sender;
- (IBAction) commitLongitude: (id) sender;
- (IBAction) addMetadata: (id) sender;
- (IBAction) removeMetadata: (id) sender;
// Show the metadata popover.
- (void) showMetadataPopover;
@end
| {
"content_hash": "4532edcc81809953dcbcd1d8e212a1fb",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 68,
"avg_line_length": 33.833333333333336,
"alnum_prop": 0.7687465790914066,
"repo_name": "jdanielOCUL/GeoMap",
"id": "ea7340da74ab52f097cff2e90b9d1042d1c86986",
"size": "4007",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GeoMap/GeoMapDocument.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "77014"
},
{
"name": "Objective-C++",
"bytes": "10301"
}
],
"symlink_target": ""
} |
The `require('internal/errors')` module is an internal-only module that can be
used to produce `Error`, `TypeError` and `RangeError` instances that use a
static, permanent error code and an optionally parameterized message.
The intent of the module is to allow errors provided by Node.js to be assigned a
permanent identifier. Without a permanent identifier, userland code may need to
inspect error messages to distinguish one error from another. An unfortunate
result of that practice is that changes to error messages result in broken code
in the ecosystem. For that reason, Node.js has considered error message changes
to be breaking changes. By providing a permanent identifier for a specific
error, we reduce the need for userland code to inspect error messages.
Switching an existing error to use the `internal/errors` module must be
considered a `semver-major` change.
## Using internal/errors.js
The `internal/errors` module exposes all custom errors as subclasses of the
builtin errors. After being added, an error can be found in the `codes` object.
For instance, an existing `Error` such as:
```js
const err = new TypeError(`Expected string received ${type}`);
```
Can be replaced by first adding a new error key into the `internal/errors.js`
file:
```js
E('FOO', 'Expected string received %s', TypeError);
```
Then replacing the existing `new TypeError` in the code:
```js
const { FOO } = require('internal/errors').codes;
// ...
const err = new FOO(type);
```
## Adding new errors
New static error codes are added by modifying the `internal/errors.js` file
and appending the new error codes to the end using the utility `E()` method.
```js
E('EXAMPLE_KEY1', 'This is the error value', TypeError);
E('EXAMPLE_KEY2', (a, b) => `${a} ${b}`, RangeError);
```
The first argument passed to `E()` is the static identifier. The second
argument is either a String with optional `util.format()` style replacement
tags (e.g. `%s`, `%d`), or a function returning a String. The optional
additional arguments passed to the `errors.message()` function (which is
used by the `errors.Error`, `errors.TypeError` and `errors.RangeError` classes),
will be used to format the error message. The third argument is the base class
that the new error will extend.
It is possible to create multiple derived
classes by providing additional arguments. The other ones will be exposed as
properties of the main class:
<!-- eslint-disable no-unreachable -->
```js
E('EXAMPLE_KEY', 'Error message', TypeError, RangeError);
// In another module
const { EXAMPLE_KEY } = require('internal/errors').codes;
// TypeError
throw new EXAMPLE_KEY();
// RangeError
throw new EXAMPLE_KEY.RangeError();
```
## Documenting new errors
Whenever a new static error code is added and used, corresponding documentation
for the error code should be added to the `doc/api/errors.md` file. This will
give users a place to go to easily look up the meaning of individual error
codes.
## Testing new errors
When adding a new error, corresponding test(s) for the error message
formatting may also be required. If the message for the error is a
constant string then no test is required for the error message formatting
as we can trust the error helper implementation. An example of this kind of
error would be:
```js
E('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound');
```
If the error message is not a constant string then tests to validate
the formatting of the message based on the parameters used when
creating the error should be added to
`test/parallel/test-internal-errors.js`. These tests should validate
all of the different ways parameters can be used to generate the final
message string. A simple example is:
```js
// Test ERR_TLS_CERT_ALTNAME_INVALID
assert.strictEqual(
errors.message('ERR_TLS_CERT_ALTNAME_INVALID', ['altname']),
'Hostname/IP does not match certificate\'s altnames: altname');
```
In addition, there should also be tests which validate the use of the
error based on where it is used in the codebase. If the error message is
static, these tests should only validate that the expected code is received
and NOT validate the message. This will reduce the amount of test change
required when the message for an error changes.
```js
assert.throws(() => {
socket.bind();
}, common.expectsError({
code: 'ERR_SOCKET_ALREADY_BOUND',
type: Error
}));
```
Avoid changing the format of the message after the error has been created.
If it does make sense to do this for some reason, then additional tests
validating the formatting of the error message for those cases will
likely be required.
## API
### Object: errors.codes
Exposes all internal error classes to be used by Node.js APIs.
### Method: errors.message(key, args)
* `key` {string} The static error identifier
* `args` {Array} Zero or more optional arguments passed as an Array
* Returns: {string}
Returns the formatted error message string for the given `key`.
| {
"content_hash": "4493cd55d8cdcfad7c7907bbb506e0d3",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 80,
"avg_line_length": 35.08510638297872,
"alnum_prop": 0.7564180311299777,
"repo_name": "enclose-io/compiler",
"id": "9fac1298a1d050b59bc3ee2b03bc33445e4e5b0b",
"size": "5017",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "current/doc/guides/using-internal-errors.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "11474"
},
{
"name": "Shell",
"bytes": "131"
}
],
"symlink_target": ""
} |
<?php
/**
* Created by PhpStorm.
* User: woohuiren
* Date: 21/3/17
* Time: 11:53 PM
*/
namespace Giantcrab\GoogleCalendar\Tests;
use Giantcrab\GoogleCalendar\GoogleCalendar;
use Google_Client;
use Google_Service_Calendar;
use Google_Service_Calendar_Event;
use Orchestra\Testbench\TestCase;
class CalendarBaseTestCase extends TestCase
{
protected $google_calendar, $credentials_setup = false;
/**
* @return GoogleCalendar
*/
public function getGoogleCalendar(): GoogleCalendar
{
return $this->google_calendar;
}
/**
* @param GoogleCalendar $google_calendar
*/
public function setGoogleCalendar(GoogleCalendar $google_calendar)
{
$this->google_calendar = $google_calendar;
}
protected function generateRandomString(): string
{
return str_shuffle('abcdefghijklnmopqrstuvwsyz0123456789');
}
protected function generateRandomEvent(): Google_Service_Calendar_Event
{
return new Google_Service_Calendar_Event(array(
'summary' => 'Google I/O 2015',
'location' => '800 Howard St., San Francisco, CA 94103',
'description' => $this->generateRandomString(),
'start' => array(
'dateTime' => '2015-05-28T09:00:00-07:00',
'timeZone' => 'America/Los_Angeles',
),
'end' => array(
'dateTime' => '2015-05-28T17:00:00-07:00',
'timeZone' => 'America/Los_Angeles',
),
'recurrence' => array(
'RRULE:FREQ=DAILY;COUNT=2'
),
'attendees' => array(
array('email' => 'lpage@example.com'),
array('email' => 'sbrin@example.com'),
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
));
}
protected function setUp()
{
parent::setUp();
$client = new Google_Client();
if (file_exists('service-account.json')) {
putenv('GOOGLE_APPLICATION_CREDENTIALS=service-account.json');
$client->useApplicationDefaultCredentials();
$this->credentials_setup = true;
}
$client->addScope(Google_Service_Calendar::CALENDAR);
$this->setGoogleCalendar(new GoogleCalendar());
$this->getGoogleCalendar()->setGoogleClient($client);
}
} | {
"content_hash": "bc9fc09eeb2d2288f58889d8155c0eda",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 75,
"avg_line_length": 30.13953488372093,
"alnum_prop": 0.5590277777777778,
"repo_name": "GIANTCRAB/google-calendar",
"id": "0f9a03bf144e0f81ae2d01c5663453fa112eb491",
"size": "2592",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/CalendarBaseTestCase.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "25807"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Struct template left_shift_assignable</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.operators_hpp" title="Header <boost/type_erasure/operators.hpp>">
<link rel="prev" href="mod_assignable.html" title="Struct template mod_assignable">
<link rel="next" href="right_shift_assignable.html" title="Struct template right_shift_assignable">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="mod_assignable.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.operators_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="right_shift_assignable.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.type_erasure.left_shift_assignable"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Struct template left_shift_assignable</span></h2>
<p>boost::type_erasure::left_shift_assignable</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.operators_hpp" title="Header <boost/type_erasure/operators.hpp>">boost/type_erasure/operators.hpp</a>>
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T <span class="special">=</span> <a class="link" href="_self.html" title="Struct _self">_self</a><span class="special">,</span> <span class="keyword">typename</span> U <span class="special">=</span> <span class="identifier">T</span><span class="special">></span>
<span class="keyword">struct</span> <a class="link" href="left_shift_assignable.html" title="Struct template left_shift_assignable">left_shift_assignable</a> <span class="special">{</span>
<span class="comment">// <a class="link" href="left_shift_assignable.html#idp304390672-bb">public static functions</a></span>
<span class="keyword">static</span> <span class="keyword">void</span> <a class="link" href="left_shift_assignable.html#idp304391232-bb"><span class="identifier">apply</span></a><span class="special">(</span><span class="identifier">T</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">U</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp480376464"></a><h2>Description</h2>
<div class="refsect2">
<a name="idp480376880"></a><h3>
<a name="idp304390672-bb"></a><code class="computeroutput">left_shift_assignable</code> public static functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><pre class="literallayout"><span class="keyword">static</span> <span class="keyword">void</span> <a name="idp304391232-bb"></a><span class="identifier">apply</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">U</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span></pre></li></ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2011-2013 Steven Watanabe<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="mod_assignable.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.operators_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="right_shift_assignable.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| {
"content_hash": "dd198c30218cce12773b0ec5e3cc569f",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 557,
"avg_line_length": 92.01612903225806,
"alnum_prop": 0.6797546012269938,
"repo_name": "Ant-OS/android_packages_apps_OTAUpdates",
"id": "f0b0f7031228a3fd08d0ac280147cafad531f1a8",
"size": "5705",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "jni/boost_1_57_0/doc/html/boost/type_erasure/left_shift_assignable.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "173932"
},
{
"name": "Batchfile",
"bytes": "31151"
},
{
"name": "C",
"bytes": "2920428"
},
{
"name": "C#",
"bytes": "40804"
},
{
"name": "C++",
"bytes": "156317088"
},
{
"name": "CMake",
"bytes": "13760"
},
{
"name": "CSS",
"bytes": "229619"
},
{
"name": "Cuda",
"bytes": "26521"
},
{
"name": "FORTRAN",
"bytes": "1387"
},
{
"name": "Gnuplot",
"bytes": "2361"
},
{
"name": "Groff",
"bytes": "8039"
},
{
"name": "HTML",
"bytes": "144391206"
},
{
"name": "IDL",
"bytes": "14"
},
{
"name": "Java",
"bytes": "160971"
},
{
"name": "JavaScript",
"bytes": "132031"
},
{
"name": "Lex",
"bytes": "1231"
},
{
"name": "Makefile",
"bytes": "1026404"
},
{
"name": "Max",
"bytes": "36857"
},
{
"name": "Objective-C",
"bytes": "3127"
},
{
"name": "Objective-C++",
"bytes": "207"
},
{
"name": "PHP",
"bytes": "59030"
},
{
"name": "Perl",
"bytes": "29502"
},
{
"name": "Perl6",
"bytes": "2053"
},
{
"name": "Python",
"bytes": "1859144"
},
{
"name": "QML",
"bytes": "593"
},
{
"name": "QMake",
"bytes": "6974"
},
{
"name": "Rebol",
"bytes": "354"
},
{
"name": "Shell",
"bytes": "365897"
},
{
"name": "Tcl",
"bytes": "1172"
},
{
"name": "TeX",
"bytes": "13404"
},
{
"name": "XSLT",
"bytes": "751497"
},
{
"name": "Yacc",
"bytes": "18910"
}
],
"symlink_target": ""
} |
package com.orhanobut.logger;
public class AndroidLogAdapter implements LogAdapter {
private final FormatStrategy formatStrategy;
public AndroidLogAdapter() {
this.formatStrategy = PrettyFormatStrategy.newBuilder().build();
}
public AndroidLogAdapter(FormatStrategy formatStrategy) {
this.formatStrategy = formatStrategy;
}
@Override public boolean isLoggable(int priority, String tag) {
return true;
}
@Override public void log(int priority, String tag, String message) {
formatStrategy.log(priority, tag, message);
}
} | {
"content_hash": "3c5af29cb03054e998b45b2465785081",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 24.391304347826086,
"alnum_prop": 0.7522281639928698,
"repo_name": "weiwenqiang/GitHub",
"id": "1446a126f6e59099f4d1d587182cd1436437f5f6",
"size": "561",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "expert/logger/logger/src/main/java/com/orhanobut/logger/AndroidLogAdapter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "87"
},
{
"name": "C",
"bytes": "42062"
},
{
"name": "C++",
"bytes": "12137"
},
{
"name": "CMake",
"bytes": "202"
},
{
"name": "CSS",
"bytes": "75087"
},
{
"name": "Clojure",
"bytes": "12036"
},
{
"name": "FreeMarker",
"bytes": "21704"
},
{
"name": "Groovy",
"bytes": "55083"
},
{
"name": "HTML",
"bytes": "61549"
},
{
"name": "Java",
"bytes": "42222825"
},
{
"name": "JavaScript",
"bytes": "216823"
},
{
"name": "Kotlin",
"bytes": "24319"
},
{
"name": "Makefile",
"bytes": "19490"
},
{
"name": "Perl",
"bytes": "280"
},
{
"name": "Prolog",
"bytes": "1030"
},
{
"name": "Python",
"bytes": "13032"
},
{
"name": "Scala",
"bytes": "310450"
},
{
"name": "Shell",
"bytes": "27802"
}
],
"symlink_target": ""
} |
<?php
namespace IMSGlobal\LTI\ToolProvider\DataConnector;
use IMSGlobal\LTI\ToolProvider;
use IMSGlobal\LTI\ToolProvider\ConsumerNonce;
use IMSGlobal\LTI\ToolProvider\Context;
use IMSGlobal\LTI\ToolProvider\ResourceLink;
use IMSGlobal\LTI\ToolProvider\ResourceLinkShareKey;
use IMSGlobal\LTI\ToolProvider\ToolConsumer;
use IMSGlobal\LTI\ToolProvider\User;
###
# NB This class assumes that a MySQL connection has already been opened to the appropriate schema
###
class DataConnector_mysql extends DataConnector
{
###
### ToolConsumer methods
###
/**
* Load tool consumer object.
*
* @param ToolConsumer $consumer ToolConsumer object
*
* @return boolean True if the tool consumer object was successfully loaded
*/
public function loadToolConsumer($consumer)
{
$ok = false;
if (!empty($consumer->getRecordId())) {
$sql = sprintf('SELECT consumer_pk, name, consumer_key256, consumer_key, secret, lti_version, ' .
'consumer_name, consumer_version, consumer_guid, ' .
'profile, tool_proxy, settings, protected, enabled, ' .
'enable_from, enable_until, last_access, created, updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::CONSUMER_TABLE_NAME . ' ' .
"WHERE consumer_pk = %d",
$consumer->getRecordId());
} else {
$key256 = DataConnector::getConsumerKey($consumer->getKey());
$sql = sprintf('SELECT consumer_pk, name, consumer_key256, consumer_key, secret, lti_version, ' .
'consumer_name, consumer_version, consumer_guid, ' .
'profile, tool_proxy, settings, protected, enabled, ' .
'enable_from, enable_until, last_access, created, updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::CONSUMER_TABLE_NAME . ' ' .
"WHERE consumer_key256 = %s",
DataConnector::quoted($key256));
}
$rsConsumer = mysql_query($sql);
if ($rsConsumer) {
while ($row = mysql_fetch_object($rsConsumer)) {
if (empty($key256) || empty($row->consumer_key) || ($consumer->getKey() === $row->consumer_key)) {
$consumer->setRecordId(intval($row->consumer_pk));
$consumer->name = $row->name;
$consumer->setkey(empty($row->consumer_key) ? $row->consumer_key256 : $row->consumer_key);
$consumer->secret = $row->secret;
$consumer->ltiVersion = $row->lti_version;
$consumer->consumerName = $row->consumer_name;
$consumer->consumerVersion = $row->consumer_version;
$consumer->consumerGuid = $row->consumer_guid;
$consumer->profile = json_decode($row->profile);
$consumer->toolProxy = $row->tool_proxy;
$settings = unserialize($row->settings);
if (!is_array($settings)) {
$settings = array();
}
$consumer->setSettings($settings);
$consumer->protected = (intval($row->protected) === 1);
$consumer->enabled = (intval($row->enabled) === 1);
$consumer->enableFrom = null;
if (!is_null($row->enable_from)) {
$consumer->enableFrom = strtotime($row->enable_from);
}
$consumer->enableUntil = null;
if (!is_null($row->enable_until)) {
$consumer->enableUntil = strtotime($row->enable_until);
}
$consumer->lastAccess = null;
if (!is_null($row->last_access)) {
$consumer->lastAccess = strtotime($row->last_access);
}
$consumer->created = strtotime($row->created);
$consumer->updated = strtotime($row->updated);
$ok = true;
break;
}
}
mysql_free_result($rsConsumer);
}
return $ok;
}
/**
* Save tool consumer object.
*
* @param ToolConsumer $consumer Consumer object
*
* @return boolean True if the tool consumer object was successfully saved
*/
public function saveToolConsumer($consumer)
{
$id = $consumer->getRecordId();
$key = $consumer->getKey();
$key256 = DataConnector::getConsumerKey($key);
if ($key === $key256) {
$key = null;
}
$protected = ($consumer->protected) ? 1 : 0;
$enabled = ($consumer->enabled)? 1 : 0;
$profile = (!empty($consumer->profile)) ? json_encode($consumer->profile) : null;
$settingsValue = serialize($consumer->getSettings());
$time = time();
$now = date("{$this->dateFormat} {$this->timeFormat}", $time);
$from = null;
if (!is_null($consumer->enableFrom)) {
$from = date("{$this->dateFormat} {$this->timeFormat}", $consumer->enableFrom);
}
$until = null;
if (!is_null($consumer->enableUntil)) {
$until = date("{$this->dateFormat} {$this->timeFormat}", $consumer->enableUntil);
}
$last = null;
if (!is_null($consumer->lastAccess)) {
$last = date($this->dateFormat, $consumer->lastAccess);
}
if (empty($id)) {
$sql = sprintf("INSERT INTO {$this->dbTableNamePrefix}" . DataConnector::CONSUMER_TABLE_NAME . ' (consumer_key256, consumer_key, name, ' .
'secret, lti_version, consumer_name, consumer_version, consumer_guid, profile, tool_proxy, settings, protected, enabled, ' .
'enable_from, enable_until, last_access, created, updated) ' .
'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d, %s, %s, %s, %s, %s)',
DataConnector::quoted($key256), DataConnector::quoted($key), DataConnector::quoted($consumer->name),
DataConnector::quoted($consumer->secret), DataConnector::quoted($consumer->ltiVersion),
DataConnector::quoted($consumer->consumerName), DataConnector::quoted($consumer->consumerVersion), DataConnector::quoted($consumer->consumerGuid),
DataConnector::quoted($profile), DataConnector::quoted($consumer->toolProxy), DataConnector::quoted($settingsValue),
$protected, $enabled, DataConnector::quoted($from), DataConnector::quoted($until), DataConnector::quoted($last),
DataConnector::quoted($now), DataConnector::quoted($now));
} else {
$sql = sprintf("UPDATE {$this->dbTableNamePrefix}" . DataConnector::CONSUMER_TABLE_NAME . ' SET ' .
'consumer_key256 = %s, consumer_key = %s, ' .
'name = %s, secret= %s, lti_version = %s, consumer_name = %s, consumer_version = %s, consumer_guid = %s, ' .
'profile = %s, tool_proxy = %s, settings = %s, ' .
'protected = %d, enabled = %d, enable_from = %s, enable_until = %s, last_access = %s, updated = %s ' .
'WHERE consumer_pk = %d',
DataConnector::quoted($key256), DataConnector::quoted($key),
DataConnector::quoted($consumer->name),
DataConnector::quoted($consumer->secret), DataConnector::quoted($consumer->ltiVersion),
DataConnector::quoted($consumer->consumerName), DataConnector::quoted($consumer->consumerVersion), DataConnector::quoted($consumer->consumerGuid),
DataConnector::quoted($profile), DataConnector::quoted($consumer->toolProxy), DataConnector::quoted($settingsValue),
$protected, $enabled,
DataConnector::quoted($from), DataConnector::quoted($until), DataConnector::quoted($last),
DataConnector::quoted($now), $consumer->getRecordId());
}
$ok = mysql_query($sql);
if ($ok) {
if (empty($id)) {
$consumer->setRecordId(mysql_insert_id());
$consumer->created = $time;
}
$consumer->updated = $time;
}
return $ok;
}
/**
* Delete tool consumer object.
*
* @param ToolConsumer $consumer Consumer object
*
* @return boolean True if the tool consumer object was successfully deleted
*/
public function deleteToolConsumer($consumer)
{
// Delete any nonce values for this consumer
$sql = sprintf("DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::NONCE_TABLE_NAME . ' WHERE consumer_pk = %d',
$consumer->getRecordId());
mysql_query($sql);
// Delete any outstanding share keys for resource links for this consumer
$sql = sprintf('DELETE sk ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' sk ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON sk.resource_link_pk = rl.resource_link_pk ' .
'WHERE rl.consumer_pk = %d',
$consumer->getRecordId());
mysql_query($sql);
// Delete any outstanding share keys for resource links for contexts in this consumer
$sql = sprintf('DELETE sk ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' sk ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON sk.resource_link_pk = rl.resource_link_pk ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' c ON rl.context_pk = c.context_pk ' .
'WHERE c.consumer_pk = %d',
$consumer->getRecordId());
mysql_query($sql);
// Delete any users in resource links for this consumer
$sql = sprintf('DELETE u ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' u ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON u.resource_link_pk = rl.resource_link_pk ' .
'WHERE rl.consumer_pk = %d',
$consumer->getRecordId());
mysql_query($sql);
// Delete any users in resource links for contexts in this consumer
$sql = sprintf('DELETE u ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' u ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON u.resource_link_pk = rl.resource_link_pk ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' c ON rl.context_pk = c.context_pk ' .
'WHERE c.consumer_pk = %d',
$consumer->getRecordId());
mysql_query($sql);
// Update any resource links for which this consumer is acting as a primary resource link
$sql = sprintf("UPDATE {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' prl ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON prl.primary_resource_link_pk = rl.resource_link_pk ' .
'SET prl.primary_resource_link_pk = NULL, prl.share_approved = NULL ' .
'WHERE rl.consumer_pk = %d',
$consumer->getRecordId());
$ok = mysql_query($sql);
// Update any resource links for contexts in which this consumer is acting as a primary resource link
$sql = sprintf("UPDATE {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' prl ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON prl.primary_resource_link_pk = rl.resource_link_pk ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' c ON rl.context_pk = c.context_pk ' .
'SET prl.primary_resource_link_pk = NULL, prl.share_approved = NULL ' .
'WHERE c.consumer_pk = %d',
$consumer->getRecordId());
$ok = mysql_query($sql);
// Delete any resource links for this consumer
$sql = sprintf('DELETE rl ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ' .
'WHERE rl.consumer_pk = %d',
$consumer->getRecordId());
mysql_query($sql);
// Delete any resource links for contexts in this consumer
$sql = sprintf('DELETE rl ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' c ON rl.context_pk = c.context_pk ' .
'WHERE c.consumer_pk = %d',
$consumer->getRecordId());
mysql_query($sql);
// Delete any contexts for this consumer
$sql = sprintf('DELETE c ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' c ' .
'WHERE c.consumer_pk = %d',
$consumer->getRecordId());
mysql_query($sql);
// Delete consumer
$sql = sprintf('DELETE c ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::CONSUMER_TABLE_NAME . ' c ' .
'WHERE c.consumer_pk = %d',
$consumer->getRecordId());
$ok = mysql_query($sql);
if ($ok) {
$consumer->initialize();
}
return $ok;
}
###
# Load all tool consumers from the database
###
public function getToolConsumers()
{
$consumers = array();
$sql = 'SELECT consumer_pk, consumer_key, consumer_key, name, secret, lti_version, consumer_name, consumer_version, consumer_guid, ' .
'profile, tool_proxy, settings, ' .
'protected, enabled, enable_from, enable_until, last_access, created, updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::CONSUMER_TABLE_NAME . ' ' .
'ORDER BY name';
$rsConsumers = mysql_query($sql);
if ($rsConsumers) {
while ($row = mysql_fetch_object($rsConsumers)) {
$consumer = new ToolProvider\ToolConsumer($row->consumer_key, $this);
$consumer->setRecordId(intval($row->consumer_pk));
$consumer->name = $row->name;
$consumer->secret = $row->secret;
$consumer->ltiVersion = $row->lti_version;
$consumer->consumerName = $row->consumer_name;
$consumer->consumerVersion = $row->consumer_version;
$consumer->consumerGuid = $row->consumer_guid;
$consumer->profile = json_decode($row->profile);
$consumer->toolProxy = $row->tool_proxy;
$settings = unserialize($row->settings);
if (!is_array($settings)) {
$settings = array();
}
$consumer->setSettings($settings);
$consumer->protected = (intval($row->protected) === 1);
$consumer->enabled = (intval($row->enabled) === 1);
$consumer->enableFrom = null;
if (!is_null($row->enable_from)) {
$consumer->enableFrom = strtotime($row->enable_from);
}
$consumer->enableUntil = null;
if (!is_null($row->enable_until)) {
$consumer->enableUntil = strtotime($row->enable_until);
}
$consumer->lastAccess = null;
if (!is_null($row->last_access)) {
$consumer->lastAccess = strtotime($row->last_access);
}
$consumer->created = strtotime($row->created);
$consumer->updated = strtotime($row->updated);
$consumers[] = $consumer;
}
mysql_free_result($rsConsumers);
}
return $consumers;
}
###
### ToolProxy methods
###
###
# Load the tool proxy from the database
###
public function loadToolProxy($toolProxy)
{
return false;
}
###
# Save the tool proxy to the database
###
public function saveToolProxy($toolProxy)
{
return false;
}
###
# Delete the tool proxy from the database
###
public function deleteToolProxy($toolProxy)
{
return false;
}
###
### Context methods
###
/**
* Load context object.
*
* @param Context $context Context object
*
* @return boolean True if the context object was successfully loaded
*/
public function loadContext($context)
{
$ok = false;
if (!empty($context->getRecordId())) {
$sql = sprintf('SELECT context_pk, consumer_pk, lti_context_id, settings, created, updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' ' .
'WHERE (context_pk = %d)',
$context->getRecordId());
} else {
$sql = sprintf('SELECT context_pk, consumer_pk, lti_context_id, settings, created, updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' ' .
'WHERE (consumer_pk = %d) AND (lti_context_id = %s)',
$context->getConsumer()->getRecordId(), DataConnector::quoted($context->ltiContextId));
}
$rs_context = mysql_query($sql);
if ($rs_context) {
$row = mysql_fetch_object($rs_context);
if ($row) {
$context->setRecordId(intval($row->context_pk));
$context->setConsumerId(intval($row->consumer_pk));
$context->ltiContextId = $row->lti_context_id;
$settings = unserialize($row->settings);
if (!is_array($settings)) {
$settings = array();
}
$context->setSettings($settings);
$context->created = strtotime($row->created);
$context->updated = strtotime($row->updated);
$ok = true;
}
}
return $ok;
}
/**
* Save context object.
*
* @param Context $context Context object
*
* @return boolean True if the context object was successfully saved
*/
public function saveContext($context)
{
$time = time();
$now = date("{$this->dateFormat} {$this->timeFormat}", $time);
$settingsValue = serialize($context->getSettings());
$id = $context->getRecordId();
$consumer_pk = $context->getConsumer()->getRecordId();
if (empty($id)) {
$sql = sprintf("INSERT INTO {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' (consumer_pk, lti_context_id, ' .
'settings, created, updated) ' .
'VALUES (%d, %s, %s, %s, %s)',
$consumer_pk, DataConnector::quoted($context->ltiContextId),
DataConnector::quoted($settingsValue),
DataConnector::quoted($now), DataConnector::quoted($now));
} else {
$sql = sprintf("UPDATE {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' SET ' .
'lti_context_id = %s, settings = %s, '.
'updated = %s' .
'WHERE (consumer_pk = %d) AND (context_pk = %d)',
DataConnector::quoted($context->ltiContextId), DataConnector::quoted($settingsValue),
DataConnector::quoted($now), $consumer_pk, $id);
}
$ok = mysql_query($sql);
if ($ok) {
if (empty($id)) {
$context->setRecordId(mysql_insert_id());
$context->created = $time;
}
$context->updated = $time;
}
return $ok;
}
/**
* Delete context object.
*
* @param Context $context Context object
*
* @return boolean True if the Context object was successfully deleted
*/
public function deleteContext($context)
{
// Delete any outstanding share keys for resource links for this context
$sql = sprintf('DELETE sk ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' sk ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON sk.resource_link_pk = rl.resource_link_pk ' .
'WHERE rl.context_pk = %d',
$context->getRecordId());
mysql_query($sql);
// Delete any users in resource links for this context
$sql = sprintf('DELETE u ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' u ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON u.resource_link_pk = rl.resource_link_pk ' .
'WHERE rl.context_pk = %d',
$context->getRecordId());
mysql_query($sql);
// Update any resource links for which this consumer is acting as a primary resource link
$sql = sprintf("UPDATE {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' prl ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ON prl.primary_resource_link_pk = rl.resource_link_pk ' .
'SET prl.primary_resource_link_pk = null, prl.share_approved = null ' .
'WHERE rl.context_pk = %d',
$context->getRecordId());
$ok = mysql_query($sql);
// Delete any resource links for this consumer
$sql = sprintf('DELETE rl ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' rl ' .
'WHERE rl.context_pk = %d',
$context->getRecordId());
mysql_query($sql);
// Delete context
$sql = sprintf('DELETE c ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::CONTEXT_TABLE_NAME . ' c ',
'WHERE c.context_pk = %d',
$context->getRecordId());
$ok = mysql_query($sql);
if ($ok) {
$context->initialize();
}
return $ok;
}
###
### ResourceLink methods
###
/**
* Load resource link object.
*
* @param ResourceLink $resourceLink Resource_Link object
*
* @return boolean True if the resource link object was successfully loaded
*/
public function loadResourceLink($resourceLink)
{
$ok = false;
if (!empty($resourceLink->getRecordId())) {
$sql = sprintf('SELECT resource_link_pk, context_pk, consumer_pk, lti_resource_link_id, settings, primary_resource_link_pk, share_approved, created, updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' ' .
'WHERE (resource_link_pk = %d)',
$resourceLink->getRecordId());
} else if (!empty($resourceLink->getContext())) {
$sql = sprintf('SELECT resource_link_pk, context_pk, consumer_pk, lti_resource_link_id, settings, primary_resource_link_pk, share_approved, created, updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' ' .
'WHERE (context_pk = %d) AND (lti_resource_link_id = %s)',
$resourceLink->getContext()->getRecordId(), DataConnector::quoted($resourceLink->getId()));
} else {
$sql = sprintf('SELECT r.resource_link_pk, r.context_pk, r.consumer_pk, r.lti_resource_link_id, r.settings, r.primary_resource_link_pk, r.share_approved, r.created, r.updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' r LEFT OUTER JOIN ' .
$this->dbTableNamePrefix . DataConnector::CONTEXT_TABLE_NAME . ' c ON r.context_pk = c.context_pk ' .
' WHERE ((r.consumer_pk = %d) OR (c.consumer_pk = %d)) AND (lti_resource_link_id = %s)',
$resourceLink->getConsumer()->getRecordId(), $resourceLink->getConsumer()->getRecordId(), DataConnector::quoted($resourceLink->getId()));
}
$rsContext = mysql_query($sql);
if ($rsContext) {
$row = mysql_fetch_object($rsContext);
if ($row) {
$resourceLink->setRecordId(intval($row->resource_link_pk));
if (!is_null($row->context_pk)) {
$resourceLink->setContextId(intval($row->context_pk));
} else {
$resourceLink->setContextId(null);
}
if (!is_null($row->consumer_pk)) {
$resourceLink->setConsumerId(intval($row->consumer_pk));
} else {
$resourceLink->setConsumerId(null);
}
$resourceLink->ltiResourceLinkId = $row->lti_resource_link_id;
$settings = unserialize($row->settings);
if (!is_array($settings)) {
$settings = array();
}
$resourceLink->setSettings($settings);
if (!is_null($row->primary_resource_link_pk)) {
$resourceLink->primaryResourceLinkId = intval($row->primary_resource_link_pk);
} else {
$resourceLink->primaryResourceLinkId = null;
}
$resourceLink->shareApproved = (is_null($row->share_approved)) ? null : (intval($row->share_approved) === 1);
$resourceLink->created = strtotime($row->created);
$resourceLink->updated = strtotime($row->updated);
$ok = true;
}
}
return $ok;
}
/**
* Save resource link object.
*
* @param ResourceLink $resourceLink Resource_Link object
*
* @return boolean True if the resource link object was successfully saved
*/
public function saveResourceLink($resourceLink) {
if (is_null($resourceLink->shareApproved)) {
$approved = 'NULL';
} else if ($resourceLink->shareApproved) {
$approved = '1';
} else {
$approved = '0';
}
if (empty($resourceLink->primaryResourceLinkId)) {
$primaryResourceLinkId = 'NULL';
} else {
$primaryResourceLinkId = strval($resourceLink->primaryResourceLinkId);
}
$time = time();
$now = date("{$this->dateFormat} {$this->timeFormat}", $time);
$settingsValue = serialize($resourceLink->getSettings());
if (!empty($resourceLink->getContext())) {
$consumerId = 'NULL';
$contextId = strval($resourceLink->getContext()->getRecordId());
} else if (!empty($resourceLink->getContextId())) {
$consumerId = 'NULL';
$contextId = strval($resourceLink->getContextId());
} else {
$consumerId = strval($resourceLink->getConsumer()->getRecordId());
$contextId = 'NULL';
}
$id = $resourceLink->getRecordId();
if (empty($id)) {
$sql = sprintf("INSERT INTO {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' (consumer_pk, context_pk, ' .
'lti_resource_link_id, settings, primary_resource_link_pk, share_approved, created, updated) ' .
'VALUES (%s, %s, %s, %s, %s, %s, %s, %s)',
$consumerId, $contextId, DataConnector::quoted($resourceLink->getId()),
DataConnector::quoted($settingsValue),
$primaryResourceLinkId, $approved, DataConnector::quoted($now), DataConnector::quoted($now));
} else if ($contextId !== 'NULL') {
$sql = sprintf("UPDATE {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' SET ' .
'consumer_pk = %s, lti_resource_link_id = %s, settings = %s, '.
'primary_resource_link_pk = %s, share_approved = %s, updated = %s ' .
'WHERE (context_pk = %s) AND (resource_link_pk = %d)',
$consumerId, DataConnector::quoted($resourceLink->getId()),
DataConnector::quoted($settingsValue), $primaryResourceLinkId, $approved, DataConnector::quoted($now),
$contextId, $id);
} else {
$sql = sprintf("UPDATE {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' SET ' .
'context_pk = %s, lti_resource_link_id = %s, settings = %s, '.
'primary_resource_link_pk = %s, share_approved = %s, updated = %s ' .
'WHERE (consumer_pk = %s) AND (resource_link_pk = %d)',
$contextId, DataConnector::quoted($resourceLink->getId()),
DataConnector::quoted($settingsValue), $primaryResourceLinkId, $approved, DataConnector::quoted($now),
$consumerId, $id);
}
$ok = mysql_query($sql);
if ($ok) {
if (empty($id)) {
$resourceLink->setRecordId(mysql_insert_id());
$resourceLink->created = $time;
}
$resourceLink->updated = $time;
}
return $ok;
}
/**
* Delete resource link object.
*
* @param ResourceLink $resourceLink Resource_Link object
*
* @return boolean True if the resource link object was successfully deleted
*/
public function deleteResourceLink($resourceLink)
{
// Delete any outstanding share keys for resource links for this consumer
$sql = sprintf("DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' ' .
'WHERE (resource_link_pk = %d)',
$resourceLink->getRecordId());
$ok = mysql_query($sql);
// Delete users
if ($ok) {
$sql = sprintf("DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' ' .
'WHERE (resource_link_pk = %d)',
$resourceLink->getRecordId());
$ok = mysql_query($sql);
}
// Update any resource links for which this is the primary resource link
if ($ok) {
$sql = sprintf("UPDATE {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' ' .
'SET primary_resource_link_pk = NULL ' .
'WHERE (primary_resource_link_pk = %d)',
$resourceLink->getRecordId());
$ok = mysql_query($sql);
}
// Delete resource link
if ($ok) {
$sql = sprintf("DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' ' .
'WHERE (resource_link_pk = %s)',
$resourceLink->getRecordId());
$ok = mysql_query($sql);
}
if ($ok) {
$resourceLink->initialize();
}
return $ok;
}
/**
* Get array of user objects.
*
* Obtain an array of User objects for users with a result sourcedId. The array may include users from other
* resource links which are sharing this resource link. It may also be optionally indexed by the user ID of a specified scope.
*
* @param ResourceLink $resourceLink Resource link object
* @param boolean $localOnly True if only users within the resource link are to be returned (excluding users sharing this resource link)
* @param int $idScope Scope value to use for user IDs
*
* @return array Array of User objects
*/
public function getUserResultSourcedIDsResourceLink($resourceLink, $localOnly, $idScope)
{
$users = array();
if ($localOnly) {
$sql = sprintf('SELECT u.user_pk, u.lti_result_sourcedid, u.lti_user_id, u.created, u.updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' AS u ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' AS rl ' .
'ON u.resource_link_pk = rl.resource_link_pk ' .
"WHERE (rl.resource_link_pk = %d) AND (rl.primary_resource_link_pk IS NULL)",
$resourceLink->getRecordId());
} else {
$sql = sprintf('SELECT u.user_pk, u.lti_result_sourcedid, u.lti_user_id, u.created, u.updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' AS u ' .
"INNER JOIN {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' AS rl ' .
'ON u.resource_link_pk = rl.resource_link_pk ' .
'WHERE ((rl.resource_link_pk = %d) AND (rl.primary_resource_link_pk IS NULL)) OR ' .
'((rl.primary_resource_link_pk = %d) AND (share_approved = 1))',
$resourceLink->getRecordId(), $resourceLink->getRecordId());
}
$rsUser = mysql_query($sql);
if ($rsUser) {
while ($row = mysql_fetch_object($rsUser)) {
$user = ToolProvider\User::fromResourceLink($resourceLink, $row->lti_user_id);
$user->setRecordId(intval($row->user_pk));
$user->ltiResultSourcedId = $row->lti_result_sourcedid;
$user->created = strtotime($row->created);
$user->updated = strtotime($row->updated);
if (is_null($idScope)) {
$users[] = $user;
} else {
$users[$user->getId($idScope)] = $user;
}
}
}
return $users;
}
/**
* Get array of shares defined for this resource link.
*
* @param ResourceLink $resourceLink Resource_Link object
*
* @return array Array of ResourceLinkShare objects
*/
public function getSharesResourceLink($resourceLink)
{
$shares = array();
$sql = sprintf('SELECT consumer_pk, resource_link_pk, share_approved ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_TABLE_NAME . ' ' .
'WHERE (primary_resource_link_pk = %d) ' .
'ORDER BY consumer_pk',
$resourceLink->getRecordId());
$rsShare = mysql_query($sql);
if ($rsShare) {
while ($row = mysql_fetch_object($rsShare)) {
$share = new ToolProvider\ResourceLinkShare();
$share->resourceLinkId = intval($row->resource_link_pk);
$share->approved = (intval($row->share_approved) === 1);
$shares[] = $share;
}
}
return $shares;
}
###
### ConsumerNonce methods
###
/**
* Load nonce object.
*
* @param ConsumerNonce $nonce Nonce object
*
* @return boolean True if the nonce object was successfully loaded
*/
public function loadConsumerNonce($nonce)
{
$ok = true;
// Delete any expired nonce values
$now = date("{$this->dateFormat} {$this->timeFormat}", time());
$sql = "DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::NONCE_TABLE_NAME . " WHERE expires <= '{$now}'";
mysql_query($sql);
// Load the nonce
$sql = sprintf("SELECT value AS T FROM {$this->dbTableNamePrefix}" . DataConnector::NONCE_TABLE_NAME . ' WHERE (consumer_pk = %d) AND (value = %s)',
$nonce->getConsumer()->getRecordId(), DataConnector::quoted($nonce->getValue()));
$rs_nonce = mysql_query($sql);
if ($rs_nonce) {
$row = mysql_fetch_object($rs_nonce);
if ($row === false) {
$ok = false;
}
}
return $ok;
}
/**
* Save nonce object.
*
* @param ConsumerNonce $nonce Nonce object
*
* @return boolean True if the nonce object was successfully saved
*/
public function saveConsumerNonce($nonce)
{
$expires = date("{$this->dateFormat} {$this->timeFormat}", $nonce->expires);
$sql = sprintf("INSERT INTO {$this->dbTableNamePrefix}" . DataConnector::NONCE_TABLE_NAME . " (consumer_pk, value, expires) VALUES (%d, %s, %s)",
$nonce->getConsumer()->getRecordId(), DataConnector::quoted($nonce->getValue()),
DataConnector::quoted($expires));
$ok = mysql_query($sql);
return $ok;
}
###
### ResourceLinkShareKey methods
###
/**
* Load resource link share key object.
*
* @param ResourceLinkShareKey $shareKey Resource_Link share key object
*
* @return boolean True if the resource link share key object was successfully loaded
*/
public function loadResourceLinkShareKey($shareKey)
{
$ok = false;
// Clear expired share keys
$now = date("{$this->dateFormat} {$this->timeFormat}", time());
$sql = "DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . " WHERE expires <= '{$now}'";
mysql_query($sql);
// Load share key
$id = mysql_real_escape_string($shareKey->getId());
$sql = 'SELECT resource_link_pk, auto_approve, expires ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' ' .
"WHERE share_key_id = '{$id}'";
$rsShareKey = mysql_query($sql);
if ($rsShareKey) {
$row = mysql_fetch_object($rsShareKey);
if ($row && (intval($row->resource_link_pk) === $shareKey->resourceLinkId)) {
$shareKey->autoApprove = (intval($row->auto_approve) === 1);
$shareKey->expires = strtotime($row->expires);
$ok = true;
}
}
return $ok;
}
/**
* Save resource link share key object.
*
* @param ResourceLinkShareKey $shareKey Resource link share key object
*
* @return boolean True if the resource link share key object was successfully saved
*/
public function saveResourceLinkShareKey($shareKey)
{
if ($shareKey->autoApprove) {
$approve = 1;
} else {
$approve = 0;
}
$expires = date("{$this->dateFormat} {$this->timeFormat}", $shareKey->expires);
$sql = sprintf("INSERT INTO {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . ' ' .
'(share_key_id, resource_link_pk, auto_approve, expires) ' .
"VALUES (%s, %d, {$approve}, '{$expires}')",
DataConnector::quoted($shareKey->getId()), $shareKey->resourceLinkId);
$ok = mysql_query($sql);
return $ok;
}
/**
* Delete resource link share key object.
*
* @param ResourceLinkShareKey $shareKey Resource link share key object
*
* @return boolean True if the resource link share key object was successfully deleted
*/
public function deleteResourceLinkShareKey($shareKey)
{
$sql = "DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::RESOURCE_LINK_SHARE_KEY_TABLE_NAME . " WHERE share_key_id = '{$shareKey->getId()}'";
$ok = mysql_query($sql);
if ($ok) {
$shareKey->initialize();
}
return $ok;
}
###
### User methods
###
/**
* Load user object.
*
* @param User $user User object
*
* @return boolean True if the user object was successfully loaded
*/
public function loadUser($user)
{
$ok = false;
if (!empty($user->getRecordId())) {
$sql = sprintf('SELECT user_pk, resource_link_pk, lti_user_id, lti_result_sourcedid, created, updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' ' .
'WHERE (user_pk = %d)',
$user->getRecordId());
} else {
$sql = sprintf('SELECT user_pk, resource_link_pk, lti_user_id, lti_result_sourcedid, created, updated ' .
"FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' ' .
'WHERE (resource_link_pk = %d) AND (lti_user_id = %s)',
$user->getResourceLink()->getRecordId(),
DataConnector::quoted($user->getId(ToolProvider\ToolProvider::ID_SCOPE_ID_ONLY)));
}
$rsUser = mysql_query($sql);
if ($rsUser) {
$row = mysql_fetch_object($rsUser);
if ($row) {
$user->setRecordId(intval($row->user_pk));
$user->setResourceLinkId(intval($row->resource_link_pk));
$user->ltiUserId = $row->lti_user_id;
$user->ltiResultSourcedId = $row->lti_result_sourcedid;
$user->created = strtotime($row->created);
$user->updated = strtotime($row->updated);
$ok = true;
}
}
return $ok;
}
/**
* Save user object.
*
* @param User $user User object
*
* @return boolean True if the user object was successfully saved
*/
public function saveUser($user)
{
$time = time();
$now = date("{$this->dateFormat} {$this->timeFormat}", $time);
if (is_null($user->created)) {
$sql = sprintf("INSERT INTO {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' (resource_link_pk, ' .
'lti_user_id, lti_result_sourcedid, created, updated) ' .
'VALUES (%d, %s, %s, %s, %s)',
$user->getResourceLink()->getRecordId(),
DataConnector::quoted($user->getId(ToolProvider\ToolProvider::ID_SCOPE_ID_ONLY)), DataConnector::quoted($user->ltiResultSourcedId),
DataConnector::quoted($now), DataConnector::quoted($now));
} else {
$sql = sprintf("UPDATE {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' ' .
'SET lti_result_sourcedid = %s, updated = %s ' .
'WHERE (user_pk = %d)',
DataConnector::quoted($user->ltiResultSourcedId),
DataConnector::quoted($now),
$user->getRecordId());
}
$ok = mysql_query($sql);
if ($ok) {
if (is_null($user->created)) {
$user->setRecordId(mysql_insert_id());
$user->created = $time;
}
$user->updated = $time;
}
return $ok;
}
/**
* Delete user object.
*
* @param User $user User object
*
* @return boolean True if the user object was successfully deleted
*/
public function deleteUser($user)
{
$sql = sprintf("DELETE FROM {$this->dbTableNamePrefix}" . DataConnector::USER_RESULT_TABLE_NAME . ' ' .
'WHERE (user_pk = %d)',
$user->getRecordId());
$ok = mysql_query($sql);
if ($ok) {
$user->initialize();
}
return $ok;
}
}
| {
"content_hash": "ec44566777e951cb6ac5879d18db7138",
"timestamp": "",
"source": "github",
"line_count": 1044,
"max_line_length": 190,
"avg_line_length": 42.63026819923372,
"alnum_prop": 0.537320810677212,
"repo_name": "renspoesse/qualtrics_lti_bridge",
"id": "c0dc1ce1b39195e74c3e6e29d2c2838e9956ce3c",
"size": "44791",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "vendor/imsglobal/lti/src/ToolProvider/DataConnector/DataConnector_mysql.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "52377"
}
],
"symlink_target": ""
} |
package api
import (
"fmt"
"math/rand"
"testing"
"github.com/evermax/stargraph/github"
"github.com/evermax/stargraph/lib/mq"
)
func TestNewConf(t *testing.T) {
q := &msgq{}
NewConf(storedb{}, q, "add", "update")
if q.addQueue != "add" {
t.Fatalf("addQueue should be \"add\", instead is %s", q.addQueue)
}
if q.updateQueue != "update" {
t.Fatalf("updateQueue should be \"update\", instead is %s", q.updateQueue)
}
}
func TestTriggerAddJob(t *testing.T) {
var aqn = "add"
var uqn = "update"
q := &msgq{}
var conf = Conf{
MessageQueue: q,
AddQueue: aqn,
UpdateQueue: uqn,
}
err := conf.MessageQueue.DeclareQueue(aqn)
if err != nil {
t.Fatalf("An error occured while Declaring a queue: %v", err)
}
var count = rand.Intn(10)
for i := 0; i < count; i++ {
conf.TriggerAddJob(github.RepoInfo{}, "test")
}
if q.addJobTriggered != count {
t.Fatalf("The number of triggered job should be: %d, but is %d", count, q.addJobTriggered)
}
}
func TestTriggerUpdateJob(t *testing.T) {
var aqn = "add"
var uqn = "update"
q := &msgq{}
var conf = Conf{
MessageQueue: q,
AddQueue: aqn,
UpdateQueue: uqn,
}
err := conf.MessageQueue.DeclareQueue(uqn)
if err != nil {
t.Fatalf("An error occured while Declaring a queue: %v", err)
}
var count = rand.Intn(10)
for i := 0; i < count; i++ {
conf.TriggerUpdateJob(github.RepoInfo{}, "test")
}
if q.updateJobTriggered != count {
t.Fatalf("The number of triggered job should be: %d, but is %d", count, q.updateJobTriggered)
}
}
type msgq struct {
addQueue string
updateQueue string
addJobTriggered int
updateJobTriggered int
token string
}
func (q *msgq) DeclareQueue(name string) error {
if name == "" {
return fmt.Errorf("Name is null")
}
if name == "add" {
q.addQueue = name
}
if name == "update" {
q.updateQueue = name
}
return nil
}
func (q *msgq) Publish(name string, body []byte) error {
if q.addQueue != name && q.updateQueue != name {
// TODO check if indeed an non existing queue would indeed trigger error
return fmt.Errorf("No such Q %s", name)
}
if name == "add" {
q.addJobTriggered++
}
if name == "update" {
q.updateJobTriggered++
}
return nil
}
func (q *msgq) Consume(name string, r mq.Receiver) error {
return nil
}
| {
"content_hash": "d1a2cd19b718e13c3ff56ead6c67d7b6",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 95,
"avg_line_length": 20.607142857142858,
"alnum_prop": 0.639948006932409,
"repo_name": "evermax/stargraph",
"id": "ee0bc5224f92cd4ef85f424aee5c2be8e37e97ae",
"size": "2308",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/conf_test.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "62253"
},
{
"name": "HTML",
"bytes": "1327"
},
{
"name": "Makefile",
"bytes": "225"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../includes/main.css" type="text/css">
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<title>Apache CloudStack | The Power Behind Your Cloud</title>
</head>
<body>
<div id="insidetopbg">
<div id="inside_wrapper">
<div class="uppermenu_panel">
<div class="uppermenu_box"></div>
</div>
<div id="main_master">
<div id="inside_header">
<div class="header_top">
<a class="cloud_logo" href="http://cloudstack.org"></a>
<div class="mainemenu_panel"></div>
</div>
</div>
<div id="main_content">
<div class="inside_apileftpanel">
<div class="inside_contentpanel" style="width:930px;">
<div class="api_titlebox">
<div class="api_titlebox_left">
<span>
Apache CloudStack v4.11.0 Root Admin API Reference
</span>
<p></p>
<h1>updateNuageVspDevice</h1>
<p>Update a Nuage VSP device</p>
</div>
<div class="api_titlebox_right">
<a class="api_backbutton" href="../index.html"></a>
</div>
</div>
<div class="api_tablepanel">
<h2>Request parameters</h2>
<table class="apitable">
<tr class="hed">
<td style="width:200px;"><strong>Parameter Name</strong></td><td style="width:500px;">Description</td><td style="width:180px;">Required</td>
</tr>
<tr>
<td style="width:200px;"><strong>physicalnetworkid</strong></td><td style="width:500px;"><strong>the ID of the physical network in to which Nuage VSP is added</strong></td><td style="width:180px;"><strong>true</strong></td>
</tr>
<tr>
<td style="width:200px;"><i>apiversion</i></td><td style="width:500px;"><i>the version of the API to use to communicate to Nuage VSD</i></td><td style="width:180px;"><i>false</i></td>
</tr>
<tr>
<td style="width:200px;"><i>hostname</i></td><td style="width:500px;"><i>the hostname of the Nuage VSD</i></td><td style="width:180px;"><i>false</i></td>
</tr>
<tr>
<td style="width:200px;"><i>password</i></td><td style="width:500px;"><i>the password of CMS user in Nuage VSD</i></td><td style="width:180px;"><i>false</i></td>
</tr>
<tr>
<td style="width:200px;"><i>port</i></td><td style="width:500px;"><i>the port to communicate to Nuage VSD</i></td><td style="width:180px;"><i>false</i></td>
</tr>
<tr>
<td style="width:200px;"><i>retrycount</i></td><td style="width:500px;"><i>the number of retries on failure to communicate to Nuage VSD</i></td><td style="width:180px;"><i>false</i></td>
</tr>
<tr>
<td style="width:200px;"><i>retryinterval</i></td><td style="width:500px;"><i>the time to wait after failure before retrying to communicate to Nuage VSD</i></td><td style="width:180px;"><i>false</i></td>
</tr>
<tr>
<td style="width:200px;"><i>username</i></td><td style="width:500px;"><i>the user name of the CMS user in Nuage VSD</i></td><td style="width:180px;"><i>false</i></td>
</tr>
</table>
</div>
<div class="api_tablepanel">
<h2>Response Tags</h2>
<table class="apitable">
<tr class="hed">
<td style="width:200px;"><strong>Response Name</strong></td><td style="width:500px;">Description</td>
</tr>
<tr>
<td style="width:200px;"><strong>apiversion</strong></td><td style="width:500px;">the version of the API to use to communicate to Nuage VSD</td>
</tr>
<tr>
<td style="width:200px;"><strong>cmsid</strong></td><td style="width:500px;">the CMS ID generated by the Nuage VSD</td>
</tr>
<tr>
<td style="width:200px;"><strong>hostname</strong></td><td style="width:500px;">the hostname of the Nuage VSD</td>
</tr>
<tr>
<td style="width:200px;"><strong>nuagedevicename</strong></td><td style="width:500px;">the name of the Nuage VSP device</td>
</tr>
<tr>
<td style="width:200px;"><strong>physicalnetworkid</strong></td><td style="width:500px;">the ID of the physical network to which this Nuage VSP belongs to</td>
</tr>
<tr>
<td style="width:200px;"><strong>port</strong></td><td style="width:500px;">the port to communicate to Nuage VSD</td>
</tr>
<tr>
<td style="width:200px;"><strong>provider</strong></td><td style="width:500px;">the service provider name corresponding to this Nuage VSP device</td>
</tr>
<tr>
<td style="width:200px;"><strong>retrycount</strong></td><td style="width:500px;">the number of retries on failure to communicate to Nuage VSD</td>
</tr>
<tr>
<td style="width:200px;"><strong>retryinterval</strong></td><td style="width:500px;">the time to wait after failure before retrying to communicate to Nuage VSD</td>
</tr>
<tr>
<td style="width:200px;"><strong>vspdeviceid</strong></td><td style="width:500px;">the device id of the Nuage VSD</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="comments_thread">
<script type="text/javascript" src="https://comments.apache.org/show_comments.lua?site=test" async="true"></script>
<noscript>
<iframe width="930" height="500" src="https://comments.apache.org/iframe.lua?site=test&page=4.2.0/rootadmin"></iframe>
</noscript>
</div>
<div id="footer_mainmaster">
<p>Copyright © 2015 The Apache Software Foundation, Licensed under the
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0.</a>
<br>
Apache, CloudStack, Apache CloudStack, the Apache CloudStack logo, the CloudMonkey logo and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
</div>
</div>
</div>
</div>
</body>
</html>
| {
"content_hash": "e5cc02b31d4e9db86ea4496a231b14d9",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 223,
"avg_line_length": 42.04615384615385,
"alnum_prop": 0.6834979875594585,
"repo_name": "apache/cloudstack-www",
"id": "6c932fb258fc8dc3fbee1e477ebad63a182083d6",
"size": "5466",
"binary": false,
"copies": "4",
"ref": "refs/heads/main",
"path": "source/api/apidocs-4.11/apis/updateNuageVspDevice.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "568290"
},
{
"name": "HTML",
"bytes": "222229805"
},
{
"name": "JavaScript",
"bytes": "61116"
},
{
"name": "Python",
"bytes": "3284"
},
{
"name": "Ruby",
"bytes": "1973"
},
{
"name": "Shell",
"bytes": "873"
}
],
"symlink_target": ""
} |
describe("validators.format", function() {
var format = validate.validators.format.bind(validate.validators.format)
, options1 = {pattern: /^foobar$/i}
, options2 = {pattern: "^foobar$", flags: "i"};
afterEach(function() {
delete validate.validators.format.message;
delete validate.validators.format.options;
});
it("allows undefined values", function() {
expect(format(null, options1)).not.toBeDefined();
expect(format(null, options2)).not.toBeDefined();
expect(format(undefined, options1)).not.toBeDefined();
expect(format(undefined, options2)).not.toBeDefined();
});
it("allows values that matches the pattern", function() {
expect(format("fooBAR", options1)).not.toBeDefined();
expect(format("fooBAR", options2)).not.toBeDefined();
});
it("doesn't allow values that doesn't matches the pattern", function() {
expect(format("", options1)).toBeDefined("is invalid");
expect(format("", options2)).toBeDefined("is invalid");
expect(format(" ", options1)).toBeDefined("is invalid");
expect(format(" ", options2)).toBeDefined("is invalid");
expect(format("barfoo", options1)).toEqual("is invalid");
expect(format("barfoo", options2)).toEqual("is invalid");
});
it("non strings are not allowed", function() {
var obj = {toString: function() { return "foobar"; }};
expect(format(obj, options1)).toBeDefined();
expect(format(obj, options2)).toBeDefined();
expect(format(3, options1)).toBeDefined();
expect(format(3, options2)).toBeDefined();
});
it("non strings are not allowed", function() {
expect(format(3, options1)).toBeDefined();
expect(format(3, options2)).toBeDefined();
});
it("doesn't allow partial matches", function() {
var options1 = {pattern: /\.png$/g}
, options2 = {pattern: "\\.png$", flags: "g"};
expect(format("foo.png", options1)).toBeDefined();
expect(format("foo.png", options2)).toBeDefined();
});
it("allows a custom message", function() {
validate.validators.format.message = "is using a default message";
var options = {pattern: /^[a-z]+$/g};
expect(format("4711", options)).toEqual("is using a default message");
options.message = "must only contain a-z";
expect(format("4711", options)).toEqual("must only contain a-z");
});
it("supports the options being the pattern", function() {
expect(format("barfoo", options1.pattern)).toBeDefined();
expect(format("barfoo", options2.pattern)).toBeDefined();
});
it("supports default options", function() {
validate.validators.format.options = {
message: "barfoo",
pattern: "abc"
};
var options = {message: 'foobar'};
expect(format("cba", options)).toEqual('foobar');
expect(format("cba", {})).toEqual('barfoo');
expect(validate.validators.format.options).toEqual({
message: "barfoo",
pattern: "abc"
});
expect(options).toEqual({message: "foobar"});
});
it("allows functions as messages", function() {
var message = function() { return "foo"; };
var options = {message: message, pattern: /bar/}
, value = "foo";
expect(format(value, options)).toBe(message);
});
});
| {
"content_hash": "8dee6b256e82f444d11c98a22334c28f",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 74,
"avg_line_length": 36.36363636363637,
"alnum_prop": 0.6478125,
"repo_name": "ansman/validate.js",
"id": "8764a17b92d18b031bef9fee649ccdc8e57e4d17",
"size": "3200",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "specs/validators/format-spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "144151"
},
{
"name": "JavaScript",
"bytes": "173914"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html xmlns="https://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-89196403-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-89196403-1');
</script>
<meta charset="utf-8"/>
<title>(conj community thoughts): Posts Tagged "functional programming"</title>
<meta name="description" content="Thoughts on Clojure, Functional Programming, and the like">
<meta name="keywords" content="">
<link rel="canonical" href="https://markbastian.github.io/tags-output/functional programming/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//fonts.googleapis.com/css?family=Alegreya:400italic,700italic,400,700" rel="stylesheet"
type="text/css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/styles/default.min.css">
<link href="/css/screen.css" rel="stylesheet" type="text/css" />
<script src="https://platform.twitter.com/widgets.js" type="text/javascript" async defer></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
<script src="https://platform.linkedin.com/in.js" type="text/javascript" async defer></script>
<script type="text/javascript" src="https://platform.linkedin.com/badges/js/profile.js" async defer></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">(conj community thoughts)</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li ><a href="/">Home</a></li>
<li
><a href="/archives/">Archives</a></li>
<li
>
<a href="/pages-output/about/">About</a>
</li>
<li><a href="/feed.xml">RSS</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
<div class="container">
<div class="row">
<div class="col-lg-9">
<div id="content">
<div id="posts-by-tag">
<div id="page-header">
<h2>Posts Tagged "functional programming"</h2>
</div>
<ul>
<li>
<a href="/posts-output/2016-04-07-tetris/">Another Tetris Clone in Clojure</a>
</li>
<li>
<a href="/posts-output/2015-10-26-concerns/">My Concern with Concerns</a>
</li>
<li>
<a href="/posts-output/2015-09-24-state-mgmt/">Clojure State Management by Example</a>
</li>
<li>
<a href="/posts-output/2015-08-25-snake/">A Clojure Snake Game</a>
</li>
<li>
<a href="/posts-output/2015-08-06-homoiconic/">Clojure is Homoiconic, Java is Not</a>
</li>
<li>
<a href="/posts-output/2015-07-22-three/">Three Reasons You May Not Want to Learn Clojure</a>
</li>
<li>
<a href="/posts-output/2015-07-14-quilwora/">Quil, Clojure, and WORA</a>
</li>
<li>
<a href="/posts-output/2015-06-11-differences/">Differences between Null, Nil, nil, Some, and None</a>
</li>
<li>
<a href="/posts-output/2015-05-27-exercises/">Exercises in Clojure with Commentary</a>
</li>
<li>
<a href="/posts-output/2015-05-15-fpfirehose/">Functional Programming from the Fire Hose</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3">
<div id="sidebar">
<h3>Links</h3>
<ul id="links">
<!-- <li><a href="https://cryogenweb.org/docs/home.html">Cryogen Docs</a></li>-->
<!-- <li><a href="https://carmen.la/blog/archives/">Carmen's Blog</a></li>-->
<li><a href="/pages-output/presentations/">Presentations</a></li>
<li><a href="/pages-output/projects/">Projects</a></li>
<li><a href="/pages-output/links/">Links</a></li>
</ul>
<div id="recent">
<h3>Recent Posts</h3>
<ul>
<li><a href="/posts-output/2020-07-03-the-joy-of-seqs/">Clojure and The Joy of Seqs</a></li>
<li><a href="/posts-output/2017-07-10-polymacro/">A Polynomial Macro</a></li>
<li><a href="/posts-output/2017-06-19-clojure-rising/">Clojure Rising</a></li>
<li><a href="/posts-output/2016-04-07-tetris/">Another Tetris Clone in Clojure</a></li>
<li><a href="/posts-output/2015-12-01-gettingstarted/">Clojure: Getting Started</a></li>
</ul>
</div>
<div id="tags">
<h3>Tags</h3>
<ul>
<li><a href="/tags-output/seq/">seq</a></li>
<li><a href="/tags-output/scala/">scala</a></li>
<li><a href="/tags-output/quil/">quil</a></li>
<li><a href="/tags-output/clojure/">clojure</a></li>
<li><a href="/tags-output/differential equations/">differential equations</a></li>
<li><a href="/tags-output/iterate/">iterate</a></li>
<li><a href="/tags-output/sequences/">sequences</a></li>
<li><a href="/tags-output/java/">java</a></li>
<li><a href="/tags-output/math/">math</a></li>
<li><a href="/tags-output/laziness/">laziness</a></li>
<li><a href="/tags-output/functional programming/">functional programming</a></li>
<li><a href="/tags-output/mazes/">mazes</a></li>
<li><a href="/tags-output/concurrency/">concurrency</a></li>
<li><a href="/tags-output/numerical analysis/">numerical analysis</a></li>
<li><a href="/tags-output/juxt/">juxt</a></li>
<li><a href="/tags-output/clojurescript/">clojurescript</a></li>
<li><a href="/tags-output/conway/">conway</a></li>
<li><a href="/tags-output/defmacro/">defmacro</a></li>
</ul>
</div>
<h3>Social</h3>
<p><a href="https://twitter.com/mark_bastian" class="twitter-follow-button" data-show-count="true">Follow @mark_bastian</a></p>
<p><a class="github-button" href="https://github.com/markbastian" data-size="large" data-show-count="true" aria-label="Follow @markbastian on GitHub">Follow @markbastian</a></p>
<p><div class="LI-profile-badge" data-version="v1" data-size="medium" data-locale="en_US" data-type="vertical" data-theme="light" data-vanity="mark-bastian-295553102"><a class="LI-simple-link" href='https://www.linkedin.com/in/mark-bastian-295553102?trk=profile-badge'>Mark Bastian</a></div></p>
</div>
</div>
</div>
<footer>Copyright © 2020 Mark Bastian
<p style="text-align: center;">Powered by <a href="https://cryogenweb.org">Cryogen</a></p></footer>
</div>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="/js/highlight.pack.js" type="text/javascript"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>
| {
"content_hash": "711244cc61d60acc0fbe3bd007ff4d91",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 312,
"avg_line_length": 44.16203703703704,
"alnum_prop": 0.4977460949785093,
"repo_name": "markbastian/markbastian.github.io",
"id": "3705ebc5ab1c6df63764ea6d8d3637e353dad910",
"size": "9539",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tags-output/functional programming/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "144082"
},
{
"name": "HTML",
"bytes": "656814"
},
{
"name": "JavaScript",
"bytes": "1667112"
}
],
"symlink_target": ""
} |
#include "OgreGLFrameBufferObject.h"
#include "OgreGLPixelFormat.h"
#include "OgreLogManager.h"
#include "OgreStringConverter.h"
#include "OgreRoot.h"
#include "OgreGLHardwarePixelBuffer.h"
#include "OgreGLFBORenderTexture.h"
#include "OgreGLDepthBuffer.h"
namespace Ogre {
//-----------------------------------------------------------------------------
GLFrameBufferObject::GLFrameBufferObject(GLFBOManager *manager, uint fsaa):
mManager(manager), mNumSamples(fsaa)
{
/// Generate framebuffer object
glGenFramebuffersEXT(1, &mFB);
// check multisampling
if (GLEW_EXT_framebuffer_blit && GLEW_EXT_framebuffer_multisample)
{
// check samples supported
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFB);
GLint maxSamples;
glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
mNumSamples = std::min(mNumSamples, (GLsizei)maxSamples);
}
else
{
mNumSamples = 0;
}
// will we need a second FBO to do multisampling?
if (mNumSamples)
{
glGenFramebuffersEXT(1, &mMultisampleFB);
}
else
{
mMultisampleFB = 0;
}
/// Initialise state
mDepth.buffer=0;
mStencil.buffer=0;
for(size_t x=0; x<OGRE_MAX_MULTIPLE_RENDER_TARGETS; ++x)
{
mColour[x].buffer=0;
}
}
GLFrameBufferObject::~GLFrameBufferObject()
{
mManager->releaseRenderBuffer(mDepth);
mManager->releaseRenderBuffer(mStencil);
mManager->releaseRenderBuffer(mMultisampleColourBuffer);
/// Delete framebuffer object
glDeleteFramebuffersEXT(1, &mFB);
if (mMultisampleFB)
glDeleteFramebuffersEXT(1, &mMultisampleFB);
}
void GLFrameBufferObject::bindSurface(size_t attachment, const GLSurfaceDesc &target)
{
assert(attachment < OGRE_MAX_MULTIPLE_RENDER_TARGETS);
mColour[attachment] = target;
// Re-initialise
if(mColour[0].buffer)
initialise();
}
void GLFrameBufferObject::unbindSurface(size_t attachment)
{
assert(attachment < OGRE_MAX_MULTIPLE_RENDER_TARGETS);
mColour[attachment].buffer = 0;
// Re-initialise if buffer 0 still bound
if(mColour[0].buffer)
{
initialise();
}
}
void GLFrameBufferObject::initialise()
{
// Release depth and stencil, if they were bound
mManager->releaseRenderBuffer(mDepth);
mManager->releaseRenderBuffer(mStencil);
mManager->releaseRenderBuffer(mMultisampleColourBuffer);
/// First buffer must be bound
if(!mColour[0].buffer)
{
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Attachment 0 must have surface attached",
"GLFrameBufferObject::initialise");
}
// If we're doing multisampling, then we need another FBO which contains a
// renderbuffer which is set up to multisample, and we'll blit it to the final
// FBO afterwards to perform the multisample resolve. In that case, the
// mMultisampleFB is bound during rendering and is the one with a depth/stencil
/// Store basic stats
size_t width = mColour[0].buffer->getWidth();
size_t height = mColour[0].buffer->getHeight();
GLuint format = mColour[0].buffer->getGLFormat();
ushort maxSupportedMRTs = Root::getSingleton().getRenderSystem()->getCapabilities()->getNumMultiRenderTargets();
// Bind simple buffer to add colour attachments
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFB);
/// Bind all attachment points to frame buffer
for(size_t x=0; x<maxSupportedMRTs; ++x)
{
if(mColour[x].buffer)
{
if(mColour[x].buffer->getWidth() != width || mColour[x].buffer->getHeight() != height)
{
StringStream ss;
ss << "Attachment " << x << " has incompatible size ";
ss << mColour[x].buffer->getWidth() << "x" << mColour[x].buffer->getHeight();
ss << ". It must be of the same as the size of surface 0, ";
ss << width << "x" << height;
ss << ".";
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, ss.str(), "GLFrameBufferObject::initialise");
}
if(mColour[x].buffer->getGLFormat() != format)
{
StringStream ss;
ss << "Attachment " << x << " has incompatible format.";
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, ss.str(), "GLFrameBufferObject::initialise");
}
mColour[x].buffer->bindToFramebuffer(GL_COLOR_ATTACHMENT0_EXT+x, mColour[x].zoffset);
}
else
{
// Detach
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT+x,
GL_RENDERBUFFER_EXT, 0);
}
}
// Now deal with depth / stencil
if (mMultisampleFB)
{
// Bind multisample buffer
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mMultisampleFB);
// Create AA render buffer (colour)
// note, this can be shared too because we blit it to the final FBO
// right after the render is finished
mMultisampleColourBuffer = mManager->requestRenderBuffer(format, width, height, mNumSamples);
// Attach it, because we won't be attaching below and non-multisample has
// actually been attached to other FBO
mMultisampleColourBuffer.buffer->bindToFramebuffer(GL_COLOR_ATTACHMENT0_EXT,
mMultisampleColourBuffer.zoffset);
// depth & stencil will be dealt with below
}
/// Depth buffer is not handled here anymore.
/// See GLFrameBufferObject::attachDepthBuffer() & RenderSystem::setDepthBufferFor()
/// Do glDrawBuffer calls
GLenum bufs[OGRE_MAX_MULTIPLE_RENDER_TARGETS];
GLsizei n=0;
for(size_t x=0; x<OGRE_MAX_MULTIPLE_RENDER_TARGETS; ++x)
{
// Fill attached colour buffers
if(mColour[x].buffer)
{
bufs[x] = GL_COLOR_ATTACHMENT0_EXT + x;
// Keep highest used buffer + 1
n = x+1;
}
else
{
bufs[x] = GL_NONE;
}
}
if(glDrawBuffers)
{
/// Drawbuffer extension supported, use it
glDrawBuffers(n, bufs);
}
else
{
/// In this case, the capabilities will not show more than 1 simultaneaous render target.
glDrawBuffer(bufs[0]);
}
if (mMultisampleFB)
{
// we need a read buffer because we'll be blitting to mFB
glReadBuffer(bufs[0]);
}
else
{
/// No read buffer, by default, if we want to read anyway we must not forget to set this.
glReadBuffer(GL_NONE);
}
/// Check status
GLuint status;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
/// Bind main buffer
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
switch(status)
{
case GL_FRAMEBUFFER_COMPLETE_EXT:
// All is good
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"All framebuffer formats with this texture internal format unsupported",
"GLFrameBufferObject::initialise");
default:
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"Framebuffer incomplete or other FBO status error",
"GLFrameBufferObject::initialise");
}
}
void GLFrameBufferObject::bind()
{
/// Bind it to FBO
const GLuint fb = mMultisampleFB ? mMultisampleFB : mFB;
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
}
void GLFrameBufferObject::swapBuffers()
{
if (mMultisampleFB)
{
// blit from multisample buffer to final buffer, triggers resolve
size_t width = mColour[0].buffer->getWidth();
size_t height = mColour[0].buffer->getHeight();
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, mMultisampleFB);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, mFB);
glBlitFramebufferEXT(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
}
void GLFrameBufferObject::attachDepthBuffer( DepthBuffer *depthBuffer )
{
GLDepthBuffer *glDepthBuffer = static_cast<GLDepthBuffer*>(depthBuffer);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mMultisampleFB ? mMultisampleFB : mFB );
if( glDepthBuffer )
{
GLRenderBuffer *depthBuf = glDepthBuffer->getDepthBuffer();
GLRenderBuffer *stencilBuf = glDepthBuffer->getStencilBuffer();
//Attach depth buffer, if it has one.
if( depthBuf )
depthBuf->bindToFramebuffer( GL_DEPTH_ATTACHMENT_EXT, 0 );
//Attach stencil buffer, if it has one.
if( stencilBuf )
stencilBuf->bindToFramebuffer( GL_STENCIL_ATTACHMENT_EXT, 0 );
}
else
{
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, 0);
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, 0);
}
}
//-----------------------------------------------------------------------------
void GLFrameBufferObject::detachDepthBuffer()
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mMultisampleFB ? mMultisampleFB : mFB );
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0 );
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, 0 );
}
size_t GLFrameBufferObject::getWidth()
{
assert(mColour[0].buffer);
return mColour[0].buffer->getWidth();
}
size_t GLFrameBufferObject::getHeight()
{
assert(mColour[0].buffer);
return mColour[0].buffer->getHeight();
}
PixelFormat GLFrameBufferObject::getFormat()
{
assert(mColour[0].buffer);
return mColour[0].buffer->getFormat();
}
GLsizei GLFrameBufferObject::getFSAA()
{
return mNumSamples;
}
//-----------------------------------------------------------------------------
}
| {
"content_hash": "01dfe3e4f9ec68dcf0dbf1128ead0cfc",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 120,
"avg_line_length": 33.123333333333335,
"alnum_prop": 0.6295662674851565,
"repo_name": "ehsan/ogre",
"id": "97059220ad5ccdb412691d0dd30ed95e8f35e539",
"size": "11300",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "RenderSystems/GL/src/OgreGLFrameBufferObject.cpp",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "4022"
},
{
"name": "C",
"bytes": "2460792"
},
{
"name": "C++",
"bytes": "20681039"
},
{
"name": "Java",
"bytes": "41426"
},
{
"name": "Objective-C",
"bytes": "304900"
},
{
"name": "Python",
"bytes": "421604"
},
{
"name": "Shell",
"bytes": "17735"
},
{
"name": "Visual Basic",
"bytes": "1029"
}
],
"symlink_target": ""
} |
package org.wildfly.camel.test.spring;
import java.net.URL;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.wildfly.camel.test.common.types.HelloBean;
import org.wildfly.extension.camel.SpringCamelContextFactory;
import org.wildfly.extension.camel.CamelAware;
/**
* Deploys a module/bundle which contain a {@link HelloBean} referenced from a spring context definition.
*
* The tests then build a route through the {@link SpringCamelContextFactory} API.
* This verifies access to beans within the same deployemnt.
*
* @author thomas.diesler@jboss.com
* @since 21-Apr-2013
*/
@CamelAware
@RunWith(Arquillian.class)
public class SpringBeanTransformTest {
@Deployment
public static JavaArchive createdeployment() {
final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "camel-spring-tests");
archive.addClasses(HelloBean.class);
archive.addAsResource("spring/bean-transformB-camel-context.xml", "some-other-name.xml");
return archive;
}
@Test
public void testSpringContextFromURL() throws Exception {
URL resourceUrl = getClass().getResource("/some-other-name.xml");
CamelContext camelctx = SpringCamelContextFactory.createSingleCamelContext(resourceUrl, getClass().getClassLoader());
camelctx.start();
try {
ProducerTemplate producer = camelctx.createProducerTemplate();
String result = producer.requestBody("direct:start", "Kermit", String.class);
Assert.assertEquals("Hello Kermit", result);
} finally {
camelctx.stop();
}
}
}
| {
"content_hash": "b20ac567f1da8e7edb1b321579fb3c69",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 125,
"avg_line_length": 35.68518518518518,
"alnum_prop": 0.7343020238713025,
"repo_name": "jamesnetherton/wildfly-camel",
"id": "5cef8ab18ccddae0c9149033400ee18d5b6d1d49",
"size": "2581",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "itests/standalone/smoke/src/test/java/org/wildfly/camel/test/spring/SpringBeanTransformTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "391"
},
{
"name": "Dockerfile",
"bytes": "602"
},
{
"name": "FreeMarker",
"bytes": "675"
},
{
"name": "Groovy",
"bytes": "15942"
},
{
"name": "HTML",
"bytes": "633"
},
{
"name": "Java",
"bytes": "2966813"
},
{
"name": "JavaScript",
"bytes": "1447"
},
{
"name": "Python",
"bytes": "60"
},
{
"name": "Ruby",
"bytes": "61"
},
{
"name": "Shell",
"bytes": "4829"
},
{
"name": "TSQL",
"bytes": "89"
},
{
"name": "Tcl",
"bytes": "34"
},
{
"name": "XSLT",
"bytes": "4383"
}
],
"symlink_target": ""
} |
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Use decision optimization to help a sports league schedule its games — DOcplex.MP: Mathematical Programming Modeling for Python V2.22 documentation</title>
<link rel="stylesheet" href="_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/bizstyle.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="The Unit Commitment Problem (UCP)" href="ucp_pandas.html" />
<link rel="prev" title="Maximizing the profit of an oil company" href="oil_blending.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="ucp_pandas.html" title="The Unit Commitment Problem (UCP)"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="oil_blending.html" title="Maximizing the profit of an oil company"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">DOcplex.MP: Mathematical Programming Modeling for Python V2.22 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="samples.html" accesskey="U">Examples of mathematical programming</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Use decision optimization to help a sports league schedule its games</a><ul>
<li><a class="reference internal" href="#the-business-problem-games-scheduling-in-the-national-football-league">The business problem: Games Scheduling in the National Football League</a></li>
<li><a class="reference internal" href="#how-decision-optimization-can-help">How decision optimization can help</a></li>
<li><a class="reference internal" href="#use-decision-optimization">Use decision optimization</a><ul>
<li><a class="reference internal" href="#step-1-import-the-library">Step 1: Import the library</a></li>
<li><a class="reference internal" href="#step-2-model-the-data">Step 2: Model the data</a></li>
<li><a class="reference internal" href="#step-3-prepare-the-data">Step 3: Prepare the data</a></li>
<li><a class="reference internal" href="#step-4-set-up-the-prescriptive-model">Step 4: Set up the prescriptive model</a><ul>
<li><a class="reference internal" href="#create-the-docplex-model">Create the DOcplex model</a></li>
<li><a class="reference internal" href="#define-the-decision-variables">Define the decision variables</a></li>
<li><a class="reference internal" href="#express-the-business-constraints">Express the business constraints</a><ul>
<li><a class="reference internal" href="#each-pair-of-teams-must-play-the-correct-number-of-games">Each pair of teams must play the correct number of games.</a></li>
<li><a class="reference internal" href="#each-team-must-play-exactly-once-in-a-week">Each team must play exactly once in a week.</a></li>
<li><a class="reference internal" href="#games-between-the-same-teams-cannot-be-on-successive-weeks">Games between the same teams cannot be on successive weeks.</a></li>
<li><a class="reference internal" href="#some-intradivisional-games-should-be-in-the-first-half">Some intradivisional games should be in the first half.</a></li>
</ul>
</li>
<li><a class="reference internal" href="#express-the-objective">Express the objective</a></li>
</ul>
</li>
<li><a class="reference internal" href="#solve-with-decision-optimization">Solve with Decision Optimization</a></li>
<li><a class="reference internal" href="#step-5-investigate-the-solution-and-then-run-an-example-analysis">Step 5: Investigate the solution and then run an example analysis</a></li>
</ul>
</li>
<li><a class="reference internal" href="#summary">Summary</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="oil_blending.html"
title="previous chapter">Maximizing the profit of an oil company</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="ucp_pandas.html"
title="next chapter">The Unit Commitment Problem (UCP)</a></p>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="use-decision-optimization-to-help-a-sports-league-schedule-its-games">
<h1>Use decision optimization to help a sports league schedule its games<a class="headerlink" href="#use-decision-optimization-to-help-a-sports-league-schedule-its-games" title="Permalink to this headline">¶</a></h1>
<p>This tutorial includes everything you need to set up decision
optimization engines, build mathematical programming models, and arrive
at a good working schedule for a sports league’s games.</p>
<p>When you finish this tutorial, you’ll have a foundational knowledge of
<em>Prescriptive Analytics</em>.</p>
<blockquote>
<div><p>This notebook is part of <a class="reference external" href="http://ibmdecisionoptimization.github.io/docplex-doc/">Prescriptive Analytics for
Python</a></p>
<p>It requires either an <a class="reference external" href="http://ibmdecisionoptimization.github.io/docplex-doc/getting_started.html">installation of CPLEX
Optimizers</a>
or it can be run on <a class="reference external" href="https://www.ibm.com/cloud/watson-studio/">IBM Watson Studio
Cloud</a> (Sign up for a
<a class="reference external" href="https://dataplatform.cloud.ibm.com/registration/stepone?context=wdp&apps=all%3E">free IBM Cloud
account</a>
and you can start using Watson Studio Cloud right away).</p>
</div></blockquote>
<p>Table of contents:</p>
<ul class="simple">
<li><a class="reference internal" href="#the-business-problem-games-scheduling-in-the-national-football-league">The business problem: Games Scheduling in the National Football League</a></li>
<li><a class="reference internal" href="#how-decision-optimization-can-help">How decision optimization can help</a></li>
<li><a class="reference internal" href="#use-decision-optimization">Use decision optimization</a><ul>
<li><a class="reference internal" href="#step-1-import-the-library">Step 1: Import the library</a></li>
<li><a class="reference internal" href="#step-2-model-the-data">Step 2: Model the data</a></li>
<li><a class="reference internal" href="#step-3-prepare-the-data">Step 3: Prepare the data</a></li>
<li><a class="reference internal" href="#step-4-set-up-the-prescriptive-model">Step 4: Set up the prescriptive model</a><ul>
<li><a class="reference internal" href="#define-the-decision-variables">Define the decision variables</a></li>
<li><a class="reference internal" href="#express-the-business-constraints">Express the business constraints</a></li>
<li><a class="reference internal" href="#express-the-objective">Express the objective</a></li>
<li><a class="reference internal" href="#solve-with-decision-optimization">Solve with Decision Optimization</a></li>
</ul>
</li>
<li><a class="reference internal" href="#step-5-investigate-the-solution-and-then-run-an-example-analysis">Step 5: Investigate the solution and then run an example analysis</a></li>
</ul>
</li>
<li><a class="reference internal" href="#summary">Summary</a></li>
</ul>
<div class="section" id="the-business-problem-games-scheduling-in-the-national-football-league">
<h2>The business problem: Games Scheduling in the National Football League<a class="headerlink" href="#the-business-problem-games-scheduling-in-the-national-football-league" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>A sports league with two divisions must schedule games so that each
team plays every team within its division a given number of times,
and each team plays teams in the other division a given number of
times.</li>
<li>A team plays exactly one game each week.</li>
<li>A pair of teams cannot play each other on consecutive weeks.</li>
<li>While a third of a team’s intradivisional games must be played in the
first half of the season, the preference is for intradivisional games
to be held as late as possible in the season.<ul>
<li>To model this preference, there is an incentive for
intradivisional games that increases each week as a square of the
week.</li>
<li>An opponent must be assigned to each team each week to maximize
the total of the incentives..</li>
</ul>
</li>
</ul>
<p>This is a type of discrete optimization problem that can be solved by
using either <strong>Integer Programming</strong> (IP) or <strong>Constraint Programming</strong>
(CP).</p>
<blockquote>
<div><strong>Integer Programming</strong> is the class of problems defined as the
optimization of a linear function, subject to linear constraints over
integer variables.</div></blockquote>
<blockquote>
<div><strong>Constraint Programming</strong> problems generally have discrete decision
variables, but the constraints can be logical, and the arithmetic
expressions are not restricted to being linear.</div></blockquote>
<p>For the purposes of this tutorial, we will illustrate a solution with
mathematical programming (MIP).</p>
</div>
<div class="section" id="how-decision-optimization-can-help">
<h2>How decision optimization can help<a class="headerlink" href="#how-decision-optimization-can-help" title="Permalink to this headline">¶</a></h2>
<ul>
<li><p class="first">Prescriptive analytics (decision optimization) technology recommends
actions that are based on desired outcomes. It takes into account
specific scenarios, resources, and knowledge of past and current
events. With this insight, your organization can make better
decisions and have greater control of business outcomes.</p>
</li>
<li><p class="first">Prescriptive analytics is the next step on the path to insight-based
actions. It creates value through synergy with predictive analytics,
which analyzes data to predict future outcomes.</p>
</li>
<li><div class="first line-block">
<div class="line">Prescriptive analytics takes that insight to the next level by
suggesting the optimal way to handle that future situation.
Organizations that can act fast in dynamic conditions and make
superior decisions in uncertain environments gain a strong
competitive advantage.</div>
<div class="line"><br /></div>
</div>
</li>
</ul>
<p>With prescriptive analytics, you can:</p>
<ul class="simple">
<li>Automate the complex decisions and trade-offs to better manage your
limited resources.</li>
<li>Take advantage of a future opportunity or mitigate a future risk.</li>
<li>Proactively update recommendations based on changing events.</li>
<li>Meet operational goals, increase customer loyalty, prevent threats
and fraud, and optimize business processes.</li>
</ul>
</div>
<div class="section" id="use-decision-optimization">
<h2>Use decision optimization<a class="headerlink" href="#use-decision-optimization" title="Permalink to this headline">¶</a></h2>
<div class="section" id="step-1-import-the-library">
<h3>Step 1: Import the library<a class="headerlink" href="#step-1-import-the-library" title="Permalink to this headline">¶</a></h3>
<p>Run the following code to import the Decision Optimization CPLEX
Modeling library. The <em>DOcplex</em> library contains the two modeling
packages, Mathematical Programming (docplex.mp) and Constraint
Programming (docplex.cp).</p>
<p>If <em>CPLEX</em> is not installed, install CPLEX Community edition.</p>
</div>
<div class="section" id="step-2-model-the-data">
<h3>Step 2: Model the data<a class="headerlink" href="#step-2-model-the-data" title="Permalink to this headline">¶</a></h3>
<p>In this scenario, the data is simple. There are eight teams in each
division, and the teams must play each team in the division once and
each team outside the division once.</p>
<p>Use a Python module, <em>Collections</em>, which implements some data
structures that will help solve some problems. <em>Named tuples</em> helps to
define meaning of each position in a tuple. This helps the code be more
readable and self-documenting. You can use named tuples in any place
where you use tuples.</p>
<p>In this example, you create a <em>namedtuple</em> to contain information for
points. You are also defining some of the parameters.</p>
<p>Use basic HTML and a stylesheet to format the data.</p>
<style>
body {
margin: 0;
font-family: Helvetica;
}
table.dataframe {
border-collapse: collapse;
border: none;
}
table.dataframe tr {
border: none;
}
table.dataframe td, table.dataframe th {
margin: 0;
border: 1px solid white;
padding-left: 0.25em;
padding-right: 0.25em;
}
table.dataframe th:not(:empty) {
background-color: #fec;
text-align: left;
font-weight: normal;
}
table.dataframe tr:nth-child(2) th:empty {
border-left: none;
border-right: 1px dashed #888;
}
table.dataframe td {
border: 2px solid #ccf;
background-color: #f4f4ff;
}
table.dataframe thead th:first-child {
display: none;
}
table.dataframe tbody th {
display: none;
}
</style><p>Now you will import the <em>pandas</em> library. Pandas is an open source
Python library for data analysis. It uses two data structures, <em>Series</em>
and <em>DataFrame</em>, which are built on top of <em>NumPy</em>.</p>
<p>A <strong>Series</strong> is a one-dimensional object similar to an array, list, or
column in a table. It will assign a labeled index to each item in the
series. By default, each item receives an index label from 0 to N, where
N is the length of the series minus one.</p>
<p>A <strong>DataFrame</strong> is a tabular data structure comprised of rows and
columns, similar to a spreadsheet, database table, or R’s data.frame
object. Think of a DataFrame as a group of Series objects that share an
index (the column names).</p>
<p>In the example, each division (the AFC and the NFC) is part of a
DataFrame.</p>
<p>The following <em>display</em> function is a tool to show different
representations of objects. When you issue the <em>display(teams)</em> command,
you are sending the output to the notebook so that the result is stored
in the document.</p>
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>AFC</th>
<th>NFC</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>Baltimore Ravens</td>
<td>Chicago Bears</td>
</tr>
<tr>
<td>1</td>
<td>Cincinnati Bengals</td>
<td>Detroit Lions</td>
</tr>
<tr>
<td>2</td>
<td>Cleveland Browns</td>
<td>Green Bay Packers</td>
</tr>
<tr>
<td>3</td>
<td>Pittsburgh Steelers</td>
<td>Minnesota Vikings</td>
</tr>
<tr>
<td>4</td>
<td>Houston Texans</td>
<td>Atlanta Falcons</td>
</tr>
<tr>
<td>5</td>
<td>Indianapolis Colts</td>
<td>Carolina Panthers</td>
</tr>
<tr>
<td>6</td>
<td>Jacksonville Jaguars</td>
<td>New Orleans Saints</td>
</tr>
<tr>
<td>7</td>
<td>Tennessee Titans</td>
<td>Tampa Bay Buccaneers</td>
</tr>
<tr>
<td>8</td>
<td>Buffalo Bills</td>
<td>Dallas Cowboys</td>
</tr>
<tr>
<td>9</td>
<td>Miami Dolphins</td>
<td>New York Giants</td>
</tr>
<tr>
<td>10</td>
<td>New England Patriots</td>
<td>Philadelphia Eagles</td>
</tr>
<tr>
<td>11</td>
<td>New York Jets</td>
<td>Washington Redskins</td>
</tr>
<tr>
<td>12</td>
<td>Denver Broncos</td>
<td>Arizona Cardinals</td>
</tr>
<tr>
<td>13</td>
<td>Kansas City Chiefs</td>
<td>San Francisco 49ers</td>
</tr>
<tr>
<td>14</td>
<td>Oakland Raiders</td>
<td>Seattle Seahawks</td>
</tr>
<tr>
<td>15</td>
<td>San Diego Chargers</td>
<td>St. Louis Rams</td>
</tr>
</tbody>
</table>
</div></div>
<div class="section" id="step-3-prepare-the-data">
<h3>Step 3: Prepare the data<a class="headerlink" href="#step-3-prepare-the-data" title="Permalink to this headline">¶</a></h3>
<p>Given the number of teams in each division and the number of
intradivisional and interdivisional games to be played, you can
calculate the total number of teams and the number of weeks in the
schedule, assuming every team plays exactly one game per week.</p>
<p>The season is split into halves, and the number of the intradivisional
games that each team must play in the first half of the season is
calculated.</p>
<p>Number of games to play between pairs depends on whether the pairing is
intradivisional or not.</p>
</div>
<div class="section" id="step-4-set-up-the-prescriptive-model">
<h3>Step 4: Set up the prescriptive model<a class="headerlink" href="#step-4-set-up-the-prescriptive-model" title="Permalink to this headline">¶</a></h3>
<pre class="literal-block">
* system is: Windows 64bit
* Python version 3.7.3, located at: c:\local\python373\python.exe
* docplex is present, version is (2, 11, 0)
* pandas is present, version is 0.25.1
</pre>
<div class="section" id="create-the-docplex-model">
<h4>Create the DOcplex model<a class="headerlink" href="#create-the-docplex-model" title="Permalink to this headline">¶</a></h4>
<p>The model contains all the business constraints and defines the
objective.</p>
</div>
<div class="section" id="define-the-decision-variables">
<h4>Define the decision variables<a class="headerlink" href="#define-the-decision-variables" title="Permalink to this headline">¶</a></h4>
</div>
<div class="section" id="express-the-business-constraints">
<h4>Express the business constraints<a class="headerlink" href="#express-the-business-constraints" title="Permalink to this headline">¶</a></h4>
<div class="section" id="each-pair-of-teams-must-play-the-correct-number-of-games">
<h5>Each pair of teams must play the correct number of games.<a class="headerlink" href="#each-pair-of-teams-must-play-the-correct-number-of-games" title="Permalink to this headline">¶</a></h5>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Model</span><span class="p">:</span> <span class="n">sports</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">variables</span><span class="p">:</span> <span class="mi">405</span>
<span class="o">-</span> <span class="n">binary</span><span class="o">=</span><span class="mi">405</span><span class="p">,</span> <span class="n">integer</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">continuous</span><span class="o">=</span><span class="mi">0</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">constraints</span><span class="p">:</span> <span class="mi">45</span>
<span class="o">-</span> <span class="n">linear</span><span class="o">=</span><span class="mi">45</span>
<span class="o">-</span> <span class="n">parameters</span><span class="p">:</span> <span class="n">defaults</span>
<span class="o">-</span> <span class="n">problem</span> <span class="nb">type</span> <span class="ow">is</span><span class="p">:</span> <span class="n">MILP</span>
</pre></div>
</div>
</div>
<div class="section" id="each-team-must-play-exactly-once-in-a-week">
<h5>Each team must play exactly once in a week.<a class="headerlink" href="#each-team-must-play-exactly-once-in-a-week" title="Permalink to this headline">¶</a></h5>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Model</span><span class="p">:</span> <span class="n">sports</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">variables</span><span class="p">:</span> <span class="mi">405</span>
<span class="o">-</span> <span class="n">binary</span><span class="o">=</span><span class="mi">405</span><span class="p">,</span> <span class="n">integer</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">continuous</span><span class="o">=</span><span class="mi">0</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">constraints</span><span class="p">:</span> <span class="mi">135</span>
<span class="o">-</span> <span class="n">linear</span><span class="o">=</span><span class="mi">135</span>
<span class="o">-</span> <span class="n">parameters</span><span class="p">:</span> <span class="n">defaults</span>
<span class="o">-</span> <span class="n">problem</span> <span class="nb">type</span> <span class="ow">is</span><span class="p">:</span> <span class="n">MILP</span>
</pre></div>
</div>
</div>
<div class="section" id="games-between-the-same-teams-cannot-be-on-successive-weeks">
<h5>Games between the same teams cannot be on successive weeks.<a class="headerlink" href="#games-between-the-same-teams-cannot-be-on-successive-weeks" title="Permalink to this headline">¶</a></h5>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Model</span><span class="p">:</span> <span class="n">sports</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">variables</span><span class="p">:</span> <span class="mi">405</span>
<span class="o">-</span> <span class="n">binary</span><span class="o">=</span><span class="mi">405</span><span class="p">,</span> <span class="n">integer</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">continuous</span><span class="o">=</span><span class="mi">0</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">constraints</span><span class="p">:</span> <span class="mi">495</span>
<span class="o">-</span> <span class="n">linear</span><span class="o">=</span><span class="mi">495</span>
<span class="o">-</span> <span class="n">parameters</span><span class="p">:</span> <span class="n">defaults</span>
<span class="o">-</span> <span class="n">problem</span> <span class="nb">type</span> <span class="ow">is</span><span class="p">:</span> <span class="n">MILP</span>
</pre></div>
</div>
</div>
<div class="section" id="some-intradivisional-games-should-be-in-the-first-half">
<h5>Some intradivisional games should be in the first half.<a class="headerlink" href="#some-intradivisional-games-should-be-in-the-first-half" title="Permalink to this headline">¶</a></h5>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Model</span><span class="p">:</span> <span class="n">sports</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">variables</span><span class="p">:</span> <span class="mi">405</span>
<span class="o">-</span> <span class="n">binary</span><span class="o">=</span><span class="mi">405</span><span class="p">,</span> <span class="n">integer</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">continuous</span><span class="o">=</span><span class="mi">0</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">constraints</span><span class="p">:</span> <span class="mi">505</span>
<span class="o">-</span> <span class="n">linear</span><span class="o">=</span><span class="mi">505</span>
<span class="o">-</span> <span class="n">parameters</span><span class="p">:</span> <span class="n">defaults</span>
<span class="o">-</span> <span class="n">problem</span> <span class="nb">type</span> <span class="ow">is</span><span class="p">:</span> <span class="n">MILP</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="express-the-objective">
<h4>Express the objective<a class="headerlink" href="#express-the-objective" title="Permalink to this headline">¶</a></h4>
<p>The objective function for this example is designed to force
intradivisional games to occur as late in the season as possible. The
incentive for intradivisional games increases by week. There is no
incentive for interdivisional games.</p>
</div>
</div>
<div class="section" id="solve-with-decision-optimization">
<h3>Solve with Decision Optimization<a class="headerlink" href="#solve-with-decision-optimization" title="Permalink to this headline">¶</a></h3>
<p>You will get the best solution found after n seconds, due to a time
limit parameter.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">Model</span><span class="p">:</span> <span class="n">sports</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">variables</span><span class="p">:</span> <span class="mi">405</span>
<span class="o">-</span> <span class="n">binary</span><span class="o">=</span><span class="mi">405</span><span class="p">,</span> <span class="n">integer</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">continuous</span><span class="o">=</span><span class="mi">0</span>
<span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">constraints</span><span class="p">:</span> <span class="mi">505</span>
<span class="o">-</span> <span class="n">linear</span><span class="o">=</span><span class="mi">505</span>
<span class="o">-</span> <span class="n">parameters</span><span class="p">:</span> <span class="n">defaults</span>
<span class="o">-</span> <span class="n">problem</span> <span class="nb">type</span> <span class="ow">is</span><span class="p">:</span> <span class="n">MILP</span>
<span class="o">*</span> <span class="n">model</span> <span class="n">sports</span> <span class="n">solved</span> <span class="k">with</span> <span class="n">objective</span> <span class="o">=</span> <span class="mi">260</span>
</pre></div>
</div>
</div>
<div class="section" id="step-5-investigate-the-solution-and-then-run-an-example-analysis">
<h3>Step 5: Investigate the solution and then run an example analysis<a class="headerlink" href="#step-5-investigate-the-solution-and-then-run-an-example-analysis" title="Permalink to this headline">¶</a></h3>
<p>Determine which of the scheduled games will be a replay of one of the
last 10 Super Bowls. We start by creating a pandas DataFrame that
contains the year and teams who played the last 10 Super Bowls.</p>
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>year</th>
<th>team1</th>
<th>team2</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>2016</td>
<td>Carolina Panthers</td>
<td>Denver Broncos</td>
</tr>
<tr>
<td>1</td>
<td>2015</td>
<td>New England Patriots</td>
<td>Seattle Seahawks</td>
</tr>
<tr>
<td>2</td>
<td>2014</td>
<td>Seattle Seahawks</td>
<td>Denver Broncos</td>
</tr>
<tr>
<td>3</td>
<td>2013</td>
<td>Baltimore Ravens</td>
<td>San Francisco 49ers</td>
</tr>
<tr>
<td>4</td>
<td>2012</td>
<td>New York Giants</td>
<td>New England Patriots</td>
</tr>
<tr>
<td>5</td>
<td>2011</td>
<td>Green Bay Packers</td>
<td>Pittsburgh Steelers</td>
</tr>
<tr>
<td>6</td>
<td>2010</td>
<td>New Orleans Saints</td>
<td>Indianapolis Colts</td>
</tr>
<tr>
<td>7</td>
<td>2009</td>
<td>Pittsburgh Steelers</td>
<td>Arizona Cardinals</td>
</tr>
<tr>
<td>8</td>
<td>2008</td>
<td>New York Giants</td>
<td>New England Patriots</td>
</tr>
<tr>
<td>9</td>
<td>2007</td>
<td>Indianapolis Colts</td>
<td>Chicago Bears</td>
</tr>
</tbody>
</table>
</div><p>We now look for the games in our solution that are replays of one of the
past 10 Super Bowls.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[(</span><span class="mi">4</span><span class="p">,</span> <span class="s1">'February'</span><span class="p">,</span> <span class="s1">'Green Bay Packers'</span><span class="p">,</span> <span class="s1">'Pittsburgh Steelers'</span><span class="p">)]</span>
</pre></div>
</div>
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>week</th>
<th>Month</th>
<th>Team1</th>
<th>Team2</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>4</td>
<td>February</td>
<td>Green Bay Packers</td>
<td>Pittsburgh Steelers</td>
</tr>
</tbody>
</table>
</div></div>
</div>
<div class="section" id="summary">
<h2>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
<p>You learned how to set up and use IBM Decision Optimization CPLEX
Modeling for Python to formulate a Constraint Programming model and
solve it with CPLEX.</p>
<ul class="simple">
<li><a class="reference external" href="http://ibmdecisionoptimization.github.io/docplex-doc/">Decision Optimization CPLEX Modeling for Python
documentation</a></li>
<li><a class="reference external" href="https://developer.ibm.com/docloud/">Decision Optimization on
Cloud</a></li>
<li>Need help with DOcplex or to report a bug? Please go
<a class="reference external" href="https://stackoverflow.com/questions/tagged/docplex">here</a>.</li>
<li>Contact us at <a class="reference external" href="mailto:dofeedback%40wwpdl.vnet.ibm.com">dofeedback<span>@</span>wwpdl<span>.</span>vnet<span>.</span>ibm<span>.</span>com</a>.</li>
</ul>
<p>Copyright ? 2017-2019 IBM. IPLA licensed Sample Materials.</p>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="ucp_pandas.html" title="The Unit Commitment Problem (UCP)"
>next</a> |</li>
<li class="right" >
<a href="oil_blending.html" title="Maximizing the profit of an oil company"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">DOcplex.MP: Mathematical Programming Modeling for Python V2.22 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="samples.html" >Examples of mathematical programming</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2016-2021, IBM®.
</div>
</body>
</html> | {
"content_hash": "cc0c0f01527efc1919e32f81ec0bcd0d",
"timestamp": "",
"source": "github",
"line_count": 674,
"max_line_length": 380,
"avg_line_length": 50.24925816023739,
"alnum_prop": 0.6718731546002126,
"repo_name": "IBMDecisionOptimization/docplex-doc",
"id": "d4357f083562497d5effb7329d8cc07893149789",
"size": "33870",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/2.22.213/mp/sports_scheduling.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/// \file iota.hpp
/// \brief Generate an increasing series
/// \author Marshall Clow
#ifndef BOOST_ALGORITHM_IOTA_HPP
#define BOOST_ALGORITHM_IOTA_HPP
#include <numeric>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
namespace boost { namespace algorithm {
#if __cplusplus >= 201103L
// Use the C++11 versions of iota if it is available
using std::iota; // Section 26.7.6
#else
/// \fn iota ( ForwardIterator first, ForwardIterator last, T value )
/// \brief Generates an increasing sequence of values, and stores them in [first, last)
///
/// \param first The start of the input sequence
/// \param last One past the end of the input sequence
/// \param value The initial value of the sequence to be generated
/// \note This function is part of the C++2011 standard library.
/// We will use the standard one if it is available,
/// otherwise we have our own implementation.
template <typename ForwardIterator, typename T>
void iota ( ForwardIterator first, ForwardIterator last, T value )
{
for ( ; first != last; ++first, ++value )
*first = value;
}
#endif
/// \fn iota ( Range &r, T value )
/// \brief Generates an increasing sequence of values, and stores them in the input Range.
///
/// \param r The input range
/// \param value The initial value of the sequence to be generated
///
template <typename Range, typename T>
void iota ( Range &r, T value )
{
boost::algorithm::iota (boost::begin(r), boost::end(r), value);
}
/// \fn iota_n ( OutputIterator out, T value, std::size_t n )
/// \brief Generates an increasing sequence of values, and stores them in the input Range.
///
/// \param out An output iterator to write the results into
/// \param value The initial value of the sequence to be generated
/// \param n The number of items to write
///
template <typename OutputIterator, typename T>
OutputIterator iota_n ( OutputIterator out, T value, std::size_t n )
{
for ( ; n > 0; --n, ++value )
*out++ = value;
return out;
}
}}
#endif // BOOST_ALGORITHM_IOTA_HPP
| {
"content_hash": "40a4c8c96bb86c596b7b16cf28f2b385",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 90,
"avg_line_length": 31.36231884057971,
"alnum_prop": 0.6534195933456562,
"repo_name": "xissburg/XDefrac",
"id": "b9156d6f739cdcbfdde2da8ec85db457ee229517",
"size": "2371",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "boost/algorithm/cxx11/iota.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "9408801"
},
{
"name": "C++",
"bytes": "112947287"
},
{
"name": "Cuda",
"bytes": "97077"
},
{
"name": "Erlang",
"bytes": "286"
},
{
"name": "FLUX",
"bytes": "8351"
},
{
"name": "Objective-C",
"bytes": "171241"
},
{
"name": "Objective-C++",
"bytes": "8498"
},
{
"name": "PHP",
"bytes": "86"
},
{
"name": "Perl",
"bytes": "197851"
},
{
"name": "Python",
"bytes": "5345"
},
{
"name": "R",
"bytes": "4052"
},
{
"name": "Ruby",
"bytes": "12845"
},
{
"name": "Shell",
"bytes": "37402"
}
],
"symlink_target": ""
} |
FROM node:8-alpine
WORKDIR /usr/src/omnium
COPY package*.json yarn.lock ./
RUN apk --no-cache --virtual build-dependencies add \
python \
make \
g++ \
&& yarn --frozen-lockfile \
&& apk del build-dependencies
COPY . .
CMD [ "yarn", "start" ]
| {
"content_hash": "2e999b76a6362eb5fa69b7f131e02d73",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 53,
"avg_line_length": 22.90909090909091,
"alnum_prop": 0.6547619047619048,
"repo_name": "ciarancrocker/sgs_bot",
"id": "15407397c4ec0befeb89f1fbf17a2e16dc3fd1d0",
"size": "252",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "Dockerfile",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Dockerfile",
"bytes": "252"
},
{
"name": "JavaScript",
"bytes": "63256"
},
{
"name": "Shell",
"bytes": "292"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Jekyll v3.7.4">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,700|Source+Code+Pro:300,400,700,900&subset=cyrillic,cyrillic-ext,latin-ext,vietnamese" rel="stylesheet">
<link rel="stylesheet" href="/css/main.css">
<link rel="icon" type="image/x-icon" href=" /favicon.ico ">
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>Research | Bitnation Pangea</title>
<meta name="generator" content="Jekyll v3.7.4" />
<meta property="og:title" content="Research" />
<meta name="author" content="Bitnation" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Your Blockchain Jurisdiction" />
<meta property="og:description" content="Your Blockchain Jurisdiction" />
<link rel="canonical" href="https://tse.bitnation.co/vi/research/" />
<meta property="og:url" content="https://tse.bitnation.co/research/" />
<meta property="og:site_name" content="Bitnation Pangea" />
<meta property="og:image" content="https://tse.bitnation.co/img/index.png" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@MyBitnation" />
<meta name="twitter:creator" content="@MyBitnation" />
<meta property="article:publisher" content="MyBitnation" />
<script type="application/ld+json">
{"image":"https://tse.bitnation.co/img/index.png","url":"https://tse.bitnation.co/research/","author":{"@type":"Person","name":"Bitnation"},"description":"Your Blockchain Jurisdiction","headline":"Research","@type":"WebPage","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<meta http-equiv="Content-Language" content="vi">
<script src="/js/cookieconsent.min.js"></script>
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#000000",
"text": "#ffffff"
},
"button": {
"background": "#ffce00",
"text": "#000000"
}
},
"theme": "edgeless",
"content": {
"link": "Learn more.",
"href": "/privacy-policy/"
}
})});
</script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-106469149-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window,document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '389494765122710');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1"
src="https://www.facebook.com/tr?id=389494765122710&ev=PageView
&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->
</head>
<body class="research">
<header class="main-header drop-shadow">
<div class="grid">
<div class="grid-cell top-logo">
<a href="https://tse.bitnation.co/vi/"><img src="/img/logo-bitnation-h.svg"></a>
</div>
<div class="grid-cell top-nav-icon">
<button><i id="openmenu" class="fal fa-bars"></i><i id="closemenu" class="hidden fal fa-times"></i></button>
</div>
<div id="topnav" class="main-menu grid-cell">
<nav class="grid main-nav">
<div class="grid-cell">
<a class="menu-item" href="/vi/" alt="Home">Trang chủ</a>
</div>
<div class="grid-cell">
<a class="menu-item" href="/vi/documents/" alt="Documents">Tài liệu</a>
</div>
<div class="grid-cell">
<a class="menu-item" href="/vi/research/" alt="Research">Research</a>
</div>
<div class="grid-cell">
<a class="menu-item" href="/vi/passport/" alt="Passport">Passport</a>
</div>
<div class="grid-cell">
<a class="menu-item" href="https://bitnation.consider.it/" alt="Proposals" target="_blank">Proposals</a>
</div>
<div class="grid-cell">
<a class="menu-item" href="/vi/faq/" alt="FAQ">FAQ</a>
</div>
<div class="grid-cell dropdown">
<button id ="active-language" class="menu-item"><i class="fal fa-language"></i></button>
<div id="available-languages" class="dropdown-content">
<a class="submenu-item" href=" /research/ ">English</a>
<a class="submenu-item" href="/ar/research/"><span dir="rtl">العَرَبِيَّة</span></a>
<a class="submenu-item" href="/de/research/">Deutsch</a>
<a class="submenu-item" href="/es/research/">Español</a>
<a class="submenu-item" href="/fr/research/">Français</a>
<a class="submenu-item" href="/id/research/">bahasa Indonesia</a>
<a class="submenu-item" href="/it/research/">Italiano</a>
<a class="submenu-item" href="/ja/research/">日本語</a>
<a class="submenu-item" href="/pl/research/">Język polski</a>
<a class="submenu-item" href="/pt/research/">Português</a>
<a class="submenu-item" href="/ru/research/">Русский</a>
<a class="submenu-item" href="/tr/research/">Türkçe</a>
</div>
</div>
</nav>
</div>
</div>
</header>
<main>
<section id="intro">
<div class="grid social-icons social-icons-top flex-end">
<div class="grid-cell">
<a href="https://github.com/Bit-Nation">
<span class="icon-m fa-layers fa-fw">
<i class="fab fa-github" data-fa-transform="shrink-6"></i>
<i class="fal fa-circle"></i>
</span>
</a>
</div>
<div class="grid-cell">
<a href="https://twitter.com/@MyBitnation">
<span class="icon-m fa-layers fa-fw">
<i class="fab fa-twitter" data-fa-transform="shrink-6"></i>
<i class="fal fa-circle"></i>
</span>
</a>
</div>
<div class="grid-cell">
<a href="https://angel.co/bitnation">
<span class="icon-m fa-layers fa-fw">
<i class="fab fa-angellist" data-fa-transform="shrink-6"></i>
<i class="fal fa-circle"></i>
</span>
</a>
</div>
<div class="grid-cell">
<a href="https://t.me/PangeaBitnation">
<span class="icon-m fa-layers fa-fw">
<i class="fab fa-telegram-plane" data-fa-transform="shrink-6"></i>
<i class="fal fa-circle"></i>
</span>
</a>
</div>
<div class="grid-cell">
<a href="https://www.facebook.com/MyBitnation">
<span class="icon-m fa-layers fa-fw">
<i class="fab fa-facebook-f" data-fa-transform="shrink-6"></i>
<i class="fal fa-circle"></i>
</span>
</a>
</div>
<div class="grid-cell">
<a href="https://steemit.com/@bitnation">
<span class="icon-m fa-layers fa-fw">
<i class="fab fa-steemit" data-fa-transform="shrink-6"></i>
<i class="fal fa-circle"></i>
</span>
</a>
</div>
</div>
<div class="grid flex-start margin-top-30">
<div class="grid-cell two-thirds yellow-box margin-initial drop-shadow">
<h2>The rapid shifts of recent years has created a new world. Yet we are running it on an old operating system.</h2>
</div>
</div>
<div class="white-box drop-shadow">
<div class="grid">
<div class="grid-cell one-third">
<p>Environmental challenges paired with technological disruption places humanity at a crossroads. We could be facing abundance or crisis. Both are highly likely - while continued status quo is increasingly unthinkable.</p>
</div>
<div class="grid-cell one-third">
<p>For the last five years, Bitnation has been gathering the most forward-looking applications of new technology for governance, in order to prepare the governance upgrade that the present fast-paced changes urgently call for.</p>
</div>
<div class="grid-cell one-third">
<p>In August Bitnation Future Governance Expedition launches, dedicated to systematise the fast-growing knowledge, mobilise the global community of governance innovators and explore – and create – the systems of tomorrow.</p>
</div>
</div>
<div class="grid flex-center">
<div class="grid-cell">
<div class="cta-hl">
<a href="http://eepurl.com/dyIZ9P" target="_blank">Register to learn more</a>
</div>
</div>
</div>
</div>
</section>
<section class=" darker-bg t-white">
<div class="grid flex-center">
<div class="grid-cell one-third">
<img class="img-round w-300 drop-shadow" alt="Carin Ism" src="/img/research-carin-ism.jpg">
</div>
<div class="grid-cell two-thirds">
<p class="bold">"Having spent the last years at GCF, mapping governance innovation initiatives in over 180 countries, it’s become clear to me that the time is right to mobilise the wealth of ideas into common action across borders and institutions. The Bitnation Future Governance Expedition aims to systematise, synthesize, and prepare suggested upgrades to current governance, ranging from general aspects such as citizenship, automation, trust, and privacy – to the more detailed ins and outs of specific implementations."</p>
<p>— Carin Ism</p>
</div>
</div>
</section>
</main>
<footer class="main-footer drop-shadow">
<div class="grid">
<div class="grid-cell footer-text">
<nav class="footer-menu">
<a href="mailto:info@bitnation.co" alt="info@bitnation.co">info@bitnation.co</a>
<a href="/vi/terms-of-use/" alt="Terms of Use">Điều khoản</a>
<a href="/vi/privacy-policy/" alt="Privacy Policy">Chính sách</a>
</nav>
<div class="footer-legal">
Copyright © 2019 Bitnation. All rights reserved.
</div>
</div>
</div>
</footer>
<script src="/js/fontawesome.min.js"></script>
<script src="/js/fa-light.min.js"></script>
<script src="/js/fa-brands.min.js"></script>
<script src="/js/script.js"></script>
</body>
</html> | {
"content_hash": "d660ea3a0c5957c3ddeea1a505247f26",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 541,
"avg_line_length": 43.438661710037174,
"alnum_prop": 0.5592640136927685,
"repo_name": "Bit-Nation/bit-nation.github.io",
"id": "a348f9c7110e08103d957926ef3a174486107ae1",
"size": "11738",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/vi/research/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "39112"
},
{
"name": "HTML",
"bytes": "180418"
},
{
"name": "JavaScript",
"bytes": "7148"
},
{
"name": "Ruby",
"bytes": "6707"
}
],
"symlink_target": ""
} |
import java.lang.Byte;
import java.util.HashMap;
import java.util.Map;
public class THashMapExample {
<caret>private static final Map<Byte, Byte> INT_INT_CONSTANT = new HashMap<>();
} | {
"content_hash": "8547ac036eaac1564b404ae7a314546d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 83,
"avg_line_length": 26.857142857142858,
"alnum_prop": 0.7446808510638298,
"repo_name": "artspb/jdk2trove",
"id": "0dc1659a124f328be884f1437afcb99792056fae",
"size": "244",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jdk2trove-plugin/testData/quickFix/hashmap/tTypeTypeHashMap/beforeByteByteConstant.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "218"
},
{
"name": "Java",
"bytes": "71576"
}
],
"symlink_target": ""
} |
from flask import current_app as app
from flask.ext.zodb import Object, List, Dict, ZODB
from hashlib import sha256
class User():
def __init__(self, username, password, userid):
self.username = username
self.passwordHash = sha256(password).hexdigest()
self.id = userid
self.offset = 0
self.restid_to_good_count = {}
self.restid_to_bad_count = {}
def updateGood(self, restid):
if restid in self.restid_to_good_count:
self.restid_to_good_count[restid] += 1
else:
self.restid_to_good_count[restid] = 1
def updateBad(self, restid):
if restid in self.rest_to_bad_count:
self.restid_to_bad_count[restid] += 1
else:
self.restid_to_bad_count[restid] = 1
def clearOffset(self):
self.offset = 0
def incrOffset(self, amount):
self.offset += amount
def getOffset(self):
return self.offset
@staticmethod
def getUserById(db, userid):
user = db['users'].get(userid, None)
return user
@staticmethod
def save(db, user):
print("updating user with id:"+str(user.id))
db['users'][user.id] = user
class Restaurant():
'''
# @name - string
# @pos - (lat, lon) tuple of floats (in degrees)
# @restid - int unique id for restaurant
# @categories - [str1, str2, str3, ...]
# @yelpCount - int
# @yelpRating - float
# @address - str
# @city - str
# @streets - str
# @zip_code - str
'''
def __init__(self, name, pos, restid, categories, yelp_count, yelp_rating, address, city, zip_code, img_url):
self.name = name
self.pos = pos
self.lat = pos[0]
self.lon = pos[1]
self.id = restid
self.good_count = 0
self.bad_count = 0
#yelp metadata
self.categories = categories
self.yelp_count = yelp_count
self.yelp_rating = yelp_rating
self.address = address
self.city = city
self.zip_code = zip_code
self.img_url = img_url
def updateGood(self):
self.good_count += 1
def updateBad(self):
self.bad_count += 1
#db - flask-ZODB instance
@staticmethod
def checkIfExists(db, pos):
if pos in db['restaurants']:
return True
else:
return False
@staticmethod
def getByPos(db, pos):
return db['restaurants'].get(pos, None)
@staticmethod
def save(db, restObj):
db['restaurants'][restObj.pos] = restObj
print "added "+restObj.name+" to the db."
| {
"content_hash": "afcf5d8e996ead5572c9e451aebf6a11",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 110,
"avg_line_length": 21.682692307692307,
"alnum_prop": 0.6651884700665188,
"repo_name": "skxu/Vittles",
"id": "8da3c134305bf412f40116ca2c82571e041b3b05",
"size": "2255",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "models.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1832"
},
{
"name": "Python",
"bytes": "9557"
}
],
"symlink_target": ""
} |
/*******************************************************************************
*
* Filename : MCHelper.hpp
* Description : Helper functions and variables for MC truth matching
* Author : Yi-Mu "Enoch" Chen [ ensc@hep1.phys.ntu.edu.tw ]
*
*******************************************************************************/
#ifndef MANAGERUTILS_PHYSUTILS_MCHELPER_HPP
#define MANAGERUTILS_PHYSUTILS_MCHELPER_HPP
#include "DataFormats/Candidate/interface/Candidate.h"
namespace mgr {
/*******************************************************************************
* PDG ID definitions:
* https://twiki.cern.ch/twiki/bin/view/Main/PdgId
*******************************************************************************/
enum PID
{
DOWN_QUARK_ID = 1,
UP_QUARK_ID = 2,
STRANGE_QUARK_ID = 3,
CHARM_QUARK_ID = 4,
BOTTOM_QUARK_ID = 5,
TOP_QUARK_ID = 6,
ELEC_ID = 11,
ELECNU_ID = 12,
MUON_ID = 13,
MUONNEU_ID = 14,
TAU_ID = 15,
TAUNEU_ID = 16,
GLUON_ID = 21,
GAMMA_ID = 22,
Z_BOSON_ID = 23,
W_BOSON_ID = 24,
HIGGS_BOSON_ID = 25
};
/*******************************************************************************
* Gen level topology transvering helper functions
*******************************************************************************/
/*******************************************************************************
* * GetDirectMother( x , F ),
* For an input particle x, it will trasverse the topology towards the parent
* side, until
* 1. the parent particle has the target flavour F, in which case it returns
* the pointer to the parent particle. Note that the absolue value will
* be taken for the for the flavour.
* 2. The parent particle has a flavour different to x, in which case a null
* pointer is return.
* This function help find direct parent of a particle while avoid the
* possibility of final state radiations,
*
* Ex: for the topology
* F->(x+g)->(x'+gg)->(x''+ggg)
* The three function calls
* - GetDirectMother( x, F )
* - GetDirectMother( x', F )
* - GetDirectMother( x'', F )
* should all return the same pointer.
*
* Topologies in MiniAOD also have some times have the strange topologies like:
* x -> x' -> x'' which could be avoided by this function.
*******************************************************************************/
const reco::Candidate* GetDirectMother( const reco::Candidate*, int );
/*******************************************************************************
* * GetDaughter( x, F)
* Return the pointer to the daughter particle of x whose flavour is F.
*
* For the decay x->F , and the strange single object decay F->F'->F'' ...
* this function will return the last of the decay chain (F'') in our case.
*******************************************************************************/
const reco::Candidate* GetDaughter( const reco::Candidate*, int );
} /* mgr */
#endif/* end of include guard: MANAGERUTILS_PHYSUTILS_MCHELPER_HPP */
| {
"content_hash": "f962f05a66aa0c73d8ca9215f9f5ef66",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 80,
"avg_line_length": 36.855421686746986,
"alnum_prop": 0.48218372016999017,
"repo_name": "NTUHEP-Tstar/ManagerUtils",
"id": "d25ad4490fd043c88773ed4dde0c75ae901a27cf",
"size": "3059",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PhysUtils/interface/MCHelper.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "313646"
},
{
"name": "Python",
"bytes": "5198"
}
],
"symlink_target": ""
} |
echo "Testing CRLS python code"
# Create temporary directory
mkdir temp
root="$( dirname "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" )"
sources="${root}/python"
root_len=$(( ${#root} + 8 ))
# Select files.
files=$(find ${sources} -type f -name "*.py")
failed=0
count=0
passed=0
function infile() {
f=${root}/tests/${1:$root_len}
echo "${f%.*}/input.txt"
return
}
function outfile() {
f=${root}/tests/${1:$root_len}
echo "${f%.*}/output.txt"
return
}
for FILE in $files; do
input=$(infile "$FILE")
expected=$(outfile "$FILE")
output="temp/expected.txt"
# Running
python "$FILE" < "$input" > "$output"
check=$(diff -q $output $expected)
if [ -z "$check" ]; then
passed=$(( $passed + 1 ))
else
failed=$(( $failed + 1 ))
printf '\e[1;31mTest Failed: \e[m%s\n' "${FILE}"
fi
count=$(( $count + 1 ))
done
# Remove temporary directory
rm -rf temp
# Check for errors
printf '\e[1;32mFinished running: \e[m%s\n' "${count} tests. ${passed} tests passed. ${failed} tests failed"
if [[ ${failed} -gt 0 ]]; then
exit 1
else
exit 0
fi
| {
"content_hash": "45a30aba8ae743b3ba6072b0eaf6de57",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 108,
"avg_line_length": 19.745454545454546,
"alnum_prop": 0.5939226519337016,
"repo_name": "znck/clrs",
"id": "73d12cb75257ebf9a60c53b8a213efe257c852f1",
"size": "1099",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "scripts/python.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "612"
},
{
"name": "Python",
"bytes": "436"
},
{
"name": "Shell",
"bytes": "2390"
}
],
"symlink_target": ""
} |
using System.ComponentModel.Composition;
using System.Waf.UnitTesting.Mocks;
using Waf.MusicManager.Applications.Views;
namespace Test.MusicManager.Applications.Views;
[Export(typeof(IInfoView)), PartCreationPolicy(CreationPolicy.NonShared)]
public class MockInfoView : MockDialogView<MockInfoView>, IInfoView
{
}
| {
"content_hash": "f81af96f459e619ef8212a97da0d435b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 73,
"avg_line_length": 32.7,
"alnum_prop": 0.8103975535168195,
"repo_name": "jbe2277/musicmanager",
"id": "bf8f8eb2dae4190bb6bd1c4ffd96999b19ae3741",
"size": "329",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/MusicManager/MusicManager.Applications.Test/Views/MockInfoView.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "428197"
},
{
"name": "Smalltalk",
"bytes": "42138"
}
],
"symlink_target": ""
} |
"""Ros node for playing audio chirps and recording the returns along
with data from a depth camera.
This requires that the depth camera and sound_play nodes have been
started (in separate terminals.):
source ./ros_config_account.sh
roslaunch openni2_launch openni2.launch
roslaunch sound_play soundplay_node.launch
"""
#import h5py
import sys
import numpy as np
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from sound_play.libsoundplay import SoundClient
from pyaudio_utils import AudioPlayer, AudioRecorder
CHIRP_FILE = '/home/hoangnt/echolocation/data/16000to8000.02s.wav'
class Recorder(object):
CHIRP_RATE = 6 # in hz
RECORD_DURATION = .06 # in seconds
CHANNELS = 2
def __init__(self, file_name):
rospy.init_node('ros_record')
self.file_name = file_name
self.bridge = CvBridge()
self.latest_depth = None
self.soundhandle = SoundClient(blocking=False)
self.audio_player = AudioPlayer(CHIRP_FILE)
self.audio_recorder = AudioRecorder(channels=self.CHANNELS)
rospy.Subscriber('/camera/depth/image_raw', Image, self.depth_callback)
while self.latest_depth is None and not rospy.is_shutdown():
rospy.loginfo("WAITING FOR CAMERA DATA.")
rospy.sleep(.1)
wavs = []
images = []
rate = rospy.Rate(self.CHIRP_RATE)
while not rospy.is_shutdown():
image = self.bridge.imgmsg_to_cv2(self.latest_depth)
images.append(image)
self.soundhandle.playWave(CHIRP_FILE)
#self.audio_player.play() # takes a while to actually play. (about .015 seconds)
rospy.sleep(.04)
self.audio_recorder.record(self.RECORD_DURATION)
while not self.audio_recorder.done_recording():
rospy.sleep(.005)
audio = self.audio_recorder.get_data()
wavs.append(audio[1])
rate.sleep()
audio = np.array(wavs)
depth = np.array(images)
rospy.loginfo("Saving data to disk...")
np.savez_compressed(self.file_name, audio=audio, depth=depth)
#with h5py.File(self.file_name, 'w') as h5:
# h5.create_dataset('audio', data=audio)
# h5.create_dataset('depth', data=depth)
#self.audio_player.shutdown()
self.audio_recorder.shutdown()
def depth_callback(self, depth_image):
self.latest_depth = depth_image
if __name__ == "__main__":
Recorder(sys.argv[1])
| {
"content_hash": "f81d808e38d5d7619857d7d7c89c46fd",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 92,
"avg_line_length": 27.67032967032967,
"alnum_prop": 0.6449563145353455,
"repo_name": "spragunr/echolocation",
"id": "7e2cf477d906637df8e77bf9f40a3d475e45bd8d",
"size": "2541",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "old_ros_record.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "116040"
},
{
"name": "Shell",
"bytes": "1537"
}
],
"symlink_target": ""
} |
/**
* Created by leo on 3/24/15.
*/
(function(){
'use strict';
// Prepare the 'users' module for subsequent registration of controllers and delegates
angular.module('Dashboard', [ 'ngMaterial' ]);
})(); | {
"content_hash": "1792988e9bf38b0a1e565be57341aef0",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 90,
"avg_line_length": 19.90909090909091,
"alnum_prop": 0.634703196347032,
"repo_name": "leompande/hmis_webportal",
"id": "9d57c9ff00ddea2d8e956f5f717c76b7eb656b42",
"size": "219",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/Dashboard/Dashboard.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "283128"
},
{
"name": "HTML",
"bytes": "113200"
},
{
"name": "JavaScript",
"bytes": "164501"
}
],
"symlink_target": ""
} |
package de.plushnikov.intellij.plugin.action.lombok;
import com.intellij.psi.PsiClass;
import de.plushnikov.intellij.plugin.LombokClassNames;
import org.jetbrains.annotations.NotNull;
public class LombokDataHandler extends BaseLombokHandler {
private final BaseLombokHandler[] handlers;
public LombokDataHandler() {
handlers = new BaseLombokHandler[]{
new LombokGetterHandler(), new LombokSetterHandler(),
new LombokToStringHandler(), new LombokEqualsAndHashcodeHandler()};
}
@Override
protected void processClass(@NotNull PsiClass psiClass) {
for (BaseLombokHandler handler : handlers) {
handler.processClass(psiClass);
}
removeDefaultAnnotation(psiClass, LombokClassNames.GETTER);
removeDefaultAnnotation(psiClass, LombokClassNames.SETTER);
removeDefaultAnnotation(psiClass, LombokClassNames.TO_STRING);
removeDefaultAnnotation(psiClass, LombokClassNames.EQUALS_AND_HASHCODE);
addAnnotation(psiClass, LombokClassNames.DATA);
}
}
| {
"content_hash": "c06341db3f6b00a3af2fcafce0c7778a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 76,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.782,
"repo_name": "ingokegel/intellij-community",
"id": "87fd63111ee98df83952a8d00ff0b85da28f20dd",
"size": "1000",
"binary": false,
"copies": "13",
"ref": "refs/heads/master",
"path": "plugins/lombok/src/main/java/de/plushnikov/intellij/plugin/action/lombok/LombokDataHandler.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/DjangoAndablog.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/DjangoAndablog.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/DjangoAndablog"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/DjangoAndablog"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
| {
"content_hash": "97b929e071dcf4c0d008982ae9d8ffbc",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 343,
"avg_line_length": 38.73988439306358,
"alnum_prop": 0.7079976126529394,
"repo_name": "WimpyAnalytics/django-andablog",
"id": "16683d7b22f83e66c8af10331f5d5caa7870bf62",
"size": "6794",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "docs/Makefile",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "1068"
},
{
"name": "HTML",
"bytes": "5151"
},
{
"name": "Python",
"bytes": "31536"
}
],
"symlink_target": ""
} |
<?xml version='1.0'?>
<!--
* Copyright 2001-2009 The Apache Software Foundation.
*
* 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.
*
*/ -->
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "jUDDI_User_Guide.ent">
%BOOK_ENTITIES;
]>
<!-- chapter: Subscription -->
<chapter id="chap-Subscription">
<title>Subscription</title>
<!-- section: Introduction -->
<section id="sect-subscription_intro">
<title>Introduction</title>
<para>
Subscriptions come to play in a multi-registry setup. Within your company you may
have the need to run with more then one UDDI, let's say one for each department,
where you limit access to the systems in each department to just their own UDDI
node. However you may want to share some services cross departments. The
subscription API can help you cross registering those services and keeping them up
to date by sending out notifications as the registry information in the parent
UDDI changes.
</para>
<para>
There are two type of subscriptions:
</para>
<variablelist>
<varlistentry>
<term>asynchronous</term>
<listitem>
<para>
Save a subscription, and receive updates on a certain schedule.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>synchronous</term>
<listitem>
<para>
Save a subscription and invoke the get_Subscription and get a synchronous reply.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
The notification can be executed in a synchronous and an asynchronous way. The
asynchronous way requires a listener service to be installed on the node to which
the notifications should be sent.
</para>
</section>
<!-- section: Two node example setup: Sales and Marketing -->
<section id="sect-Two_node_example">
<title>Two node example setup: Sales and Marketing</title>
<para>
In this example we are setting up a node for 'sales' and a node for 'marketing'.
For this you need to deploy jUDDI to two different services, then you need to do
the following setup:
</para>
<!-- procedure: Setup Node 1: Sales -->
<procedure id="proc-Two_node_example_Setup_Node1">
<title>Setup Node 1: Sales</title>
<step>
<para>
Create <filename>juddi_custom_install_data</filename>.
</para>
<screen><xi:include href="extras/Subscription_1.screen" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></screen>
</step>
<step>
<para>
edit: <filename>webapps/juddiv3/WEB-INF/classes/juddiv3.properties</filename> and set the following
property values where 'sales' is the DNS name of your server.
</para>
<programlisting><xi:include href="extras/Subscription_1.properties" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
</step>
<step>
<para>
Start the server (tomcat), which will load the UDDI seed data (since this
is the first time you're starting jUDDI, see
<xref linkend="chap-root_seed_data" />)
</para>
<screen><xi:include href="extras/Subscription_3.screen" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></screen>
</step>
<step>
<para>
Open your browser to <ulink url="http://sales:8080/juddiv3"/>. You should see:
</para>
<!-- figure: Sales Node Installation -->
<figure id="fig-sales_node_installation">
<title>Sales Node Installation</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/sales_node_installation.png" scalefit="1"/>
</imageobject>
<textobject>
<phrase>Sales Node Installation</phrase>
</textobject>
</mediaobject>
</figure>
</step>
</procedure>
<!-- procedure: Setup Node 2: Marketing -->
<procedure>
<title>Setup Node 2: Marketing</title>
<step>
<para>
Create <filename>juddi_custom_install_data</filename>.
</para>
<screen><xi:include href="extras/Subscription_4.screen" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></screen>
</step>
<step>
<para>
edit: <filename>webapps/juddiv3/WEB-INF/classes/juddiv3.properties</filename> and set the following
property values where 'marketing' is the DNS name of your server.
</para>
<programlisting><xi:include href="extras/Subscription_2.properties" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
</step>
<step>
<para>
Start the server (tomcat), which will load the UDDI seed data (since this
is the first time you're starting jUDDI, see
<xref linkend="chap-root_seed_data" />)
</para>
<screen><xi:include href="extras/Subscription_5.screen" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></screen>
</step>
<step>
<para>
Open your browser to <ulink url="http://marketing:8080/juddiv3"/> .
You should see:
</para>
<!-- figure: Marketing Node Installation -->
<figure id="fig-Marketing_Node_Installation">
<title>Marketing Node Installation</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/marketing_node_installation.png" scalefit="1"/>
</imageobject>
<textobject>
<phrase>Marketing Node Installation</phrase>
</textobject>
</mediaobject>
</figure>
</step>
</procedure>
<para>
Note that we kept the root partition the same as sales and marketing are in the
same company, however the Node Id and Name are different and reflect that this
node is in 'sales' or 'marketing'.
</para>
<para>
Finally you will need to replace the sales server's
<filename>uddi-portlets.war/WEB-INF/classes/META-INF/uddi.xml</filename>
with <filename>uddi-portlets.war/WEB-INF/classes/META-INF/uddi.xml.sales</filename>.
Then, edit the
<filename>uddi-portlets.war/WEB-INF/classes/META-INF/uddi.xml</filename> and set
the following properties:
</para>
<programlisting language="XML"><xi:include href="extras/Subscription_1.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<para>
Log into the sales portal: <ulink url="http://sales:8080/pluto"/> with
username/password: sales/sales.
</para>
<!-- figure: Sales Services -->
<figure id="fig-sales_services">
<title>Sales Services</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/sales_services.png"/>
</imageobject>
<textobject>
<phrase>Sales Services</phrase>
</textobject>
</mediaobject>
</figure>
<para>
Before logging into the marketing portal, replace marketing's
<filename>uddi-portlet.war/WEB-INF/classes/META-INF/uddi.xml</filename>
with <filename>udd-portlet.war/WEB-INF/classes/META-INF/uddi.xml.marketing</filename>.
Then you will need to edit the
<filename>uddi-portlet.war/WEB-INF/classes/META_INF/uddi.xml</filename> and set
the following properties:
</para>
<programlisting language="XML"><xi:include href="extras/Subscription_2.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<para>
Now log into the marketing portal <ulink url="http://marketing:8080/pluto"/> with
username/password: marketing/ marketing. In the browser for the marketing node we
should now see:
</para>
<!-- figure: Marketing Services -->
<figure id="fig-marketing_services">
<title>Marketing Services</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/marketing_services.png"/>
</imageobject>
<textobject>
<phrase>Marketing Services</phrase>
</textobject>
</mediaobject>
</figure>
<para>
Note that the subscriptionlistener is owned by the Marketing Node business (and
not the Root Marketing Node). The Marketing Node Business is managed by the
marketing publisher.
</para>
</section>
<!-- section: Deploy the HelloSales Service -->
<section id="sect-deploy_HelloSales_service">
<title>Deploy the HelloSales Service</title>
<para>
The sales department developed a service called HelloSales. The HelloSales service
is provided in the <filename>juddiv3-samples.war</filename>, and it is annotated
so that it will auto-register. Before deploying the war, edit the
<filename>juddiv3-samples.war/WEB-INF/classes/META-INF/uddi.xml</filename> file to
set some property values to 'sales'.
</para>
<programlisting language="XML"><xi:include href="extras/Subscription_3.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<para>
Now deploy the <filename>juddiv3-samples.war</filename> to the sales registry
node, by building the <filename>juddiv3-samples.war</filename> and deploying. The
HelloWorld service should deploy
</para>
<!-- figure: Registration by Annotation, deploying the juddi-samples.war to the sales Node -->
<figure id="fig-Registration_Annotation">
<title>Registration by Annotation, deploying the <filename>juddi-samples.war</filename> to the sales Node</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/registration_by_annotation.png"/>
</imageobject>
<textobject>
<phrase></phrase>
</textobject>
</mediaobject>
</figure>
<para>
On the Marketing UDDI we'd like to subscribe to the HelloWord service, in the
Sales UDDI Node. As mentioned before there are two ways to do this; synchronously
and asynchronously.
</para>
</section>
<!-- section: Configure a user to create Subscriptions -->
<section id="sect-config_user_create_subscription">
<title>Configure a user to create Subscriptions</title>
<para>
For a user to create and save subscriptions the publisher needs to have a valid
login to both the sales and the marketing node. Also if the marketing publisher is
going to create registry objects in the marketing node, the marketing publisher
needs to own the sales keygenerator tModel. Check the
<filename>marketing_*.xml</filename> files in the root seed data of both the
marketing and sales node, if you want to learn more about this. It is important to
understand that the 'marketing' publisher in the marketing registry owns the
following tModels:
</para>
<programlisting language="XML"><xi:include href="extras/Subscription_4.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<para>
If we are going to user the marketing publisher to subscribe to updates in the
sales registry, then we need to provide this publisher with two clerks in the
<filename>uddi.xml</filename> of the <filename>uddi-portlet.war</filename>.
</para>
<programlisting language="XML"><xi:include href="extras/Subscription_5.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<para>
Here we created two clerks for this publisher called 'MarketingCratchit' and
'SalesCratchit'. This will allow the publisher to check the existing subscriptions
owned by this publisher in each of the two systems.
</para>
</section>
<!-- section: Synchronous Notifications -->
<section id="sect-synchronous_notifications">
<title>Synchronous Notifications</title>
<para>
While being logged in as the marketing publisher on the marketing portal, we
should see the following when selecting the UDDISubscription Portlet.
</para>
<!-- figure: Subscriptions. In (a) both nodes are up while in (b) the sales node is down -->
<figure id="fig-Subscriptions_a_both_nodes_up_b_sales_node_is_down">
<title>Subscriptions. In (a) both nodes are up while in (b) the sales node is down</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/a_bothup_b_sales_down.png"/>
</imageobject>
<textobject>
<phrase>Subscriptions. In (a) both nodes are up while in (b) the sales node is down</phrase>
</textobject>
</mediaobject>
</figure>
<para>
When both nodes came up green you can lick on the 'new subscription' icon in the
toolbar. Since we are going to use this subscription synchronously only the
Binding Key and Notification Interval should be left blank, as shown in
<xref linkend="fig-create_a_new_subscription" />. Click the save icon to save the
subscription.
</para>
<!-- figure: Create a New Subscription -->
<figure id="fig-create_a_new_subscription">
<title>Create a New Subscription</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/create_new_subscription.png"/>
</imageobject>
<textobject>
<phrase>Create a New Subscription</phrase>
</textobject>
</mediaobject>
</figure>
<para>
Make sure that the subscription Key uses the convention of the keyGenerator of the
marketing publisher. You should see the orange subscription icon appear under the
“sales-ws” UDDI node.
</para>
<!-- figure: A Newly Saved Subscription -->
<figure id="fig-newly_saved_subscription">
<title>A Newly Saved Subscription</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/newly_saved_subscription.png"/>
</imageobject>
<textobject>
<phrase>A Newly Saved Subscription</phrase>
</textobject>
</mediaobject>
</figure>
<para>
To invoke a synchronous subscription, click the icon with the green arrows. This
will give you the opportunity to set the coverage period.
</para>
<!-- figure: Set the Coverage Period -->
<figure id="fig-set_coverage_period">
<title>Set the Coverage Period</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/set_coverage_period.png"/>
</imageobject>
<textobject>
<phrase>Set the Coverage Period</phrase>
</textobject>
</mediaobject>
</figure>
<para>
Click the green arrows icon again to invoke the synchronous subscription request.
The example finder request will go out to the sales node and look for updates on
the HelloWorld service. The raw XML response will be posted in the
UDDISubscriptionNotification Portlet.
</para>
<!-- figure: The Raw XML response of the synchronous Subscription request -->
<figure id="fig-RawXML_response_of_the_synchronous_Subscription_request">
<title>The Raw XML response of the synchronous Subscription request</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/raw_XML_response_synchronous_subscription_request.png"/>
</imageobject>
<textobject>
<phrase>The Raw XML response of the synchronous Subscription request</phrase>
</textobject>
</mediaobject>
</figure>
<para>
The response will also be consumed by the marketing node. The marketing node will
import the HelloWorld subscription information, as well as the sales business. So
after a successful sync you should now see three businesses in the Browser Portlet
of the marketing node, see <xref linkend="fig-registry_info_HelloWorld" />.
</para>
<!-- figure: The registry info of the HelloWorld Service information was imported by the subscription mechanism. -->
<figure id="fig-registry_info_HelloWorld">
<title>The registry info of the HelloWorld Service information was imported by the subscription mechanism.</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/registry_info_helloworld.png"/>
</imageobject>
<textobject>
<phrase>The registry info of the HelloWorld Service information was imported by the subscription mechanism.</phrase>
</textobject>
</mediaobject>
</figure>
</section>
</chapter>
| {
"content_hash": "b79d8638e28eed9e0da5cfaa6ebb3ddc",
"timestamp": "",
"source": "github",
"line_count": 444,
"max_line_length": 162,
"avg_line_length": 43.538288288288285,
"alnum_prop": 0.5861052195954685,
"repo_name": "st609877063/juddi",
"id": "69e2db7b5dbd5eb75153d699d36881fe63f6ac98",
"size": "19335",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "docs/userguide/en-US/Subscription.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "3670154"
},
{
"name": "CSS",
"bytes": "10542"
},
{
"name": "Java",
"bytes": "11283212"
},
{
"name": "JavaScript",
"bytes": "520187"
},
{
"name": "Ruby",
"bytes": "1206"
},
{
"name": "Shell",
"bytes": "111179"
},
{
"name": "XSLT",
"bytes": "3987"
}
],
"symlink_target": ""
} |
package com.zhuhongqing.mongoassist;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.mongodb.WriteConcern;
import com.zhuhongqing.mongohandler.MongoBeanHandler;
import com.zhuhongqing.mongohandler.MongoListBeanHandler;
import com.zhuhongqing.mongointerface.MongoDBConnectionInterface;
import com.zhuhongqing.utils.BeanUtils;
import cn.zhuhongqing.dao.Dao;
import cn.zhuhongqing.dao.QueryResult;
public class MongoDao extends MongoAssist implements Dao {
public MongoDao(MongoDBConnectionInterface mdbc) {
super(mdbc);
}
public Serializable save(Object bean) {
synchronized (this) {
createPrimaryKey(bean);
}
return getDbCollection(bean.getClass()).insert(createDBObject(bean),
WriteConcern.SAFE).getN();
}
public List<Serializable> saveAll(Collection<Object> beans) {
List<Serializable> serList = new ArrayList<Serializable>();
Iterator<Object> it = beans.iterator();
while (it.hasNext()) {
serList.add(save(it.next()));
}
return serList;
}
public void delete(Object bean) {
getDbCollection(bean.getClass()).remove(createDBObject(bean),
WriteConcern.SAFE);
}
public void deleteAll(Collection<Object> beans) {
Iterator<Object> it = beans.iterator();
while (it.hasNext()) {
delete(it.next());
}
}
public void update(Object bean) {
getDbCollection(bean.getClass())
.findAndModify(createDBObject(createPrimaryKeyMap(bean)),
createDBObject(bean));
}
public void updateAll(Collection<Object> beans) {
Iterator<Object> it = beans.iterator();
while (it.hasNext()) {
update(it.next());
}
}
public <T> T get(Class<T> clazz, Serializable beanId) {
Map<String, Object> primaryValueMap = new HashMap<String, Object>();
primaryValueMap.put(BeanUtils.getPrimaryKey(clazz), beanId);
return find(clazz, primaryValueMap, new MongoBeanHandler<T>(clazz));
}
public List<?> find(String sql) {
return null;
}
public <T> List<T> find(Class<T> clazz) {
return find(clazz, new MongoListBeanHandler<T>(clazz));
}
public Object findUniqueResult(String sql) {
return null;
}
public <T> List<T> findByBean(Class<T> clazz, Object bean) {
return find(clazz, createDBObject(bean), new MongoListBeanHandler<T>(
clazz));
}
public <T> List<T> findByProperty(Class<T> clazz, String prop, Object value) {
Map<String, Object> propMap = new HashMap<String, Object>();
propMap.put(prop, value);
return find(clazz, propMap, new MongoListBeanHandler<T>(clazz));
}
public <T> QueryResult<T> findPagesByBean(Class<T> clazz, Object bean,
int pageIndex, int pageSize) {
return new QueryResult<T>(find(clazz, bean,
new MongoListBeanHandler<T>(clazz), pageIndex, pageSize),
showCount(clazz));
}
public <T> QueryResult<T> findPages(Class<T> clazz, int pageIndex,
int pageSize) {
return new QueryResult<T>(find(clazz,
new MongoListBeanHandler<T>(clazz), pageIndex, pageSize),
showCount(clazz));
}
}
| {
"content_hash": "4d9cc64def5cf49b13fb658b911c4c3f",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 79,
"avg_line_length": 23.684615384615384,
"alnum_prop": 0.7262098083793439,
"repo_name": "legend0702/Utils",
"id": "e7fc481f0a2eed2e5e1571c796aee8dc276a8860",
"size": "3079",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MongoAssist/com/zhuhongqing/mongoassist/MongoDao.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "137015"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>Ebola-Web-Map</name>
</data>
</configuration>
</project>
| {
"content_hash": "0733c4d6b043ce78f0379fa977d6a8cf",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 70,
"avg_line_length": 36.44444444444444,
"alnum_prop": 0.6371951219512195,
"repo_name": "heidieh/Ebola-Web-Map",
"id": "fa49e97307c2234b5a3beba59fadbf8f97c84545",
"size": "328",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "nbproject/project.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "542"
},
{
"name": "HTML",
"bytes": "2266"
},
{
"name": "JavaScript",
"bytes": "27021"
}
],
"symlink_target": ""
} |
import Ember from 'ember';
import { initialize } from '../../../initializers/icon-service';
import { module, test } from 'qunit';
var container, application;
module('IconServiceInitializer', {
beforeEach: function() {
Ember.run(function() {
application = Ember.Application.create();
container = application.__container__;
application.deferReadiness();
});
}
});
// Replace this with your real tests.
test('it works', function(assert) {
initialize(container, application);
// you would normally confirm the results of the initializer here
assert.ok(true);
});
| {
"content_hash": "6adbd7de978b8bf0a2f74947c7c027f7",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 67,
"avg_line_length": 26.043478260869566,
"alnum_prop": 0.6811352253756261,
"repo_name": "mike1o1/ember-material-design-old",
"id": "8ea9d8582211261b20a73b8afa94b9679fefc26d",
"size": "599",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/unit/initializers/icon-service-test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "114260"
},
{
"name": "HTML",
"bytes": "1682"
},
{
"name": "Handlebars",
"bytes": "88253"
},
{
"name": "JavaScript",
"bytes": "138130"
}
],
"symlink_target": ""
} |
<html>
<head>
<title>User agent detail - Mozilla/5.0 (Linux; Android 4.2.2; ALCATEL ONE TOUCH Fierce Build/JDQ39) AppleWebKit/537.31 (KHTML, Like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="section">
<h1 class="header center orange-text">User agent detail</h1>
<div class="row center">
<h5 class="header light">
Mozilla/5.0 (Linux; Android 4.2.2; ALCATEL ONE TOUCH Fierce Build/JDQ39) AppleWebKit/537.31 (KHTML, Like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31
</h5>
</div>
</div>
<div class="section">
<table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Source result (test suite)</th></tr><tr><td>ua-parser/uap-core<br /><small>vendor/thadafinser/uap-core/tests/test_device.yaml</small></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Alcatel</td><td>One Touch Fierce</td><td></td><td></td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-test">Detail</a>
<!-- Modal Structure -->
<div id="modal-test" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Testsuite result detail</h4>
<p><pre><code class="php">Array
(
[user_agent_string] => Mozilla/5.0 (Linux; Android 4.2.2; ALCATEL ONE TOUCH Fierce Build/JDQ39) AppleWebKit/537.31 (KHTML, Like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31
[family] => Alcatel One Touch Fierce
[brand] => Alcatel
[model] => One Touch Fierce
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapPhp<br /><small>6012</small></td><td>Chrome 26.0</td><td>WebKit </td><td>Android 4.2</td><td style="border-left: 1px solid #555"></td><td></td><td>Mobile Phone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.10801</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-215ac98d-ccf8-4615-916e-5a819d6a59c9">Detail</a>
<!-- Modal Structure -->
<div id="modal-215ac98d-ccf8-4615-916e-5a819d6a59c9" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>BrowscapPhp result detail</h4>
<p><pre><code class="php">stdClass Object
(
[browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.4\.2.*\) applewebkit\/.* \(khtml, like gecko\) chrome\/26\..*safari\/.*$/
[browser_name_pattern] => mozilla/5.0 (*linux*android?4.2*) applewebkit/* (khtml, like gecko) chrome/26.*safari/*
[parent] => Chrome 26.0 for Android
[comment] => Chrome 26.0
[browser] => Chrome
[browser_type] => Browser
[browser_bits] => 32
[browser_maker] => Google Inc
[browser_modus] => unknown
[version] => 26.0
[majorver] => 26
[minorver] => 0
[platform] => Android
[platform_version] => 4.2
[platform_description] => Android OS
[platform_bits] => 32
[platform_maker] => Google Inc
[alpha] =>
[beta] =>
[win16] =>
[win32] =>
[win64] =>
[frames] => 1
[iframes] => 1
[tables] => 1
[cookies] => 1
[backgroundsounds] =>
[javascript] => 1
[vbscript] =>
[javaapplets] =>
[activexcontrols] =>
[ismobiledevice] => 1
[istablet] =>
[issyndicationreader] =>
[crawler] =>
[cssversion] => 3
[aolversion] => 0
[device_name] => general Mobile Phone
[device_maker] => unknown
[device_type] => Mobile Phone
[device_pointing_method] => touchscreen
[device_code_name] => general Mobile Phone
[device_brand_name] => unknown
[renderingengine_name] => WebKit
[renderingengine_version] => unknown
[renderingengine_description] => For Google Chrome, iOS (including both mobile Safari, WebViews within third-party apps, and web clips), Safari, Arora, Midori, OmniWeb, Shiira, iCab since version 4, Web, SRWare Iron, Rekonq, and in Maxthon 3.
[renderingengine_maker] => Apple Inc
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>DonatjUAParser<br /><small>v0.5.0</small></td><td>Chrome 26.0.1410.58</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661">Detail</a>
<!-- Modal Structure -->
<div id="modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>DonatjUAParser result detail</h4>
<p><pre><code class="php">Array
(
[platform] => Android
[browser] => Chrome
[version] => 26.0.1410.58
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>NeutrinoApiCom<br /><small></small></td><td>Chrome Mobile 26.0.1410.58</td><td><i class="material-icons">close</i></td><td>Android 4.2.2</td><td style="border-left: 1px solid #555">Alcatel</td><td>OT-7024W</td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.257</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc">Detail</a>
<!-- Modal Structure -->
<div id="modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>NeutrinoApiCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[mobile_screen_height] => 960
[is_mobile] => 1
[type] => mobile-browser
[mobile_brand] => Alcatel
[mobile_model] => OT-7024W
[version] => 26.0.1410.58
[is_android] => 1
[browser_name] => Chrome Mobile
[operating_system_family] => Android
[operating_system_version] => 4.2.2
[is_ios] =>
[producer] => Google Inc.
[operating_system] => Android 4.2 Jelly Bean
[mobile_screen_width] => 540
[mobile_browser] => Android Webkit
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>PiwikDeviceDetector<br /><small>3.5.2</small></td><td>Chrome Mobile 26.0</td><td>WebKit </td><td>Android 4.2</td><td style="border-left: 1px solid #555">Alcatel</td><td>One Touch Fierce</td><td>smartphone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.003</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-21638055-738d-46ba-a1b1-f5114bc26475">Detail</a>
<!-- Modal Structure -->
<div id="modal-21638055-738d-46ba-a1b1-f5114bc26475" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>PiwikDeviceDetector result detail</h4>
<p><pre><code class="php">Array
(
[client] => Array
(
[type] => browser
[name] => Chrome Mobile
[short_name] => CM
[version] => 26.0
[engine] => WebKit
)
[operatingSystem] => Array
(
[name] => Android
[short_name] => AND
[version] => 4.2
[platform] =>
)
[device] => Array
(
[brand] => AL
[brandName] => Alcatel
[model] => One Touch Fierce
[device] => 1
[deviceName] => smartphone
)
[bot] =>
[extra] => Array
(
[isBot] =>
[isBrowser] => 1
[isFeedReader] =>
[isMobileApp] =>
[isPIM] =>
[isLibrary] =>
[isMediaPlayer] =>
[isCamera] =>
[isCarBrowser] =>
[isConsole] =>
[isFeaturePhone] =>
[isPhablet] =>
[isPortableMediaPlayer] =>
[isSmartDisplay] =>
[isSmartphone] => 1
[isTablet] =>
[isTV] =>
[isDesktop] =>
[isMobile] => 1
[isTouchEnabled] => Array
(
[0] => TOUCH
)
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.0</small></td><td>Chrome 26.0.1410.58</td><td><i class="material-icons">close</i></td><td>Android 4.2.2</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c">Detail</a>
<!-- Modal Structure -->
<div id="modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>SinergiBrowserDetector result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Sinergi\BrowserDetector\Browser Object
(
[userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 4.2.2; ALCATEL ONE TOUCH Fierce Build/JDQ39) AppleWebKit/537.31 (KHTML, Like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31
)
[name:Sinergi\BrowserDetector\Browser:private] => Chrome
[version:Sinergi\BrowserDetector\Browser:private] => 26.0.1410.58
[isRobot:Sinergi\BrowserDetector\Browser:private] =>
[isChromeFrame:Sinergi\BrowserDetector\Browser:private] =>
)
[operatingSystem] => Sinergi\BrowserDetector\Os Object
(
[name:Sinergi\BrowserDetector\Os:private] => Android
[version:Sinergi\BrowserDetector\Os:private] => 4.2.2
[isMobile:Sinergi\BrowserDetector\Os:private] => 1
[userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 4.2.2; ALCATEL ONE TOUCH Fierce Build/JDQ39) AppleWebKit/537.31 (KHTML, Like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31
)
)
[device] => Sinergi\BrowserDetector\Device Object
(
[name:Sinergi\BrowserDetector\Device:private] => unknown
[userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object
(
[userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 4.2.2; ALCATEL ONE TOUCH Fierce Build/JDQ39) AppleWebKit/537.31 (KHTML, Like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31
)
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UAParser<br /><small>v3.4.5</small></td><td>Chrome Mobile 26.0.1410</td><td><i class="material-icons">close</i></td><td>Android 4.2.2</td><td style="border-left: 1px solid #555">Alcatel</td><td>One Touch Fierce</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b">Detail</a>
<!-- Modal Structure -->
<div id="modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UAParser result detail</h4>
<p><pre><code class="php">UAParser\Result\Client Object
(
[ua] => UAParser\Result\UserAgent Object
(
[major] => 26
[minor] => 0
[patch] => 1410
[family] => Chrome Mobile
)
[os] => UAParser\Result\OperatingSystem Object
(
[major] => 4
[minor] => 2
[patch] => 2
[patchMinor] =>
[family] => Android
)
[device] => UAParser\Result\Device Object
(
[brand] => Alcatel
[model] => One Touch Fierce
[family] => Alcatel One Touch Fierce
)
[originalUserAgent] => Mozilla/5.0 (Linux; Android 4.2.2; ALCATEL ONE TOUCH Fierce Build/JDQ39) AppleWebKit/537.31 (KHTML, Like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UserAgentStringCom<br /><small></small></td><td>Android Webkit Browser </td><td><i class="material-icons">close</i></td><td>Android 4.2.2</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.08</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4">Detail</a>
<!-- Modal Structure -->
<div id="modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UserAgentStringCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[agent_type] => Browser
[agent_name] => Android Webkit Browser
[agent_version] => --
[os_type] => Android
[os_name] => Android
[os_versionName] =>
[os_versionNumber] => 4.2.2
[os_producer] =>
[os_producerURL] =>
[linux_distibution] => Null
[agent_language] =>
[agent_languageTag] =>
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhatIsMyBrowserCom<br /><small></small></td><td>Chrome 26.0.1410.58</td><td>WebKit 537.31</td><td>Android 4.2.2</td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.41</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9795f66f-7271-430e-973a-a5c0e14dc35a">Detail</a>
<!-- Modal Structure -->
<div id="modal-9795f66f-7271-430e-973a-a5c0e14dc35a" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhatIsMyBrowserCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[operating_system_name] => Android
[simple_sub_description_string] =>
[simple_browser_string] => Chrome 26 on Android (Jelly Bean)
[browser_version] => 26
[extra_info] => Array
(
)
[operating_platform] =>
[extra_info_table] => stdClass Object
(
[System Build] => JDQ39
)
[layout_engine_name] => WebKit
[detected_addons] => Array
(
)
[operating_system_flavour_code] =>
[hardware_architecture] =>
[operating_system_flavour] =>
[operating_system_frameworks] => Array
(
)
[browser_name_code] => chrome
[operating_system_version] => Jelly Bean
[simple_operating_platform_string] =>
[is_abusive] =>
[layout_engine_version] => 537.31
[browser_capabilities] => Array
(
)
[operating_platform_vendor_name] =>
[operating_system] => Android (Jelly Bean)
[operating_system_version_full] => 4.2.2
[operating_platform_code] =>
[browser_name] => Chrome
[operating_system_name_code] => android
[user_agent] => Mozilla/5.0 (Linux; Android 4.2.2; ALCATEL ONE TOUCH Fierce Build/JDQ39) AppleWebKit/537.31 (KHTML, Like Gecko) Chrome/26.0.1410.58 Mobile Safari/537.31
[browser_version_full] => 26.0.1410.58
[browser] => Chrome 26
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhichBrowser<br /><small>2.0.10</small></td><td>Chrome Dev 26.0.1410.58</td><td>Webkit 537.31</td><td>Android 4.2.2</td><td style="border-left: 1px solid #555">Alcatel</td><td>One Touch Fierce</td><td>mobile:smart</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.007</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4">Detail</a>
<!-- Modal Structure -->
<div id="modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhichBrowser result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Array
(
[name] => Chrome
[version] => 26.0.1410.58
[type] => browser
)
[engine] => Array
(
[name] => Webkit
[version] => 537.31
)
[os] => Array
(
[name] => Android
[version] => 4.2.2
)
[device] => Array
(
[type] => mobile
[subtype] => smart
[manufacturer] => Alcatel
[model] => One Touch Fierce
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Woothee<br /><small>v1.2.0</small></td><td>Chrome 26.0.1410.58</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>smartphone</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.002</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-3f285ff5-314b-4db4-9948-54572e92e7b6">Detail</a>
<!-- Modal Structure -->
<div id="modal-3f285ff5-314b-4db4-9948-54572e92e7b6" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Woothee result detail</h4>
<p><pre><code class="php">Array
(
[name] => Chrome
[vendor] => Google
[version] => 26.0.1410.58
[category] => smartphone
[os] => Android
[os_version] => 4.2.2
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Wurfl<br /><small>1.6.4</small></td><td>Chrome Mobile 36</td><td><i class="material-icons">close</i></td><td>Android 4.2</td><td style="border-left: 1px solid #555">Alcatel</td><td>OT-7024W</td><td>Smartphone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.08701</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-1a1aee36-7ce7-4111-a391-8e2c501f1532">Detail</a>
<!-- Modal Structure -->
<div id="modal-1a1aee36-7ce7-4111-a391-8e2c501f1532" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Wurfl result detail</h4>
<p><pre><code class="php">Array
(
[virtual] => Array
(
[is_android] => true
[is_ios] => false
[is_windows_phone] => false
[is_app] => false
[is_full_desktop] => false
[is_largescreen] => true
[is_mobile] => true
[is_robot] => false
[is_smartphone] => true
[is_touchscreen] => true
[is_wml_preferred] => false
[is_xhtmlmp_preferred] => false
[is_html_preferred] => true
[advertised_device_os] => Android
[advertised_device_os_version] => 4.2
[advertised_browser] => Chrome Mobile
[advertised_browser_version] => 36
[complete_device_name] => Alcatel OT-7024W (One Touch Fierce)
[form_factor] => Smartphone
[is_phone] => true
[is_app_webview] => false
)
[all] => Array
(
[brand_name] => Alcatel
[model_name] => OT-7024W
[unique] => true
[ununiqueness_handler] =>
[is_wireless_device] => true
[device_claims_web_support] => true
[has_qwerty_keyboard] => true
[can_skip_aligned_link_row] => true
[uaprof] =>
[uaprof2] =>
[uaprof3] =>
[nokia_series] => 0
[nokia_edition] => 0
[device_os] => Android
[mobile_browser] => Android Webkit
[mobile_browser_version] =>
[device_os_version] => 4.2
[pointing_method] => touchscreen
[release_date] => 2013_october
[marketing_name] => One Touch Fierce
[model_extra_info] =>
[nokia_feature_pack] => 0
[can_assign_phone_number] => true
[is_tablet] => false
[manufacturer_name] =>
[is_bot] => false
[is_google_glass] => false
[proportional_font] => false
[built_in_back_button_support] => false
[card_title_support] => true
[softkey_support] => false
[table_support] => true
[numbered_menus] => false
[menu_with_select_element_recommended] => false
[menu_with_list_of_links_recommended] => true
[icons_on_menu_items_support] => false
[break_list_of_links_with_br_element_recommended] => true
[access_key_support] => false
[wrap_mode_support] => false
[times_square_mode_support] => false
[deck_prefetch_support] => false
[elective_forms_recommended] => true
[wizards_recommended] => false
[image_as_link_support] => false
[insert_br_element_after_widget_recommended] => false
[wml_can_display_images_and_text_on_same_line] => false
[wml_displays_image_in_center] => false
[opwv_wml_extensions_support] => false
[wml_make_phone_call_string] => wtai://wp/mc;
[chtml_display_accesskey] => false
[emoji] => false
[chtml_can_display_images_and_text_on_same_line] => false
[chtml_displays_image_in_center] => false
[imode_region] => none
[chtml_make_phone_call_string] => tel:
[chtml_table_support] => false
[xhtml_honors_bgcolor] => true
[xhtml_supports_forms_in_table] => true
[xhtml_support_wml2_namespace] => false
[xhtml_autoexpand_select] => false
[xhtml_select_as_dropdown] => false
[xhtml_select_as_radiobutton] => false
[xhtml_select_as_popup] => false
[xhtml_display_accesskey] => false
[xhtml_supports_invisible_text] => false
[xhtml_supports_inline_input] => false
[xhtml_supports_monospace_font] => false
[xhtml_supports_table_for_layout] => true
[xhtml_supports_css_cell_table_coloring] => true
[xhtml_format_as_css_property] => false
[xhtml_format_as_attribute] => false
[xhtml_nowrap_mode] => false
[xhtml_marquee_as_css_property] => false
[xhtml_readable_background_color1] => #FFFFFF
[xhtml_readable_background_color2] => #FFFFFF
[xhtml_allows_disabled_form_elements] => true
[xhtml_document_title_support] => true
[xhtml_preferred_charset] => iso-8859-1
[opwv_xhtml_extensions_support] => false
[xhtml_make_phone_call_string] => tel:
[xhtmlmp_preferred_mime_type] => text/html
[xhtml_table_support] => true
[xhtml_send_sms_string] => sms:
[xhtml_send_mms_string] => mms:
[xhtml_file_upload] => supported
[cookie_support] => true
[accept_third_party_cookie] => true
[xhtml_supports_iframe] => full
[xhtml_avoid_accesskeys] => true
[xhtml_can_embed_video] => none
[ajax_support_javascript] => true
[ajax_manipulate_css] => true
[ajax_support_getelementbyid] => true
[ajax_support_inner_html] => true
[ajax_xhr_type] => standard
[ajax_manipulate_dom] => true
[ajax_support_events] => true
[ajax_support_event_listener] => true
[ajax_preferred_geoloc_api] => w3c_api
[xhtml_support_level] => 4
[preferred_markup] => html_web_4_0
[wml_1_1] => false
[wml_1_2] => false
[wml_1_3] => false
[html_wi_w3_xhtmlbasic] => true
[html_wi_oma_xhtmlmp_1_0] => true
[html_wi_imode_html_1] => false
[html_wi_imode_html_2] => false
[html_wi_imode_html_3] => false
[html_wi_imode_html_4] => false
[html_wi_imode_html_5] => false
[html_wi_imode_htmlx_1] => false
[html_wi_imode_htmlx_1_1] => false
[html_wi_imode_compact_generic] => false
[html_web_3_2] => true
[html_web_4_0] => true
[voicexml] => false
[multipart_support] => false
[total_cache_disable_support] => false
[time_to_live_support] => false
[resolution_width] => 540
[resolution_height] => 960
[columns] => 60
[max_image_width] => 320
[max_image_height] => 480
[rows] => 40
[physical_screen_width] => 57
[physical_screen_height] => 100
[dual_orientation] => true
[density_class] => 1.0
[wbmp] => true
[bmp] => false
[epoc_bmp] => false
[gif_animated] => false
[jpg] => true
[png] => true
[tiff] => false
[transparent_png_alpha] => true
[transparent_png_index] => true
[svgt_1_1] => true
[svgt_1_1_plus] => false
[greyscale] => false
[gif] => true
[colors] => 65536
[webp_lossy_support] => true
[webp_lossless_support] => true
[post_method_support] => true
[basic_authentication_support] => true
[empty_option_value_support] => true
[emptyok] => false
[nokia_voice_call] => false
[wta_voice_call] => false
[wta_phonebook] => false
[wta_misc] => false
[wta_pdc] => false
[https_support] => true
[phone_id_provided] => false
[max_data_rate] => 3600
[wifi] => true
[sdio] => false
[vpn] => false
[has_cellular_radio] => true
[max_deck_size] => 2000000
[max_url_length_in_requests] => 256
[max_url_length_homepage] => 0
[max_url_length_bookmark] => 0
[max_url_length_cached_page] => 0
[max_no_of_connection_settings] => 0
[max_no_of_bookmarks] => 0
[max_length_of_username] => 0
[max_length_of_password] => 0
[max_object_size] => 0
[downloadfun_support] => false
[directdownload_support] => true
[inline_support] => false
[oma_support] => true
[ringtone] => false
[ringtone_3gpp] => false
[ringtone_midi_monophonic] => false
[ringtone_midi_polyphonic] => false
[ringtone_imelody] => false
[ringtone_digiplug] => false
[ringtone_compactmidi] => false
[ringtone_mmf] => false
[ringtone_rmf] => false
[ringtone_xmf] => false
[ringtone_amr] => false
[ringtone_awb] => false
[ringtone_aac] => false
[ringtone_wav] => false
[ringtone_mp3] => false
[ringtone_spmidi] => false
[ringtone_qcelp] => false
[ringtone_voices] => 1
[ringtone_df_size_limit] => 0
[ringtone_directdownload_size_limit] => 0
[ringtone_inline_size_limit] => 0
[ringtone_oma_size_limit] => 0
[wallpaper] => false
[wallpaper_max_width] => 0
[wallpaper_max_height] => 0
[wallpaper_preferred_width] => 0
[wallpaper_preferred_height] => 0
[wallpaper_resize] => none
[wallpaper_wbmp] => false
[wallpaper_bmp] => false
[wallpaper_gif] => false
[wallpaper_jpg] => false
[wallpaper_png] => false
[wallpaper_tiff] => false
[wallpaper_greyscale] => false
[wallpaper_colors] => 2
[wallpaper_df_size_limit] => 0
[wallpaper_directdownload_size_limit] => 0
[wallpaper_inline_size_limit] => 0
[wallpaper_oma_size_limit] => 0
[screensaver] => false
[screensaver_max_width] => 0
[screensaver_max_height] => 0
[screensaver_preferred_width] => 0
[screensaver_preferred_height] => 0
[screensaver_resize] => none
[screensaver_wbmp] => false
[screensaver_bmp] => false
[screensaver_gif] => false
[screensaver_jpg] => false
[screensaver_png] => false
[screensaver_greyscale] => false
[screensaver_colors] => 2
[screensaver_df_size_limit] => 0
[screensaver_directdownload_size_limit] => 0
[screensaver_inline_size_limit] => 0
[screensaver_oma_size_limit] => 0
[picture] => false
[picture_max_width] => 0
[picture_max_height] => 0
[picture_preferred_width] => 0
[picture_preferred_height] => 0
[picture_resize] => none
[picture_wbmp] => false
[picture_bmp] => false
[picture_gif] => false
[picture_jpg] => false
[picture_png] => false
[picture_greyscale] => false
[picture_colors] => 2
[picture_df_size_limit] => 0
[picture_directdownload_size_limit] => 0
[picture_inline_size_limit] => 0
[picture_oma_size_limit] => 0
[video] => false
[oma_v_1_0_forwardlock] => false
[oma_v_1_0_combined_delivery] => false
[oma_v_1_0_separate_delivery] => false
[streaming_video] => true
[streaming_3gpp] => true
[streaming_mp4] => true
[streaming_mov] => false
[streaming_video_size_limit] => 0
[streaming_real_media] => none
[streaming_flv] => false
[streaming_3g2] => false
[streaming_vcodec_h263_0] => 10
[streaming_vcodec_h263_3] => -1
[streaming_vcodec_mpeg4_sp] => 2
[streaming_vcodec_mpeg4_asp] => -1
[streaming_vcodec_h264_bp] => 3.0
[streaming_acodec_amr] => nb
[streaming_acodec_aac] => lc
[streaming_wmv] => none
[streaming_preferred_protocol] => rtsp
[streaming_preferred_http_protocol] => apple_live_streaming
[wap_push_support] => false
[connectionless_service_indication] => false
[connectionless_service_load] => false
[connectionless_cache_operation] => false
[connectionoriented_unconfirmed_service_indication] => false
[connectionoriented_unconfirmed_service_load] => false
[connectionoriented_unconfirmed_cache_operation] => false
[connectionoriented_confirmed_service_indication] => false
[connectionoriented_confirmed_service_load] => false
[connectionoriented_confirmed_cache_operation] => false
[utf8_support] => true
[ascii_support] => false
[iso8859_support] => false
[expiration_date] => false
[j2me_cldc_1_0] => false
[j2me_cldc_1_1] => false
[j2me_midp_1_0] => false
[j2me_midp_2_0] => false
[doja_1_0] => false
[doja_1_5] => false
[doja_2_0] => false
[doja_2_1] => false
[doja_2_2] => false
[doja_3_0] => false
[doja_3_5] => false
[doja_4_0] => false
[j2me_jtwi] => false
[j2me_mmapi_1_0] => false
[j2me_mmapi_1_1] => false
[j2me_wmapi_1_0] => false
[j2me_wmapi_1_1] => false
[j2me_wmapi_2_0] => false
[j2me_btapi] => false
[j2me_3dapi] => false
[j2me_locapi] => false
[j2me_nokia_ui] => false
[j2me_motorola_lwt] => false
[j2me_siemens_color_game] => false
[j2me_siemens_extension] => false
[j2me_heap_size] => 0
[j2me_max_jar_size] => 0
[j2me_storage_size] => 0
[j2me_max_record_store_size] => 0
[j2me_screen_width] => 0
[j2me_screen_height] => 0
[j2me_canvas_width] => 0
[j2me_canvas_height] => 0
[j2me_bits_per_pixel] => 0
[j2me_audio_capture_enabled] => false
[j2me_video_capture_enabled] => false
[j2me_photo_capture_enabled] => false
[j2me_capture_image_formats] => none
[j2me_http] => false
[j2me_https] => false
[j2me_socket] => false
[j2me_udp] => false
[j2me_serial] => false
[j2me_gif] => false
[j2me_gif89a] => false
[j2me_jpg] => false
[j2me_png] => false
[j2me_bmp] => false
[j2me_bmp3] => false
[j2me_wbmp] => false
[j2me_midi] => false
[j2me_wav] => false
[j2me_amr] => false
[j2me_mp3] => false
[j2me_mp4] => false
[j2me_imelody] => false
[j2me_rmf] => false
[j2me_au] => false
[j2me_aac] => false
[j2me_realaudio] => false
[j2me_xmf] => false
[j2me_wma] => false
[j2me_3gpp] => false
[j2me_h263] => false
[j2me_svgt] => false
[j2me_mpeg4] => false
[j2me_realvideo] => false
[j2me_real8] => false
[j2me_realmedia] => false
[j2me_left_softkey_code] => 0
[j2me_right_softkey_code] => 0
[j2me_middle_softkey_code] => 0
[j2me_select_key_code] => 0
[j2me_return_key_code] => 0
[j2me_clear_key_code] => 0
[j2me_datefield_no_accepts_null_date] => false
[j2me_datefield_broken] => false
[receiver] => false
[sender] => false
[mms_max_size] => 0
[mms_max_height] => 0
[mms_max_width] => 0
[built_in_recorder] => false
[built_in_camera] => true
[mms_jpeg_baseline] => false
[mms_jpeg_progressive] => false
[mms_gif_static] => false
[mms_gif_animated] => false
[mms_png] => false
[mms_bmp] => false
[mms_wbmp] => false
[mms_amr] => false
[mms_wav] => false
[mms_midi_monophonic] => false
[mms_midi_polyphonic] => false
[mms_midi_polyphonic_voices] => 0
[mms_spmidi] => false
[mms_mmf] => false
[mms_mp3] => false
[mms_evrc] => false
[mms_qcelp] => false
[mms_ota_bitmap] => false
[mms_nokia_wallpaper] => false
[mms_nokia_operatorlogo] => false
[mms_nokia_3dscreensaver] => false
[mms_nokia_ringingtone] => false
[mms_rmf] => false
[mms_xmf] => false
[mms_symbian_install] => false
[mms_jar] => false
[mms_jad] => false
[mms_vcard] => false
[mms_vcalendar] => false
[mms_wml] => false
[mms_wbxml] => false
[mms_wmlc] => false
[mms_video] => false
[mms_mp4] => false
[mms_3gpp] => false
[mms_3gpp2] => false
[mms_max_frame_rate] => 0
[nokiaring] => false
[picturemessage] => false
[operatorlogo] => false
[largeoperatorlogo] => false
[callericon] => false
[nokiavcard] => false
[nokiavcal] => false
[sckl_ringtone] => false
[sckl_operatorlogo] => false
[sckl_groupgraphic] => false
[sckl_vcard] => false
[sckl_vcalendar] => false
[text_imelody] => false
[ems] => false
[ems_variablesizedpictures] => false
[ems_imelody] => false
[ems_odi] => false
[ems_upi] => false
[ems_version] => 0
[siemens_ota] => false
[siemens_logo_width] => 101
[siemens_logo_height] => 29
[siemens_screensaver_width] => 101
[siemens_screensaver_height] => 50
[gprtf] => false
[sagem_v1] => false
[sagem_v2] => false
[panasonic] => false
[sms_enabled] => true
[wav] => false
[mmf] => false
[smf] => false
[mld] => false
[midi_monophonic] => false
[midi_polyphonic] => false
[sp_midi] => false
[rmf] => false
[xmf] => false
[compactmidi] => false
[digiplug] => false
[nokia_ringtone] => false
[imelody] => false
[au] => false
[amr] => false
[awb] => false
[aac] => true
[mp3] => true
[voices] => 1
[qcelp] => false
[evrc] => false
[flash_lite_version] =>
[fl_wallpaper] => false
[fl_screensaver] => false
[fl_standalone] => false
[fl_browser] => false
[fl_sub_lcd] => false
[full_flash_support] => false
[css_supports_width_as_percentage] => true
[css_border_image] => webkit
[css_rounded_corners] => webkit
[css_gradient] => none
[css_spriting] => true
[css_gradient_linear] => none
[is_transcoder] => false
[transcoder_ua_header] => user-agent
[rss_support] => false
[pdf_support] => true
[progressive_download] => true
[playback_vcodec_h263_0] => 10
[playback_vcodec_h263_3] => -1
[playback_vcodec_mpeg4_sp] => 0
[playback_vcodec_mpeg4_asp] => -1
[playback_vcodec_h264_bp] => 3.0
[playback_real_media] => none
[playback_3gpp] => true
[playback_3g2] => false
[playback_mp4] => true
[playback_mov] => false
[playback_acodec_amr] => nb
[playback_acodec_aac] => none
[playback_df_size_limit] => 0
[playback_directdownload_size_limit] => 0
[playback_inline_size_limit] => 0
[playback_oma_size_limit] => 0
[playback_acodec_qcelp] => false
[playback_wmv] => none
[hinted_progressive_download] => true
[html_preferred_dtd] => html4
[viewport_supported] => true
[viewport_width] => device_width_token
[viewport_userscalable] => no
[viewport_initial_scale] =>
[viewport_maximum_scale] =>
[viewport_minimum_scale] =>
[mobileoptimized] => false
[handheldfriendly] => false
[canvas_support] => full
[image_inlining] => true
[is_smarttv] => false
[is_console] => false
[nfc_support] => false
[ux_full_desktop] => false
[jqm_grade] => A
[is_sencha_touch_ok] => false
[controlcap_is_smartphone] => default
[controlcap_is_ios] => default
[controlcap_is_android] => default
[controlcap_is_robot] => default
[controlcap_is_app] => default
[controlcap_advertised_device_os] => default
[controlcap_advertised_device_os_version] => default
[controlcap_advertised_browser] => default
[controlcap_advertised_browser_version] => default
[controlcap_is_windows_phone] => default
[controlcap_is_full_desktop] => default
[controlcap_is_largescreen] => default
[controlcap_is_mobile] => default
[controlcap_is_touchscreen] => default
[controlcap_is_wml_preferred] => default
[controlcap_is_xhtmlmp_preferred] => default
[controlcap_is_html_preferred] => default
[controlcap_form_factor] => default
[controlcap_complete_device_name] => default
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr></table>
</div>
<div class="section">
<h1 class="header center orange-text">About this comparison</h1>
<div class="row center">
<h5 class="header light">
The primary goal of this project is simple<br />
I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br />
<br />
The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br />
<br />
You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br />
<br />
The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a>
</h5>
</div>
</div>
<div class="card">
<div class="card-content">
Comparison created <i>2016-02-13 13:43:02</i> | by
<a href="https://github.com/ThaDafinser">ThaDafinser</a>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js"></script>
<script>
$(document).ready(function(){
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$('.modal-trigger').leanModal();
});
</script>
</body>
</html> | {
"content_hash": "09a922f80a2983000cb9e1f0b8434b03",
"timestamp": "",
"source": "github",
"line_count": 1128,
"max_line_length": 758,
"avg_line_length": 41.530141843971634,
"alnum_prop": 0.5394697519532083,
"repo_name": "ThaDafinser/UserAgentParserComparison",
"id": "832a274d601c85f3c6074903cf5f185d0db6454f",
"size": "46847",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "v4/user-agent-detail/f7/4b/f74bab3f-549c-440e-9a95-9b3e505fc03f.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2060859160"
}
],
"symlink_target": ""
} |
/**
* Dependencies
*/
var _ = require('lodash'),
util = require('util'),
Err = require('../../../errors/fatal'),
onRoute = require('./onRoute'),
STRINGFILE = require('sails-stringfile');
/**
* Expose hook definition
*/
module.exports = function(sails) {
return {
defaults: {},
configure: function() {
// Legacy (< v0.10) support for configured handlers
if (typeof sails.config[500] === 'function') {
sails.after('lifted', function() {
STRINGFILE.logDeprecationNotice('sails.config[500]',
STRINGFILE.get('links.docs.migrationGuide.responses'),
sails.log.debug);
sails.log.debug('sails.config[500] (i.e. `config/500.js`) has been superceded in Sails v0.10.');
sails.log.debug('Please define a "response" instead. (i.e. api/responses/serverError.js)');
sails.log.debug('Your old handler is being ignored. (the format has been upgraded in v0.10)');
sails.log.debug('If you\'d like to use the default handler, just remove this configuration option.');
});
}
if (typeof sails.config[404] === 'function') {
sails.after('lifted', function() {
STRINGFILE.logDeprecationNotice('sails.config[404]',
STRINGFILE.get('links.docs.migrationGuide.responses'),
sails.log.debug);
sails.log.debug('Please define a "response" instead. (i.e. api/responses/notFound.js)');
sails.log.debug('Your old handler is being ignored. (the format has been upgraded in v0.10)');
sails.log.debug('If you\'d like to use the default handler, just remove this configuration option.');
});
}
},
/**
* When this hook is loaded...
*/
initialize: function(cb) {
// Register route syntax that allows explicit routes
// to be bound directly to custom responses by name.
// (e.g. {response: 'foo'})
sails.on('route:typeUnknown', onRoute(sails));
cb();
},
/**
* Fetch relevant modules, exposing them on `sails` subglobal if necessary,
*/
loadModules: function(cb) {
var hook = this;
sails.log.verbose('Loading runtime custom response definitions...');
sails.modules.loadResponses(function loadedRuntimeErrorModules(err, responseDefs) {
if (err) return cb(err);
// Check that the user reserved response methods/properties
var reservedResKeys = [
'view',
'status', 'set', 'get', 'cookie', 'clearCookie', 'redirect',
'location', 'charset', 'send', 'json', 'jsonp', 'type', 'format',
'attachment', 'sendfile', 'download', 'links', 'locals', 'render'
];
_.each(Object.keys(responseDefs), function(userResponseKey) {
if (_.contains(reservedResKeys, userResponseKey)) {
return Err.invalidCustomResponse(userResponseKey);
}
});
// Ensure that required custom responses exist.
_.defaults(responseDefs, {
ok: require('./defaults/ok'),
negotiate: require('./defaults/negotiate'),
notFound: require('./defaults/notFound'),
serverError: require('./defaults/serverError'),
forbidden: require('./defaults/forbidden'),
badRequest: require('./defaults/badRequest')
// Example usage:
// foo: cannotFindResponseWarning('foo', 400)
});
// Register blueprint actions as middleware
hook.middleware = responseDefs;
return cb();
});
/**
*
* @param {String} responseName
* @return {Function}
*/
function cannotFindResponseWarning(responseName, statusCode) {
return function _mockCustomResponse(err) {
var req = this.req;
var res = this.res;
// Log a warning:
var warningMsg = '`res.%s()` was called, but no response module was found for `%s`.';
warningMsg = util.format(warningMsg, responseName, responseName);
// sails.log.warn(warningMsg);
var helpMsg = 'You can probably solve this by creating `%s.js` in:';
helpMsg = util.format(helpMsg, responseName);
// sails.log.warn(helpMsg);
// sails.log.warn(sails.config.paths.responses);
// Send a default response:
// var wrappedErr = { status: statusCode };
// if (_.isObject(err)) {
// _.extend(wrappedErr, err);
// }
// else {
// wrappedErr.error = err;
// }
if (process.env.NODE_ENV === 'production') {
return res.send(statusCode || 500, err);
}
return res.send(statusCode || 500, err);
};
}
},
/**
* Shadow route bindings
* @type {Object}
*/
routes: {
before: {
/**
* Add custom response methods to `res`.
*
* @param {Request} req
* @param {Response} res
* @param {Function} next [description]
* @api private
*/
'all /*': function addResponseMethods(req, res, next) {
// Attach res.jsonx to `res` object
_mixin_jsonx(req,res);
// Attach custom responses to `res` object
// Provide access to `req` and `res` in each of their `this` contexts.
_.each(sails.middleware.responses, function eachMethod(responseFn, name) {
res[name] = _.bind(responseFn, {
req: req,
res: res
});
});
// Proceed!
next();
}
}
}
};
};
/**
* [_mixin_jsonx description]
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
function _mixin_jsonx(req, res) {
/**
* res.jsonx(data)
*
* Serve JSON (and allow JSONP if enabled in `req.options`)
*
* @param {Object} data
*/
res.jsonx = res.jsonx || function jsonx (data){
// Send conventional status message if no data was provided
// (see http://expressjs.com/api.html#res.send)
if (_.isUndefined(data)) {
return res.send(res.statusCode);
}
else if (typeof data !== 'object') {
// (note that this guard includes arrays)
return res.send(data);
}
else if ( req.options.jsonp && !req.isSocket ) {
return res.jsonp(data);
}
else return res.json(data);
};
}
// Note for later
// We could differentiate between 500 (generic error message)
// and 504 (gateway did not receive response from upstream server) which could describe an IO problem
// This is worth having a think about, since there are 2 fundamentally different kinds of "server errors":
// (a) An infrastructural issue, or 504 (e.g. MySQL database randomly crashed or Twitter is down)
// (b) Unexpected bug in app code, or 500 (e.g. `req.session.user.id`, but `req.session.user` doesn't exist)
| {
"content_hash": "72b5c28c923fd5eaa25b6a218901161c",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 111,
"avg_line_length": 30.419213973799128,
"alnum_prop": 0.5768016078093597,
"repo_name": "xjpro/sails-windows-associations",
"id": "68275dbd2ee4ba874d551d52149dbd41350e7a18",
"size": "6966",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "lib/hooks/responses/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "803"
},
{
"name": "JavaScript",
"bytes": "741137"
}
],
"symlink_target": ""
} |
===============================
pylxd
===============================
python library for lxd
Python library for communicating with the REST API via the unix socket.
| {
"content_hash": "9d4db72c39b777e9d9675d1208ac8e31",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 71,
"avg_line_length": 23.857142857142858,
"alnum_prop": 0.49700598802395207,
"repo_name": "Saviq/pylxd",
"id": "4ddaf258bf811684d4001538a6e70d9ca2f7984d",
"size": "167",
"binary": false,
"copies": "3",
"ref": "refs/heads/travis",
"path": "README.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "94211"
}
],
"symlink_target": ""
} |
#ifndef __GRPC_INTERNAL_IOMGR_ENDPOINT_H__
#define __GRPC_INTERNAL_IOMGR_ENDPOINT_H__
#include "src/core/iomgr/pollset.h"
#include <grpc/support/slice.h>
#include <grpc/support/time.h>
/* An endpoint caps a streaming channel between two communicating processes.
Examples may be: a tcp socket, <stdin+stdout>, or some shared memory. */
typedef struct grpc_endpoint grpc_endpoint;
typedef struct grpc_endpoint_vtable grpc_endpoint_vtable;
typedef enum grpc_endpoint_cb_status {
GRPC_ENDPOINT_CB_OK = 0, /* Call completed successfully */
GRPC_ENDPOINT_CB_EOF, /* Call completed successfully, end of file reached */
GRPC_ENDPOINT_CB_SHUTDOWN, /* Call interrupted by shutdown */
GRPC_ENDPOINT_CB_ERROR /* Call interrupted by socket error */
} grpc_endpoint_cb_status;
typedef enum grpc_endpoint_write_status {
GRPC_ENDPOINT_WRITE_DONE, /* completed immediately, cb won't be called */
GRPC_ENDPOINT_WRITE_PENDING, /* cb will be called when completed */
GRPC_ENDPOINT_WRITE_ERROR /* write errored out, cb won't be called */
} grpc_endpoint_write_status;
typedef void (*grpc_endpoint_read_cb)(void *user_data, gpr_slice *slices,
size_t nslices,
grpc_endpoint_cb_status error);
typedef void (*grpc_endpoint_write_cb)(void *user_data,
grpc_endpoint_cb_status error);
struct grpc_endpoint_vtable {
void (*notify_on_read)(grpc_endpoint *ep, grpc_endpoint_read_cb cb,
void *user_data);
grpc_endpoint_write_status (*write)(grpc_endpoint *ep, gpr_slice *slices,
size_t nslices, grpc_endpoint_write_cb cb,
void *user_data);
void (*add_to_pollset)(grpc_endpoint *ep, grpc_pollset *pollset);
void (*shutdown)(grpc_endpoint *ep);
void (*destroy)(grpc_endpoint *ep);
};
/* When data is available on the connection, calls the callback with slices. */
void grpc_endpoint_notify_on_read(grpc_endpoint *ep, grpc_endpoint_read_cb cb,
void *user_data);
/* Write slices out to the socket.
If the connection is ready for more data after the end of the call, it
returns GRPC_ENDPOINT_WRITE_DONE.
Otherwise it returns GRPC_ENDPOINT_WRITE_PENDING and calls cb when the
connection is ready for more data. */
grpc_endpoint_write_status grpc_endpoint_write(grpc_endpoint *ep,
gpr_slice *slices,
size_t nslices,
grpc_endpoint_write_cb cb,
void *user_data);
/* Causes any pending read/write callbacks to run immediately with
GRPC_ENDPOINT_CB_SHUTDOWN status */
void grpc_endpoint_shutdown(grpc_endpoint *ep);
void grpc_endpoint_destroy(grpc_endpoint *ep);
/* Add an endpoint to a pollset, so that when the pollset is polled, events from
this endpoint are considered */
void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset);
struct grpc_endpoint {
const grpc_endpoint_vtable *vtable;
};
#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_H__ */
| {
"content_hash": "3919e215e5e8fe1053452fdffefd682b",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 80,
"avg_line_length": 43.08,
"alnum_prop": 0.6394305168678428,
"repo_name": "nathanielmanistaatgoogle/grpc",
"id": "e89cf6691c08eff7c3029f616905b1a798f354c9",
"size": "4799",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/core/iomgr/endpoint.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "3066424"
},
{
"name": "C#",
"bytes": "384252"
},
{
"name": "C++",
"bytes": "499254"
},
{
"name": "JavaScript",
"bytes": "135884"
},
{
"name": "Makefile",
"bytes": "1105328"
},
{
"name": "Objective-C",
"bytes": "145264"
},
{
"name": "PHP",
"bytes": "100749"
},
{
"name": "Protocol Buffer",
"bytes": "133189"
},
{
"name": "Python",
"bytes": "663536"
},
{
"name": "Ruby",
"bytes": "291726"
},
{
"name": "Shell",
"bytes": "17838"
}
],
"symlink_target": ""
} |
local mod = EPGP:NewModule("warnings", "AceHook-3.0")
local DLG = LibStub("LibDialog-1.0")
local L = LibStub("AceLocale-3.0"):GetLocale("EPGP")
DLG:Register("EPGP_OFFICER_NOTE_WARNING", {
text = L["EPGP is using Officer Notes for data storage. Do you really want to edit the Officer Note by hand?"],
icon = [[Interface\DialogFrame\UI-Dialog-Icon-AlertNew]],
buttons = {
{
text = _G.YES,
on_click = function(self)
self:Hide()
mod.hooks[GuildMemberOfficerNoteBackground]["OnMouseUp"]()
end,
},
{
text = _G.NO,
},
},
hide_on_escape = true,
show_while_dead = true,
})
DLG:Register("EPGP_MULTIPLE_MASTERS_WARNING", {
text = L["Make sure you are the only person changing EP and GP. If you have multiple people changing EP and GP at the same time, for example one awarding EP and another crediting GP, you *are* going to have data loss."],
icon = [[Interface\DialogFrame\UI-Dialog-Icon-AlertNew]],
buttons = {
{
text = _G.OKAY,
},
},
hide_on_escape = true,
show_while_dead = true,
time_remaining = 15,
})
mod.dbDefaults = {
profile = {
enabled = true,
}
}
function mod:OnInitialize()
self.db = EPGP.db:RegisterNamespace("warnings", mod.dbDefaults)
end
function mod:OnEnable()
local function officer_note_warning()
DLG:Spawn("EPGP_OFFICER_NOTE_WARNING")
end
if GuildMemberOfficerNoteBackground and
GuildMemberOfficerNoteBackground:HasScript("OnMouseUp") then
self:RawHookScript(GuildMemberOfficerNoteBackground, "OnMouseUp",
officer_note_warning)
end
local events_for_multiple_masters_warning = {
"StartRecurringAward",
"EPAward",
"GPAward",
}
-- We want to show this warning just once.
local function multiple_masters_warning()
if not UnitAffectingCombat("player") then
DLG:Spawn("EPGP_MULTIPLE_MASTERS_WARNING")
end
for _, event in pairs(events_for_multiple_masters_warning) do
EPGP.UnregisterCallback(self, event)
end
end
for _, event in pairs(events_for_multiple_masters_warning) do
EPGP.RegisterCallback(self, event, multiple_masters_warning)
end
end
| {
"content_hash": "fc5b0a0051e23124f11c75ab498e7ea3",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 222,
"avg_line_length": 28.76923076923077,
"alnum_prop": 0.6519607843137255,
"repo_name": "Taracque/epgp",
"id": "1a405520e2609f62b43cf9149a855ada5e6f43aa",
"size": "2244",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/warnings.lua",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Lua",
"bytes": "920190"
},
{
"name": "TeX",
"bytes": "4343"
}
],
"symlink_target": ""
} |
This is a system used to provide an objective measure of a number of cookbook
quality metrics. The system takes inspiration from [Foodcritic](http://www.foodcritic.io/).
**Umbrella Project**: [Supermarket](https://github.com/chef/chef-oss-practices/blob/master/projects/supermarket.md)
* **[Project State](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md):** Maintained
* **Issues [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md):** 14 days
* **Pull Request [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md):** 14 days
This repository is a place where the community can start collaborating on
metrics.
The lifecycle of a metric will be:
* *Draft* - this is a proposed metric, ready for community discussion and
approval.
* *Accepted* - this metric has been accepted and merged into the master branch.
* *In Progress* - data for this metric is being gathered and is visible by some
mechanism but not displayed on the Supermarket by default.
* *Implemented* - this metric has been implemented and is shown on the Supermarket.
* *Closed* - this metric has not been accepted or has been removed from the
system.
## Proposing New Metrics
* create a new branch in this repository
* copy `quality-metrics/template.md` to `quality-metrics/new/qm-000-SHORT_NAME.md`
* Add new metric to your new file
* Submit a pull request against this repository
## Approving New Metrics
* New metrics will be reviewed by the people listed in `MAINTAINERS.md`
* At least two MAINTAINERS must approve each new metric with a :+1:
* Any maintainer may :-1: a proposed metric. This will increase the
requirement for a metric to be merged to an absolute majority of maintainers.
* An EDITOR (someone listed in `EDITORS.md`) will:
* Assign a number to the quality metric by updating the name of the file and
the `SMQM` field
* Move the file from `quality-metrics/new` to `quality-metrics/`
* Update the status to `Accepted`
* Add the metric to `SMQM.md`
The metric's status should be changed to `In Progress` once data is being gathered for that metric.
The metric's status should be changed to `Implemented` when the metric is being measured and is visible on the [public Supermarket](https://supermarket.chef.io).
## Viewing Cookbook Metrics
The [Supermarket](https://supermarket.chef.io) will show the metrics for each cookbook. We are currently concerned with coming up with a good list of cookbook quality metrics outside of the technical implementation. Once this moves into the implementation phase, there may be metrics here which require adjustments to Chef, Supermarket, or other tools.
## Maintenance Policy
This project generally follows [Chef's Maintenance Policy](https://github.com/chef/chef-rfc/blob/master/rfc030-maintenance-policy.md).
* The **Project Lead** for this is project is the current project lead for [Chef](https://github.com/chef/chef) as specified in the [MAINTAINERS file](https://github.com/chef/chef/blob/master/MAINTAINERS.md).
* The **Lieutenant** and **Maintainers** for this project are listed in `MAINTAINERS.md`.
| {
"content_hash": "a62e2bcd5fb277d6d01a549b9c432bc3",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 352,
"avg_line_length": 55.62068965517241,
"alnum_prop": 0.7653440793552387,
"repo_name": "chef-cookbooks/cookbook-quality-metrics",
"id": "0a065bb4d57c670c4f1497ca293e0688535b918a",
"size": "3254",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "7551"
}
],
"symlink_target": ""
} |
using content::WebContents;
namespace page_actions_keys = extension_page_actions_api_constants;
namespace extensions {
namespace {
const char kBrowserActionStorageKey[] = "browser_action";
const char kPopupUrlStorageKey[] = "poupup_url";
const char kTitleStorageKey[] = "title";
const char kIconStorageKey[] = "icon";
const char kBadgeTextStorageKey[] = "badge_text";
const char kBadgeBackgroundColorStorageKey[] = "badge_background_color";
const char kBadgeTextColorStorageKey[] = "badge_text_color";
const char kAppearanceStorageKey[] = "appearance";
// Only add values to the end of this enum, since it's stored in the user's
// Extension State, under the kAppearanceStorageKey. It represents the
// ExtensionAction's default visibility.
enum StoredAppearance {
// The action icon is hidden.
INVISIBLE = 0,
// The action is trying to get the user's attention but isn't yet
// running on the page. Was only used for script badges.
OBSOLETE_WANTS_ATTENTION = 1,
// The action icon is visible with its normal appearance.
ACTIVE = 2,
};
// Whether the browser action is visible in the toolbar.
const char kBrowserActionVisible[] = "browser_action_visible";
// Errors.
const char kNoExtensionActionError[] =
"This extension has no action specified.";
const char kNoTabError[] = "No tab with id: *.";
const char kNoPageActionError[] =
"This extension has no page action specified.";
const char kUrlNotActiveError[] = "This url is no longer active: *.";
const char kOpenPopupError[] =
"Failed to show popup either because there is an existing popup or another "
"error occurred.";
const char kInternalError[] = "Internal error.";
struct IconRepresentationInfo {
// Size as a string that will be used to retrieve representation value from
// SetIcon function arguments.
const char* size_string;
// Scale factor for which the represantion should be used.
ui::ScaleFactor scale;
};
const IconRepresentationInfo kIconSizes[] = {
{ "19", ui::SCALE_FACTOR_100P },
{ "38", ui::SCALE_FACTOR_200P }
};
// Conversion function for reading/writing to storage.
SkColor RawStringToSkColor(const std::string& str) {
uint64 value = 0;
base::StringToUint64(str, &value);
SkColor color = static_cast<SkColor>(value);
DCHECK(value == color); // ensure value fits into color's 32 bits
return color;
}
// Conversion function for reading/writing to storage.
std::string SkColorToRawString(SkColor color) {
return base::Uint64ToString(color);
}
// Conversion function for reading/writing to storage.
bool StringToSkBitmap(const std::string& str, SkBitmap* bitmap) {
// TODO(mpcomplete): Remove the base64 encode/decode step when
// http://crbug.com/140546 is fixed.
std::string raw_str;
if (!base::Base64Decode(str, &raw_str))
return false;
bool success = gfx::PNGCodec::Decode(
reinterpret_cast<unsigned const char*>(raw_str.data()), raw_str.size(),
bitmap);
return success;
}
// Conversion function for reading/writing to storage.
std::string RepresentationToString(const gfx::ImageSkia& image, float scale) {
SkBitmap bitmap = image.GetRepresentation(scale).sk_bitmap();
SkAutoLockPixels lock_image(bitmap);
std::vector<unsigned char> data;
bool success = gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &data);
if (!success)
return std::string();
base::StringPiece raw_str(
reinterpret_cast<const char*>(&data[0]), data.size());
std::string base64_str;
base::Base64Encode(raw_str, &base64_str);
return base64_str;
}
// Set |action|'s default values to those specified in |dict|.
void SetDefaultsFromValue(const base::DictionaryValue* dict,
ExtensionAction* action) {
const int kDefaultTabId = ExtensionAction::kDefaultTabId;
std::string str_value;
int int_value;
SkBitmap bitmap;
gfx::ImageSkia icon;
// For each value, don't set it if it has been modified already.
if (dict->GetString(kPopupUrlStorageKey, &str_value) &&
!action->HasPopupUrl(kDefaultTabId)) {
action->SetPopupUrl(kDefaultTabId, GURL(str_value));
}
if (dict->GetString(kTitleStorageKey, &str_value) &&
!action->HasTitle(kDefaultTabId)) {
action->SetTitle(kDefaultTabId, str_value);
}
if (dict->GetString(kBadgeTextStorageKey, &str_value) &&
!action->HasBadgeText(kDefaultTabId)) {
action->SetBadgeText(kDefaultTabId, str_value);
}
if (dict->GetString(kBadgeBackgroundColorStorageKey, &str_value) &&
!action->HasBadgeBackgroundColor(kDefaultTabId)) {
action->SetBadgeBackgroundColor(kDefaultTabId,
RawStringToSkColor(str_value));
}
if (dict->GetString(kBadgeTextColorStorageKey, &str_value) &&
!action->HasBadgeTextColor(kDefaultTabId)) {
action->SetBadgeTextColor(kDefaultTabId, RawStringToSkColor(str_value));
}
if (dict->GetInteger(kAppearanceStorageKey, &int_value) &&
!action->HasIsVisible(kDefaultTabId)) {
switch (int_value) {
case INVISIBLE:
case OBSOLETE_WANTS_ATTENTION:
action->SetIsVisible(kDefaultTabId, false);
case ACTIVE:
action->SetIsVisible(kDefaultTabId, true);
}
}
const base::DictionaryValue* icon_value = NULL;
if (dict->GetDictionary(kIconStorageKey, &icon_value) &&
!action->HasIcon(kDefaultTabId)) {
for (size_t i = 0; i < arraysize(kIconSizes); i++) {
if (icon_value->GetString(kIconSizes[i].size_string, &str_value) &&
StringToSkBitmap(str_value, &bitmap)) {
CHECK(!bitmap.isNull());
float scale = ui::GetImageScale(kIconSizes[i].scale);
icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale));
}
}
action->SetIcon(kDefaultTabId, gfx::Image(icon));
}
}
// Store |action|'s default values in a DictionaryValue for use in storing to
// disk.
scoped_ptr<base::DictionaryValue> DefaultsToValue(ExtensionAction* action) {
const int kDefaultTabId = ExtensionAction::kDefaultTabId;
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString(kPopupUrlStorageKey,
action->GetPopupUrl(kDefaultTabId).spec());
dict->SetString(kTitleStorageKey, action->GetTitle(kDefaultTabId));
dict->SetString(kBadgeTextStorageKey, action->GetBadgeText(kDefaultTabId));
dict->SetString(
kBadgeBackgroundColorStorageKey,
SkColorToRawString(action->GetBadgeBackgroundColor(kDefaultTabId)));
dict->SetString(kBadgeTextColorStorageKey,
SkColorToRawString(action->GetBadgeTextColor(kDefaultTabId)));
dict->SetInteger(kAppearanceStorageKey,
action->GetIsVisible(kDefaultTabId) ? ACTIVE : INVISIBLE);
gfx::ImageSkia icon = action->GetExplicitlySetIcon(kDefaultTabId);
if (!icon.isNull()) {
base::DictionaryValue* icon_value = new base::DictionaryValue();
for (size_t i = 0; i < arraysize(kIconSizes); i++) {
float scale = ui::GetImageScale(kIconSizes[i].scale);
if (icon.HasRepresentation(scale)) {
icon_value->SetString(
kIconSizes[i].size_string,
RepresentationToString(icon, scale));
}
}
dict->Set(kIconStorageKey, icon_value);
}
return dict.Pass();
}
} // namespace
//
// ExtensionActionAPI
//
static base::LazyInstance<BrowserContextKeyedAPIFactory<ExtensionActionAPI> >
g_factory = LAZY_INSTANCE_INITIALIZER;
ExtensionActionAPI::ExtensionActionAPI(content::BrowserContext* context) {
ExtensionFunctionRegistry* registry =
ExtensionFunctionRegistry::GetInstance();
// Browser Actions
registry->RegisterFunction<BrowserActionSetIconFunction>();
registry->RegisterFunction<BrowserActionSetTitleFunction>();
registry->RegisterFunction<BrowserActionSetBadgeTextFunction>();
registry->RegisterFunction<BrowserActionSetBadgeBackgroundColorFunction>();
registry->RegisterFunction<BrowserActionSetPopupFunction>();
registry->RegisterFunction<BrowserActionGetTitleFunction>();
registry->RegisterFunction<BrowserActionGetBadgeTextFunction>();
registry->RegisterFunction<BrowserActionGetBadgeBackgroundColorFunction>();
registry->RegisterFunction<BrowserActionGetPopupFunction>();
registry->RegisterFunction<BrowserActionEnableFunction>();
registry->RegisterFunction<BrowserActionDisableFunction>();
registry->RegisterFunction<BrowserActionOpenPopupFunction>();
// Page Actions
registry->RegisterFunction<EnablePageActionsFunction>();
registry->RegisterFunction<DisablePageActionsFunction>();
registry->RegisterFunction<PageActionShowFunction>();
registry->RegisterFunction<PageActionHideFunction>();
registry->RegisterFunction<PageActionSetIconFunction>();
registry->RegisterFunction<PageActionSetTitleFunction>();
registry->RegisterFunction<PageActionSetPopupFunction>();
registry->RegisterFunction<PageActionGetTitleFunction>();
registry->RegisterFunction<PageActionGetPopupFunction>();
}
ExtensionActionAPI::~ExtensionActionAPI() {
}
// static
BrowserContextKeyedAPIFactory<ExtensionActionAPI>*
ExtensionActionAPI::GetFactoryInstance() {
return g_factory.Pointer();
}
// static
ExtensionActionAPI* ExtensionActionAPI::Get(content::BrowserContext* context) {
return BrowserContextKeyedAPIFactory<ExtensionActionAPI>::Get(context);
}
// static
bool ExtensionActionAPI::GetBrowserActionVisibility(
const ExtensionPrefs* prefs,
const std::string& extension_id) {
bool visible = false;
if (!prefs || !prefs->ReadPrefAsBoolean(extension_id,
kBrowserActionVisible,
&visible)) {
return true;
}
return visible;
}
// static
void ExtensionActionAPI::SetBrowserActionVisibility(
ExtensionPrefs* prefs,
const std::string& extension_id,
bool visible) {
if (GetBrowserActionVisibility(prefs, extension_id) == visible)
return;
prefs->UpdateExtensionPref(extension_id,
kBrowserActionVisible,
new base::FundamentalValue(visible));
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED,
content::Source<ExtensionPrefs>(prefs),
content::Details<const std::string>(&extension_id));
}
// static
void ExtensionActionAPI::BrowserActionExecuted(
content::BrowserContext* context,
const ExtensionAction& browser_action,
WebContents* web_contents) {
ExtensionActionExecuted(context, browser_action, web_contents);
}
// static
void ExtensionActionAPI::PageActionExecuted(content::BrowserContext* context,
const ExtensionAction& page_action,
int tab_id,
const std::string& url,
int button) {
DispatchOldPageActionEvent(context,
page_action.extension_id(),
page_action.id(),
tab_id,
url,
button);
WebContents* web_contents = NULL;
if (!extensions::ExtensionTabUtil::GetTabById(
tab_id,
Profile::FromBrowserContext(context),
context->IsOffTheRecord(),
NULL,
NULL,
&web_contents,
NULL)) {
return;
}
ExtensionActionExecuted(context, page_action, web_contents);
}
// static
void ExtensionActionAPI::DispatchEventToExtension(
content::BrowserContext* context,
const std::string& extension_id,
const std::string& event_name,
scoped_ptr<base::ListValue> event_args) {
if (!extensions::ExtensionSystem::Get(context)->event_router())
return;
scoped_ptr<Event> event(new Event(event_name, event_args.Pass()));
event->restrict_to_browser_context = context;
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
ExtensionSystem::Get(context)->event_router()->DispatchEventToExtension(
extension_id, event.Pass());
}
// static
void ExtensionActionAPI::DispatchOldPageActionEvent(
content::BrowserContext* context,
const std::string& extension_id,
const std::string& page_action_id,
int tab_id,
const std::string& url,
int button) {
scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(new base::StringValue(page_action_id));
base::DictionaryValue* data = new base::DictionaryValue();
data->Set(page_actions_keys::kTabIdKey, new base::FundamentalValue(tab_id));
data->Set(page_actions_keys::kTabUrlKey, new base::StringValue(url));
data->Set(page_actions_keys::kButtonKey,
new base::FundamentalValue(button));
args->Append(data);
DispatchEventToExtension(context, extension_id, "pageActions", args.Pass());
}
// static
void ExtensionActionAPI::ExtensionActionExecuted(
content::BrowserContext* context,
const ExtensionAction& extension_action,
WebContents* web_contents) {
const char* event_name = NULL;
switch (extension_action.action_type()) {
case ActionInfo::TYPE_BROWSER:
event_name = "browserAction.onClicked";
break;
case ActionInfo::TYPE_PAGE:
event_name = "pageAction.onClicked";
break;
case ActionInfo::TYPE_SYSTEM_INDICATOR:
// The System Indicator handles its own clicks.
break;
}
if (event_name) {
scoped_ptr<base::ListValue> args(new base::ListValue());
base::DictionaryValue* tab_value =
extensions::ExtensionTabUtil::CreateTabValue(web_contents);
args->Append(tab_value);
DispatchEventToExtension(
context, extension_action.extension_id(), event_name, args.Pass());
}
}
//
// ExtensionActionStorageManager
//
ExtensionActionStorageManager::ExtensionActionStorageManager(Profile* profile)
: profile_(profile) {
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED,
content::NotificationService::AllBrowserContextsAndSources());
StateStore* storage = ExtensionSystem::Get(profile_)->state_store();
if (storage)
storage->RegisterKey(kBrowserActionStorageKey);
}
ExtensionActionStorageManager::~ExtensionActionStorageManager() {
}
void ExtensionActionStorageManager::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_EXTENSION_LOADED: {
const Extension* extension =
content::Details<const Extension>(details).ptr();
if (!ExtensionActionManager::Get(profile_)->
GetBrowserAction(*extension)) {
break;
}
StateStore* storage = ExtensionSystem::Get(profile_)->state_store();
if (storage) {
storage->GetExtensionValue(extension->id(), kBrowserActionStorageKey,
base::Bind(&ExtensionActionStorageManager::ReadFromStorage,
AsWeakPtr(), extension->id()));
}
break;
}
case chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED: {
ExtensionAction* extension_action =
content::Source<ExtensionAction>(source).ptr();
Profile* profile = content::Details<Profile>(details).ptr();
if (profile != profile_)
break;
WriteToStorage(extension_action);
break;
}
default:
NOTREACHED();
break;
}
}
void ExtensionActionStorageManager::WriteToStorage(
ExtensionAction* extension_action) {
StateStore* storage = ExtensionSystem::Get(profile_)->state_store();
if (!storage)
return;
scoped_ptr<base::DictionaryValue> defaults =
DefaultsToValue(extension_action);
storage->SetExtensionValue(extension_action->extension_id(),
kBrowserActionStorageKey,
defaults.PassAs<base::Value>());
}
void ExtensionActionStorageManager::ReadFromStorage(
const std::string& extension_id, scoped_ptr<base::Value> value) {
const Extension* extension =
ExtensionSystem::Get(profile_)->extension_service()->
extensions()->GetByID(extension_id);
if (!extension)
return;
ExtensionAction* browser_action =
ExtensionActionManager::Get(profile_)->GetBrowserAction(*extension);
if (!browser_action) {
// This can happen if the extension is updated between startup and when the
// storage read comes back, and the update removes the browser action.
// http://crbug.com/349371
return;
}
const base::DictionaryValue* dict = NULL;
if (!value.get() || !value->GetAsDictionary(&dict))
return;
SetDefaultsFromValue(dict, browser_action);
}
//
// ExtensionActionFunction
//
ExtensionActionFunction::ExtensionActionFunction()
: details_(NULL),
tab_id_(ExtensionAction::kDefaultTabId),
contents_(NULL),
extension_action_(NULL) {
}
ExtensionActionFunction::~ExtensionActionFunction() {
}
bool ExtensionActionFunction::RunImpl() {
ExtensionActionManager* manager = ExtensionActionManager::Get(GetProfile());
const Extension* extension = GetExtension();
if (StartsWithASCII(name(), "systemIndicator.", false)) {
extension_action_ = manager->GetSystemIndicator(*extension);
} else {
extension_action_ = manager->GetBrowserAction(*extension);
if (!extension_action_) {
extension_action_ = manager->GetPageAction(*extension);
}
}
if (!extension_action_) {
// TODO(kalman): ideally the browserAction/pageAction APIs wouldn't event
// exist for extensions that don't have one declared. This should come as
// part of the Feature system.
error_ = kNoExtensionActionError;
return false;
}
// Populates the tab_id_ and details_ members.
EXTENSION_FUNCTION_VALIDATE(ExtractDataFromArguments());
// Find the WebContents that contains this tab id if one is required.
if (tab_id_ != ExtensionAction::kDefaultTabId) {
ExtensionTabUtil::GetTabById(tab_id_,
GetProfile(),
include_incognito(),
NULL,
NULL,
&contents_,
NULL);
if (!contents_) {
error_ = ErrorUtils::FormatErrorMessage(
kNoTabError, base::IntToString(tab_id_));
return false;
}
} else {
// Only browser actions and system indicators have a default tabId.
ActionInfo::Type action_type = extension_action_->action_type();
EXTENSION_FUNCTION_VALIDATE(
action_type == ActionInfo::TYPE_BROWSER ||
action_type == ActionInfo::TYPE_SYSTEM_INDICATOR);
}
return RunExtensionAction();
}
bool ExtensionActionFunction::ExtractDataFromArguments() {
// There may or may not be details (depends on the function).
// The tabId might appear in details (if it exists), as the first
// argument besides the action type (depends on the function), or be omitted
// entirely.
base::Value* first_arg = NULL;
if (!args_->Get(0, &first_arg))
return true;
switch (first_arg->GetType()) {
case base::Value::TYPE_INTEGER:
CHECK(first_arg->GetAsInteger(&tab_id_));
break;
case base::Value::TYPE_DICTIONARY: {
// Found the details argument.
details_ = static_cast<base::DictionaryValue*>(first_arg);
// Still need to check for the tabId within details.
base::Value* tab_id_value = NULL;
if (details_->Get("tabId", &tab_id_value)) {
switch (tab_id_value->GetType()) {
case base::Value::TYPE_NULL:
// OK; tabId is optional, leave it default.
return true;
case base::Value::TYPE_INTEGER:
CHECK(tab_id_value->GetAsInteger(&tab_id_));
return true;
default:
// Boom.
return false;
}
}
// Not found; tabId is optional, leave it default.
break;
}
case base::Value::TYPE_NULL:
// The tabId might be an optional argument.
break;
default:
return false;
}
return true;
}
void ExtensionActionFunction::NotifyChange() {
switch (extension_action_->action_type()) {
case ActionInfo::TYPE_BROWSER:
case ActionInfo::TYPE_PAGE:
if (ExtensionActionManager::Get(GetProfile())
->GetBrowserAction(*extension_.get())) {
NotifyBrowserActionChange();
} else if (ExtensionActionManager::Get(GetProfile())
->GetPageAction(*extension_.get())) {
NotifyLocationBarChange();
}
return;
case ActionInfo::TYPE_SYSTEM_INDICATOR:
NotifySystemIndicatorChange();
return;
}
NOTREACHED();
}
void ExtensionActionFunction::NotifyBrowserActionChange() {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED,
content::Source<ExtensionAction>(extension_action_),
content::Details<Profile>(GetProfile()));
}
void ExtensionActionFunction::NotifyLocationBarChange() {
TabHelper::FromWebContents(contents_)->
location_bar_controller()->NotifyChange();
}
void ExtensionActionFunction::NotifySystemIndicatorChange() {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED,
content::Source<Profile>(GetProfile()),
content::Details<ExtensionAction>(extension_action_));
}
// static
bool ExtensionActionFunction::ParseCSSColorString(
const std::string& color_string,
SkColor* result) {
std::string formatted_color;
// Check the string for incorrect formatting.
if (color_string.empty() || color_string[0] != '#')
return false;
// Convert the string from #FFF format to #FFFFFF format.
if (color_string.length() == 4) {
for (size_t i = 1; i < 4; ++i) {
formatted_color += color_string[i];
formatted_color += color_string[i];
}
} else if (color_string.length() == 7) {
formatted_color = color_string.substr(1, 6);
} else {
return false;
}
// Convert the string to an integer and make sure it is in the correct value
// range.
std::vector<uint8> color_bytes;
if (!base::HexStringToBytes(formatted_color, &color_bytes))
return false;
DCHECK_EQ(3u, color_bytes.size());
*result = SkColorSetARGB(255, color_bytes[0], color_bytes[1], color_bytes[2]);
return true;
}
bool ExtensionActionFunction::SetVisible(bool visible) {
if (extension_action_->GetIsVisible(tab_id_) == visible)
return true;
extension_action_->SetIsVisible(tab_id_, visible);
NotifyChange();
return true;
}
TabHelper& ExtensionActionFunction::tab_helper() const {
CHECK(contents_);
return *TabHelper::FromWebContents(contents_);
}
bool ExtensionActionShowFunction::RunExtensionAction() {
return SetVisible(true);
}
bool ExtensionActionHideFunction::RunExtensionAction() {
return SetVisible(false);
}
bool ExtensionActionSetIconFunction::RunExtensionAction() {
EXTENSION_FUNCTION_VALIDATE(details_);
// setIcon can take a variant argument: either a dictionary of canvas
// ImageData, or an icon index.
base::DictionaryValue* canvas_set = NULL;
int icon_index;
if (details_->GetDictionary("imageData", &canvas_set)) {
gfx::ImageSkia icon;
// Extract icon representations from the ImageDataSet dictionary.
for (size_t i = 0; i < arraysize(kIconSizes); i++) {
base::BinaryValue* binary;
if (canvas_set->GetBinary(kIconSizes[i].size_string, &binary)) {
IPC::Message pickle(binary->GetBuffer(), binary->GetSize());
PickleIterator iter(pickle);
SkBitmap bitmap;
EXTENSION_FUNCTION_VALIDATE(IPC::ReadParam(&pickle, &iter, &bitmap));
CHECK(!bitmap.isNull());
float scale = ui::GetImageScale(kIconSizes[i].scale);
icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale));
}
}
extension_action_->SetIcon(tab_id_, gfx::Image(icon));
} else if (details_->GetInteger("iconIndex", &icon_index)) {
// Obsolete argument: ignore it.
return true;
} else {
EXTENSION_FUNCTION_VALIDATE(false);
}
NotifyChange();
return true;
}
bool ExtensionActionSetTitleFunction::RunExtensionAction() {
EXTENSION_FUNCTION_VALIDATE(details_);
std::string title;
EXTENSION_FUNCTION_VALIDATE(details_->GetString("title", &title));
extension_action_->SetTitle(tab_id_, title);
NotifyChange();
return true;
}
bool ExtensionActionSetPopupFunction::RunExtensionAction() {
EXTENSION_FUNCTION_VALIDATE(details_);
std::string popup_string;
EXTENSION_FUNCTION_VALIDATE(details_->GetString("popup", &popup_string));
GURL popup_url;
if (!popup_string.empty())
popup_url = GetExtension()->GetResourceURL(popup_string);
extension_action_->SetPopupUrl(tab_id_, popup_url);
NotifyChange();
return true;
}
bool ExtensionActionSetBadgeTextFunction::RunExtensionAction() {
EXTENSION_FUNCTION_VALIDATE(details_);
std::string badge_text;
EXTENSION_FUNCTION_VALIDATE(details_->GetString("text", &badge_text));
extension_action_->SetBadgeText(tab_id_, badge_text);
NotifyChange();
return true;
}
bool ExtensionActionSetBadgeBackgroundColorFunction::RunExtensionAction() {
EXTENSION_FUNCTION_VALIDATE(details_);
base::Value* color_value = NULL;
EXTENSION_FUNCTION_VALIDATE(details_->Get("color", &color_value));
SkColor color = 0;
if (color_value->IsType(base::Value::TYPE_LIST)) {
base::ListValue* list = NULL;
EXTENSION_FUNCTION_VALIDATE(details_->GetList("color", &list));
EXTENSION_FUNCTION_VALIDATE(list->GetSize() == 4);
int color_array[4] = {0};
for (size_t i = 0; i < arraysize(color_array); ++i) {
EXTENSION_FUNCTION_VALIDATE(list->GetInteger(i, &color_array[i]));
}
color = SkColorSetARGB(color_array[3], color_array[0],
color_array[1], color_array[2]);
} else if (color_value->IsType(base::Value::TYPE_STRING)) {
std::string color_string;
EXTENSION_FUNCTION_VALIDATE(details_->GetString("color", &color_string));
if (!ParseCSSColorString(color_string, &color))
return false;
}
extension_action_->SetBadgeBackgroundColor(tab_id_, color);
NotifyChange();
return true;
}
bool ExtensionActionGetTitleFunction::RunExtensionAction() {
SetResult(new base::StringValue(extension_action_->GetTitle(tab_id_)));
return true;
}
bool ExtensionActionGetPopupFunction::RunExtensionAction() {
SetResult(
new base::StringValue(extension_action_->GetPopupUrl(tab_id_).spec()));
return true;
}
bool ExtensionActionGetBadgeTextFunction::RunExtensionAction() {
SetResult(new base::StringValue(extension_action_->GetBadgeText(tab_id_)));
return true;
}
bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() {
base::ListValue* list = new base::ListValue();
SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_);
list->Append(
new base::FundamentalValue(static_cast<int>(SkColorGetR(color))));
list->Append(
new base::FundamentalValue(static_cast<int>(SkColorGetG(color))));
list->Append(
new base::FundamentalValue(static_cast<int>(SkColorGetB(color))));
list->Append(
new base::FundamentalValue(static_cast<int>(SkColorGetA(color))));
SetResult(list);
return true;
}
BrowserActionOpenPopupFunction::BrowserActionOpenPopupFunction()
: response_sent_(false) {
}
bool BrowserActionOpenPopupFunction::RunImpl() {
ExtensionToolbarModel* model = ExtensionToolbarModel::Get(GetProfile());
if (!model) {
error_ = kInternalError;
return false;
}
if (!model->ShowBrowserActionPopup(extension_)) {
error_ = kOpenPopupError;
return false;
}
registrar_.Add(this,
chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
content::Source<Profile>(GetProfile()));
// Set a timeout for waiting for the notification that the popup is loaded.
// Waiting is required so that the popup view can be retrieved by the custom
// bindings for the response callback. It's also needed to keep this function
// instance around until a notification is observed.
base::MessageLoopForUI::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&BrowserActionOpenPopupFunction::OpenPopupTimedOut, this),
base::TimeDelta::FromSeconds(10));
return true;
}
void BrowserActionOpenPopupFunction::OpenPopupTimedOut() {
if (response_sent_)
return;
DVLOG(1) << "chrome.browserAction.openPopup did not show a popup.";
error_ = kOpenPopupError;
SendResponse(false);
response_sent_ = true;
}
void BrowserActionOpenPopupFunction::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, type);
if (response_sent_)
return;
ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP ||
host->extension()->id() != extension_->id())
return;
SendResponse(true);
response_sent_ = true;
registrar_.RemoveAll();
}
} // namespace extensions
//
// PageActionsFunction (deprecated)
//
PageActionsFunction::PageActionsFunction() {
}
PageActionsFunction::~PageActionsFunction() {
}
bool PageActionsFunction::SetPageActionEnabled(bool enable) {
std::string extension_action_id;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &extension_action_id));
base::DictionaryValue* action = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &action));
int tab_id;
EXTENSION_FUNCTION_VALIDATE(action->GetInteger(
page_actions_keys::kTabIdKey, &tab_id));
std::string url;
EXTENSION_FUNCTION_VALIDATE(action->GetString(
page_actions_keys::kUrlKey, &url));
std::string title;
if (enable) {
if (action->HasKey(page_actions_keys::kTitleKey))
EXTENSION_FUNCTION_VALIDATE(action->GetString(
page_actions_keys::kTitleKey, &title));
}
ExtensionAction* page_action = extensions::ExtensionActionManager::Get(
GetProfile())->GetPageAction(*GetExtension());
if (!page_action) {
error_ = extensions::kNoPageActionError;
return false;
}
// Find the WebContents that contains this tab id.
WebContents* contents = NULL;
bool result = extensions::ExtensionTabUtil::GetTabById(
tab_id, GetProfile(), include_incognito(), NULL, NULL, &contents, NULL);
if (!result || !contents) {
error_ = extensions::ErrorUtils::FormatErrorMessage(
extensions::kNoTabError, base::IntToString(tab_id));
return false;
}
// Make sure the URL hasn't changed.
content::NavigationEntry* entry = contents->GetController().GetVisibleEntry();
if (!entry || url != entry->GetURL().spec()) {
error_ = extensions::ErrorUtils::FormatErrorMessage(
extensions::kUrlNotActiveError, url);
return false;
}
// Set visibility and broadcast notifications that the UI should be updated.
page_action->SetIsVisible(tab_id, enable);
page_action->SetTitle(tab_id, title);
extensions::TabHelper::FromWebContents(contents)->
location_bar_controller()->NotifyChange();
return true;
}
bool EnablePageActionsFunction::RunImpl() {
return SetPageActionEnabled(true);
}
bool DisablePageActionsFunction::RunImpl() {
return SetPageActionEnabled(false);
}
| {
"content_hash": "661db4e37ebf720eded6d17a050c60cd",
"timestamp": "",
"source": "github",
"line_count": 925,
"max_line_length": 80,
"avg_line_length": 33.902702702702705,
"alnum_prop": 0.6892538265306123,
"repo_name": "anirudhSK/chromium",
"id": "15973bfb58c5bce7d4bdcf5d22d8688ce42c3e4c",
"size": "33023",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chrome/browser/extensions/api/extension_action/extension_action_api.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "52960"
},
{
"name": "Awk",
"bytes": "8660"
},
{
"name": "C",
"bytes": "42502191"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "201859263"
},
{
"name": "CSS",
"bytes": "946557"
},
{
"name": "DOT",
"bytes": "2984"
},
{
"name": "Java",
"bytes": "5687122"
},
{
"name": "JavaScript",
"bytes": "22163714"
},
{
"name": "M",
"bytes": "2190"
},
{
"name": "Matlab",
"bytes": "2496"
},
{
"name": "Objective-C",
"bytes": "7670589"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "672770"
},
{
"name": "Python",
"bytes": "10873885"
},
{
"name": "R",
"bytes": "262"
},
{
"name": "Shell",
"bytes": "1315894"
},
{
"name": "Tcl",
"bytes": "277091"
},
{
"name": "TypeScript",
"bytes": "1560024"
},
{
"name": "XSLT",
"bytes": "13493"
},
{
"name": "nesC",
"bytes": "15206"
}
],
"symlink_target": ""
} |
<!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 (9-Debian) on Thu Sep 28 23:12:19 GMT 2017 -->
<title>Uses of Interface dollar.api.plugin.ExtensionPoint (Dollar 0.4.5195 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="date" content="2017-09-28">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../jquery/jquery-1.10.2.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface dollar.api.plugin.ExtensionPoint (Dollar 0.4.5195 API)";
}
}
catch(err) {
}
//-->
var pathtoroot = "../../../../";loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="fixedNav">
<!-- ========= 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="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">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?dollar/api/plugin/class-use/ExtensionPoint.html" target="_top">Frames</a></li>
<li><a href="ExtensionPoint.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>
<ul class="navListSearch">
<li><span>SEARCH: </span>
<input type="text" id="search" value=" " disabled="disabled">
<input type="reset" id="reset" value=" " disabled="disabled">
</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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding"> </div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
<div class="header">
<h2 title="Uses of Interface dollar.api.plugin.ExtensionPoint" class="title">Uses of Interface<br>dollar.api.plugin.ExtensionPoint</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#dollar.api.execution">dollar.api.execution</a></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<th class="colFirst" scope="row"><a href="#dollar.api.monitor">dollar.api.monitor</a></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#dollar.api.plugin">dollar.api.plugin</a></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<th class="colFirst" scope="row"><a href="#dollar.api.script">dollar.api.script</a></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#dollar.api.scripting">dollar.api.scripting</a></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<th class="colFirst" scope="row"><a href="#dollar.api.uri">dollar.api.uri</a></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#dollar.execution.simple">dollar.execution.simple</a></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<th class="colFirst" scope="row"><a href="#dollar.http">dollar.http</a></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#dollar.java">dollar.java</a></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<th class="colFirst" scope="row"><a href="#dollar.learner.simple">dollar.learner.simple</a></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#dollar.monitor">dollar.monitor</a></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<th class="colFirst" scope="row"><a href="#dollar.plugins.pipe">dollar.plugins.pipe</a></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#dollar.redis">dollar.redis</a></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<th class="colFirst" scope="row"><a href="#dollar.resources.std">dollar.resources.std</a></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#dollar.uri.mapdb">dollar.uri.mapdb</a></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<th class="colFirst" scope="row"><a href="#dollar.uri.socketio">dollar.uri.socketio</a></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="dollar.api.execution">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/execution/package-summary.html">dollar.api.execution</a></h3>
<table class="useSummary" summary="Use table, listing subinterfaces, and an explanation">
<caption><span>Subinterfaces of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/execution/package-summary.html">dollar.api.execution</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>interface </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/api/execution/DollarExecutor.html" title="interface in dollar.api.execution">DollarExecutor</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/api/execution/package-summary.html">dollar.api.execution</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/api/execution/DefaultDollarExecutor.html" title="class in dollar.api.execution">DefaultDollarExecutor</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.api.monitor">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/monitor/package-summary.html">dollar.api.monitor</a></h3>
<table class="useSummary" summary="Use table, listing subinterfaces, and an explanation">
<caption><span>Subinterfaces of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/monitor/package-summary.html">dollar.api.monitor</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>interface </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/api/monitor/DollarMonitor.html" title="interface in dollar.api.monitor">DollarMonitor</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.api.plugin">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/plugin/package-summary.html">dollar.api.plugin</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/api/plugin/package-summary.html">dollar.api.plugin</a> with type parameters of type <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>interface </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a><T extends <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a>></span></code></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/api/plugin/NoOpProxy.html" title="class in dollar.api.plugin">NoOpProxy</a><T extends <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a><T>></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
<table class="useSummary" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../dollar/api/plugin/package-summary.html">dollar.api.plugin</a> with type parameters of type <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>static <T extends <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a><T>><br>@NotNull <a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><T></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">Plugins.</span><code><span class="memberNameLink"><a href="../../../../dollar/api/plugin/Plugins.html#allProviders-java.lang.Class-">allProviders</a></span>​(@NotNull <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><T> serviceClass)</code></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <T extends <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a><T>><br>T</code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">NoOpProxy.</span><code><span class="memberNameLink"><a href="../../../../dollar/api/plugin/NoOpProxy.html#newInstance-java.lang.Class-">newInstance</a></span>​(@NotNull <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><T> c)</code></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <T extends <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a><T>><br>T</code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">Plugins.</span><code><span class="memberNameLink"><a href="../../../../dollar/api/plugin/Plugins.html#newInstance-java.lang.Class-">newInstance</a></span>​(@NotNull <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><T> serviceClass)</code></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <T extends <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a><T>><br>T</code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">Plugins.</span><code><span class="memberNameLink"><a href="../../../../dollar/api/plugin/Plugins.html#sharedInstance-java.lang.Class-">sharedInstance</a></span>​(@NotNull <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><T> serviceClass)</code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.api.script">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/script/package-summary.html">dollar.api.script</a></h3>
<table class="useSummary" summary="Use table, listing subinterfaces, and an explanation">
<caption><span>Subinterfaces of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/script/package-summary.html">dollar.api.script</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>interface </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/api/script/ModuleResolver.html" title="interface in dollar.api.script">ModuleResolver</a></span></code></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>interface </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/api/script/TypeLearner.html" title="interface in dollar.api.script">TypeLearner</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.api.scripting">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/scripting/package-summary.html">dollar.api.scripting</a></h3>
<table class="useSummary" summary="Use table, listing subinterfaces, and an explanation">
<caption><span>Subinterfaces of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/scripting/package-summary.html">dollar.api.scripting</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>interface </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/api/scripting/ScriptingLanguage.html" title="interface in dollar.api.scripting">ScriptingLanguage</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.api.uri">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/uri/package-summary.html">dollar.api.uri</a></h3>
<table class="useSummary" summary="Use table, listing subinterfaces, and an explanation">
<caption><span>Subinterfaces of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/api/uri/package-summary.html">dollar.api.uri</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>interface </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/api/uri/URIHandlerFactory.html" title="interface in dollar.api.uri">URIHandlerFactory</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.execution.simple">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/execution/simple/package-summary.html">dollar.execution.simple</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/execution/simple/package-summary.html">dollar.execution.simple</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/execution/simple/ScopeAwareDollarExecutor.html" title="class in dollar.execution.simple">ScopeAwareDollarExecutor</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.http">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/http/package-summary.html">dollar.http</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/http/package-summary.html">dollar.http</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/http/HttpURIHandlerFactory.html" title="class in dollar.http">HttpURIHandlerFactory</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.java">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/java/package-summary.html">dollar.java</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/java/package-summary.html">dollar.java</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/java/Java9ScriptingLanguage.html" title="class in dollar.java">Java9ScriptingLanguage</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
<table class="useSummary" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../dollar/java/package-summary.html">dollar.java</a> that return <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>@NotNull <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">Java9ScriptingLanguage.</span><code><span class="memberNameLink"><a href="../../../../dollar/java/Java9ScriptingLanguage.html#copy--">copy</a></span>​()</code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.learner.simple">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/learner/simple/package-summary.html">dollar.learner.simple</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/learner/simple/package-summary.html">dollar.learner.simple</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/learner/simple/SimpleTypeLearner.html" title="class in dollar.learner.simple">SimpleTypeLearner</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.monitor">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/monitor/package-summary.html">dollar.monitor</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/monitor/package-summary.html">dollar.monitor</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/monitor/MetricsMonitor.html" title="class in dollar.monitor">MetricsMonitor</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.plugins.pipe">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/plugins/pipe/package-summary.html">dollar.plugins.pipe</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/plugins/pipe/package-summary.html">dollar.plugins.pipe</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/plugins/pipe/ClassModuleResolver.html" title="class in dollar.plugins.pipe">ClassModuleResolver</a></span></code></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/plugins/pipe/GithubModuleResolver.html" title="class in dollar.plugins.pipe">GithubModuleResolver</a></span></code></th>
<td class="colLast"> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/plugins/pipe/MavenModuleResolver.html" title="class in dollar.plugins.pipe">MavenModuleResolver</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.redis">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/redis/package-summary.html">dollar.redis</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/redis/package-summary.html">dollar.redis</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/redis/RedisURIHandlerFactory.html" title="class in dollar.redis">RedisURIHandlerFactory</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.resources.std">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/resources/std/package-summary.html">dollar.resources.std</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/resources/std/package-summary.html">dollar.resources.std</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/resources/std/RandomResourceFactory.html" title="class in dollar.resources.std">RandomResourceFactory</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.uri.mapdb">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/uri/mapdb/package-summary.html">dollar.uri.mapdb</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/uri/mapdb/package-summary.html">dollar.uri.mapdb</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/uri/mapdb/MapDBURIFactory.html" title="class in dollar.uri.mapdb">MapDBURIFactory</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="dollar.uri.socketio">
<!-- -->
</a>
<h3>Uses of <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a> in <a href="../../../../dollar/uri/socketio/package-summary.html">dollar.uri.socketio</a></h3>
<table class="useSummary" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../dollar/uri/socketio/package-summary.html">dollar.uri.socketio</a> that implement <a href="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">ExtensionPoint</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="../../../../dollar/uri/socketio/SocketIOURIFactory.html" title="class in dollar.uri.socketio">SocketIOURIFactory</a></span></code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</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="../../../../dollar/api/plugin/ExtensionPoint.html" title="interface in dollar.api.plugin">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?dollar/api/plugin/class-use/ExtensionPoint.html" target="_top">Frames</a></li>
<li><a href="ExtensionPoint.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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2017. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "2ab28dd3d479bf7034bc38e183c98fb9",
"timestamp": "",
"source": "github",
"line_count": 635,
"max_line_length": 417,
"avg_line_length": 54.07716535433071,
"alnum_prop": 0.675849617053496,
"repo_name": "sillelien/dollar",
"id": "94559eb5975686acd919d9a42b7144a7ca68a1a9",
"size": "34339",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/dev/apidocs/dollar/api/plugin/class-use/ExtensionPoint.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "5403"
},
{
"name": "Java",
"bytes": "1134511"
},
{
"name": "Shell",
"bytes": "11580"
}
],
"symlink_target": ""
} |
package parser
import (
"unicode"
"unicode/utf8"
)
func lexReference(l StatefulRubyLexer) stateFn {
l.acceptRun(alphaNumericUnderscore)
defaultCase := func() {
r, _ := utf8.DecodeRuneInString(l.slice(l.startIndex(), l.startIndex()+1))
if l.accept("?!") {
l.emit(tokenTypeMethodName)
} else if unicode.IsUpper(r) {
l.emit(tokenTypeCapitalizedReference)
} else {
l.emit(tokenTypeReference)
}
}
switch l.currentSlice() {
case "def":
l.emit(tokenTypeDEF)
l.acceptRun(whitespace)
l.ignore()
if l.lengthOfInput() > l.startIndex()+5 && l.slice(l.startIndex(), l.startIndex()+5) == "self." {
l.acceptRun("self")
l.emit(tokenTypeSELF)
l.accept(".")
l.emit(tokenTypeDot)
}
if l.accept(validMethodNameRunes) {
l.acceptRun(validMethodNameRunes)
l.accept("=")
l.emit(tokenTypeReference)
} else if l.accept("<") {
if l.accept("=") {
l.accept(">")
} else {
l.accept("<")
}
l.emit(tokenTypeOperator)
} else if l.accept(">") {
l.accept("=")
l.emit(tokenTypeOperator)
} else if l.accept("=") {
l.acceptRun("=")
l.emit(tokenTypeOperator)
}
case "defined":
if l.accept("?") {
l.emit(tokenTypeDEFINED)
} else {
defaultCase()
}
case "do":
l.emit(tokenTypeDO)
case "end":
l.emit(tokenTypeEND)
case "if":
l.emit(tokenTypeIF)
case "else":
l.emit(tokenTypeELSE)
case "elsif":
l.emit(tokenTypeELSIF)
case "unless":
l.emit(tokenTypeUNLESS)
case "class":
l.emit(tokenTypeCLASS)
case "module":
l.emit(tokenTypeMODULE)
case "true":
l.emit(tokenTypeTRUE)
case "false":
l.emit(tokenTypeFALSE)
case "__FILE__":
l.emit(tokenType__FILE__)
case "__LINE__":
l.emit(tokenType__LINE__)
case "__ENCODING__":
l.emit(tokenType__ENCODING__)
case "for":
l.emit(tokenTypeFOR)
case "while":
l.emit(tokenTypeWHILE)
case "until":
l.emit(tokenTypeUNTIL)
case "begin":
l.emit(tokenTypeBEGIN)
case "rescue":
l.emit(tokenTypeRESCUE)
case "ensure":
l.emit(tokenTypeENSURE)
case "break":
l.emit(tokenTypeBREAK)
case "next":
l.emit(tokenTypeNEXT)
case "redo":
l.emit(tokenTypeREDO)
case "retry":
l.emit(tokenTypeRETRY)
case "return":
l.emit(tokenTypeRETURN)
case "yield":
l.emit(tokenTypeYIELD)
case "and":
l.emit(tokenTypeAND)
case "or":
l.emit(tokenTypeOR)
case "lambda":
l.emit(tokenTypeLAMBDA)
case "case":
l.emit(tokenTypeCASE)
case "when":
l.emit(tokenTypeWHEN)
case "self":
l.emit(tokenTypeSELF)
case "nil":
l.emit(tokenTypeNIL)
case "alias":
l.emit(tokenTypeALIAS)
readCommaDelimitedSymbolsUntilEOL(l)
default:
defaultCase()
}
return lexSomething
}
func readSymbolsUntilEOL(l StatefulRubyLexer) {
l.acceptRun(whitespace)
l.ignore()
for l.accept(alphaNumericUnderscore) {
l.acceptRun(alphaNumericUnderscore)
l.accept("?!")
l.emit(tokenTypeSymbol)
l.acceptRun(whitespace)
l.ignore()
}
}
func readCommaDelimitedSymbolsUntilEOL(l StatefulRubyLexer) {
l.acceptRun(whitespace)
l.ignore()
for l.accept(alphaNumericUnderscore) {
l.acceptRun(alphaNumericUnderscore)
l.accept("?!")
l.emit(tokenTypeSymbol)
l.acceptRun(whitespace)
l.ignore()
l.accept(",")
l.acceptRun(whitespace)
l.ignore()
}
}
| {
"content_hash": "0ca717a1daf0889cba4513abd483022a",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 99,
"avg_line_length": 19.875776397515526,
"alnum_prop": 0.6728125,
"repo_name": "rajthilakmca/grubby",
"id": "ab27df27360bed5f30a42599a4a7aa9d1aa115ec",
"size": "3200",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "parser/references.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "475461"
},
{
"name": "Ruby",
"bytes": "1346272"
},
{
"name": "Shell",
"bytes": "690"
},
{
"name": "Yacc",
"bytes": "51229"
}
],
"symlink_target": ""
} |
mvn spring-boot:run -Drun.profiles=openshift | {
"content_hash": "d8817d05be9eacffe180fea6d3788f2d",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 44,
"avg_line_length": 44,
"alnum_prop": 0.8409090909090909,
"repo_name": "niekvandael/iTalent",
"id": "014c13ae4b831ed8babf846d5bb5bf4247c6cb9e",
"size": "55",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "italent/runopenshift.sh",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "210"
},
{
"name": "CSS",
"bytes": "79618"
},
{
"name": "HTML",
"bytes": "2092479"
},
{
"name": "Java",
"bytes": "145036"
},
{
"name": "JavaScript",
"bytes": "74574"
},
{
"name": "Shell",
"bytes": "269"
}
],
"symlink_target": ""
} |
import { Model } from 'ember-cli-mirage'
export default Model.extend()
| {
"content_hash": "f53c5baee73099a4e1eb0c6e56c5b14c",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 40,
"avg_line_length": 24,
"alnum_prop": 0.7361111111111112,
"repo_name": "anehx/anonboard-frontend",
"id": "f8ed73237ddb4ffdb51ada9f235d38a4a2f8992e",
"size": "72",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mirage/models/user.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10632"
},
{
"name": "HTML",
"bytes": "9888"
},
{
"name": "JavaScript",
"bytes": "57187"
},
{
"name": "Shell",
"bytes": "370"
}
],
"symlink_target": ""
} |
// Copyright (c) 2011-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
#define BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
#include <qt/sendcoinsrecipient.h>
#include <QAbstractTableModel>
#include <QStringList>
#include <QDateTime>
class WalletModel;
class RecentRequestEntry
{
public:
RecentRequestEntry() : nVersion(RecentRequestEntry::CURRENT_VERSION), id(0) { }
static const int CURRENT_VERSION = 1;
int nVersion;
int64_t id;
QDateTime date;
SendCoinsRecipient recipient;
SERIALIZE_METHODS(RecentRequestEntry, obj) {
unsigned int date_timet;
SER_WRITE(obj, date_timet = obj.date.toTime_t());
READWRITE(obj.nVersion, obj.id, date_timet, obj.recipient);
SER_READ(obj, obj.date = QDateTime::fromTime_t(date_timet));
}
};
class RecentRequestEntryLessThan
{
public:
RecentRequestEntryLessThan(int nColumn, Qt::SortOrder fOrder):
column(nColumn), order(fOrder) {}
bool operator()(const RecentRequestEntry& left, const RecentRequestEntry& right) const;
private:
int column;
Qt::SortOrder order;
};
/** Model for list of recently generated payment requests / bitcoin: URIs.
* Part of wallet model.
*/
class RecentRequestsTableModel: public QAbstractTableModel
{
Q_OBJECT
public:
explicit RecentRequestsTableModel(WalletModel *parent);
~RecentRequestsTableModel();
enum ColumnIndex {
Date = 0,
Label = 1,
Message = 2,
Amount = 3,
NUMBER_OF_COLUMNS
};
/** @name Methods overridden from QAbstractTableModel
@{*/
int rowCount(const QModelIndex &parent) const override;
int columnCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
/*@}*/
const RecentRequestEntry &entry(int row) const { return list[row]; }
void addNewRequest(const SendCoinsRecipient &recipient);
void addNewRequest(const std::string &recipient);
void addNewRequest(RecentRequestEntry &recipient);
public Q_SLOTS:
void updateDisplayUnit();
private:
WalletModel *walletModel;
QStringList columns;
QList<RecentRequestEntry> list;
int64_t nReceiveRequestsMaxId{0};
/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
void updateAmountColumnTitle();
/** Gets title for amount column including current display unit if optionsModel reference available. */
QString getAmountTitle();
};
#endif // BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
| {
"content_hash": "92735349c876885a6592d59be4d14b3e",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 126,
"avg_line_length": 32.81818181818182,
"alnum_prop": 0.7223761157279163,
"repo_name": "midnightmagic/bitcoin",
"id": "c0bd3461bb4108647a42e756f7a7e60d9c9ba616",
"size": "3249",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "src/qt/recentrequeststablemodel.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "534165"
},
{
"name": "C++",
"bytes": "3705952"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Groff",
"bytes": "19797"
},
{
"name": "HTML",
"bytes": "50621"
},
{
"name": "Java",
"bytes": "2100"
},
{
"name": "Makefile",
"bytes": "65360"
},
{
"name": "Objective-C",
"bytes": "2022"
},
{
"name": "Objective-C++",
"bytes": "7238"
},
{
"name": "Protocol Buffer",
"bytes": "2308"
},
{
"name": "Python",
"bytes": "447889"
},
{
"name": "QMake",
"bytes": "2019"
},
{
"name": "Shell",
"bytes": "40702"
}
],
"symlink_target": ""
} |
Ti=Impact
1.sec=Rapid legal codification.
2.sec=Improved speed, transparency and certainty in business dealings.
3.sec=Greater access to justice, rule of law and self-governance.
4.sec=Greater transparency of institutions.
5.sec=Improved outcomes for social objectives such as privacy, health, climate and decentralization.
=[G/Z/ol/s5] | {
"content_hash": "4937989331a7831d31c2a5b31358efd7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 100,
"avg_line_length": 26.46153846153846,
"alnum_prop": 0.7906976744186046,
"repo_name": "CommonAccord/Cmacc-Org",
"id": "2f7c0d502fab42bcf9e7058815b1a2840d0088f0",
"size": "344",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Doc/S/About/CDL/Impact_0.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4996"
},
{
"name": "HTML",
"bytes": "130299"
},
{
"name": "PHP",
"bytes": "1463"
}
],
"symlink_target": ""
} |
namespace app { namespace Fuse { namespace Controls { struct Switch; } } }
namespace app { namespace Fuse { namespace Elements { struct Element; } } }
namespace app { namespace Fuse { namespace Gestures { struct Clicker; } } }
namespace app { namespace Fuse { namespace Input { struct PointerMovedArgs; } } }
namespace app { namespace Fuse { namespace Input { struct PointerPressedArgs; } } }
namespace app { namespace Fuse { namespace Input { struct PointerReleasedArgs; } } }
namespace app { namespace Fuse { struct Node; } }
namespace app { namespace Fuse { struct PlacedArgs; } }
namespace app { namespace Uno { namespace UX { struct ValueChangedArgs__bool; } } }
namespace app {
namespace Fuse {
namespace Controls {
struct DefaultSwitchBehavior;
struct DefaultSwitchBehavior__uType : ::app::Fuse::Triggers::Trigger__uType
{
};
DefaultSwitchBehavior__uType* DefaultSwitchBehavior__typeof();
void DefaultSwitchBehavior___ObjInit_2(DefaultSwitchBehavior* __this);
::app::Fuse::Elements::Element* DefaultSwitchBehavior__get_Bounds(DefaultSwitchBehavior* __this);
::app::Uno::Float2 DefaultSwitchBehavior__get_Size(DefaultSwitchBehavior* __this);
DefaultSwitchBehavior* DefaultSwitchBehavior__New_1(::uStatic* __this);
void DefaultSwitchBehavior__OnCaptureLost(DefaultSwitchBehavior* __this);
void DefaultSwitchBehavior__OnPlaced(DefaultSwitchBehavior* __this, ::uObject* sender, ::app::Fuse::PlacedArgs* args);
void DefaultSwitchBehavior__OnPointerMoved(DefaultSwitchBehavior* __this, ::uObject* sender, ::app::Fuse::Input::PointerMovedArgs* args);
void DefaultSwitchBehavior__OnPointerPressed(DefaultSwitchBehavior* __this, ::uObject* sender, ::app::Fuse::Input::PointerPressedArgs* args);
void DefaultSwitchBehavior__OnPointerReleased(DefaultSwitchBehavior* __this, ::uObject* sender, ::app::Fuse::Input::PointerReleasedArgs* args);
void DefaultSwitchBehavior__OnPointerTapped(DefaultSwitchBehavior* __this, ::uObject* a, int tapCount);
void DefaultSwitchBehavior__OnRooted(DefaultSwitchBehavior* __this, ::app::Fuse::Node* elm);
void DefaultSwitchBehavior__OnUnrooted(DefaultSwitchBehavior* __this, ::app::Fuse::Node* elm);
void DefaultSwitchBehavior__OnValueChanged(DefaultSwitchBehavior* __this, ::uObject* sender, ::app::Uno::UX::ValueChangedArgs__bool* args);
bool DefaultSwitchBehavior__ReleaseCapture(DefaultSwitchBehavior* __this);
void DefaultSwitchBehavior__set_Bounds(DefaultSwitchBehavior* __this, ::app::Fuse::Elements::Element* value);
struct DefaultSwitchBehavior : ::app::Fuse::Triggers::Trigger
{
::uStrong< ::app::Fuse::Controls::Switch*> _switch;
::uStrong< ::app::Fuse::Elements::Element*> _bounds;
::uStrong< ::app::Fuse::Gestures::Clicker*> _clicker;
::app::Uno::Float2 _prevCoord;
::app::Uno::Float2 _currentCoord;
::app::Uno::Float2 _originalP;
bool _captured;
int _capturedIndex;
void _ObjInit_2() { DefaultSwitchBehavior___ObjInit_2(this); }
::app::Fuse::Elements::Element* Bounds() { return DefaultSwitchBehavior__get_Bounds(this); }
::app::Uno::Float2 Size() { return DefaultSwitchBehavior__get_Size(this); }
void OnCaptureLost() { DefaultSwitchBehavior__OnCaptureLost(this); }
void OnPlaced(::uObject* sender, ::app::Fuse::PlacedArgs* args) { DefaultSwitchBehavior__OnPlaced(this, sender, args); }
void OnPointerMoved(::uObject* sender, ::app::Fuse::Input::PointerMovedArgs* args) { DefaultSwitchBehavior__OnPointerMoved(this, sender, args); }
void OnPointerPressed(::uObject* sender, ::app::Fuse::Input::PointerPressedArgs* args) { DefaultSwitchBehavior__OnPointerPressed(this, sender, args); }
void OnPointerReleased(::uObject* sender, ::app::Fuse::Input::PointerReleasedArgs* args) { DefaultSwitchBehavior__OnPointerReleased(this, sender, args); }
void OnPointerTapped(::uObject* a, int tapCount) { DefaultSwitchBehavior__OnPointerTapped(this, a, tapCount); }
void OnValueChanged(::uObject* sender, ::app::Uno::UX::ValueChangedArgs__bool* args) { DefaultSwitchBehavior__OnValueChanged(this, sender, args); }
bool ReleaseCapture() { return DefaultSwitchBehavior__ReleaseCapture(this); }
void Bounds(::app::Fuse::Elements::Element* value) { DefaultSwitchBehavior__set_Bounds(this, value); }
};
}}}
#endif
| {
"content_hash": "bd28121131438dbe0d10ae828f5a2bc5",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 158,
"avg_line_length": 63.11940298507463,
"alnum_prop": 0.7474580279025774,
"repo_name": "blyk/BlackCode-Fuse",
"id": "bc020523668dcb27b2f3c16e33531f0465279720",
"size": "4596",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AndroidUI/.build/Simulator/Android/include/app/Fuse.Controls.DefaultSwitchBehavior.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "31111"
},
{
"name": "C",
"bytes": "22885804"
},
{
"name": "C++",
"bytes": "197750292"
},
{
"name": "Java",
"bytes": "951083"
},
{
"name": "JavaScript",
"bytes": "578555"
},
{
"name": "Logos",
"bytes": "48297"
},
{
"name": "Makefile",
"bytes": "6592573"
},
{
"name": "Shell",
"bytes": "19985"
}
],
"symlink_target": ""
} |
package org.bdgenomics.convert.htsjdk;
import java.util.ArrayList;
import java.util.List;
import htsjdk.variant.vcf.VCFHeader;
import htsjdk.variant.vcf.VCFHeaderLine;
import org.bdgenomics.convert.AbstractConverter;
import org.bdgenomics.convert.ConversionException;
import org.bdgenomics.convert.ConversionStringency;
import org.slf4j.Logger;
/**
* Convert a VCFHeader to a list of VCFHeaderLines.
*/
public final class VcfHeaderToVcfHeaderLines extends AbstractConverter<VCFHeader, List<VCFHeaderLine>> {
/**
* Create a new VCFHeader to a list of VCFHeaderLines converter.
*/
public VcfHeaderToVcfHeaderLines() {
super(VCFHeader.class, VCFHeaderLine.class);
}
@Override
public List<VCFHeaderLine> convert(final VCFHeader header,
final ConversionStringency stringency,
final Logger logger) throws ConversionException {
if (header == null) {
warnOrThrow(header, "must not be null", null, stringency, logger);
return null;
}
List<VCFHeaderLine> headerLines = new ArrayList<VCFHeaderLine>();
headerLines.addAll(header.getFilterLines());
headerLines.addAll(header.getFormatHeaderLines());
headerLines.addAll(header.getInfoHeaderLines());
headerLines.addAll(header.getOtherHeaderLines());
return headerLines;
}
}
| {
"content_hash": "aa3b0f04cc2ffb4eeab7bd042751f3e0",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 104,
"avg_line_length": 31.108695652173914,
"alnum_prop": 0.6876310272536688,
"repo_name": "heuermh/bdg-convert",
"id": "66a5037b005a91dc1dac1e4e2a328e6e1109da08",
"size": "2224",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "convert-htsjdk/src/main/java/org/bdgenomics/convert/htsjdk/VcfHeaderToVcfHeaderLines.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "273074"
}
],
"symlink_target": ""
} |
@implementation KirinArgsTest
- (void) testArgs {
STAssertEqualObjects(@"", [KirinArgs args: nil], @"No args");
NSString* args1 = [KirinArgs args: @"1", nil];
STAssertEqualObjects(@"1", args1, @"One arg");
NSString* args2 = [KirinArgs args: @"1", @"2", nil];
STAssertEqualObjects(@"1, 2", args2, @"Two args");
NSString* args3 = [KirinArgs args: @"1", @"2", @"3", nil];
STAssertEqualObjects(@"1, 2, 3", args3, @"Three args");
}
@end
| {
"content_hash": "199fd61023e9fbe93de8aa9be47107d8",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 65,
"avg_line_length": 23.142857142857142,
"alnum_prop": 0.5761316872427984,
"repo_name": "KirinJS/Kirin",
"id": "95df42a75845796ec6e90456f10b865408b4a696",
"size": "693",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "platforms/ios/KirinKit/KirinKitTests/KirinArgsTest.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "227046"
},
{
"name": "JavaScript",
"bytes": "253930"
},
{
"name": "Objective-C",
"bytes": "370679"
},
{
"name": "Shell",
"bytes": "428"
}
],
"symlink_target": ""
} |
module HeapHop
class HeapFileParser
include Enumerable
HeapObject = Struct.new \
:address, :generation, :references, :obj_type, :class_address,
:file, :line, :method, :memsize, :flags, :info
attr_reader :filename
# Create a new HeapFileParser that can be used to parse the given heap file.
#
# filename - The name of the Ruby heap file
#
# Raises RuntimeError if the Ruby heap file cannot be found.
def initialize( filename )
unless File.file? filename
raise RuntimeError, "Could not find the heap file: #{filename.inspect}"
end
@filename = filename
@address = 0
end
#
#
def each
return enum_for :each unless block_given?
@address = 0
File.open(filename, "r") do |fd|
fd.each_line do |line|
yield parse_line(line)
end
end
self
end
# Internal: Given a single line from a Ruby heap dump, parse that line of
# information and return a HeapObject struct.
#
# line - A Ruby heap line as a String.
#
# Returns a HeapObject.
def parse_line( line )
hash = MultiJson.load line
address = hash.delete("address") || next_address
generation = hash.delete("generation") || 0
references = hash.delete("references")
obj_type = hash.delete("type")
class_address = hash.delete("class")
file = hash.delete("file")
line = hash.delete("line")
method = hash.delete("method")
memsize = hash["memsize"] || hash["bytesize"]
flags = hash.delete("flags")
address = convert_address(address)
class_address = convert_address(class_address)
references.map! { |reference| convert_address(reference) } if references
HeapObject.new \
address, generation, references, obj_type, class_address,
file, line, method, memsize, flags, hash
end
# Internal: Convert a memory address to an Integer value.
#
# Returns an Integer or `nil`
def convert_address( address )
return address if address.nil? || address.is_a?(Integer)
address.to_i(16)
end
# Internal: Returns the next pseudo-memory address. This is used for heap
# objects that do not have a memory addres - the VM root is one of these.
def next_address
current_address, @address = @address, @address+1
return current_address
end
end
end
| {
"content_hash": "181e95523b2b59ee73e5b32d146a65d1",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 80,
"avg_line_length": 29.93975903614458,
"alnum_prop": 0.613682092555332,
"repo_name": "TwP/heap_hop",
"id": "fff02ae5b83d3f85943773295b805ee1a9c0f700",
"size": "2485",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/heap_hop/heap_file_parser.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "54"
},
{
"name": "HTML",
"bytes": "1850"
},
{
"name": "Ruby",
"bytes": "23853"
},
{
"name": "Shell",
"bytes": "348"
}
],
"symlink_target": ""
} |
/**
* @author anton.
*/
package ru.aserdyuchenko.iterator.task5_1_2; | {
"content_hash": "74e52612394d5afadf20275922ce2695",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 44,
"avg_line_length": 17.5,
"alnum_prop": 0.6857142857142857,
"repo_name": "anton415/Job4j",
"id": "cdb1dd2724b8750caedcbb529d48982b2283ffb3",
"size": "70",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Junior/Part_1_Collections_Pro/src/test/java/ru/aserdyuchenko/iterator/task5_1_2/package-info.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "21252"
},
{
"name": "Java",
"bytes": "393706"
}
],
"symlink_target": ""
} |
/**
* File: Tank.java
* @author Xu,Runbo and Zurn,Andrew
* @version Jan. 19, 2011
*/
package tank;
/**
* Tank is an interface for objects that represent a container
*/
public interface Tank
{
/**
* this constructor will check whether the tank is empty and return the result as a boolean
* @return true if the tank is empty; false if the tank is not empty.
*/
public boolean isEmpty();
/**
* this constructor will check whether the tank is full and return the result as a boolean
* @return true if the tank is full; false if the tank is not full.
*/
public boolean isFull();
/**
* this constructor will return the capacity of the tank as a double
* @return the value of tank's capacity
*/
public double getCapacity();
/**
* this constructor will return the level of the tank as a double
* @rturn the value of tank's level
*/
public double getLevel();
/**
* this constructor receive a parameter amount and add the amount to the tank
* @param amount the amount that should be added to the tank
*/
public void add(double amount);
/**
* this constructor receive a parameter amount and remove amount from tank
* @param amount the amount that should be removed from the tank
*/
public void remove(double amount);
}
| {
"content_hash": "a286de4be35dfeccc1ea043898002a79",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 93,
"avg_line_length": 25.745098039215687,
"alnum_prop": 0.6778370144706778,
"repo_name": "AndrewZurn/sju-compsci-archive",
"id": "37bac1b0b503d36dfc162e11188e4c654c0d026b",
"size": "1313",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CS100s/CS162/Lab/Lab01/Tank.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "18272"
},
{
"name": "Bison",
"bytes": "278"
},
{
"name": "C",
"bytes": "151324"
},
{
"name": "C++",
"bytes": "587"
},
{
"name": "CSS",
"bytes": "19503"
},
{
"name": "Haskell",
"bytes": "13675"
},
{
"name": "Java",
"bytes": "5735261"
},
{
"name": "JavaScript",
"bytes": "274"
},
{
"name": "Makefile",
"bytes": "3010"
},
{
"name": "Mathematica",
"bytes": "53105"
},
{
"name": "Perl",
"bytes": "7350"
},
{
"name": "Shell",
"bytes": "1010"
},
{
"name": "TeX",
"bytes": "197561"
}
],
"symlink_target": ""
} |
package org.apache.flink.streaming.runtime.io;
import org.apache.flink.annotation.Internal;
import org.apache.flink.core.io.InputStatus;
import org.apache.flink.runtime.io.AvailabilityProvider;
import org.apache.flink.runtime.io.PullingAsyncDataInput;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.LatencyMarker;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.streamstatus.StreamStatus;
/**
* The variant of {@link PullingAsyncDataInput} that is defined for handling both network
* input and source input in a unified way via {@link #emitNext(DataOutput)} instead
* of returning {@code Optional.empty()} via {@link PullingAsyncDataInput#pollNext()}.
*/
@Internal
public interface PushingAsyncDataInput<T> extends AvailabilityProvider {
/**
* Pushes the next element to the output from current data input, and returns
* the input status to indicate whether there are more available data in
* current input.
*
* <p>This method should be non blocking.
*/
InputStatus emitNext(DataOutput<T> output) throws Exception;
/**
* Basic data output interface used in emitting the next element from data input.
*
* @param <T> The type encapsulated with the stream record.
*/
interface DataOutput<T> {
void emitRecord(StreamRecord<T> streamRecord) throws Exception;
void emitWatermark(Watermark watermark) throws Exception;
void emitStreamStatus(StreamStatus streamStatus) throws Exception;
void emitLatencyMarker(LatencyMarker latencyMarker) throws Exception;
}
}
| {
"content_hash": "4a7ec4e851a0849f2380cdf630b7d55e",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 89,
"avg_line_length": 35.43478260869565,
"alnum_prop": 0.7865030674846626,
"repo_name": "sunjincheng121/flink",
"id": "a0193a64ba24691a629198ec4d50d292736ada4f",
"size": "2430",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/PushingAsyncDataInput.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4588"
},
{
"name": "CSS",
"bytes": "57936"
},
{
"name": "Clojure",
"bytes": "93205"
},
{
"name": "Dockerfile",
"bytes": "10793"
},
{
"name": "FreeMarker",
"bytes": "17422"
},
{
"name": "HTML",
"bytes": "224462"
},
{
"name": "Java",
"bytes": "48828103"
},
{
"name": "JavaScript",
"bytes": "1829"
},
{
"name": "Makefile",
"bytes": "5134"
},
{
"name": "Python",
"bytes": "809916"
},
{
"name": "Scala",
"bytes": "13394897"
},
{
"name": "Shell",
"bytes": "483872"
},
{
"name": "TypeScript",
"bytes": "243702"
}
],
"symlink_target": ""
} |
"""
Featurizes proposed binding pockets.
"""
from __future__ import division
from __future__ import unicode_literals
__author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2017, Stanford University"
__license__ = "MIT"
import numpy as np
from deepchem.utils.save import log
from deepchem.feat import Featurizer
class BindingPocketFeaturizer(Featurizer):
"""
Featurizes binding pockets with information about chemical environments.
"""
residues = [
"ALA", "ARG", "ASN", "ASP", "CYS", "GLN", "GLU", "GLY", "HIS", "ILE",
"LEU", "LYS", "MET", "PHE", "PRO", "PYL", "SER", "SEC", "THR", "TRP",
"TYR", "VAL", "ASX", "GLX"
]
n_features = len(residues)
def featurize(self,
protein_file,
pockets,
pocket_atoms_map,
pocket_coords,
verbose=False):
"""
Calculate atomic coodinates.
"""
import mdtraj
protein = mdtraj.load(protein_file)
n_pockets = len(pockets)
n_residues = len(BindingPocketFeaturizer.residues)
res_map = dict(zip(BindingPocketFeaturizer.residues, range(n_residues)))
all_features = np.zeros((n_pockets, n_residues))
for pocket_num, (pocket, coords) in enumerate(zip(pockets, pocket_coords)):
pocket_atoms = pocket_atoms_map[pocket]
for ind, atom in enumerate(pocket_atoms):
atom_name = str(protein.top.atom(atom))
# atom_name is of format RESX-ATOMTYPE
# where X is a 1 to 4 digit number
residue = atom_name[:3]
if residue not in res_map:
log("Warning: Non-standard residue in PDB file", verbose)
continue
atomtype = atom_name.split("-")[1]
all_features[pocket_num, res_map[residue]] += 1
return all_features
| {
"content_hash": "8dbb5992ef42a4ed04a77372550ea921",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 31.607142857142858,
"alnum_prop": 0.6175141242937853,
"repo_name": "Agent007/deepchem",
"id": "bf26d0e76a73f84a5208746d56818c147ce2df34",
"size": "1770",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "deepchem/feat/binding_pocket_features.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "16453"
},
{
"name": "HTML",
"bytes": "20618"
},
{
"name": "Jupyter Notebook",
"bytes": "59756"
},
{
"name": "Python",
"bytes": "2129306"
},
{
"name": "Shell",
"bytes": "11976"
}
],
"symlink_target": ""
} |
<?php
namespace PivotalTracker\Exception;
/**
* InvalidArgumentException.
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}
| {
"content_hash": "69e24842992d9f59cd4c1a2d5a1dce8f",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 94,
"avg_line_length": 19.166666666666668,
"alnum_prop": 0.7913043478260869,
"repo_name": "bariton3/php-pivotal-tracker-api",
"id": "d59e7919d072c57781cb82e117956dc6d3863ab1",
"size": "230",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/PivotalTracker/Exception/InvalidArgumentException.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "61587"
}
],
"symlink_target": ""
} |
'use strict';
var util = require('util');
var path = require('path');
var fs = require('fs');
var yeoman = require('yeoman-generator');
var yosay = require('yosay');
var chalk = require('chalk');
function checkForCanvasError() {
fs.stat('node_modules/grunt-reduce/node_modules/assetgraph-builder/node_modules/histogram', function (err, stat) {
if (!err) {
return;
}
var os = require('os');
var EOL = os.EOL;
var command = 'Run: _';
var platformCommand = '';
var then = 'npm install -f grunt-reduce';
if (process.platform === 'linux') {
platformCommand = 'sudo apt-get install -y libcairo2-dev libjpeg8-dev libgif-dev libpango1.0-dev';
} else if (process.platform === 'darwin') {
platformCommand = 'brew install cairo jpeg giflib pango';
}
if (process.platform.indexOf('win') === 0) {
command = 'Visit ' + chalk.cyan('https://github.com/Automattic/node-canvas/wiki/Installation---Windows') + ' for installation instructions';
} else {
command = command.replace('_', chalk.cyan(platformCommand));
}
console.log(yosay(
chalk.yellow('UH OH!') + ' Looks like the installation of canvas failed.' + EOL +
'Canvas is used for image optimization and spriting.'
));
console.log('To fix this problem: ' + command + ', then ' + chalk.cyan(then));
});
}
var GreenfieldGenerator = module.exports = function GreenfieldGenerator(args, options, config) {
yeoman.generators.Base.apply(this, arguments);
this.on('end', function () {
this.installDependencies({
bower: !this.options['skip-install'],
npm: !this.options['skip-install'],
skipInstall: this.options['skip-install'],
skipMessage: !this.options['skip-install'],
callback: checkForCanvasError
});
});
this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
};
util.inherits(GreenfieldGenerator, yeoman.generators.Base);
GreenfieldGenerator.prototype.askFor = function askFor() {
var cb = this.async();
// have Yeoman greet the user.
//console.log(this.yeoman);
var prompts = [{
type: 'list',
name: 'CSS',
message: 'What flavor CSS do you like??',
choices: [
'CSS',
'Scss',
'Less'
],
default: 'CSS'
}];
this.prompt(prompts, function (props) {
this.cssPreProcessor = props.CSS;
this.cssExtension = this.cssPreProcessor.toLowerCase();
cb();
}.bind(this));
};
GreenfieldGenerator.prototype.gruntfile = function gruntfile() {
this.template('Gruntfile.js');
};
GreenfieldGenerator.prototype.app = function app() {
this.mkdir('app');
this.mkdir('app/styles');
this.mkdir('app/scripts');
this.mkdir('app/images');
this.template('_package.json', 'package.json');
this.copy('_bower.json', 'bower.json');
};
GreenfieldGenerator.prototype.projectfiles = function projectfiles() {
this.copy('editorconfig', '.editorconfig');
this.copy('jshintrc', '.jshintrc');
this.copy('jshintignore', '.jshintignore');
this.copy('bowerrc', '.bowerrc');
this.copy('gitignore', '.gitignore');
};
GreenfieldGenerator.prototype.html5bp = function projectfiles() {
this.copy('app/404.html', 'app/404.html');
this.copy('app/favicon.ico', 'app/favicon.ico');
this.copy('app/robots.txt', 'app/robots.txt');
this.copy('app/.htaccess', 'app/.htaccess');
this.copy('app/styles/main.css', 'app/styles/main.' + this.cssExtension);
this.copy('app/scripts/main.js', 'app/scripts/main.js');
};
GreenfieldGenerator.prototype.writeIndex = function writeIndex() {
this.indexFile = this.readFileAsString(path.join(this.sourceRoot(), 'app/index.html'));
this.indexFile = this.engine(this.indexFile, this);
this.write('app/index.html', this.indexFile);
};
| {
"content_hash": "99433b65f524c15afb21965de99ffe6d",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 152,
"avg_line_length": 31.5390625,
"alnum_prop": 0.6162992321030468,
"repo_name": "Munter/generator-greenfield",
"id": "337d97bd429c34d496c24d88e7e0def01a875c7d",
"size": "4037",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "CSS",
"bytes": "503"
},
{
"name": "HTML",
"bytes": "6249"
},
{
"name": "JavaScript",
"bytes": "8022"
}
],
"symlink_target": ""
} |
package com.smartdevicelink.proxy.rpc;
import android.support.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.DefrostZone;
import com.smartdevicelink.proxy.rpc.enums.VentilationMode;
import java.util.Hashtable;
import java.util.List;
/**
* Contains information about a climate control module's capabilities.
*/
public class ClimateControlCapabilities extends RPCStruct{
public static final String KEY_MODULE_NAME= "moduleName";
public static final String KEY_FAN_SPEED_AVAILABLE= "fanSpeedAvailable";
public static final String KEY_DESIRED_TEMPERATURE_AVAILABLE= "desiredTemperatureAvailable";
public static final String KEY_AC_ENABLE_AVAILABLE= "acEnableAvailable";
public static final String KEY_AC_MAX_ENABLE_AVAILABLE= "acMaxEnableAvailable";
public static final String KEY_CIRCULATE_AIR_ENABLE_AVAILABLE= "circulateAirEnableAvailable";
public static final String KEY_AUTO_MODE_ENABLE_AVAILABLE= "autoModeEnableAvailable";
public static final String KEY_DUAL_MODE_ENABLE_AVAILABLE= "dualModeEnableAvailable";
public static final String KEY_DEFROST_ZONE_AVAILABLE= "defrostZoneAvailable";
public static final String KEY_DEFROST_ZONE= "defrostZone";
public static final String KEY_VENTILATION_MODE_AVAILABLE= "ventilationModeAvailable";
public static final String KEY_VENTILATION_MODE= "ventilationMode";
public static final String KEY_HEATED_STEERING_WHEEL_AVAILABLE = "heatedSteeringWheelAvailable";
public static final String KEY_HEATED_WIND_SHIELD_AVAILABLE = "heatedWindshieldAvailable";
public static final String KEY_HEATED_REAR_WINDOW_AVAILABLE = "heatedRearWindowAvailable";
public static final String KEY_HEATED_MIRRORS_AVAILABLE = "heatedMirrorsAvailable";
public ClimateControlCapabilities() {
}
public ClimateControlCapabilities(Hashtable<String, Object> hash) {
super(hash);
}
/**
* Constructs a newly allocated ClimateControlCapabilities
*
* @param moduleName The short friendly name of the climate control module. It should not be used to identify a module by mobile application.
*/
public ClimateControlCapabilities(@NonNull String moduleName) {
this();
setModuleName(moduleName);
}
/**
* Sets the moduleName portion of the ClimateControlCapabilities class
*
* @param moduleName The short friendly name of the climate control module. It should not be used to identify a module by mobile application.
*/
public void setModuleName(@NonNull String moduleName) {
setValue(KEY_MODULE_NAME, moduleName);
}
/**
* Gets the moduleName portion of the ClimateControlCapabilities class
*
* @return String - Short friendly name of the climate control module.
*/
public String getModuleName() {
return getString(KEY_MODULE_NAME);
}
/**
* Sets the fanSpeedAvailable portion of the ClimateControlCapabilities class
*
* @param fanSpeedAvailable
* Availability of the control of fan speed.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setFanSpeedAvailable(Boolean fanSpeedAvailable) {
setValue(KEY_FAN_SPEED_AVAILABLE, fanSpeedAvailable);
}
/**
* Gets the fanSpeedAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control of fan speed.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getFanSpeedAvailable() {
return getBoolean(KEY_FAN_SPEED_AVAILABLE);
}
/**
* Sets the desiredTemperatureAvailable portion of the ClimateControlCapabilities class
*
* @param desiredTemperatureAvailable
* Availability of the control of desired temperature.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setDesiredTemperatureAvailable(Boolean desiredTemperatureAvailable) {
setValue(KEY_DESIRED_TEMPERATURE_AVAILABLE, desiredTemperatureAvailable);
}
/**
* Gets the desiredTemperatureAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control of desired temperature.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getDesiredTemperatureAvailable() {
return getBoolean(KEY_DESIRED_TEMPERATURE_AVAILABLE);
}
/**
* Sets the acEnableAvailable portion of the ClimateControlCapabilities class
*
* @param acEnableAvailable
* Availability of the control of turn on/off AC.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setAcEnableAvailable(Boolean acEnableAvailable) {
setValue(KEY_AC_ENABLE_AVAILABLE, acEnableAvailable);
}
/**
* Gets the acEnableAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control of turn on/off AC.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getAcEnableAvailable() {
return getBoolean(KEY_AC_ENABLE_AVAILABLE);
}
/**
* Sets the acMaxEnableAvailable portion of the ClimateControlCapabilities class
*
* @param acMaxEnableAvailable
* Availability of the control of enable/disable air conditioning is ON on the maximum level.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setAcMaxEnableAvailable(Boolean acMaxEnableAvailable) {
setValue(KEY_AC_MAX_ENABLE_AVAILABLE, acMaxEnableAvailable);
}
/**
* Gets the acMaxEnableAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control of enable/disable air conditioning is ON on the maximum level.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getAcMaxEnableAvailable() {
return getBoolean(KEY_AC_MAX_ENABLE_AVAILABLE);
}
/**
* Sets the circulateAirEnableAvailable portion of the ClimateControlCapabilities class
*
* @param circulateAirEnableAvailable
* Availability of the control of enable/disable circulate Air mode.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setCirculateAirEnableAvailable(Boolean circulateAirEnableAvailable) {
setValue(KEY_CIRCULATE_AIR_ENABLE_AVAILABLE, circulateAirEnableAvailable);
}
/**
* Gets the circulateAirEnableAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control of enable/disable circulate Air mode.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getCirculateAirEnableAvailable() {
return getBoolean(KEY_CIRCULATE_AIR_ENABLE_AVAILABLE);
}
/**
* Sets the autoModeEnableAvailable portion of the ClimateControlCapabilities class
*
* @param autoModeEnableAvailable
* Availability of the control of enable/disable auto mode.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setAutoModeEnableAvailable(Boolean autoModeEnableAvailable) {
setValue(KEY_AUTO_MODE_ENABLE_AVAILABLE, autoModeEnableAvailable);
}
/**
* Gets the autoModeEnableAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control of enable/disable auto mode.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getAutoModeEnableAvailable() {
return getBoolean(KEY_AUTO_MODE_ENABLE_AVAILABLE);
}
/**
* Sets the dualModeEnableAvailable portion of the ClimateControlCapabilities class
*
* @param dualModeEnableAvailable
* Availability of the control of enable/disable dual mode.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setDualModeEnableAvailable(Boolean dualModeEnableAvailable) {
setValue(KEY_DUAL_MODE_ENABLE_AVAILABLE, dualModeEnableAvailable);
}
/**
* Gets the dualModeEnableAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control of enable/disable dual mode.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getDualModeEnableAvailable() {
return getBoolean(KEY_DUAL_MODE_ENABLE_AVAILABLE);
}
/**
* Sets the defrostZoneAvailable portion of the ClimateControlCapabilities class
*
* @param defrostZoneAvailable
* Availability of the control of defrost zones.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setDefrostZoneAvailable(Boolean defrostZoneAvailable) {
setValue(KEY_DEFROST_ZONE_AVAILABLE, defrostZoneAvailable);
}
/**
* Gets the defrostZoneAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control of defrost zones.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getDefrostZoneAvailable() {
return getBoolean(KEY_DEFROST_ZONE_AVAILABLE);
}
/**
* Gets the List<DefrostZone> portion of the ClimateControlCapabilities class
*
* @return List<DefrostZone> - A set of all defrost zones that are controllable.
*/
public List<DefrostZone> getDefrostZone() {
return (List<DefrostZone>) getObject(DefrostZone.class, KEY_DEFROST_ZONE);
}
/**
* Sets the defrostZone portion of the ClimateControlCapabilities class
*
* @param defrostZone
* A set of all defrost zones that are controllable.
*/
public void setDefrostZone(List<DefrostZone> defrostZone) {
setValue(KEY_DEFROST_ZONE, defrostZone);
}
/**
* Sets the ventilationModeAvailable portion of the ClimateControlCapabilities class
*
* @param ventilationModeAvailable
* Availability of the control of air ventilation mode.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setVentilationModeAvailable(Boolean ventilationModeAvailable) {
setValue(KEY_VENTILATION_MODE_AVAILABLE, ventilationModeAvailable);
}
/**
* Gets the ventilationModeAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control of air ventilation mode.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getVentilationModeAvailable() {
return getBoolean(KEY_VENTILATION_MODE_AVAILABLE);
}
/**
* Gets the List<VentilationMode> portion of the ClimateControlCapabilities class
*
* @return List<VentilationMode> - A set of all ventilation modes that are controllable.
*/
public List<VentilationMode> getVentilationMode() {
return (List<VentilationMode>) getObject(VentilationMode.class, KEY_VENTILATION_MODE);
}
/**
* Sets the ventilationMode portion of the ClimateControlCapabilities class
*
* @param ventilationMode
* A set of all ventilation modes that are controllable.
*/
public void setVentilationMode(List<VentilationMode> ventilationMode) {
setValue(KEY_VENTILATION_MODE, ventilationMode);
}
/**
* Sets the heatedSteeringWheelAvailable portion of the ClimateControlCapabilities class
*
* @param heatedSteeringWheelAvailable Availability of the control (enable/disable) of heated Steering Wheel.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setHeatedSteeringWheelAvailable(Boolean heatedSteeringWheelAvailable) {
setValue(KEY_HEATED_STEERING_WHEEL_AVAILABLE, heatedSteeringWheelAvailable);
}
/**
* Gets the heatedSteeringWheelAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control (enable/disable) of heated Steering Wheel.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getHeatedSteeringWheelAvailable() {
return getBoolean(KEY_HEATED_STEERING_WHEEL_AVAILABLE);
}
/**
* Sets the heatedWindshieldAvailable portion of the ClimateControlCapabilities class
*
* @param heatedWindshieldAvailable Availability of the control (enable/disable) of heated Windshield.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setHeatedWindshieldAvailable(Boolean heatedWindshieldAvailable) {
setValue(KEY_HEATED_WIND_SHIELD_AVAILABLE, heatedWindshieldAvailable);
}
/**
* Gets the heatedWindshieldAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control (enable/disable) of heated Windshield.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getHeatedWindshieldAvailable() {
return getBoolean(KEY_HEATED_WIND_SHIELD_AVAILABLE);
}
/**
* Sets the heatedRearWindowAvailable portion of the ClimateControlCapabilities class
*
* @param heatedRearWindowAvailable Availability of the control (enable/disable) of heated Rear Window.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setHeatedRearWindowAvailable(Boolean heatedRearWindowAvailable) {
setValue(KEY_HEATED_REAR_WINDOW_AVAILABLE, heatedRearWindowAvailable);
}
/**
* Gets the heatedRearWindowAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control (enable/disable) of heated Rear Window.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getHeatedRearWindowAvailable() {
return getBoolean(KEY_HEATED_REAR_WINDOW_AVAILABLE);
}
/**
* Sets the heatedMirrorsAvailable portion of the ClimateControlCapabilities class
*
* @param heatedMirrorsAvailable Availability of the control (enable/disable) of heated Mirrors.
* True: Available, False: Not Available, Not present: Not Available.
*/
public void setHeatedMirrorsAvailable(Boolean heatedMirrorsAvailable) {
setValue(KEY_HEATED_MIRRORS_AVAILABLE, heatedMirrorsAvailable);
}
/**
* Gets the heatedMirrorsAvailable portion of the ClimateControlCapabilities class
*
* @return Boolean - Availability of the control (enable/disable) of heated Mirrors.
* True: Available, False: Not Available, Not present: Not Available.
*/
public Boolean getHeatedMirrorsAvailable() {
return getBoolean(KEY_HEATED_MIRRORS_AVAILABLE);
}
}
| {
"content_hash": "cb53e4dcca1fd94e3d2dbdbdbed574bd",
"timestamp": "",
"source": "github",
"line_count": 376,
"max_line_length": 145,
"avg_line_length": 40.42553191489362,
"alnum_prop": 0.7117763157894736,
"repo_name": "anildahiya/sdl_android",
"id": "6961faf944fe2330c7b65419335711bab5b5ae53",
"size": "16806",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "base/src/main/java/com/smartdevicelink/proxy/rpc/ClimateControlCapabilities.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "6158140"
}
],
"symlink_target": ""
} |
(function() {
'use strict';
/**
* @ngdoc module
* @name material.components.radioButton
* @description radioButton module!
*/
angular.module('material.components.radioButton', [
'material.core'
])
.directive('mdRadioGroup', mdRadioGroupDirective)
.directive('mdRadioButton', mdRadioButtonDirective);
/**
* @ngdoc directive
* @module material.components.radioButton
* @name mdRadioGroup
*
* @restrict E
*
* @description
* The `<md-radio-group>` directive identifies a grouping
* container for the 1..n grouped radio buttons; specified using nested
* `<md-radio-button>` tags.
*
* As per the [material design spec](http://www.google.com/design/spec/style/color.html#color-ui-color-application)
* the radio button is in the accent color by default. The primary color palette may be used with
* the `md-primary` class.
*
* Note: `<md-radio-group>` and `<md-radio-button>` handle tabindex differently
* than the native `<input type='radio'>` controls. Whereas the native controls
* force the user to tab through all the radio buttons, `<md-radio-group>`
* is focusable, and by default the `<md-radio-button>`s are not.
*
* @param {string} ng-model Assignable angular expression to data-bind to.
* @param {boolean=} md-no-ink Use of attribute indicates flag to disable ink ripple effects.
*
* @usage
* <hljs lang="html">
* <md-radio-group ng-model="selected">
*
* <md-radio-button
* ng-repeat="d in colorOptions"
* ng-value="d.value" aria-label="{{ d.label }}">
*
* {{ d.label }}
*
* </md-radio-button>
*
* </md-radio-group>
* </hljs>
*
*/
function mdRadioGroupDirective($mdUtil, $mdConstant, $mdTheming) {
RadioGroupController.prototype = createRadioGroupControllerProto();
return {
restrict: 'E',
controller: ['$element', RadioGroupController],
require: ['mdRadioGroup', '?ngModel'],
link: { pre: linkRadioGroup }
};
function linkRadioGroup(scope, element, attr, ctrls) {
$mdTheming(element);
var rgCtrl = ctrls[0];
var ngModelCtrl = ctrls[1] || $mdUtil.fakeNgModel();
function keydownListener(ev) {
switch(ev.keyCode) {
case $mdConstant.KEY_CODE.LEFT_ARROW:
case $mdConstant.KEY_CODE.UP_ARROW:
ev.preventDefault();
rgCtrl.selectPrevious();
break;
case $mdConstant.KEY_CODE.RIGHT_ARROW:
case $mdConstant.KEY_CODE.DOWN_ARROW:
ev.preventDefault();
rgCtrl.selectNext();
break;
case $mdConstant.KEY_CODE.ENTER:
var form = angular.element($mdUtil.getClosest(element[0], 'form'));
if (form.length > 0) {
form.triggerHandler('submit');
}
break;
}
}
rgCtrl.init(ngModelCtrl);
element.attr({
'role': 'radiogroup',
'tabIndex': element.attr('tabindex') || '0'
})
.on('keydown', keydownListener);
}
function RadioGroupController($element) {
this._radioButtonRenderFns = [];
this.$element = $element;
}
function createRadioGroupControllerProto() {
return {
init: function(ngModelCtrl) {
this._ngModelCtrl = ngModelCtrl;
this._ngModelCtrl.$render = angular.bind(this, this.render);
},
add: function(rbRender) {
this._radioButtonRenderFns.push(rbRender);
},
remove: function(rbRender) {
var index = this._radioButtonRenderFns.indexOf(rbRender);
if (index !== -1) {
this._radioButtonRenderFns.splice(index, 1);
}
},
render: function() {
this._radioButtonRenderFns.forEach(function(rbRender) {
rbRender();
});
},
setViewValue: function(value, eventType) {
this._ngModelCtrl.$setViewValue(value, eventType);
// update the other radio buttons as well
this.render();
},
getViewValue: function() {
return this._ngModelCtrl.$viewValue;
},
selectNext: function() {
return changeSelectedButton(this.$element, 1);
},
selectPrevious: function() {
return changeSelectedButton(this.$element, -1);
},
setActiveDescendant: function (radioId) {
this.$element.attr('aria-activedescendant', radioId);
}
};
}
/**
* Change the radio group's selected button by a given increment.
* If no button is selected, select the first button.
*/
function changeSelectedButton(parent, increment) {
// Coerce all child radio buttons into an array, then wrap then in an iterator
var buttons = $mdUtil.iterator(parent[0].querySelectorAll('md-radio-button'), true);
if (buttons.count()) {
var validate = function (button) {
// If disabled, then NOT valid
return !angular.element(button).attr("disabled");
};
var selected = parent[0].querySelector('md-radio-button.md-checked');
var target = buttons[increment < 0 ? 'previous' : 'next'](selected, validate) || buttons.first();
// Activate radioButton's click listener (triggerHandler won't create a real click event)
angular.element(target).triggerHandler('click');
}
}
}
/**
* @ngdoc directive
* @module material.components.radioButton
* @name mdRadioButton
*
* @restrict E
*
* @description
* The `<md-radio-button>`directive is the child directive required to be used within `<md-radio-group>` elements.
*
* While similar to the `<input type="radio" ng-model="" value="">` directive,
* the `<md-radio-button>` directive provides ink effects, ARIA support, and
* supports use within named radio groups.
*
* @param {string} ngModel Assignable angular expression to data-bind to.
* @param {string=} ngChange Angular expression to be executed when input changes due to user
* interaction with the input element.
* @param {string} ngValue Angular expression which sets the value to which the expression should
* be set when selected.*
* @param {string} value The value to which the expression should be set when selected.
* @param {string=} name Property name of the form under which the control is published.
* @param {string=} ariaLabel Adds label to radio button for accessibility.
* Defaults to radio button's text. If no text content is available, a warning will be logged.
*
* @usage
* <hljs lang="html">
*
* <md-radio-button value="1" aria-label="Label 1">
* Label 1
* </md-radio-button>
*
* <md-radio-button ng-model="color" ng-value="specialValue" aria-label="Green">
* Green
* </md-radio-button>
*
* </hljs>
*
*/
function mdRadioButtonDirective($mdAria, $mdUtil, $mdTheming) {
var CHECKED_CSS = 'md-checked';
return {
restrict: 'E',
require: '^mdRadioGroup',
transclude: true,
template: '<div class="md-container" md-ink-ripple md-ink-ripple-checkbox>' +
'<div class="md-off"></div>' +
'<div class="md-on"></div>' +
'</div>' +
'<div ng-transclude class="md-label"></div>',
link: link
};
function link(scope, element, attr, rgCtrl) {
var lastChecked;
$mdTheming(element);
configureAria(element, scope);
rgCtrl.add(render);
attr.$observe('value', render);
element
.on('click', listener)
.on('$destroy', function() {
rgCtrl.remove(render);
});
function listener(ev) {
if (element[0].hasAttribute('disabled')) return;
scope.$apply(function() {
rgCtrl.setViewValue(attr.value, ev && ev.type);
});
}
function render() {
var checked = (rgCtrl.getViewValue() == attr.value);
if (checked === lastChecked) {
return;
}
lastChecked = checked;
element.attr('aria-checked', checked);
if (checked) {
element.addClass(CHECKED_CSS);
rgCtrl.setActiveDescendant(element.attr('id'));
} else {
element.removeClass(CHECKED_CSS);
}
}
/**
* Inject ARIA-specific attributes appropriate for each radio button
*/
function configureAria( element, scope ){
scope.ariaId = buildAriaID();
element.attr({
'id' : scope.ariaId,
'role' : 'radio',
'aria-checked' : 'false'
});
$mdAria.expectWithText(element, 'aria-label');
/**
* Build a unique ID for each radio button that will be used with aria-activedescendant.
* Preserve existing ID if already specified.
* @returns {*|string}
*/
function buildAriaID() {
return attr.id || ( 'radio' + "_" + $mdUtil.nextUid() );
}
}
}
}
})();
| {
"content_hash": "c3a364b6678930049e4ee4bc24ece050",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 115,
"avg_line_length": 29.802768166089965,
"alnum_prop": 0.6260304191338674,
"repo_name": "svetlyak40wt/material",
"id": "a5c53d88d77de22d6575feb9a8edbd5ebc9ee3a6",
"size": "8613",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/components/radioButton/radioButton.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "102621"
},
{
"name": "HTML",
"bytes": "47934"
},
{
"name": "JavaScript",
"bytes": "613833"
},
{
"name": "Shell",
"bytes": "3135"
}
],
"symlink_target": ""
} |
package org.apache.camel.converter.jaxp;
import java.io.InputStream;
import java.io.Reader;
import javax.xml.transform.stream.StreamSource;
import org.apache.camel.Converter;
/**
* A converter from {@link StreamSource} objects
*/
@Converter
public final class StreamSourceConverter {
/**
* Utility classes should not have a public constructor.
*/
private StreamSourceConverter() {
}
@Converter
public static InputStream toInputStream(StreamSource source) {
return source.getInputStream();
}
@Converter
public static Reader toReader(StreamSource source) {
return source.getReader();
}
} | {
"content_hash": "17947372fc4dd3299ab2dda5d1f1b2f8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 66,
"avg_line_length": 20.53125,
"alnum_prop": 0.7062404870624048,
"repo_name": "kevinearls/camel",
"id": "59f5c5ccc2c712e28ae35f869f0a331a58efbf03",
"size": "1460",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "camel-core/src/main/java/org/apache/camel/converter/jaxp/StreamSourceConverter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6519"
},
{
"name": "Batchfile",
"bytes": "6512"
},
{
"name": "CSS",
"bytes": "30373"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "11410"
},
{
"name": "Groovy",
"bytes": "54390"
},
{
"name": "HTML",
"bytes": "190929"
},
{
"name": "Java",
"bytes": "70990879"
},
{
"name": "JavaScript",
"bytes": "90399"
},
{
"name": "Makefile",
"bytes": "513"
},
{
"name": "Python",
"bytes": "36"
},
{
"name": "Ruby",
"bytes": "4802"
},
{
"name": "Scala",
"bytes": "323982"
},
{
"name": "Shell",
"bytes": "23616"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "285105"
}
],
"symlink_target": ""
} |
// Copyright (c) 2003-present, Jodd Team (jodd.org). All Rights Reserved.
package jodd.madvoc.petite;
import jodd.madvoc.component.InterceptorsManager;
import jodd.madvoc.interceptor.ActionInterceptor;
import jodd.petite.meta.PetiteInject;
import jodd.petite.PetiteContainer;
/**
* Petite-aware interceptors manager.
*/
public class PetiteInterceptorManager extends InterceptorsManager {
@PetiteInject
protected PetiteContainer petiteContainer;
/**
* Acquires interceptor from Petite container.
*/
@Override
protected <R extends ActionInterceptor> R createWrapper(Class<R> wrapperClass) {
return petiteContainer.createBean(wrapperClass);
}
} | {
"content_hash": "1b77df8efd3ce6bb3b778a072b6287e2",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 81,
"avg_line_length": 26.4,
"alnum_prop": 0.793939393939394,
"repo_name": "wsldl123292/jodd",
"id": "ee01f9035554e0da200fd5bfb831250ce3a4eeef",
"size": "660",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jodd-madvoc/src/main/java/jodd/madvoc/petite/PetiteInterceptorManager.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Groovy",
"bytes": "3780"
},
{
"name": "HTML",
"bytes": "4127593"
},
{
"name": "Java",
"bytes": "5436830"
},
{
"name": "Python",
"bytes": "29538"
},
{
"name": "Shell",
"bytes": "3838"
}
],
"symlink_target": ""
} |
package org.openrdf.repository.object.managers.converters;
import org.openrdf.model.Literal;
import org.openrdf.model.URI;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.vocabulary.XMLSchema;
import org.openrdf.repository.object.managers.Marshall;
/**
* Converts {@link Short} to and from {@link Literal}.
*
* @author James Leigh
*
*/
public class ShortMarshall implements Marshall<Short> {
private ValueFactory vf;
public ShortMarshall(ValueFactory vf) {
this.vf = vf;
}
public String getJavaClassName() {
return Short.class.getName();
}
public URI getDatatype() {
return XMLSchema.SHORT;
}
public void setDatatype(URI datatype) {
if (!datatype.equals(XMLSchema.SHORT))
throw new IllegalArgumentException(datatype.toString());
}
public Short deserialize(Literal literal) {
return Short.valueOf(literal.shortValue());
}
public Literal serialize(Short object) {
return vf.createLiteral(object.shortValue());
}
}
| {
"content_hash": "7b5b1b93203a728991ca39be6f798198",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 59,
"avg_line_length": 22.09090909090909,
"alnum_prop": 0.7489711934156379,
"repo_name": "stain/alibaba",
"id": "2a8c035c156947ed33b24b1bab15189fac4e5220",
"size": "2544",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "object-repository/src/main/java/org/openrdf/repository/object/managers/converters/ShortMarshall.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "2153587"
},
{
"name": "Ruby",
"bytes": "7407"
},
{
"name": "Shell",
"bytes": "731"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.