query_id
string
corpus_id
string
query
string
code
string
label
int64
e97207b184dee1a8952da7585aad0db9
54b5c6a14ce17a617339e010efa4d640
Normalizes string, converts to lowercase, removes non-alpha chars and converts spaces to hyphens.
def handleize(text) text.to_s.downcase \ .gsub(/[\'\"\(\)\[\]]/, '') \ .gsub(/\W/, ' ') \ .gsub(/\ +/, '-') \ .gsub(/(-+)$/, '').gsub(/^(-+)/, '') end
1
79255efe3dcba72dff80825cf85540ba
a3ba8292cdc49e50516a0041c7ff0e9e
see https://binance-docs.github.io/apidocs/spot/en/#symbol-order-book-ticker fetches the bid and ask price and volume for multiple markets
class Ticker: def __call__(self, markets: str): response = requests.get(server_api('/v1/ticker'), params={'markets': markets}) return response.json()
1
5db293941194171db02e88c5adbf324b
2f4c9a6751187b723eb3cb5a0752412e
This function returns the key code associated with the specified command.
{ int i; for (i = 0; i < NR_LOCK; i++) { if (keycode == locks[i]) { return (NR_CONTROL + i + 1); } } return 0; }
0
71250508f48096d040e42370aef7cdce
1d6e7ff46f54040c2bc65695717abde2
提取json文件里的车辆信息
{ vehicleDatas = new VehicleData[jd["carList"].Count]; for (int i = 0; i < jd["carList"].Count; i++) { vehicleDatas[i].axlesNumber = int.Parse(jd["carList"][i]["axlesNumber"].ToString()); vehicleDatas[i].laneNo = int.Parse(jd["carList"][i]["laneNo"].ToString()); ...
1
62861ec07405ce86a3dbfdb2c4d6c5aa
245c7ece305f16910ec86188bce16ccb
Called when the user clicks the add build button
{ var selectedBuilding = GuiController.GetSelectedBuilding(); if (selectedBuilding == null) { return; } if (mOccupied == Occupied.Empty) { _eventDispatcher.AddEvent(new BuildOrderEvent(this, selectedBuilding)); } }
1
2e6ce4cdcc069d0ba4bd72bf9b19a036
827a9fb29c8677f826e17d26c456991f
Gets the raw, unmodified, text in each tweet from tweets by users whose language is English
tweet_list = [] for index, line in enumerate(self.tweet_lines): if len(line.split("\t")) < self.tweet_idx: continue tweet = Tweet(line, self.tag_list[index], self.filter_by, self.input_type, self.matricies) if tweet.get_emotions(): twee...
0
cb80d9c3d58bfb2b01e4ea0c29c4e92c
a793a441eb896ccbbee0ad89c2ff995e
Retrieve the target of a processing-instruction.
XMLEvent outEvent = null; if (inEvent.isProcessingInstruction()) { return outEvent; } else { return inEvent; } }
0
1349bead3976c4f7ed5cb9bc26166fbc
b2c01b481aeee904b1064c640f9298cf
Gets the user roles allowed to have profiles of this type. The role IDs. If empty, all roles are allowed.
Collection<Profile> getAllowed();
0
7ade7a2ca7bd644c391a9285ca5396a0
019c451767c030b4ca84ecb96ecf0aa9
Authorization 정보를 전달하지 않았을 때 server 인증 테스트
class TestGetServerInfoView(TestCase): def test_not_authenticated(self): client = self.client infoUrl = self.infoUrl response = client.get(infoUrl) self.assertEqual(response.status_code, 400)
1
6b4eb3e651cecebf89b33dfcc1f1f4dc
3998d0740df6dd82f530bf256e6f048a
============================================== DO THE INTEGRATION ==============================================
{ TimeStep* currentStep ; this -> giveTimeIntegrationScheme() ; while (currentStep = timeIntegrationScheme->giveNextStep()) this -> solveYourselfAt(currentStep) ; }
1
daba74536daec6646f9a8d656ddd69cd
5ff29c1914949f3e205ff9d80fc30d55
Get the source transaction identifier (if any).
class MessageNode extends AbstractData public function getDstTransactionId(): ?string { return $this->getString('dst_transaction_id'); }
0
dce3e76666dc07311c0f1d9624b94d74
18f27100fa3587de3aadde3f27266a8d
Determines whether or not this space is adjacent to the given space.
namespace InfiniteCity.Model internal sealed class Space : ISpace public bool IsAdjacentTo(Point point) { return Board.Adjacencies(Location).Contains(point); }
1
ae2e361c2b957fd35b5f27d4b9d00349
6ad2d1b8e77c69e93b543d752e30ce60
\brief Generate a sphere or circle. Generates a sphere or circle of particles in a grid using the parameters specified in the constructor.
{ double x, y, z; double xMin=pos[0] - radius; double xMax=pos[0] + radius; double yMin=pos[1] - radius; double yMax=pos[1] + radius; double zMin=pos[2] - radius; double zMax=pos[2] + radius; double deltaX=xMax - xMin; double deltaY=yMax - yMin; double deltaZ=zMax - zMin; if (data.distr...
1
e7457bd7f11f193eb6f372d79a02182f
c9e8c2abc2326a179ef4ce249138d036
When fireeye-nx-get-reports command returns empty response then corresponding message should be populated.
{ Message msg1; msg1._extra = "Contact: ;;"; inject_msg(msg1.get_response(), _tp); ASSERT_EQ(0, txdata_count()); }
0
de6eea11990a67692784762b39ef6353
19e0a68e8202e0c8fc298c4700a94e21
For compatibility. Does nothing.
void sync::NullMetrics::gauge_relative(const char*, double) { }
1
565632e6a80f4c15e17ef9cd4e182be9
a31239f8ac606553aae84a9e054f039a
Returns the time of creation for the specific cache entry in milliseconds. <p> See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC). entry was created and January 1, 1970 UTC.
public class PrefixMappedItemCache private static class CacheValue<V> public long getCreationTime() { return creationTime; }
1
d410573a792e9530714aa71e1a0eefa9
4384f8d58794a0756c15a8ee45729720
Contrast Measure based on squared Laplacian according to 'Robust Automatic Focus Algorithm for Low Contrast Images Using a New Contrast Measure' by Xu et Al. doi:10.3390/s110908281 window: window size= window X window
{ int windowOffset = windowSize / 2; if (windowOffset * 2 + 1 != windowSize) { throw new ArgumentException("windowSize must be odd"); } CvEx.InitCvMat(ref dest, src); int width = src.Cols; int height = src.Rows; ...
0
79fa25e841cab3e6ac42ccb00e1cdcc6
a3b58fa5fe9afd0ae7ea66a4512c39ca
liest die farben der obenliegenden Flächen
for(int x = 0; x < feld[0].length; x++) if(feld[feld.length - 1][x] == null){ for(int xtmp = x; xtmp < feld[0].length; xtmp++) { if(feld[feld.length - 1][xtmp] != null){ for(int y = 0; y < feld.length; y++){ f...
0
f0a58fb9ca2cc0b4dd948b2114240e1d
176979692cc63293dcd24014939389ba
返回排行榜的第一名
{ return $this -> getRow("select * from {$this->getTableName()} where matchid=? order by score desc limit 1", [$matchid]); }
1
3eb95357acfa30942c7b5d46429f9caf
8e7ccfd7802ed57bdaa8f896aef7bf10
判断是否全是英文
for char in check_str: if self.is_english(char): return True return False
0
ae3dda7750f5e239f9f953eafe057abe
628e63e69164c485882676d5b77f42b8
触发target上的watcher中的addDep方法,参数为dep本身
class Watcher constructor() { Dep.target = this }
0
13e898c459db1dbcd0c007f3a9c90b28
5f4fb78fa1a6927b87d9119437970aa9
Checks whether input is calling a built in function.
static int ish_isBuiltIn(Command_T oCommand) { DynArray_T oTokens; Token_T oToken; oTokens = Command_getTokens(oCommand); oToken = DynArray_get(oTokens, 0); if ((strcmp(Token_getValue(oToken), "setenv") == 0) || (strcmp(Token_getValue(oToken), "unsetenv") == 0) || (strcmp(Token_getValue(o...
1
f2ac520c3b5d797594e62fd7c6669eca
7c6d00d2ef335e9c31cda67a2824fdd2
get records that are currently selected or highlighted.
export default class DataSet extends EventListener getSelectedData() { return DataSet.getRecordsData(this.getRecords(), true); }
1
a875bc37d208783dea5e85896b3b0bdd
f8153c5e3c863ff3ffe21263020b7678
Check if a section is enabled or not based on the $value parameter
{ return $this->scopeConfig->getValue( $configSection . '/' . self::XML_CONFIG_MODULE_ENABLE_PATH, self::STORE_SCOPE ); }
0
aab16ee77fbe8b5f8a16fe550873b9ad
ccc3125ea18e79e8ae73e931b5099ba1
Prepares the start and drain panels
public class Opening : MonoBehaviour void Start () { startPanelPrefab = GameController.buildGameObject("UIPrefabs/StartPanel", new Vector2 (0f,0f), new Vector2 (0f,0f) ); number = GameObject.Find("Number").GetComponent<Text>(); if (!GameController.isTutorial) { batteryPanel = GameController.buildGameObject("UI...
1
d4e05e73a78a98d874f9e828309662cc
2e3c72497085a89ebdd83fc484244e7b
retry on server errors, not on client errors
function handleErrors(response) { if (response.statusText !== "OK") { throw Error(response.statusText); } return response.data; }
0
6bee1f96f27aa3928be1973fa4b76757
0641163e547c0cbd6447fb510588aebd
Visit a parse tree produced by ECMAScriptParser#IdentifierExpression.
namespace Loretta.Parsing.Visitor public abstract class TreeWalkerBase : ITreeVisitor public virtual void VisitIdentifier ( IdentifierExpression node ) { }
1
a2d912224b8164b482077882d36e44e9
d36c010dc6bb6ac9cc8c003f723653f2
Reads data to populate multiple BlastQueryInfo structures. This data is formatted in the config file as BlastQueryInfoN.X[.Y] where N is the chunk number, X is the field of the BlastQueryInfo structure and Y is the field of the BlastContextInfo structure (only applicable if X has the value contextM, where M is the cont...
{ char * inputType = hashMustFindVal(config, "inputType"); if(sameString(inputType, "bioInt")) splitDataFromBioInt(config); else if(sameString(inputType, "flatfiles")) splitDataFromFile(config); else if(sameString(inputType, "five3db")) splitDataFromFive3db(config); }
0
6583cb244851188af96e67b2c45a0a95
277d3765f426c54a712db2c45309e12f
Flatten a multi-level Dictionary into a List of Tuples
def flatten(d, sep=None): def _flatten(e, parent_key): import collections if isinstance(e, collections.MutableMapping): return tuple((parent_key + k2, v2) for k, v in e.items() for k2, v2 in _flatten(v, (k,))) elif isinstance(e, collections.MutableSequence): return tu...
1
dd8ec885d1dbc7b0c180f3fde37180a4
706315c36d3cd4699f6305644e716095
使用迭代的方式+逆序
public class Solution public int[] reversePrint2(ListNode head) { int count = 0; ListNode temp = head; while (temp != null) { temp = temp.next; count++; } int[] nums = new int[count]; while (--count >= 0) { nums[count] = head.val; ...
1
720e42dd77cbb500803b8c9819d7cfd6
74d0077befdcca49c894efc5440a9e7b
Executes a named, parameterless stored procedure.
namespace Idera.SQLsafe.Nuke public static class SqlServerHelper public static int ExecuteNonQueryStoredProc(SqlServerConnectionInfo connectionInfo, string procName, params SqlParameter[] parameters) { ArgumentHelper.AssertNotNull(connectionInfo, "connectionInfo"); using (SqlConnection connection = OpenConn...
0
8f0eb3120f1f7308ed55511678ae404c
cc88bccd0f3abac1a28eb6168a7297fb
获取日期格式化的设置,如:hh:mm:ss
public class DateUtils public static String getDatePattern() { return date_time_pattern; }
0
0e7958967b6627ac9678445878aa298c
c9280b1a5814cfdfce9b80b75b02760b
產生考核對象考評分數單頭
PdfPCell baseCell = new PdfPCell(); baseCell.setHorizontalAlignment(Element.ALIGN_CENTER); baseCell.setVerticalAlignment(Element.ALIGN_MIDDLE); baseCell.setBorderWidth(1); baseCell.setBorderColor(BaseColor.BLACK); baseCell.setMinimumHeight(30f); String[] types = {...
1
056c4f265beb4bf10bb0720c67e41659
c384d963e43626f8996cfd4f2d604f69
GetIPv6Properties(self: IPInterfaceProperties) -> IPv6InterfaceProperties Provides Internet Protocol version 6 (IPv6) configuration data for this network interface. Returns: An System.Net.NetworkInformation.IPv6InterfaceProperties object that contains IPv6 configuration data.
class IPInterfaceProperties(object): def GetIPv4Properties(self): pass
0
abeb595c25e2649ab1ddcf0512e0a0d6
0929e5616bd802db97a81bc6619761bc
格式化sql并把单引号替换成双单引号,防sql注入
public final class TableOp public static String formatSql(String str) { return str.replace("'", "''"); }
1
9748d09d5a1941bf160c43a478ccdb21
b26fde214d03984d7ce88c37477d3311
The calendar-month-day-box binding might not be ready yet, because it's XBL and XBL is hopeless. Wait for it if necessary.
if (!this._calendarPortal) { this._calendarPortal = new ComponentPortal(MdDatetimepickerContent, this._viewContainerRef); } if (!this._popupRef) { this._createPopup(); } if (!this._popupRef.hasAttached()) { let componentRef: ComponentRef<MdDatetimepickerContent<D>> = this._po...
0
7651ae846e1fe50cd2eb29e01608a778
f17d25cf64f334262540f90eaad003fa
=> array of <tr>'s
class LarriveeScraper def table_rows(data) data.css('.tborder tr')[1..-2] end
1
91397de80ebf13f8bd1c3b76c95cc577
83cb3615013084f4d297bc7f570deef6
选择DEM接边检查输出路径
namespace SimpleCodeGen public partial class Main : Form private void btnOutputPath_Click(object sender, EventArgs e) { dlgOutputPath.SelectedPath = txtOutputPath.Text; if (dlgOutputPath.ShowDialog() == DialogResult.OK) { txtOutputPath.Text = dlgOutputPath...
1
eb29f1a07a602f8184cc65bf7bd65746
0b8b3fc4e5eae8773c17bb44c5da6555
タイムゾーンが日本であるかどうかの判定
$t=self::$time_stamp; $t=($t + self::$time_offset * self::$define_list['HOUR']) % self::$define_list['DAY']; if($t>=19*self::$define_list['HOUR'] || $t<5*self::$define_list['HOUR'])return true; return false; }
0
9cdd02205bdbb385ffc65a0030c2253f
227ed9d1d1738fe69ec9629d311d5edf
Same as getClassName but appends the propertyName.
public final class PropertyAccessor<_PropertyType> private String getFullGetterName() { return model.getClass().getName() + "#" + getGetter().getName(); }
0
7c2e368bc28e97657ea33c3b519de9a6
43f981c5cd72e437a52bbf0255d36022
Load master info from config/master.json.
def get_master(path: str) -> str: with open(os.path.join(path, WIT_METADATA_FILE), 'r') as file: return file.readlines()[1].partition('=')[2].strip()
0
f498ba326f3b3fd0358e13e6107eddc2
c9500deffee69235a23a31c71dbc112f
! Очищає стрічку -- робить її порожньою. Складність має бути О(1).
Stroka::~Stroka() { delete[] buffer; buffer = NULL; length = 0; }
0
ade27c9750640beb0063674489420821
621088b645a9092a11a33a01c85c2527
Reads an unsigned 64-bit value from a little-endian buffer
debug_assert!(len < 8); let mut i = 0; let mut out = 0; if i + 3 < len { out = load_int_le!(buf, start + i, u32) as u64; i += 4; } if i + 1 < len { out |= (load_int_le!(buf, start + i, u16) as u64) << (i * 8); i += 2 } if i < len { out |= (*buf.ge...
1
aa6479213830cbdc7ef269321f985210
cbc1ab81abcc811f4f749fcd7cd2986a
Returns all the subsets of this set of nodes. This is a generator.
class TreeNode(object): def subsets(self): sets = [] for i in self.traverse(self_before=False, self_after=True, \ include_self=False): if not i.Children: i.__leaf_set = frozenset([i.Name]) else: leaf_set = reduce(or_, [c.__leaf_set for ...
0
61268c42ebede81992d339a4eb9955d7
bc3a6d9f84e5acf9018b0f6494460436
获取 日志类型(1.系统级日志,2.业务级日志), 类型long 默认值:0
@Entity @Table(name = "sys_log") public class SysLog implements java.io.Serializable public SysLog setType(Integer type) { this.type = type; return this; }
0
6c2e4b0af9c06082c22c4de509e035e9
c9e17f1400d3fa723c268580899f21ca
构造静态文件
class Request public function parseStatic() { $file = $this->path . '.' . $this->type; $path = strtr(ASSET_ROOT . '/' . $file, ['//' => '/']); if (file_exists($path)) { $content = file_get_contents($path); return app('res')->dispatch($content); } throw...
0
38cd056d609a47b567a579cb7c535d8f
9b7e71649dab196aebaebde02f83eb6f
default to visible
public class UploadTab extends FWTab @Override public boolean isVisibleByDefault() { return false; }
0
7956db5b761e89a57898ec93974213a8
1b94cef7a5b28e3621b83251237a5293
Generate unique ID string of 16 digits hexadecimal.
public class Misc public static String generateUniqueId() { BigInteger min = BigInteger.valueOf(10).pow(15); BigInteger max = BigInteger.valueOf(10).pow(16).subtract(BigInteger.valueOf(1)); return String.valueOf(util.Numbers.randomRange(min, max)); }
0
ee3432294db208dcdf699f4a91ca1c18
57d0fac9b2c2f048aacce85c03457a16
Fetch the Sprite show flag status
public isVisible(): boolean { return this.sprite.visible; }
1
550430719ac4c3c163bf2ededa48c5df
4e997396ed31e0f4de0659dfe9275390
Get absolute frequencies
{ $this->freqs_by_num = array_count_values($this->set); foreach($this->freqs_by_num as $value => $count){ if(!isset($this->freqs[$count])){ $this->freqs[$count] = array(); } $this->freqs[$count][] = $value; } ksort($this->freqs)...
1
8f54302ee44a11611f5ed8a29b2095af
a50cfc749c6ac1e0f6051829a172cd65
Destroys the given resource at the filepath
import os from find_resource import find_resource path = find_resource(uri) os.remove(path)
1
2ffc24bede7cebeb3a381af1d73fd26d
5f0189f072f2b072b0775165af6e463b
update the account using the customer ID and the amount deposit.
{ $customer = Customer::find($model->customer_id); $account = $customer->account; $account->deposit = $account->deposit + $model->amt; $account->save(); }
1
d7ee38c9c16967ae0f708a6a461912a9
6f750eb0b4fa2efa29532751bc90f036
Tests writing to the memory and reading the same data back.
class TestCPUState(unittest.TestCase): def testReadMemShort(self): self.cpu_state.WriteMem(0x3800, "\x41\x42") self.assertEqual(self.cpu_state.ReadMem(0x3800, 2), 0x4241)
1
1e9633497c9df865553810432d8c6af5
31bae5c470db18467406cb7e260bd571
Whether the receivers lock on a particular session has expired.
namespace Azure.Messaging.ServiceBus.Core internal abstract class TransportReceiver public abstract Task RenewSessionLockAsync(CancellationToken cancellationToken);
0
9e13cb48b870788ca41c24cb46567b56
e246cd39fa5efb5ad6618fdf392695fe
Compute raw data size from column statistics
class CatalogTableStatistics(object): def get_raw_data_size(self) -> int: return self._j_catalog_table_statistics.getRawDataSize()
0
de196e8f71a4d3e0a73d274c65555bd7
6277934463bbd471a1ed9f5bd43002f9
Clear the group input
filters = {}; filterInputs._groups[0].forEach(entry => { if (entry.value != 0) { d3.select('#' + entry.id).node().value = ""; } }); }
1
bb5cd8d7f2f55d4ee78ddad5443d38a3
c1ffbb5823b476a06c958b353ad93510
Convert short [-32768;32767] to float range [-1.0f;1.0f].
function floatTo16(input: Float32Array): Int16Array { const scale = 0x8000; const output = new Int16Array(input.length); for (let i = 0; i < input.length; i++) { let value = Math.floor(scale * input[i] + random.range()) | 0; if (value > 0x7fff) { value = 0x7fff; } else if (value < -0x8000) { ...
0
905ef9e5e80a5dd93c7107cfc2310306
6385119b8742198f9eebde2ea9d358f8
Test case for sms_templates_get Get lists of all sms templates # noqa: E501
class Guardian(object): def get_templates(self): return self.client.get(self._url('factors/sms/templates'))
1
37c5c85aee4db731e36a561c6454acb3
ae3b1356d401e5f1767c1cadec6827c5
Looks to see if there are database associated credentils that should be associated with the content being uploaded
public boolean hasAssociatedData();
0
d5db5fac25e698861fb8c2a25fdc4c22
26a0863d78c82f97f64a0470b9cd7d75
Converts dict p_filters into its string representation
filter_template = ''' {{ "op": "in", "content": {{ "field": "{0}", "value": [ "{1}" ] }} }} ''' prefix = ''' { "op": "and", "content": [ ''' suffix = ''' ] } ''' filter_list = [] ...
1
76a090c9d9b63edf1cbf357122b91598
55bdfab4022c79eb29bd2d988c834a84
Edits a rp_rider_user
public ResponseEntity<Message> updateRider(RiderDto riderDto) { LogUtil.info(logger, "RiderService:updateRider, riderDto = " + riderDto.toString()); Customer customer = customerRepository.findOne(riderDto.getId()); if (!customer.getSysUsers().get(0).getUsername().equals(riderDto.getUsername(...
1
0415201d8f5f7f87bb833070bc5afa09
0406e9795ce7286a759540a320f30d1f
Returns the magnitude or distance between two points. Will always be positive.
double aSquared = Math.pow(this.x - that.x, 2); double bSquared = Math.pow(this.y - that.y, 2); double cSquared = aSquared + bSquared; return Math.sqrt(cSquared); }
1
c3e7460c7a27b7a01f5fda13af377aa5
efbef93a2f0142a9c4d328af7b07b94f
Performers a HTTP request that returns XML and deserializes that XML result into object.
namespace Site.Common.Web public class ApiWebRequestHelper public static T GetXmlRequest<T>(string requestUrl, NameValueCollection headerValues = null) { try { WebRequest apiRequest = WebRequest.Create(requestUrl); if (headerValues?.Count > 0) ...
1
9435acdf78c8d7d89daead5e8d2ea7eb
0ba681fed3ea09f93310ade0efa36ea7
handles getTopics requests from client
public class Server implements IServer @Override public ArrayList<String> fetchTopics() throws RemoteException { return dataManager.fetchTopics(); }
1
fd58dc647995b76fab95268447c95c8a
1dd557f5424e591629762c3888f5e0dd
Determines if the "data-param-enableRightClick" article attribute is set to true
@TagName(ArticleElement.TAG) public final class ArticleElement extends Element public boolean getDataParamEnableRightClick() { return (!"false".equals(this .getAttribute("data-param-enableRightClick"))); }
1
f68840128d988a070c3c68562fa698c0
6480e4c3b884bed6f810fa5bb5f4f6f5
term order for univariate polynomials. One thing special to univariate case is that powers are not tuples but integers.
class PolyElement(DomainElement, DefaultPrinting, CantSympify, dict): def iterterms(self): return iter(self.items())
0
5df0b0edd8f8bd9324ff47ee95a5d0cf
7b7a9b489bdbdb2c05877a1c313ca46c
Lectura de bit en memoria interna bool con el estado del bit presente en la dirección de memoria EEPROM interna, en la posición indicada
{ int offset=block/8; int shift=block%8; int result; int i; if(!secboot_en_memoria) { result=vdreadseclog(0, (char *) &secboot); secboot_en_memoria=1; } mapa_bits_bloques= secboot.sec_inicpart+secboot.sec_res+secboot.sec_mapa_bits_area_nodos_i; if(!blocksmap_en_memoria) { for(i=0;i<secboot.sec_mapa_bi...
1
d278823ab6c7d092cbe2022c67761168
79962a1fc490226fc4b761f7603177b0
現在のアイテム群を用いて文字列を置換する。
{ var sb = new StringBuilder(); foreach (var item in Items) { var literalItem = item as LiteralText; if (literalItem != null) sb.Append(literalItem); } return sb.ToString(); }
0
baf2caf5836e6e900987c5d86ee78532
1f669096a74bb1bd7825438ea913c1e8
https://leetcode-cn.com/problems/maximum-difference-between-node-and-ancestor/
class Solution(object): # Time: O(n) # Space: O(h) # recursive solution def maxAncestorDiff(self, root): def dfs(node, minn, maxx): if not node: return 0 minn = min(minn, node.val) maxx = max(maxx, node.val) if not node.left and not node.right: ...
1
ed0830db4f3d7dd0e1932f889b3ed759
8fb7fb3fd2fb9365d21233f924255c45
Set the z4 aca12 code.
class MTZcell: def set_a(self, value): self.cell_a = value
0
40866341c4f0229a14d0ac80f505d7e7
25f952581198be07de8810c253788935
Returns the map of actions composing the sequence
public class Game implements GamePhaseHandler public List<Action> getActions() { return this.actionMap.values().stream().collect(Collectors.toUnmodifiableList()); }
0
c6a9c730cccf0ac1b90874fe0770798c
d92e2969b4782475a22b94af52ed48ae
Injects the Sessions async service proxy.
{ var configuration = configurationProvider.Configure().GetEnumerator().Current; configuration.SetProperty(Environment.CurrentSessionContextClass, typeof(WebSessionContext).AssemblyQualifiedName); var sessionFactoryProvider = new SessionFactoryProvider(configurationProvider);...
0
d0023e4cf39e1d587241cda5aae12f33
09255c36c94e38be3169c70de8ede6a5
点亮建筑,做管理标记
local kind = info.m_kind; local offset = info.m_offset local landname = ""; local unitObj = nil; if kind >= BUILDING_Silver and kind <= BUILDING_Iron then if City.m_Buildings_res[kind] ~= nil then unitObj = City.m_Buildings_res[kind][offset]; end else unitObj = City.m_Buildings[kind]; end if unitObj ==...
1
915c6d11c64ae60457b44c704a1d51ae
4acedc51acb089705b38cf47e7bbb116
有向图G采用邻接表存储结构 若G无回路,则输出G的顶点的一个拓扑序列并返回OK,否则返回ERROR
EdgeNode *e; int i,k,gettop; int top=0; int count=0; int *stack; stack=(int *)malloc(GL->numVertexes * sizeof( int )); for(i=0; i<GL->numVertexes; i++) if(GL->adjlist[i].in ==0) stack[++top]=i; while(top!=0) { gettop=stack[top--]; printf("%d ->",GL->adjlist[gettop].data); count++; for(e=GL->ad...
1
53142fda8192c02ac01ff031b016a193
39b7ab3d6014e71bac3a4780f9f24cd6
Extracts File_name from a complete_file_path
def parse_file_name(full_path): if '/' in full_path: return full_path.split('/')[-1] else: return full_path
1
7a9890690f8239b3ab25f7fb8d18ca6c
3ae650429e4e1a164874ea160801ffb4
Sets this block analyzed.
self._check_access_permission() if is_validate: self._validated_blocks += 1 self._total_blocks += 1 self._set_dirty(True)
1
3fc807242d55863c5038b254ac5eb47d
b41dd03db6e1826ee83a25387683369f
Check if customer logged in, product id is set and this product is not yet viewed, update view number
class Client implements EventClientInterface public function saveCustomerViewProduct($customerId, $productId) { return $this->_setCustomerToItemAction('view', $customerId, $productId); }
0
a35d4eba03368bd6c3b78ee92f58e518
65a857cbaeec2934768b5174853fb852
Finds the closest ancestor anchor element (including the target itself).
if (nodeEl) { var p = getParent(target, nodeEl); while (p) { nodeEl = p.target; p = getParent(target, nodeEl); } return getNode(target, nodeEl); } else { var root = getRoots(target); return root.length ? root[0] : null; } }
0
6e27e931d52244d096c4b15d4a92ca34
da559685469c6cf470ea4014667d43a5
This method saves the SiteLabel into the database, performing add/update auto detect and without performing a cascade operation.
java.lang.String save(RoleSiteEntity roleSite);
0
e6806634855dce198a53f6d9b98f791b
0cc4dec1c24c9439d6e4832173b11d36
List the available items and allows the user to pick one to load
namespace _3P5_Project_1937291_1923906 public partial class MainWindow : Window private void LoadItems_Click(object sender, RoutedEventArgs e) { if (CanLoad()) Load(); }
0
9ab7591f559f69c4ddf3f43769c3ba7f
43b38f6233f72b8d2d31b345fd5083e5
calculate forces from thrusts and accelerations
HeliMMClass::ForceCalc( void ) { mlTrig trig; grav.x = -mass * GRAVITY * eusin.y; grav.y = mass * GRAVITY * eusin.x * eucos.y; grav.z = mass * GRAVITY * eucos.x * eucos.y; F.x = grav.x + mr6d.x + wn6d.x + fus6d.x; F.y = grav.y + mr6d.y + fus6d.y + tr6d.y + vt6d.y; F.z = grav.z + mr6d.z + ...
1
92a12806656d780b0d440c732cb8f8d9
b787a7caff85fef3daa83f93f1a0eefa
This function fills the list box with the file directory for the specified topic.
def getdir(filepath=os.getcwd()): cf = os.listdir(filepath) for i in cf: listbox_filename.insert(END, i)
1
de90f447a1df8bf5140ccb22694e5d9a
2e3a3ebf6101527406adc68ac6521d49
Changes the sensor state.
class SensorData(object): def toggle_sensor_state(self): self.sensor_state = int(not self.sensor_state)
1
996ac3ff8d33b4eb36b156a18b5f68b1
1ae6d855b37923bf96b0a3f1883147f4
Adds item to the top of the stack. Increases array size as required.
namespace CubeX namespace Core [Serializable] public class StackArray<TItem> : ListArray<TItem> public void Push(TItem item) { Add(item); }
1
fba13ba23772e05e67cf5a9495077e71
7e67694626db631d9ddd2fc412ce5a15
Handles the Click event of the menuItemSmallIcons control.
namespace Photo_Editor public partial class Form1 : Form private void SmallToolStripMenuItem_Click(object sender, EventArgs e) { listView1.View = View.SmallIcon; detailsToolStripMenuItem.Checked = false; smallToolStripMenuItem.Checked = true; largeToolStripMen...
1
a005ad7a3beaed6f2f2c29af0e3e1936
e265caf6e617f42ddf31f60f5f4c37c5
Set the default period when the period is not set
const { duration, startDate } = transition.queryParams; if (!duration || !startDate) { this.transitionTo({ queryParams: { duration: durationDefault, startDate: startDateDefault, endDate: endDateDefault }}); } }
1
b110c39a73f8e2803d2173e4afbead3f
58449f186ef2d12f8057031abc1d2432
使用swfdump对flash文件进行分析,并提取真实的文件名
public void onCreate(Bundle savedInstanceState) { DumpInfoFlag = true; super.onCreate(savedInstanceState); StarActivity._Call("DoAssetsFile", "python", "code10.py"); }
0
402b8ad1740ad59bf43c177762f978d7
27c750a488631b8add77ba259a218c9e
Auditory sensory handler
class AudibleSkill(MycroftSkill): def __init__(self): super(AudibleSkill, self).__init__(name="Audible")
0
205a8b64abbe7acdc714b9e5b4b402fc
089b6f79c94ee306208a254f5804238d
returns false if a turn cannot be taken, true otherwise and increments the number of turns taken
public class Tile public boolean progressTurn() { return true; }
0
58d245e8bad82de3e1469889cf265d57
a6120accbf3217f6208bb10a9ae46020
是否是数字(负数、小数)
if (null == str || "" == str) { return false } val pattern = Pattern.compile("^[-\\+]?[\\d]*$") return pattern.matcher(str).matches() }
0
6a0fd744e84010cfb9eb3a345c19ac6e
1e32f83399170a9fa2a8efc5c8844915
Allows for clicks to be registered within the current state.
{ ChangePredicate<MouseState> rule = MakeTriggerRule( obj, HoverState.On, button, state ); return AddListener( rule, button, GetButtonName( button, obj ), helpText, handler ); }
0
e3b498e68e11ec87e5552149ce47de81
3de20f72fb25a56aec2bcbe165972c56
动态创建Lov
public class LovServiceImpl implements ILovService @SuppressWarnings("rawtypes") public List<Lov> selectlovByParam(Map paramMap){ return iLovMapper.selectlovByParam(paramMap); }
0
708e53259d51c272fb9b03b4878b22f5
b4361e438a15094e0cf025b86d2c75ba
GOOGLE CUSTOM SEARCH APIからキーワードで画像のURLを取得する
{ val url = "https://search.yahoo.co.jp/image/search?n=60&p=${keyword}&search.x=1" Log.d(TAG, url) HttpClient.getDocument(url) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( { result -> ...
0
30a0782f3c4ce4976b09258a550ede60
4b7a6c6778d9417d08085d29749f1bfc
Handles a GET /users/<user_id>/images/<image_name> request by returning the user's image with the given name.
class ImageResource(Resource): def get(self): image_path = request.args.get('image_path') if image_path is None: return get_message_json('No file path'), HTTPStatus.BAD_REQUEST if allowed_file(image_path) and os.path.exists(image_path): extension = os.path.splitext(image_...
0
022e517bb5fe129c8a2a05d2dbf8d26b
4678f7b6f9ed7e1bc71849c8e4183777
Returns a vector, casted to integer values.
impl Integer pub fn to_vec(self) -> Vec<u8> { self.into() }
0
87240413186bf2f30480cfba91e423aa
e0b0841608332a3b776fcb53aede01d5
Convert all index columns to lower case.
class DB2SchemaManager extends AbstractSchemaManager protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) { foreach ($tableIndexes as &$tableIndexRow) { $tableIndexRow = array_change_key_case($tableIndexRow, CASE_LOWER); $tableIndexRow['primary...
1
b40f3b1f3b96e463b1351f8bc3443ca9
c9b1d75f91416cfd85fef3a0eb3f154b
Get the binding MySQL charset name for this collation.
String charset();
0
8113fc4f74301d2af0921b3726113b78
ba09e99759357ed448baa7917e4021ba
用户退押金信息审核
$token = get_token(); $info=db('session')->where('token',$token)->field('user_id')->find(); $status=db('user_info')->where('user_id',$info['user_id'])->field('is_delete')->find(); if($status['is_delete']=="yes"){ $this->render('50000', '账号已被封停', array( "error"...
0
07d69de3f4a5fbb5ccf9de6b968bc505
f632e14000fec16d4d64c004b96be8d6
将当前用户的游戏数据托管在微信后台
const self = this; self.collectionWhere({ collectionName: 'userGameInfo', whereCondi: { _openid: self.openid }, success: res => { self.showWxLoading(false); if (res.data.length == 0) { let...
1
e4443648e93025e6ae6d13b3c620b0be
7d6c80cad42fb501c952211de5b10794
Method that directs the users to an activity where they can see all the spots with information and status.
val newFragment = AllPlaces() val transaction = supportFragmentManager.beginTransaction() transaction.replace(R.id.nav_host_fragment, newFragment) transaction.addToBackStack(null) transaction.commit() }
1