query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
47702d1cc1f0406cff88e94c3169a158 | fb239ed38eeaffb99787861e51de6fdb | Accessor to the observations error distribution. | if self._model.hidden_ndim < 2:
return self.x_dist
dist = Normal(self.xmean, self.xcov[..., self._diaginds, self._diaginds].sqrt())
return Independent(dist, 1) | 1 |
67108cfc6ec95f307a7222a8174f7063 | ae8a29f9af5099a4fdba74b305aa1167 | Apply uniform filter to average out each point with neighbours | {
float filteredPixel, neighbourPixel, currentPixel;
float wP, gR, gD;
int neighbourCol;
int neighbourRow;
for (int col = 0; col < cols; col++)
{
for (int row = 0; row < rows; row++)
{
filteredPixel = 0;
wP = 0;
for (int windowCol = 0; windowCo... | 0 |
beed9773d0415ed02400c22d3d597ee7 | a65f25e141ab80e0d7dde90af13341ac | BrightnessPulse continuously dials up and down brightness | r := nanopi.NewNeoAdaptor()
led := gpio.NewLedDriver(r, "PWM")
work := func() {
brightness := uint8(0)
fadeAmount := uint8(15)
gobot.Every(100*time.Millisecond, func() {
if err := led.Brightness(brightness); err != nil {
fmt.Println(err)
}
brightness = brightness + fadeAmount
if brightness == 0... | 1 |
35265b47bdfb7ee8cd27fe73ca24f04a | 8d791d15e2642ed81353be409c87f57a | Snippet for UpdateWorkflowTemplateAsync | class DliAsyncClient extends Client
public function updateFlinkTemplateAsync($request)
{
return $this->updateFlinkTemplateAsyncWithHttpInfo($request);
} | 0 |
2b32cc1783a94bae08dac58e9ac83814 | 8e60edf90e1d21e6c5eb9cdbc4e5eeae | 获取车场信息 | @RestController
@RequestMapping("/timeloit")
public class CarPushController
@RequestMapping(value = "/getCarParkInfo")
public ResponseModel<String> getCarParkInfoByCar(@RequestBody CarParkingStop carParkingStop){
return carPushService.getCarParkInfoByCar(carParkingStop);
} | 1 |
eb80adf7eb50bd267369263ed6f64fbf | 1151aabd290b6c2c960df51856498738 | Get selected text's properties (font family, size, color, etc.) | {
TextField textField = currentElement as TextField;
if (textField != null)
{
listBoxFontName.SelectedIndex = (int)textField.TemplateListItem.FontName;
listBoxFontSize.SelectedIndex = (int)textField.TemplateListItem.FontSize - 1;
... | 1 |
9ada97bcbb72253644b159d907ee4bee | 36dc7e1cb5bdd25da96472ffc637869b | Process results merging column names and values into a JS object | let processedResult = [];
for (let i = 0; i < dataSet.length; i++) {
let result = this.retrieveData(dataSet[i]);
let requiredResult = {
GSE: result.Accession,
Title: result.title,
GSM_Count: result.n_samples,
Summary... | 1 |
716fa7fccf273de628a8afbf14ff582c | 10c9e8c47053a3ad25e67ca88f7e014d | Confirms a logged-in agent. | def agentLogin():
global user, cursor
print()
print()
print()
username = input("Enter a valid ID. Enter exit to return: ").strip()
if username.lower() == 'exit':
return -2
pas = getpass(prompt='Password: ')
cursor.execute(""" SELECT * FROM agents WHERE aid=? AND pwd=?""", [userna... | 1 |
72be87a8897df0aad9a356d659adb27b | ed76e22ce3e6bc6aa5880ebb53476f84 | 获取微博评论第一页的url | def get_url(pageNum):
url = 'https://book.douban.com/subject/34995610/comments/hot?p={pageNum}'.format(pageNum=pageNum)
return url | 0 |
1912ca8619fd2cc48233ae32fc13add1 | 09c058615e84616b87b3c984055d04b3 | 14.Переворачивает список Trainee группы, то есть последний элемент списка становится начальным,
предпоследний - следующим за начальным и т.д.. | Node prev = null;
Node current = head;
Node next = null;
System.out.println("prev="+prev+" current="+current.data+" next="+next);
while (current != null) {
next = current.next;
current.next = prev;
prev = current;
current = next;
... | 1 |
2ae8f4a4c2880e3da86e686cb294d708 | c28f3063fe7a6439240587f4b4e312d4 | Authorize using Guzzle | {
$client = new Client();
$res = $client->request('GET', 'https://api.github.com/user', [
'auth' => ['user', 'pass']
]);
} | 1 |
c3a3793c93a6bdc45198aadfaf21c06c | 1d5594369aad76b79782b53b8a53c9dd | Draw X in SVG | oval = self._drawing.ellipse(center=upt((self._ox+x+w/2),
(self._oy+y+h/2)), r=upt((w/2), (h/2)),
stroke_width=upt(self._strokeWidth), stroke=self._svgStroke,
fill=self._svgFill)
self._drawing.add(oval) | 0 |
3c5705761e6fb301b4e3c815f2ba6a2f | c7d768b370d4395a3ea1d44d5083500e | Encode quality scores from list of integers as Illumina text string. | encodeQuality <- function(quality, type=c("Illumina", "Sanger", "Solexa")){
type <- match.arg(type[1], c("Illumina", "Sanger", "Solexa"))
offset <- c(64, 33, 59)
names(offset) <- c("Illumina", "Sanger", "Solexa")
if(type %in% c("Illumina", "Sanger"))
quality <- -10 * log(quality, 10)
if(type %in% "Solexa")
qua... | 1 |
0a05a15a6886892e6839af5ce94b890e | f43357218bdab42fe11d1ee88dd14c51 | Return the current state of the Permissions needed. | def perms_state_request(perms):
return perms.to_dict() | 1 |
b2c83cb23e1de98fc040626a3853c34f | 3a5598125cda6d5d3f71e7c67a032e90 | Get the Party Address, Name and Contact Information. | public function getParty(): array
{
return $this->party;
} | 0 |
05fc65cd6db1ddc32d6180b2705c6fa5 | e87cd6ae7f9fd3bc9d4d64d25e246969 | Returns the tuple (r, g, b). For compatibility with TigerJython. | if not normalized:
return self.qcolor.toRgb().red(), self.qcolor.toRgb().green(), self.qcolor.toRgb().blue()
else:
return self.qcolor.toRgb().redF(), self.qcolor.toRgb().greenF(), self.qcolor.toRgb().blueF() | 1 |
090880238ab227feeb8380c02e509ebf | cc240785368c8b32553d9f883508a143 | 筛选重量大于120克的苹果 | List<Apple> result = new ArrayList<>();
for (Apple apple : inventory) {
if ("green".equals(apple.getColor())) {
result.add(apple);
}
}
return result;
} | 0 |
c840047c0e055ace28d365d63971fe00 | ecdcbda08b8729ef7698af60e50094e2 | Reads the numbers from the user input and insert into BST | void init(BSTree *root)
{
int num;
*root = NULL;
scanf_s("%d", &num);
while (num)
{
InsertBST(root, num);
scanf_s("%d", &num);
}
} | 1 |
30fee5f5034d633dc4c783f2d160fa20 | 7d6af4275266b5474d9eb2f92f4e0345 | Getter for lab grades list | def get_gradeables_list (student_data):
try:
return [*student_data[0].get('grades')]
except:
return [] | 1 |
1a20cede94ccae4fe225b97dba8776c5 | 05ada1911a0fcaf763db2116a39393a7 | =begin
creates a sorted list of users based on their distance to
username
=end | @users = User.order(cached_points: :desc)
render 'users/index', locals: {users: @users}
end | 0 |
a47a2d4b0d54b7729a2389b72c13eb82 | 8595f2744451f55de8b940aac79b99c4 | Allows the user to choose his compiler | export class Compiler
public async changeDefaultCompilerType(target: vscode.ConfigurationTarget) {
try {
const compilers: string[] = [compilerType[compilerType.remote], compilerType[compilerType.localFile], compilerType[compilerType.localNodeModule], compilerType[compilerType.embedded]];
... | 1 |
5c5dc2c2dac24596dceb282cef02e8c2 | 537bec116c1e6e5039bdfa1021d0c12f | Flatten arbitrarily nested lists | def flattener(x):
try:
it = iter(x)
except TypeError:
yield x
else:
for i in it:
for j in flattener(i):
yield j | 1 |
bf7fceb393118c0e0b1c3f6efa2da721 | 046cf9de46bcfd886ffb11a3b80c4e7b | Blacklist the given refresh token | query = select([blacklist_tokens_table.c.id]).where(
blacklist_tokens_table.c.token == token)
result = await db.fetchrow(query)
if result:
raise jwt.ExpiredSignatureError('Signature is expired.') | 0 |
fbd9f507e8375c7a52433a9fcf188963 | f81bbaef35d4377ac30de806c349d5bd | 如果Bean实现了BeanFactoryAware接口的话,Spring将调用setBeanFactory()方法,将BeanFactory容器实例传入,用来获取其他bean | public class BeanLifeCycle implements BeanNameAware,BeanClassLoaderAware, BeanFactoryAware, EnvironmentAware,EmbeddedValueResolverAware,ResourceLoaderAware,
ApplicationEventPublisherAware,MessageSourceAware, ApplicationContextAware, BeanPostProcessor, ServletContextAware, InitializingBean, DisposableBean
@Overr... | 1 |
a1ea75074b61cf8e43d532f5d8d965ef | a9335b886597c15f781a843f74cea51d | Open your Extension's options page, if possible.<br />The precise behavior may depend on your manifest's <c>$(topic:optionsV2)[options_ui]</c> or <c>$(topic:options)[options_page]</c> key, or what the browser happens to support at the time.<br />If your Extension does not declare an options page, or the browser failed ... | function optionsPage() {
browser.runtime.openOptionsPage();
} | 1 |
275555bb40e626615cc124e4d8bd66be | 80ca5123b133a4f5dd1766a2bd42b67a | Will direct user to a secure connection is SSL is setup. | {
if ($type === 'secure') {
return $this->redirect('https://' . env('SERVER_NAME') . $this->request->getUri()->getPath());
}
} | 1 |
0c2f47afabe7eb78f2f5bd22a170e8e4 | 3971a4294679504d0023df21b24058e6 | 获得行高累计值 | public class ComplexHeaderUI extends BasicTableHeaderUI
private int getCellHeight(int mergeRowNum)
{
int height = 0;
for (int i = 0; i < mergeRowNum; i++)
{
height += singleRowHeight;
}
return height;
} | 1 |
cf9e4b6ea1517bba246b2add2b56e240 | a54deeec5e5965bdf02726c27565da90 | Log all the Notifications and clear them | this.getAllNotifications();
var set = setInterval(async () => {
await this.getAllNotifications();
}, 20000);
this.interval.push(set);
} | 0 |
c9836e608e5e2e96d7ef0d648f801c28 | 86c6279336f73a8a4ea80913336123d7 | getting recipe from array at the given index | namespace FiledRecipes.Domain
public class RecipeRepository : IRecipeRepository
public virtual IRecipe GetAt(int index)
{
return (IRecipe)_recipes[index].Clone();
} | 1 |
cdb4542892f3daabc8e3e89ea268836b | 508d88d57c4d128de39d305d4a234af1 | 把数据库中图片byte,存到项目temp目录下,并且把路径返设置给TsIcon | {
string filePath= Path.Combine(Setting.PICT_TEMP_PATH, Util.NewPictName());
WebClient wc = new WebClient();
Stream stream = wc.OpenRead(url);
Bitmap src = new Bitmap(stream);
stream.Close();
src.Save(filePath, ImageFormat.Jpeg);
... | 0 |
f2a516d17f1bad7e03d0bb5e42aff0ab | eb7e1d9b10281dff9ca848c82a20e4bf | Gets the column statistics for the current transformation. | void getCurrentStatistics(ColumnStatistics[] output); | 1 |
65f05330f35e5f40936a3031da09970a | c78371d3ba0c67ef82a3adfc09e0e04a | 是否所有兄弟项都未选中 | export class OptionBlockNestedComponent implements OnInit
noneChecked(opts: Option[]) {
let n = opts.every(o => !o.selected);
return n;
} | 1 |
70bca21aa90be3e10a727da276950fcd | 74d7cfb6763c3f8d3e9292e32c78204c | Build the overnight visitor sythetic population. | vector< Person >::iterator pend = pvec.end();
for (vector< Person >::iterator it = pvec.begin();
it != pend;
it++) {
Person &p = *it;
if (p.nTravelTimer<=0 && !isQuarantined(p) && get_rand_double < travel_pr[p.age]) {
double r = get_rand_double;
int i;
for (i=0; r>travel_len... | 1 |
27894c3615cca37d842403add3886534 | 8480c1c6a33b47b9d210f9d55c8b862f | Called when the user chooses the "Select All Features" menu item. | namespace SvduPro
public partial class SVDockMainWindow : Form, SVInterfaceApplication
private void selectAllMenuItem_Click(object sender, EventArgs e)
{
SVControlWindow win = currentControlWindow();
if (win != null)
win.selectAllMethod();
} | 1 |
85d90fd3372eb1f884f0484386f15ffc | e0b90c4fbf1cd74ab5f74b9bf887813b | 乘法表中第K小的数 leetcode_668 | int n = matrix.length;
PriorityQueue<KthSmallestTuple> pq = new PriorityQueue<>();
for (int j = 0; j <= n - 1; j++) pq.offer(new KthSmallestTuple(0, j, matrix[0][j]));
for (int i = 0; i < k - 1; i++) {
KthSmallestTuple t = pq.poll();
if (t.x == n - 1) continue;
... | 0 |
8588d1fe74fe954b1631f2886fb077a9 | 2be6863560e17e631a2953ad0bae1933 | Determine the partition key from queue name and task id. | task_id = sql_table_id(target)
if partition_id:
task_id += f"${partition_id}"
return task_id | 0 |
cae70800fc9a2a00663e679fe9e25eb8 | 5c90085fe6d63bdd563fcdfe41568225 | Check_LogToDatabase_CheckedChanged
- Event handler that allows user to change whether they want to log to the database during the session | void CServerAppDlg::OnBnClickedGuilog()
{
if (guiLogChk->GetCheck()) {
guiLogOutput->enable();
}
else {
guiLogOutput->disable();
}
} | 0 |
e046a0150f1c65d2f5965e0bbb940d05 | 7bfc6068df73efaf5796553dbd077506 | Нажать кнопку "Да" (Например принять в группу) | $.ajax({
url: '/AjaxInviteInGroup',
type: 'post',
data: {group_id: group_id, agree: 'true'},
success: function(data){
if(data == true){
$('#invite_'+group_id).css('display', 'none');
$('.contact-list-group').append("<li><a href='/group/"+group_id+"'>"+$("#invite_"+group_id+" .popup-form-column-name"... | 1 |
750f480ba0d24c2437e4b144ab02eb3d | c337f42eeead9ee13c064e5082ff9006 | Sets the oscillator type. | function setWaveform(osctype) {
jsonData.oscType = osctype;
updateTrackData(jsonData.trackid, jsonData.trackName, jsonData.oscType);
} | 1 |
0763b0bd8b5f66f2dc618748e1d35fac | 7482bfffe6c8968697e0e8384ca2430d | Solution to problem number 10. | int main(int argc, const char * argv[]) {
std::cout << "Euler Problem 12" << std::endl;
number counter = 0;
number triangle = 0;
number maxDivisors = 0;
while (true) {
counter++;
triangle += counter;
int divisors;
if ((divisors = numDivisors(triangle)) > 500)
... | 0 |
a71392070547e400e2fe68e4c5722b78 | c198eed6975046afe977feb9d68feee5 | # 행정표준코드에 해당하는 시, 군, 구, 동의 이름을 출력하는 함수 | class Search_model extends CI_Model
function gu()
{
$qry = $this->db->select ( "'' as COMPLEX_IDX, LAW_DONG_CODE ,LAW_DONG_NAME AS title,'street' AS icontype, LAW_DONG_NAME addr, LAT as lat, LNG as lng")
->where('USE_YN','Y')
->like ('LAW_DONG_NAME', $this->keylist[4])->ORDER_BY('LAW_DONG_C... | 0 |
df59cd90e4d17a7d07ccf9e04737cf77 | 7f1e25481624c04a99569ccb02171100 | 通过教师id给教师添加班级id | @Query(value = "select c.class_id from class_info c where c.teacher_id = ?1 ", nativeQuery = true)
List<Long> getClassIdByTeacherId(Long teacherId); | 0 |
a02dc8063d76a998a99756bb2b74e2d9 | f8a7ddec681283e9d9ec5a01d596736d | 在指定时间范围内是否可以执行 | {
if (DateTime.Compare(beginTime, endTime) >= 0)
{ return false; }
if (DateTime.Compare(targetTime, beginTime) < 0)
{ return false; }
if (DateTime.Compare(targetTime, endTime) >= 0)
{ return false; }
return true;
} | 1 |
0d59f77e87924a5f674a3b8c239dc90d | 40388fbc7904c8bf7c5439eaf30c8324 | 模拟竖式乘法 | {
if (strlen($x) < strlen($y)) {
$tmp = $y;
$y = $x;
$x = $tmp;
}
if (strlen($x) > $arrL) {
die("超过范围");
}
for ($i = 0; $i < strlen($x); $i++) {
$xArr[$arrL - 1 + $i] = substr($x, $i, 1);
if ($i < strlen($y)) {
$yArr[$arrL - 1 + $i + strlen... | 1 |
05ec638bc1ecf07f6e99051e9f3e832f | 6b8f621dd8b1ec5981d58ffd6d140e8d | 警報器機關 | void alarm_Radio(RADIO_ALARM_MSG *myalarm, char nodeadr)
{
WDR();
if (CheckFlag(FEdisall))
return;
if (CheckFlag(FEAlarm) == 0)
{
if ((myalarm->type == RALARMTYPE_PIR) || (myalarm->type == RALARMTYPE_MAGNET) || (myalarm->type == RALARMTYPE_GENPIR))
... | 1 |
1dce4c5e4f220693bcca1ae005f7e365 | 3151e7f62986e505284fb36ce49e1df1 | Sets a new tPAExtensions | class VehicleLocationRequirementsType extends AbstractStructBase
public function setTPA_Extensions($tPA_Extensions = null)
{
$this->TPA_Extensions = $tPA_Extensions;
return $this;
} | 1 |
76d6cb085c5e0c0e5cb5e12ae521bc07 | 3520ca3e1e09c11d89dc7ea6e685edbc | Replace keys that are invalid Python identifiers or keywords with
valid object attribute names.
This function is useful when converting a dict to an object where its
attributes are the dict keys. Because Python attribute names have
restrictions, this function munges any dict keys that are not valid
attribute names. For... | allowed = string.ascii_letters + string.digits + '_'
attr = _safe_key(attr)
if camel_killer:
attr = _camel_killer(attr)
attr = attr.replace(' ', '_')
out = ''
for character in attr:
out += character if character in allowed else '_'
out = out.strip('_')
try:
int(ou... | 1 |
172d93e6d2edb168d8deb3452806e7a7 | ea49d6fc39917a22857af1b1cef15efc | This method gets mediacontent for a particular message
* this function will get media content searching the various mediacontent id's
* for a particular message id
* checks if ipodvideo, highqfilepath exists and is not empty | namespace ININ.PureCloudApi.Api
ApiResponse<VoicemailMediaInfo> GetMessagesMessageIdMediaWithHttpInfo (string messageId, string formatId = null); | 1 |
4b4cea0667bcbc5fc6a710bb968da696 | c1c69f01e495eab1a5e6c5ef413cfa6c | 发送之前检测是否已经发送过好友请求 以免重复发送 | if (Model.getInstance().getDbManager().getContactTableDao().getContactByHx(hskUser.getUsername()) != null) {
Toast.makeText(AddFriendActivity.this, "该用户已经是你的好友了", Toast.LENGTH_SHORT).show();
return;
}
Model.getInstance().getGlobalThreadPool().execute(new Runnable() {
... | 1 |
9e4bb3a7e697d9991d438dbd6e5eab97 | f070517db1a66d0d6debe8970772f533 | returning a list without the first and the last elements. | def middle(lst):
return lst[1:-1] | 1 |
4f82eca18082ba7186b7a64c486086ea | 441d46dd5fd696db8269b15c03dbb6d2 | transitions from title screen to character creation | public class MainActivity extends AppCompatActivity
public void menuCharacter(View random) {
setContentView(R.layout.character_signup);
} | 1 |
f95308b989646cfd3c1fdee5e1d8628a | b9ea80e37207bbcb7c96c4ffc7dfc8c8 | Split string into substrings using separator string
Empty items are removed and existing are trimmed | {
return str
.Split(new[] {separator}, StringSplitOptions.RemoveEmptyEntries)
.Select(sub => sub.Trim())
.ToArray();
} | 1 |
5a2134b6d04f6b560f6dde74da4a8272 | 1cce3155c561a853bc407fa163da8c76 | Arrange the elements in a way so postive elements should come at the end of array
7 4 -5 -7 8 -5 10 2 -10 14 | namespace InterviewQuestions.LeetCode
class ArrayArrangment
public static int[] PositiveElementsAtEndsInArray(int[] nums)
{
if (nums.Length < 1)
{
return nums;
}
int j = 0;
for (int i = 0; i < nums.Length; i++)
{
... | 1 |
e6a0548da0a7404964b87556003e10d9 | c8eff35141575c7c6b47fdc7bdf50c0e | Sets the scene center, destroys all old chunks, and creates all of the new chunks. | Vector3i newChunkPos = calcCamChunkOffset();
boolean chunksCurrentlyPending = false;
if (!newChunkPos.equals(chunkPos) || force || pendingChunks) {
Vector3i viewingDistance = config.getRendering().getViewDistance().getChunkDistance();
Region3i viewRegion = Region3i.create... | 1 |
920f890aae0e5702b89a3b14a6abf338 | c869a7ab78f6fd89bc35e52d97e9724d | 辺IDを追加する | {
assert(border);
if (edge<0 || edge >= numVertices())
{
cerr << "intersection " << _id << " - addBorder:"
<< "edge number is invalid." << endl;
}
else if (_dir2edge.size() != _borders.size())
{
cerr << "intersection " << _id << " - addBorder:"
<< "_dir2... | 1 |
30179eea8dfa7091545216efb5be2bf1 | e80d2f26fccec7d62211fb86661c1a13 | Seleciona o log de posts enviados nos foruns de um curso | function get_forum_posts($course_id)
{
global $db;
$table = $db->query("SELECT * FROM forum_post WHERE course_id = $course_id");
if($table->rowCount() == 0)
return false;
else
{
$result = $table->fetchAll();
return $result;
}
} | 1 |
c52be94f356975766d20a73dbb955774 | 7a0e082959e06b5ecb947d41825d15b9 | Turns on the button that starts the next phase. | namespace Gui.Menus
public class AttackPhase : PhaseLogic
public void EndTurnButton_OnClick()
{
Gc.NextPlayer();
Gc.Gui.CurrentMenu = MenuType.MovePhase;
} | 0 |
c84d79f66470a7f175913c1075fbb25d | 94a53d97b52dee5615dac907ee4ac07b | returns the surface unit that this surface point is in (rounds down) | public class TransportSystem
private SurfaceUnit getLargeSU(SurfaceUnit msu)
{
return new SurfaceUnit(msu.side,
Mathf.FloorToInt((float)msu.u/largeTUWidth),
Mathf.FloorToInt((float)msu.v/largeTUWidth));
} | 1 |
58ed80b9f79d57d1a9d9f337b67a24ae | a6a8f73f963706800638369c0251e5bd | 计算前几帧的平均帧间隔时间 | class FPS(object):
def calculate(self, frames):
if not frames or not isinstance(frames, list):
return {}
jank_times = 0
vsync_times = 0
for frame in frames:
frame = frame.strip()
draw, prepare, process, execute = frame.strip().split('\t')
o... | 0 |
5320f03d5f521353950e21f470c38b41 | a56598fc65916d7de81499d153edfd36 | Method used by undo to delete tasks without pushing to undo stack | int pos = getDataProvider().undoLastRemoval();
if (pos >= 0) {
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TASK_LIST);
((TaskRecyclerViewFragment) fragment).notifyItemInserted(pos);
}
} | 0 |
a8977563e01d433eecef7bd1d5416edb | b38a0ed2d967c3129eb6da18f79221ef | Like os.rename, but try to work around some win32 wierdness.
Every so often windows likes to throw a spurious error about not being
able to rename something; if we sleep for a brief period and try
again it seems to get over it. | import os
try:
os.rename(oldname, newname)
except:
logging.debug('Command "mv {0} {1}" failed' .format(oldname, newname))
return | 0 |
60c946e72326d1fbec675338e35b0dab | f49e62e561bcd7105a9b875e98a87076 | Eliminate circles that overlap with better ones. | x_filt = np.abs(self.points[0, :]) < radius
y_filt = np.abs(self.points[1, :]) < radius
not_close = np.logical_not(np.logical_and(x_filt, y_filt))
self.points = self.points[:, not_close] | 0 |
1972821862ee9c14a3e7d9929f2cf23c | 06dde694719f4917acc56ee50f021d3f | Returns an array of ExtensionInterface's for the given group.
If the group is not defined all plugins are returned. | public function findAllByGroup($gid); | 1 |
a2263b4a3021086d9b72dc28c956ad49 | 32be0e11b74593427ac7f90c3bbabf5d | 如果当前手机系统是安卓6.0或者以上的版本需要进行动态授权 | public class MainActivity extends BaseVoiceActivity
private boolean checkIsAndroidO() {
if (Build.VERSION.SDK_INT >= 26) {
boolean isCan = getPackageManager().canRequestPackageInstalls();
if (!isCan) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permissi... | 0 |
32a76979ed71a40f9b0e722f52d32480 | b23d0f6799a7f419a0424845b28cf272 | 获取指定的agent id的代理商的有效耗卡数 | Double getMoney(Integer agentId); | 0 |
e58dfd8de7a40b1385c6370bfc867d49 | 002df00482e1656f26165070f499f710 | 单选弹出框,带确认和取消按钮 | public class DialogUtils
public void showSingleChoiceDialog(String title,
String[] items,
SingleChoiceDialogListener listener) {
items = Optional.ofNullable(items)
.orElse(new String[]{});
String[] fina... | 1 |
ae868ced4ee8a59eb182a3e0b3896296 | dba5f81aa4d263b51d63f7cae6606a27 | No chore experience. | fn cooldown() -> Exercise {
Exercise::new("Cooldown", "Great Job!")
} | 0 |
e4bb0c995a268b435b60b65c0ed447ee | d85f58c13ba994bf324c57c1db40635e | Gets the foreign field in the link | public function getForeignColumn(): string; | 1 |
7e87f600157ad232dca46ced087a441e | 2660d87ce976ea830a1a0f8030f1409c | Проверка доступности модуля модераторам | class CImOpenLinesReportBoardComponent extends \CBitrixComponent
protected function checkModules()
{
$result = false;
if (Loader::includeModule('imopenlines'))
{
$result = true;
}
else
{
\ShowError(Loc::getMessage('IMOL_COMPONENT_MODULE_NOT_INSTALLED'));
}
return $result;
} | 0 |
fe75a7716dddeb7d702466585d0c5cba | c1552fac471883bd86fef0f005155105 | Convert RGB pixel array to YCrCb | height, width = Y.shape
red = np.zeros((height, width), dtype=np.uint8)
green = np.zeros((height, width), dtype=np.uint8)
blue = np.zeros((height, width), dtype=np.uint8)
blue[:, :] = Y[:, :] + ((1.772 * Cb[:, :]) - (128 * 1.772))
green[:, :] = Y[:, :] - ((0.344136 * Cb[:, :]) - (128 * 0.344136)... | 0 |
8ca84ebe67bd0f0fd6d236d283943806 | 80a67fc1506c0461c840a44330457316 | 遍历图形列表,累加每个图形的面积 | class Building(object):
def allarea(self):
self.allareas = []
allarea = 0.0
self.allareas = self.xml.findall('.//{%s}Polygon' %ns_gml)
self.count = 0
for poly in self.allareas:
self.count += 1
allarea += polygon3dmodule.getAreaOfGML(poly, True)
ret... | 1 |
5515ea2f1c8a53a3aeca0d8c019c422e | e631fb69e11caba7ebd02e47c6396d98 | 複数のリストの共通部分をとる関数 | class DBScan:
def get_intersection(self, data_list, core_list):
retv_list = []
for j in core_list:
for i in data_list:
if i == j:
retv_list.append(j)
break
return retv_list | 0 |
351951d943139dc445e4088977945422 | f834a3af81992a4a2741fdfae35ae9c0 | Create plone members and register them for XMPP.
Then deregister them manually and check that all is fine. | class TestSubscriptionService(unittest.TestCase):
def test_unsubscribe_members(self):
ant = create_list('ant@example.com')
ant.admin_immed_notify = False
bee = create_list('bee@example.com')
bee.admin_immed_notify = False
anne = self._user_manager.create_user('anne_0@example.com'... | 0 |
2922296b85e7c2d919b504c4568cc1df | bc67d63c4945f3441ac9174cde61f329 | this function returns euclidean distance between two one dimensional arrays | def get_EuclideanDist(x, y):
myx = np.array(x)
myy = np.array(y)
return np.sqrt(np.sum((myx-myy)*(myx-myy))) | 1 |
514677f022002ef62bf1ac4e79c27d4b | c291f8354ce2fe868f996effcb123309 | Releases a picked up item. | {
grabbedItem.transform.parent = null;
grabbedItem.getRigidBody().isKinematic = false;
grabbedItem = null;
hasItem = false;
} | 1 |
e620afef4629e525d1add42fb2c4a486 | 2e0cc08e923ae41922056b0ec3ecac72 | Disables the TCP/UDP mod. | namespace MafDiBot
static class View
public static async Task<bool> DisableMod()
{
try
{
await Config.ChannelMain.AddOverwriteAsync(Config.RoleEveryone, Permissions.None, Permissions.None);
await Config.ChannelMainVoice.AddOverwriteAsync(Config.RoleEve... | 0 |
c1dba33b81377b26cbe8e7e9208f77bd | 01f7686d84fc9673b5a6974c82db9bb5 | Extract the stream name from a string.
Match the whole string.
There are two cases handled here:
abc -> abc, #**abc** -> abc
Leading/trailing whitespace is discarded.
Return None if no match could be found. | n = s.find('#')
if n >= 0:
return s[:n]
else:
return s | 0 |
9b06d89ead7cb1f4be8befaa7f21f14b | ec55885c71138d5317c35f1aff77c8e9 | Converts 2-character country code to continent code | def get_continent(country):
try:
country_code = pc.country_name_to_country_alpha2(country, cn_name_format="default")
continent_code = pc.country_alpha2_to_continent_code(country_code)
except:
if country=='The Bahamas':
return 'NA'
elif country=='Myanmar (Burma)':
... | 1 |
4196eb779a516f13710e4eca8ebee782 | 386599ac664f94a662d58b9f3bb7510b | \brief MainWindow alarmClear event handler.
Handles the MainWindow Ui alarmClear button clicked signal. | void CustomDialogAlarm::onAlarmSwitch(bool checked)
{
if (!checked) {
setVisible(false);
}
} | 0 |
3395cc13e4d85e76e2b91123233a8386 | f1b142adb002cd250b636e04d78f4e97 | Applies the styles from the specified style sheet to this object. | {
if (stylesheet != null && VisualEditor.Document != null)
{
HTMLDocument hdoc = (HTMLDocument)VisualEditor.Document.DomDocument;
IHTMLStyleSheet hstyle = hdoc.createStyleSheet("", 0);
hstyle.cssText = stylesheet;
}
} | 1 |
243473a47791bfd4b36aadf175ec049a | 3340de4b8bb4aee1aeadf4db6f030fa2 | 前端小型的IOC容器类,为所有的service相互依赖提供支持
TODO 目前之支持静态应用 | constructor() {
super();
this.bindServices(this._iocKernel);
this.addEventListener('ioc-request', (e) => {
if(this._iocKernel.has(e.detail.key)) {
e.detail.result = this._iocKernel.get(e.detail.key);
e.stopPropagation();
}
});
} | 1 |
f9013415549b143295ea91a3130f4b33 | 97d6d3f6fef8e2057cf7e642241a9e55 | Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. | public int maxProduct(String[] words) {
int ret = 0;
if(words.length==0) return ret;
Arrays.sort(words, new Comparator<String>(){
public int compare(String a, String b){
return b.length() - a.length();
}
});
int[] ocur = new int[words... | 1 |
494db239b26e1df0d79863c0b370067d | a2d151fba4c3e3880f6ebf3cbb896a21 | A list of features to enable on the guest operating system. Applicable only for bootable
images. Read Enabling guest operating system features to see a list of available options. | public class InstanceGuestOsFeature extends Diffable implements Copyable<GuestOsFeature>
@Updatable
@ValidStrings({
"FEATURE_TYPE_UNSPECIFIED",
"MULTI_IP_SUBNET",
"SECURE_BOOT",
"UEFI_COMPATIBLE",
"VIRTIO_SCSI_MULTIQUEUE",
"WINDOWS" })
public String getType() {
... | 1 |
fb99d8b49fcdcd06efc100f2345b103e | 76b4a6234e18d8d8e69789d978cdb0a6 | use haversine to caculate actual distance in miles | const meters = haverDistance(p1.lat, p1.lon, p2.lat, p2.lon);
return meters / 1609.344;
} | 1 |
5ca222d0ebc54a6460a9aa8cea632a3c | aff7848ba8dd9ffe276b994cabdc355f | .. versionadded:: 3.0.0
Gets the Git/FTP publishing credentials of an app. | loader_url = "https://support.shotgunsoftware.com/hc/en-us/articles/219033078"
return """
Publishes the file to Shotgun. A <b>Publish</b> entry will be
created in Shotgun which will include a reference to the file's current
path on disk. If a publish template is configured, a cop... | 0 |
83df830c8cd34916c288347b915ae17d | 06f96960a9f6dc464ddb830652973dfd | Retrieves the application resource.
Returns:
An app resource representing the project's app.
Raises:
googlecloudsdk.api_lib.app.exceptions.NotFoundError if app doens't exist | project = properties.VALUES.core.project.GetOrFail()
if console_io.PromptContinue(
message=('There is no App Engine app in project [{}].'.format(project)),
prompt_string=('Would you like to create one'),
throw_if_unattended=True):
try:
app_engine_api_client = app_engine_api.GetApiClientF... | 0 |
3b28d7e033ca33abc433c0f0f3fb7658 | cd38ed57b3f7c1164320c0a4778e7c3a | Handles Rendering of the Desktop View List, List Search, and Amount Input | function DropdownRendering(){
} | 0 |
bd53f27b7ac5152fcb3ca9be485d7050 | 54c7307959ad10ccaa4c5aebd1f9b609 | Return value as an ActionScript function. Returns NULL if value is
not an ActionScript function. | {
FunctionHelper.ValidateFunctionString(functionString, LangDef.funcL, LangDef.funcG, LangDef.funcLEQ, LangDef.funcGEQ);
FunctionHelper.ValidateVariableDef(vd);
FunctionHelper.ValidateValue(value);
return LangDef.GetFunction(functionString, vd, FunctionHelper.Conv... | 0 |
68bf3854f795561d91f8de5b9da720ea | ce724b7781401b86ae6805b9c8eab2e0 | 获取选择单科室同事 | {
$id = Yii::$app->request->post('d_id');
$arr[] = $id;
$subnode = $this->_getSubNode($id, $arr);
$user = User::find()->select('u_id,u_name')->where(['in','u_dept_id',$subnode])->andWhere(['company_id'=>$this->_user['company_id'],'is_del'=>0])->andWhere(['or','u_status=1','u_status=2... | 1 |
7c9623caf7134c572bef9cf11b0da4a2 | cdca940a05f9d1b36c20267dec021990 | DeleteAllRoom will remove all items out of the DB with the given RoomID | session := connectDB()
defer session.Close()
roomcoll := session.DB("HA17DB_jesse_arff_590245").C("rooms")
roomcoll.RemoveAll(bson.M{"roomid": roomID})
lampcoll := session.DB("HA17DB_jesse_arff_590245").C("lamps")
lampcoll.RemoveAll(bson.M{"roomid": roomID})
shuttercoll := session.DB("HA17DB_jesse_arff_590245").... | 1 |
1d116544518b32e13aaca18cacebe3a6 | 91221df555ced2acb627f9a6fd33910e | Close all connections and kill the
thread (and the associated socket) listening for new tcp connections.
Also clear all entries in self.connections dictionary. | if self.active:
self._sockets.clear()
for (port, address) in tuple(self._acceptors.keys()):
self.unbind(port, address)
self._close_all()
self._disp.stop() | 1 |
e58a11028bddb51a76076150a85e1a54 | 60698ae3f4716061e4d532fe62554ac0 | Общий процент изучных карточек | $lessons=ThemexCore::getPostRelations(0, $ID, 'lesson_course');
$progress=0;
if(!empty($lessons)) {
$users=ThemexCore::getUserRelations($user, $lessons, 'lesson');
$progress=round(100*(count($users)/count($lessons)));
}
return $progress;
} | 1 |
fc64f720336e388408820a4a25dba0ca | ba330ae7fc9b431a693a40008c1ef114 | Run RF classification using WeFDE features. | def rfe_kfda(x, y, p, lmb, kernel):
if (p < 0.0) or (p > 1.0):
raise ValueError("parameter p must be in [0.0, 1.0]")
xarr = np.asarray(x, dtype=np.float)
yarr = np.asarray(y, dtype=np.int)
if xarr.ndim != 2:
raise ValueError("x must be a 2d array_like object")
if yarr.ndim != 1:
... | 0 |
63620dccb9f377418c03945606df4678 | 100af8e2bc1f927b6147a48afd3d334b | Set the genome for this Sample. | self._HomologSet = HomologSet
self.Write = Write(self)
self.Read = Read(self)
self._alignments = {"latest": alignment} | 0 |
fc638c5583bbef8e5269a6c9df91d42b | 7862b373f91a5ac9233792d3d186a9a2 | 由于当前的cell组件,是我们自定义的组件,所以如果我们想要在自定义组件上触发事件,那么就需要调用
第一个参数:事件名,设置当前事件名的目的是让父组件可以捕获到当前事件
第二个参数:detail-->需要传出的数据
第三个参数:事件选项-->只有当两个选型全都打开时,才能够传递出数据 | this.dispatchEvent(new CustomEvent("mycustomevent"));
this.template.querySelector('div[data-id="eventhandler"]').dispatchEvent(
new CustomEvent("customeventwithparams", {
detail: {
key: "value"
},
bubbles: false,
composed: false
})
);
} | 1 |
95d5a6d43c1ff1cd4a87694a86b4d0fb | ccbe0818a17162cc04c7ac092f7ad4c3 | 获得商户配送费用列表 | namespace RFD.FMS.DAL.FinancialManage
public class FMS_MerchantDeliverFeeDao : SqlServerDao, IFMS_MerchantDeliverFeeDao
public DataTable GetAllMerchantList()
{
var dict = new Dictionary<int, string>();
var strSql = new StringBuilder();
strSql.Append(" SELECT ID,ProvinceID... | 0 |
eda170c74ad82b39e14afb455c9b49db | 25ecb7f95751379711183392010c414d | Extracts a keyword from the <code>data</code> and returns it as a string.
A keyword can only contain letters. | public class DrawingPanel extends javax.swing.JPanel
public String getKeyword() {
return _keyword.getText();
} | 0 |
d0bda3041d42187a1080584c170ae47c | bb7f620918bb50c7249484f43be94617 | 根据主题编码获取对应的主题发送记录
主题编码 | @Slf4j
@Service
public class VsmMessageSendRecordService extends SimpleGeneralService<VsmMessageSendRecord,Long> implements GeneralService<VsmMessageSendRecord,Long>{
public Optional<VsmMessageSendRecord> findByCode(String code) {
return vsmMessageSendRecordReposity.findTopByCode(code);
} | 1 |
037b910698d7f46b67e4aa15a8f6defc | 84707283354a6df1eadbc380a32888e2 | Write the cache back into the disk at fixed frequency. | periodical_write_back (void *aux UNUSED)
{
while (true)
{
timer_sleep(WRITE_BACK_INTERVAL);
cache_write_to_disk(false);
}
} | 1 |
451d66393d7577331996ffb648d61636 | 7729f5f49076f49a93b34741048d78ea | 121
给定一个数组,它的第 i 个元素是一支给定的股票在第 i 天的价格。
设计一个算法来计算你所能获取的最大利润。你最多可以完成 两笔 交易。
注意: 你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。 | num := []int{7, 1, 5, 3, 6, 4}
num2 := []int{1, 2, 3, 4, 5}
num3 := []int{7, 6, 4, 3, 1}
fmt.Println(maxProfit(num))
fmt.Println(maxProfit(num2))
fmt.Println(maxProfit(num3))
} | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.