query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
c352143c36d2f7c8e2dbdb9e8645d94c | 513419a5d674bc2e01ff057607efa00e | Redirect parent pages to first child. | routes.forEach((v, i) => {
if (v.children && v.children.length > 0) {
v.redirect = { name: v.children[0].name };
Util.setDefaultRoute(v.children);
}
});
} | 1 |
efb9038e4684488c0fd992885f899c59 | 6f299021d4d6ee374ae65f3b47a4909d | Allows the user to change the sound of music playing throughout the game.
Only accessible through the volume sliders in the Settings Scene and the Main Game Scene | public class OptionsHandler : MonoBehaviour
public void ChangeMusicVolume(float _vol)
{
currentMusicVol = _vol;
masterMixer.SetFloat("MusicVolume", _vol);
} | 1 |
620498242af788614a76d414adc024f5 | f4e5d475b2adc8b033dab9c2d9d2eaec | If the given filesystem-path contains any path-separators (either a forward or a back-slash),
return the part that comes after the final path-seperator, otherwise just return the argument unchanged. | static inline std::string trimEndOfSeparator(const std::string &path)
{
std::string _path = path;
char ch = _path[_path.length() - 1];
if (ch == '/') {
_path.erase(_path.end() - 1);
}
return _path;
} | 0 |
eef8e3a50b7d63c0de6d1705646cdd65 | 58c9649ecea2c1dfe6c3f4fbfc5068f0 | Обновить запись в таблице crm_Event | {
$where = 'evnt_id=' . $this->getVal('id', -1);
$id = $this->update('events', 'evnt_', $this->getValues(), $where);
return $id;
} | 0 |
826038e9e6d11e591bc57465cd6951fb | c5e5ac9c1face379af69bb9e6687db1d | Method to set the delay period for retrieval of scan results | class GrabzItHTMLOptions extends GrabzItBaseOptions
public function setDelay($value)
{
$this->delay = $value;
} | 1 |
668907bdf09f4b3d11f4103abf45d28e | 239baeda8679ae22850b982c1f730c2b | display the outcome of command:dir <path>
displaying the files and directories of the specified path | void print_dir(const char *current_path) {
printf("Current path: %s\n", current_path);
printf("PID: %d\n", getpid());
char buff[MAX_PATH_SIZE];
sprintf(buff, "ls -l %s", current_path);
system(buff);
} | 1 |
06a809a18cfb60158ffe6dde070279c5 | fe8fa749f2aa35b775e27cfc9246c897 | Set multiple attributes of one edge. | class Neo4jGraph(object):
def add_edge_attrs(self, source, target, attrs):
normalize_attrs(attrs)
query = (
generic.match_edge(
"s", "t", source, target, "rel",
self._node_label, self._node_label,
self._edge_label) +
rewriting.add_a... | 1 |
f8d9991e2bd8c69ebe7f088325d0f427 | 6539ff35c1e265ac45746224e97ddef6 | Submit the current order's data to Firebase. | public class MainActivity extends AppCompatActivity
public void submitOrders(View view) {
EditText nameFiled = (EditText) findViewById(R.id.name_field);
String customerName = nameFiled.getText().toString();
CheckBox checkBoxCream = (CheckBox) findViewById(R.id.whipped_cream_checkbox);
bo... | 0 |
14eee965257ec9cd1f814dcab2bbf316 | f1cfc04a9c52b59a73e2690e3cfb1ab6 | Testing to see if the method recognizes this is NOT a palindrome. | class TestIsPermutationPalindrome(unittest.TestCase):
def test_returns_false_if_not_possible_palindrome(self):
result = is_permutation_palindrome("ahsidfha")
self.assertFalse(result) | 1 |
ceee460fc33d713c15c7e26ba30c76d6 | 95f21ee9f52a12ab88fbe3b343fe97a2 | Destroys a value buffer created using createSimpleXmlValueBuffer. | {
if (buf == XNULL)
{
return;
}
if (buf->content != XNULL)
{
#ifndef XML_USE_BUFFER_CONTENT
XOS_MemSet(buf->content, -1, BASE_BUFFER_SIZE);
#else
XOS_MemSet(buf->content, -1, buf->size);
#endif
xmlFree(buf->content);
}
XOS_MemSet(buf, -1, sizeof(xmlBuffer));... | 1 |
be50f95e6450b7c2b25dbbdc7d2c19fc | 8dc17d96a801f13d8c5cc7a0b44e2b50 | gets the Total number of by ions in this series. | public class GcimCalculator
public int getTotIMi() throws java.rmi.RemoteException{
return this.numIMi;
} | 0 |
a0717396bfb88feeead861b028d7116a | 4174e9720ce4b608ea033287851b347c | Getting the machine's used interface name | cmd="netsh interface show interface"
sub= subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=False)
res= sub.stdout.readlines()
for i in res:
if re.search("\S+\s+(\S+)\s+\S+\s+(.*)",i):
if re.search("\S+\s+(\S+)\s+\S+\s+(.*)",i).group(1)=='Connected':
... | 1 |
5bca9691528d18b28fb06b919320715d | a3ea2328dfef40bd6797bcea9fbe5dc1 | 重新初始化加载KnowledgeBase,即重新加载所有的规则文件 | void knowledge_reset() {
kb = clearKnowledgeBase(kb);
} | 0 |
0bcdf738211614466a9953223311a728 | 63cf5c62b38ac9d28ca099d37b3d6106 | 添加 个人出售历史记录 | BasicResponse<PersonalTradeVO> addPersonalTradeRecord(PersonalTradeVO personalTradeVO, boolean isCustomize); | 1 |
708bbeb74af0a1327f1b46ad9f9e7445 | b271a0e8288cd6a64101c88f4cbba303 | Rounds tensor to nearest integer using a straight through estimator. | class FloatTensor(BaseTensor):
def ceil(self):
return self.no_params_func("ceil", return_response=True) | 0 |
a10fea7566405966d20fe4b091650771 | 59aa9cd751003787b835726618318898 | 根据商机编号,名称或客户查询商机。 | TaskQuery businessKey(String businessKey); | 0 |
bc6ee6ae4e557e81f1a41a90cf0c0908 | a90d1b23c129b05db7395ab4411983d7 | check that writing and then reading an object
is still the same | self.login()
(last_modified, nb) = self.mgr.read_notebook_object(self.nb_id)
ret_id = self.mgr.write_notebook_object(nb)
self.assertNotEquals(ret_id, self.nb_id)
if (ret_id is not self.nb_id):
self.mgr.delete_notebook(ret_id) | 0 |
d826cc9f2c7975272703343cc209e3f5 | d0ac7e308c1671f02d0f05d1857c57ce | Test writing events to stdout. | parser = bencode_parser.BencodeParser()
storage_writer = self._ParseFile(['bencode', 'utorrent'], parser)
self.assertEqual(storage_writer.number_of_warnings, 0)
self.assertEqual(storage_writer.number_of_events, 4)
events = list(storage_writer.GetSortedEvents())
expected_event_values = {
... | 0 |
1f81a9d8b8ab9169e8edecd0838b9e44 | f3eca816f93e0051ba8ef655d064102c | checks if geometryB is within geometryA | {
if (a.left < b.right &&
a.top < b.bottom &&
a.right > b.left &&
a.bottom > b.top
)
{
return TRUE;
}
return FALSE;
} | 0 |
6b4318f4e9120b8c6051a9ce01685295 | 8dcd1604392665cd084d786540cc0b7c | Create a new build job that is attached to the database - i.e.
that will send notifications to the database when it is updated.
Note this is the preferred way to create a BuildJob, since it gives
the job a jobId. | execution_manager = self._get_execution_manager([self._get_buildable_job()])
build_context = {
'start_time': arrow.get('2015-01-01')
}
execution_manager.running = True
execution_manager.submit('buildable_job', build_context)
self.assertIn('buildable_job', exec... | 0 |
aa2155d5f96603bd8bcf3afc4ddadc87 | 3110cce6c92bff74fdfe779178e2fe4b | After the animation stopped, "scrollViewDidScroll" should be invoked, this could fix the bug of lack of tableview cells. | void SNSTableView::scrollViewDidStartDrag(CCPoint position)
{
CCRect frame;
if (m_rowCount > 0 && m_delegate) {
for (int i = m_topPointer; i < m_bottomPointer; i++) {
SNSTableViewCell *cell = (SNSTableViewCell *)m_body->getChildByTag(i);
frame = CCRectMake(cell->getPosition().x, cell->getPosition().y, cell... | 0 |
d88199f383891a41c1026b88eef23442 | 67fb94497d50d3c4fec6a8d22167bd44 | @brief Append a attribute to the given element. | incr_NC_attrarray(NC_attrarray *ncap, NC_attr *newelemp)
{
NC_attr **vp;
assert(ncap != NULL);
if(ncap->nalloc == 0)
{
assert(ncap->ndefined == 0);
vp = (NC_attr **) NCI_Malloc(NC_ARRAY_GROWBY * sizeof(NC_attr *));
if(vp == NULL)
return NC_ENOMEM;
ncap->value = vp;
ncap->nalloc = NC_ARRAY_GROWBY;
}
e... | 1 |
6d7f3522e32dbadc7e50b5b7ebe550eb | a5be635546ba2bb48b880cba44eeb181 | Returns an object containing description of simulation and entities in it form GUI side. | String serializeSimulationState(); | 0 |
f7d76f86755d3d227b5e870a4e8c7f39 | b627133da6fdb8ee510bd9a76ad4b588 | Gets the direction to the left of the car, from the perspective of the direction that the car is facing.
E.g., if the car is facing UP, this will return LEFT, and if it's facing DOWN, this will return RIGHT | namespace PacSim.Models
public static class PacDirectionExtensions
public static PacDirection ToTheLeft(this PacDirection currentDirection) => currentDirection switch
{
PacDirection.NORTH => PacDirection.WEST,
PacDirection.SOUTH => PacDirection.EAST,
PacDirection.EAST => ... | 1 |
9e71bac56c6157adb83c164431adcf78 | 1afce573fcbb41404bc1697ef3f5a756 | Tests incrementing a batch of keys all at the same time. | batch := s.NewKVBatch()
batch.Set([]byte("b"), []byte("val-b"))
batch.Set([]byte("c"), []byte("val-c"))
batch.Set([]byte("d"), []byte("val-d"))
batch.Set([]byte("e"), []byte("val-e"))
batch.Set([]byte("f"), []byte("val-f"))
batch.Set([]byte("g"), []byte("val-g"))
batch.Set([]byte("h"), []byte("val-h"))
batch.S... | 0 |
5c3ec9f6b291d0e55b10046eac6c6889 | e734f318af62e97ebaccc249480028f6 | Load the compounds mapping. This maps from cpd id to name (we use
the name in our reactions, but use the cpd to parse the model
seed database to avoid ambiguities.
Optionally, you can provide a compounds file. If not, the default
in MODELSEED_DIR/Biochemistry/compounds.master.tsv will be used. | def _get_rcsb_complexes(filenames):
complexes = {}
for filename in filenames:
name = db.get_pdb_name(filename)
complexes[name] = Complex(name=name, bound_filenames=[filename],
unbound_filenames=[])
return complexes | 0 |
65a3802b799f388bc29693df9a6399fe | ae4a036fe37958cce616e9d690c1d63d | @brief Sort the N ADC samples | int i, addr = nch;
register uint16_t temp;
#define PIX_SORT(a,b) { if ((a)>(b)) PIX_SWAP((a),(b)); }
#define PIX_SWAP(a,b) { temp=(a);(a)=(b);(b)=temp; }
uint16_t p[9];
for(i = 0; i < 9; ++i, addr += NUMBER_OF_ADC_CHANNELS)
p[i] = ADC_array[addr];
PIX_SORT(p[1], p[2]) ; PIX_SORT(p[4], p[5])... | 1 |
f9c3da7832ddc9c29ea8dbb881db371c | 6d70313bfbae2808d6bac2bc6671276d | Sets the value of the BJADModuleEntry instance's
navPanel property.
The value to set within the instance's
navPanel property | {
if (!isset($this->input['parent'])) {
$this->input['parent'] = null;
}
$this->navEntries->setEntry($this->input);
} | 0 |
77909106bee70115530ebdf492fd4fac | 485646b3a74e7b12a04ea70cb8033a81 | 平滑启动 | namespace GPSTran
static class Program
[STAThread]
public static void Main()
{
Logger.Init();
Logger.Info(@"GPSTran启动!");
Logger.Warn(@"GPSTran启动!");
Logger.Error(@"GPSTran启动!");
Logger.Fatal(@"GPSTran启动!");
... | 0 |
c077fffd56bbf4cb56dfcb07a54bb6bf | a94a07ce232ae9f3ab308cf6fcaaf2db | 清理Patch目录,所有更新下来的资源 | cc.FileUtils:getInstance():removeDirectory(cc.FileUtils:getInstance():getWritablePath() .. "patch/")
cc.FileUtils:getInstance():removeDirectory(cc.FileUtils:getInstance():getWritablePath() .. LOCAL_PATH)
cc.UserDefault:getInstance():setStringForKey(KEY_OF_LOCAL_VERSION, CUR_VERSION)
cc.UserDefault:getIn... | 1 |
8663c66979aaa4b587e3c243e3cc9d1f | a707ecaa518d588f400e09186da87506 | Calculate the sum of squared errors (inertia) per cluster. | sse = 0
for c in range(self.num_clusters):
c_points = np.where(self.points_to_centroids_map == c)
points = self.X[c_points]
for point in points:
sse += self.get_distance(self.centroids[c], point)
pass
pass
return s... | 1 |
e4966037c5b7681a0352c6f911f4a2cb | 07c6e211b00b3b4ac28251d99248aa2f | true when anything has been injected and is available | namespace Elastos namespace Droid namespace Webkit namespace Content namespace Browser AutoPtr<SelectionHandleController> ContentViewCore::GetSelectionHandleController()
Boolean ContentViewCore::isInjectingAccessibilityScript()
{
return mAccessibilityInjector->AccessibilityIsAvailable();
} | 1 |
0b829e7f1a2487b685a1f644a823c389 | 113ddcc1b46af6c1e1869c9331f90279 | Normalizing stellar data by radius to compare with theoretical models | if np.unique(self.data.data).size == 1:
self.sData = factor*self.radiusmin*np.ones((len(self.data.data),))
else:
self.sData = normalize(self.data.data, tomin=factor*self.radiusmin,
tomax=factor*self.radiusmax)
... | 1 |
c3db7a0202e2fa210fd77742a22d78b4 | f92a2dca3f064ea70f2083677326a259 | Parses the string as a signed [Byte] number and returns the result. | namespace AtleX.CommandLineArguments.Parsers.TypeParsers
internal sealed class ByteTypeParser
: TypeParser<byte>
public override bool TryParse(string value, out byte parseResult)
{
bool result;
if (!string.IsNullOrEmpty(value))
{
result = byte.TryParse(value, out parseResult);
}... | 0 |
0a416eed204d6026d233ad643114a5b1 | 000d3e5bec51adffe7d44bbaed1d12ff | 按页查找,输出无密码用户信息 | @ResponseBody
public Map findOrdinaryUsers(int page, int rows) {
logger.debug("findOrdinaryUsers:" + "page=" + page + " rows" + rows);
Map map = service.findOrdinaryUsers(page, rows);
logger.debug("用户列表获取结果:" + map);
return map;
} | 1 |
4d6280b5ee5aba8712ba363d65d4e339 | 7677f7bfe26e2f1d188cb8c10b9f3d5d | # The Euclidean distance between vectors a and b | euclid.dist <- function(x,y){
return(sqrt(sum((c(x[1],x[2]) - c(y[1],y[2]))^2)))
} | 1 |
97f9fe09776e46ff7511cfea7de3c3f6 | df6407998f793e670539bcee27d0755b | Euclidean Clustering using PCL with k-d tree
returns:
cluster_indices, white_cloud | std::vector<pcl::PointIndices> get_cluster_indices(std::vector<LidarPoint> lidarPoints)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr trans_pcd = boost::make_shared<pcl::PointCloud<pcl::PointXYZ>>();
for (auto point : lidarPoints)
{
pcl::PointXYZ pcl_point;
pcl_point.x = point.x;
pcl_point.y... | 1 |
dc2550096d4484999b4626ece8897e35 | e683f283be9bc17f7a713b58901f3e65 | Remembers the timestamp associated with a raw ID | with self.lock:
self.cur.execute(
'insert into "timestamps" ("job", "what")'
'values (?, ?);', (db_id, name)) | 0 |
c93f6d226f5d24779b91e07f35aa499f | 9a83b625a7aface251076652f546d182 | @brief Replace fwd-table by ID
Replace operation of resource: fwd-table | tSfPolicyConfig *config,
sfcidr_t* Ip,
char *fileName
)
{
tSfPolicyId *policyId;
int iRet;
if ((config == NULL) || (Ip == NULL) || (fileName == NULL))
return -1;
if ((policyId = calloc(sizeof(tSfPolicyId), 1)) == NULL)
{
return -1;
}
*policyId ... | 0 |
7b469744bec9093d9bc227a7c96dd85a | bbd3bcd78572596e08690a5e11428fb3 | 更新订单汇率 | namespace OmsClient.Web.ControllersApi
public partial class UserBuyOrderController
[HttpPost]
public IResponseResult UpdateBuyOrderRate(BuyOrder request)
{
var result = Biz.UpdateBuyOrderRate(UserModel, request, out var msg, out var rate);
if (!result)
{
... | 1 |
e067cfe4505164af9b297f5e1f1cf5bb | b1a3abc3237d16660993ad062270eaff | 更新user的信息(不跟新密码,头像) | @Configuration
public class SDKService
public static JSONObject updateUinfo(User user) {
try {
JSONObject json = null;
String url = "https://api.netease.im/nimserver/user/updateUinfo.action";
List<NameValuePair> params = new ArrayList<NameValuePair>();
if (!StringUtil.isEmpty(user.getAccid()))
params... | 1 |
e5c27adbced9ec3d20fbb16ec035d2a6 | f2173775f2e426c8c2221b3ac5cf9884 | 动态获取秒杀path | @Controller
@RequestMapping("/miaosha")
public class MiaoshaController implements InitializingBean
@AccessLimit(seconds = 5, maxCoutn = 5, needLogin = true)
@RequestMapping(value = "/path", method = RequestMethod.GET)
@ResponseBody
public Result<String> getMiaoshaPath(HttpServletRequest request, MsUser user... | 1 |
a36ad0d0b70f03933ed063f0512600f0 | c87230ec8d8f7495e2960de4bf6965ae | Convert (cx, cy, w, h) to (xmin, ymin, xmax, ymax) | arr = cxcywh
x0 = arr[..., 0] - arr[..., 2] // 2
y0 = arr[..., 1] - arr[..., 3] // 2
res = [
x0,
y0,
x0 + arr[..., 2],
y0 + arr[..., 3]
]
return self.stack(res).reshape(*arr.shape[:-1], len(res)) | 1 |
7cfd73a435755362939453e8e394d768 | 72da7c962b0686b9f4a827d124499769 | 通过或忽略好友请求 | @PostMapping("/operFriendRequest")
public Result operFriendRequest(@RequestParam("acceptUserId") String acceptUserId,@RequestParam("sendUserId")String sendUserId,@RequestParam("operType")Integer operType) {
FriendsRequest friendsRequest = new FriendsRequest();
friendsRequest.setAcceptUserId(acce... | 1 |
34d786be158eea076aeccefc0829742e | 0faf6f9773265957f1f036b0deb022a9 | 设置原图宽度,像素为单位
此参数必填 | public class Texture extends com.earthview.world.graphic.Resource
public void setWidth(long w)
{
long wParamValue = w;
setWidth_ev_size_t(this.nativeObject.pointer, wParamValue);
} | 1 |
1f78133a2006d88c907423a44c2676c6 | bb0a0d94f2053a38e594d99cc75177b1 | 扫描表数据 | @Controller
public class HBaseDataController
@RequestMapping(value = "/data/scanTable", method = RequestMethod.GET)
public String scanTable() {
return "data/scanTable";
} | 0 |
0dc38637de42d689691a1c87262c208c | 455c46a70acd97e6b16f6d4e329c09af | Returns the meta object for the attribute '{@link org.eclipse.gmf.examples.design2d.ClassDesignStyle#getQualifiedClassName <em>Qualified Class Name</em>}'.
<!-- begin-user-doc -->
<!-- end-user-doc --> | EAttribute getStyleSelector_Class(); | 0 |
ccb55eb7b28c88d00de1421e650ad831 | 8c606444b69734f1649132afaf0023d2 | 异步保存查看次数 | if (!ctx.session.postViewMap) {
ctx.session.postViewMap = {}
}
let lastViewTime = ctx.session.postViewMap[postId]
if (lastViewTime) {
let timeNow = new Date().getTime()
if ((timeNow - lastViewTime) > (24 * 60 * 60 * 1000)) {
ctx.session.postViewMap[postId] = timeNow
} els... | 1 |
b98fa3eb1fe4e304e3980d14b6a3d23a | d5039e5adff8341f1b6a0d5a204aad3f | Obtain ParamGrid object from MxArray | class TDSEND_solver(object):
def getPGrid(self):
return self._p | 0 |
045f57812d436ea70d1c087388cec87b | 6cfe75ae1d1c5e1bd6f1afff5d31abca | seleciona e lista os dias úteis de um mês | {
$primeiro_dia = mktime(0, 0, 0, $mes, 1,$ano);
$num_dias = date('t', $primeiro_dia);
$pri_dia_sem = date('w', $primeiro_dia);
if($pri_dia_sem > 0) $calendario = array(0 => array_fill(0, $pri_dia_sem, NULL));
$dia = 1;
$semana = 0;
$dia_semana = $pri_dia_sem;
while ($dia <= $num_dias)
{
if ($d... | 0 |
702f7b633d891246f22e69c71e8ef45f | abafaf642f39b1d3c25aa2d4ee43c3ef | Returns the count of unread messages for the current User, given a specific sender. | namespace community.Business
public class BusinessFacade
public static int GetUsersUnreadMessagesCount(ApplicationUser user)
{
return new BusinessLogic().GetUsersUnreadMessagesCount(user);
} | 0 |
e4051f5a34fd3d4f59c93af819079616 | ff4c68ada033442060720bf5684bedbe | Create the recipe plan object, and print its status. | class TestScript extends Command
public function handle()
{
$recipe = DB::table('recipes')
->select('id', 'name', 'cook_time', 'prep_time')
->where("id", 1)
->get();
return 0;
} | 0 |
be20e8eeb21756004d96cc9e3327e3eb | 02cfa786d623e74b758c8d28503a55a9 | Process a single consumed item, adding any results to the <see cref="Produce" /> collection. | namespace Infrastructure.Contracts
void Consume(XmlContent xmlContent); | 0 |
00ef20995ac0343ee30af9a6544c4fce | c03b5e8939bd4a42d81b2f5311033332 | Promote a user to admin given an email | function promoteUser($userID)
{
include_once('_php/connect.php');
$query = "UPDATE user SET userType='admin' WHERE userID ='".$userID."'";
if (mysqli_query($connection, $query))
{
phpAlert("The user has been promoted to admin user.");
}
else
{
phpAlert("User not found: ".mysqli_error($connectio... | 0 |
7376df59a3555efc4abe551c2a382805 | 063c19dcf1372e9a7f25e4d714eda03c | Returns an array of strings of the URLs in the registry.
The array contains a snapshot of the names present in the registry. | class CTM_Registry
public static function fetchURLData()
{
return self::$URLData;
} | 0 |
ef2c1cf70a3f4759a2af5b10465ecad8 | 6cb7184cd5e41a8d4dd708f8e7b408e5 | Generate a CSV string containing the human readable headers. | class ChData(sys_data.SysData):
def get_csv_header(verbose=False):
if verbose:
return "Time,Raw Time,Name,ID,Value\n"
else:
return "Time,Name,Value\n" | 1 |
caa7acbc849f451c04209d0dcca922b7 | d09053f12f037329c513c7d7fe93024d | methode qui assure la detection d'obstacles a l'arriere du robot
- Retourne True s'il y'a un obstacle
- False sinon | for (IAgentite agentite : pCase.getAgentites()) {
if (agentite instanceof Obstacle)
return true;
}
return false;
} | 1 |
f92c291e1eb789a68c841c29770924c5 | 5a543a43f799bb1430cc3640e4c5230d | Return bare library names for LLVM components. | return [
"-x",
"c++",
"-w",
"-c",
"-std=c++17",
"_-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS",
"-DRVD",
] | 0 |
242f8daefe106eb0d8c84f0e6ddee0e8 | 58b8d2e98b54eb0b8eafb6c6ff2948b4 | 最大子段和,全为负数时,最佳为空子段 | int FindMaxCrossSubarray(int *A, int low, int mid, int high)
{
if (A[mid] < 0)
{
return 0;
}
else
{
int tempSum = 0;
int leftSum = 0;
for (int i = mid; i >= low; i--)
{
leftSum += A[i];
leftSum = leftSum > tempSum ? leftSum : tempSum;
... | 0 |
f5bcb3cd096d40a6149f44a2395f4696 | ee8be533206a918be83393738e773d1c | Permet de télécharger un fichier en écrivant directement dans le flux de retour. | {
if (file_exists($sFilePath) and $file = fopen($sFilePath, "r")) {
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . urlencode($sFileName) . ";");
header("Content-Transfer-Encoding: binary");
if ($iFileSize) {
header("Content-Length: " . $iFileSi... | 1 |
bf2fd7f53cbbe410e2becb4f4e94aa5d | 1d3c3bace0a409f402bec5fc4484847c | Returns this instance of the span buffer. | public class StringBuffer : HeapBuffer
public unsafe ReadOnlySpan<char> AsSpan() => new(CharPointer, checked((int)_length)); | 1 |
882ef57af9a4202d5871368b3967cacd | c0e5bc6ecfdd76f8849a8964d71d0805 | Function to set Number of Faces on die | def change_nod(text):
global nOfDice
nOfDice = int(text[0])
return | 0 |
167d553e1028f00c280d6920e76a8f94 | 97c37587e985485e3e9d8ad1c5aac0b2 | 设置接警X坐标 | @Table(name = "measure_list_issue")
public class MeasureListIssue
public void setPosX(Integer posX) {
this.posX = posX;
} | 1 |
7c020b70cf2f0e0370568fa83a46ae65 | f172e96a59523443f798cadcdc71ce47 | Overwrites the command with a new one at the corresponding keyboard keycode location | void MainWindow::keyPressEvent(QKeyEvent *keyEvent)
{
if (ui->commandLineEdit->hasFocus() && !commands.isEmpty())
{
if (keyEvent->key() == Qt::Key_Up)
{
ui->commandLineEdit->setText(commands[currentCommandIndex]);
if (currentCommandIndex > 0)
--currentComm... | 0 |
92f8be93c8fba73d289e11e4e2816c83 | 0ee4472b8c1c20b934dc8a94777483af | Ensure that data from one call doesn't override data of the second call | class ServiceTest extends
AbstractTestService
public function testData() : void
{
$systemUnderTest = $this->createSystemUnderTest();
$service1 = $systemUnderTest->data();
$service2 = $systemUnderTest->data();
self::checkServices(
$systemUnderTest,
$service... | 1 |
4389a9ad77f2fe7bde8298f3fc24272a | 5e71c165d50193c89fe28f2d34941044 | set up the linked structure (each room aware of its immediate neighbors
order is: top, bottom, left, right | void GamePlay::linkedSpace()
{
foyer->setRight(livingRoom);
livingRoom->setTop(bedRoom1);
livingRoom->setBottom(bathRoom);
livingRoom->setLeft(foyer);
livingRoom->setRight(kitchen);
bedRoom1->setBottom(livingRoom);
bathRoom->setTop(livingRoom);
kitchen->setLeft(livingRoom);
kitchen->setRight(bedRoom2);
kitche... | 1 |
39e8e233e061ba9ea0b1e19b3313d534 | a13bea4b7407d94d70e34ea7d8d8d476 | 训练fasttext词向量 | pre_deal_train_df.fillna('aa',inplace=True)
print(pre_deal_train_df.info())
texts = []
texts_s1_train = [line.strip().split(" ") for line in pre_deal_train_df['question1'].tolist()]
texts_s2_train = [line.strip().split(" ") for line in pre_deal_train_df['question2'].tolist()]
texts.extend(texts_... | 0 |
7b26f419c2d9f0c95996960f93e3b683 | c1fd93111b25a6600224d347c71de96e | 这是一个使用 `@public` 标记的公开方法(默认情况) | class Person
private sayHi(){
console.log('hi');
} | 0 |
a531a004c0c5d4b3cb0cf6f35f10118d | 87e8a4ba2b3d537ed3acf342fd33b1e3 | Find the best matching map for the url | var segments = splitRoute(cleanseRoute(url));
for (var route in routeTable) {
if (isMatch(routeTable[route], segments)) {
return route;
}
}
return '*';
} | 1 |
b139fc09d8705723b6941e8970715cac | b871c59cc8b6ec91ef2f9b7470b85dae | 根据信息推特id获取该推特信息的所有的评论 | @Service
public class CommentServiceImpl implements CommentService{
@Override
public CommentExecution getCommentListByWeiboId(long weiboId) {
if (weiboId<=0) {
return new CommentExecution(CommentStateEnum.ERROR);
}else {
try {
List<Comment> commentList = commentDao.queryCommentListByWeiboId(weiboId);
... | 1 |
3b08cdb5bde059be58b7350abdaae92e | 031f93917f6e9b57555c71f4deef426d | 按平台和权限获取微博列表 | class VWeiboController extends Controller
public function Lists(){
if(empty($_POST['tuid'])){
$this->ajaxReturn('ERR_PARAM_ILLEGAL');
}
if(!isset($_POST['sorttype'])){
$_POST['sorttype'] = 0;
}
$param =array();
$param['uid'] = $_POST['tuid'];
$total = $this->vweiboModel->Count($... | 0 |
1e0277d5a79f43de86e08ad0e082a1e3 | dc864bf9019e3da25fbc61f77bbf37c7 | Reads the merged edge info dataframe from a processing directory | def read_merged_edge_info(proc_url):
if io.is_db_url(proc_url):
metadata = io.open_db_metadata(proc_url)
edges = metadata.tables["merged_edges"]
columns = list(edges.c[name] for name in EDGE_INFO_COLUMNS)
statement = select(columns)
raw_df = io.read_db_dframe(proc_url, statem... | 1 |
a19a7ba5004fc154bb2cfb45d7efefd1 | 9d14316f1c565d7f4bb68f68df4168d0 | Initialize all fields in class. | class Instruction:
def __init__(self):
for field in DATA_FIELDS:
setattr(self, field, None) | 1 |
e002e1e12f1518301403105711795065 | 0fb00e75ca79a39f255d2bef62c16a6a | runs the simulation of the cart pole | class InvertedPendulum:
def __init__(self, pole_mass=2.0, cart_mass=8.0, pole_lenght=0.5, delta_t=0.1):
self.angle_list = list()
self.gravity = 9.8
self.delta_t = delta_t
self.pole_mass = pole_mass
self.cart_mass = cart_mass
self.pole_lenght = pole_lenght
self.ang... | 0 |
9d42d80fd98b45f0e54b553b93360222 | f0419058dd0c283865bdef40b6d4db90 | Shares this event (sends out recommendations).
* users: A list that can contain usernames, emails, User objects, or all of them.
* message: A message to include in the recommendation message. | namespace CityVoter.Social
public static class GigyaHelper
public static GigyaResponse<string> Share(string[] providers,
Account publishFor,
string message,
string title,
... | 0 |
209a3ac40245c6dfc52bdb6d1012f5bd | 92fb71a1ceaf592c3dbc42fafc5d2595 | Get a key from the page URI. | def uri_key(uri):
return split_uri(uri)[1] | 1 |
65699517b124011cdf83f056ab8007bb | 1c06ec34a0018bf3d5d0183af348d833 | LZW压缩 | def lzw_encode(inpath, outpath):
dictionary = {bytes([i]): i for i in range(256)}
max_code = 256
code_bits = 8
buffer = 0
buffer_bits = 0
with open(outpath, 'wb') as outfile:
P = b''
for b in util.filepath_bytes(inpath):
C = bytes([b])
PC = P + C
... | 1 |
61f2fde808e6764b3137340d377406ae | fcdfcae29d8e7fd957f3e061f7ebaa20 | 筛素数 | const arr = new Array(n + 1).fill(true);
arr[0] = arr[1] = false;
for (let i = 2; i < Math.sqrt(arr.length - 1); i++) {
if (arr[i]) {
for (let j = Math.pow(i, 2); j < n + 1; j = j + i) {
arr[j] = false;
}
}
}
return arr.map((i, index) => i && i... | 1 |
7221d9e0e595f0b51e8911f16a463082 | 5501a134513667ca53c1d2b3c15c0249 | Switches the active blog until the user calls the restorePreviousBlog() method. | function classblogging_switch_to_blog( $blog_id )
{
if ( function_exists( 'switch_to_blog' ) ) {
switch_to_blog( $blog_id );
}
} | 1 |
18718cc485e9aed996ec4ada8c6e0653 | aa29663fc39944f80386f21acda230d0 | 在playable播放时的每一帧,获取累计已播放时间,除以总间隔,
对应到曲线的x轴,从曲线上取得对应播放速度值 | fun getVolumeProgressDegreeX(context: Context) =
context.getSharedPreferences("play_volume_progress",Context.MODE_PRIVATE).getFloat("progressX",-1.0f) | 0 |
b6d8809bd02458077d16fe9a715de95a | aee9492fdf761f0d6505b4d70a9a1605 | Calcular envio según la dirección seleccionada | class BolsaController extends Controller
public function actionCalcularEnvio(){
if (isset($_POST['direccion_id'])) {
$direccion = DireccionEnvio::model()->findByPk($_POST['direccion_id']);
$flete = Orden::model()->calcularTarifa($direccion->ciudad->cod_zoom, $_POST['numero_productos'], $_POST['peso'], $_POST['s... | 1 |
0ef4c3ceba92a6cd2ccbbee7e57ff5d0 | c9a57fc2330298c3ac8005514df7cd6e | Load a public and private key from a pair of strings. | Key[] keys = new Key[2];
keys[0] = getPublicKeyFromPemFile(publicKeyFile);
keys[1] = getPrivateKeyFromPemFile(privateKeyFile);
return keys;
} | 0 |
53baca08a798990a1413dee68eb83c7d | 006b9216cbe4cadeced3fa0c20153c36 | Adds the timer pattern to the matrix
The timer pattern is a dotted line,
which is added between the finder patterns.
No conflict calculation with the alignment patterns is done,
because this dotted line is part of the pattern. | size = len(self.matrix)
if size < 25:
return
pattern = [
'#####',
'# #',
'# # #',
'# #',
'#####',
]
index = (size - 25) / 4
for pos in itertools.product(alignment_pattern_locations[index], repeat=... | 0 |
82f302aa45a96df10992eaf61a4c4637 | 35b72ca53f593106e22085ab4f1c8d1d | Set up TCP/IP Servers for arm and computer | LT_IP, LT_PORT = "127.0.0.1", 5000
COM_IP, COM_PORT = "127.0.0.1", 5001
SpinupServer(LT_IP, LT_PORT, LieutenantRequestHandler)
SpinupServer(COM_IP, COM_PORT, CommanderRequestHandler)
while(1):
time.sleep(1) | 1 |
12911c1533625f212b16ec813c79f00c | f8b927917672b393f9e4a5268395344c | Test operator overloading method __sub__ | try:
new = Param(formula=[[operator.sub, self, other]],
strform=Param._build_str_formula(self,'-',other))
except:
raise
return new | 1 |
61750c618b64b57d1d90c14c60a48216 | 937977dae5a85b811ed131676726baba | Makes a request to https://www.depts.ttu.edu/communications/emergency/coronavirus/ and scrapes case data. | Log.i("Info", "getWebsite()");
new Thread(new Runnable() {
@Override
public void run() {
final StringBuilder builder = new StringBuilder();
try {
Document doc = Jsoup.connect(url).get();
Element totalCasesElem... | 1 |
dd419b4d234b39f8c5cec77ceedb13a5 | 037330ece7cde4aba9fc9c25a87f26a9 | 转换double 去除小数点后面的0 | public class StringUtils
public static String deletzero(String str) {
DecimalFormat decimalFormat;
String pattern = "###.";
if (str.split("\\.")[0].equals("0")) {
decimalFormat = new DecimalFormat("0");
} else if (str.split("\\.")[1].length() <= 4) {
for (int i = ... | 1 |
43622acf290b95fec83cc1924a625265 | 41a07b673f6103423d3d15d735957925 | Obtiene el atributo cerrado de una instancia de Hueco | abstract class HbfSesiones implements ActiveRecordInterface
public function getCerrado()
{
return $this->cerrado;
} | 0 |
12209fe72f8c2c5bcb9609deab9de469 | f2753c57aa18eed5e559088823336ff3 | 去除ID前缀 | each(
mappingIdIndex,
function ( item ) {
if ( item.reg.test( baseId ) ) {
each( item.v, function ( mapData ) {
var key = mapData.k;
var rule = createPrefixRegexp( key );
if ( ru... | 1 |
c2c3e9ab74de78cc61c0422ebbb205a1 | d0d8f10f3c687f07132f4846b9a24f2b | Расчитывает высоту элемента согласно всем настройкам | {
$this->cols = self::DEFAULT_COLS;;
$i = 0;
foreach ($this->items as $item) {
if(isset($item['colSize'])) {
$i++;
$this->customSizeCount += (int)$item['colSize'];
$this->cols -= (int)$item['colSize'];
}
}
... | 0 |
aea6d2db4c3ab0d3cb32d9507f6d7d21 | 877d32a402ca8905b8bd9d1e6754ff9a | Driver-specific function: update the vdp mouse state | int PDC_mouse_set(void)
{
return OK;
} | 0 |
aac5703be57b10bebb4b23ae54192b5b | 912da100e0f9d47639d0fceff124f72d | Deletes all records in the Registrations table | def del_all_records():
delete_alles = Customer.delete().where(Customer.name >= '')
delete_alles.execute() | 0 |
bac5fa817b393fee714fbce399a5f00b | 3ab205ea0cc543ab12c5ec75743f41a9 | 添加元素,如果失败调整内容表大小 | public boolean add(String e){
checkElement(e);
if(size()>=capacity){
throw new IllegalDistributionLockStatException(IllegalDistributionLockStatException.State.FULL);
}
distributionWriteLock.lock();
try {
return offer(e);
}catch (Exception el){
... | 0 |
09d0fe2e6439b9613ccce1d4c03d231c | fa6ccc80b50c9e6581a5cb396e9c3fc7 | Start the method that collects the Audits using the stream mechanism. | class SimStream(object):
def start(self):
if self.consumer is None:
self.setup()
self.start_collecting() | 1 |
effa269b848ab7f740ccebd6a2fb6e92 | ae4cc5fac1cfce9002d34befe133f3b8 | Crea y rellena un diccionario a partir de una ruta de la planificaion base | self.base=base
self.spark=spark
self.case_std=case_std
self.date=date
self.ruta="bases/"+empresa
self.ord_hid=ord_hid
self.path=base+"/"+date+"/"+case_std
self.ver=ver
self.horario=horario
self.sep=sep
self.etapas_df=self.etapas()
self.indhor_df=self.indhor() | 0 |
5ea25f9707d8301f5d09fedc5cef08ee | 98060787c6e24ef186fef7b43a09f6a8 | お店全体でのランキング表示機能 | class RestaurantsController
def ranking
@ranking_restaurants = Restaurant.order(favorites_count: :desc).limit(10)
end | 1 |
1180210dc0566dd35efb9f047ef5de48 | a7d14930ceaae5b484463b279f0b335e | sets the size of the text | {
$this->size = $size;
if (!empty($this->textLines)) {
array_walk($this->textLines, function ($item) {
$item->size($this->size);
});
}
return $this;
} | 1 |
2f7dc6c4f2874917b470696b3f09fa88 | 0e37d5c43190553f1c59b3487ff89873 | 获取栈顶元素放入item中,空栈则返回false | export class LiStack<T>{
getTop(): boolean | T {
if (!this.head.next) {
return false;
}
return this.head.next.element;
} | 1 |
4dcca8a9425b9870a50a404ea283007f | 64e0d529a03684ac57207b764fa25e64 | Instancio el Gameobject Bala (definido como variable publica), en la posicion de este Gameobject. | public class BalaDestroyerPisc : MonoBehaviour
void Start()
{
} | 0 |
91880d3df39304339352aa9d32459aac | 7bbca7b3d7fb547969ad1694741fda54 | Read default config from amazon s3 if no config file path is provided. | final String defaultConfigUri = ExchangeRateUtils.getDecryptedEnvironmentVariableFromAWS("DEFAULT_CONFIG_URI");
ERTParams ertParams = readConfigFromAWSS3(defaultConfigUri);
Set<String> nodeNames = ertParams.nodes.keySet();
for(String nodeName : nodeNames){
ertParams.nodes.put... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.