query_id
string
corpus_id
string
query
string
code
string
label
int64
aaeacbeae9a9e82f33be4cf20fd3b0ec
d87bed51ff487a4a8e25824a56cd9fc8
根据用户地区自定义网站名称:比如“会东广告栏"
$str = "<p><span class='xing'>*</span>地&nbsp;区&nbsp;名&nbsp;称:"; $str .= "<input type='text' id='name' size='12'/>"; $str .= "</p>"; return $str; }
0
1599a6404c654e975eeb578550ee24a0
89d0777fd1e8149026f527e75b8f4660
Reads AirSigmets from file, inserts into grid, and then inserts into DB
rapidjson::Document sig = ContentReadWrite::readJSON("data/sigmet.json"); std::vector<AirSigmet> airSigmets; AirSigmet::readFromJson(sig, airSigmets); int c = 0; for (const AirSigmet& a : airSigmets) { std::cout << "AirSigmet " << c << " of " << airSigmets.size() << std::endl; std::vector<std::string> interior...
1
613fc728fe7a42832587239da8bbfd6e
4089aa29237abb3baaaaddb7dd7c6258
给站点ID列表加锁
public class DistributedMutexLock public void lockSiteSubGroupCookieList(int siteId,int agentSubgroupId,int lockTime) { String cacheKey = "ACCOUNT_SITE_" + siteId + "_SUBGROUPID_" + agentSubgroupId + "_COOKIE_LIST_LOCK"; MemcacheManagerForGwhalin cacheClient = MemcacheManagerForGwhalin.getInstance(); Calendar cal...
0
a3077896a82464c7ea42f6dba6667dd0
c850e7185584454dd4664dc642c98db1
Returns surface area of a cylinder, radius as first argument and height as the second argument.
float cylinder::SurfaceArea() { float surfaceArea; surfaceArea = 0; surfaceArea = circumference() * height + 2 * area(); cout << "The surface area is " << surfaceArea << endl << endl; return surfaceArea; }
0
ef16a865954594a6eb05f844d6600c1f
4adc5b1aa2d08c22940d7986f66365f4
Finds the nth digit in Champerdowne's constant.
digits = Number(digits) + 1 var digits_per_iteration = 14.1816474627254776555; var iterations = (digits / digits_per_iteration) + 1; var a = new Decimal(13591409); var b = new Decimal(545140134); var c = new Decimal(-640320); var numerator, denominator; var sum = new Decimal(0); for (var k = 0; k < it...
0
ef4d0bebfb403ff2e9298993522060db
18cb3e441be4433de2d7894801baf796
Collect candidates from all buckets from all hashes
class Engine(object): def _get_candidates(self, v): candidates = [] for lshash in self.lshashes: for bucket_key in lshash.hash_vector(v, querying=True): bucket_content = self.storage.get_bucket( lshash.hash_name, bucket_key, ...
1
f96d6eb8ab7a138d3ead85c7cdef79b2
d848d444ef641658b20235c5fb593989
testing of the Dog model
class PugOrUghModelTests(Pregame, TestCase): def test_dog_creation(self): self.assertEqual(self.dog1.name, 'Dog1') self.assertNotEqual(self.dog1.gender, self.dog2.gender) self.assertLessEqual(self.dog3.created_at, timezone.now()) self.assertEqual(self.dog1.__str__(), 'Dog12')
1
2c9cf35fd8c9500fc9abb643be98f136
db2aa7b738392cac5074f54d6de08c08
@brief This function gets if the External PLL Loop Filter is enabled
CTR_6002DR2_API int LMLL_TxRfGetLOOPBBEN() { return getMainModule()->getTxRf()->getLOOPBBEN(); }
1
2342376f618cc7da1b618c9af7899168
b0e30f924ced896098bcea678351812f
extract gray object from the input image
cv.cvtColor(image, image, cv.COLOR_RGBA2GRAY, 0); cv.threshold(image, image, 175, 255, cv.THRESH_BINARY); cv.findContours(image, contours, hierarchy, cv.RETR_CCOMP, cv.CHAIN_APPROX_SIMPLE); let cnt = contours.get(0); let rect = cv.boundingRect(cnt); cnt.delete(); return image.roi(rect); }
1
4b5ba3f872feaf16747b289670352ed7
3655c5363ce6d8ecc4fda86b5e9b34f5
Event fired when the user selects the button to show the updates release notes.
class WorkbenchFrame(wx.Frame): def doEditReleaseNotes(self, event): version = UpdateManager.getApplicationVersion() releaseDir = Framework.getPath("data", "workbench", "releases") self.openFile(os.path.join(releaseDir, version, "release-notes.txt"))
1
65df60ab6f02ad3429618cecb98942f0
e729c88bed19d297d0716ae11f16888e
Create instance of ``CleanImage`` from FITS-file with CLEAN image.
hdu = fits.open(filename)[0] self = cls(filename.split(os.path.sep)[-1], hdu.data.astype(np.float), hdu.header) try: self.datetime = Time(self.header['DATE-OBS'], format='isot') except (ValueError, KeyError): conf.logger.warning(('No time inform...
1
56f6500d66b0c8cbbb5845a26f7f0a08
13628ed009d24ee4c73dec913556c832
计算隐藏变量好瓜值
double calculationTruefit(BeeGroup bee) { double truefit=0; truefit=0.5+(sin(sqrt(bee.code[0]*bee.code[0]+bee.code[1]*bee.code[1]))*sin(sqrt(bee.code[0]*bee.code[0]+bee.code[1]*bee.code[1]))-0.5) /((1+0.001*(bee.code[0]*bee.code[0]+bee.code[1]*bee.code[1]))*(1+0.001*(bee.code[0]*bee.code[0]+bee....
0
b5a17596a6151121c41b04895de39770
bf3a8029702733c54a0588b374214fe8
Pretty prints a matrix to stdout.
def matprint(mat, fmt="g"): col_maxes = [max([len(("{:" + fmt + "}").format(x)) for x in col]) for col in mat.T] for x in mat: for i, y in enumerate(x): print(("{:" + str(col_maxes[i]) + fmt + "}").format(y), end=" ") print("")
1
9a7c8a93a53b52542231dec1a4ef9544
b9212fcf1a1a8292022f2b4525e82ce2
获取强化最大等级
function ForgeData:GetUpStarMaxLevel() return #self:GetUpStarCfg()[0] or 0 end
1
4c1f119978bb2c8d4e88c48acec59ce1
2163c21eb6c015c8e6fb3d4df1c1f4a1
Fitting Partial Least Squares Regression to the dataset
{ PLS2Regression result = new PLS2Regression(); result.AnalyzeFromPreprocessed(matrixX,matrixY,maxFactors); return result; }
1
8fb2998f6b0c399645a18e4b8f5cda57
5757a7914fd97967b75528bbf5b519eb
Sets the default fallback LB method.
abstract class UserPreferences implements UserPreferencesInterface public function setDefaultMethod($defaultMethod) { $this->defaultMethod = $defaultMethod; }
1
f3e50b3d7d35394149c48194a12e871f
e5795ac8036e11a7993b9faf74d311b3
Callback for Kodi notifications that handles and dispatches playback started and playback stopped events.
namespace MediaBrowser.UI.Controls public partial class NavigationBar : BaseUserControl void PlaybackManager_PlaybackStarted(object sender, PlaybackEventArgs e) { if (e.Player is BaseInternalMediaPlayer) { CurrentPlayer = e.Player; CurrentPlayer.PlaySt...
0
a1ae9e179d4e6131a76abe9f0b1eef87
9d556e46c379027c6deadbfd8a79a494
Register a dependent file name with the pywbemcli dependent file api. This insures that any change to a dependent file will cause the script to be recompiled.
def register_dependency(file_path, document): document.settings.record_dependencies.add(file_path) document.settings.env.note_dependency(file_path)
1
5b3f20f86035f18d50f21bb246e99391
ee888b749a50adf6a6246408a82494f4
Test method for Transaction.abort() which aborts an empty transaction.
class IExtendedTransaction(ITransaction): def nti_abort():
0
c57d6c650de557c04da6a17630326afa
4081b44cb1adb84e87d4039a82a23cb3
to change
def changer(a, b): a = 2 b[0] = 'spam'
1
788399565a7d08c24e0f87e5e65875dd
61775cdf1812e4e0107e20c08c074004
API to get connected network details such as SSID, IP address, USB connection status. Returns: dict: JSON object with teh network details and execution status.
class NetgearRouter: async def async_get_link_status(self) -> dict[str, Any] | None: async with self.api_lock: return await self.hass.async_add_executor_job(self.api.check_ethernet_link)
0
132fff0db8c7e9178b778b935b4154af
6ab00349cbe3b9df4fdb8e761c908d21
显示建筑名
void ShowBaseName();
0
6692856b55eeab59775bdd9f01cf2147
969033e2fb7e78441f15223edd3c1817
============== bdSecurityID::bdSecurityID ==============
void bdInitChunk::bdInitChunk(bdInitChunk *this) { bdChunk::bdChunk(this, BD_CT_INIT); this->__vftable = (bdInitChunk_vtbl *)&bdInitChunk::`vftable'; *(_QWORD *)&this->m_initTag = 0i64; bdSecurityID::bdSecurityID(&this->m_id); this->m_theirKey.m_ptr = NULL; this->m_windowCredit = 0i64; }
1
3b0e253f818bd44dcf4f5c98ba38c36d
a5713ee8a976215305718cb28d33b3e7
Calculates the BMI in Imperial units.
class BMI: def calcBMI(self): h = self.height / 100 self.bmi = self.weight / (h ** 2)
0
925dc4073a3a0c7971c3eb25ade0b3a6
94aecdeda8aeefd0d275bd3d84908e7d
获取从用户等级升到下一级所需要的所有数量
public class UserGrowthReward public static List<Integer> getLevelsCanReceive(int growthLevel) { List<Integer> levels = new ArrayList<>(); for (int i = 1; i <= growthLevel; i++) { if (canReceive(i)) { levels.add(i); } } return levels; }
0
7a7445abe74e174dbf8bf95d3b5172cd
04ae29ded5a35aa9d6d5bd76454df01c
2.When the user clicks the forward arrow, make a GET fetch request and show next 50 monsters.
if (NewFetchApi.pageNumber < totalPages) { NewFetchApi.pageNumber = NewFetchApi.pageNumber + 1; drawPageWhenClickOnArrow() } }
0
06125e1bdd241cb1e04767c5683d85f2
16fab51d634fe1d1184e9625fe1fdb16
Lagrange's Four-Square Theorem: All natural numbers can be represented by at most four numbers' square sum.
Factorizer factorizer = new Factorizer(); int currentFirstNumber = 1; final int LENGTH_OF_SEQUENCE = 4; int[] currentFour = new int[LENGTH_OF_SEQUENCE]; ArrayList<HashSet<Integer>> currentFourFactors; boolean found = false; ArrayList<Integer> currentNumberFactors; while (!found) { currentFirstNumber+...
0
beb2614b04bf11e7f576b5dcd4a86660
7210f86537fd48cf693a4a04089aeebc
En funktion som skriver ut tre punkter efter varandra
int main() { Punkt p1, p2, p3, p4; p1.lagPunkt(1, 2, 2); p2.lagPunkt(5, 2, 8); p3.lagPunkt(21, 25, 33); p4.lagPunkt(1, 7, 36); std::cout << "Punkt 1 er: " << p1 << std::endl; std::cout << "Punkt 2 er: " << p2 << std::endl; std::cout << "Punkt 3 er: " << p3 << std::endl; std::cout << "Punkt 4 er: " << p4 << std...
0
ba9829a592fc7c834a6fb2accdd616fb
ed7a04df9005a242bb1917a3b11d319c
Возвращает получаемое юзером количество бонуса за оффер.
{ double bonus = 0; if (!General.IsNullable(orderId)) { using (WMContext context = new WMContext()) { var query = ( from og in context.OrderGoods join g in context.Goods on og....
1
1d547861edf016d34e80c5a6c5ccb0ce
8da16dbb68cf257d79295b607c766947
Implementation of cuckoo search global exploration walk
final boolean[] neighbor_has_server, final double[] performance, int[][] weights, int[] outputs_neighbor_server, int[] outputs) { HashSet<Vertex<Integer>> selected_nodes = new HashSet<Vertex<Integer>>(); LinkedList<Step> wal...
0
1539bb2d7a0534650a1f3dfce86f5675
1c3fbd2458f50edc063313d0c8f3f5fb
Given a kinetic energy in MeV returns CSDA range in cm
l = electron_wavelength(keV) V = keV * 1e3 return (2*np.pi)/(electron_wavelength(keV)*V)*(electron_mass*speed_of_light**2 + elementary_charge * V)/(2*electron_mass*speed_of_light**2 + elementary_charge * V)
0
9da58ccd294866bb185e63358d944057
f5f9b3fbd31867c32a4050b0ab113d52
Get all drink categories.
class DrinkCategoryController extends Controller public function index() { $categories = DrinkCategory::latest()->get(); return view('admin.bar.categories.index',compact('categories')); }
1
2eeed2d1d988838b362cf581decfc8fc
c8fe139c5888a5a29a5d5f1bf78eaa50
Handle the symbol size value change from the symbol size spinner.
namespace WLib.WinCtrls.Dev.ArcGisCtrl public partial class SymbolSelectorForm : DevExpress.XtraEditors.XtraForm private void nudSize_ValueChanged(object sender, EventArgs e) { ((IMarkerSymbol)Selector.StyleGalleryItem.Item).Size = (double)nudSize.Value; PreviewImage(); }
1
575fb3eda4d980eb4f5cbad621c65ec0
844609568ef2e4df7bbbfc6d4cf087ed
设置游戏结束类型
{ if(index <0 || index >=2) return; this->game_type = index; }
0
95cc37c6a15ac4bd36c25dfc2f1853e9
1e73167d20dd980d11ef72e31a3fff11
reads temperature and returns raw 16-bit sensor output
static int16_t hdc1000_DataTemperatureGetRaw( I2C_Handle i2c, uint16_t *pi16Temp, uint16_t *pi16Hum) { uint8_t rawVal[4]; if ( hdc1000_DataRead( i2c, rawVal ) != PASS) return FAIL; *pi16Temp = ((uint16_t)rawVal[0] << 8) | rawVal[1]; *pi16Hum = ((uint16_t)rawVal[2] << 8) | rawVal[3]; return...
1
5ce55450696cfb877b7ece02e005515d
f6d3ec5cc22d9deeeb06ce60124ba5bc
Allows to specify a different name for the result file
class CryMainImmigrantCalculation(CryMainCalculation): def set_output_file_name(self, output_file_name): self._DEFAULT_OUTPUT_FILE = output_file_name
1
531c17624fdcb23084115d9804fe7684
bfdbd6945f19f173c551c6535dc7ae36
@brief Find the last valid token that match the command texts etc.
static const struct shell_static_entry *get_last_command( const struct shell *shell, size_t argc, char *argv[], size_t *match_arg, struct shell_static_entry *d_entry) { const struct shell_static_entry *prev_entry = NULL; const struct shell_cmd_entry *prev_cmd = NULL; ...
1
260f6850c5bd8738f754d75bda1f6eec
53988cd4becf47c68d8dc559db7438d0
车险投保缴费提交交易回调方法
public void requestPsnAutoInsurancePaySubmitCallBack(Object resultObj) { BaseHttpEngine.dissMissProgressDialog(); Map<String, Object> resultMap = this.getHttpTools().getResponseResult(resultObj); if (StringUtil.isNullOrEmpty(resultMap) || StringUtil.isNullOrEmpty(resultMap.get(Safety.JQXPOLICYNO))) { startAct...
1
bd0db58e2866ee12a2cc84f7c594c23f
09b0ba9cb4d6eef69f1b2980ba6c981a
If token is wrong account activation should not be possible.
{ $user = User::findOne(['email' => 'georgemember@email.com']); $I->assertFalse(User::isActivateTokenValid($user->password_reset_token)); $I->amOnRoute('/site/activate', ['token' => $user->password_reset_token]); $I->seeResponseCodeIsClientError(); }
1
5422287c76016fcdf7831b9b1c47349e
365ca0c9299356f6d0f5c8b35847ed91
Set if server requires TLS.
class NSSSLVServer(NSBaseResource): def set_tls1(self, tls1): self.options['tls1'] = tls1
1
4f68a3168af802f517c8c97e3bc4d47e
089df584f8391450abdd21b02706a0da
Check to see if AliasId property is set
namespace Amazon.WorkSpaces.Model public partial class ConnectionAlias internal bool IsSetAliasId() { return this._aliasId != null; }
1
502ad5c6190e668a595e3a178b2fb717
c5fbd6d326e2b5a01aaf3533d31a1d28
Save a JSONArray to file
class DecryptPacoJson private static void jsonToFile(JSONArray input, String outputFilename) throws IOException { FileWriter writer = new FileWriter(outputFilename); writer.write(input.toString()); writer.close(); }
1
cd3816ef836edf5d9150e1f949f734ac
713e9ce5fa0c9a893ac0c387b797ad15
获取酒店订单支付信息
$data = (new Query()) ->select("*") ->from("pay_hotel_order_house") ->where(['order_id' => $order_id]) ->one(Yii::$app->db2); return $data ? $data : null; }
1
2afe68a5e8b15776d0665a265eb326b7
13f80607016ef83a5db4b58297997625
Calculate shipping date
{ if ($this->getDeliveryDays() !== null && !empty($this->getDeliveryDays())) { return date( 'Y-m-d\Th:i:s:u', mktime( date("H"), date("i"), date("s"), date("m"), da...
1
2327e61bc424613ffaa29cf5fe55318b
35b35109857396a1792762a44daa973d
查询参数转json
function getQueryParam(d) { var param = { crowdNameCode : paramJsonObj.name , length : d.length , start : d.start , includeResidentAndTemporary : paramJsonObj.includeResidentAndTemporary , vip : paramJsonObj.vip , startTimeLong : paramJsonO...
0
9a99aaeb1ed1e3e158df94b140f83ab5
5273d9372a9d1aac11fa0b132bce31fa
Send an E-mail with SwiftMailer
{ Session::replaceLookups($textView); Session::replaceLookups($htmlView); $view = [ 'html' => $htmlView, 'text' => $textView ]; return $this->mailer->send( $view, $data, function (Message $m) use ($data) { ...
1
e053c18a9e35b5cefd389c55544bbd81
4384a5226a9622aaed371124637672b3
<summary> Obtiene la lista de festivos ente un rango de fechas
try { const client = await this.getClient(); const [result] = await client.GetHolidaysForDateRangeAsync(opt); return result; } catch (error) { this.getError(error); } }
1
08915ae537e6587071f12bb5bb0c848a
19a4fb92607ffd9a0bb4dce0d9bdc2e0
A contextmanager which deletes a container when the test is complete.
class RemoveContainer(ContainerBase): def __init__(self): super(RemoveContainer, self).__init__()
0
3e6aaf4bd672fd783dcf701055eca1d0
4badd9d2f777b3e32cf5c16f0d60c7a8
update_attributesに状態遷移をmixしたもの photo_filesがある場合は、uploaded_atの日付も自動的に埋め込む
class UpdateView(TestMixin1, generic.UpdateView): # 更新画面 def form_valid(self, form): self.object.__dict__.update(form.cleaned_data) self.object.save() if len(self.request.FILES) != 0 and\ self.request.FILES['form-upload-image'].name: logger.debug("With Image.") ...
0
bb498f4bd5e3970ee427eee634755d7b
e2fc2647e52780bc48185d11b9836e57
Retrieves the total credits available for a specific user.
function wpec_gd_user_credits_available( $user_id = '' ) { global $wpec_gd_user_profile; return $wpec_gd_user_profile->get_available_credit( $user_id ); }
1
b4baa6291b4269435111abf6f477c111
6fe6dfe041fb9e0a8f4c55bb479c9ef2
Returns the meta object for the containment reference list '{@link uk.ac.kcl.inf.mdd.project.githubaction.Job#getSteps <em>Steps</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures .add(MetaModellerPackage.Literals.MSTEP_TYPE__MPARAMETER_TYPES); childrenFeatures .add(MetaModellerPackage.Literals.MSTEP_TYPE__MRESULT_TYPES); } return childrenFeatures; }
0
5fb1895578d81c5bf2e1adf9838f5fba
1bdedab099d10e1ba59c82265c4da6a5
Copy text char by char to the byte-pattern buffer
int i; for(i = 0; i < size; ++i) ((char *)pDst)[i] = data; }
1
b924ec40d57b49582733698c712af476
a2746047422354b00509a2d768f23bd1
Helper for 3D latent viz plots.
voxels = np.asarray(voxels) fig = plt.figure() ax = fig.gca(projection=Axes3D.name) ax.voxels(voxels, edgecolor='k') ax.set_xlabel('X') ax.set_ylabel('Y') ax.set_zlabel('Z') ax.view_init(elev=30, azim=225) if out_file is not None: plt.savefig(out_file) if show: pl...
1
0ab6ef9fe376fb1b9fc7381875871004
7503698f10aba1bc174e0d0f713299e6
批量获取产品图片
@Service public class ProductPictureService extends ServiceImpl<ProductPictureMapper, ProductPicture> public List<ProductPicture> getProductPictureByProductIds(List<String> productIds){ EntityWrapper<ProductPicture> wrapper = new EntityWrapper<>(); wrapper.in("product_id", productIds).where("deleted = {...
1
a477fcada4019789ab3d9cd30a89e4fb
980a979f5aa32bb6315ef58af87a9d9e
二级黄页分类
$good=new GoodsApi(); $second_type=217; $this->typename=$good->getFieldById('goodsType','name','id',$second_type); $this->goodtype=M('goods_type')->where(['id'=>217])->field('id,name')->select(); $this->goodtype2=$good->getGoodsType($second_type); $res=M('goods_type')->where([...
1
c50a59b67c97030b68d479cd73e059f2
dcba1bec3cec6389bbaad027f657d8fa
Async version of cluster_get_state
class AioCluster: async def get_state(self) -> 'ClusterState': return await cluster_get_state_async(await self._client.random_node())
1
20b65beca4741758cabf2e68f252cf93
e21c735d9f3401d45aaac7c7efbc5435
Whether the source has data at the particular pointer
{ return (FState != DataSetState.Inactive) && (FActiveOffset <= FEndOffset) && ((FBuffer[FActiveOffset].RowFlag & RowFlag.Data) != 0); }
1
584daf3aa9a4c2988d83f73632e0524d
fc60c5bd980b7c3b6734b0c1df5a4e64
get courses list under a department and certain term
@Query("select * from courses where term_id = :termId") LiveData<List<CourseEntity>> getAllCoursesForTerm(int termId);
0
1583272cf8904eb5f70ba5e5b367e505
b7826869a3ec7d173b4cfb0b62427cc8
保存或更新用药提醒
int result = 0; using (var tran = _db.Database.BeginTransaction()) { try { foreach (var item in list) { Notice notice = new Notice() { Id = new Guid(), ...
1
8ab2d6d433ed8616d359cbeb568dd82d
b79ea25b25d5a32276b8526ca327ae11
Get the extension to use for debug info for the given binary type
namespace UnrealBuildTool class MacPlatform : UEBuildPlatform public override string GetDebugInfoExtension(UEBuildBinaryType InBinaryType) { switch (InBinaryType) { case UEBuildBinaryType.DynamicLinkLibrary: return BuildConfiguration.bGeneratedSYMFile || BuildConfiguration.bUsePDBFiles ? ".dSYM" : "";...
1
dacf52ba282dbe9208f153a66d9de138
1d24a901010e001ee14cf48cfb2b60cd
INSERT a Consultant record
namespace Tn.JobPortal.Api.Controllers [Route("api/[controller]")] [ApiController] [Authorize] public class UserController : ControllerBase [HttpPost("consultant")] public async Task<int> AddOrUpdateConsultantsAsync(ConsultantsClientModel consultantData) { return await userBu...
1
b204559c0a69743aa0a103eb577c6153
251db72c043d65ba8e23d3504791be1d
在parentDir下生成生成类似 yande.re_-_Pack_049_480001_490000(In_Pool) yande.re_-_Pack_049_480001_490000(Not_In_Pool) Konachan.com_-_Pack_028_270001_280000 的文件夹
let i = 0; let dir = parentDir(path); let folderList = fileSystem.listdir(dir); while (folderList.includes(i == 0 ? path : `${dir}/${getFileName(path, true)}(${i})${getFileExtension(path)}`)) { i++; } if (i != 0) { path = `${dir}/${getFileName(path, true)}(${i})${getFileExtension...
1
4c98d32332a06aa08ffe28b92908db2e
91bbda0d8e9ceb958c7f5095f00a6da4
Move the faller left
if is_faller_in_contact(faller, self, direction) == False: if direction == '<': if is_valid_col_number(faller.col() - 1, self) == True: faller.shift_left() elif direction == '>': if is_valid_col_number(faller.col() + 1, self) == True: ...
1
9ccff668ed3e489a0fa5885f3c074aaa
dd451323c08709d4ed44c8dd6790f209
taken from http://www.codinghorror.com/blog/archives/001018.html #######
def split(iterable, n): groupsize = int(math.floor(len(iterable) / float(n))) remainder = len(iterable) % n sizes = [groupsize+1 for i in range(remainder)] + [groupsize]*(n-remainder) pivot, groups = 0, [] for size in sizes: groups.append(iterable[pivot:pivot+size]) pivot += size ...
1
8599c2f910aec53ec700887bb3a394c6
2ce76236eabb88b9ec3253c03efd7b88
進化素材が設定されているか?
class RPG::Material def item? @type_id == 0 end
0
d4b86c2e1b8593ff86bd3a5df022d87a
2aa4417a99c18cea311dcb06896ddbdc
Sets creator uid.
class Ticket extends \Ilch\Model public function setCreator($creator) { $this->creator = (int)$creator; return $this; }
1
9cd9a0d3f5f71d31a8869ab1e448d40c
adf86b44e8c7d0ac6c623a7eb2366611
主動調整音樂進度
public class OnPlayGUI : MonoBehaviour void Update() { if (m_musicManager.IsPlaying()) { m_kSeekersBack.ProceedTime(m_musicManager.DeltaBeatCountFromStart); m_kSeekersFront.ProceedTime(m_musicManager.DeltaBeatCountFromStart); m_kSeeker.Seek(m_musicManager.DeltaBea...
1
24f1f70cb2767f7ba7fe9096c6909ab9
510bdd5147e9b8a3fa0dde5a5a293b75
Receive a SOL packet and send an ACK in response.
struct ipmi_rs * ipmi_lanplus_recv_sol(struct ipmi_intf * intf) { struct ipmi_rs * rsp = ipmi_lan_poll_recv(intf); if (rsp && rsp->session.authtype != 0) { ack_sol_packet(intf, rsp); check_sol_packet_for_new_data(intf, rsp); } return rsp; }
1
d89e515ed144062250abe121ed858d85
cf41049376c305342efac8f51d00987a
Decrements the data pointer (goes one cell to the left)
def dec_val(): global cells cells[dataptr] = (cells[dataptr] - 1) % 255
0
e730f1a89092fa3d34863981dd15e278
829effd517a13e5a476fdd702f103f1b
Finds the next occurrence of the search string and selects it in the editor.
namespace OpenCOR namespace CoreEditing void CoreEditingPlugin::doFindNext() { if (mEditor) mEditor->findNext(); }
1
3937c8a29564cf915e41f0ee37cb38f9
9d2273f0a3df098bc73e3a985de28e91
Get payment status from Pay U
{ try { $SOAP = $this->SOAP(); $result = $SOAP->getPaymentStatus(array( "context" => $this->getRequestContext($order->getIncrementId()), "invoiceReference" => $reference, "invoiceVersion" => $version ? $version : 0 )...
1
de18e7a70dcedf8cc7b549e1190ff9fe
9e0c131f9e173d6d890d48ad7f0e3f3c
Sets a timezone to a potentially naive datetime
def fix_timezone(x, date_fmt='%Y-%m-%d %H:%M:%S', timezone_str='+0000'): if(x.utcoffset() is None): x = datetime.strptime('%s%s'%(x.strftime(date_fmt), timezone_str), '%s%%z'%(date_fmt)) return x
1
862e5356ddcca77c81fb7fec34854404
3f32daaa8093259f26bfedb0fb581f30
Hide WP Admin Bar for users who are not logged in
function hook_wp_head() { if ( !is_user_logged_in() ){ echo '<style>#wpadminbar{ display:none !important; }</style>'; } }
1
f17e91fb4d8395fc733e8dd5a68da5d0
29281e6a2b6bd1424631d219312e04a1
获取网络请求 adapter
public class UploadUtil private Retrofit getRetrofit() { OkHttpClient.Builder builder = new OkHttpClient.Builder() .connectionPool(new ConnectionPool(100, 10, TimeUnit.MINUTES)) .connectTimeout(6, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS) ...
1
bc00fae5fb7e1527b186c2132272252d
7861e9be266fb29f18fd95f584182cda
增加当天抽奖机会
$dayTotalChance = $this->getRedisKey('day_total_chance', array($this->phone, date("Ymd", TIMESTAMP))); $addRet = $this->redis->incrBy($dayTotalChance, 1); if($addRet > $this->actConfig['day_first_chance'] + $this->actConfig['day_share_chance']) { $this->redis->decrBy($dayTotalChance,...
1
181b811d73f1ae8e826c207acba708ef
f48848d3c0d2029bfd8a71dfef11cb39
Is there a theme available to use with PyQt
def _apply_base_theme(app): if qtpy_version < (5,): app.setStyle('plastique') else: app.setStyle('Fusion') with open(_STYLESHEET) as stylesheet: app.setStyleSheet(stylesheet.read())
1
a294f5f722f3a19a174fffaa886a4b77
eeadc897f53437f0461da4b07d8a61b3
Проверка клетки сетки на препятствие
{ if ((CellsOfNet[pointNet.X, pointNet.Y] == TypeOfCell.Block1) || (CellsOfNet[pointNet.X, pointNet.Y] == TypeOfCell.Block2)) return true; return false; }
1
949a7b84da3b0b233fc085f9ef6a62e1
fbcc24e0cb3d963c5cde1acc2a18e51d
Whether this provider is implemented by a real MongoDB.
class BC_Database_Driver_Mongo extends Database_DriverAbstract public static function isSupport() { $class = class_exists('MongoClient', false) ? 'MongoClient' : 'Mongo'; if (!class_exists($class)) return false; return $class; }
1
a4b4515af03e6f7099ebbb62f9678fd5
461b7f5aa0bf82146645d4d3ad02bb8d
Make a collection of BarcodeItems with info from a collection of Items
class App(wx.App): def CreateDatabaseItems(self, meter_objects): self.db_items = [myDatabase.Item(m.GetProductLabel(), m.GetSerialNumber(), m.GetCalibrationNumberReplicates()) for m in meter_objects]
0
0182f01a793f13ebbe424a5fde116a80
a811bb03b60cd52283a30824fe41807b
Get sample ID based on it's name
def sampleId(self): self.uuid = ('_').join(os.path.basename(self.fastq[0]).split('_')[0:3])
1
13ea3fea0e517cf2853fa96f7d4bbac8
de4b7f0bbac53cec2ecb877e8068e4be
obtain an oriented x2z molecule object from a geometry
_mg = pyx2z.MolecGeom() for sym, xyz in geo: _atm = pyx2z.Atom(sym) _atm[0], _atm[1], _atm[2] = xyz _mg.push_back(_atm) ts_bnds = list(map(list, ts_bnds)) x2m = pyx2z.MolecStruct(_mg, ts_bnds) return x2m
1
91826a519862544b50f7cc4849070411
b8c17ba57b4ebe6cff20ab60d3a3f064
Adds more beats per minute
void Metronome::incrementBpm(uint8_t increment) { auto newValue = change(bpm, increment, SOFT_MIN_BPM, SOFT_MAX_BPM); setBpm(newValue); }
1
a242177cc26c091e224cb238a5e1adfd
530c9946133f9d3d910974c5731aeb7a
将字符的0-9转化成数字的0-9 0 => 48 1 => 49 2 => 50
def char2num(c): cdict = {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9} return cdict[c]
0
6580f6e2d97a778ffb4038901da08aa4
5e74cccfedf8b61d04523fd3ce570170
Accepts an open trade. If the call is successful, the offered and accepted items will be swapped between the two players' inventories.
c.getPacketSender().closeInterface(); final Client other = c.getClient(c.trade_reqId); if (tellOther && c.validClient(c.trade_reqId)) { other.declineTrade(false); c.tradeConfirmed2 = false; other.tradeConfirmed2 = false; other.inTrade = false; c.inTrade = false; } for (final GameItem item : c.o...
0
71e3fefda444a4dadc9e9e6537acf040
fa3abae4647ae96b8a0aef59d70c4ca9
获取指定用户的报名信息
class Enlist extends Model{ static async getEnlistInfo(aid,uid){ const enlistInfo = await Enlist.findOne({ where:{ aid:aid, uid:uid } }) return enlistInfo }
1
1b1ceff3a4a63044c8c7e62c95b423b9
8b4eb2ffe65e6b085e91fce3ff7f52e8
Set work start time in milliseconds.
public void setStartTime(double millis);
1
ed09d88eddb96bfc7c31a18d89b69168
595cf2c49e73422b8ccf3e1bd307925f
@brief : 判断卷膜电流状态是否过流或正常。
{ static uint8_t overcurrent1_count = 0; static uint8_t overcurrent2_count = 0; int32_t temp1,temp2; if(mcurrent1_filt > (max_current + 100)) overcurrent1_count++; else overcurrent1_count = 0; if(overcurrent1_count > 5) { status_flags.overcurrent1 = 1; } if(mc...
1
59a9723390a6b72a236cd312154b328a
0d52243cccec5567061b5bac3f0da915
=========== M_Cmd_SaveIP_f Saves players IP ============
void ipbox_save(HWND &hwndDlg) { char buf[512]; FILE* pFile = fopen(ipbox_file, "w"); int size = ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_GETCOUNT, 0, 0); for (size_t index = 0; index != size ; index++) { ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_GETTEXT, index, (long)buf); fprintf(pFi...
1
051080c7ba52368ec168843ce011e2f9
619b43f8aa17efef32449900468b049a
Value if interpreted as an integer. Converts if necessary.
export default class Value toInt() { if (this.#value === true) { return 1; } return parseInt(this.#value) || 0; }
1
718c15be663fcae0054646addf99d290
0991f69c95963fe4034d7c9ac15993c0
Метод получения списка версий схем для заданной схемы.
List<String> getVersions(String familyName);
1
458f9628300a67ef4bdd966f1e1d74b6
f47d6f9f67c26ae3a0fe4e1d9d5becbd
Méthode qui va nous renvoyer le média actuel
class MediaPlayer(gobject.GObject, object): def get_media(self): return self.media
1
817263b2ab222fc13fa558473d40e6ba
bb00f94442aa0f0b0f1b26f6160a5082
Método que aplica a busca local sobre toda a população
public class Grafo public static void busquedaLocal() { for(Integer k = 0; k < populationHijosElegidos.size(); k++) { Individuo original = new Individuo(); original = populationHijosElegidos.get(k); Integer i2 = 0; Integer j2 = 0; Integer nuevo1 = 0; for(Integer i = 0; i < original.list.size(); i++)...
1
646f7ce53cdbb9d7f923cc8e7066b8ac
7366f3f956ee9d720a9180f89ae16efd
Set the buffer reference to new values. The previously referenced buffer is released before assignment.
class ProtoWriter: def set_buffer(self, buffer): assert not self.__buffer self.__buffer = buffer
0
7447ffb85674f41d85baa9cf7a29534f
008bd2164ceac9364b8c94ab5f2b1017
alarm must be > current time
class Alarm def should_alarm? now = Time.now days.include?(WEEKDAYS[now.wday]) && now.localtime.min == time.localtime.min && now.localtime.hour == time.localtime.hour && enabled end
0
ce03b007316028ec826f370048053552
7902c62ab7bb8ed362e11725f3712bb7
phương thức này trả về tổng số tiền của 1 giỏ hàng nếu sản phẩm là khuyến mãi => tính theo tổng số tiền đã được giảm giá của từng sản phẩm nếu sản phẩm không khuyến mãi => tính tổng số tiền của từng sản phẩm
class DiscountService implements Discountable public function getCartTotal(Collection $products = null): float { $products = $products ?? $this->productCartService->get(); $discounts = $this->getCartDiscount($products); if ($discounts->first()?->type === Discount::GROUP) { $total = $...
1
d14475bf99e192012e521f8f60c3b752
e334457b1925236e7b176c4855555ac5
Returns the SSH Public Keys uploaded to your profile. API Documentation: https://www.linode.com/docs/api/profile/#ssh-keys-list
public class UserApi extends AbstractApi public List<SshKey> getSshKeys() throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "user", "keys"); return (response.readEntity(new GenericType<List<SshKey>>() {})); }
1
ac67728e51fdd1a7b1ade9fe9fd36c19
b7bd842454d02fbee8ad381c3c8b2c2e
Метод, который вызывается, когда окно становится невидимым для пользователя. В данном случае музыка ставится на паузу.
public class ProfileActivity extends AppCompatActivity @Override protected void onPause() { super.onPause(); SetSound.getInstance().pauseMusic(); }
1
ab8893a91aea3a4aa0cd5610783d6c83
04d20bef62e42dd44465f1b5073369e9
Return a dict only if at least one value is not None
def filter_values(data: dict) -> dict: ret = {} for obj in data: if data[obj] is not None: ret[obj] = data[obj] return ret
0
dc8d296cbe1d9b7a997e41c0a9905b0f
7f9a06108a8af0f40f73071205801c9c
Downloads apk from the given url.
final Message msg = new Message(); System.out.println(downloadApkUrl+"..."); fh.download(downloadApkUrl, DOWNLOAD_APK_PATH, false, new AjaxCallBack<java.io.File>() { @Override public void onFailure(Throwable t, int errorNo, String strMsg) { super.onFailure(t, errorNo, strMsg); msg...
1
341098b5817bfc83fef90c9645d34e46
db857d31ce403f5d9058762c1c7305e4
Получить Код для восстановления пароля.
{ return db.Users.FirstOrDefault(u => u.UserName == username && u.IsBlock == false && u.IsDeleted == false).ActivationCode; }
1