query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
c4f7956fc139bf994613c3baf9e65d8c | 99868378827f6d90b175859383bea442 | 将一个User实例保存到数据库
同时添加一个时间戳 | @Service("userService")
@Transactional(readOnly = true)
public class UserServiceImpl extends BaseServiceImpl<User, Integer> implements IUserService{
@Transactional(readOnly=false)
public void save(User user) {
entryptPassword(user);
user.setCreateDate(DateUtils.getSysTimestamp());
userDao.save(user);
} | 1 |
360b73c9cd48cd1295ed69d7c8948a98 | 79585a05cf81dbd455a6a318d731ef1c | Rotate length 3 vector *v* about *axis* by *theta* radians. | axis = axis / np.sqrt(np.dot(axis, axis))
a = np.cos(theta / 2)
b, c, d = -axis * np.sin(theta / 2)
rot_matrix = np.array(
[
[a * a + b * b - c * c - d * d, 2 * (b * c + a * d), 2 * (b * d - a * c)],
[2 * (b * c - a * d), a * a + c * c - b * b - d * d, 2 * (c * d + a * b)... | 1 |
faad0d5c58a843da659e1bdd4dd30fd6 | 5da2bdbe41763b6466c98b42a428729e | Replaces all static fields in a string with their values.
Fields are detected by the pattern <code>"${<field name>}"</code> | Pattern p = Pattern.compile(VARIABLE_NAME_PATTERN);
Matcher m = p.matcher(textToReplaceIn);
StringBuffer buffer = new StringBuffer();
while (m.find()) {
String varName = m.group(1);
String value = get(varName).toString();
m.appendReplacement(buffer, va... | 1 |
cdb6996970013b7deb28f18796f0a9f0 | 30937d0d8fc74b2815f16534248765ce | Delete a product from an Event | $this->authorize( 'touch', $event);
$event->delete();
return response()->json( [ 'status' => 'event.create.deleted' ], 200 );
} | 0 |
7e13c801bb1c56eee9f4978f36268368 | 0cad381208667bbe2e6ba7b6c7c2db5e | 客账账务信息数据绑定后的事件,用于注册其中行的复选框更改事件 | function subCheckboxEventInit(){
$("input[type='checkbox'][class!='borrowMonthClass'][id!='SelectAll']").change(function(){
var url = ctx+"/matchingcreditor/ajaxMoney?creditMonableId=";
var obj = $(this);
checkboxFunMonth(url,obj,false);
});
$('#SelectAll').click(function(){
if ($("#SelectAll").attr("checked... | 1 |
cc15b8b431f55891a8640b93999f213f | ee39c8e23fd84aba87668ae087294ff3 | <p>Description of the Category used by external search engines for improved search engine performance.</p> | public abstract class YouTubeCategoryBase extends org.semanticwb.model.SWBClass implements org.semanticwb.model.Descriptiveable
public String getDescription()
{
return getSemanticObject().getProperty(swb_description);
} | 0 |
eaf8f1d1067d7237d14f299019c991c1 | b1bbb867e419bbd152a54dcc44d3c501 | update the status of appointments daily | let current;
if (day) current = moment(day).format('DD/MM/YYYY');
else current = moment().format('DD/MM/YYYY');
if (moment(event.start).format('DD/MM/YYYY') === current)
this.todayAppointments.push(event);
} | 0 |
130662dd967e2cd9536083546bf70090 | 68669c63a3e6aae9bbdedd249864db87 | @brief De-Initializes the OSPI interface. | void wspi_lld_stop(WSPIDriver *wspip) {
wspi_lld_sync(wspip);
if (wspip->state == WSPI_READY) {
wspip->ospi->CR = 0U;
dmaStreamFreeI(wspip->dma);
wspip->dma = NULL;
#if STM32_WSPI_USE_OCTOSPI1
if (&WSPID1 == wspip) {
rccDisableOCTOSPI1();
}
#endif
#if STM32_WSPI_USE_OCTOSPI2
if (&WSPID... | 1 |
26055588585a586d77052e9c30770ad6 | 4e0b222f7a0f7da1ae37666cbf273415 | First we make sure there is no existing config file,
say from a previous run | class ConfigScript:
def make_new(self):
try:
makedirs(path.dirname(self.config.path))
except OSError as exc:
if exc.errno != 17:
raise
try:
open(self.config.path, "w").close()
chmod(self.config.path, stat.S_IRUSR|stat.S_IWUSR)
... | 0 |
f713d6f3950f4cafc9d283b75173e11b | 29e887282093248b68cd06cdf2d66081 | computes the affinity between a TF and the DNA at a specific position using a known sequence affinity 3' -> 5' | int translate(char c1, char c2 ,char c3, int seqno, int pos)
{
int amac;
if(c1 == 'T')
{
if(c2 == 'T')
{
if(c3 == 'T') amac = 18;
if(c3 == 'C') amac = 18;
if(c3 == 'A') amac = 16;
if(c3 == 'G') amac = 16;
}
if(c2 == 'C') amac = 2;
if(c2 == 'A')
{... | 1 |
99726ed1513016ceefeb954614326741 | c77a1ffdc8bda045a76aa9e59e28a399 | 일정 시간동안 무적상태 활성화 | public class InvincibleHelper
public void goInvincible()
{
goInvincible(INVINCIBLE_TIME_HIT, true);
} | 1 |
2e4a99cc622c8c7c005a4a834d96db90 | 977bd0e7d5617a681d62eb597a25cf90 | 添加右键菜单项 | rightMenu = QtGui.QMenu(self.ui.containerList)
showAction = QtGui.QAction("show", self, triggered=self.showItem)
rightMenu.addAction(showAction)
removeAction = QtGui.QAction("delete", self, triggered=self.deleteItem)
rightMenu.addAction(removeAction)
rightMe... | 1 |
697db283eb6d4c917a44947459627863 | b122d134bef477eaff21143741a1fe1a | 마지막 Sequence에 대한 값만 Loss를 계산한다. | class TotalLoss(nn.Module):
def forward(self, outputs, target):
seq_logit, sen_emb = outputs
seq_label, seq_mask = target
seq2seq_loss = self.compute_loss_of_seq2seq(seq_logit, seq_label, seq_mask)
similarity_loss = self.compute_loss_of_similarity(sen_emb)
return {'loss': seq2seq... | 0 |
a57321467ec676505c4c8555121c8bf8 | d5673b553c646aff42165ebaafdd372a | Calcula um passo no método de Euler | y = np.zeros([m])
y[0] = y0
for i in range(0, m-1):
f = funcao(x[i], y[i])
ff = funcao(x[i] + h, y[i] + h*f)
y[i+1] = y[i] + 0.5*h*(f + ff)
return y | 0 |
dddc16bc8621d5fb7000d62af62feacd | 75d6afd1d59e77be7e425c0ca27e8498 | Returns the EntityManager
Fetches the EntityManager from ServiceLocator if it has not been initiated
and then returns it | public class PersistenceManager
public static EntityManager getEntityManager() {
return PersistenceInitializer.getEntityManager();
} | 0 |
b1a628d65602a7e1ac8e66943bbac94f | e9858ad6eeca8e75692b30d728cd6908 | Close the connection with labjack | class LabJackController(object):
def endStream(self):
localID = c_long(self.idnum)
errorCode = cDrivers.AIStreamClear(localID)
self.ErrorHandler(errorCode)
print "LabJack Stream Closed" | 1 |
a63ac56eb91494ee5e5df576fe15052c | 5970919b6b31658a3d7950a3c49c64b9 | フィールドの囲み領域を描画します。 | namespace nitkagoshima_sysken.Procon29.Visualizer
public class DrawField
protected void DrawEnclosedCell(Graphics graphics)
{
DrawEnclosedCell(graphics, Calc.Turn);
} | 1 |
8162ab4e111e3b544c4729726fdd6bfc | a55db7c72991cb8e0c4338f9f0e6b4af | P-gain of front wheel P-controller model (e.g. based on the fitting the RW data to simple P model) | const pion_flt *p,
const double g
)
{
return p[eqPG]/(g-1.)/p[eqRO];
} | 0 |
8ad64da78b8a6fbe764ed1a33a6ba9e3 | c9c6036737fb7bab42e95cfbd8cc3e12 | 店家註冊完成頁 | class RegisterController extends Controller
public function getComplete(){
return view('requester.register.complete');
} | 1 |
5aa759cb76f741029f39df65af489ddf | 6f2ab5ddcaf4b74807e9c4f0946264c9 | 生成create请求post的json参数 | class Util_ApiSftx extends Util_Curl
private function _createJavaPost($post){
if (!count($post))return false;
$postStr='';
foreach ($post as $key=>$value){
if (!is_array($value)){
$postStr.="{$key}={$value}&";
}else{
foreach ($value as $childKey=>$childValue){
$postStr.="{$key}={$childValue}&";... | 0 |
5df9939bfd4cc8b883f2c62d2f1cd5dc | b77af4ff5d2bb5cf17154a51c8a4921d | Check to see if StreetNumber property is set | {
if ($this->numberOfStreet !== $numberOfStreet) {
$this->numberOfStreet = isset($numberOfStreet) ? $numberOfStreet : '';
}
} | 0 |
bc1fd814956633831c1fe8739ca4367c | ebf02cdc442c008b5d07927794d51849 | Sets who last updated the appointment | public class Appoinment_view_main
public void setLastUpdateBy(String lastUpdateBy) {
this.lastUpdateBy = lastUpdateBy;
} | 1 |
1751ee51ebfaaddebc4123ee2a7c7fef | 03925c63d10dbebe49ed642494f302a6 | 根据医生编号和手机号 查询该人是否已被邀请过 | @Select("select c.name companyName,u.id userId,u.securephone phone from users u,companies c where u.id=c.userid and c.verifystatus='审核通过' and u.securephone=#{phone} ")
public InviteRs isExistsSupplyer(@Param("phone") String phone); | 0 |
e493e8dc89fc3d1cab1a194617e0ce2d | 21035631fb112016a3d2422d21444e58 | Método que permite limpiar los controles del formulario. | {
try
{
Cmb_Anio.SelectedIndex = -1;
Cmb_Meses.SelectedIndex = -1;
Cmb_Cuenta_Inicial.SelectedIndex = -1;
Cmb_Cuenta_Contable_Final.SelectedIndex = -1;
Chk_Movimientos_Saldo_... | 1 |
ed915652f29fee22f4038bbc43c038db | 8d365856252eed38c1263ba6bdff92fc | 过滤掉自己给自己的赞 | const { isLogin } = this.state
const uid = isLogin && isLogin.id
if (!isLogin) {
return this.props.history.push('/user/login')
} else if (isLogin && isLogin.loginname === loginname) {
return this.$showMsg('亲,不能给自己点赞!')
}
this.$request({
method: 'post',
url: `/reply/${id}/... | 1 |
c8a886b365c560fcf035771ad57c2cf3 | 2224ff158c87a3637499aa59cff5232c | ! \brief Drops all messages in the queue with a certain ID | namespace Kitsunemimi
namespace Project
void
ReplyHandler::removeAllOfSession(const uint32_t sessionId)
{
spinLock();
std::vector<MessageTime>::iterator it;
for(it = m_messageList.begin(); it != m_messageList.end(); it++)
{
if((it->completeMessageId & 0xFFFFFFFF) == sessionId)
{
... | 1 |
9c61f41c5543e7deb35b5ce79793a6b9 | 19ef3c6d7f070a664c983f5ddfb49e5d | makes a deep copy of nested arrays | let copy = [[],[]];
for(let i = 0; i < myArray.length; i++){
if(Array.isArray(myArray[i])){
for(let x = 0; x < myArray[i].length; x++){
copy[i].push(myArray[i][x]);
}
} else {
copy.push(myArray[i]);
}
}
return copy;
} | 0 |
9c119a65433322663c55b9ae880e805f | b4693f79724883517a88f1c451350314 | Récupère la commande envoyée par le serveur depuis la queue de communication | def get_command():
print("get_command: ", my_command_queue)
return my_command_queue.get() | 1 |
d37181101f79bb73b749f1efadb6d3f0 | ee528519a09300f806544e02d7c1c7d8 | Displays maskpage. | function showMask() {
$('.stigmod-mask-white').show();
$('.stigmod-loader').show();
$('.stigmod-loader-text').show();
} | 1 |
4a74759d3a12a0657656a0ba9dad2f93 | a647fa2c93dbc97b235db38e1da2db6a | Called by servers to begin an asynchronous operation to authenticate the client, and optionally the server, in a client-server connection. This method does not block. | namespace Nistec.Messaging.Tcp
public class TcpClient : Nistec.Net.Tcp.TcpClient
public bool AuthAsync(AuthAsyncOperation op)
{
if (this.IsDisposed)
{
throw new ObjectDisposedException(this.GetType().Name);
}
if (!this.IsConnected)
... | 1 |
aeacab9fd396a1c97b18336b5ae9f6f6 | afed998a565d54cc1f2848de6dc5dc96 | Method to update balance by account number. | public abstract void updateBalance(Integer accountId, float amount); | 1 |
03d271348e96b4476eba17bd862a269e | bcce5dbc27709da2f5470953be4a97c6 | bestow tokens on boss death and unlock riftgate | if (discovered == levelOneCriteria) {
runeUnlock[3] = 1;
runeUnlock[4] = 1;
runeUnlock[5] = 1;
itemUnlock [3] = 1;
itemUnlock [20] = 1;
itemUnlock [26] = 1;
itemUnlock [27] = 1;
itemUnlock [31] = 1;
itemUnlock [32] = 1;
itemUnlock [36] = 1;
itemUnlock [39] = 1;
itemUnlock [... | 0 |
a864ea0ce11778d73a12d1d1950fa229 | 5a10f16843b9cd80bebee155204ffda3 | 后序遍历,非递归版本,单栈实现 | void postNone(BTNode* bt) {
BTNode* stack1[maxsize];
BTNode* stack2[maxsize];
int top1 = -1;
int top2 = -1;
BTNode *p;
stack1[++top1] = bt;
while(top1 != -1) {
p = stack1[top1--];
stack2[++top2] = p;
if(p->lchild != NULL) {
stack1[++top1] = p->lchild;
... | 0 |
572c9e058a2be8992c0484ed6bf150ea | 17489437fcf588b5c93a9d7ab75d4999 | Get the unique values in given collection | def uniqueify(x: Collection, sort: bool = False) -> List:
res = list(OrderedDict.fromkeys(x).keys())
if sort:
res.sort()
return res | 1 |
8bfe8765904858b32a157edb4c5b7cf8 | 745fdfc753ba5aa0e7c4fe0da2553972 | 查询数据表,不分页 | public class DBUtil
public DataTable query(String sql) throws Exception {
return this.query(sql, false);
} | 1 |
a7052012ad38c72034012e5c0757501d | d63b926a37e034b2470508b944ede566 | Define a constant. There is no functional difference between using
this Const, a python variable or a magic number. However, this Const
can be provided a name to make the .apm model more clear. | def constant(name, value):
return NamedValue(name, [value], 0) | 1 |
f6a4882108a368098f057bcb7065be07 | 49fc8ad78eacb4cabe716f56f2def3d4 | Create an ML pipeline using MultiOutputClassifier, AdaBoostClassifier with DecisionTreeClassifier
as base estimator, and GridSearch CV | pipeline = Pipeline([
('vect', CountVectorizer(tokenizer = tokenize)),
('tfidf', TfidfTransformer()),
('clf', MultiOutputClassifier(GradientBoostingClassifier()))
])
params_gbc = {'clf__estimator__n_estimators': [50, 200],
'clf__estimator__learning_rate': [.05, .1]
... | 0 |
56870e2cf983ee9017350608da8be1ef | c7be03aba6e46e683182c969fc807d39 | Questa funzione è uno slot che viene automaticamente mandato in esecuzione
dopo che è cambiata la varTable.
Gestisce l'attivazione dei bottoni in basso alla varTable stessa. | void MainMenu::on_tableWidget_clicked(const QModelIndex &index){
ui->pushEditButton->setEnabled(true);
ui->pushDeleteButton->setEnabled(true);
} | 1 |
80d4a97fca1176acc81b05f9881fbf67 | a78bb32f5cb0d3332d67c49909f3038a | this function reconstructs the attractor of a time series through time delay embedding | Length = len(Chaos)
print('混沌序列的长度:', Length)
ChaosNew = np.reshape(Chaos, (1, Length))
print('改变Chaos的shape:', np.shape(ChaosNew))
if Length - 1 - (m - 1) * tau < 1:
print('delay time or the embedding dimension is too large')
xn = []
dn = []
else:
xn = np.empty... | 1 |
96763deeb676b3e85f1339f056d48d43 | bc6c8435bf506e6d232ec8a1515a5715 | Reset GUI | void MainWindow::defaultGuiSettings() {
ui->tableViewMemory->setModel(0);
ui->tableViewMemory->update();
ui->tableViewMachine->setModel(0);
ui->tableViewMachine->update();
ui->graphicsView->setScene(0);
ui->graphicsView->update();
ui->pushButton_viewModel->setEnabled(false);
ui->pushButt... | 1 |
ff995a93678866cd32565af449193c45 | 914ee147cf1643cff3f63ddd87bc4697 | Init translation for Zend validators | {
$install = self::install();
if ($install->isDefaultLanguage()) {
return;
}
$language = $install->getLanguage();
$translator = new Zend_Translate(array(
'adapter' => Zend_Translate::AN_ARRAY,
'content' => LIB_CORE_EXTERNAL_RESOURCES_ZEND_LANGUAGES_PATH . DIRECTORY_SEPARATOR . $language,
'locale'... | 1 |
bdc3b3830233288092e554bce7ca0fca | 72270f8c9ab2fd85f66044a1d99fdfb3 | Renders list of recent countries | countries = serialize('geojson', WorldBorders.objects.all(),
geometry_field='geom',
fields=('objectid','cntry_name'))
countries_json = json.loads(countries)
return render(request, 'countries/homepage.html', {'countries_json':countries_json}) | 0 |
6f252fa97570d3a832c786a56e5d7b6e | d7adefa4fec464903ebc94da1ed2c444 | 获取当前文章的下一篇文章 | class WebArticle extends Model
public function next(){
return $this->where("create_time",'>',$this->_create_time)->find();
} | 1 |
90b6f84fc4fb0fd24542db963c4e00bd | a01614afeb6fa306eb69899f036ab4d1 | Set speed proportional to head's speed to slowly wait for yield proximity. | namespace Nautilus{
void RoboMotor::setYawSpeed(double t)
{
mutexYawSpeed.lock();
yawSpeed = t;
mutexYawSpeed.unlock();
boost::thread thread(&RoboMotor::accelerateMotorSmoothly,this);
} | 0 |
6df799d6b228a25ba8ba41b1d97261c7 | 20614321618f8dffca86611e22d81f74 | Fixture to create PModelEnvironments with scalar and array inputs | def pmodelenv(values):
sc = pmodel.PModelEnvironment(tc=values['tc_sc'],
vpd=values['vpd_sc'],
co2=values['co2_sc'],
patm=values['patm_sc'])
ar = pmodel.PModelEnvironment(tc=values['tc_ar'],
... | 1 |
be84fb336d18ab0dd757d164815e8835 | f4357e2544e702346554f514b86f62da | 获取当前播放平台中的清晰度,并根据清晰度返回相应的播放连接 | const streams = {};
const dashStreams = {};
let bestStream;
let bestDashStream = { size: 0};
let headers = await buildHeaders();
logger.debug('get html content', p);
const res = await retryGetContents(url, headers);
let htmlContent = res[0];
let dom = htmlparser2.parseDocument(htmlCo... | 1 |
ea2046737c046ae004d60438f700eaf7 | 1731c1eb834cef304cc89d0af8f80164 | 获取活动基本缓存信息 | IActivityLimitValue value = null;
try {
value = (IActivityLimitValue) CacheLoaderTemplate.getEntity(CommnConstant.MEMCACHE_ACTIVITY_LIMIT_INFO,
activityId, ActivityCacheUtil.getAcCacheLoader(CommnConstant.MEMCACHE_ACTIVITY_LIMIT_INFO));
} catch (Exception e) {
log.error("getAcLimitInfo is excep by acId... | 1 |
70b8bf7e6f7727ceca4064da1de90aa5 | 8f7d4aadac57c7df591e35e7f64f366c | ++
Routine Description:
Closes handles opened by NlpOpenCache | {
DEBUGLOG(std::wcout << L"Closing handles" << std::endl);
CloseHandle(mhInsertMutex);
CloseHandle(mhRemoveMutex);
CloseHandle(mhHasItem);
CloseHandle(mhHasCapacity);
} | 1 |
5ebe829a4f0a01b3fdfa5dfeb6a520ca | a7c6657168fa86bc94a6082415662c42 | removes reserved piece, if none returns False | class Chess
def remove_piece(position)
@pieces.delete_if { |piece| piece.position == position }
@gameboard.occupied_spaces.delete_if { |space| space == position }
end | 0 |
e0e4853a17cb91974d99e402d76eb9d2 | 1b82a74704a1e4e6f3d541196b407b8c | getUserID a function that returns the userID tied to a twitter row in the database | {
$db = new PDO("mysql:host=localhost;dbname=capstonegames", "root", "");
$dbs = $db->prepare('SELECT userID FROM users WHERE email = :email');
$dbs->bindParam(':email', $email);
if ( $dbs->execute() && $dbs->rowCount() > 0 ) {
$value = $dbs->fetch(PDO::FETCH_ASSOC);
return $value['userID'];
}
} | 0 |
b40ce5bfa7479626a47ebc4ab69b8304 | 1ab3f1e2deab935230136f453a212b7b | Returns the lower of two shorts | namespace TerraFX.Utilities
public static class MathUtilities
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static short Min(short left, short right) => (left < right) ? left : right; | 1 |
20f76ef3c919df2d418e663eaa2611c0 | 590f02cc5c8a0e9580223013f51893f5 | Initialisation of data for external APIs and data received from NAS | {
memset (&dsat_ss_cm_data, 0x0, 2*sizeof(supserv_cm_op_s_type));
dsat_ss_cm_data[0].ussd_oper_type = processUnstructuredSS_Request;
dsat_ss_cm_data[1].ussd_oper_type = processUnstructuredSS_Request;
#if defined(FEATURE_DATA_WCDMA_PS) || defined(FEATURE_GSM_GPRS)
#ifndef FEATURE_DATA_ETSIPKT_AT_PURGE_COMMANDS
d... | 1 |
e2ec59b513930b17b75d6f84cf3cc1a1 | a9a6423cbd9300ade0a731b20b70d0cd | Annotate TOPMed study data with semantic knowledge graph linkages. | self.default_trial_visit_label = 'GENERAL'
self.patient_col = 'INDIVIDUAL_ID'
self.study_id = study_id
self.top_tree_node = top_tree_node
self.individual_id_to_patient: Dict[str, Patient] = {}
self.dimensions: List[Dimension] = []
self.modifier_key_to_modifier: Di... | 0 |
f549148e5d054e3b3c085cfc2ecd01ca | 04dbe3ef09f5e894f1f81c5cb3ab9ae4 | 设置单元格宽度,如果不指定宽度,将自动适应宽度 | public class ExcelWritePoiUtil
public void setWidth(HSSFSheet sheet,short cellIndex,short ecellWidthllWidth){
sheet.setColumnWidth(cellIndex, (short) (ecellWidthllWidth * 256));
} | 0 |
99173c4be1e18519dfadfadbd09d02ed | 3350fa8077efd1ab741d44432c0a3928 | RFID卡认证请求,地址是扇区号 | namespace ICCardManagementLib
public class CQTCommonForUsb
[DllImport("mwrf32usb.dll", EntryPoint = "rf_request", SetLastError = true,
CharSet = CharSet.Auto, ExactSpelling = false,
CallingConvention = CallingConvention.StdCall)]
public static extern Int16 rf_request(int icdev, int... | 0 |
123ab5b8bdc3c57bc43bd3554e07a9e9 | 6a89e0c8fe40e442ae660aa2dcef18d0 | Compute root of linear polynomial. | {
var p = new double[a.Count - 1];
for (int i = a.Count - 2; i >= 0; i--)
p[i] = (i == a.Count - 2 ? 0 : p[i + 1]) * x0 + a[i+1];
return new Polynomial(p);
} | 0 |
319ef7d1720254d75dfd6a1a539f464c | c1611c8658841de49b75254ee0e75a74 | Deletes passed BOL from system. | {
const string QUERY = @"
DECLARE
LBOL_COUNT NUMBER(3);
BEGIN
:LBOL_COUNT := <proxy />PKG_EDI_2.CREATE_BOL_FOR_EDI(AEDI_ID =>:EDI_ID);
... | 0 |
7a9ee0ef7e4a4fcfe3d197c38564c200 | c4ef1ff6d564993d30258dde884ec1cd | Function that calcuates shortest path from initial to final node using djistras algorithm. | def shortest_path(i,j):
X=[i]
Y=[0,1,2,3,4,5,6,7,8,9,10,11]
route_x=[[i,i,0]]
Y.remove(i)
while j not in X:
mini_dist=1000000000
present_point=j
next_point=j
for p1 in route_x:
for p2 in Y:
if distance(p1[1],p2)!=0 and p1[2]+dista... | 0 |
35dbae5ca5aa71eb51ee63a22192578c | cff80caf2b1b4111ee86abb200c6502c | Resets the speeds back to the original values | public class F13Character
protected void restoreOriginalSpeeds() {
if (getF13Player().isOnline()) {
getF13Player().getBukkitPlayer().setFlySpeed(getOriginalFlySpeed());
getF13Player().getBukkitPlayer().setWalkSpeed(getOriginalWalkSpeed());
getF13Player().getBukkitPlayer().set... | 1 |
a3c74e180887fc817cb53dbde80bc4d8 | 9ab45c806f36d03bc2bc29b2b0f54e39 | 设置过期字符串,单位秒 | @RestController
@RequestMapping("rest/jedis")
public class JedisController
@GetMapping("get/overdue")
public Object setEx() {
String value = jedis.setex("hello", 10, "我会在 10 秒后过期");
return value;
} | 1 |
801ddd43666d922d87b7d78f7d53216e | 26f16030e3eab243defbe15888e157a3 | Convert from wxyz to xyzw quaternions. | tx_, ty_, tz_ = EulerXYZ_[0:3]
sx = math.sin(0.5 * tx_)
cx = math.cos(0.5 * tx_)
sy = math.sin(0.5 * ty_)
cy = math.cos(0.5 * ty_)
sz = math.sin(0.5 * tz_)
cz = math.cos(0.5 * tz_)
qx_ = sx * cy * cz + cx * sy * sz
qy_ = -sx * cy * sz + cx * sy * c... | 0 |
8b60053f3e8da7704f39c40dc5464d1e | d620c8af15dafbc489c263f59f965b52 | валидация на егн | {
if (string.IsNullOrEmpty(egn))
{
return false;
}
if (egn.Length != 10)
{
return false;
}
double num;
if (!double.TryParse(egn, out num))
{
return false;
... | 1 |
5c8733b6cfd848a18d45c43fe37d44c0 | 3cbddb364fd5dabd4789ffa758b97a77 | if referer is defined and and from the same host allows, else denies | class WebServices_SupportdataController extends SanSIS_Controller_Action
public function checkReferer()
{
if (
(
!isset($_SERVER['HTTP_REFERER'])
||
!strstr($_SERVER['HTTP_REFERER'], 'http://'.$_SERVER['SERVER_NAME'])
)
&&
APPLICATION_ENV != 'development'
)
die('Busted! IP: '.$_SERVER['R... | 1 |
12666131c3886415cfa5f96d8c48e231 | 46433a34373bf712e6ee4a98fb1b8249 | Sets the arguments (GET & POST) from the parent request that are
prefixed with the current argument namespace | class Onyx
private function set_req_args()
{
$postData = json_encode($_POST);
$_POST = json_decode(Utils::utf8_urldecode(
str_replace('+', '%2B', $postData)
), true);
$this->reqArgs = array_merge($_POST, $_GET);
} | 0 |
1b8c558deaaec2c0d87206025351dc58 | 83a9001999a536b5756a8640e4b89151 | Converts a datetime.datetime to integer milliseconds since the epoch.
Requires special handling to preserve microseconds. | if not isinstance(value, datetime.datetime):
raise ValueError(
'Expecting datetime object, got %s instead' % type(value).__name__)
if value.tzinfo is not None:
raise ValueError('Only UTC datetime is supported')
dt = value - EPOCH
return dt.microseconds + 1000 * 1000 * (dt.seconds + 24 * 3600 * d... | 1 |
0b10f3d4f96593c059694f2a0e4c9027 | e36b89b787653f9c96d8e59ccd98292a | recursive nCr | {
long long int ncr = 1;
n--, r--;
int nu[r], dn[r];
r = (r < n-r ? r : n-r);
for(int i=0; i<=r; i++)
{
nu[i] = n-i;
dn[i] = r-i;
}
for(int i=0; i<=r; i++)
{
for(int j=0; j<=r; j++)
{
for(int k=dn[j]; k>=2; k--)
{
if(dn[j] % k == 0 && nu[i] % k == 0)
{
... | 0 |
127193224370dd53e5ca565baab2b280 | bc04d624d53ec0c1d005db0593c07d15 | 指示当前应用程序是否正在 UWP 上运行。 | {
using (var key = Registry.CurrentUser.OpenSubKey(RUN_LOCATION))
{
if (key == null)
return false;
var value = key.GetValue(appName) as string;
if (value == null)
return false;
return ... | 0 |
e2c70f41ebb62c9fdc85215eb53efbd9 | 1e3142f30e33d9509ccd262b9087568a | Split an iterable of words into chunks, using English stopwords as
separators. | lazy: bool = True,
tokenizer: Tokenizer = None,
token_indexers: Dict[str, TokenIndexer] = None) -> None:
super().__init__(lazy)
self._tokenizer = tokenizer or WordTokenizer()
self._token_indexers = token_indexers or {"tokens": SingleIdTokenIndex... | 0 |
28610cfcecc97399efa4540c69188ba1 | 70aa421b85538dcd5c12318e73c35981 | Procedimiento a sobrecargar en subclases del reporte, que recoge del GET y del POST
las variables que definen el filtro a aplicar para el query de la base de datos. Se
espera que esta función devuelva variables que se deben conservar al realizar paginación.
El arreglo devuelto por esta función se pasa sin cambios a eve... | class EditController extends BaseController
protected function getFilters()
{
$filters = $this->get('session')->get('SSystems\CarritoBundle\Adm_DocumentosDetallesList\Filters', array());return $filters;
} | 0 |
a49ce48fd8922f4f37bb511f9e0375bf | ad5f7f8586714d3bcd80aabb21f040fc | Assign tpl array with all available bad word lists | if (badWordsList == null) {
badWordsList = new Map[WORDS_MAX_LENGTH];
for (int i = 0; i < badWordsList.length; i++) {
badWordsList[i] = new HashMap<String, String>();
}
}
String path = BadWordsUtil.class.getClassLoader()
.getRes... | 0 |
7f2e8cfcbf31892aba1531db48982644 | a9b0fe9daa7df05e6d1445988f9e2e4e | Generate random "center-out" reach timeseries for training and testing. | t_interior = np.random.uniform(low=t_low - 0.5*(T-t_low), high=T, size=[nSim_interior, 1])
X_interior = np.random.uniform(low=X_low - 0.5*(X_high-X_low), high=X_high + 0.5*(X_high-X_low), size=[nSim_interior, 1])
t_terminal = T * np.ones((nSim_terminal, 1))
X_terminal = np.random.uniform(low=X_low - 0.5... | 0 |
b6de6c7f7953535a2b83479146434d66 | 5073d849471d13bc153eb4537e0c0eca | draw red box around UI region | {
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
g.drawRect(delayBox);
for (int i = 0; i < mousePosArray.size(); i++)
{
int mouseX = mousePosArray.operator[](i).getX() - 5;
int mouseY = mousePosArray.operator[](i).getY() - 5;
if (mousePosArr... | 0 |
274d8290d157782cc59d31b8e1f4fba8 | b0415314899d56d0bfd01a8eac6a3f8f | 按百分比(%)计算金额(金额是分) | value = value * 100;
int fee = Integer.valueOf(value.intValue());
return fee;
} | 0 |
90fd4b8830a3db79bcf666d7eacc203e | 1a3d556415f57efa578bca27d90098fd | 用户是否被禁言 | class ApioldController extends CommonController
public function checkIsShutup()
{
$parameter_array = array('userid', 'emceeuserid', 'token');
$this->_publicFunction($parameter_array);
$inputParams = array(
'userid' => I('POST.userid', 0, 'intval'),
'emceeuserid' => I('POST.emceeuserid', 0, 'intval'),
... | 1 |
d7b05c91e28b193199eec97d2d6a587c | 3c634132e13142e8b518018b5cef524b | Проверяет состояние запущенного процесса клиента | {
if ($this->isStarted()) {
$this->procStatus();
return $this->status === self::STATUS_TERMINATED;
}
return false;
} | 1 |
b0a8999a9e83f9c4e9097ef1c59813c3 | d42a70149c336b4d79fd2a790f115499 | Say who left when someone leaves the server. | embed_message = discord.Embed(title="An user left the server!", \
description="**Timestamp:** {time}".format(\
time=time.strftime('%l:%M%p %Z on %b %d, %Y')), color=0x0052a5)
embed_message.add_field(name=" ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄", value="The user {name}, known in the server as {nick}, with I... | 1 |
63c1db4533f6284d96a06141dfa81221 | 3dc5c5aae649e5e7a0172f03e0ad018e | 将制作的封面图片生成视频 | throws Exception {
long start = System.currentTimeMillis();
String orderFolderName = creativeAddress + "/preview";
File dir = new File(orderFolderName);
if (!dir.exists()) {
dir.mkdir();
}
File file = new File(orderFolderName + "/" + id + "video.mp... | 0 |
0b810be7e94ddc24a0b60586cca1781e | 4d41fd9952a55fd66ff832d8613b935e | Check that the LBEPS block can be extracted | {
Utility::ArrayView<const double> lhnm_block =
pb_xss_data_extractor->extractLHNMBlock();
FRENSIE_CHECK_EQUAL( lhnm_block.size(), 3176 );
FRENSIE_CHECK_EQUAL( lhnm_block.front(), 9.916958825662E-07 );
FRENSIE_CHECK_EQUAL( lhnm_block.back(), 9.999864243970E+04 );
} | 0 |
65fd4ec7d8853cdbafd07e7fa0386554 | 4d5eac2f7889dc70bd2a7566f530145e | Build the updated student data from the validated form input. | {
Student temp = new Student();
if(cf_id.Text != "")
{
temp.ID = Convert.ToInt32(cf_id.Text);
}
if(cf_fname.Text != "" && Regex.IsMatch(cf_fname.Text.ToUpper(), @"^[A-Z]+$"))
{
tem... | 1 |
5395b3062073dbdfc7ebe21be13becb7 | ecfd463eda3b83671decf96fa775a95c | Create a sequence from an InputStream.
This is the counterpart of {@link MidiSystem#getSequence(InputStream)}
for MUS format. | Sequence sequence = MidiSystem.getSequence(file);
int[] notes = reader.getNotes(sequence);
long[] ticks = reader.getTicks(sequence);
playSequence(notes, ticks);
} | 0 |
a9482c0026adcc649cd8f788b6f0de1a | e39739f2c3af260b5f762b64bf24e245 | 反病毒检查 | public function checkAntivirusScan(string $id): string; | 1 |
cb9cb2f319d6e301e240ee4c5c90617a | a652bbad0f339211ccef3a69088bdd9a | Handles the SelectedIndexChanged event of the Project control. | {
controlProject cp = (controlProject)lvKPIProject.Items[lvKPIProject.SelectedIndex].FindControl("controlProject");
if (cp != null)
{
KPIProjectEntity kpiproject = base.ckpi.GetKPIProject((int)lvKPIProject.SelectedDataKey.Value);
if (this.IDProject != null)
... | 1 |
52d5984ef069d122fe8dfd7dcbc1cf17 | 999758312677984607f1a30d637e13a2 | the details of a skeleton | {
file->goToAddress(6);
uint16_t header_size;
file->readInt16E(&header_size);
version = "";
uint8_t tmp = 0;
file->readUChar(&tmp);
version += ToString((uint32_t)tmp) + ".";
file->readUChar(&tmp);
version += ToString((uint32_t)tmp) + ".";
file->readUChar(&tmp);
version += ToString((uint32_t)tmp) + ".";
file... | 1 |
2b1240763a572f1cfa4abb554c6192ab | 4c72ce2e587645ab80b5c413e7889f92 | Callback for dragging of the lower slider. | {
float pos = 0.1 * float(lowerSlider->sliderPosition());
QString tt = QString::number(pos);
lowerEdit->setText(tt);
} | 1 |
d1f9567c3e620d9879cfd7f232f52e15 | 7e2dbc931d8f7dd1643d5db85d31143e | Initializing some openGL 3D rendering options///////////////////////////////////////////////////// | void setupOpenGL() {
glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LESS );
glFrontFace( GL_CCW );
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
glewExperimental = GL_TRUE;
GLenum glewResult = glewInit();
if( glew... | 1 |
18c6bdb239db05001a432c8e2c7bca6e | 59f8edb206e8dc271866f06026146ccd | # dissimilarity index : the proportion of sample should be removed to achieve perfect fit | n = length(x$redisuals)
RSS = residual_sum_squares(x)
TSS = total_sum_squares(x)
p = x$rank
(TSS-RSS)/p/(RSS/(n-p-1))
} | 0 |
dfe842869e6cc2e3c84d4fb241f67f77 | 42a444304c46ad59610d61f1f95bf8ce | Returns the nonzero indices in the vector vec. | int n = vec.size();
IntegerVector out;
for (int k = 0; k < n; k++) {
if (NumericVector::is_na(vec[k])) out.push_back(k);
}
return out;
} | 0 |
a66be4e6cded83d678ad74a41c30e88c | 9a838ca6650ae480e8cde9e6002c90fe | 使用xpath 获取 主贴 | div_tag = html.find('main')
if div_tag is None:
return None
return div_tag.find('div', class_='nn-user-post') | 0 |
1e61c1ae801f2d984c8648a49d9b7444 | 08d5b63dc4125ac44188b93255003ccf | 利用桶的思想求排序之后两数之间的最大差值 | int maximumGap(vector<int>& nums)
{
if (nums.empty() || nums.size() < 2)
return 0;
int mini = *min_element(nums.begin(), nums.end()),
maxi = *max_element(nums.begin(), nums.end());
int bucketSize = max(1, (maxi - mini) / ((int)nums.size() - 1));
int bucketNum = (maxi - mini) / bucketSize + 1; ... | 1 |
8eddeaa6e8157698d3de38ba73bb9497 | 2e37851ac2437c9be2df754b1a58258f | Ajout à la listes des coordonnée interdite pour les points dans le cas ou la coordonnée n'appartiendrait pas déjà à la liste,
permet d'éviter les doublons | public class Espace{
public void addPointIntersection(PointIntersection p){
figures.add(p);
App.fenetre.getFiguresOption().addList(p);
} | 0 |
afbf060f79c995a3e1b7c4fd7a828e4d | 5689336c2bf2410fdf10d4839db6670d | theoretical standard error of theta_hat | def theory_se(n=n, theta=theta):
return theta * np.sqrt(n / (n + 2) - (n/(n+1))**2) | 1 |
073b6440313c5cc44eba86ba27c4f2fe | b024141458e8ab86be54fb2fa8097226 | 查找一个案件中所有卷宗的操作记录 | @Controller
@RequestMapping("/dossier")
public class DossierController
@RequestMapping("/his/all/{caseNum}")
public List<DossierOperationRecord> getRecordsByCaseNum(@PathVariable String caseNum) {
return dossierService.getDossierOperationRecordsByCaseNum(caseNum);
} | 1 |
fe696e5a068cc39628ee80c22dc914e3 | 46f44c11b009ecfd1601b8dc8cd14245 | 完善(更新)孩子信息 | @Update("update child set gender=#{gender},child_name=#{childName},imgUrl=#{imgUrl},birth_date=#{birthDate} where child_id = #{childId}")
void updateChild(Child child); | 1 |
86cb3e43555641ed3f85c71e8ff59d97 | 16283868a601e57fa4c344bde8c32294 | Adds a recorded duration in nanoseconds. | {
double time_current;
struct timeval tv;
struct timezone tz;
NamedDuration *namedDuration;
gettimeofday(&tv,&tz);
namedDuration = findDuration(name);
if (namedDuration == NULL)
{
return;
}
time_current = (((double)(tv.tv_sec))+((double)tv.tv_usec/1000000.0));
namedDu... | 0 |
cf06ecb858f5bf480d07e920c33f7985 | 9b6b780488105040dd49fbe15a20a00a | Calculate -
Determines the angle between the hour and minute hands | {
const double degreesPerHour = (360 / 12);
const double degreePerMin = (360 / 60);
if (hour < 1 || hour > 12)
{
return "Hour must be a value between 1 - 12";
}
if (minute < 0 || minute > 59)
{
re... | 1 |
616bb516c6b0371ee6cfdd8264129ba1 | 5ca3f081b57f56b00bbcbc322f6bdb5e | A getItem() method for the Vec class, which allows the user to get a particular index.
Throws a range_error if the index is too great. | Item Vec::getItem(unsigned index) const {
if (index >= mySize) {
throw range_error("Vec::getItem() is trying to get an index that is too great.");
}
return myArray[index];
} | 1 |
714e5d84543a8a140f6b97232e2f1d05 | 43e84dceea875c13486a9f6dac93b003 | Sets the UUID of this object to one generated on the fly | class StoredObject extends \Phalcon\Mvc\Model implements ReadableEncryptedContent, Renderable
protected function beforeCreate()
{
$this->generateNewUuid();
} | 1 |
7afcb33aa21a4c1a4634ac58ad010187 | e0b0097f56514656113db1d7bfb25ad4 | Is this syntax tree token an invertible binary operation.
syntax tree token | return (type == NODE_TYPE_OPERATOR_BINARY_EQ ||
type == NODE_TYPE_OPERATOR_BINARY_NE ||
type == NODE_TYPE_OPERATOR_BINARY_LT ||
type == NODE_TYPE_OPERATOR_BINARY_LE ||
type == NODE_TYPE_OPERATOR_BINARY_GT ||
type == NODE_TYPE_OPERATOR_BINARY_GE ||
type == NO... | 0 |
90de8fce32064862f5e5feac1641d6c7 | 242c794f7552ea02d8ac3f4f37299f08 | Sets the time when this move was made | @Entity
@Table(name = "skymine_votes")
public class VoteData
public void setTime(final Timestamp vTime) {
this.time = vTime;
} | 1 |
f2d9acff9a2a14486c5700d00dbe27b1 | 5a9ec2a774250b4232b33ed7b9b244eb | r"""
Return the indegree sequence. | class GraphFrame(object):
def inDegrees(self):
jdf = self._jvm_graph.inDegrees()
return DataFrame(jdf, self._spark) | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.