query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
60b26c52a4329b2adcbf06b11ef680a1 | 2493849c7c0dfe251d67d615ba76cc99 | Invoked when multiple bullets must be fired, i.e. the triple shot upgrade | {
_currentShotsActivated += 2;
if (_currentShotsActivated > additionalShotLocations.Length - 1) {
_currentShotsActivated = additionalShotLocations.Length - 1;
}
} | 1 |
9eb7a36c0a16bb5096f24cafbdedc529 | 49eed0d2cc380bede785babfec6e827e | ==============================================================================================================================
Returns a point (grid CRS) which is the rounded average of (i.e. is midway between) two other grid CRS points
===================================================================================... | public function midPoint($pointOne, $pointTwo); | 1 |
37257c7897fc95466f16e7d1b48b017f | e4b9730a0fa7817e1743cd1b1709bea6 | Flag to control if shared secrets must be 32 bytes | $ret = ipworksencrypt_elgamal_set($this->handle, 7, $value );
if ($ret != 0) {
throw new Exception($ret . ": " . ipworksencrypt_elgamal_get_last_error($this->handle));
}
return $ret;
} | 0 |
5526712c9aa42d8bb8dedfee22cc4846 | 46a75f9108455054ccdf760960022361 | Retrieve the window handle (if any) for this browser. If this browser is
wrapped in a CefBrowserView this method should be called on the browser
process UI thread and it will return the handle for the top-level native
window. | impl RaylibHandle
pub unsafe fn get_window_handle(&mut self) -> *mut ::std::os::raw::c_void {
ffi::GetWindowHandle()
} | 0 |
ce8b5ee9b211562de28ceb2314635da3 | 58d81670dca79de442553a77ba040c6c | An offset of the oldest available Event in that partition. This value will be changing upon removal of events
from the partition by the background archiving/cleanup mechanism. | long getMinOffsetInQueue(); | 1 |
805e23d30234667b059963ef1fc7292a | 366d590db2f4749347de9e359522ed5f | estimate uses very simple algorithm to assign priorities based on CPU number required for the job | {
time_current = time;
core_t *core = priqueue_at(&c_queue, core_id);
job_t *job_exp = core->job;
priqueue_remove(&j_queue, job_exp);
priqueue_offer(&j_queue, job_exp);
node *i = j_queue.head;
while(i)
{
job_t *job = i->data;
if(job->core_number < 0)
{
job->core_number = job_exp->core_... | 0 |
f29c3e1f68e0e10492345a4058896e8e | 46b90da7ef6f3b0355b18a4927cb6fca | 删除某个查询字符串上的所有侦听器
并移除这个查询字符串 | boolean removed = false;
synchronized (queryListeners) {
Iterator<DiscoveryListener> eachDiscoveryListener = queryListeners.values().iterator();
while (eachDiscoveryListener.hasNext()) {
if (listener == eachDiscoveryListener.next()) {
eachDisco... | 0 |
2f6a9cf8def2e124c408f44a03d1a81c | d0fe48dd464a44b3dbcf5d9699288652 | イベントページを公開するときの特有の処理を行うJobを追加する | public class EntryJobProcess implements IJobProcess
public void start(WorkData workData, WorkFlowEvent event) {
System.out.println("■EntryJob#start()■");
Job job = new Job("Entry");
job.setWorkID(workData.getWorkID());
job.setFlowName(event.getFlowName());
job.setItemID(event.getItemID());
job.setParentItem... | 1 |
2933daeda1cd3b743419037232954413 | 86a06cc7a8bd0798e367720999194b12 | Asserts active filter data. | class RequestTest extends TestCase
public function it_asserts_true_when_filters_exist()
{
request()->offsetSet('name', 'John');
$availableFilters = [
'name'
];
$this->assertTrue(Request::hasFilters($availableFilters));
} | 1 |
d724bcd189a107ad5c96bc7fba1ccf56 | 512948b62590a121908934bf4fa959a9 | 获取登录用户收听的人的列表。 | public class LiveHttpUtil
public static void getUserList(String liveuid, String stream, HttpCallback callback) {
HttpClient.getInstance().get("Live.getUserLists", LiveHttpConsts.GET_USER_LIST)
.params("liveuid", liveuid)
.params("stream", stream)
.execute(callback... | 1 |
7746c0de743a504879b2524802a0168c | 51831882f599fe1e5f1bff6493fefec2 | Remove unwanted fields from the input data before deserialization. | class BaseDocument:
def remove_unpicklable_values(self, state):
state.pop("_meta", None)
state.pop("_permitted_fieldnames", None) | 1 |
d76e8ea6391e37c0fdf296b60609b43a | d1bb7c9c383088389198069182e8bedf | Función que lista los tipos de equipamiento por categoría | {
try {
$user=Auth::user();
$sucursal=Auth::user()->sucursales()->get();
if (request()->get('total')){
if (request()->get('total')>14 && request()->get('total')<101){
$totalpage=request()->get('total');
}... | 0 |
2314fb82cf1932a286245a55db2c77fb | c037c98fe47881b2b27df317e6ddd4bc | method to find the maximum overlap of any given string | int i = 0;
int j;
int k;
int len;
int maxlen = 0;
int maxi = -1;
while(i < s.length -1){
j = i + 1;
while (j < s.length){
if (s.data[i]==s.data[j]){
len = 1;
for(k=1;s.data[i+k]==s.data[j+k];k++){
len++;
... | 1 |
e57d5c9a1ddde4ce1845fb7d84f75379 | 20cac4e65b88b83ef4c4c884e09a3dcd | Integrates the given function via the midpoint rule. | X = np.linspace(a, b, N + 1)
sub_intervals = zip(X[:-1], X[1:])
s = 0.0
for a, b in sub_intervals:
s += pm(f, a, b)
return s | 0 |
51b1720ef4ca27b68a21321c2e89974b | cf1ceb0e0e432860877d35d4a50313fa | 三元组输入函数 | void (*f[3])() = {f1, f2, f3};
int flag;
printf("请输入一个1,2,或者3,输入0退出\n");
scanf("%d", &flag);
while (flag) {
if (flag == 1 || flag == 2 || flag == 3) {
f[flag-1](flag-1);
printf("请输入一个1,2,或者3,输入0退出\n");
scanf("%d", &flag);
} else {
... | 0 |
a87dc3b95680954f3b3464bf6e049d37 | 1deab177086bc4e57d218f160c1e4587 | Runs alignment using the given code file and clone positions. All lines
are 1-based and inclusive. Returns the clone classes after alignment
(sorted by {@link StableCloneClassComparator}). | String output = "";
ArrayList<String> line = new ArrayList<>();
String[] word;
Scanner inputFile;
inputFile = new Scanner(codeFile);
while (inputFile.hasNext()) {
line.add(inputFile.nextLine());
}
inputFile.close();
for (String s : line... | 0 |
ba6e3440dcfe950262ea4621e5ba5e5a | 7f61448ad6da3ef0f9cb03f40c5be655 | # selected | cases like (1) | 0 |
6717260752b9e5cc1803d7add526e9ce | 28494931f4ddfd617ef1597ef5669342 | Initialize a Resp2079876Root object from a json dictionary. | if not isinstance(structure, dict):
raise TypeError('Cannot create %s instance from %r instance'
% (cls.__name__, type(structure)))
root = cls(structure['data'], restrictions)
root._from_dict(structure)
return root | 1 |
8b2d32631ce62342fb5f8147838af086 | 63b86215b664a92e5118f151bfb239ab | Evaluation of the agent's policy. Makes use of a ReLU activation for the hidden layer and sigmoid function
to squash output to probability range [0,1]. | class Pong:
def policy_forward(self, x):
h = numpy.dot(self.model['W1'], x)
h[h<0] = 0
logp = numpy.dot(self.model['W2'], h)
p = self.sigmoid(logp)
return p, h | 1 |
5a044c47f2e2679f4f51de50394d972e | 23ae4ebc0aefd05796d040fe7954efdf | @brief Get currently accessed register, which always equals to selected
register from anx7447 emulator. | {
NX_ASSERT( CNULL != __g_pRegister );
return (U32)(__g_pRegister->ALIVEGPIOINTENBREADREG & 0x03F );
} | 0 |
5eb8cbdc01d4b58b40938144615aabb8 | e6dd6eaf55f98920a1816d78d60ad77f | Deletes one key and child from the sibling, depending on its position. | my_index = self.parent.children.index(self)
if my_index == 0:
return False
left_sibling_index = my_index - 1
left_sibling = self.parent.children[left_sibling_index]
if len(left_sibling.keys) != math.ceil(self.tree.order / 2) - 1:
return False
sep... | 0 |
e26f4c51383991ba48559a215e0e7a0a | 40a8db9950ca449971d57589b6573f89 | Newlines | fmt.Println("\n Newline")
fmt.Println("\t tab")
fmt.Println("\" \" ")
fmt.Println(" \\ ")
} | 1 |
98e176ad3e1daeed79ebb894b4fb01e2 | 3b95e615581018cddc0ac0a2a244f4a3 | Returns whether this direction is horizontal, with the assumption that
only the four cardinal directions are represented. | bool S_HexCoordinates::IsHorizontalDir() const
{
return z == 0;
} | 1 |
18c6f4924ec0add0a4a2e6b80357eb0c | 59b515d60304d4dde6461238289791c1 | determine batch or job directory from cwd and option | class BatchManager:
def ManageOutputDir( self ):
outputDir = self.options_.outputDir
if outputDir=='':
today = datetime.today()
outputDir = 'OutDir_%s' % today.strftime("%d%b%y_%H%M%S")
print 'output directory not specified, using %s' % outputDir
s... | 0 |
5479fa6d61aa8cf8aaf95088f91d0d29 | 0cf8e90a8e7c8ba98739ef2e133c880a | When click/touch down in mobile menu and moved to the left close the menu. | class CallableClass extends JaxonCallableClass
protected function hideMenuOnMobile()
{
$this->jq('body')->trigger('touchend');
} | 0 |
341a5f4c7181225a73da42df6718c060 | 9ade6a149876b7a806e40a72d8b9e4b7 | add value to amount | namespace PointOfSale
public partial class CurrencyControl : UserControl
private void addButton_Click(object sender, RoutedEventArgs e)
{
AmountFromCustomer++;
e.Handled = true;
} | 1 |
b9e23f309b0c218d99c011cae5bb17b7 | b60777ec494ff46a68479c4593876e1d | Hàm search class của GV | {
List<Lop_Gv_Cth> listLopSearch = new List<Lop_Gv_Cth>();
if(tb_lopSearch.Text == "")
lv_tabLop_dsLop.ItemsSource = mListLopGV;
else {
foreach (Lop_Gv_Cth lop in mListLopGV)
{
if(Regex.IsMatch(lop.Lop.MMaLop... | 1 |
1e325cf639971b4380afbca5d5f7d959 | e31c93287360d137da331d60e78d273e | assert that null is returned when passed coordinate is out of bounds | {
Location ob;
ob = new Location(12, 11);
assertEquals(MazeCell.INVALID_CELL, board.getCell(ob));
} | 0 |
523ed7c88f5af42a8500dd54dccabc5b | f90b76d0682e70a7da32abe0428dfabd | 查看某教师指导学生的所有数据 | def teacher_show_student(t):
t.show_students() | 1 |
14cd514381f268d90f6b6ed2ae4473b9 | aaed2505aa6e5e539a4cb93dfd4da8c3 | 发送短信配置信息 ,找回密码/验证码 | @Service
public class ApisInfoServiceImpl implements ApisInfoService
@Override
public ResponseJson sendMessage(String phone, int code,int type){
return (ResponseJson) SendMessage.send(phone,code,type);
} | 1 |
a358b938198a2d8da7683c55522a1efa | 5b1f673a0c376ad5c36b3e11b39a2cae | 判断给定的牌是否碰碰胡 | pair_list = RuleMaJiang.search_pairs(cards)
for card in pair_list:
flag, path = RuleMaJiang.can_hu_by_jiang(cards, card)
if flag:
return True, path
return False, [] | 1 |
3457be3d87c1c041503ca00bb3e1b37e | 3df105756da732f67b8a406c0cef4c3f | 获取报溢报损单 | public class StubManager implements StubManagerBlService{
public ArrayList<SpillsLossBillVO> getSpillsLossBill (BillState st){
ArrayList<SpillsLossBillVO> result=new ArrayList<SpillsLossBillVO>();
ArrayList<StubSpillsLossBill> billList=billPool.getSpillsLossBill(st);
for(StubSpillsLossBill temp: billList){
res... | 1 |
cab814433ae15963d95c820a2e3d3679 | 6feb7f361615099fd980bb5bb15a3427 | @brief find the "best" encryption key
The "best" is the first one that is not expired, or simply the
first one. | static struct search *
new_search(void)
{
struct search *sr, *oldest = NULL;
sr = searches;
while(sr) {
if(sr->done &&
(oldest == NULL || oldest->step_time > sr->step_time))
oldest = sr;
sr = sr->next;
}
if(oldest && oldest->step_time < now.tv_sec - DHT_SEARCH_... | 0 |
a6f2c1c67208a04e132b0de01c4d960b | 123b06b719c1f8e786e936878c665aeb | Gets the location of a SqlParameter in the collection. | namespace Utility.DataAccess
[Serializable]
public sealed class DbAccessParameterCollection : MarshalByRefObject, IDataParameterCollection
public int IndexOf(DbAccessParameter value)
{
return Parameters.IndexOf(value);
} | 1 |
89ec5aa2af04e166564ae3072491c111 | 9e7ade1077c4526b8fdec8d87f860315 | This function calculates the minimum number of bits needed to represent a given unsigned integer value. | int nNum=(int)dNum;
int nStart=CFN_MAXINTBITS-1;
int nZeroStartBits=0;
for (int i=nStart; i>=0; i--)
{
int nPow2=1<<i;
int nVal=nNum&nPow2;
if (nVal) break;
nZeroStartBits++;
}
return(CFN_MAXINTBITS-nZeroStartBits+1);
} | 1 |
4c76b0fff23815b974b7997e5641ed2a | bdf6f3e9eca8a042900f5795deb33507 | 继承力导向网络的构造函数 | class Network(object):
def __init__(self, struct, w=None, b=None, batsize=5, i_max=100, c_min=1e-3, rate=1.0):
self.struct = struct
self.batsize = batsize
self.nlayer = len(struct)
self.rate = rate
if w is None:
w, b = self.initwb()
self.w = w
self.b ... | 0 |
2f4c8d1c84e0996d5747795e8f07cfb9 | 94909173caed4a74931d93de6122830f | this makes a 9x9 filled it with numbers that conform to the rules of Sudoku. | void createVector() {
vector<vector<string>> validNums(9);
for (vector<string>& row : validNums) {
for (int i = 0; i < 9; i++) {
row.push_back("123456789");
}
}
for (int k = 0; k < 9; k++) {
for (int l = 0; l < 9; l++) {
... | 0 |
7465cfb619dc65c81da87c890b639590 | fc8026df197afdae32d3d7bd96aa1f00 | Test the logic for getting mixed geounits outside a boundary at the
highest geolevel. | self.snow_level_data[2, 2] = np.nan
expected = np.array([[1.0, 1.0, 2.0],
[1.0, 1.5, 2.0],
[1.0, 2.0, 2.0]])
snow_level_updated = self.plugin.fill_in_by_horizontal_interpolation(
self.snow_level_data, self.max_in_nbhood_orog, ... | 0 |
5d7acb64e39d7608ea06603abc8697ae | 6fa559d4dc5d4e1e94a40e61b3fdd1f4 | (PECL mongo >=1.3.0)<br/>
Get the read preference for this collection | class MongoDB
public function getReadPreference () {} | 1 |
07c84885c4671b2caf3adc5f4f126bbf | 237bd5a573385349dc0c2255c43e5232 | обрабатывает масштабирование изображения через ползунок | namespace ImageSource
public partial class FormImageEdit : Form
private void buttonScale_Click( object sender, EventArgs e )
{
Double scaleFactor;
scaleFactor = Double.Parse(textBoxScalingFactor.Text);
Image<Bgr,byte> temp = new Image<Bgr, byte>(sourceImage.path).Resize(s... | 0 |
ebb0233021d3287d55b3266b04c68339 | 545086e6e4c70a6f40ac3cc70cd3614f | Load the Recently Used panel with recently selected colors | function recentColor () {
$(".recent p").on("click","a",function () {
var thisHex = $(this).parent().find("i").html();
writeHex(thisHex);
writeDec(hex2dec(thisHex));
$(".recent p span").removeClass("current");
$(this).parent().addClass("current");
})
} | 0 |
6e860214c9e5778e8411a36fb48735e8 | 394828b453dce9107739ece7c31c8cbe | Get list of finished challenges to show in the history | $challenges = $user->getChallengesAccepted();
$notFinishedChallenges = array();
foreach($challenges as $challenge){
if($challenge->getChallenge()->getEndDate() >= new \DateTime())
array_push($notFinishedChallenges, $challenge->getChallenge());
}
return $notFinishedChallenges;
} | 0 |
c481ece988995de87e39717c256c154a | ac97249ead527255507c5e5cf6587c1e | Move to the next stroke. | {
const currentPath = this.currentPath;
if (currentPath)
{
currentPath.closeStroke = true;
}
return this;
} | 0 |
2f439764d2fa6e0e00d901e1614c5dff | 21d7913a234c2869ef368a7a3739eb8b | returns true if the `current` version string is greater than or equal to `required`
version string.
this converts version strings like '2.5.1' to 100210051001, then compares values. | function requireVersion( requiredVersion, callback ) {
const thisVer = version.split( '.' ).map( str => Number( str ) );
const reqVer = ("" + requiredVersion).split( '.' ).map( str => Number( str ) );
const cb = callback || (
match => {
if( !match ) {
error( `Vorple versi... | 0 |
5369f677b11325d25ff7184de33e3440 | a70e22dafdf8f079a44f3e3118a1ad89 | reshapes from 'list of list of descriptors' to list of descriptors | class SSD_network(object):
def reshape_list(self, l, shape=None):
r = []
if shape is None:
for a in l:
if isinstance(a, (list, tuple)):
r = r + list(a)
else:
r.append(a)
else:
i = 0
for ... | 1 |
6b86e8292ef3fa67f58e5857b4be3c17 | c1b94f633d3dd42ee0a31757d05c0239 | Origina numeros al azar para el eje x para que los asteroides aparescan en distintios lugares | function EjeCoordenadaJugadores() {
var dif = 0;
for (var i = 0; i <= 12; i++) {
var randonX = Math.floor(Math.random() * 700);
var randonY = Math.floor(Math.random() * 400);
if (i >= 11) {
if (randonY > 150 && randonY < 280) {
... | 1 |
3a267ad82c993dfe7257ceeb995845cd | d5ee3b9b1c676a0bd9e14eb14f54da3b | function to get limb darkening coefficient u (Allen 1973) based on wavelength value | def u(T):
u = 0.5 / 0.41337887 /12. / 3600.
return u | 0 |
e7a0fd34992d1846c14fa8c56f6894c7 | 2b6e1e5896ddb6341864f67c9ae9315d | The business number (aka Tax ID). | public function getBsb(); | 0 |
1b736e8cac81515c2cc4cc7155116267 | d061eb763245bae7763d62461fce387d | Returns the array of html classes. | return @_classes if defined?(@_classes)
@_classes = []
@_classes.concat(@config[:css_classes]) if @config[:css_classes]
(@_classes << @config[:id].to_s) if @config[:id]
return @_classes
end | 1 |
64ee005c38a65cd9a98e41695467decc | fd6aa08503352891912a539393cdf052 | Checks if userInfo credentials is contained inside adminList
If userInfo is contained inside adminList, returns loggedIn as True. | if mode == "admin":
path = ADMIN_PATH
else:
path = ALLOWLIST_PATH
admin = False
user = update.effective_user
with open(path, "r") as file:
for line in file:
chatId = line.strip("\n").split(" - ")[0]
if chatId == str(user["username"]) or chatId == str... | 1 |
b65db9211bbccbb347472cfd6b5269af | 66dc373dbc3832e2805b6c1fbd1765b0 | Randomly create an individual.
In this GA, an individual is an array of integer indiced which
correspond to cube moves. | ind = []
for action in self.action_list:
ind.append(np.random.randint(0,
len(self.search_space[action])))
return ind | 1 |
b21594d3460d0e5e5eceba07a651d5c0 | 723b538157d1ec3b51079919cb4a471f | Remove all and show the help | class DebugUI:
def showHelp(self):
self.clearView(helpText) | 1 |
50479e7ab6eddb38abd3994a20968676 | e82b2176dede2807c6753156607f883a | 测试兄弟孩子树的层次遍历 | int main()
{
struct Node *root = newNode(1);
root->left = newNode(2);
root->right = newNode(3);
root->left->left = newNode(4);
root->left->right = newNode(5);
root->left->right->right = newNode(15);
root->right->left = newNode(6);
root->right->right = newNode(7);
root->right->left->r... | 0 |
c6c2917678b4e3e16e1c9da762dd9161 | 257f5816bd8bc6d4b4e3cf8b8c8592f9 | Determines is the supplied gene descriptor is statistically significant in any of the agi
query list columns. | return (
POSITIVE
if (c.gene_cid, c.compound_cid, "PubChem") in knowledge_base
else ABSTAIN
) | 0 |
60cf3d4d98cbdce547d0c0c7be7f23ce | 904030a45c9ad08edc8075da8de7f3a4 | 每道题的错误率 | try {
String userid = MpUtil.getUserid(request);
if (!"1".equals(userid)) {
TkClassErrorQuestionManager errorManager = (TkClassErrorQuestionManager) getBean("tkClassErrorQuestionManager");
TkBookContentManager bookcontentManager = (TkBookContentManager) getBean("tkBookContentManager");
String bookco... | 1 |
4e7a7969146a7b317b29b2177fbcf818 | f311aa161077e3c4abe31512c6945f8b | Рисует области вокруг точек выбранным цветом | {
var pic = pictureBox1.CreateGraphics();
SolidBrush myBrush = new SolidBrush(Color.Red);
for (int cluster = 0; cluster < clusters.Count; cluster++)
{
myBrush.Color = Color.FromArgb(colors_of_centers[cluster, 0], colors_of_centers[cluster, 1],
... | 1 |
730f75ba2abb16f120b952ab0863b973 | 05f6bd35f98d3ae16c7a3eb53c133ec4 | 屏幕坐标点是否落在建筑物点内 | export class MBuild extends egret.DisplayObjectContainer
public check_is_touch(x: number, y: number): number {
if (!this.getBaseLayerVisible()) return;
var build_id = 0;
var self = this;
if (self.m_pBuild.hitTestPoint(x, y)) {
if (self.m_pBuildOpenMenu) {
... | 1 |
24099b71f6db4f374264f6ad810b8816 | a4fb97624937fea06ea85463297d0a8d | Sets the tuner count. Valid only for {@link #TYPE_TUNER}. | boolean setCounter(long count); | 1 |
3387227dbe4241a75480cdb380cc48ef | da09d81ac0df859339eea82e7640055b | Test that indeed some points are not included as vertices
issue #3 | filter_type = 1
user = MyUser.objects.create(email="test@email.com")
survey = RentingSurveyModel.objects.create(user_profile=user.userProfile)
polygon = survey.polygons.create()
polygon.vertices.create(lat=45.454545, lng=12.23232)
polygons = [{'key': 1, 'vertices': [{'lat... | 1 |
a0322bf3a1f00d64b8da30d08ec70e26 | a9cd049b8edb50ac1dfdabde09486ec3 | 默认选中一个学生班级 | public Students suijiselect(); | 0 |
40ce1f05ca33e5377dec967907a3b934 | 0bc8864ebf2ccfd6450a08822d13a780 | Unveils all missing characters | ans=' '
import string
for i in range(0,26):
if string.ascii_lowercase[i] not in lettersGuessed:
ans=ans+string.ascii_lowercase[i]
return ans | 1 |
3b11a6f9e0182552f6f2a58c2ac42f22 | 238cf219bfe4e8ef7dd766a1d21e1d1f | 替换文章 | $id = $this->frparam('id');
if($id){
$data = M('article')->find(['id'=>$id]);
unset($data['id']);
if(M('Article')->add($data)){
JsonReturn(array('code'=>0,'msg'=>'复制成功!'));
}else{
JsonReturn(array('code'=>1,'msg'=>'复制失败!'));
}
}
} | 0 |
c454d0b8c83a194e9a411a9408005810 | 22260ad394e8cc270d365b9a7da1ce4e | Restricts the check for exit codes to the container with the
specified name. When null, the rule applies to all
containers. When specified, it should match one the
container or initContainer names in the pod template. | public class BMSPOQueryObject
public BMSPOQueryObject withContainerName(String containerName) {
this.containerName = containerName;
return this;
} | 1 |
f3db3b6af0f01d7c5a07c8b470215060 | 490fa6c780b304d789726cf896c3003b | get first missing id from sorted sequence of ids | def solve_part2(filepath: str) -> int:
ids = read_input(filepath)
ids.sort()
min_id = ids[0]
for i in range(len(ids)):
if min_id + i != ids[i]:
return ids[i] - 1
return -1 | 1 |
1d0f9eeef35e4ded9546a4f4f46961e9 | 4866467a42cdb54ea046dcbe6e84ec56 | create a new section on the web page to maintain table layout | var td = obj.parentElement;
var table = td.parentElement
.parentElement
.parentElement
var tableid = table.id;
var max = table.parentElement.firstChild.value;
var textboxes = td.getElementsByTagName("input");
var newtable = table.cloneNode(true);
... | 1 |
3ada33cc2809ba79f0baf6bad6975d04 | 292cad8e5e059c564bc40c1b8fb344a2 | função para multiplicar duas matrizes e colocar em outra | char *nomeR) {
struct tLista *aux1, *aux2;
float **matR;
if (pLista != NULL) {
aux1 = busca(*pLista, nome1);
aux2 = busca(*pLista, nome2);
if (aux1 != NULL && aux2 != NULL) {
strcat(nome1, "X");
strcat(nome1, nome2);
aux1 = criarMatriz(pLista, nome1, aux1->size... | 1 |
14d94602f5e63ff7a2e8a6acc4367dde | 37fa250c83001c85a9cb89de44f9cecf | Returns whether this coin receptacle has enough space to accept at least
one more coin. Causes no events. | public final class CoinReceptacle extends AbstractHardware<CoinReceptacleListener> implements CoinAcceptor
@Override
public boolean hasSpace() {
return coinsEntered.size() < maxCapacity;
} | 1 |
cdf996365315330a061d448d55b6677e | 5821b3db006a36c0e3c4b6a3e7e49423 | DOMAIN TESTS | {
$response = $this->service->domains();
$this->assertNotEmpty($response);
$row = $response[0];
$this->assertArrayHasKey('domain', $row);
$this->assertArrayHasKey('created_at', $row);
$this->assertArrayHasKey('last_tested_at', $row);
$this->assertArrayHasKey('... | 1 |
9b09c2af788abe9642eced944ad2d8a9 | 8c4e5fbd8a6e1721adef7423b82c21f5 | List Volume Attachments for a given Server. | class volume:
def get_attached_volumes(self, datacenter_id, server_id, depth=1):
return self.get_api_instance(ionoscloud.ServerApi)\
.datacenters_servers_volumes_get_with_http_info(datacenter_id,
server_id,
... | 1 |
26c962f0e0996f1ff7a3f20c8a409441 | 35a150d78c1d4cf622679fb6592474e0 | Setea que las sesiones se guarden en Memcache utilizando los drivers nativos de php | $sessionMemcache = CConfig::getInstance()->load('SESSION_MEMCACHE');
if(extension_loaded('memcache') && $sessionMemcache == true){
$sessionHost = CConfig::getInstance()->load('SESSION_MEMCAHCE_HOST');
ini_set("session.save_handler", "memcache");
ini_set("session.save_path", "tcp://".$sessionHost);
... | 1 |
4e9d08e0273d12dab8a4a96289696f7d | c4810d0f6707e18e59998f1aae7ec89b | 演示使用asm动态生成子类,添加方法 | throws NotFoundException, IllegalAccessException, InstantiationException, CannotCompileException, NoSuchMethodException, InvocationTargetException {
ClassPool classPool = ClassPool.getDefault();
CtClass ctClass = classPool.makeClass("com.threedr3am.bug.compile.javassist.C");
StringBuilde... | 0 |
9cc5bc7bce118291520afc3aca8c9683 | 4ac1163dc6efec6472fbcd38c5fdd805 | Sets the number of words found in the file. | class GutenbergBook:
def num_words(self, w):
self._num_words = w | 1 |
d19715fb63e01d160ff32e67a9800efe | bee39242c252e29d689685cbf5c6db6e | 根据有向边集合构建图 | {
char c1, c2;
char vexs[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G'};
char edges[][2] = {
{'A', 'G'},
{'B', 'A'},
{'B', 'D'},
{'C', 'F'},
{'C', 'G'},
{'D', 'E'},
{'D', 'F'}};
int vlen = LENGTH(vexs);
int elen = LENGTH(edges);
int i, p1, ... | 1 |
7c1da9668a14ad62397e992a868f1e05 | f8fff17a7002d016d69647ec2cd978c0 | Initilize all the Button names for the specific state. | ButtonNameConfig config = ButtonNameConfig.getInstance("/"
+ languageName + ".properties");
init(config);
} | 1 |
c850ffa8ee45f24ae673bf59f71edec4 | 1cfa3a714fdf2df60437c06ba836ad94 | 实现 strStr() 函数。
给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。
如果不存在,则返回 -1。
示例 1:
输入: haystack = "hello", needle = "ll"
输出: 2
示例 2:
输入: haystack = "aaaaa", needle = "bba"
输出: -1
说明:
当 needle 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。
对于本题而言,当 needle 是空字符串时我们应当返回 0 。这与C语言的 strstr() 以及 Java的 indexOf... | func strStr(haystack string, needle string) int {
if strings.Compare(needle, "") == 0 {
return 0
}
if strings.Compare(haystack, "") == 0 {
return -1
}
var index = kmp(haystack, needle)
return index
} | 1 |
9b46dfe923c337069711e21e7dff6111 | 7f93619ecf15a25e6c791f45c2a6c022 | checkbox的事件,達到上限就不能再選 | var me = this;
var checkBoxes = document.getElementsByName(name);
for (var box of checkBoxes) {
box.addEventListener('change', function(e) {
if (me.container.querySelectorAll(`input[name=${name}]:checked`).length > maxSelect) {
this.checked = false;
... | 1 |
1a72f64336a363c60811a52f474ae560 | 9aa78e7267c85215d7acda35290f2890 | 根据原始asm annotationNode构造注解实体 | public final class DescriptionHelper
public static Annotation resolveAnnotation(ImportBuilder importer, AnnotationDescription annotation) {
ModelFactory factory = Models.getModelFactory();
NamedType type = (NamedType) resolve(importer, annotation.getDeclaringClass());
Map<String, Expression> ele... | 1 |
fbdcaef3e3038d988f3077f422d36e7b | 3b7b0de5abaa57347c4cd1a6a06f3dbe | Returns the number of related J808tProducto objects. | {
if ($this->aJ808tProducto === null && (($this->co_producto !== "" && $this->co_producto !== null))) {
$c = new Criteria(J808tProductoPeer::DATABASE_NAME);
$c->add(J808tProductoPeer::CO_PRODUCTO, $this->co_producto);
$this->aJ808tProducto = J808tProductoPeer::doSelectOne($c, $con);
}
return $this->aJ80... | 0 |
c3da7b113525dd886e5a1fad781e72ae | 837721e9c70ac3bfb19d1d61d6c64c87 | Find pos of id to delete return -1 if no ID founded | int rsl = -1;
for (int index = 0; index < position; index++) {
if (items[index].getId().equals(id)) {
rsl = index;
break;
}
}
return rsl;
} | 1 |
418614712d789d586f0f2be47f5187c6 | 5486bb40cda46b7352126a989a3abc73 | 文本块生成器:把纯文本分成一个个文本块 | content = convert_to_unicode(content)
results = []
for i in range(1, len(content) + 1):
results.append(content[0:i].encode('utf-8'))
return results | 0 |
a4ddf8bf992d0e67582654316f523611 | e4c86b754880e975467116008defcb34 | Put request | class Request:
def put(self, path, data, options):
return requests.put(self._client.host + path,
auth = self._authenticate(),
data = json.dumps(self._get_data(data, options), cls=SubObjectEncoder),
verify = True,
timeout = 65,
headers = self._get_heade... | 1 |
41cf0090d783c698442e16fc44daed1b | 8f7e277793a1dc3495563072654931a6 | Disposes the Eyes object, turning off all LEDs and disposing the correspoding I2C devices. | TX_CONTEXTHANDLE hContext = TX_EMPTY_HANDLE;
TX_TICKET hConnectionStateChangedTicket = TX_INVALID_TICKET;
TX_TICKET hEventHandlerTicket = TX_INVALID_TICKET;
BOOL success;
txDisableConnection(hContext);
txReleaseObject(&g_hGlobalInteractorSnapshot);
success = txShutdownContext(hContext, TX_CLEANUPTIMEOUT_DEFAULT,... | 0 |
d159c1a4c62bd99c03070d85f21b2ae2 | 7b2d63c3e46121fd5a9f18c065948058 | Finds field (input, textarea, select) with specified locator. | class DocumentElement extends ActionableElement
public function findField($locator)
{
return $this->find('named', array(
'field', $this->getSession()->getSelectorsHandler()->xpathLiteral($locator)
));
} | 1 |
b6777f00f4b0f0bf86faea3aaf04dc8f | 9d40cf26828063863eb47845841e6bae | Find atomic parameters recursively. | class Reg():
def get_nested_params(self):
params = []
if isinstance(self, MultiReg):
params += [self.param]
if isinstance(self.fields[0], MultiReg):
params += self.fields[0].get_nested_params()
return params | 1 |
c9fc4f3ac12470692458574646cfcd94 | 22db3bafbdd435cbead5d440fd7e2b37 | Sets JWT as the default token format for access tokens. | {
parent::configureOptions($resolver);
$resolver->setDefaults([
'attr_name' => 'access_token',
'use_bearer_authorization' => true,
]);
} | 0 |
662916f35e34bfaaf02ab1e16ee57131 | 46ac92ee66f54b5c9d0aca12886276d2 | Wait for the codec bus to be free | voyagerfb_wait(struct voyagerfb_softc *sc)
{
do {} while ((bus_space_read_4(sc->sc_memt, sc->sc_regh,
SM502_SYSTEM_CTRL) & SM502_SYSCTL_ENGINE_BUSY) != 0);
} | 1 |
09066e2cdb1074e7059b3088852ef72b | 1e7963c862dad4aeff3236e1dca6c68f | 向服务器发送统计数据,用户分享了该活动 | class ActivityScoreRanking(ActivityNew):
def _onUserShare(self, event):
shareId = 0
if isinstance(event, HallShare2Event):
shareId = event.sharePointId
elif isinstance(event, HallShareEvent):
shareId = event.shareid
if not shareId:
return
isOpe... | 0 |
f7994093773af3bb935a972a2205d2b0 | ca8b902a72d9182e510dd392dea2d524 | Test updating another users answer | self.client.force_authenticate(user=User.objects.get(pk=2))
url = reverse("task-detail", kwargs={"pk": 4})
data = {"answer": "Anyway the wind blows, doesn't really matter to me, to me"}
response = self.client.patch(url, data)
self.assertEqual(response.status_code, status.HTTP_403... | 1 |
d4d8a91c718d2023755ecb5b548bb747 | fdf4d305c538ad6cc291ce9d2627bde4 | 创建新的空文件夹,创建.和..文件 | func mkdir() {
os.Mkdir("text", 0777)
os.MkdirAll("text/1/2", 0777)
err := os.Remove("text")
if err != nil {
fmt.Println(err)
}
os.RemoveAll("text")
} | 0 |
935346949b1354c0c1f44f1cbdd3b984 | 99ae46910716eca7650f369620bde1fb | 对象序列为json字符串 | public class JsonTools
public static String object2json(Object list){
return JSONSerializer.toJSON(list).toString(1);
} | 1 |
4a9e6a6acf0c460cb2c13279eddb4ebc | 0e893a340b1ff5e6c75d9da2e73a55f3 | Specify the concrete implementation for the contract interface. | {
$this->factory = $this->instance = null;
if ( ! is_a($concrete, $this->getInterface(), true) ) {
throw new InvalidArgumentException('concrete is not compatible with the serviced interface');
}
$this->concrete = $concrete;
return $this;
} | 1 |
95e3381f2d1710a595422fc95dbe8172 | 79bb84e4943124482757590ac2da74ad | compute the indices of the start and end anchors for a given curve segment
can be helpful when building the basis matrix | if not len(detIndices):
stop = []
start = []
diffs = np.diff(detIndices)
startPositions = np.concatenate([[0], np.nonzero(diffs>mergeThreshold)[0]+1])
start = detIndices[startPositions]
if len(startPositions) > 1:
stopPositions = np.concatenate([startPositions[1:]-1, [len(det... | 1 |
67f85a514e891babfc09c0969be108bf | 030b4a6461dccb65a9caa833d87519ec | convert position in map(has bounds) to position in graphic | Point MapRenderer::mapPosition(int px, int py){
return Point(int((offset.getX()*(scale) + px) / tileSize*(1/scale)), int((offset.getY()*(scale) + py) / tileSize*(1/scale)));
} | 0 |
24af2b26f5d7918a3a1e9faa65433b3d | 804fcfd2d2e97850c9ffa6b59e91ade2 | Retrieves a flag which indicates if summary rows inherit
criteria from non-summary rows. | public class GraphicalIndicator
public List<GraphicalIndicatorCriteria> getNonSummaryRowCriteria()
{
return (m_nonSummaryRowCriteria);
} | 0 |
49fa11720fa59a2c7971821a0fde0ab0 | d843f9b8879f9cc4c60187b161e697f4 | 回调方法很简单,就是遍历成功或者失败回调函数容器,然后依次执行内部的方法 | export class ResourceItem
public executeCall(res: any): void {
if (this._loaded) {
let len = this._callBackList.length;
for (let i = 0; i < len; i++) {
this._callBackList[i].callBack.call(this._callBackList[i].thisObj, res, this.name);
this._callBackList[i].callBack = null;
this._callBackList[... | 1 |
d90a5e0db09c41a1f5aedc1c1ed1e6c1 | 8ae060a2154ac5eafaed01ce84b32708 | Named provides a more concise way to create NamedArg values.
Example usage:
db.ExecContext(ctx, `
delete from Invoice
where
TimeCreated < @end
and TimeCreated >= @start;`,
sql.Named("start", startTime),
sql.Named("end", endTime),
) | func NamedArgString(arg sql.NamedArg) string {
return fmt.Sprintf("%s=%v", arg.Name, arg.Value)
} | 0 |
ac8e07623b29e16855e103e80f22d3eb | 097e9434fa7a2a9190a4ef46f5198d1e | Command handler for the MKD command.
<pre>MKD %SP% %pathname% %CRLF%</pre> | static void handle_cmd_MKD(SOCKET *socket)
{
if (mkdir(global->params, 0777) == 0) {
static const char *OK = "250 Directory created\r\n";
socket_send(socket, OK, strlen(OK), NET_FLAGS__NOCOPY);
VERBOSE(OK);
} else {
static const char *ERR =... | 1 |
d27fc6826427fede01bd08c1f8611f4f | d9164768456d5dc8e0541524fdb0fc66 | Solve the equation a x = b for x, assuming a is banded matrix.
The matrix a is stored in `ab` using the matrix diagonal ordered form::
ab[u + i - j, j] == a[i,j] | def solve(a, b):
a, _ = _makearray(a)
b, wrap = _makearray(b)
one_eq = len(b.shape) == 1
if one_eq:
b = b[:, newaxis]
_assertRank2(a, b)
_assertSquareness(a)
n_eq = a.shape[0]
n_rhs = b.shape[1]
if n_eq != b.shape[0]:
raise LinAlgError, 'Incompatible dimensions'
t... | 0 |
88fc653faa53ee416a25c7007efe3cdc | ce6779864d10df7ca021eaa10ce5fb59 | 获取集中器和控制器详细信息 | namespace BW.MMS.DAL
public partial class S_ControllerInfo
public DataSet GetList(string strWhere)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select ID,ControlName,SystemLabel,Description,Area,Enable,ChannelName,ControllerAddress,IPaddress,Port,MacAddress,UserName,PassWord,DeviceLabel,DeviceCod... | 1 |
47164023ec6ae103e3c0f280678cb504 | 1fb2789ed20acbf412b5029cf58ec701 | inizializza listener del bottone | public class OrdinaActivity extends AppCompatActivity implements View.OnClickListener{
private void initListeners(){
conferma.setOnClickListener(this);
} | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.