query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
e84c0187d46d4aeba8475fddb14765e6 | 0a3f06eb9e19382f346ee3d06321d416 | no more than two characters | class Manager:
def get_last_name(self):
if len(self.name)<=3:
return self.name[0]
else:
return self.name[0:2] | 1 |
24cb7d7de9e886008bc638b72e28a350 | a0260447482e0db2f629c733ad718bbf | returns command velocity Vector given vehicle current position, velocity, acceleration and desired position | double reqTheta) {
double l, wheelRadius, trackWidth, angularVelocity, turningRadius, ICRI,
displacement1, rps1, driveVelocity1, ICRO, displacement2, rps2,
driveVelocity2, dt;
l = AckermannController::getL();
wheelRadius = 0.3;
trackWidth = 1;... | 0 |
f1aaf2b9e2626770bb5de7cf1aef8cf3 | f38e509d76e220afbabe0df216725e48 | 跨浏览器获取Text | if (window.navigator.userAgent.toLowerCase().indexOf("firefox") != -1) {
return obj.textContent;
}
else {
return obj.innerText;
}
} | 1 |
d042305523f3dbc212e18f087af75d07 | e303c226320cd6f8ce870a2f9ff2db74 | # Sets up choices for selection in selectInput in ui.R | example_choices <- function() {
c("eight_schools", "multi_normal")
} | 1 |
799952e714685645bf7d464aede85ff2 | 69dd36ac999c00d151fd9eb6ea4006be | Re-apply force dark toggle state (sometimes checks too soon after launch) | _, _, sec, cmd = reaper.get_action_context()
state = reaper.GetToggleCommandStateEx( sec, cmd )
reaper.SetToggleCommandState( sec, cmd, 1 )
reaper.RefreshToolbar2( sec, cmd )
end | 1 |
4a66878dc1b931d2e364c4d60cf82703 | da6f8f06906fdc827e0132c44fab3eda | Initializes a new Bidder with name, budget and bid increase %.
Bid probability is using a random value between 0,1. | class RandomBuyer(RandomAgent):
def __init__(self, agent_id: str, reservation_price: float):
super().__init__(agent_id, reservation_price) | 0 |
c4696bee3fbc48a808f66722237733c3 | 5574038ed9610654968be1f4eba3c61e | Handles the OnClick event of the lbtnSavePopup control. | namespace WebCounter.AdminPanel.UserControls
public partial class SettingsSiteActionTemplate : System.Web.UI.UserControl
protected void lbtnSavePopup_OnClick(object sender, EventArgs e)
{
racbRecipients.Entries.Clear();
foreach (AutoCompleteBoxEntry entry in racbRecipientsPopup.Entri... | 1 |
6f3cd095fc334783babcb9f1a968cf20 | c991d5160f8c4badd3153290254d6c59 | Verifies the result is the correct HTTP response type of 'NoContent' | class ApiResultControllerTest extends BaseTestCase
public function testDeleteResultAction204NoContent(array $result): int
{
$headers = $this->getTokenHeaders();
self::$client->request(
Request::METHOD_DELETE,
self::API_ROUTE . '/' . $result['id'],
[],
... | 1 |
1d0f05644b6de927811d29b7af234533 | f0ba8bc4e1cbbbcb08397ffebc3ed775 | Calc some pattern length stats | enum pat { FIVE=0, FOUR_OPEN=1, FOUR_HALF=2,FOUR_SPACED = 3, THREE_OPEN=4, THREE_HALF=5, TWO_OPEN=6, TWO_HALF=7, ONE= 8};
if (length>=5){
pattern[FIVE]+=1;
}else if((possible_length_R>=5)&&(possible_length_L>=5)){
pattern[FOUR_SPACED]+=2;
}else if(length==4){
pattern[3-free]+=1;
}else if(possible_... | 1 |
37d16b24cf38f8f92bfea52cfa4c9040 | deb42befaa0d4c498e27aa20e9ac1e27 | Apply WHERE conditions to the alias for the Replay join table. | {
StringBuilder sb = new StringBuilder();
bool clauseExists = false;
for (int i = 0; i < 10; i++)
{
if (where.Contains("@" + i))
{
parameters[i.ToString()] = GetValue(signal, "Param" + i);
}
}
while (where.Contains('['))
{
sb = sb.Append(where.LeftOf('['));
string fieldNa... | 1 |
60ea0cf2c517043d533a792d34f58641 | 293540da01371fe1ad0afcb9d26ab1bb | Returns the tag element in the IFD structure.
Should be a value between 0x00 to 0xFF. | class Asn1rd(Asn1Reader):
def get_tag(self):
result = self._lib_vscf_asn1rd.vscf_asn1rd_get_tag(self.ctx)
return result | 1 |
0b0f845d96d2583d06f625dc3fa76d82 | 52ce778600911f551707101b845b0c06 | 获取字段remark5的值,该字段的<br>
字段名称 :备用字段5<br>
数据类型 :varchar(255)<br>
是否主键 :false<br>
是否必填 :false<br> | public class BaseEntity implements Serializable
public String getSystemReserve5() {
return systemReserve5;
} | 0 |
4110aba1bfb9dee76c6ae5acd139d41f | 654f17a3a4da24ea623090bdedfb9003 | go to end of line | void Buffer::move_EOL() {
int before = f_curs.col;
f_curs.col = (int) content[f_curs.row].size() - 1;
int after = f_curs.col;
int delta = after - before;
s_curs.col += delta % (s_curs.max_col - s_curs.min_col);
if (s_curs.col < p_curs.col)
p_curs.col = s_curs.col;
wmove(pad, s_curs.c... | 1 |
9f655d7eb674577c25c497cf4cb55e06 | a61f7f73ce25e445314a6788f7530e85 | sets all shown answers | function showGivenAnswers () {
strHTML = "";
for (var id in massachusetts.objDialogue.answeredQuestions)
strHTML += massachusetts.objDialogue.answeredQuestions[id].id + ": " + massachusetts.objDialogue.answeredQuestions[id].input.answer + "<br />";
jQuery("#massachusettsPlayground").html(strHTML);
} | 1 |
2ca63e59a3d7f549dcc76d1ea9e5bda2 | 6612390941601fc1ba496440dfeb8ac3 | Returns the number of microseconds since the current sketch started running | uint64_t getus()
{
register _u32 cached_ms, cached_tick;
_u32 context = enter_critical_section();
cached_ms = _systick_val;
cached_tick = SysTick->VAL;
if (SCB->ICSR & SCB_ICSR_PENDSTSET_Msk) {
++cached_ms;
cached_tick = SysTick->VAL;
}
leave_critical_section(context);
re... | 1 |
267a515ecf61e08af5be1b2e193c72f3 | d70dd55caa431b843aa21823332ce384 | makes histograms of the occupation and detection probabilities | plt.subplot(2, 1, 1)
plt.hist(data[0], bins=nbins, range=[t_lolim, t_hilim])
plt.xlim(0, 10)
plt.ylabel(r'$No.\/of\/entries$')
plt.xlabel(r'$Decay\/Time,\/t\//\mu s$')
plt.title(r'$t\/Distribution$', fontsize='x-large')
plt.subplot(2, 1, 2)
data_deg = data... | 0 |
02531f0d9e939017972214ff2c2de0b6 | 3284ea7b2b8b0345963deafa4f24dea9 | Returns whether or not this sound can be played back | namespace Otter.UI.Resources
public class SoundInfo : Resource
public bool IsPlayable()
{
return (mWaveOut != null && mWaveStream != null);
} | 1 |
68b2ea5535b142c93362d7fe8c469c4a | 6d72906fd1c79ab29663631176971d0f | customisation for running the Patatrack triplets reconstruction, with automatic offload via CUDA when a supported gpu is available | number_of_batches = (int)(TOTAL_TRACKS/BATCH_SIZE);
std::srand(std::time(NULL));
concurentThreadsSupported = 1;
std::cout << "Available threads: " << concurentThreadsSupported << '\n';
} | 0 |
fcc5cf113de444f152be367ef1209114 | 00fdc2251fa9bc4f80727f39449122b3 | Checks if there is an item in list a that is also in
list b | {
bool found;
if (!A->length) {
return true;
}
for (int i = 0; i < A->length; i++) {
found = false;
for (int j = 0; j < B->length; j++) {
if (B->items[j] == A->items[i]) {
found = true;
}
}
if (!found) {
return f... | 0 |
2827dc953a4fac3c547c9ae616a2d264 | eea876e4b38191a82a05f67844ffc1ce | GET: api/PuntuacionesRest | [HttpGet]
public ActionResult<object> Select()
{
try
{
var test = _scoresService.DoNothing();
var items = _scoresService.GetAll();
if (items.ToList().Count > 0)
{
var toSerialize = new Mes... | 1 |
a42cefda90e17148dcc980366680c025 | 80c47d4aa75be9c067c740cbe1e931da | Make workflow executor serializable | class TransportableException(JoblibException):
def __reduce__(self):
return self.__class__, (self.message, self.etype), {} | 1 |
f581079b55fe474144d63a7c52c2edcc | 1070d316fba291f2a52f6379acb12c6c | 给定一个整数,写一个函数来判断它是否是 4 的幂次方。如果是,返回 true ;否则,返回 false 。
整数 n 是 4 的幂次方需满足:存在整数 x 使得 n == 4x
示例 1:
输入:n = 16
输出:true
示例 2:
输入:n = 5
输出:false
示例 3:
输入:n = 1
输出:true
提示:
进阶:
你能不使用循环或者递归来完成本题吗? | def isPowerOfFour(self, num):
return num>0 and not(num&(num-1)) and len(bin(num))%2==1 | 1 |
0c6233fbe6e2e79b65098856a7fc1b7f | 790938d26af291c4102aac0a560119d9 | Deletes a simple or extended slice and closes up the gap(s). | h, w = self.slices[upperi][upperj]
if (h, w) == (0, 0):
return
for i in range(upperi, upperi + h):
for j in range(upperj, upperj + w):
self.free[i][j] = True
self.slices[upperi][upperj] = (0, 0) | 1 |
5854a0e5a77128cafd5ea8de7dbccba6 | cd8198abdd2b4f1ff2bd0f528179d33c | Called after a streaming data packet has been sent. | {
paTestData *_data = (paTestData *) userData;
printf( " |-- Stream Completed : %s\n", _data->message );
} | 0 |
d4011d22817f89d17c05e71ceefb09c7 | 06c7e03280a4203d25b7bb3b3c2fd0a0 | silnia rekurencyjnie | if (i > 1)
return (i * Fac(i - 1));
else
return 1;
} | 1 |
530ea9a2f05c3ff9ce8e25cb80c97f60 | 9f339684c3aa135c8e80eb738905cca1 | Create or update a document. For MongoDb, this is using "findAndModify" with
the "upsert" flag (insert or update). | namespace Mongo.CRUD
Task<bool> UpsertAsync(TDocument obj); | 1 |
d5ed05efd6756335b246bbcb12792a0b | 2351761d4bd28aff703fe79560644754 | Restore stack offset based on input stack offset | {
int needed_space;
needed_space = get_full_stack_offset();
assert(needed_space >= 0);
if(needed_space != 0)
{
fprintf(o_file, "\tsubq\t$%d, %%rsp\n", needed_space);
}
} | 0 |
05fd2bd78a603e5404d90afa3965693b | 0e91bd26e4806dce7893e0c4f752eaed | Convert from YUV422 format to RGB888. Formulae are described on http://en.wikipedia.org/wiki/YUV
http://www.twam.info/linux/v4l2grab-grabbing-jpegs-from-v4l2-devices | {
unsigned int in, out = 0;
unsigned int pixel_16;
unsigned char pixel_24[3];
unsigned int pixel32;
int y0, u, y1, v;
for(in = 0; in < width * height * 2; in += 4) {
pixel_16 =
yuv[in + 3] << 24 |
yuv[in + 2] << 16 |
yuv[in + 1] << 8 |
... | 1 |
0efdd62600426a4b6c7348c57c9a436d | 9295c21fa1555cd504d84f911b671bce | resets the event (only necessary of manualReset TRUE in ctor) | public void resetEvent (); | 1 |
e72b9661db753dc8254cf2c91cf7974c | 5d44c1e1521ce5e630d8873180138469 | Asserts whether year end balance is calculated correctly | class BudgetModelTest(TestCase):
def test_yearly_estimated_per_category_is_calculated_correctly(self):
calculated_data, real_data = yearly_estimates_and_actuals()
self.assertAlmostEqual(calculated_data.calculated_data.estimates_and_actuals[1][3],
real_data.groceries_estima... | 0 |
23afd7d8b2b8f078b740b04fe63628a4 | 5bd7cb59abed9d8e9e5f3a9215944f9b | 列表添加列(从第二列开始自动添加) | {
$i = 0;
foreach (func_get_args() as $param) {
$i++;
if ($i > 1) {
$query = sprintf('ALTER TABLE %s ADD COLUMN %s;', $table, $this->columnArrayToSQL($param));
$this->exec($query);
}
}
} | 1 |
36889903f7686d6e84553423ff53c3b4 | c3183e95f6cb85eba9ebcd901d7ac49c | need to make sure each triangle has a consistent winding order | void TRIANGULATED_AREA<T>::
Check_Signed_Area_And_Make_Consistent(const int triangle,const bool verbose)
{
VECTOR<int,3>& nodes=mesh.elements(triangle);
if(TRIANGLE_2D<T>::Signed_Area(particles.X(nodes[0]),particles.X(nodes[1]),particles.X(nodes[2])) < 0){
if(verbose) LOG::cout<<"triangle number "<<tria... | 1 |
4c09a47929e4ce0502d021b4e83342ab | 390fab4947e51e983b46b108dc80b20e | 查询最热圆桌 | public Custom findOneByHot(); | 1 |
10eaede70534d0b19cab585023a5a804 | ee1ef95ae02fbfb02f8b56149ef74abd | Provides derived classes an opportunity to handle changes to the DotHeight property. | [TemplatePart(Name = "PART_Dot1", Type = typeof(Rectangle))]
[TemplatePart(Name = "PART_Dot2", Type = typeof(Rectangle))]
[TemplatePart(Name = "PART_Dot3", Type = typeof(Rectangle))]
[TemplatePart(Name = "PART_Dot4", Type = typeof(Rectangle))]
[TemplatePart(Name = "PART_Dot5", Type = typeof(Rectangle))]
[TemplatePart(N... | 0 |
34a34993366af91fe49785abb6415e39 | af432fbf6be924f1ed251c2d28efc082 | Method to maximize the main
screen from menu | class OperationThs:
def max_window(self):
if self.__main_window.GetShowState() != 3:
self.__main_window.Maximize()
self.__main_window.SetFocus() | 1 |
170716b6a9b4189caaea06d1bbb91dfb | 80b23b1f57b5d3269583dcc591ed4496 | 作業状態配列を取得する。 | public class BinStatusDetailsVO extends BaseVO
public Data1VO[] getBinStatusBSOPflg()
{
return m_arrBinStatusBSOPflg;
} | 1 |
151a6d225ab1f90520d59415ecef5204 | 67cf9cd37aa1c304a34f63ff7da52ada | Función que muestra la siguiente foto, si llega la final de la lista,
se regresa al primer valor de la lista | function next(){
if (index<photos.length-1){
index=index+1;
} else {
index=0;
}
document.getElementById('main_image').src=photos[index];
} | 1 |
f48731062a7096d50bca8f99bed21319 | 8b7424e9f24348eb2a942a5e5dd10505 | 启动发送文件的线程 | class ChatWin(QWidget, Ui_ChatWin):
def start_file_send_thread(self,local_path,filename,myID,aimID,file_win,send_sockfd,process_value):
content = 'put' + '*^$*#%*' + local_path + '*^$*#%*' + filename
send_file = Thread(target=self.send_file,args=(content,myID,aimID,file_win,send_sockfd,process_value))
... | 1 |
32b211d273daba91e042037f57c3d594 | 00519b2aad71b60e0297efb3d16ef81d | Returns the page object, which corresponds to the given absolute url string. | class Repository implements RepositoryContract
public function page($url)
{
$page = $this->pages->first(function ($key, Page $page) use ($url) {
return $page->getUrl() === $url;
});
if ($page !== null) {
return $page;
}
$pageModel = PageModel::query()
... | 1 |
8fb21af5c09109e4d2d7a61f595b6299 | 69fb39c9ca3b41a82d5c92ec2ae36a09 | 後半3fタイムを返します | public class NyujokenHagakiParam extends NyujokenHagakiPart
public RString getAtena34() {
return this.atena34;
} | 0 |
578dd26c4dff341730596b4b7592d984 | f0c36a81820e8a9d6149eb4b4c8d9f94 | N个月的最后一天 | Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, n);
int MaxDay=c.getActualMaximum(Calendar.DAY_OF_MONTH);
c.set( c.get(Calendar.YEAR), c.get(Calendar.MONTH), MaxDay, 23, 59, 59);
return c.getTime();
} | 1 |
c99eabc9d07f05f0e8be2a6659b80e46 | 72c5ff59267c2c46eeb987be1b6b3392 | Sum of Path Numbers (medium)
Given a binary tree where each node can only have a digit (0-9) value, each root-to-leaf path will
represent a number. Find the total sum of all the numbers represented by all paths. | int main()
int main()
{
struct node *root = newNode(6);
root->left = newNode(3);
root->right = newNode(5);
root->right->right= newNode(7);
root->left->left = newNode(2);
root->left->right = newNode(5);
root->right->right = newNode(4);
root->left->right->left = newNode(7);
... | 0 |
332cdfc5499b711e7bce192ea6801443 | 17ee9eb4866fb1f8286a2f413d3e5454 | Display the step to execute in
the right side of the window | {
string ShowStep = "";
if ((trayDesignStep & (int)TrayStep.GDS_MODELEDIT) == 0)
ShowStep += TranslationSource.Instance["GDS_MODELEDIT"];
else if((trayDesignStep & (int)TrayStep.GDS_BLOCKOUT) == 0)
ShowStep += TranslationSource.Instance["GDS_BL... | 1 |
0db4206b747c89866cc25f9399808207 | a27176e259f09bdf09a167f690484b03 | 注册文件描述符fd上的可写事件EPOLLOUT | int add_epoll_out_fd(int epollfd, int fd, int oneshot)
{
printf("FD [%d] add_epoll_out_fd(%d)\n", fd, oneshot);
struct epoll_event event ;
event.data.fd = fd ;
event.events |= ~ EPOLLIN ;
event.events |= EPOLLOUT ;
event.events |= EPOLLET;
if (oneshot)
{
event.events |= EPOLLONE... | 1 |
77608aabc1f171c5d5bba7a38084a423 | afb7c532c203bc50589cec12f6ba3760 | Deletes all credentials for a user. | public class CredentialManager
public void deleteCredential(String userId) throws IOException {
credentialStore.delete(userId);
} | 1 |
f207adf1186ab5f886bdf05572ff5a66 | 617c3e19ccbf70f833b032181a047fca | Lấy toàn bộ dữ liệu trong DataBase đổ vào DataGridView. | {
string query = "SELECT * FROM dbo.thongtinnv";
dtgvThongTinNV.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dtgvThongTinNV.DataSource = DataProvider.Instance.ExecuteQuery(query);
} | 1 |
919d43b1322df80367f29fb78e81445c | ea852fbf462382183bd6ac5b3fe5ed4a | 字符串转日期 yyyy-MM-dd | @Slf4j
public final class DateUtils
public final static Date StrToDate(String str) {
return StrToDateTime(str, P_yyyy_MM_dd);
} | 1 |
8e9ef0f6460cc56378c31b10373fa71d | dc143d8dc4c33255f1693f61679702ac | Définit le statut d'importance du champ | namespace imbSCI.Core.extensions.table
public static class dataColumnRenderingSetup
public static DataColumn SetImportance(this DataColumn dc, dataPointImportance col_importance)
{
dc.ExtendedProperties.add(templateFieldDataTable.col_importance, col_importance);
dc.ExtendedProperties... | 1 |
2e7573f74df19a2933f3adb3d941af40 | cc88d701f2cc535e70f753a0a449d0cf | Get raw image from the right side camera | img = None
while not img: img = self._read_camera()
size = img[1][0]
img = np.flipud(np.array(img[2], dtype='uint8').reshape((size, size)))
return img | 0 |
2073912613a5f12767ad2612085fd9a8 | bc0aece6b5a43c3c4fd7aee4b5cadb0a | Read the version information from the _version.py file | def read_version(version_file_name):
version_file = open(os.path.join(version_file_name)).read()
return re.search("__version__ = ['\"]([^'\"]+)['\"]", version_file).group(1) | 1 |
aece73769a4721f0be4e4092a9fce0c6 | 87e4eb71d2179e35e8833f4def088529 | <p>
Test compress and decompress methods with illegal arguments.
</p> | public class MVStoreTest
@Test
public void testGetCompressionLevel()
{
fail("Not yet implemented");
} | 0 |
8f2c3783481275be954b9be4fdea1c77 | 90f9f1bb0c72b0eb4bc9fbc702e6c937 | ******** 查询提现手续费 ******** | function getWithdrawHandFee(req) {
return axios({
headers: {
'Authorization': 'Bearer ' + lStore.get('token'),
'Content-Type': 'application/json'
},
url: createUrl('/v1/misc/listByArray', req),
method: 'get',
})
} | 1 |
766eeb9f15238d5f6dac19b4337bd90d | 4db747d2e4d6f52246e9931d52347d8f | Entry intro author info | def info():
print(Fore.RED+"Author/Senior DEV :"+" "+Fore.CYAN+"H2O")
print(" ")
print(Fore.GREEN+"------------------------------------")
print(" ")
print(Fore.RED+"junior DEV :"+" "+Fore.CYAN+"Jessica Miles")
print(" ")
print(Fore.GREEN+"------------------------------------")
pri... | 1 |
ab86f497c325522364ba0f36b5a9ddc7 | e09c02f6555ab0b0a5656eec7e46bd93 | 周期变更申请撤回 | public void apprPerChange(ApprParam apprParam) throws HsException; | 0 |
6cf0a98b18c53bd21eabd36d70a4a73e | 376946f62ee36c3c725b4f76b083d540 | 默认过滤框 | function GetDateStr(num, filter)
function FilterClean() {
$("#variety option:first").prop("selected", 'selected');
$("#material option:first").prop("selected", 'selected');
$("#surface option:first").prop("selected", 'selected');
$("#height option:first").prop("selected", 'selected');
... | 1 |
7c355de05a8a64986824c2359981cf7e | 85c6e02014a18ec52f28bc26802f4354 | 添加网络层 | public class MBDllWrapper
public static native void MBAddNet(); | 1 |
647e3e49a830fbac00bd9532e6ead8a8 | 8a76e1ae8cc9c90bf938a3d585d60dd2 | Returns the value of field video | @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"pack"
})
@XmlRootElement(name = "Message")
public class TerminialStatusMsg @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"ppvspMessage"
})
public static class Pack @XmlAccessorType(XmlA... | 0 |
d3df1ae3a3b1543610a82f0a78531986 | 4b6e2ea05a7c4055beb522f5fa035fea | Quantize the position data. | class StateIndexObjectAttribute(core.PointObjectAttribute, core.DerivedObjectAttribute):
def _get_data(self, idx):
position = self._other_attr['position'].get(idx)
return roundup(position).astype(int) | 1 |
60852fc71dc69ab77ffdddd8e70c1518 | 75feb33a7177805dbe00afb2d4853e27 | Установка темной темы. | public static class SpecialFunctions
public static void SetDark()
{
gameUI.SetDark();
} | 1 |
e3ec68458325c9728fe41e1bba11f479 | 3aa3b76c1bf08a4d4af982aab6e05547 | Returns a dictionary mapping (allele, peptide) pairs to rows. | class Dataset(object):
def allele_and_peptide_pair_to_row_dictionary(self):
return {key: row for (key, row) in self.iterrows()} | 1 |
1e19782c1e2cf15593622d8029941d81 | b21d79c373eb2e45c63e26e453b2758c | This method sets the config root class per document | public class TexDocumentImpl extends Environment implements TexDocument
public void setDocumentClass(final String documentClass) {
this.documentClass = documentClass;
} | 0 |
6e97b55808cb21d713e2e06f7a1f5943 | 0c46b1a520a303d79cd26d57ff6bd8a9 | Tests kerberos challenge/response where the client response is bad. | app = TestApp(KerberosAuthMiddleware(index,
hostname='example.org',
unauthorized=('CUSTOM',
'text/html')))
r = app.get('/', expect_errors=True)
sel... | 0 |
5ebfa44937f0cad78f58bdf47ad679ff | 58a3db322357b4c1fd26d25d0a16fd9c | 根据文件名的后缀来判断是否为图片样式 | List<String> suffixList = Arrays.asList("jpg", "png", "gif", "jpeg", "bmp");
if (suffixList.contains(suffix)) {
return true;
} else {
return false;
}
} | 1 |
380e8b0a05234d67e88b596e748ce691 | 676b20f0d35c098d8e33996a13303f4d | permet de tester la création d'un enclos | def test_est_occupee():
place(1, 6)
if not (est_occupee(6)):
print("Erreur 1")
place(0, 8)
if (est_occupee(8)):
print("Erreur 2")
exit()
if (est_occupee(6)):
return True | 0 |
877bab1b5d129118294169dde1fb551d | 8160b0ff6ed4b1b583be0f5441c1a0ad | Get a short from the buffer and align the read pointer | uint_16 res = (buffer[ptr_pos + 1] << 8) + (buffer[ptr_pos]);
ptr_pos += sizeof(uint_16);
return res;
} | 1 |
6863fa38744d9fb7288483aca75b7403 | 75f41b73086de147374a19f87a8ceec8 | if the list is empty, do nothing | class RList
void print() {
if ( this->isEmpty() ) return ;
std::cout << this->first << std::endl;
this->rest->print();
} | 1 |
1a122b0c39ed4f152f12137e7e3fcdae | ef1b2a8173a547ba6aaa14d5cbf4ceaf | 判断传入的定位器locator的类型是否为tuple,如果不是,则不进行元素定位 \n | if not isinstance(locator, tuple):
print("locator参数类型错误,必须是元组类型:loc=('xpath','value')")
else:
try:
print("正在定位元素信息:定位方式->%s,value值->%s" % (locator[0], locator[1]))
ele = WebDriverWait(self.driver, self.timeout, self.t).until(EC.presence_of_element_... | 1 |
695250de9cea3fc9c77c8b9bf598b902 | a2f33d63750adb847b5b375a8f83c0ce | elimina un concepto registrado en la memoria de costos | class FacturasController extends Controller
public function actionDeleteCostos($id) {
if (Yii::app()->request->isPostRequest) {
$model = CentroCostosFacturas::model()->findByPk($id);
$model->delete();
if (!isset($_GET['ajax']))
$this->redirect(isset($_POST['re... | 1 |
a4351d5f97fce95d8e7170db359dee20 | 6cf1bf0bd0a6529dda720e446df85545 | Fill album titles menu ( right menu list ) | function getAlbumsList(){
global $translator;
return array(
'faces' => $translator->trans('album_title_1'),
'girl-and' => $translator->trans('album_title_2'),
'in-the-middle' => $translator->trans('album_title_3'),
'may' => $translator->trans('album_title_4... | 1 |
77386b964fabf02a08896ba2a19b3ba1 | d45d9d043becf8c25fd8331f1b43a411 | Return as a timedelta the offset on this date for the local timezone compared to UTC | time_here = date.astimezone()
time_utc = time_here.replace(tzinfo=pytz.utc)
offset = time_utc - time_here
return offset | 1 |
c6bd4cd9cecb2eb0ddc838410fa81f9a | 4e0126bba132f08160394211793ff34d | 文章删除(物理删出) | $returnData = [
'result' => false,
'message' => '彻底删除失败',
];
try {
$info = $this->articleRepo->find($id);
if($info->status == getStatusClose()){
if($this->articleRepo->destroy($id)){
$returnData = array_merge($returnData, [
'result' => true,
'me... | 1 |
c576cf2555bffc8e75ad565c08b60dd5 | 0b6c41520d740855e7be587453c87e5b | Find the generator loss using either least squared error or negative log likelihood. | class CycleGAN():
def G_loss(self, D, fake, real_label=1.0, epsilon=1e-12):
if self.opt.gan_mode is 'lsgan':
generator_loss = tf.reduce_mean(tf.squared_difference(D(fake), real_label))
elif self.opt.gan_mode is 'vanilla':
generator_loss = -1 * tf.reduce_mean(tf.log(D(fake) + ep... | 1 |
828f0be798d9a6a8bc10b5e8fc23152f | 0aad0a3bdd972bb0aca48dd6b3296fbf | 校验验证码
1. 获取表单中的验证码
2. 获取图片上的文字 | text = attrs.get('text')
redis_conn=get_redis_connection('code')
image_id=attrs.get('image_code_id')
redis_text=redis_conn.get('img_'+str(image_id))
if redis_text is None:
raise serializers.ValidationError('图片验证码过期')
if redis_text.decode().lower() != text.lowe... | 1 |
0bacd94cb51d0ff7813e7b282de003ac | 9adc9fc19aa26dd011167845020cc277 | funcion para establece el modo de codificacion de los datos (CRC Encoding),
puede ser de 8 bits, 16 bits o deshabilitado.
por default lo establece a 8 bits (1 Byte).
no devuelve ningun valor. | {
uint8_t config = NRF24_read_register(REG_CONFIG) & ~( _BV(BIT_CRCO) | _BV(BIT_EN_CRC)) ;
if ( length == RF24_CRC_DISABLED )
{
}
else if ( length == RF24_CRC_8 )
{
config |= _BV(BIT_EN_CRC);
}
else
{
config |= _BV(BIT_EN_CRC);
config |= _BV( BIT_CRCO );
}
NRF24_write_register( REG_CONF... | 1 |
115fa5c1e8a38b26d1ac32c94ebb7477 | 876bd76f34b23b0a99192eceaacd3312 | Check whether the computed triangles are consisting with the edges. | {
int[] triangles = GetTriangles();
Dictionary<Edge, List<int>> trianglesByEdge = new Dictionary<Edge, List<int>>();
for (int iTriangle = 0; iTriangle < triangles.Length / 3; iTriangle++)
{
Edge[] edges = new Edge[]
{
... | 1 |
7c7f63f00cd279a72dd605d9480fbb0b | 40f2ef3132ee2b602022a91644db7e70 | GET: All parts | namespace TruckCheckUp.WebUI.Controllers
public class PartCatalogManagementController : Controller
public ActionResult Index()
{
var partCatalog = _partCatalogService.RetrieveAllParts();
return View(partCatalog);
} | 1 |
475b189177fabed90c1033e594da6d78 | 52f7a658a860214af9ed417b5d4c324f | Identifies whether the specified value is associated with one or more
parameter names in this instance.
at least one name | class BodyAssertion extends AbstractAssertion
function hasParameters($names)
{
foreach ($names as $name) {
if (!$this->hasParameter($name)) {
return false;
}
}
return true;
} | 0 |
58c69c83e7a8ee292532665cde648f9f | 8774a8b275694d6b5274e1b80abe2417 | Set to true to include territories in the list of states | class Action extends AbstractAction
public function setInclusionStates(bool $inclusionStates): self
{
$this->inclusionStates = $inclusionStates;
return $this;
} | 1 |
7118168cebc032d66fca873f59b6b700 | 8e3c5a508b421cfbc6c062a83b3f5763 | Gets order guide item descriptions for all catalog items | namespace Broobu.Media.Contract.Interfaces
[OperationContract]
DescriptionItem[] GetDescriptionItemsForCulture(string objectId); | 0 |
ae8316d9a5ab88bf22721dfeffbe8ae6 | d28c03183caec3340da14481c86d2756 | Method for calling a procedure, assuming no data table is returned | public void callProcedure(String procedureName, List params); | 1 |
e3cee91715b054252b62fbae06bc6626 | 3ea7a6fab17211a9753bb209b2f1bdfa | Hook for reducing objects.
The function intercepts serialization of all objects and store them
to internal data structures, preventing actually writing them to
the buffer. | @store.compact if @optimize_objects
@store.each do |ref|
ref.offset = output.size
output << ref.object
end
end | 0 |
05e6f13673606e136350f42068b174ce | 3f3f3a5592b5075f73374998488b8174 | It returns the snake's tail size. | {
SnakePart_t *current = self->head;
int count = 0;
while (current->next != NULL)
{
count++;
current = current->next;
}
return count;
} | 0 |
ef10260fe322234c54ef8c8678944fdd | 7313873aab9d3c6522b48a64e6e12879 | 测试正常发布社团公告、使用不存在的社团发布与重复发布 | response = self.client.post('/delete/cancel_follow_club/', {'followerid':'1','name':'动漫社'})
response1 = self.client.post('/delete/cancel_follow_club/', {'followerid':'1','name':'篮球社'})
response2 = self.client.post('/delete/cancel_follow_club/', {'followerid':'1','name':'动漫社'})
self.asser... | 0 |
cc9113ddcffe96a8f2fc5dc1179fe05d | ea8ef037f553a34cd601820697383a88 | Este método es el que guarda en un archivo de texto (en el disco duro) todos los contactos. | public class ContactManagerImpl implements ContactManager
@Override
public void flush() {
try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("Contact.txt"))) {
out.writeObject(idCreator);
out.writeObject(contactSet);
out.writeObject(meetings);
... | 1 |
3e668e363c295ce23056828ba1df5121 | 0e3706f1d63555f89187e1b8a26d2f4a | reading keyboard input buffer
16 bit word as:
scan code in hi byte and
ascii code in lo byte | void keyboard_handler(struct regs *r) {
unsigned char scn = inportb(0x60);
if (scn & 0x80) {
return;
} else {
kputch(scanCodeToAsciiTable[scn]);
}
} | 0 |
41a7038aed6c4d5d7a2b6cee413a2a58 | 27c831ecd506c6847df3c3ee73513e9d | 从MSMQ中接收消息 | {
Task<ServiceBusDTO> t = Task<ServiceBusDTO>.Factory.StartNew(() => {
ServiceBusDTO dto = null;
while (null == dto)
{
Thread.Sleep(1000);
dto = messager.Get<ServiceBusDTO>(subscription);
}
... | 0 |
ec4d5d0754fcf756086d46c092cfc6ca | f4f4a19215d4553f0d17bd13af962b2d | Get the previous location of the pager's tab indicator. | if (tabBar.getWidgetCount() == 0)
return null;
return tabBar.getWidget(tabBar.getWidgetCount() - 1);
} | 0 |
e1a6e2eafd7dc4c83404da7909cc652f | 9f2c3fbb57e55eb22c802de1d379fd0e | Ensure IP has 4 octets | octs := strings.Split(ip, ".")
if len(octs) != 4 {
return false
}
for _, oct := range octs {
if len(oct) > 1 && oct[0] == '0' {
return false
}
v, err := strconv.Atoi(oct)
if err != nil {
return false
}
if v < 0 || v > 255 {
return false
}
}
return true
} | 1 |
19be71bbd55e1a3dcee43ce905029174 | b5de84db0026e75e25229a5b95307b54 | Return CSS selector of main image | public function getMainImage(); | 0 |
24a050f0751b356bd52f6f955c30cd2c | 4031f5b3c0411d9f31348c8f05a36e4e | 添加新收集的,还未抓取过的HOST,如果之前已经添加过则不会重复添加
新的host | ipt = self.isIp(option.add, True)
if ipt:
ip = option.add
res = self.oldGetHost(ip, True, True)
if len(res) == 1:
print(self.Red.format("already exist !"))
elif len(res) == 0:
u = self.conf["USERINFO"]
record... | 1 |
31ca324afb928a003567c996d30b8717 | e67da2e2152589c314032f3b08bc9c75 | Get amount of pixels in the cell. | if (getCells().length == 0) {
return 0;
}
return getCells()[0].length;
} | 0 |
e2fb93da580cdbc135f2e5a4c5b7b77a | 5c3363b6d18bf53e98f7acbc449e916c | Returns the value of the '<em><b>Image Data</b></em>' attribute.
<!-- begin-user-doc -->
<p>
If the meaning of the '<em>Image Data</em>' attribute isn't clear,
there really should be more of a description here...
</p>
<!-- end-user-doc --> | namespace CSharpJExcel.Jxl.Biff.Drawing
byte[] getImageData(); | 1 |
94ff518c4f81980eed776b4e7531e603 | c89114d75eb92d7b24adc9a6f9712113 | Retrieve the raw cell informations (active + neighbouring) | export default class CrosswordCell
getInformation() {
return {
answer: (this.answer) ? Util.toUpperCase(this.answer, Util.UPPERCASE_EXCEPTIONS) : this.answer,
clueIdAcross: this.params.clueIdAcross,
clueIdDown: this.params.clueIdDown,
position: this.position,
score: this.getScore(),
... | 0 |
ed348c0655635cfb12f65436ed71f8be | a7b817ea039e2d53022def8f396b8cb9 | Draw the trajectory when using the AntFourRooms environment. | plt.figure()
if dataset== "kitti":
for description, coords in trajectories_dict.items():
x = coords["x"]
y = coords["y"]
plt.plot(x,y, ls="-", marker=".", color=coords["color"], label=description)
plt.plot(x[0],y[0], marker='o', color=coords["color"])
plt.xlabel("x (m)")
plt.ylab... | 0 |
a4041d976b2ffd2f2d9f44ed8ecdf881 | 5cc0207f765a0e60e610d5f4ca373d6c | Sets the lockTimeout configuration value for the given cache and then returns the current info
for that cache. | public function getLockInfo($objectType, $objectKey); | 0 |
ca7ba4c734cb5dcf7d966a2a0c26aba0 | 89d283aa8390a9ad559f581d38cc4cdc | 安全输出, 判断当前终端如果是可输出终端, 再输出内容, 否则不输出
若当前终端不是可输出终端, 某些情况下会写入 Worker 日志中, 也有一些情况下会导致进程崩溃 | function access(log) {
writeLog(accessWriteStream, log)
if (env === 'dev') console.log(log)
} | 0 |
935c54630b99ff9d8a90299aedea4665 | 5d5e08cc20e69cfc89a250de09567b71 | <p>
Sets the salt generator to be used. If no salt generator is specified,
an instance of {@link org.jasypt.salt.RandomSaltGenerator} will be used.
</p> | public abstract class AuthenticatorBase extends ValveBase
implements Authenticator, RegistrationListener
public void setSecureRandomAlgorithm(String secureRandomAlgorithm) {
this.secureRandomAlgorithm = secureRandomAlgorithm;
} | 0 |
fc5d4dcaabc936bb3f7c11291730ba46 | c2d0f8b355142dd0191f32035c26015c | Returns object describing simulation and objects in it. | namespace Amazon.SimSpaceWeaver
public partial class AmazonSimSpaceWeaverClient : AmazonServiceClient, IAmazonSimSpaceWeaver
public virtual DescribeSimulationResponse DescribeSimulation(DescribeSimulationRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller ... | 1 |
b275cffde5037b13f20b67a5dbee41b1 | e81c02b7f2a4bb5eeea365dd17a9291c | === 携帯向けコンテンツの有無を表示する | if (detectMobileQuick()
|| detectGameConsole()
) {
return true
}
if (detectDangerHiptop()
|| detectMaemoTablet()
|| detectSonyMylo()
|| detectArchos()
) {
return true
}
if (userAgent.indexOf(d... | 1 |
2437f38052ded783aaa785b602ffbfe4 | fbaf412525537c58e5e37f2c893c9140 | Temporal Difference Advantage Actor Critic model. | policy_delay = 2, obs_normalizer=None, action_processor=None,
model_save_path='weights/td3/td3.ckpt',
best_model_save_path = 'weights/best_td3/td3.ckpt',
summary_path='results/td3/'):
super().__init__(env, val_env, sess, actor, critic1, actor_n... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.