query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
7de7a5c0464ea5631de6e6b3a5ec0bcc | a8909e5e06d17086f7a9300e564a79bb | Make function to XOR each character in string s with byte. | outputBytes = b''
for byte in inputBytes:
outputBytes += bytes([byte ^ charValue])
return outputBytes | 1 |
be86ff0e6198f0384bbf050b95fb6343 | 935d0f30fa20004d14078f7bdbcddd2b | Returns the index of a country in the countries by its ISO A-2 code. | {
for (int i = 0; i < _countries.Count; i++)
{
if (_name == _countries[i].CountryName) return i;
}
return -1;
} | 0 |
3995a5244997149a86e07d0874c11d97 | 7272fb44a6c13e040bdca3925a5d2604 | Generate the input data and write it to a file. | def main():
parser = argparse.ArgumentParser(prog="simulation data generation")
parser.add_argument("--size", type=int, help="size of new data", required=True)
parser.add_argument(
"--output", type=str, help="filename for storing data", required=True
)
arguments = parser.parse_args()
sav... | 1 |
49dfdded66a797db59875208285132ef | fc6a3a850c2e55fe95d78810929baff6 | Calculate the md5 hash. | class Page:
def md5(self) -> str:
return md5(self.bytes).hexdigest() | 1 |
18e0e3b46d6e0012fb31a86086202a34 | bb73c05149dcdebc4e3f4bbcc692614d | This function redirects all systems error messages to print at the QuantumGuiPanel console instead of the standard console.
This is done to give the user better feedback when the heap space overflows upon using too large of a data set. | if (self.gbackend is not None) and (self.gbackend.has_load_backend()):
self.gbackend.dialog_error_show(strerror)
else:
print(strerror) | 0 |
f9edb70cd1329529f0af6a12932f5b6d | f9354f495fedcdf07f93cd3c61fdf43e | Cuenta el numero de coincidencias en un archivo dada la ruta del fichero y la función de coincidencia | file, err := os.Open(fileInfo)
if err != nil {
log.Fatal(err)
}
buffer := make([]byte, 512*1024)
counter := 0
searchFor := []byte(search)
c, _ := file.Read(buffer)
counter += bytes.Count(buffer[:c], searchFor)
return counter
} | 1 |
5f828b2e8f6b76679e1638fced6bb7c0 | 510419ad7c5dbea617854b1998e4bf79 | 测试获取工厂bean自己 | @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"application.xml"})
public class SpringTests
@Test
public void testFactoryBean() {
MyBean bean1 = (MyBean) context.getBean("myFactoryBean");
bean1.print();
MyBean bean2 = (MyBean) context.getBean("myFactoryBean");
bean2.p... | 1 |
0975eb203413e884a2360afdca3a8bd5 | 13d61f34391f431815af78ffb47916f8 | Retrieve reverse types assigned to a ruler with concatenation over
reeceperiod | class FastD(FastA):
def rc(self):
super(FastD,self).rc()
self.loops = self.loops[::-1]
self.stems = self.stems[::-1] | 0 |
2478dc9bec9422f9bf2b8b155a7fe726 | abe70e3f751c659256e0a69d6bd431dd | Returns the largest element that is smaller than element. | public E ceiling(E e) {
return nullableGet(e, true, false);
} | 0 |
1e11dd64835c4b9b9b9d574e8cd1dd48 | a9c08294c64919435fb0f0045a7ef0cc | solves knapsack problem using branch and bound algorithm | {
int W = knapSackSize;
int N = noOfItems;
int[,] opt = new int[N + 1, W + 1];
bool[,] sol = new bool[N + 1, W + 1];
for (int n = 1; n <= N; n++)
{
for (int w = 1; w <= W; w++)
{
int optio... | 0 |
a8ee4a99c165479ce398fd4a9a525e23 | 64adec0bcac3cae26519f18a37a32935 | 登录,若成功了发射出User对象,失败了发射错误信息 | namespace PublishClient
public partial class Form_Login : Form
private void button_Login_Click(object sender, EventArgs e)
{
var uac = textBox_UesrAccount.Text;
var upw = textBox_UserPW.Text;
textBox_UserPW.Text = "";
if (uac.Length == 0)
{
... | 0 |
4073a0d1e492f86d2bc251dc112148e3 | dbc774f6d2f75ad05927bb65f8d1804a | Close the registry socket and reset all variables to their "disconnected" state. | static void
do_reset(tcp_socket_t *s)
{
s->state = _CLOSED;
__timer_cancel(&s->timer);
free_rxlist(s);
unlink_socket(s);
} | 1 |
382958c54c059dcedcc90bd504d0a517 | ab15c9b521070531b928b914843ac756 | Se conecta a la bd y modifica una fila utilizando los datos que se le pasan en un listado y utilizando el codigo de cliente para encontrar el que se debe modificar. | class Clase_sql{
public function ActualizarCliente($cod,$nummident,$Tcliente,$Inombres,$Iapellidos,$Idireccion,$Numtelef,$correo,$contra){
$resultado = $this->bd->query("UPDATE clientes set CED_CLI= '$nummident',TIPO_CLIENTE='$Tcliente' , NOM_TCLI='$Inombres',APE_CLI ='$Iapellidos' ,DIR_CLI ='$Idireccion' ,... | 1 |
b96d16399118f41127ea1e780bfb646a | ca6a07969db4a91d174cafda8beee4eb | Changes the status of all the checkboxes in the grid, based on the state of the header checkbox. | {
CheckBox cbx = (CheckBox)sender;
foreach (GridViewRow gvr in gvResult.Rows)
{
if (!gvr.Cells[0].Enabled) continue;
CheckBox ch = (CheckBox)gvr.FindControl("ItemCheckBox");
ch.Checked = cbx.Checked;
}
} | 1 |
4a4c56cbbb6ff003b4ec982946f7945a | b7422dd36bf63984ba4d4ec430a4817f | GET: QuestionRecords | {
var question = db.Question.Include(q => q.RefForm);
return View(await question.ToListAsync());
} | 1 |
ea14dbc23ec48b114d41d762e29282cc | 57e474e596ae81e6c8b0ca60206b8741 | newsem -- allocate an unused semaphore and return its index | ipc_sem_t *semset = key!=IPC_PRIVATE?ipc_sem_find(key,-1):NULL;
if (semset==NULL) {
ipc_sem_t *new = malloc(sizeof(ipc_sem_t));
if (new!=NULL) {
size_t i;
new->ipc.type = IPC_SEM;
new->ipc.id = ipc_lastid++;
new->ipc.key = key;
new->ipc.owner = proc_current;
new->ipc.crea... | 0 |
502a68bbb4d2d101101e3773f2e3a8ec | ee212a77ef9983daa578a9aac4872505 | Build call arguments as array of Nodes; spread elements as necessary. | function build() {
return arguments;
} | 0 |
a0bfec1532dd6c7e83e60036571f39a9 | d40d8ccf90e324a61391ce9db114e4e6 | Back to where it was POSTed from | function redirect() {
$back = getenv('HTTP_REFERER');
header("Location: $back");
} | 1 |
f1b3c7a025828c090e585dcb9b3280ee | ff1f736ff19ae97806e46cd285571c77 | Trim two data series so that it can be correlated.
Used in differential plot. | series_1 = fn(*args, **kwargs)
series_2 = fn(*args, **kwargs)
return series_1, series_2 | 0 |
f395952472cde463456f95e234a509b1 | 0c99151a31734b814237e3519897c6e3 | teste si val est contenu dans a | bool In_tab(const Entiers &tab, int val)
{
for (uint i=0; i < tab.size(); i++)
if(tab[i]==val)
return true;
return false;
} | 1 |
a29bbf2368847f62d5169c7d8181ba3b | c4c5405bbb01ae061030a14bfb68932a | Unpacks header info in idx file's first 15 bytes. | class _NameTable(_BaseTable):
def _name_header(bufr, idx):
name_hdr_offset = 6 + idx*12
return unpack_from('>HHHHHH', bufr, name_hdr_offset) | 0 |
83a2b4e252773bd1c3682e4e42768f06 | 9238f052faf9bdfbaab3788d30ed6043 | 找出内容与广告之间相匹配的那些单词 | void MyTextEdit::marchingWords()
{
result.clear();
if(input.isEmpty() && parentStr.isEmpty())
{
return;
}
if (input.isEmpty())
{
for (QString str : keywords)
{
result << str;
}
}
else
{
for (QString str : keywords)
{
... | 0 |
2acc16a134ab365cc8331b5cddbcdbe0 | 1d0eb4e0533d314b8e82c2c0312c2450 | Metodo encargado de crear el texto correspondiente a la estructrura jugador. | playerCreated = ""
formations = {0 : [[1, 0, 3, 2, 2, 3], "3-4-3"],
1 : [[1, 0, 3, 2, 3, 2], "3-5-2"],
2 : [[1, 0, 3, 2, 4, 1], "3-6-1"],
3 : [[1, 2, 2, 2, 2, 2], "4-4-2 classic"],
4 : [[1, 2, 2, 1, 3, 2], "4-4-2 offensive"],
... | 1 |
75fd27c0bc37c7c847f48366c8936d7d | af3ed2b502127fae6d0e98d4865a156e | Ajoute le joueur dans le fichier texte des meilleurs scores. | void MyGLWidget::save(QString player, float val) {
if(!player.toStdString().empty()) {
std::fstream os("scores.txt",std::ios::app);
os<<player.toStdString().c_str();
os<< " ";
os<<std::to_string((int)val).c_str();
os<<"\n";
os.close();
}
} | 1 |
788f1985242390ea812c7253fce64b28 | 7eda76c7d72e403dc1a8f92620ba7ed2 | Resolve the time span an an {@see IntervalInterface} starting at the given time point, with a length equal to this time span. | public long getInterval(long sometime); | 0 |
fb91f7aa146e22df545af36814196126 | 1771da91ab357abce2ded3409c8a6319 | Batch get the configurations of all workflows in this cluster. | def list_workflows(state: State) -> dict:
connection = CliOsduClient(state.config)
response_json = connection.cli_get_returning_json(CONFIG_WORKFLOW_URL, "workflow?prefix=")
return response_json | 1 |
845aa5403cfab86ff15464f5919293e3 | cdc3710b7be908b007351898e2aec32f | Based on https://stackoverflow.com/a/19053800 | function weighted_random_pick<T>(items: T[], weights: number[]): T {
for (let i = 0; i < weights.length; ++i) {
weights[i] += weights[i - 1] || 0;
}
const random = Math.random() * weights[weights.length - 1];
let choosen = 0;
for (let i = 0; i < weights.length; ++i) {
if (weights[i] ... | 1 |
a341a7776b88eada83954c40b3d524db | 4ad7ff3b8b66e68cf72c7dad9bc6e5ba | Toggles the location search bar hidden / shown. | class App extends React.PureComponent
changeLocation(){
this.setState({
businessSearchEnabled: false
});
} | 0 |
1743dd722784f9a1bcf77bca8d54ee3e | 249143552bf3bf53283d7342e70bfa51 | Check if the given CSS file exists. | {
boolean exists = find().byCss(css).exists();
Context.addXPathToNoHitCheck(css, exists);
return exists;
} | 0 |
c281c3b760a08bbd4f9ab379457aa74a | 3c4f7032f0240236a63d4205a8016089 | 提现申请查询接口 | class HtToCashController extends HtController
public function querycashapply()
{
$data = A('HtToCash:getApplyCash', [$_POST]);
$data ? info('ok', 1, $data) : info('暂无记录', -4);
} | 1 |
535a3cd2f8861ea2033a738312a60197 | c3813e05bcd4be192d19bb3554e637d6 | <para>処理を委譲する「イベント処理で、ビジネスロジックを実行する機能
(<see cref="Terasoluna.Windows.Forms.Events.IEventProcCompBizLogicExecuter"/>)」を取得します。</para> | namespace Terasoluna.BizLogic
public abstract class WcfBizLogicInfoManagerBase : BizLogicInfoManagerBase
[SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter",
Justification = "ファクトリメソッドであるため、利用側でのCastを不要にするために、引数から推測できないGenericパラメータを利用する。")]
public override TBiz... | 0 |
70203514bb1ef3419780e9ad97fda6d5 | b7ce5aa28d40a101b4ff174766ce5611 | This adds a property descriptor for the Transverse Bar Spacing feature.
<!-- begin-user-doc -->
<!-- end-user-doc --> | itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_MemberType_transient_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_MemberType_transient_feature", "_UI_MemberType... | 0 |
eea62a303ddbcb6f02a712960f0a73a0 | 6a17580e537a184da77f29774b186594 | Sets the exposure_type of this Exposure. | EAttribute getLocationType_Exposure(); | 0 |
fd1186b2b703df4d0bed6ec6c7aeaff5 | 7b4970444104d072dad156c08963f9f3 | Return a dictionary that maps test-name tuples to ITestResult
objects. This may return an empty or partially-filled dictionary
until the build has completed. | class ITestResult(Interface):
def getResults(): | 0 |
c009c573c7894700b6f2c53fa1330d59 | 0452a0dd222d1d03bebe52a840e6c4b8 | Untrash the comments of a post. | class CommentController extends BaseController
public function restore($id)
{
self::checkAdmin();
Comment::withTrashed()
->where('id', $id)
->restore();
return redirect()->back();
} | 1 |
02e6ffd522abbe2d69b74b4e22ce966b | 78221cdb119d915676ae5143fe5c6e9b | Set up a keypair for signing the tokens, initialize all kinds of different tokens for tests. | def init():
path = dirname(dirname(dirname(abspath(__file__))))
all_address_path = path + '/test/address.json'
all_address = loads(open(all_address_path).read())
token_abi_path = path + '/build/contracts/ComToken.json'
info_abi_path = path + '/build/contracts/TokenInfo.json'
contract_token_abi =... | 0 |
8785c851a39c72c3f6c80c5acca5d68d | a850cbb3bdb1324657fc366ff9110220 | Building up URL for getting .ics file | class Calendar
private function _get_add_event_url($event_id) {
return 'https://caldav.icloud.com/'.$this->user_id.'/calendars/'.$this->calendar_id.'/'.$event_id.'.ics';
} | 1 |
23944f4d53c8ec98f4e31cafb6b08303 | 3181209bff92603604ea830d13468614 | update shipping charge in cart if Pincode avail | class Xcentia_Coster_ProductController extends Mage_Core_Controller_Front_Action
public function setshippingpriceAction(){
$start = microtime(true);
if($this->getRequest()->getParam('key') == "gorhdufzk"){
$iProducts = Mage::getModel('xcentia_coster/product')
->getCollection(... | 0 |
0db9d642be0bd55b6622d65f3ed79d78 | 31e4abc650bab929d90019698cf792e5 | 发送sps和pps数据 | int SendVideoSpsPps(unsigned char *pps,int pps_len,unsigned char * sps,int sps_len){
RTMPPacket * packet=NULL;
unsigned char * body=NULL;
int i;
packet = (RTMPPacket *)malloc(RTMP_HEAD_SIZE+1024);
memset(packet,0,RTMP_HEAD_SIZE+1024);
packet->m_body = (char *)packet + RTMP_HEAD_SIZE;
body = (unsigned char *)pa... | 1 |
7283020b7ff12cbb580d06f5b031192a | b4517d7ae00339cca1295015e3f0a8d7 | 追跡番号の桁数チェック | private function checkSpanK3(& $sNumber): bool
{
if (!is_null($this->span)) {
$aDigitals = str_split($sNumber, 1);
try {
if ($this->min_span && (max($aDigitals) - min($aDigitals)) === $this->span) {
$aSpan = [];
$iMax = count($a... | 0 |
34bacf69b8d8f91bc84de5fdc5dc40be | 2f949b70364ae8c594b58a1e503e4d8f | 删除已上传的物业费账单数据 | namespace Skynet.IMedicareManage.MedicareRebirth.MR016
public class MedicalAPI
[DllImport("LxClient.dll")]
private static extern int Mxb_DelFeeList(string AsOrganID, string aCardID, string aDiagno, StringBuilder DataBuffer); | 0 |
68b9805e6e057bb0511bb73a9741d84a | 08a522a0fc45949d5417fc754afb7603 | Visit a parse tree produced by CSELParser#if_stmt. | class ExprVisitor(ParseTreeVisitor):
# Visit a parse tree produced by ExprParser#root.
def visitIfStmt(self, ctx:ExprParser.IfStmtContext):
return self.visitChildren(ctx) | 0 |
1bc23e20f9327638f73bd59166e8c27b | 3fdfef8716a2118bc89d8f4ed0624261 | Apply spatial filtering to the dataset across the spatial dimensions. | def spatial_filter(x, y, z, dx, dy, n_sigma=3.0):
Nn = int((np.abs(y.max() - y.min())) / dy) + 1
Ne = int((np.abs(x.max() - x.min())) / dx) + 1
f_bin = stats.binned_statistic_2d(x, y, x, bins=(Ne, Nn))
index = f_bin.binnumber
ind = np.unique(index)
zo = z.copy()
for i in range(len(ind)):
... | 1 |
37409cc3fa841790367f4684e7c2689b | 22523b553e85312cb9f1c85ecfb7e49e | Define how to assess the reduced data.
The defined parameters are:
.. include:: ../tables/reductionassessmentdef.rst | wavepixeladj = ""
if (reducer.wide_angle_correction and reducer.transmission_calculator.output_wksp):
_issueWarning("sans solid angle correction execution")
SANSWideAngleCorrection(SampleData=workspace,
TransmissionData = reducer.transmission_... | 0 |
6ecf22b1fd691f0827c90af34c22caaa | 9c442dc7f153b7f0af71c5eb92448e84 | 创建真实订单时, 判断库存是否足够 | public boolean isGoodsEnoughByOrderDetail(OrderDetail orderDetail) throws Exception; | 1 |
324dbd9b48c4048fadabbba9bb42557d | 840eb889d7046a8108b5d11baabd36c3 | format a pattern to case-insensetive one. "Abc" -> "[Aa][Bb][Cc]" | def insensitive_glob(pattern):
def either(c):
return '[%s%s]'%(c.lower(),c.upper()) if c.isalpha() else c | 1 |
01ef3bcb993812deb995c569848b17a8 | c64fad69d0a4f6d592a43fb4ec7654c1 | Поиск относительных оценок d_i | users_ratings = line[1]
a = list()
dctuserratings = {}
for pair in users_ratings:
a.append(float(pair[1]))
dctuserratings[pair[0]] = float(pair[1])
mn = np.mean(a)
dn1 = math.sqrt(np.sum((a-mn)**2))
for item in dctuserratings:
v... | 1 |
cbf2b7d5586f135b306c97a37af71d4e | 60343c57466db7e6f03ff7607c8c4348 | Iterate through all elements in the labeled data and add all selected ones to the list of maps | class ActiveDataset():
def add_to_labeled(self, indices):
if self.save_queries:
save_to_csv(self.queries_file, indices)
self.masklabeled[np.array(indices)] = True
self.update_labeled_list() | 0 |
d4109827c3d9e23f7ec4f20b3920143a | ff460a0806a0a7fdfc40dd873e51223c | Sets the visibility state of the login modal to visible. | export class VersionComponent implements OnInit
loginModalShow() {
this.authService.displayAuthModal(true);
} | 1 |
9307346bda6b1c9e516a6b322d2e0882 | 802da3751ad417e6d9ff556e8fb4fe12 | Create a SelectiveScrollingGrid. | this.cols = cols;
this.rows = rows;
this.screen = this.allocateScreen_();
this.cursorCol = this.cursorRow = 0;
this.resize();
} | 0 |
4a326a2a567dabc2ea6f907f773ad033 | 050759b5fc2bdfcf0cdabb21c7f89b22 | @brief Get current scan configuration. | class scanner(object):
def get_scan_pattern(self):
req = connection_pb2.Request()
req.get_scan_pattern.SetInParent()
return self._connection.send_request(req).get_scan_pattern.config | 1 |
434a6497bab82df82b702fab66f16556 | fe82e3e355f4ea080d4cd00802b21cdd | 点击“搜索”可以从数据库中搜索需要的方剂信息 | namespace prozect_client
public partial class client : Form
private void Search_client_Click(object sender, EventArgs e)
{
this.BringClient();
ConnectServer_SendData.Visible = true;
AddMedicine.Visible = true;
} | 0 |
d58a74aff705f5dc025b66d303572945 | b16b6b0728dd1b4fb76238d842ffd046 | Assert trying to release invalid resource fails. | namespace i5.Toolkit.Core.Tests.Utilities
public class ObjectPoolTests
[Test]
public void ReleaseResource_PoolDoesNotExist_ThrowsInvalidOperationException()
{
TestObject testObj = new TestObject(1);
Assert.Throws<InvalidOperationException>(delegate
{
... | 1 |
ce243e0066d087052289ad5879e289a8 | 602adc6ffe1b227d1d4ddbbd935afee2 | Throws an error for a not yet implemented method with the given name called by the SAPUI5
framework. The error message includes the arguments to the method call. | namespace Pchp.Core
[DebuggerNonUserCode]
public static class PhpException
public static void MethodOnNonObject(string methodName)
{
throw ErrorException(string.Format(ErrResources.method_called_on_non_object, methodName));
} | 0 |
fa90dd7f1b3a9d2c8fdcbac5228958a2 | 1561000ec3f90b2772a92880755ba72b | The GiST Union method for boxes
returns the minimal bounding box that encloses all the entries in entryvec | Datum g_cube_penalty(PG_FUNCTION_ARGS)
{
GISTENTRY* origentry = (GISTENTRY*)PG_GETARG_POINTER(0);
GISTENTRY* newentry = (GISTENTRY*)PG_GETARG_POINTER(1);
float* result = (float*)PG_GETARG_POINTER(2);
NDBOX* ud = NULL;
double tmp1, tmp2;
ud = cube_union_v0(DatumGetNDBOX(origentry->key), DatumGetN... | 0 |
053ca56d0f2541499ccfc9500efaed65 | 9e02afd743dbae4159f23985ecf0331b | Gets the statement end character. | get state(){
return STATE_STATEMENT_ENDED;
} | 0 |
18973fc52c9433160bc7c63db88da0ab | 0f028c032349a50a91d22bf1903a44d0 | 通过$topicid删除话题 | $id = $_REQUEST['id'];
$topic = new \home\model\topic;
$res = $topic->delete($id);
if($res){
$this->assign('success',1);
$this->assign('info','删除成功!');
}else{
$this->assign('info','删除失败!');
}
$this->ajaxreturn();
} | 1 |
81c2a3f1fb41ec487cee8cffd9668e3b | acae742281728ea7c17236c6a0806926 | 根据ID删除挂件 | class PluginModel extends \Think\Model\AdvModel
public function delbyid($id)
{
return $this->where(array('id' => $id))->delete();
} | 1 |
024ca8c2e78d153867f5fd7b9f512b73 | 0d6cead79a8d0b78723160abfe9514c0 | Update the AR status for the entry in the list. | this.setState((state, props) => ({
report: this.setEntryStatusRecur(
state.report,
selectedEntries,
newStatus,
),
}));
} | 1 |
529ba98aeb13f2780d5108be9b0205fd | 61578cd03dc2702984eb870828fac3d3 | Linear simulation of LTI system. | def simulate_step_response(sys, t=None):
_check_for_state_or_transfer(sys)
try:
_check_for_state(sys)
except ValueError:
sys = transfer_to_state(sys)
if t is None:
tf, ts = _compute_tfinal_and_dt(sys)
t = np.arange(0, tf+ts, ts, dtype=float)
else:
t, ts = _che... | 1 |
6129202c2d8073e6f24ce25183bb9993 | db4e2a54741eb40d26fd6dcf77597b05 | Extracts the first frame of the video. | class ffmpeg
public function extractFrame($extract_begin_timecode='00:00:00')
{
$this->extractFrames($extract_begin_timecode, $extract_begin_timecode, 1, 1);
} | 1 |
edf7da34e8a799e1e1baa393058d97c9 | e2a601eed737b23ad9eb2437d0d227dd | !
\brief Returns a pointer to the console parameters. | try:
return console.console_c
except AttributeError:
warnings.warn(
(
"Falsy console parameters are deprecated, "
"always use the root console instance returned by "
"console_init_root."
),
DeprecationWarning,
... | 1 |
3ae62cf385f02de8184b395946849d4f | 8c3a569d6b5dbc01dd6219b2cda0a6cd | function to print weapon info | void WeaponBay::printWeaponList()
{
for(list<Weapon*>::iterator it = weaponList.begin(); it != weaponList.end(); it++)
{
cout << (*it)->getName() << endl;
cout << "" << endl;
}
} | 1 |
06c27d2661ee4d942da04012356e0c66 | 189f53b42a8fdff5e68117a33437a17e | Deleting the specific customer out of the django database. | user = get_object_or_404(User, id = request.POST['user_id'])
user.delete()
return HttpResponse('User deleted') | 1 |
275677604ea89d0f27d4132754bb3304 | df528f27a4f1c9e27897f7f24a290a4b | Check that final state is logged correctly when using measurements. | state = qml.math.array(two_qubit_state)
shots = qml.measurements.Shots(10000)
mp = qml.var(qml.prod(qml.PauliX(0), qml.PauliX(1)))
result = measure_with_samples(mp, state, shots=shots, rng=123)
assert result != 1
assert np.allclose(result, 1, atol=0.05) | 0 |
f3c50571163107ac2ead15e4dab0d6b6 | 156277be1c68fd3f03ce47a81e303812 | Kurangi nilai absis | void GeserKeSbX (POINT *P)
{
POINT P1;
Ordinat(P1)=0;
Absis(P1)=Absis(*P);
*P=P1;
} | 0 |
2520896a3fa1828e8b31d1bdd8b1b66f | 94882da1c3197ea0344f21b439039d0a | Obtiene el listado de alumnos que pertenecen a una AMPA | export class ActaCompromisoComponent implements OnInit
getAlumno(): void{
this.servicioAlumno.getAlumnos().subscribe(
(res) => {
this.listadoAlumnos = res;
},
(error) => {
this.alertas.alerterror();
}
);
} | 0 |
45b7092ba3de01d590e4e02940ff4882 | d8bf537654a42ef7f450477774153c7a | Compute gradients for all weights in the LSTM | class GRUCell(RNNAbstractCell):
def parameters_grad(self):
n, h = self.Wz.shape
Hold = np.concatenate((self.Hinit[:, None, :], self.H[:, :-1, :]), 1)
Hold = Hold.reshape(-1, h)
DWz = self.X.reshape(-1, n).T @ self.DSz.reshape(-1, h)
DWr = self.X.reshape(-1, n).T @ self.DSr.reshap... | 0 |
5b8231a1b921fe792e539649b2f77c36 | a446e7d4ca192bb2302c1782447200f9 | 获取通讯记录列表(分组取一组中的最新值) | Observable<BaseResponseBody<MessageItemOther>> getChatRecordGroup(
@Query(ApiInfo.GET_CHAT_RECORD_JOIN_CODE) int joinCode,
@Query(ApiInfo.GET_CHAT_RECORD_PAGE) int page,
@Query(ApiInfo.GET_CHAT_RECORD_SIZE) int size
); | 1 |
84db5d6976247234d4aa391ba9b9017e | 45e3a166b9b376b9cadabdcc5b60a06f | Compile CoffeeScript. | def run_coffee_node(content):
builtins = read(os.path.join("../pythonjs", "pythonjs.js"))
write("%s.js" % tmpname, builtins + '\n' + content)
return run_command("node %s.js" % tmpname) | 0 |
e8e5eca131e6b47868f94d3a2e418dd2 | 018f4e1c8de44330737df8dbe564a4f3 | add bytes read from client socket to the input buffer | public void appendBytes(org.apache.tomcat.util.buf.MessageBytesRemoteInterface mb) throws RemoteException; | 1 |
ccc4c4e30d61ee2150c5f12a4e8f7b0f | 3bab2348662748553b0c658a31a73ffa | function to be called when a drop is picked up. Checks what position the drop was in and makes the position available for respawn. | void AIDirector::HealthPickUpRespawn(HealthPickUp *healthPickupSprite, float positionX, float positionY, bool healthTrigger)
{
if (healthTimer >= 10)
{
healthTimer = 0;
healthPickupSprite->GetHealthPickUpSprite()->setPosition(Vec2(positionX, positionY));
healthPickupSprite->GetHealthPickUpSprite()->setVisible(t... | 1 |
5619a20a1de07cbbb4c4224429179ed8 | e1610953199d71a7d7f60700d1fa53b7 | \brief Returns whether connected to spawnd on the given core. | inline bool spawnd_state_exists(coreid_t core_id)
{
return spawnds[core_id] != NULL;
} | 1 |
651d7961eaa122639dc2434a842acdd6 | 0ef0339243cdc28c30c977ef100f693d | Generates the basic
polymorphic relations prerequisites. | from apis_core.apis_entities.models import AbstractEntity
from apis_core.apis_relations.models import AbstractRelation
from apis_core.apis_vocabularies.models import AbstractRelationType
def create_function_get_related_entity_class(related_entity_class):
return classmethod(lambda cls: related_en... | 1 |
98945899ab2841c86b101dea54530e80 | d1171658e7ee143c963e038470728874 | This routine identifies and fits emission lines in a 1-dim spectrum (ie generally speaking it finds and fits peaks in a 1dim array), using "scipy.optimize.curve_fit".
Detection threshold, background threshold, and maximum threshold can be provided as keyword parameters. Different models for the peak-like function can b... | tt = np.array(tt)
ff = np.fft.fftfreq(len(tt), (tt[1] - tt[0]))
yy_stored = yy
guess_freq = 0
guess_amp = 0
guess_offset = 0
for i in range(0, len(yy_stored)):
yy = np.array(yy_stored[i])
Fyy = abs(np.fft.fft(yy))
guess_freq += abs(ff[np.argmax(Fyy[1:])+1])
... | 0 |
97732407d09de772ba67bc4522782cdb | 023bde18b3c342bf4ccdc38d7230c335 | Calculate bitrate, done it here because requires data from multiple chunks | long ov_bitrate_instant(OggVorbis_File *vf){
int link=(vf->seekable?vf->current_link:0);
long ret;
if(vf->ready_state<OPENED)return(-131);
if(vf->samptrack==0)return -1;
ret=vf->bittrack/vf->samptrack*vf->vi[link].rate+.5;
vf->bittrack=0.f;
vf->samptrack=0.f;
return(ret);
} | 1 |
f2c03b45c77dd45da6c698fb79506ecf | 40e50750e3aaca4c8f11f1741e7b9bc3 | Tests that lists are properly flattened to avg/stddev. | t_in = TimeSeries(TRAFFIC_DATA_IN)
t_out = TimeSeries(TRAFFIC_DATA_OUT)
t_merged = TimeSeries.timeseries_list_merge(dict(name='traffic'), [t_in, t_out])
self.assertEqual(t_merged.at(2).get('in'), 26)
self.assertEqual(t_merged.at(2).get('out'), 67)
self.assertEqual(t_merge... | 0 |
b2d029f0974c3355abf6e7f89e0b8b6f | 7e647043280b160222fcd3228b325e12 | function for solving the 15 slide puzzle | def fifteen_puzzle(deck):
fields = [Fours(92, 45), Fours(277, 45), Fours(463, 45),
Fours(92, 152), Fours(277, 152), Fours(463, 152),
Fours(92, 260), Fours(277, 260), Fours(463, 260),
Fours(92, 370), Fours(277, 370), Fours(463, 370),
Fours(92, 475), Fours(277, ... | 0 |
7768685e1b2c0c6560ae9bfd1d0a17b1 | 76a1c4c323f3aa25aa1edb1f1f03de52 | Test het opgeven van een te lange referentietekst (max 35 tekens). | class AfzenderTest extends TestAbstract
public function testCompanyNameTooLong()
{
$tooLong = str_pad('x', 36);
(new Afzender)
->setBedrijfsnaam($tooLong);
} | 1 |
d91a9f258f0c543007135475c09c49f9 | 43862f5cefba79174ebfd98678f92abd | 根据学号查看借出信息 | Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<InfoBorrow> list = new ArrayList<>();
try {
connection = JdbcUtils.getConnection();
String sql = "select * from infoborrow where borrower_cardno = ?"... | 1 |
8f5c31b81fa564a4833bd112fa6d20f6 | e93e8db791b5a58c51ad431f579d2443 | This function enables the free view camera mode. | {
mainCamera.enabled = true;
topViewCamera.enabled = false;
freeCamera.enabled = false;
ActiveCamera = mainCamera;
} | 0 |
a99e8bd41b2ec4f48796ddb866f90618 | c7c81d9b7e6df8fb7570cf99997b06fd | 处理扫描类 | final class Scan
public function run()
{
$notIgnoreClass = [];
foreach ($this->dir as $dir) {
$dir = FileSystem::getAbsPath($dir);
$dirScanner = FileSystem::filterDirScanner($dir, function (SplFileInfo $f) {
if ($f->isDir() && Str::endsWith($f->getFilename(),... | 1 |
50a125563615a83856a479b4df3cbf66 | 66bc4b782cb7d2addc57296afeb71d47 | Get the trap base type (TRAP_BASE_TYPE_*) of oTrapObject. - oTrapObject: a placeable,
door or trigger | public class Traps extends PassiveRoomObject
public int getSpecial(){
return special;
} | 0 |
e3d19b269e75887f572e839d3a352c16 | 556afccb1fdf3cc908efc3cde696feb2 | 上传带有截图信息的图片,进行截图并保存为用户头像 | namespace TheFamilyFriend.Controllers
[Authorize]
public class HomeController : BaseController
[HttpGet]
public ActionResult UploadHeaderPic(string id)
{
if (string.IsNullOrWhiteSpace(id))
{
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequ... | 0 |
027c118f19f01ec4f8e9f7322b0ffdcb | 94f468a85a006f4e8c3616b75bbf8cd7 | 判断是否有父窗口 | function GUI控件类:是否通知父控件()
return self._isok and self._wnd:IsNotifyParent() or false
end | 0 |
4be81b308152f437473dabf366fb4d4e | 99eb10781e476d4935f6e1699f65b1de | Sets whether the textbox is marked as containing an error - if any one
of them is, then the program will not attempt to calculate the color
from the three values. | namespace Montecarlo
public class BaseForm : Form
protected void SetErrControl(TextBox form)
{
form.BackColor = CST.ERR_COLOR;
} | 0 |
7715591dc9c1541e9aa149a3acef3fc1 | 5ddcf0be9fcd14cfd7459d1394bbfef6 | Returns the most frequent value in a sequence
If 2 values have the same frequencies, return the smallest one | def most_frequent(test_list):
occurence_count = Counter(test_list)
return occurence_count.most_common(1)[0][0] | 0 |
0d0ce4ba5d484a61307ace0a341b7276 | 5907f40c1d5d9eb7de8149ef6b6a33d6 | Check that you are not given the option to cast anything if there are no valid choices. | class test_main(unittest.TestCase):
def test_validateChoice(self):
pyip.validateChoice('dog',['dog', 'cat'])
with self.assertRaises(pyip.ValidationException):
pyip.validateChoice('moose',['dog', 'cat']) | 0 |
d317247a73a48a1204e1235566139ffe | 56c28050616d4f415d8e1701d2383241 | The same thing, but in promise style: | return new Promise(function (resolve, reject) {
let img = document.createElement("img");
img.src = githubUser.avatar_url;
img.className = "promise-avatar-example";
document.body.append(img);
setTimeout(() => {
img.remove();
resolve(githubUser);
}, 3000);
});
} | 1 |
0ba2248b10c5f8822de6673cab48e492 | 042cdb28e9bd71ca6a971bd5e0b58a12 | Sets the view's visibility to [View.GONE]. | if (getVisibility() == View.GONE) {
return;
}
mAnimatorSet.cancel();
stopCountDown();
setVisibility(View.GONE);
} | 1 |
22a221cd64504c2c28b09a91c014fcbe | b5f99277d3b212dd02e7a0e93d593c40 | Despliega contenido de un archivo de unix | bool mostrar(string nombArch)
{
ifstream archivoCargar;
string aux;
archivoCargar.open(nombArch);
if(archivoCargar.is_open())
{
cout << "--------------------------------------------------------------" << endl;
while (!archivoCargar.eof())
{
getline(archivoCargar, ... | 1 |
d25a6f051c900e93afa27c011c495246 | 5509df881cf4e54c2c234a4d4749a93b | 将Q、K、V拆分到多个头 | class MultiHeadedAttention(nn.Layer):
def forward_qkv(self, query, key, value):
n_batch = paddle.shape(query)[0]
q = paddle.reshape(
self.linear_q(query), [n_batch, -1, self.h, self.d_k])
k = paddle.reshape(self.linear_k(key), [n_batch, -1, self.h, self.d_k])
v = paddle.resha... | 1 |
742835f1ea5a5d2f885fe55b90982e3c | 473c8ad31d9d378ba7381f3362c2b1fa | Sends a request for current user's stats to Steam.
_This command is called within Init so AppGameKit code will likely never need to call this command explicitly._ | {
if (_authKey == null) throw new Exception("Must be logged in to call this method");
string serializedJson = JsonWrapper.SerializeObject(request, PlayFabUtil.ApiSerializerStrategy);
Action<CallRequestContainer> callback = delegate(CallRequestContainer requestContainer)
... | 0 |
83540084f7153aa2dcfa87eba25adec4 | 2a760959811ea53cfa8b39b2a27c4c7e | @brief Convert private LPM route entry union to IP route entry union
None | static GT_STATUS prvTgfConvertGenericToDxChL2MllPairEntry
(
IN PRV_TGF_L2_MLL_PAIR_STC *l2MllPairEntryPtr,
OUT CPSS_DXCH_L2_MLL_PAIR_STC *dxChL2MllPairEntryPtr
)
{
GT_STATUS rc;
cpssOsMemSet(dxChL2MllPairEntryPtr, 0, sizeof(CPSS_DXCH_L2_MLL_PAIR_STC));
PRV_TGF_STC_S2D_FIELD_COPY_MAC(dxChL2Mll... | 0 |
da3635c7498d1d86702027cd82c5f698 | 8a2876359b125b4fb798ee1d8652aa02 | 在两个顶点之间添加有向边 | namespace Sobey.DataStructure.Graph
public class MyAdjacencyList<T> where T : class
public void AddEdge(T from, T to)
{
Vertex<T> fromVertex = Find(from);
if (fromVertex == null)
{
throw new ArgumentException("头顶点不存在!");
}
Vertex<T>... | 0 |
17934cc069f734075e124f61dd3674c8 | bbfe76d75de9f290ce077bfa28d0073c | Merges genres from a file | String genreList = "";
int lineNum = Integer.parseInt(inFile.nextLine());
for (int i=0; i<lineNum+1; i++) {
String s = inFile.nextLine();
genreList += s + "\n";
}
return genreList;
} | 1 |
240da8e215c3929022e63ea4f554334a | 6c6bc29b473ff60118a6fc3bf8f5728f | Create cron entries if they don't exist yet
=== Return | empty($data['updated']) && $data['updated'] = $this->getModificationTime($data['name']);
empty($data['runningUser']) && $data['runningUser'] = $this->currentUser;
empty($data['rightUser']) && $data['rightUser'] = $this->currentUser;
$this->Model->addRunningCron($data['runningUser... | 1 |
52d6eaf5e85ebc3b65fad02e394cc711 | 85cececcc62bcb1c42c3030ee9a5ac60 | Gets a single data cell from the top of the house across all dimensions. This isn't generally going to
yield any particularly useful information, but rather, is meant as a quick and easy way to hit the cube
with the configured dimensions and make sure they're all represent and that you can in fact perform | {
if (_cells.ContainsKey(x) && _cells[x].ContainsKey(y))
{
return _cells[x][y];
}
return null;
} | 0 |
4d846a31452ea5ab32cedbac4ac10ff1 | 6a529afbe487caa729c9d77efd99016a | 修改前查询指定餐厅信息 | public String preUpdateApp(Integer resID,String currPage,Model model){
WmRestaurant tmpRes = rd.getResByID(resID);
model.addAttribute("tmpRes",tmpRes);
model.addAttribute("currentPage",currPage);
return "restaurant/modRes";
} | 1 |
95d0d378781164a119aa8b91b4239a71 | 7c28b279869c3c9887970121346af52c | Calculates document rank based on tfidf | len_doc = len(ltf)
idf = []
for a in list_df:
idf.append((round(m.log10(len_doc / a), 3)))
return idf | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.