MegaCode
Collection
6 items • Updated • 1
query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
59525cf10bc0c1bf13b000adb1ab92a9 | e9944dc1d254f0bde4676b0313dc793a | Returns the <see cref="TypeInfo"/> representation of the specified type. | namespace CodeEvaluator.Evaluation.Interfaces
EvaluatedTypeInfo GetTypeInfo(BaseTypeDeclarationSyntax typeDeclaration); | 1 |
53a468bbc8cfc935eee02b66f5d41a3f | 43496f1f316860f783f693aab77d2680 | Gets query for [[PropertyType]]. | class DevicePropType extends Eloquent
public static function getPropertyTypes(QueryParameters $config) {
return self::getRecords($config, get_called_class(), 'propertyTypes');
} | 1 |
03b109aa2cdf5166bbe9fed956cbdc0a | 008d60c4466ca8baa94c7703cbdf367c | 设置短连接结果监听 | public class SobotApi
public static void setHyperlinkListener(HyperlinkListener hyperlinkListener){
SobotOption.hyperlinkListener = hyperlinkListener;
} | 0 |
b16357d27f857732bc5aa0a578b9271c | 2fd5901885bd66f3c1ac8f135fd6b12b | Метод возвращающий количество золота | class Getters:
def getGold(self):
return self.data["gold"] | 1 |
695ffca63456bfb4aa803eda6e4141ae | 40fcd79c996873aa8cc813cf04a57bd7 | Sets the player_personality_card_id. | void setPlayerID(PlayerID value); | 0 |
a1c147c5858bb67de2d2ea5b18a535b9 | 747f056d307f7c1dc44db7dee52fb6a4 | Actual wire call for <see cref="ConfigurationsList" /> method. | namespace Microsoft.Azure.PowerShell.Cmdlets.MySql
public partial class MySql
internal async global::System.Threading.Tasks.Task ConfigurationsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Microsoft.A... | 0 |
f9fe73f9315d980353044b9aba99d65e | 4d03e238c15715a3b8a75cc1a9d4ddfd | Should the get operation perform any file size/checksum verifications?
can be customized for specific movers | public class Uploader
public FileExistsOperation getFileExistsOperation() {
return mFileExists;
} | 0 |
0cc341648ffeced722b2b19814d626d6 | f626d9672b947ae6ad1a2f51a15c5e40 | !\rst
Reset the state back to default. Afer this call, translated exceptions will be of type
default_exception_type_object_. Future calls to Initialize() will define new exception
types in another (not necessarily different) scope.
This is not recommended.
.. WARNING:: NOT THREAD SAFE. See Initialize() comments.
.. WAR... | void picoctrl_engResetExceptionManager(
picoctrl_Engine this
)
{
picoos_emReset(this->common->em);
} | 1 |
8d9834cd38c6d35e640cb2a6d20f9a4f | 63f349f48b446e5d4c560a3798dd7d86 | Edit fanout trigger | "use strict";
let workspace = getWorkspace();
let rule_xml = Blockly.Xml.workspaceToDom(workspace, true);
let rule_string = JSON.stringify(rule_xml);
if (event.type === "create" && event.ids.length === 1) {
let block = workspace.blockDB_[event.blockId];
if (block) {
block.inputList.forEach(eleme... | 0 |
c6015c339d849ea7ef43832c5098fd25 | 6c20ea3ce1084194f9354704dfb35831 | 将当前时间存在json数据里 | {
file_put_contents("json/" . $this->current_time . ".json.txt", $json, FILE_APPEND);
$this->conn->query("INSERT INTO wechat_Json ( json ) VALUES ( '$json' )");
} | 0 |
879fd659b9683e2ee90f3ee344ac26ff | d32de47e3faf8d36c8beb10f6e53e252 | Get the 3D points of the pixels in RGB images in metric unit. | class odometry:
def get_rgb(self, idx):
return (self.get_cam2(idx), self.get_cam3(idx)) | 0 |
adca1fefbd0a874c6093197ef83a2fc9 | ee8ccd56c87137af8bbca226448bac16 | This function searches for books by a given string. This string can be anywhere (id, title, author) | class Library:
def find_books(self, search_parameter, search_value):
suitable_books = self.session.query(Book).filter(getattr(Book, search_parameter).contains(search_value)).all()
return suitable_books | 1 |
3b1b16d2ef3637a1ad895c6565b611d0 | e3a169bd42e64ca53f90a412d11b2093 | Save cursor position and attributes | global cursorx, cursory
set_attr()
memory[0x4000:0x5800] = 0
memory[0x5800:0x5b00] = attr
cursorx, cursory = 0,0
set_attr()
if autoupdate: UPDATE() | 0 |
7016d387b89e8fe8409d8dfd9eab1113 | ceced0cc4b92520d9423f2fcdf94b4ff | Get microservice name from api id. | class output
private function getApiName(string $file): string
{
$file = strtolower($file);
$file = preg_replace('@/(response|request)\.yml@', '', $file);
return $file;
} | 0 |
64ea35e00d4df7de2994d629a18952d2 | 5824936b1a76f160c1f473141826e865 | Leemos información tabular de la pagina actual. | allElements = document.getElementById('contentRow').children[1];
tmp = allElements.children[0];
tmp.innerHTML=tmp.innerHTML.replace(/Subscribed newspapers/,"Periodicos suscritos");
results = getElements(document, "//table[@class='dataTable']");
if (results.snapshotLength > 0) {
allElements = results.snapshotItem... | 1 |
d33778dfb3cdbb4230e7d9cf3e4e316e | 6fb5ff701896fb5e1bc1390c632c634c | Creates an Import AST from an 'ImportDeclaration' TreeNode | public sealed partial class Parser
AstImport ParseImport(Position nodeStart)
{
var importNames = new StructList<AstNameMapping>();
AstSymbolImport? importName = null;
AstString? source;
if (Type == TokenType.String)
{
source = (AstString)ParseExpressionAtom(Start)... | 1 |
a2f668f5a84391dab32caf76e7c1da32 | 09939a2555a83c50dc3ff417b5f984ee | Determines whether index 2d is inside array bounds | bool in_bounds2(floor_type *floor_ptr, POSITION y, POSITION x) { return (y >= 0) && (x >= 0) && (y < floor_ptr->height) && (x < floor_ptr->width); } | 1 |
2d49d63f80ba4d09b29aea4dc4759609 | a5333fcab66c1bf0e4fc9696fc6470c4 | Find a GL Account number by a work center name | {
string strGKLocation = "";
OdbcDataReader dr = null;
try
{
StringBuilder strSQL = new StringBuilder();
strSQL.Append( "SELECT " + DBC.SS_GK_LOCATION );
strSQL.Append( " FROM " + DBC.SERVICE_SPACES_TABLE );
strSQL.Append( " WHERE " + DBC.SS_GK_NAME + "=" + "'" + DBUtil.MakeStringSafe( str... | 0 |
ab06a74fe7f689f1accff8466f8de7cd | 6801c5fb17c7bdd98f96c5a573b38cb8 | Add a group to a given group category and list | @group = Group.find(params[:group_id])
@gcategory = @group.gcategories.build(params.require(:gcategory).permit!)
@gcategory.group_id = @group.id
if @gcategory.save
redirect_to group_gcategories_url(@group)
else
render :action => "new"
end
end | 0 |
c6b115ae0891f6b332ea6336eb6b1e9f | 8773b614ab0303c3f0f1df61aa6a47ff | Returns Base16 time-stamp | local function time_stamp()
local t = os.date("*t")
return string.format("%04u%03u%02u%02u%02u", t.year, t.yday, t.hour, t.min, t.sec)
end | 0 |
d601a74f73da9a076979f98c44342c22 | 7f6659da2c7e73d20a2c85ab43ef7479 | Check if given var is / can be converted to int | if (is_int($var)) {
return false;
} else {
$var = intval($var);
return true;
}
} | 1 |
6d60027ff093bfa8bb0f5e673c39d62c | b87411ecb566087f0da3e9a2bcad6655 | Возвращает размер узла в байтах (папки или файла) | class Node(object):
def size(self):
return _get_tree_properties(self)['size'] | 0 |
bcf98af968afe2d431eedf65ccd39a4c | e5b6ce5e481242d407855060d59a1adf | Add next discrete point to path | {
VECTOR prev = _prev;
List<VECTOR> pts = _pts;
int count = pts.Count;
if (count != 0)
{
FLOAT td = VectorHelper.Distance(prev, p);
FLOAT md = _linDist;
if (td > md)
{
... | 1 |
3d520df213129e0389191482ffcc8cb1 | 7a75bfea5f45124285f2ed5fe893a096 | 获取exhibitionid属性的值。 | val = attr_val(elem, 'exhibitType')
if val is None:
return 'EX-101'
return val | 0 |
a9997d1f3df6b072be89297d3c161ee9 | 50fa670ae33660f2fbe9fe51b1fb0f63 | Enter a parse tree produced by ECLParser#qm. | class TransformationAlgebraTypedListener(ParseTreeListener):
# Enter a parse tree produced by TransformationAlgebraTypedParser#start.
def exitE(self, ctx:TransformationAlgebraTypedParser.EContext):
pass | 0 |
0e14276c81636c37954fba0786b66b04 | 56bcd7a643099f0ed723fd69f56831c9 | Удаляем пустые платформы | class GameField:
def clean_empty(self):
for r in range(self.WIDTH):
for c in range(self.WIDTH):
if isinstance(self.field[r][c], Figure.Path):
self.field[r][c] = Figure.Empty() | 0 |
7b4ebb567f1d8ee383443f31ef0d0616 | 81ef35b9921916c8a56ebb549b252f91 | returns locally defined parameter specific data | class Condition:
def get_local_params(self, par_global):
return [
par_global[a] if a is not None else b
for a, b in zip(self._p_global_indices, self.p_local)
] | 1 |
3ef07338596b49ad0b39d7e3ae7a47e5 | 4fccbf35afdc698359a2878454578847 | Get all of the jobs matching a truth-test callback. | function filter(predicate) {
return transduce.filter(iteratee(predicate));
} | 1 |
550d3aca4b836bf04fec70c70913936c | 0d4de1a8087eb44599ac50afcae49469 | Creates a form to edit a Question entity. | {
$survey = $this->get('app.survey_read')->findById($surveyId);
$question = $this->get('app.question_read')->findById($questionId);
if(!$survey) {
$this->addFlash('fail','Survey not found!');
return $this->redirectToRoute('survey_show');
}
if(!$questio... | 1 |
ce8ae964493a0ebff6bbd356c07a29e0 | 4064109beaab7e5776faa950762c3b12 | Tee output to a full new set of debug logs in the given directory. | def get_or_create_debug_dir(export_dir):
debug_dir = get_debug_dir(export_dir)
file_io.recursive_create_dir(debug_dir)
return debug_dir | 0 |
ec364845cf33fe035caa2fb0a31e67a3 | 6284a95234864455c8acfefff230e6ab | 不断接收串口数据,发布给订阅者 | void *
InteraircraftReceiver::receive_thread(void *arg)
{
{
char thread_name[24];
sprintf(thread_name, "InteraircraftReceiver");
px4_prctl(PR_SET_NAME, thread_name, px4_getpid());
}
orb_advert_t _communication_pub = orb_advertise(ORB_ID(master_slav... | 1 |
96dcf9aa25ded06a0cde7ef28e49a69f | 7269fedb8d8046a01e627c08cbb3d2cc | 切换数据源为写类型的 | + " and @annotation(cn.netinnet.nna.annotation.ReadDataSource) ")
public void setReadDataSourceType() {
if(!DataSourceType.write.getType().equals(DataSourceContextHolder.getReadOrWrite())){
DataSourceContextHolder.setRead();
}
} | 0 |
b3f2a27ffc00a5eeb4e54733f13fb068 | a9e9d2ed3dad51b4a3442474ae51ea94 | Returns type of token stored in the table at the index | class CompilationEngine:
def peek_type(self):
ret_val = self.__tokens[self.__i]
return ret_val[0] | 1 |
73ea9bab74ae83a3267957380249e10b | 260906b53bc657e7b2c8eedfe2f60023 | Dataloader for prediction. The input is either the regular input, or a tuple
with input and label. | class LoadData:
def predict_input_fn(self, features, labels, batch_size):
if labels is None:
inputs = features
else:
inputs = (features, labels)
dataset = tf.data.Dataset.from_tensor_slices(inputs)
assert batch_size is not None, "batch_size must not be None"
... | 1 |
0e13b8bcd24ea4556a860c3a067b5fd0 | b0520764f4e804b9b7d2b30af41a2046 | Prueft, ob ein Artikel ueber einen bestimmten Varselect verfuegt. | {
$oDb = oxDb::getDb();
$oSeries = $this->getSerie();
$sSelect = "select 1 from oxobject2discount where oxdiscountid = " . $oDb->quote($oSeries->getId()) . " and oxtype = 'oxarticles'";
$blOk = ( bool ) $oDb->getOne($sSelect);
return $blOk;
} | 0 |
507862aaf1e7a641d642f8bdf3344d69 | 958b06e64bebdf28e981bea2800c43cc | 有条件的更新图书信息 | @Update("update book_info set b_title=#{bookInfoDto.b_title}, c_id=#{bookInfoDto.c_id}, b_publisher=#{bookInfoDto.b_publisher}, b_pdate=#{bookInfoDto.b_pdate}, b_author=#{bookInfoDto.b_author} where isbn=#{bookInfoDto.isbn}")
void updateBookInfo(@Param("bookInfoDto") BookInfoDto bookInfoDto); | 1 |
585f897182b8c3893388c73287114c54 | a22ca489c6c289f99fbb502e17d4cc22 | Sorts GET, POST data into clean arrays | foreach ($_GET as $k => $v) {
if (__SAFESCHEMA__) {
$this->m_Get[$k] = $this->m_pSchema->clean_by_element($v, $k);
}
else {
$this->m_Get[$k] = $v;
}
$this->m_Get[':'.$k]['value'] = $v;
}
unset($_GET);
foreach ($_POST as $k => $v) {
if (__SAFESCHEMA__) {
$this->m_Post[$k] = $this->m... | 1 |
d422a91edf01c2870bddd70ca45ed3fd | 8c4c27032d788d046ee635800af0dfcb | **********非递归的层次遍历********** | void LeveOrder(BITree t){
BITree Que[20];
int front, rear;
if(t==NULL)
return 1;
front = -1;
rear = 0;
Que[rear] = t;
while(front != rear){
front++;
printf("%d", Que[front]->data);
if(Que[front]->data!=NULL){
rear++;
Que[rear] = Que[fro... | 1 |
cf43aa4cb07e4e3e4abcdbfea45aa377 | faeb60e92f1471de09f0ce42b8c96666 | Determines if this axiom is a logical axiom. Logical axioms are defined
to be axioms other than declaration axioms (including imports
declarations) and annotation axioms.
<code>false</code> if the axiom is not a logical axiom. | public boolean isLogical(); | 1 |
a558265443a44a2d8fd32686a3434272 | c43d125f8363a1e6ebb40d46156f2aba | Don't emit the default value type constructor - the runtime handles that | namespace MongoDB.Bson.Serialization.Conventions
[Obsolete("Use IgnoreIfDefaultConvention instead.")]
public class NeverSerializeDefaultValueConvention : ISerializeDefaultValueConvention
public bool SerializeDefaultValue(MemberInfo memberInfo)
{
return false;
} | 1 |
67483ab824a5613bfcf6359728160522 | fd805ea521aa70b74328d679942aa77b | Luu mang nguoi dung xuong localStorage | class User
saveUserLocalStorage() {
var jsonPlayer = JSON.stringify(this);
localStorage.setItem(this.username, jsonPlayer);
} | 0 |
645855eaa13990cb3b4cff86c4639bdf | 9c754a2306fed754bd17332074efd83e | Метод инкрементирующий поле с количеством проигрышных партий у пользователя | {
using (IDbConnection DbConn = new SQLiteConnection(ConnectionString()))
{
DbConn.Execute($"UPDATE Users SET Wins = Wins+1 WHERE login='{login}';");
}
} | 0 |
4a3aee6c334b7e83bbc011ca59c2af1e | 742235c88701a1d3adb62de88b73b58f | 将通用对象s转换为float类型,如果字符穿为空或null,返回r; | float n = Float.MIN_VALUE;
if (s == null) {
return n;
}
try {
n = new Float(s.trim()).floatValue();
} catch(NumberFormatException e) {}
return(n);
} | 0 |
8b6aef38b96cc9b329dcf6ab02061a63 | 57f80fc550837d3ef0baf6596f2d894b | Generates all possible circular permutations of the input. | fn permutations<T: Copy>(input: Vec<T>) -> Vec<Vec<T>>
fn generate_permutations<T: Copy>(out: &mut Vec<Vec<T>>, input: &mut Vec<T>, len: usize) {
if len <= 1 {
out.push(input.clone());
return;
}
for i in 0..len {
generate_permutations(out, input, len - 1);
... | 0 |
058ada2812151a22db12767983bb98f4 | f5f4b62d8a0733a393011e2da27b2cb0 | 实现背景颜色的替换功能 | public class SelectorUtil
public static void replaceSelctor(View view, String color) {
StateListDrawable mySelectorGrad = (StateListDrawable) view.getBackground();
try {
Class slDraClass = StateListDrawable.class;
Method getStateCountMethod = slDraClass.getDeclaredMethod("getStat... | 1 |
5f9a375dd1c747662f0dfa07c217700d | 90e7d1f46ece24f6ce5fde205575b6be | 减去优惠券抵扣金额后, 积分能够抵扣的金额 | class UserCouponModel extends BaseModel
public function getRealPay($userCouponCode, $realPay, $nbrCoupon) {
$userCouponInfo = $this
->field(array('insteadPrice', 'discountPercent','couponType'))
->join('BatchCoupon ON BatchCoupon.batchCouponCode = UserCoupon.batchCouponCode')
... | 0 |
7157b94dd21d812889623b3a5500868b | 142bec93d900715feabdd6c3ae8d35a3 | [TASK] Implement a ISR code here to echo back a received byte. | ISR(USART1_RX_vect) {
uint8_t byte = UDR1;
UDR1 = byte;
} | 1 |
f3611cd3875016e7869bdbcd5eee8780 | 76debb0384de3561edcd5eb85c7e3169 | commuta mode inserció/sobre-escriptura | int main ()
{
char car;
FILE * fent, * fsal;
if((fent = fopen("entrada.txt","r")) == NULL)
{
puts("Error fichero entrada");
return -1;
}
if((fsal = fopen("salida.txt","w")) == NULL)
{
puts("Error fichero salida");
return -1;
}
while(fscanf(fent,... | 0 |
424323b55d8485d2c07dbbe0f7b9480d | 8db4ec0a4ce2a9ec83d9845e845bfe54 | Infer call to tuple alias as new subscriptable class typing.Tuple. | def infer_tuple_alias(
node: Call, ctx: context.InferenceContext = None
) -> typing.Iterator[ClassDef]:
try:
res = next(node.args[0].infer(context=ctx))
except StopIteration as e:
raise InferenceError(node=node.args[0], context=context) from e
class_def = ClassDef(
name="Tuple",
... | 1 |
d8244959ac82c9f64908147b3282b19d | 4c84d9aea0e35d34b2c6462d5aab5923 | GENERAL RADIX ONE DIMENSIONAL FOURIER TRANSFORM; | rs_dft_1d (int N, minfft_cmpl *x, minfft_cmpl *t, minfft_cmpl *y, int sy, const minfft_cmpl *e) {
int n;
minfft_cmpl t0,t1,t2,t3;
if (N==1) {
y[0] = x[0];
return;
}
if (N==2) {
t0 = x[0]+x[1];
t1 = x[0]-x[1];
y[0] = t0;
y[sy] = t1;
return;
}
if (N==4) {
t0 = x[0]+x[2];
t1 = x[1]+x[3];
t... | 1 |
86a9d42479eca33853720d0862d576ec | fb6fca37d3fc9db8273c5e832032264d | 转换 布尔为 Y 或 N | public class WorkMenuBean
public String boolToStr(boolean b) {
if (b) {
return "Y";
} else {
return "N";
}
} | 1 |
63816a726eb3ffa43869463c270bc424 | 96d1e65cdb299d120d677955e6a6c61c | 验证注册链接的code,有效时间为24小时 | $swiftconfig = Kohana::$config->load('message.expire.email');
$swiftconfig = $swiftconfig/(24*3600);
if((arr::get($get,'code')+7200) >= time()){
$client = Service_Sso_Client::instance();
$email = Arr::get($get,'email');
$key = Arr::get($get, "key");
... | 1 |
7cf1ee274f0e32070e6ef74e3172d5c9 | f197a4130dfcaaacffee2c079c1d542b | 获取 上次推送时间 | @Table(name = "task_item_exec_call")
public class TaskItemExecCallDO implements Serializable
public Date getNextPushTime() {
return nextPushTime;
} | 0 |
2e299479a99d8f8ae97f7b15db0f271c | 25d3759563147d0c549a41bea9a62460 | 获取商家关联的仓库编码 | List<String> getWarehouseCodeList(); | 1 |
0cd121a030fe0e1f1e60b1f613aa0d10 | 530c72337c5277ec2547e7572073decd | @brief Gibt die aktuelle Drehrichtung zurueck | uint8_t DC_Motor::getDirection()
{
return direction;
} | 1 |
94f0cd0967d830ed4a2c92e7064abbc2 | ac435fae118516a7ffb54ad4387c8e7a | Put the users lineup into their SD account. | public class SDRipper extends EPGDataSource
public static int addLineupToAccountByID(String lineupID) throws IOException, SDException
{
return ensureSession().addLineupByID(lineupID);
} | 1 |
47663f1afc6d704c1657d550f407dce9 | 2fa665d6ddb6eba229ac94542f67799f | Check whether or not game is already started, won't allow team to login. | class MultiDuel
def game_start_ok?
ret = false
if (@alpha && @alpha.start_ok?) && (@beta && @beta.start_ok?)
ret = true
end
ret
end | 0 |
50b991261360f2078fcf307280c0afef | 58f9698e7c2e9e6c447f187da510e83d | Valida inscri��o estadual do estado do Para�ba | public class InscricaoEstadual
private static void validaIEBahia(String ie) throws Exception {
if (ie.length() != 8 && ie.length() != 9) {
throw new Exception("Quantidade de digitos inválidas." + ie);
}
int modulo = 10;
int firstDigit = parseInt(valueOf(ie.charAt(ie.length() == 8 ? 0 : 1)));
if (firstDigit... | 0 |
2fb7e60440b5467920b3e9a4a98cd6a6 | cbc680a25b39d7b90efd045a80081ab3 | บันทึกรายการจ่ายโบนัส | {
$last_bonus = 0;
$i = 0;
$b_sql = "SELECT p_bonus FROM product WHERE id IN($p_id) ORDER BY find_in_set(id ,'{$p_id}')";
$b_res = mysql_query($b_sql);
while($b_row = mysql_fetch_array($b_res))
{
$last_bonus += $b_row['p_bonus'] * $pay_qty[$i];
$i++;
}
if(strlen($member_i... | 1 |
0685cd13fb748951055513cfad699858 | 990abc2527aa2e77adfe1f2ffc94c9ca | Returns the number of tries left as type string | public class Game1
public int getTries(){
return this.tries;
} | 0 |
cd2e9ce59f208e935e08b29c3ce9ac10 | acdc3894f3253e81840a9acb0778c3ee | @brief
loop()”时都应该调用这个函数。 该函数将自行决定是否需要计算一个新的PID输出。
计算输出时返回true,没有任何操作时返回false。 | bool QuickPID::Compute() {
if (!inAuto) return false;
uint32_t now = micros();
uint32_t timeChange = (now - lastTime);
if (timeChange >= sampleTimeUs) {
int input = *myInput;
int dInput = input - lastInput;
error = *mySetpoint - input;
if (controllerDirection == REVERSE) {
error = -error... | 1 |
d70b215d3c6461e893dd6a5e257236e4 | c029e258d3e7f1b005723e98856753af | 使用正则方法解析节点名,获取节点内的值 | public void regexMatch() {
String str = "<root><ResultCode>0</ResultCode></root>";
Pattern p = Pattern.compile("<ResultCode>(.*?)</ResultCode>");
Matcher m = p.matcher(str);
if (m.find()) {
System.out.println(m.group(1));
System.out.println("匹配成功");
} ... | 1 |
2868c6161679d989c6124db02f953923 | b9f3e3418920730283b26f3ebae71670 | 通过URL来获取图片,显示在ImageView | ImageLoader imageLoader = AppController.getInstance().getImageLoader();
imageLoader.get(url, ImageLoader.getImageListener(
imageview, R.color.trans, R.color.trans));
} | 1 |
c1b2d3adf6db7c6916f2f39ad6ddfbb4 | b55d0f8f7ca763c03b72f6e9cff04e16 | Put together all gradient arrays and make a single array | class GPUImageData(object):
def weightgradientall(self, delta):
tmp = cuda.device_array(24*self.shape[0]*delta.shape[0])
fastmult[24,1024](delta.arr,self.arr,tmp)
return tmp.copy_to_host().reshape((delta.shape[0],self.arr.shape[0],24)).sum(2) | 1 |
dabdf2e1ee2c8bdf0ddaf21f2fb3cbd3 | 75fd52caee0abd0c6c0bef4824b6ef2b | Creates a BMP file and fills it with the data inside self.pixels | with open(path, "wb") as f:
w = PngWriter(f, self.width, self.height)
w.write_image(self.bytes()) | 0 |
ef9d99742c4a7a657e823e61ed922b9b | 5fd039b54dc4aee5c4b814ecb6a48a03 | 获取用户ID(变量名称为RED_USERID的COOKIE的值) | {
if (!request.Cookies.Keys.Contains("UID"))
{
return "";
}
if (string.IsNullOrEmpty(request.Cookies["UID"].Value))
{
return "";
}
return request.Cookies["UID"].Value;
} | 0 |
85a563139adbcc4e501593da466629e2 | fbdc024af72bc89c2a0f9ff0074fec95 | Checks if it's possible to click on OK in this screen. | public class MainWindowController implements Initializable
public boolean isOkClicked() {
return okClicked;
} | 0 |
3d133a8a272ae2768f77a32952c0c92f | 7bbdb00d1fa3a6be640f8a0bf2fdd0d0 | generates a random list of elevator calls | time = 0
pos = 0.0
door_timer = 0
elev_state = 0
active_calls = []
j = 0
stop_request = False
self.call_list.append(call)
call.state = -1
while call.state != 0:
if len(self.call_list) > j:
if self.call_list[j... | 0 |
a827c84d0ba6923b5729d461c80f8484 | 2350c901a393a243490af2909b5fbbe7 | fonction qui met à jour le nombre maximal des éléments dans le tas | {
m_size = number_of_elements * 2 + 1;
m_array_datas = new CNope[m_size];
m_last = number_of_elements - 1;
for (int i = 0; i < m_last; i++)
{
m_array_datas[i] = array_datas_parameter[i];
}
int from_vertex = (int)(number_of_elements/2.0 - 1);
for (int i = from_vertex; i >= 0; i--)
{
shiftDown(i);
}
} | 0 |
509469104cbb8b62d863937095738025 | 3a08be5f6c4e50204aaf55abbe66954b | It checks if the amount of elements to create isn't more big than the size of the world | while (_Universe->size() <= n) {
step();
}
return true;
} | 0 |
8e1def6ab1aa4d5aee20b37758bc4461 | af48aa52bd29778f7a761a02f5b9f017 | Converts a frequency into a note. If the frequency is invalid it returns None
freq: frequency in Hz of the note
returns: str of the form "<octave>:<note> | inline uint16_t MODFreqToNote(uint16_t freq) {
return 0;
} | 0 |
fc5bff5622b9a04b5bab0272b97ce27b | bf546424570f003e250da76ca9ad3671 | Calculation of WER with Levenshtein distance.
Works only for iterables up to 254 elements (uint8).
O(nm) time ans space complexity. | def wer(r, h):
import numpy
d = numpy.zeros((len(r)+1)*(len(h)+1), dtype=numpy.uint8)
d = d.reshape((len(r)+1, len(h)+1))
for i in range(len(r)+1):
for j in range(len(h)+1):
if i == 0:
d[0][j] = j
elif j == 0:
d[i][0] = i
for i in range... | 1 |
fe8518823a929d9683c983f167953703 | 8ebd6b2f0b6bde5d1cb9d5f5f9d7d08b | Validate inputs of a Movie form | return $request->validate([
'film_title' => 'required|max:100',
'genre_id' => 'required|exists:\App\Genre,id',
'story' => 'required',
'release_date' => 'required|date',
'duration' => 'required|integer',
'additional_info' => 'nullable',
... | 1 |
0aae0b0f722447651b562a3979f8db3b | 59889f84b0e56d1aee4c85bf76feff16 | Helper function for creating SPARQL update queries.
Creates an operation for deleting all triples in a graph. | sparql_client.performUpdate("""DELETE WHERE {?s ?p ?o.}""")
pathlist = Path(TEST_TRIPLES_DIR).glob('*.ttl')
for path in pathlist:
g = Graph()
g.parse(str(path), format='turtle')
sparql_client.uploadGraph(g) | 1 |
b23cf67ec960bbc1402b3c61e0f1d244 | b456bef6dc774cb2faeb59327ec3b4e0 | Return list of (word, freq) for all words in trie that match pattern.
pattern is a string, interpreted as explained below:
* matches any sequence of zero or more characters,
? matches any single character,
otherwise char in pattern char must equal char in word.
Do not use a brute-force method that involves generating/l... | while '**' in pattern:
pattern = pattern.replace('**', '*')
if len(pattern) == 0:
return [] if trie.value is None else [('', trie.value)]
subtries = []
first = pattern[0]
if first == '?':
subtries = list(trie.children.items())
elif first == '*':
subtries = [('', t... | 1 |
8c25d0d5f007675da31ea8fdeca3fb8e | 900199ad3fe9d226e1e1c649c6350022 | 初始化labelButton | public class UI_GuideStep : NGUIChildGUI
public void InitialLabel(StringTable st)
{
if (m_stringTable == null)
m_stringTable = st;
m_labelSkip.text = st.GetString(321);
m_labelLeave.text = st.GetString(314);
m_labelResume.text = st.GetString(313);
for (int... | 1 |
83b0137a6e2a698c73dc2cc2f14d0360 | b0fc213e73222fd1f4255f92b7eb5e62 | Returns a fresh instance of this enum. Useful if you are working with a serialized/unserialized or cloned version
of this Enum. Such a "modified" Enum won't ever be equal to any other enum due to its object ID having changed
after the serialization respectively cloning process.
=> e.g. checking its equality with other ... | public class XObject extends Expression implements Serializable, Cloneable
public XObject getFresh()
{
return this;
} | 0 |
0e81d540807aad7df96bcc9224a37043 | a7eff482d62a201ce17c6010891e3e7a | Attach two-byte length before a string. | char const* p = in;
auto q = std::next(out.begin());
size_t n_bytes = 0;
const auto end = out.end();
while ((*p != 0) && (q != end) && n_bytes < 254) {
*q = uint16_t(*p);
++p;
++q;
n_bytes += 2;
}
out.front() = (TUSB_DESC_STRING << 8) | (n_bytes + 2);
} | 1 |
4564887e72764216ac8c844240e55bd9 | 682dce2632ca00f659141bc33dccd63a | changes a string like "up: nodeName" to "nodeName" | public class EventSpeechRule
private static String getUnqualifiedNodeName(Node node) {
String nodeName = node.getNodeName();
int colonIndex = nodeName.indexOf(":");
if (colonIndex > -1) {
nodeName = nodeName.substring(colonIndex + 1);
}
return nodeName;
} | 1 |
27889a741b4a7adde15e925a72ac2f46 | 8a13b7675a98d9bf11871a2ba416a9f2 | 카페 이미지 삭제 | class Model_Clinic_Mypage extends Model
public static function delete_image($image_name)
{
$auth = Auth::instance('Clinicauth');
$username = $auth->get('username');
$query = DB::select()
->where('c_username', '=', $username)
->from('c_images')
->execute();
$pre_image_name = isset($query->current()[... | 0 |
7823f00df8998b95b504c2ea066925f1 | ed8fa6305a434c32eeace8fdcb7e577c | Compute required memory size for L1 cache. | unsigned compute_L2_associativity(unsigned L1_size, unsigned L1_assoc, unsigned L2_size)
{
const float ratio = L2_size / (float) L1_size;
return L1_assoc * ratio;
} | 0 |
6b5abe4e442e13214be96ffa0d7d724b | cbe629fac6e563e0c40109ff86c608f5 | or if any page in the shelf is loading | public class MovieListFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener,
MoviesPresenter.View, MovieItemClickListener
/*, MovieAdapterHorizontal.ClickListener*/
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState)
@Override
public Boolean isLoa... | 1 |
1fb466ec51d9374d867b7c09ee2e122f | fee9e01fc851b4f89cdefe173cb32e3f | Get the allowed queue orders for configuration validation | class ConfigParse
public static function getOrders()
{
return ConfigParse::$_orders;
} | 1 |
7e1f05e9a49a80ece6bc8e0f648e6b83 | a217c9c127ab01b410f77d230e901457 | Lista de elementos que sofrem 2x quando atacados pelo elemento instanciado. | return [
"boost evasion",
"do NOT boost elemental defense",
"boost physical AND elemental defense, but no other stats",
"boost SP or elemental attack"
] | 0 |
f26d9dd79156f9e4b1afea561f2ca599 | c402d70e9fa496e56044212529faf376 | Test that plotting daily residuals doesn't crash. | matplotlib.use("Template")
n_series = 50
t_samples = 1200
k_clusters = 1
d_clusters = 4
data_series = generate_cluster_time_series(n_series, t_samples, k_clusters, d_clusters)
self.assertFalse(plot_time_series_dependencies(data_series) is None)
matplotlib.... | 0 |
6f8233e3fcee43b8322e23e57e180dc2 | f98a8c445a35bae199ec242b991f2f32 | This method will divide the blocks among the tasks of the nodes as per the data locality
based on block location information | List *assignFileSegmentList(List *segmentlist, List *dnNames)
{
ListCell *lc = NULL;
List *totalTask = NIL;
int segmentlistLen = list_length(segmentlist);
int datanodeNums = list_length(dnNames);
int avgTaskLen;
if (datanodeNums == 0)
return NIL;
avgTaskLen = segmentlistLen / datanod... | 0 |
8d4b1944e228888d14f050cac7ee8ce0 | 007ce7721e0b9f9d41a5f581db8f3c66 | Возвращает значение, говорящее о том, получен ли критический скачок количества процессов. | public class ConnectionMonitoringByteDownloader extends ConnectionMonitoringStreamHandler
public boolean checkError() {
return downloadError;
} | 0 |
41d81eb33c4cea3c95d00eba69534493 | f933b9f7dfe6c8e505e280c064998bc8 | 发送联盟奖励邮件 | $arrReward = [];
if (!empty($money)) {
$arrReward[] = FunctionHelper::moneyOutput($money) . "金币";
} elseif (!empty($diamonds)) {
$arrReward[] = FunctionHelper::moneyOutput($diamonds, EnumConfig::E_ResourceType['JEWELS']) . "钻石";
} else {
return $this->... | 1 |
c5a7b3a510105456b09c5e200f6aa105 | 9d0268f97dba11d4957cf16c8de9415e | Seules les cases de la 1er colonne ne le sont pas
(consacrees a la numerotation des lignes) | public boolean isCellEditable(int rowIndex, int columnIndex) {
if(columnIndex>0)
return false;
else
return true;
} | 1 |
e107b37bd94923c3243d3c9a59b6293f | e5f4c6868b31c1440089d7aca20a4616 | 获取会员卡信息(查询机构下所有会员卡) | $mcard = new Service_Data_MemberCard(['brand_id' => $arrInput['brand_id']]);
return $mcard->getMcardByMemberId(['member_id' => $arrInput['member_id']]);
} | 0 |
b89e54a99d4c6dd6432931b545331277 | 9a06dbce5d9bc4123587bde847e7efc5 | 通过equal条件删除,只支持一个equal条件,是简单的封装 | public class CommonDao<T>
public void delete(Map<String, Object> eqs) throws SQLException {
DeleteBuilder deleteBuilder = mDao.deleteBuilder();
Where where = deleteBuilder.where();
int size = eqs.size();
int index = 0;
for (Map.Entry<String, Object> eq : eqs.entrySet()) {
... | 0 |
c53eace26c1f5b26f42d2400f9be4c7a | af1022407dd24d0686b52dfab584e076 | dohvacanje vrijednosti iz comboboxa zdrastvena ustanova | {
DBConnection.ShowStreet(comboBoxEditUsersGorod.Text);
comboBoxEditUsersYlintca.DataSource = DBConnection.street;
comboBoxEditUsersYlintca.DisplayMember = "ylitca";
comboBoxEditUsersYlintca.ValueMember = "id_ylitca";
} | 0 |
0ae5627cfa27e5a0c967a9788bf4459e | a7299b74ea1adab93ffb9dbf34c04d5f | Returns all carts for current site and user | class CartPeer extends BaseCartPeer
public static function doSelectCartsOfUser($user_id = null, $with_archive = false) {
if(!$user_id) { $user_id = sfContext::getInstance()->getUser()->getGuardUser()->getId(); }
$criteria = new Criteria();
$criteria->add(CartPeer::USER_ID, $user_id);
$criteria->addDescendingOrd... | 1 |
d2af4c3540d7253da51bf6d0756701f7 | 080bb05d633fb7d0699ca5161263d42a | 현재 프레임 - 이전 프레임 위치 가 음/양 수에 따라 낙하/상승 | {
if (transform.position.x > preXPos + 0.01f)
{
transform.localScale = rightDir;
nameTextTrn.localScale = rightDir;
}
else if (transform.position.x + 0.01f < preXPos)
{
transform.localScale = leftDir;
nameTextTrn.localScale = leftDir;
}
pr... | 0 |
68676d7f060d28391daa2e5ecd792c18 | 967f87e18c5eaddd07d50b3cc9bd2609 | Unsubscribe from order book updates for a set of ticker(s). | class BittrexSocket(WebSocket):
def unsubscribe_from_orderbook_update(self, tickers, unsub_type=True):
sub_type = SUB_TYPE_ORDERBOOKUPDATE
self._unsubscribe(tickers, sub_type, unsub_type) | 1 |
ea09c5df2a25abeefaa9064f129e52e2 | d713c7c8aa492ad689c21cae125e914a | 处理聚餐费用的申请 | Integer processExpense(Map map) throws Exception; | 1 |
379fa26c45435ae557f26faa84cc90d3 | 83400ba9a18300dc32d508120bbb0979 | Gets the date HTML attributes. | {
var result = new Dictionary<string, object>();
if (HtmlAttributes != null)
result = new Dictionary<string, object>(HtmlAttributes);
var data = new Dictionary<string, object>();
result.TryAdd("data-initialdate", InitialDate);
result.Tr... | 1 |
7481256d2967cd5cfae7cddc7f612901 | 757bf8e2bf55418cd91835fef1e5df3d | #' @return A dataframe with information about the clusters | data <- c()
print(files)
for (f in files) {
print(load(f))
in_data <- fcs.data
data <- rbind(data, in_data)
}
clst <- data[, "cluster"]
print(head(data <- data[, colnames(data) != "cluster", drop = FALSE]))
data <- applyTransforms(data, transforms)
colnames(data) ... | 1 |
27200a6455fb3a7ab95c44592f4e9f23 | 2386aaf8e2710242a062f9039e1ab130 | Mark the pushwall as disabled | idPhysics* physics = (groundTrace.fraction < 1.0f) ? gameLocal.entities[groundTrace.c.entityNum]->GetPhysics() : NULL;
bool parametricPhysics = (physics) ? physics->IsType(idPhysics_Parametric::Type) : false;
if( parametricPhysics && IsWallWalking() ) {
return;
}
idPhysics_Player::SetPushed( deltaTime );... | 0 |
2d1fd0846e8757f71d39e25be56563a7 | 3260fc0e671a27d042e50f59bfc8117a | If saline conductivity is bigger than tissue conductivity, the
value of 2*(inf homogeneous point source) should be bigger
than value returned from MoI | def test_z_on_h_calculation_single_one_II():
assert np.isposinf(abundance_obj.z_on_h(0, 1)) | 0 |