query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
8bbbff0f9d9c7a0ffd3c8d06ddfdcd5c | 867bd4a2d65f4f4b7912103a7cfbf1b9 | Добавляет файл в БД и в ФС | namespace CloudStorage.Data.MsSql.Repositories
public class FileRepository : IFileRepository
public void Add(File newFile)
{
this._db.Files.Add(newFile);
this._db.SaveChanges();
} | 0 |
4466ee7c91ea6528c44871579bfca00a | cee597dbe201b6b1f8d6f82ff6c81791 | Create request for operation 'associationsInsertWithName' | $result = true;
$association1 = $this->createComplexParams( $alias1 );
$association2 = $this->createComplexParams( $alias2 );
try {
$result = $this->getFacebookAPI()->data_defineAssociation(
$this->getAssociationName(),
$this->getAssociationType(),
$association1,
$a... | 0 |
5f0d1e8a6be606f757564c289a6764ab | 50b6d4f02beb3c2bc3bbfe7f861f9dc9 | Send message data to specific client in asynchronous mode. | namespace Game
public class Session
public void SendAsync(byte[] data)
{
writeArgs = new SocketAsyncEventArgs();
writeArgs.Completed += IOCompleted;
writeArgs.UserToken = client;
if (writeArgs.SocketError == SocketError.Success)
{
i... | 1 |
61ffbb067538a82b5360d8985fae741c | 159cf3d7646326eba62a4804b4a554d9 | Generate the GetID method. | def OutputPosMatcherHeader(pos_matcher, output):
def _GenerateGetMethod(rule_name, index):
return (' inline uint16 Get%(rule_name)sId() const {\n'
' return rule_id_table_[%(index)d];\n'
' }' % { 'rule_name': rule_name, 'index': index }) | 1 |
3f3b47ad706e659b95cc24c489ac1240 | d4d0867097ae8a16015a7e8fc5967889 | 當有重覆的key,會留下最後一個put的value | public class MapTest
public static void addRepeatedKey(){
Map<String, Integer> map = new HashMap<>();
map.put("a", 13);
map.put("b", 23);
map.put("a", 33);
System.out.println(map.get("a"));
} | 1 |
45043906735dd8344dc4204fcc89a7df | 36c03dafd0ec75bbe9866173aa7efbcb | Add all items to the player. | for item in self.item_list:
player.inventory.add_item(item)
player.inventory.add_gold(self.gold)
self.item_list = []
self.gold = 0 | 1 |
12d67a1ceb506a7dec7a52b0a20b0b99 | 2f347d41d679175d58aaaad66e86d369 | Method for setting a name for a workout | public class RecordFx
public void setWorkName(String wName) {
workName.set(wName);
} | 1 |
cd7ceb8e272d40c16d25adadc425fb3b | a60bfcea53f8b81b1feca055125e0d0c | newInput() calls enforceRules with the new input details then sets the
input to the gameBoard. It will return true only when every non-locked
cell input is determined to be filled and valid. | if( getActiveSqr().isFixed() ) return false;
if( (newval < SqrTypes.BLANK_VAL) || (newval > gridLength) ) {
logger.warning( "* New value '" + newval + "' OUT OF RANGE *" );
return false;
}
logger.info( "New Square value == " + newval );
int $val = newval;
... | 0 |
d96703ada0faa1a9817ad65cc81ca29b | 99fd51d2e068d13f781b8e894ecd50ae | Devuelve el numero interno de la proxima tarjeta chip a generar. La numeracion la concentra en Gestion. | {
Random random = new Random();
double aux = 10000000 + (99999999 - 10000000) * random.nextDouble();
return aux;
} | 0 |
727bbf1b417583fbd4fc8d8cb1cef138 | 2c778b123e8c5857fa9846426ea88b77 | Test building files from the config file. | def test_build_book(tmpdir):
os.chdir(path_book)
run(f"make clean".split())
assert path_book.joinpath("conf.py").exists()
run(f"make html".split(), check=True)
path_html = path_book.joinpath("build", "html")
assert path_book.joinpath("build").exists()
assert path_html.joinpath("index.html").... | 1 |
31dc76ac22cb2651d3a5217f088d226c | 670293850e3cba8c327d08e34be7c3e2 | Add a single OHLC record to a selected table. | col_index = 0
for arg in args:
if arg != None:
if isinstance(arg, numbers.Real):
err = impl.ts_row_set_double(
self.__table_handle, col_index, float(arg))
else:
err... | 1 |
010619f3a14adbf3635faf95f8d127dc | 6f33f3c54972f57471ea7c39e5ebb7c8 | 更新飞机系列。 | string nn; int x;
cout << "请输入飞机编号:";
while (1) {
cin >> nn;
x = ps.get_xb(nn);
if (x == -1) break;
cout << "\n飞机编号重复,请重新输入:";
}
pl.upd_ID(nn);
} | 0 |
cc03d9c650585bc19a910c5aef6ab33d | 5517aa065f185336f5c9933b0efd3019 | Test reading a blank string. | def test_read_file():
assert view_user_birthdate.read_file('testfile4read_file.txt') == """ABCDEFGHIJKLMNOPQRSTUVWXYZ?
abcdefghijklmnopqrstuvwxyz.""" | 0 |
ee8155edad947fe9b4d6f0b8b78881f7 | b21445404565cfb16af72e7864d2a273 | Increments food stockpile value | public class Resources : MonoBehaviour
static public void AddFood(int food)
{
instance._addFood(food);
} | 1 |
7bc68788f64f56ec11d3eae3a95d535c | b677457cfd4ade6163bf19c58570915a | Gets the accountNbr value for this CheckModel. | public class HolderAccountObjectTO extends ValidationOperationType implements Serializable{
public Integer getAccountNumber() {
return accountNumber;
} | 0 |
4f40327d7957bbb2660bc3755966c5a1 | 36054fd485298bdd8f17b8bfdac2463e | funcion que obtiene la lista de los usuarios en un grupo | $users = array();
$this->loadModel('Queries');
$usrs = $this->Queries->find(
'group_users',
array("conditions"=>array('gu_gid'=>$grp),
'order'=>'u_nom'),
Model::FETCH_OBJ
);
foreach ($usrs as $k => $v) {
$users[$v->gu_login] = strtoupper($v->u_nom);
}
return $users;
} | 1 |
b7c32a3877616ccb86afede8f69a015d | adeb0b77b4254798735b43b8d7e630ea | 删除收藏的answer | const me = await User.findById(ctx.state.user._id).select('+collectingAnswers')
const index = me.collectingAnswers.map(id => id.toString()).indexOf(ctx.params.id)
if (index > -1) {
me.collectingAnswers.splice(index, 1)
me.save()
}
ctx.status = 204
} | 1 |
d0177a8544b068e7085f7715ff08756c | 809ec0c4e393b9364d505bfba88692e2 | Check sound selection before game starts. | public class Gameplay : MonoBehaviour
private void SoundCheck()
{
var playerData = player.GetComponent<PlayerData>();
if(!soundSystem.GetComponent<SoundManager>().sfx.sound)
{
slashButton.GetComponent<UIPlaySound>().volume = 0.0f;
jumpButton.GetComponent<UIPlaySound>().volume = 0.0f;
}
else
{
slas... | 0 |
50c4e7244a14d769b564e4889558b78c | 8249acb2ed4ad88617858ffa6e80e631 | 获取所有子评分标准 | {
StringBuilder sbsql = new StringBuilder();
sbsql.Append("select s.KgtID,stu.XsName,stu.BjName,tp.SjName,sp.ZyName,sb.KmName,s.DxtScore,s.DuoxtScore,s.PdtScore,s.ZgtScore");
sbsql.Append(" from tbScore as s,tbObjTopic as ot,tbTestPaper as tp,tbUser as u,tbStudent as stu,tbSu... | 0 |
156ef64435e0514aba9d5bdf1ff2c3f7 | a7e8b455bb4c373c18ac5738d889291c | Called when the control is woken up. @ref GuiControl_Waking ) | BOOL wakeUpEventHandler()
{
gotoSleep = FALSE;
return TRUE;
} | 1 |
71597c64316e8685cf0d64b714ee0f57 | 1172e84e1a2326566d9a5b4b63181fd0 | Get all authors with at least one same name to the authors got by the given name | public List<Author> getAuthorsByAuthorName(String name); | 1 |
075ec3728fac34708ea7cb81366ebf99 | 04bb70843a3f66d0156263c77bf6f42a | 完成任务时推送一次同盟任务信息 | void ChatController::viewAllianceTaskInfo()
{
CCLOGFUNC("");
if(AllianceDailyController::getInstance()->isSwitchOpen()){
if (FunBuildController::getInstance()->getMainCityLv() >= 10) {
PopupViewController::getInstance()->addPopupInView(AllianceDailyPublishView::create());
}else{
... | 0 |
66188faa2f8555bc52852c6f46e48e2c | 2865a5275e7101b0881284da7061db7c | 最後に攻撃した人を取得する | CChar * CChar::Attacker_GetLast()
{
int64 dwLastTime = INT32_MAX, dwCurTime = 0;
CChar * retChar = NULL;
for (size_t iAttacker = 0; iAttacker < m_lastAttackers.size(); ++iAttacker)
{
LastAttackers & refAttacker = m_lastAttackers.at(iAttacker);
dwCurTime = refAttacker.elapsed;
if (dwCurTime <= dwLastTime)
{
... | 1 |
00f8e63130456573b398e1b137ffea32 | 61a02223da4a22ad68dbe9d34ef62bf4 | 导出文章统计列表 | class StatisticController extends BaseController
public function actionExportNewsData(){
if(!Yii::$app->exAuthManager->can('statics/export-news-data')) {
return json_encode(["code"=>20004, "msg"=>$this->status_code_msg[20004]]);
}
$official_account_id = Yii::$app->request->get("offic... | 1 |
b792184850ee5c2c4184dee33020e6ee | 72b040431cfde4bc34e8a99f054e5d3a | verify that there is no equal property on the object | class MockObjectTest(testtools.TestCase):
def testNotEquals(self):
self.mock_object._Replay()
self.assertFalse(self.mock_object != self.mock_object) | 0 |
e48919568683b1ba9cae7d8709029802 | 2a044ffa683e8d85e7763bd149a88c47 | Add http:// if missing | function cs_add_http($url){
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
$url = "http://" . $url;
}
return $url;
} | 1 |
ba82ed113f6cc1da5d4530609fb87690 | cffa0272c78acd3b774b527b8ffbcc04 | 指定された時刻の値を返します。値がない場合はnull。 | V findValue(long timestamp); | 1 |
80363a6091f91d6fafb6baae08c2aa0b | 4cb7801a035c3f88699926f9e50f99d9 | Disables all elements that shouldn't be used while recording | public class MicrophoneTestActivity extends AppCompatActivity implements MediaPlayer.OnCompletionListener, View.OnClickListener
private void enableAllButtonsButStop() {
recordWithMediaRecorder.setEnabled(true);
recordWithAudioRecord.setEnabled(true);
recordWithIntent.setEnabled(true);
st... | 0 |
5dd72984df49a0611138725ded5dcc79 | 95709da5442342de415179436a784728 | validates 3G payload from UI | if(capaValue.value==""){
alert("please enter capacity!!!");
return false;
}else if(capaValue.value.length>3){
alert("Capacity is invalid!!!");
return false;
}
return true;
} | 0 |
c2abbef660339c8546404674417f3aab | 8bfb77f454e78b67c72b525f420e8bb8 | Metodo para setear el sistema operativo | public class InfraCombination
public void setOs(String os) {
this.os = os;
} | 1 |
31c0a944cf2dc5be623a9811e9947d99 | f6af45f39839023b4c520c76ee5f866d | randomly generates a trading decision | def decide_buy_sell(): | 0 |
1415b2393da7a975e3aa5c91bc80f926 | f0b77ad8f63c994545ac550ce05ef405 | Creates import instance task.
See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-ImportInstance.html for description.
Note, only one volume is transferred in time.
Asynchronous. The status is got via DescribeConversionTasks.
Only Image.Format and Image.ImportManifestUrl parameters
are needed. ... | try:
args = (
request,
request.DATA['name'],
request.DATA['source_id'],
request.DATA['flavor_id'],
request.DATA['key_name'],
request.DATA['user_data'],
request.DATA['security_groups'],
... | 0 |
f7a2a158db995dfe0502d40c55bfb4b3 | 087410dbc316d3380ad6c10614a1a1a8 | Button to begin searching for ingredients. | public class NewFoodFragment extends Fragment implements View.OnClickListener
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.searchFoodButton: {
String foodName = inputFoodName.getEditText().getText().toString();
if (foodName.isEmpty()) {
... | 1 |
ea605af4e6a9e03286dd807551431e1e | 26f7dbd52d52b4e2c824fca287919c99 | @brief SE Enter Secure Mode. | C_AND_BF706xx::DEV_STAT_E C_AND_BF706xx::Secure()
{
PRINTF("C_AND_BF706xx::Secure()\n");
return OPERATION_OK;
} | 1 |
0b3320cf46b7de33c34e8cb451d742c8 | 79428cf9b6b70a60b0c6516b9a227045 | @brief Add a new sub menu to a given menu | {
TInt index = iScreenIndex + iScrollBar->CurIndex();
TItemType& type = iItemTypeArray[index];
if(ESubMenu == type.iType)
{
iSubMenu = CPopUpMenu::NewL(iObserver,iMainEngine,ETrue);
iSubMenu->SetParentPopUpMenu(this);
const CSubMenuItem& subItem = *iSubMenuItemArray[type.iNumber];
TPoint point = iClientRect... | 1 |
e59fa85919437535f83e1c5a3da811c4 | 401701bab770bece863071ebdd7f1034 | Processes the Sniffer packet capture global header | eth_header = packet[self.header_start:self.hdr_length]
eth = unpack('!6s6sH' , eth_header)
self.proto = socket.ntohs(eth[2])
self.dest_mac = self.eth_addr(packet[0:6])
self.src_mac = self.eth_addr(packet[6:12]) | 1 |
793ec23a78869f71bc030d918af949d2 | 04068d3ed43c4d3869c84fdd6125fedc | Gets the name of the events file currently being written to.
Returns:
The name of the events file being written to. | class settings_class(object):
def fname_eve(self):
return self._fname_eve | 1 |
0f66de2d240ebe9c729fd776c422853d | 70c68adab36f1eb9d8c4c0f477b7603f | Generate a load constant instruction based on the opcode. | {
switch (Value)
{
case -1:
ILGen.Emit(OpCodes.Ldc_I4_M1);
break;
case 0:
ILGen.Emit(OpCodes.Ldc_I4_0);
break;
case 1:
ILGen.Emit(OpCodes.Ld... | 1 |
6edfcbad4ba07fec537eb5e9935efa6d | 6dbb3022a9ef54690f16b6975ef45bea | This iterates over the quiz attempts dictionary and adds the information to the quiz result object's dictionary. | def take_test(data):
student_id = int(data["student_id"])
quiz_test_id = data["test_id"]
query = db.session.query(ObjectiveQuestions).filter_by(quiz_test_id=quiz_test_id)
items = []
for i in query:
items.append({"student_id":student_id,"quiz_test_id":i.quiz_test_id,"question_id":i.question_i... | 0 |
8f66bbef2ea92d817a40f2fe264ec2af | 9a6313d45fa5f21a42b5fde91ff8c667 | Check to ensure that the provided bit-stream is intended for this part. | {
if(m_part_downloader.m_total_bytes != m_part_downloader.m_part_element->m_size)
return false;
return Engine::CompareMD5(m_part_downloader.m_data,
m_part_downloader.m_total_bytes,
m_part_downloader.m_part_element->m_md5);
} | 0 |
7d5c7fad2e813acbe62a5939c64ede8e | 47411001610f426477648abf0085c659 | Returns the number of elements currently in the AthleteList | @XmlRootElement
public class ConcurrentList
public int countArcher() {
return this.archList.size();
} | 0 |
c6ae6e0aa70b02505e5044e47f84759e | 8adb5d20f2c4f562ba822caf2ed7a084 | Tests whether a validator error results if User not found at gateway and no fallback member found | {
$this->setExpectedException(
'RuntimeException',
'No PaymentGateway found',
150730014
);
$merchant = $this->getMockBuilder('BB\DurianBundle\Entity\Merchant')
->disableOriginalConstructor()
->getMock();
$em = $this->getMock... | 0 |
f20c1a158f4de21430495fb74b671e5b | 025dad7b55e868d771973546f1f2ba85 | Converts a Java color to Brew(NativeColor) color value
NativeColor color: 16bits (565)
Java color: 0x00RRGGBB | {
int r = R;
int g = G;
int b = B;
r = r * 0b11111 / 256;
g = g * 0b11111 / 256;
b = b * 0b11111 / 256;
return ( ushort ) ( r << 10 | g << 5 | b );
} | 1 |
d796d9d63e0291d1c810e48277721c48 | 08cb9a9a40f97ca42182c341c5a5285e | Add to the end a group of properties for a 3D vector | ps[index] = x;
ps[index + 1] = y;
ps[index + 2] = z;
} | 1 |
68cd615cb368eeefb96591ced41d5caf | 46ad579a918646b1da07495bc5ba966f | 加锁设置某个Key的值 | @Slf4j
@Component
public class RedisTool
public boolean lock(String key, String value) {
try {
Boolean aBoolean = redisTemplate.opsForValue().setIfAbsent(key, value);
if (Objects.nonNull(aBoolean)) {
return aBoolean;
}
String currentValue = redisTe... | 1 |
0147ead9b4f8353f26cd61d1693262c9 | 70e6b8158a6b26314b320f755df81be5 | 5.Given a string, return a string length 1 from its front, unless front is false,
in which case return a string length 1 from its back. The string will be non-empty. | def both_ends(s):
return | 0 |
cc650d71403a049fbe71db640719d527 | db2e8a7b87e794acbf511dd566a573d5 | 开启指定锁定行为的事务 | {
this.DbTransaction = null;
this.DbLockType = lockType;
return this;
} | 0 |
a6a4c34dd0cb2e13c219e4c6193ef684 | 93b34d46ddf704cba3ead51f050b9798 | Finds the zero of a function using the Newton method | x0 = np.atleast_1d(x0)
assert x0.shape[0] == 1
xn = x0.copy()
while True:
fxn, gxn = f(xn)
if np.linalg.norm(fxn) < tolerance:
return xn
else:
xn = xn - fxn / gxn | 1 |
4a04a3696c6823cb1c89abf7737f0cdd | 9ef1d5cb018c66c2b0de74578a243024 | 1 - Listar ISBN e título de todos os livros | $books = \DB::table('books')->get();
foreach($books as $book) {
echo $book->title.'<br>';
}
return 'Example 2';
} | 0 |
3f89dc715e6e31cc61d725dc588deb7c | da67b97a1a186166fb2c3c87fbad39e6 | 自定义ArgumentParser类. | def custom_default_argument_parser(epilog=None):
parser = argparse.ArgumentParser(
epilog=epilog
or f"""
Examples:
Run on single machine:
$ {sys.argv[0]} --num-gpus 8 --config-file cfg.yaml MODEL.WEIGHTS /path/to/weight.pth
Run on multiple machines:
(machine0)$ {sys.argv[0]} --machine-rank 0... | 1 |
f287ed02a5bd017093265f6306513bea | 62c1829ab3be37e0114ca37b7ca1368a | 重连进来时,把公屏清空,显示房间公告 | public class LargeClassActivity extends BaseActivity private void initSdk()
@Override
public void onLeaveRoomSuccess() {
handState = 0;
mStudentId.setVisibility(View.GONE);
btnReiseYourHand.setBackgroundResource(R.mipmap.liv... | 0 |
f33389e1330799a97ea934fd65014e42 | c1a33a790df22511f57a1ddeba02a221 | Subscribe the specified clients of the buyer to the auction package. If a
client in the list does not belong to the buyer, an error response will be
returned, and all of the following clients in the list will not be subscribed.
Subscribing an already subscribed client will have no effect.
Required. Name of the auction ... | try:
params = request._serialize()
headers = request.headers
body = self.call("ModifySubscribeObjects", params, headers=headers)
response = json.loads(body)
model = models.ModifySubscribeObjectsResponse()
model._deserialize(response["Respon... | 1 |
46c7dd5543098b736342b47280e2cda1 | da84639ff645e366bcf8eb0d0918328a | Adapted from user @Letiv on StackOverflow
http://stackoverflow.com/questions/1560788/how-to-check-internet-access-on-android-inetaddress-never-times-out
The unique feature of this connectivity check compared to others is that it actually looks
for packets from a name server instead of just checking with the system if t... | {
try {
URL url = new URL("http://www.google.com");
HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection();
urlConnect.setConnectTimeout(20000);
@SuppressWarnings("unused")
Object objData = urlConnect.ge... | 0 |
9772c3dd066e6baaf392a58b850cc7de | c293979bd359819f86ce06012b790622 | Показывает список кассиров компании, которые были удалены. | {
return view('reservationcancels.reservationcancelsList', [
'title' => 'Список отмененных бронирований',
'reservations1' => CabinetReservation::withTrashed()->where('is_cancel', 1)->get(),
'reservations2' => CabinetReservation::withTrashed()->where('is_cancel', 1)->where... | 0 |
18a2cee000942ada1996ecd0181ee2ea | ed63565c52116f0980a269500982fdb0 | 有数据的日期上加粗 | var reg = /(\d+|#|-|\/|•)/;
$('.job_xinxi p').each(function(index, el) {
if (!reg.test($(this).text())) {
$(this).css({
fontWeight: 'bold',
fontSize: '16px'
});
}
});
} | 0 |
91f08d140305686bae23ecce19bc1502 | 594d4b68db371926958969232cf31523 | 调用者会收到成功或失败的promise信息,一般来说只有成功的情况下才会需要作进一步处理,
比如更新缓存等。失败的话,直接显示错误信息了。 | try {
const result = callback(self.PromiseResult)
if (result instanceof Promise) {
result.then(resolve, reject)
} else {
resolve(result)
}
} catch (error) {
reject(error)
}
} | 1 |
b6870c3a09d4e0f1003f9ec0c5803d23 | 10534ded270de4ed9656a1b981b9f8eb | Generate a signature for the message we've been loaded with using
the key we were initialised with. | final class Message
public function getSignature()
{
return md5(sprintf('%s:%s:%s', $this->type, $this->data, $this->recipient));
} | 0 |
30a79a4a6762b7fce5a478be34559e61 | 01cd8a5ad4d20b39c7a158acf2a86231 | 获得怪兽ID | {
QVector<int> monster_id_list;
for(int i1=0;i1<15;++i1){
for(int i2=0;i2<15;++i2){
if((map[i1][i2]>=30&&map[i1][i2]<=49)||map[i1][i2]==80||map[i1][i2]==81){
int index;
if(map[i1][i2]>=30&&map[i1][i2]<=49){
index=map... | 1 |
3156cf8cf827ed44254618ad212e5173 | 8c66785ce137ec51ae5ec6c5a78078f9 | Returns the cause of death of this pathology data. | class Death
def multiple_cause_code(i)
raise 'Invalid index' unless (1..20).include?(i)
death_data.send("icdf_#{i}") || death_data.send("icdpvf_#{i}") ||
death_data.send("icd_#{i}") || death_data.send("icdpv_#{i}")
end | 1 |
15393a3bdbc30cceea0cf986e7759bee | b8b51483ec7a7a2b85aa5e0df7deeddf | The lane type of the event. Only present if relevant. (Legal values: BOT_LANE, MID_LANE, TOP_LANE) | class Event(dict):
def sub_type(self) -> Optional[str]:
return self.get("sub_type") | 0 |
52272947dd95c3377f34f09d13f0485c | cc634e4480f24f62a8f8572976793333 | 當滑鼠拖曳時,判斷是否有物件。當有物件時,則設定該物件的X,Y座標。 | public class ClickHandler : MonoBehaviour
void OnMouseDrag() {
if (gameObject.GetComponent<Collider2D>().isTrigger) {
OnClickObject();
} else {
PickupOrDragObject();
}
} | 0 |
d3417007cffd596fc6f2a6fae4b93e8d | 8ed5cf84d3e5b9ce59a5ceac72ab1b95 | 获取指定句柄的 IE浏览器 标题 | {
StringBuilder sb = new StringBuilder(100);
GetWindowText(windowHandle, sb, sb.Capacity);
return sb.ToString();
} | 1 |
860930138a4a95d0fcb0345178bf5319 | c06772069925b5f1dd615d8252f437fa | LZ77 Decompressor function | def lz77_decode(compressed_data):
output = []
index = 0
for (distance_back, length, new_character) in compressed_data:
for i in range(index-distance_back, index-distance_back+length):
output.append(output[i])
if new_character != '$':
output.append(new_character)
... | 1 |
91a186c5637d258633de7953ec9598ef | 9c760cadb7a223956407cfbefe4efbb6 | The total time of all recorded events since this timer was created. | namespace dt
float DTAppTimer::totalTime()const
{
if (_stopped)
{
return (float)(((_stopTime - _pausedTime) - _baseTime)*_secondsPerCount);
}
else
{
return (float)(((_currTime - _pausedTime) - _baseTime)*_secondsPerCount);
}
} | 1 |
a2ef914572c1bc9efb33e50bf121c91d | de5f68ce0fef13809e4f905e6175698a | ! @brief メインキャラクターのアクション | {
if (this->getChildByTag(TAG_MENU_3)->getNumberOfRunningActions() == 0)
{
if (!mButtonCharactersLockFlag)
{
mButtonCharactersLockFlag = true;
playButtonSE();
auto nextScene = TransitionFade::create(0.5f, Characters::createScene(), Color3B(192, 213, 234));
... | 0 |
0868c879e355ec48f72185370083cdb3 | dadc1845453fe146efb00abb33db2847 | Test case for eisendpointstopologytaguuiddelete
Remove Endpoint from a Topology # noqa: E501 | class TopologiesApi(object):
def topology_tag_uuid_get(self, topotaguuid, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.topology_tag_uuid_get_with_http_info(topotaguuid, **kwargs)
else:
(data) = self.topology_tag_uuid_get_with_... | 0 |
3b980405ec8b9db8335b89ea79d6f94e | dd8e5903c6a7b316cb247701a251ab4e | Processes the statement with specified cpu context. Returns false if we couldn't read due to invalid memory
address. | {
if (Memory.IsUntouched(Pc))
{
return false;
}
uint instruction = Memory.LoadWord(Pc);
if (instruction == TerminateInstruction)
{
return false;
}
Pc += 4;
if ((instruction... | 1 |
ae2017d58a28c9996138e647e2a693e1 | ba3df54240d650519cc00f2aaf7fae74 | 将一个列表对象放入缓存,并且设置有效时间 | @Slf4j
@Configuration
@AutoConfigureAfter(RedisConfig.class)
@Priority(-999)
public class RedisUtils
public static void setList(String key,List<?> list,int seconds) {
setList(key, list,seconds,TimeUnit.SECONDS);
} | 1 |
62d37eba51a4fb751333e0473fcee870 | 48fc2acce46b8890a9a5812076337c8e | The purpose of this is to let protections auto-expire if the owner did
not play for the last X days. | the_time = await utils.get_timestamp()
mycursor, db = await the_database()
await mycursor.execute("""
SELECT * FROM SlothSkills
WHERE skill_type = 'divine_protection' AND (%s - skill_timestamp) >= 86400
""", (the_time,))
divine_protections = await mycu... | 1 |
3cb17188a25762ffe01f306c5da85a08 | db28a918e7d08ba41bbc1c492ece7444 | Validates that the value of the <see cref="GUID_USER_PRESENCE_PREDICTION" /> property is correct. | {
if (String.IsNullOrEmpty(guid))
throw new ArgumentException("Invalid guid.", "guid");
IFCAnyHandleUtil.ValidateSubTypeOf(ownerHistory, false, IFCEntityType.IfcOwnerHistory);
} | 0 |
be05a84204cfe1ffd45a1a940fb968c9 | b69d9f2c02427f6109a2f015a5cc763c | Build the optional Command form. | class CommandWithArgumentFormType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('id', LegacyFormHelper::getType(TextType::class, 'text'), [
'label' => 'Id',
'required' => true,
]);
} | 0 |
2a3767b42928e187f6afff96c31079fd | 6f8b6c4a2f11ac8c90d6ef6aefc87481 | DirectDeviceの作成 | d3dObject = Direct3DCreate9(D3D_SDK_VERSION);
D3DPRESENT_PARAMETERS presParams;
ZeroMemory(&presParams, sizeof(presParams));
presParams.Windowed = TRUE;
presParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
presParams.BackBufferFormat = D3DFMT_UNKNOWN;
presParams.PresentationInterval = D3DPRESENT_INTERVAL_ONE... | 1 |
a8bcf4693d817621be8ec0da9524d13b | 3a8d387c55c13634d0fb7c9a8c2fd23c | Check if it should purge versions on delete | @XmlRootElement(name = "DeleteFolderCriteria")
@JsonRootName("DeleteFolderCriteria")
public class PSDeleteFolderCriteria
public boolean getShouldPurge() { return this.shouldPurge; } | 1 |
496a53d872bf1f4a2381325b94bd3467 | 73313470b5992de4e06cda2feb7c2f26 | Get latest-time model in a directory. | def getLastTime(directory):
if not os.path.isdir(directory):
os.makedirs(directory)
files = os.listdir(directory)
if len(files) == 0:
return 0
files.sort()
parts = files[-1].split('.dat')
return int(parts[0]) | 1 |
b7b3df4d08c4ee267b40b47d1884cf92 | c3c3fe262cc1078a35cb80cf117b3a9f | write a byte to ds18b20 | unsigned char i;
unsigned char x;
for (i=0;i<8;i++) {
x = data>>i;
x &= 0x01;
ds18b20_send(x);
}
delay_us(100);
} | 1 |
3855dbd01d278ce2fede7d717940b2c3 | f703ca97569ad1b4f099ca766e0a0620 | restore previous projection settings | void restoreNormalProjection() {
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
} | 1 |
a940bd0f7c04db7973872aace9992027 | adba65928b97fb1a8a2b9efada46c2c1 | Convert any value to Integer. Returns null if failed to convert. | if (value instanceof Integer) {
return (Integer) value;
}
try {
return Integer.parseInt(getString());
} catch (Exception e) {
return null;
}
} | 1 |
5bbcc2e110a4fbe82b55ec172421af39 | a2aab21d515882689447065a9e3d3442 | Safely attempts to get a path to the provided relative asset path, prioritizing overrides in the alternate content manager. | namespace Rotorz.Games.EditorExtensions
public static class PackageUtility
public static string ResolveAssetPath(string packageName, string relativeFolderPath = null, string assetFileName = null)
{
CheckPackageNameArgument(packageName);
CheckRelativeFolderPathArgument(relativeFolderP... | 0 |
40624a86a2d732efe3d6ae7746be42e0 | 9f3bf435a35f55322ff03a56ea3fe365 | Get STAFF Records from RSP_K25 | {
string query = "EDOC_RETRIEVE_S5";
SqlParameter[] sqlParameters = new SqlParameter[0];
return conn.executeSelectQuery(query, sqlParameters);
} | 0 |
e8315ea53323d5af236c12a614c2f903 | 5d2504f15adccf76dae2c2b77e91fb20 | Playを生成するが、返すものはPlayId | export class PlayManager
async createPlay(playLocation: PlayManagerParameters, playlog?: DumpedPlaylog, options?: AMFlowStoreOptions): Promise<string> {
const playId = `${this.nextPlayId++}`;
this.plays.push({
playId,
status: "running",
createdAt: Date.now(),
lastSuspendedAt: null,
...playLocation
... | 1 |
31679ed326b04d98bae455c453ab56e2 | 05ece97e2d0982510fbe4c148c91f5a0 | returns the most recent speed vector in the speed vector list | int Profile::getSpeed()
{
return (savedSpeed);
} | 0 |
e1aa82758c562809fa5ccab2a40861df | bec164aad8b04f0b8b3d7574d6009a93 | Return the maximum value in a List<Double> | public double getMax(List<Double> l); | 1 |
1cd4c8600acd015451c3fabd873fa0d4 | 658abb2fb432d72cdeb65e018737d6c5 | https://gist.github.com/pascaldekloe/62546103a1576803dade9269ccf76330 | function colorTemperatureToRGB(kelvin) {
let temp = kelvin / 100
let red, green, blue
if (temp <= 66) {
red = 255
green = temp
green = 99.4708025861 * Math.log(green) - 161.1195681661
if (temp <= 19) {
blue = 0
} else {
blue = temp-10
blue = 138.5177312231 * Math.log(blue) - ... | 1 |
0042ad14eb8623fed7fc097e9f8597fe | 7195be7d5c102b8340f4677d137d0d6b | @brief 组合
从n个不同数组中,任取m个元素并成一组,叫做从n个不同数组中取出m个元素的一个组合; | class Lottery extends Common
public function combination ($a, $m)
{
$r = array();
$n = count($a);
if ($m <= 0 || $m > $n) {
return $r;
}
for ($i=0; $i<$n; $i++) {
$t = array($a[$i]);
if ($m == 1) {
$r[] = $t;
} else {
$b = array_slice($a, $i+1);
$c =... | 1 |
747f449eb178e027197f3d5811a42cfb | 9995361b8fe570c99eaa1d77f1208257 | Chart for investments | def invest(amount, rate, time):
print(f"principal amount: ${amount}")
print(f"annual rate of return: {rate}")
for i in range(1, time + 1):
amount = amount * (1 + rate)
print(f"year {i}: ${amount}")
print() | 0 |
fc8329977c4a91ad8275a1843b94579d | 0ec5ecb9cefbd54d8b613e359159871b | Change chinese numbers to Arabic numerals
chinese numbers | targetStr = ''
for i in range(len(sourceStr)):
i = arabic_numerals_transform_chinese(sourceStr[i])
targetStr = targetStr + i
return targetStr.decode('utf-8') | 0 |
7006bdc0ae261815c5228dd36bc5f576 | f353efa5b1dd8196e4f70577005105db | 如果dict裡面有東西 才要畫 | class Food:
def draw(self, window):
if self.rect.width < CELL_SIZE:
self.rect.inflate_ip(2, 2)
pygame.draw.ellipse(window, self.color, self.rect) | 0 |
a4de5b76e6f9027ac74fe2ba37516ff7 | a0361faf44f8aacae999fc521b8990f9 | Parse hex to dec string | def hexToDec(hexstr):
lehex = ''.join(reversed([hexstr[i:i+2] for i in range(0, len(hexstr), 2)]))
decstr = str(int(lehex, 16))
return decstr | 1 |
f304287eef853bf1f1007f022ee9e49e | 98152a9290228a2dd0cb7ba9667623f7 | Returns a {@code Collector} that accumulates the input elements into a
new {@code Set}. There are no guarantees on the type, mutability,
serializability, or thread-safety of the {@code Set} returned; if more
control over the returned {@code Set} is required, use
{@link Collectors#toCollection(Supplier)}.
<p>
This is an... | fun <E : Enum<E>> toImmutableEnumSet(): Collector<E, *, ImmutableSet<E>> {
return Accumulator.TO_IMMUTABLE_ENUM_SET
} | 1 |
d558023246355fb839cdb93c85a685c7 | 9d291b196463aa5c29393a903df41522 | Test the request headers not containing enough bytes for a valid status-line. | msg = 'INVITE sip:bob@biloxi.com SIP/2.0' + \
'\r\nVia: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds' + \
'\r\nVia: SIP/2.0/UDP bigbox3.site3.atlanta.com' + \
'\r\nMax-Forwards: xyz' + \
'\r\nFrom: Alice <sip:alice@atlanta.com>;tag=1928301774' + \
'\r\nCall-... | 0 |
396b284fbeebfb5d2137e13cf01ffa07 | 7a4b6360405816bcf85b6e24a8ea38d7 | Get the lib variable1. | libvar_t *v;
v = LibVar( var_name, value );
return v->value;
} | 1 |
efaa062a7d56e2d88e8bc28673dfe1f5 | 026123fcafafcd6dffb74d867083199e | PublisherService constructor. | {
$config = array_merge([
'publisher_id' => getenv(static::PUBLISHER_ID_ENV_NAME),
'product_webservice_password' => getenv(static::PRODUCT_WEBSERVICE_PASSWORD_ENV_NAME)
], $config);
if (!$config['publisher_id']) {
throw new AffilinetProductWebserviceExcept... | 1 |
419e9ce964aa10208f2ed03820d43347 | 444d352d0fc37758a4f169617904a12f | Executes the code in the specified scope.
Returns an ObjectHandle wrapping the resulting value of running the code. | {
CheckDisposed();
ScriptSource sourceCode = PythonScriptHost.Engine.CreateScriptSourceFromString(pythonCode, kind);
return sourceCode.Execute(_scope);
} | 1 |
4b33ddd7c7a2d71578e1b32fb762796f | 656a06f170e83e8aa8729a98e5ec7c8d | 숙박 정보 등록 | DBConnection dbConn = new DBConnection();
Connection conn = dbConn.getConn();
hotelInfoLUserDao dao = new hotelInfoLUserDao();
int intResult;
try{
intResult = dao.hotelInfoLUser_insert( conn, vobox, box );
}catch( Exception e ){
System.out.println( "cmd hotelInfoLUser_insert Exception ==>"+e );
... | 1 |
71f8997b1bd912baddae595c7e7662bc | 7db63712cc0075d8d8530c74edd865c6 | Obtiene el tipo de imagen segun la extension | $type = false;
switch (strtolower($ext)) {
case 'gif':
$type = self::TYPE_GIF;
break;
case 'jpg':
case 'jpeg':
$type = self::TYPE_JPG;
break;
case 'png':
$type = self::TYPE_PNG... | 1 |
d68191f72e2183beba839442cd067e6e | f4a74734a9d4775dcd03c734e8533b23 | Método para exibir todas as apostas feitas em um cenário. | public int valorTotalDeApostas(int cenario); | 0 |
ce74ffc176bf0454f5b5e037e302488a | 57a37638302eeb478b2e428fe9d0116a | 按照指定大小将字符串截取成一组子字符串 | if (isEmpty(str)) {
return new String[] { str };
}
if (size <= 0) {
throw new LSysException("The size parameter must be more than 0.");
}
int num = str.length() / size;
int mod = str.length() % size;
String[] ret = mod > 0 ? new String[num + 1] : new String[num];
for (int i = 0; i < num; i++) {
... | 1 |
cd85a52987f9e0a11f054ce30a4152c2 | f89ba21ec6a362e314d1c516bef6b1d6 | https://docs.python.org/3/library/exceptions.html#exception-hierarchy | import paramiko
msg = str(excp)
if isinstance(excp, socket.timeout):
return cls(msg, cls.TIMEOUT)
elif isinstance(excp, socket.gaierror):
if excp.errno == socket.EAI_NONAME:
return cls(msg, cls.DNS_NOTFOUND)
elif isinstance(excp, socket.err... | 1 |
fb941b6ed3c40e768efa78f69d8e527f | ea7433c175031a1b0d7e485d9729b059 | Add an xz and yz slice to a plot with given axes. | z = [int(i) for i in zz]
y = [int(i) for i in yy]
x = [int(i) for i in xx]
for dest_view in self.views.values():
dest_dims = dest_view.main_volume.shape_xyz()
points_1 = self.view_to_view(x[0], y[0], z[0], Orientation.axial, dest_view.orientation,
... | 0 |
d6a5461b5b0dde713a3cfb0998733442 | 241f97282285fd4996139453e96d01c9 | styles the content of the planet stats | {
return(
<div>
<h1 style = {headerStyle}>
{props.persona.name} ({props.persona.level}/{data.getArcana(props.persona.arcana)})
</h1>
<h2 style = {headerStyle}>Inherits: {data.getType(props.persona.inherits)}</h2>
</div>
)
} | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.