query_id
string
corpus_id
string
query
string
code
string
label
int64
63e076321bbfc61e6874e1f62aa74a25
f1789fa70ab917161332c8cb82d7f459
Live 3D rotation and 2D projection for a given 3D point
pts2d = C.dot(Rt.dot(pts3d)) pts2d = pts2d / pts2d[2,:] return pts2d[0:2,:]
1
101aac498fabb42bdb96f89aa4b368a0
4fb0daf6105b5b5835b43ce8cf98ca1a
infix 토큰배열을 postfix로 바꿔준다.
{ List<String> queue = new ArrayList<String>(); List<Character> stack = new ArrayList<Character>(); if(infix.charAt(0) == '-' || infix.charAt(0) == '.') { infix.insert(0, '0'); } char[] charArr = infix.substring(0, infix.length()).trim().toCharArr...
1
cc7ddafcd49492ef8fdeaa3c4cd52614
7d12dfc41d4fa85dad42f951bbb8d79f
Set the code prime paniers.
class Forfaits public function setCodePrime($codePrime) { $this->codePrime = $codePrime; return $this; }
1
c6385879da6191b1c83fc36508780c02
3d58bc8036c5e3487c0ae3922897a3b5
make the current object invisible and go to the previous stage
{ if (mSceneObject) { mSceneObject->RemoveFromParent(); mIsVisible = false; mIsLoaded = false; Show(mParentSceneObject, mBackSceneObject); } }
1
f9797251086b92888fa37c64fde9ef29
9dda56f96cfead356cdfd7100a56b2ec
NOTE: We use a fixed salt and force sha1 for the admin token. This fixed salt matches the authentication policy used above.
def admin_role_client( client: TestClient, db_session: orm.Session, user_with_admin_role: usermodels.User ): resp = client.post( url="api/v1/auth/login", headers={"content-type": "application/x-www-form-urlencoded"}, data={ "username": user_with_admin_role.email, ...
0
c189fc8504c510caf5cee6dd17b8fe9a
67e01471ac624535fd96b17145ae19d2
Gets the last IR frame time, as returned by the sensor.
class SI1145(object): def readIR(self): return self._device.readU16LE(0x24)
0
7fecb6a9a1ffa68446d34e2c582fcf51
d459a2d071c0a63ae59a379ff13bcf93
已经登录时不能登录
function _login_state(){ if (isset($_COOKIE['username'])){ _alert_back('登录状态无法进行此操作!'); } }
1
f9d354abfa467555318653449d7b713f
c008bde031321f3130dc7290f252169e
清空实体的 IsDeleted 状态,使其还原到删除之前的状态。
{ model.IsDeleted = true; model.DeleterUserId = AbpSession.UserId; model.DeletionTime = Clock.Now; }
0
ff4e3caf456ae45d7508502e836264e4
8a955726721a9a5e59c5b740e597c654
Transfers all row types present in the source feature list to the target feature list.
void transferAllPredicates(OptimizablePredicateList otherList) throws StandardException;
0
224a79fdc3b39068ca6e1ce9b5fe71cf
e093448ce58b904429aeea167d13d2e9
获取 默认的 psr-16 标准 simple-cache 适配器
{ if (class_exists('Symfony\Component\Cache\Psr16Cache')) { return new Psr16Cache(new ArrayAdapter(0, false)); } return new ArrayCache(0, false); }
1
0c6cc5ff926f8f9f38ad7bdc00acddbf
184274ea57e5c0e0d07da88ca0af64db
社員IDが重複しているかチェックするメソッド
public int isIdDupCheck(String id);
1
3a67f215c979a8e6b2f5c073df68e381
f65ce00d8fee075387ce41f2f3a8f874
Checkbox die das verändern des Spielernamens und Zeichens von Spieler2 erlauben
if(document.getElementById("is-computer1").checked){ document.getElementById("spelare1").disabled = true; document.getElementById("spelare1").value = "Dator"; document.getElementById("is-computer2").disabled = true; }else{ document.getElementById("spelare1").disabled = false; document.getElementById("spelar...
0
4fad8a91761647e682c27e60d0b6fd19
1e705b34b36d300a214882535c7142db
disables plus1 and minus1 button
btnAdd.setDisable(true); btnAdd.setStyle("-fx-opacity: 0.5;"); btnSub.setDisable(true); btnSub.setStyle("-fx-opacity: 0.5;"); btnDiv.setDisable(true); btnDiv.setStyle("-fx-opacity: 0.5;"); btnMulti.setDisable(true); btnMulti.setStyle("-fx-opacity: 0.5;"); ...
0
cb123efb0e64d6322fe3d0c97f40d0c6
d8486360f4e798e3ddcfc4c9bd451eb6
Sets linkedSpaceId.
public class TarantoolIndexMetadata void setSpaceId(int spaceId) { this.spaceId = spaceId; }
0
3d772446ae30a60e2345dffccd6a2087
86a47e07cc3fa5d4e66b6da7ab0c11ae
Code to generate point samples from the image dataset.
scale: Numeric) -> ee.Feature: arrays_samples = patches_array.sample( region=point.geometry(), scale=scale, projection='EPSG:3857', factor=None, numPixels=None, dropNulls=False, tileScale=12) return arrays_samples.first().copyProperties(po...
1
2d4cf184632a781d7215b02bca7270c8
0249738644d24c71c416949863f85631
将服务器时间转换到本地时区
public final class ApplicationHelper public static String convertServerTimeToLocalTime(String serverTime) throws Exception { String utcTime = convertServerToUTC(serverTime); String localTime = convertUTCtoLocalTime(utcTime); return localTime; }
1
dd71fec36eef0f614ab9b8d171ea85cf
27d3b488fa7967a1614de71bc882ca37
将一个成员移出黑名单
export class FriendPart extends PlayerBasePart public onRemoveBlackList(playerID:number):void { this._d.blackList.remove(playerID); this.me.dispatch(GameEventType.RemoveFriendBlackList); }
1
5c2a04f05a135ad07b7baa87d7cafc93
b3c82615789a39bf308d05a28a882ee8
Uninstalls and then imports packages again.
installer = getToolByName(self.portal, 'portal_quickinstaller') installer.uninstallProducts(['qi.portlet.TagClouds']) self.failIf(installer.isProductInstalled('qi.portlet.TagClouds')) from hexagonit.portletstyle.upgrades import reimport_package reimport_package(self.portal) ...
1
93446fe6dda7ea596cd379e27145e5dc
26d2deebcaae0be319744d6b9e929efb
Method to convert a gas water heater's volume input power based on a linear regression performed on the web scraped data.
let k1 = 0.190263; let k2 = 8.417286E-5; let p = Math.pow((Math.pow(As, k1) - (k2 * h)), (1 / k1)); return (p); }
0
e097485514456abf0fb6c6fcc4745ae4
3315fe419d719ea13e28f66c8ed34949
Summary Get data stream for temporary file created with CreateTempFile.
namespace ICSharpCode.SharpZipLib.Zip Stream GetTemporaryOutput();
1
4ece8986f04a0229139b6c4e5db5a89f
0836e2aa7c257ce93d64454cf8968cef
Function to print all sub strings
if(index == str.length()){ cout<<curr<<" "; return; } printSubs(str, curr, index + 1); printSubs(str, curr + str[index] , index + 1); }
0
8aac175584ea4fd870ac1fd5f5ced60d
f7b93a552b04d7285db5cf3f8e78d8d2
渐变隐藏动画
class Animation private middleReduceHide(callBack: Function = function () { }, thisObject?: any) { egret.Tween.get(this.object).to({ alpha: 0, scaleX: 0, scaleY: 0 }, 300).call(callBack, thisObject); }
1
6ccc9c23560d832a838d63edc51c1dfb
65371ff3a84c7fba3d9adcab80d3c2c9
Изменяет флаг заявки на ОПЛАЧЕНО
class MembraneOrder extends Object public function toPayed() { if($this->AR->status !== self::STATUS_DEFAULT) throw new BadRequestHttpException; $this->AR->pay_date = new Expression('now()'); $this->AR->status = self::STATUS_PAYED; $this->AR->update(); }
1
9e00afab97fe9911900808b537e732da
5e1ae07530f6c4593fdf1bd21fbb0bed
获取文件在ftp上面的路径
@Service public class FtpShareLocalFile public String getPathname(String filename){ ftpShareLocalEntity = ftpShareLocalDao.findUnique(); String pathname = ftpShareLocalEntity.getShareBasePath() + "\\"+filename+".xls"; return pathname; }
0
56aebbd95cb95402a8dd0f5072ba6382
56379d7afd8b42de13463988c3840d4d
返回当前节点到根的句法依存树的路径
List<MapField> path = new List<MapField>(); while ( true ) { path.Add(node.This); if ( node.Parent == null ) { break; } node = node.Parent; } path.Reverse(); return path; }
1
9b889447d81bd95ff8d2eb84e52076ab
c31515a3a2ee6832cd8e029eda1e0434
first person to go is olways X, so if turn count is even, then it is X turn, if turn count is odd, O turn
class TicTacToe def current_player turn_count.even? ? "X" : "O" end
1
6cf921ded7e8f6bea3f795108aeb1f4a
292f3708049a20e0653ea41768239230
发送Http Post请求(带超时) 如果millisecond为空,则不设置超时
public class HttpClient public static RespDto sendPost(String host, String api, Object entity, int timeoutMillisecond){ String urlStr = "http://" + host + api; String entityJsonStr = JSON.toJSONString(entity); logger.info("send post url:" + urlStr + ",entityJsonStr:" + entityJsonStr); tr...
0
f627dbc073d4ba3def5ef92d46f48d97
8b3216bfffed7bf73fcfa8ba54ddcccf
Go through on the file with the list of queries for one category and add each query to the right subcategory Input: - cat : Category object - file : name of the file containing the queries
result = [] directory = {} for f in files: path = f.split("/") file_name = path[-1] if file_name not in directory: directory[file_name] = [] directory[file_name].append(f) for q in queries: if q in directory: result.extend(directory[q]) ...
0
7c301b7598b8d8631296a2484a8819b7
99417b627617804a26c3372548e8b91e
@brief OmxRpc function to unmarshall params of OmxRpc GetComponentVersion msg response
static Void omxrpc_msg_unmarshall_component_tunnel_request_response (OmxRpc_msgComponentTunnelRequestResponse *tunnelRequestResponseMsg, OMX_OUT OmxCore_OMX_TUNNELSETUPTYPE *pTunnelSetup) { if (pTunnelSetup != NULL) { pTunnelSetup->nTunnelFlags = tunnelRequestResponseMsg->sTunnelSetup.nTunnelFl...
0
f385d1aacc4cdd14801a1f87c94118ba
03b0692dd1151e674d29586e837cebca
获取选择查询列表,返回的是字典列表
List<KeyValueDTO> getsSelect(Integer type);
1
9601f4d91811114fdb383cff24226a16
69d68d38a652a0e7c9a872b55493795c
from : http://content.gpwiki.org/index.php/SDL:Tutorials:Drawing_and_Filling_Circles SDL_Surface 32-bit circle-fill algorithm without using trig While I humbly call this "Celdecea's Method", odds are that the procedure has already been documented somewhere long ago. All of the circle-fill examples I came across utiliz...
{ if (SDL_MUSTLOCK(Surface) && _sge_lock) { if (SDL_LockSurface(Surface) < 0) return; } sge_DoCircle(Surface, x, y, r, color, _PutPixel); if (SDL_MUSTLOCK(Surface) && _sge_lock) { SDL_UnlockSurface(Surface); } sge_UpdateRect(Surface, x-r, y-r, 2*r+1, 2*r+1); }
0
11488ad3917ace77fc9afb6d33f2d5e7
7cccbc9ec0ff2f21e676aa73687577a8
Computes -this.
public class SynMatrix implements Copyable<SynMatrix>, Serializable public SynMatrix oneMinusThis() { DoubleMatrix result = DoubleMatrix.ones(numRows(), numCols()).sub(internalMatrix); return new SynMatrix(result); }
0
05b992632c3c0464c480f1b8b4ba6623
12ee963f6774ed8510d87093687a6d34
Finds whether the top {@code cardsToMove} cards in {@code srcCol} can be legally moved to {@code destCol}. It does not automatically execute the move. <p> If {@code destCol} is empty, then the bottommost card of the pile being moved must be a king. Otherwise, the top card of {@code destCol} must be one rank higher than...
namespace CardGames.ShiftingGame class ShiftingCore bool CanMove(int src, int des) { if ((src >= 4 && src <= 7) || des == 8) return false; if (src == des) return false; if (src == 8) { if (des <= 3) ...
0
071d601f590e955018602cd2c00ab38e
480aba0a05cf3ed7f36456b25a954b92
styled to fit a receipt
var toReturn = "- Order #" + ordernum + " for " + receipt[0] + " -\nItems:\n" for (let i = 0; i < 8; i++) { if (receipt[2 + i][0] != '#VALUE!' && receipt[2 + i][0] != '#REF!') { let item = i == 0 ? receipt[2 + i][0].slice(0, -1) : receipt[2 + i][0] toReturn += "[" + item + "\n" } } toReturn ...
0
e60e486b1262ba88f638e60b73d62b6b
8001bd37a48dc499873f554d93d8d428
#function to see for which states some year the merge did not run
l = rep(NA, length(m)) l [ m >= ymd("1958-11-23") & m < ymd("1962-11-18") ] = 1 l [ m >= ymd("1962-11-18") & m < ymd("1967-03-05") ] = 2 l [ m >= ymd("1967-03-05") & m < ymd("1968-06-23") ] = 3 l [ m >= ymd("1968-06-23") & m < ymd("1973-03-04") ] = 4 l [ m >= ymd("1973-03-04") & m < ymd("1978-03-12"...
0
6f354605483e41f90a7464b3e2888032
f98f02e0e5f4008ae23395352a5e2828
Reads the list from the API and updates the store
export default class TodoModel private async fetchFromStore () { const todos = await this.store.fetchTodos(); this.todos = todos; this.inform(); }
0
b874a9e16a9bfabfd1495443e39cfec4
efab76b58e46c08f732930ead37abb01
! \fn UINT8 MLMEMC13192PAOutputAdjust(UINT8 u8PaValue) \brief Adjust the Output power of the transmitter
IN PRTMP_ADAPTER pAd) { UCHAR RfReg; CHAR bbpreg = 0; RT30xxReadRFRegister(pAd, RF_R50, (PUCHAR)&RfReg); RfReg = ((RfReg & ~0x10) | 0x00); RT30xxWriteRFRegister(pAd, RF_R50, (UCHAR)RfReg); RT30xxReadRFRegister(pAd, RF_R51, (PUCHAR)&RfReg); RfReg = ((RfReg & ~0x1C) | ((pAd->TxMixerGain24G & 0x07) << 2)); RT3...
0
50e022df8ba96a87874a132bff86ee61
3c9404c620b2eccbde53648c502c56f9
convert a mxn matrix to a nxm matrix
newmatrix = [] linenumber = 0 for line in m: newmatrix.append([]) for entry in line: newmatrix[linenumber].append(entry) linenumber += 1 return newmatrix
0
4c89dc5e4a1c3f29f520fa0c31ff4ca3
a21df6cd3fb7af5401603d3737eb798d
print element and its subelements recursively
indentation = "" indent.times{ indentation << " " } if indent > 0 if element and element.is_a?( REXML::Element ) and element.has_elements? attributes = getAttributeString( element ) name = lookupFieldName( element ) puts "#{indentation}#{name} #{attributes}:" elemen...
1
b99399529d6d882fd4c4c0e8919c4493
9e76c94af0e5fbd4a349ce6d975cb37d
Always return true for SDK < M, let the system deal with the permissions
public class MainActivity extends BaseActivity{ protected boolean shouldAskPermissions() { return (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1); }
0
aa2d55de7d8e559030f30eb0f58e09bb
a0685b6cbd01f4e50e88de5154c0cf1c
SWebSocketResponse constructor.
class MCSResponseClient extends MCSBaseClient constructor (ws) { super(ws); this._id = ws && ws.req && ws.req.headers ? ws.req.headers['sec-websocket-key'] : null; }
0
5695212a4ea962261305f014ba647496
00bd607fbb219474510445d3abbd237c
Write a linebreak; used after writing paragraphs.
class BodyNode (Node): # title of section def br(self): self.add(Node('br'))
1
f7509ed3954c5e2663153067261a1a34
4603bc3abe794263cacd599fe3e0aa44
Returns an object with valid words as keys and scores as values.
def transform(legacy_data): return {letter.lower(): score for score, letters in legacy_data.items() for letter in letters}
0
28e8e672c92f2cb64b8c9f5bffc958f9
5f5d410e31842b594b1b9ef16f5c8a0d
获取指定的菜单,如果id为0,则获取当前默认菜单
export class Desktop static getMenu(menuId): any { if (FastExt.Desktop.desktopAllMenusInfo.hasOwnProperty(menuId)) { return FastExt.Desktop.desktopAllMenusInfo[menuId]; } return FastExt.System.getMenu(menuId); }
0
250ccf10eea2c05bf3d1a1d0aeb43b76
f238e016810c5d5e10e8046a2a610fdd
zwraca MultiSet jako Dictionary
Maps_OneAndOne<Finger, SySet<SyElement>> km ) { List<Couple<Finger, SyElement>> kmList = new List<Couple<Finger, SyElement>>(); foreach (Finger koma in km.ToKeyList()) { SySet<SyElement> masus = km.ElementAt(koma); forea...
0
4bfc513b28a60313bede1aafdbc329c6
6f993f4c68ef39f9e4356772d77508b1
finds the next value in iteration by comparing ln(p) at the current and proposed value
double getNextX(double x_k, double x_k_1, double fx_k, double fx_k_1) { double fraction = fx_k / (fx_k - fx_k_1); return x_k - fraction*(x_k - x_k_1); }
0
29d9a111cd6a83f6bbdcff6f335ef1b5
7367610b3e9e7e5ec0169c7a1129c0b0
Route a frame to an appropriate AX.25 connection.
static int axudp_raw(struct iface *iface, struct mbuf **bpp) { axudp_dev *dev; struct mbuf *copy; struct ax25 hdr; uint plen; uint8 *dstcall; int numaddrs, bcast, res; axudp_map_entry *e; iface->rawsndcnt++; iface->lastsent = secclock(); dump(iface,IF_TRACE_OUT,*bpp); dev = &Axudp_dev[iface->dev]; plen = le...
1
0de11bb84ebadcf82b12ac6aeba3fcde
909ecdf2ef8539262a8f1c39b5d77239
发布、修改红包接口
{ $redModel = new \Common\Model\LiveRedModel(); $LiveRoom = new \Common\Model\LiveRoomModel(); $token = trim(I('post.token')); $type = trim(I('post.type')); $total_amount = trim(I('post.total_amount')); $blessing = trim(I('post.blessing')) ?: '恭喜发财,大吉大利'; $roo...
1
74230a6f3a8b67a1897730d651495b9a
f92c29df9b99c480abba608d407e8265
Makes a map of the corners which makes it easier to check if a node is a corner node.
class PerlinMap: def _find_corners(self) -> list: width, height = self.width, self.height return [(0, 0), (width, 0), (0, height), (width, height)]
1
01fdee436be1085543574ad23dc4e9e9
c2632ee0972127e99307a9989dcfa7a2
NewGraphQLHandler is the HTTP handler used for handling GraphQL requests.
func GQLHandler(schema graphql.Schema) func(http.ResponseWriter, *http.Request) { return func(writer http.ResponseWriter, request *http.Request) { if request.Body == nil { http.Error(writer, "No query given", 400) return } var payload gqlRequest err := json.NewDecoder(request.Body).Decode(&payload) if ...
1
090b035cf2747d7d85b29e5f7e32d0a7
43c461261a8fe85dee61a56db3a8e40c
Returns true if the principal of the currently running script is the system principal, false otherwise.
namespace Gecko [return: MarshalAs(UnmanagedType.U1)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)] bool SubjectPrincipalIsSystem();
1
9dcc9cb54e5d98bad891faf0e8e4bd03
86bb548df47af021aeb7a45ec1ee7d1b
Returns a dict containing all the original field values. Field values will be their pre-filtered values.
class Model(object): def _build_original(self): d = {} for f in self.Structure: try: d[f.name] = self.__getattribute__(f.name) except AttributeError: pass return d
1
4325217b5a2c9a6414fd558c17e0d691
6e94f9dd06a7df4a5fdf1e6725bb1982
Output is scalar of int64 containing the size of the input tensor.
class SequenceLength(OnnxOpConverter): def _impl_v11(cls, inputs, attr, params): return _expr.const(len(inputs[0]), dtype="int64")
1
fd1075901ec70ed377b78f73bae945d8
ada0ac948d8e5131a672bdeae3fd20e7
Validating m2m relations on TemplateNode.
class Archetype(AuthoredResource,grok.Model): def nodeIdsValid():
0
f08d3e4052eb880668698da984b693ad
af09cce3de55deef32e7937f6b74142a
Minimizes a continuous differentiable multivariate function.
def minimize(loss_func, params, verbose=False, print_params=True, learning_rate=0.1, epochs=500): opt = tf.optimizers.Adam(learning_rate=learning_rate) benchmark = [] history = [] for i in range(epochs): start_time = time.time() with tf.Gr...
1
633db31d2af756493b5c569597a621e1
ec44ecc3176cda5e21aa1499488350ea
按先序遍历二叉树,将每个节点按照树深度加入到map中
Map<Integer,Integer> map = new HashMap<>(); if(root==null){ return new ArrayList<>(); } int max_depth = -1; Stack<TreeNode> nodeStack = new Stack<>(); Stack<Integer> depthStack = new Stack<>(); nodeStack.push(root); depthStack.push(0); ...
0
ceb78382cfebfd639685505cfa5faa4a
2156a271385f5a35c336e77e4f573e46
Return the details of the projects in a workspace.
class Toggl(): def _request_projects_all(self, wid): url = [Endpoints.WORKSPACES, str(wid), "projects"] return self.toggl.request("/".join(url))
1
8eb2f82b9a0c15b56c317a05fcc2224e
d0b48ef56755f1b7ee1bf1bf3509ebe5
DESCRIPTION : Displays the contents of the current procedure parameter array INPUTS : The logical name of the output RETURNS : Nothing useful SIDE EFFECTS : None NOTES : None
if (names->size() == 0) return; cout << "=============================================================" << endl; cout << "Parameter list: " << endl; cout << "=============================================================" << endl; for (unsigned int ii = 0; ii < names->siz...
1
a8e34cf7f814357a048192810ec35cc4
497e3adf62e4ad42960d63e947b66a70
Takes board coordinates (eg. d2, c4) and transforms into matrix coordinates (eg: (3, 1) or .
def convert_position(string): x, y = string[0], string[1] x = letters[x] y = 8 - int(y) return x, y
1
e6ad1f9615aff1afc38a87ebd1b97aee
94891c6accd026f47f18a0200868b2e5
---------------------------------------------------------------------------------------------------- Function: Copies the URL for the Wiki. ----------------------------------------------------------------------------------------------------
namespace EXOFiddlerInspector public class MenuUI : IAutoTamper // Ensure class is public, or Fiddler won't see it! public void miWiki_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start(Properties.Settings.Default.WikiURL); }
0
6d8f1c0f4d7c8efc81c8915d26125820
e569990303c948c45dcc04a01fb1deea
Plots a best fit line to the data
def PlotLinearFitThroughOrigin( x , y ) : x_ = np.array(x) x_ = x_[:,np.newaxis] a, _, _, _ = np.linalg.lstsq(x_, y) plt.plot(x_, a*x_, 'r-', linewidth=2.0)
1
31311b773166c41fb535eee7ab79b82c
4faed603c80e2ef73f477b68c139aabe
Checks the states of the Network & GameControllers to update correctly //
public class NetworkSetup : NetworkBehaviour void Update () { }
0
4c20b18ac83790dad3c3f5bd30b3ef26
74047a7bcb02b44cd901f6337605fe06
Set the maximum number of recipients for a single message. If set to -1 then limit is ignored.
abstract class Zend_Mail_Protocol_Abstract public function setMaximumLog($maximumLog) { $this->_maximumLog = (int) $maximumLog; }
0
8fd36efed4b4235d31ee1125b8d6a337
5a610d213157bdb6b9b56103a2b1c355
Custom output
function header_output() { ?> <!--Customizer CSS--> <style type="text/css"> <?php generate_css('body', 'background-color', 'background_color', '#'); ?> <?php generate_css('.branch-color', 'background-color', 'branch_color', '', '!important'); ?> <?php generate_css('.second...
1
8cdb35e4b4694e82b0b0589444181795
82614e4e3b4a0f0de0168bdd5dc02c39
The closest point of a hexagon that intersects with a given line is the closest such point of each of its six line segments.
Polygon q; Point p1 = line.first, p2 = line.second; int n = p.size(); for (int i=0; i<n; ++i) { double c = cross(p1, p2, p[i]); double d = cross(p1, p2, p[(i+1)%n]); if (c >= 0) q.push_back(p[i]); if (c * d < 0) q.push_back(intersection(p1, p2, p[i], p[(i+1)%n])); ...
0
f681a12e171c0cb0063490b92073b17c
8c35ed130dc6fc60c06d7004b2088bf9
Пишет сообщение в консоли с идентификатором потока и окрашивает каждый поток в свой цвет
{ va_list args; va_start(args, line); #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) HANDLE hConsole; hConsole = GetStdHandle(STD_OUTPUT_HANDLE); FlushConsoleInputBuffer(hConsole); switch (color) { case Types::Colors::NORMAL: vprintf(line.c_str(...
0
c4a628dacc34062b867220676ec7c49d
26a1bd91152350bf4320e5af9d1acb65
Called by StageHubScript when a stage is "entered". Creates the collectible icons on the StagePanel
{ if (Panel.transform.childCount == 0 || collectibles.Length > Panel.transform.childCount) { DeleteCurrent(); RectTransform r = Panel.GetComponent<RectTransform>(); float width = r.rect.width; Vector3 leftBorder = new Vector3(r.rect.xMin, r.transform.p...
1
bb394e8c6855dda2039c23609b272a80
52f83799c124150d2fe10fc468bdc429
创建文章,并返回生成的文章ID
{ if (empty($title)) { throw new Exception('文章标题不能为空', ErrorCode::ARTICLE_TITLE_CONNOT_EMPTY); } if (empty($content)) { throw new Exception('文章内容不能为空', ErrorCode::ARTICLE_CONTENT_CONNOT_EMPTY); } $sql = 'INSERT INTO articles(`user_id`,`title`,`content`...
1
4c4a1cbf10a2432f04fffe947ad0f8bf
9d6a0bb39d6ddb644ce86367ea6cd7ea
When the Delete button is clicked, Connect to the database and delete the record then tell the parent form to update.
namespace Password_Manager_Program public partial class MainForm : Form private void TsmDeleteEntry_Click(object sender, EventArgs e) { BtnDeleteEntry_Click(sender, e); }
0
f81a3bacf3db049726fbbdb61eb29a89
84cc8a0d4ec727636021e0a6e23b2071
Computes the next Euler-Heun iterate
{ double x, v, h, k1, k2, k3, k4, q1, q2, q3, q4; x = *ptx; v = *ptv; h = tf - t; k1 = h * func(t, x, v, u); q1 = h * v; k2 = h * func(t + h/2.0, x + q1/2.0, v + k1/2.0, u); q2 = h * (v + k1/2.0); k3 = h * func(t + h/2.0, x + q2/2.0, v + k2/2.0, u); q3 = h * (v + k2/2.0); k4 = h * func(t + h, x + q3, v + k3,...
0
a468a6209a6396d394f4f031e6d03d1e
6524c532bdda309a857bb921770e5259
Called before each test method executes.
namespace UnitTestsForCodility._1._Time_Complexity [TestFixture] public class TriangleTest [SetUp] public void SetUp() { }
1
b987a4709c7f5e86ab5944e80158c526
0d04f16847b69b13be0e4286b0f8f6d0
判断一棵完美二叉树
if(pRoot == NULL){ return true; } int left_high = TreeDepth(pRoot->left); int right_high = TreeDepth(pRoot->right); return abs(right_high - left_high) <= 1; }
0
535f095e9d7daa9fe8c3ee6232f8ad78
b1e6913158b05c643dbb1388d16c428a
远程阻塞执行一条SHELL命令.
RemoteShellExecResult execute(RemoteShellCommand remoteShellCommand,TimeUnit timeUnit,long timeout);
1
842532d439d91c9a86c6055317b03e16
d8c2d1bbc3edba9435884f0a11da0bd3
Creates and updates some specific keys in the .config file during install.
f_dpms = self.get_configdir() + 'x_screen_saver.conf' f_lock = self.get_configdir() + 'screen_lock.conf' if os.path.exists(f_dpms) or os.path.exists(f_lock): userconfig = ConfigParserWrapper(self.get_bootfile()) try: userconfig.read_wrapper() e...
1
0c3069db51d3bf546eddab9d03033923
69a1195c3d7b405204994db913a142ce
更新状态栏颜色
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; } if (!isSetStatusTextColor()) { if (!isColorDrak(statusColor)) { statusColor = blendColor(HALF_COLOR, statusColor); } } window.clearFlags(WindowManager.LayoutP...
1
cf37eb08f2df1bac81be4a4ce2563b36
d1044e949898122c3e67104190bece4a
Copy cloud folder to cloud folder.
src = get_cloud_path() + '/' + cloud_sub_path desc = get_home_path() + '/' + home_sub_path ln_path(src, desc)
0
c05d0cb43435eaa73f3457243be1632c
bcf565fb60ac4fc29173b5d3fd6326e6
!@brief R(A) := constget(Syms(Bx))
void rpsxSRAV_const() { g_psxConstRegs[_Rd_] = *(int*)&g_psxConstRegs[_Rt_] >> (g_psxConstRegs[_Rs_]&0x1f); }
0
c05ea51b540a970b7c5134303288c5fd
5c640e3095dc830edf713650857d203d
Get all the Project Config Parameter groups by Project ID
export class ProjectModule public getConfig(projectId: string): Promise<IProjectConfigSettingItem[]> { return this.xhr .get(`/gdc/app/projects/${projectId}/config`) .then((apiResponse: ApiResponse) => { const projectConfig = apiResponse.getData(); return p...
1
c6674dd0cd1f5ab2a60be66f2b102cea
57eb68c4047a775360660c0bfaf16560
いびきアラームの各種設定項目の表示・非表示を切り替え
{ if (setButtons == true) { editAlarmButton.Enabled = true; deleteAlarmButton.Enabled = true; } else { editAlarmButton.Enabled = false; deleteAlarmButton.Enabled = false; } ...
0
3009fcb9bd60c4797130d5bcb9624b00
600e3ea891aea30ba1355c04d7b9af76
向map中添加k, v键值对。 若k已经存在,则认为是对该键值对的更新操作
const data = getMapData(this, key) const size = data.size data.set(key, value) this.size += data.size == size ? 0 : 1 return this }
1
0a045a1eb1c208cdbf0d5c8300b437ac
2a7344a61286bc3793818f09a5a72bfb
修改对应房源id的房源审核状态
{ try { $oPropSearch = Model_House_HzPropSearch::data_access($cityId); $oPropSearch->force_master(); $oPropSearch->set_field('status', $status); $oPropSearch->set_field('updated', time()); $oPropSearch->filter('proid', $propId); return ...
1
77284b05312200d54f24fe1b942cd661
0014c333b4b0ac762aec1481fff23b5a
获取上月开始时间和结束时间
var nowdays = new Date(); var year = nowdays.getFullYear(); var month = nowdays.getMonth(); if (month == 0) { month = 12; year = year - 1; } if (month < 10) { month = "0" + month; } var firstDayOfPreMonth = year + "-" + month + "-" + "01"; var lastDay = new D...
1
90dd45925158f4988f56e867ee0d1186
a73f3f8179c61384e71168003eb9eca1
Método para probar que la lista obtenida de eventos puede tener uno o mas eventos
public void PruebaObtenerListaFechaCompetenciasAsistidos() { Tuple<List<Entidad>, List<Entidad>, List<DateTime>, List<DateTime>> tupla = eventosAsistidos.Ejecutar(); List<DateTime> listaFechaCompetencia = tupla.Item4; Assert.GreaterOrEqual(listaFechaCompetencia.Count,...
1
d509448f58207ad189cc41f4b0c6b926
91e6cf1d3a1fd2fcaa67c6d3e388a304
渲染简单的HTML,同时支持纯文本(也就是 Text)
class Text extends Element implements Component public function render($value): string { $value = $this->getValue($value); $this->attr['name'] = $this->field; $this->attr['value'] = $value; $this->attr['placeholder'] = $this->attr['placeholder'] ?: '请输入' . $this->name; $this-...
1
71cc4c53742657c91f3a284ef2071ddb
4c4ff580e9172eb3601aac5e18bba8d3
首次註冊送遊戲幣
$user_data = $GLOBALS['user_info']; $conf_red_packet=$GLOBALS['db']->getOne(" select value from ".DB_PREFIX."conf where name = 'USER_REGISTER_BRIBERY_MONEY' and is_effect = 1"); if($conf_red_packet==1){ es_cookie::set("send_money","1"); $conf_red_packe...
1
489d48f72c19eb475f67307560d47c25
36b8c04496ed34e6e667d10e2944be83
根据服务器mac地址获取服务器ID,没有则添加
class AnalystService extends Service{ public function getMacId($fmac = null){ $fmac || $fmac = $this->getFMac(); $mac = AnalystMacsTable::model()->fetchRow(array( 'fmac = ?'=>$fmac, ), 'id'); return $mac ? $mac['id'] : 0; }
0
80b3d063064937410b24c9771df859ed
1493ccc3dcbff643faf083072a8a5046
Get list of embedded memories.
class CallbackClass: def get_memories(self, sender, data): data = self._im.get_list_of_memories() self._sock.set_list_of_memories(data)
1
e264bff31742145f697560de9ad9c4d1
b3fa58550bb566a3b49c5d56be04599e
誤差拡散法(Floyd-Steinbergディザリング)を使用して、 指定された画像から1bppのイメージを作成する https://dobon.net/vb/dotnet/graphics/1bpp.html
{ Bitmap source = null; if (pimage.PixelFormat != PixelFormat.Format32bppArgb) { source = new Bitmap(pimage.Width, pimage.Height, PixelFormat.Format32bppArgb); source.SetResolution(pimage.HorizontalResolution, pimage.VerticalResolution); ...
0
63ec74d21899c89c261d9fd2fb9c43f0
1c23bc9a043b7e2b33ac02aeeb35feaa
换弹控制
FlagStatus B_VAL = Lil_GetState(CH_B); switch (state) { case state_00: if (B_VAL == SET) { state = state_11; } break; case state_10: state = state_00; break; case state_11: if (B_VAL == RESET) { state = state_00; if (open_flag == 1) cur_pos = cur_pos + 1; else cur_pos = cur_pos ...
0
9cbce2fbeb9109ff031e90a5904b5ee2
6ee562ca885d54a1e6f6cdd00d1a3981
set a page read only
{ Caption=Caption+" (Read Only)"; this->PopupMenu=NULL; fcDBTreeView1->PopupMenu=NULL; btnActivities->Enabled=false; btnOk->Enabled=false; btnCancel->Enabled=false; wwtblCustomers->Close(); wwtblCustomers->RequestLive=false; wwtblCustomers->Open(); m_bReadOnly=true; }
1
aa5c5fb6d01e88fc9e8bc70de7debe40
439b7eae0f1625e042523a52dc7db07b
<p>方法描述:<br> 根据验证ID获取验证KEY
Object key = null; Map<String,Object> keyMap = instKeyMap.get(instCode); if(keyMap != null){ key = keyMap.get(keyName); } return key; }
1
a66371fb69d2df48ba2ed442939dc1a1
7a441dd5f5434c04cbd37597866dddc8
邀请好友加入已有群窗口
{ int groupId = (int)obj[0]; int roomId = (int)obj[1]; RoomEntityBase room = ChatGroupProxy.Instance.GetRoom(groupId, roomId); if (room == null) return; int[] cfgId = new int[room.Config.Count]; for (int i = 0; i < room.Config.Count; ++i) { cfgId[i...
1
86841fb98d2449b6a5b3199405e34178
35474c1e9c2faf81a2cfa3c06befb862
Gets the time this trail was cached.
export default class TrailEmitter getLife () { return this.m_fLife; }
0
bcc79c88e317bdcc96e6b61ca93d3af1
f66c8a142acfd08525a320fcff78280e
This function gets the data from the sensor and processes the data to usable and calibrated temperature values
HUM_TEMP_StatusTypeDef HTS221_GetTemperature(float* pfData) { int16_t T_out, temperature_t; uint8_t tempReg[2] = {0,0}; uint8_t tmp = 0x00; float T_degC; if(HTS221_IO_Read(&tmp, HTS221_ADDRESS, HTS221_CTRL_REG1_ADDR, 1) != HUM_TEMP_OK) { return HUM_TEMP_ERROR; } tmp &= (HTS221_ODR_...
1
f34493257b33e7a38d4d505ebd1e93d4
a6e40dee5c5d77ed4f42c9e51ddefdce
Check hits between all entities of the two given teams
for(TeamData data : active){ if(areEnemies(team, data.team)){ for(TileEntity tile : data.cores){ ret.get(tile); } } } }
0
b3af3256cc734f92ddb2c240a977d667
7a3385df2d326024df0313cea3aa7524
The definition of version components.
class Version(object): def __init__(self, key_type: int, bip: int, testnet: bool): self.key_type = Key(key_type) self.bip_type = Bip(bip) self.testnet = testnet
1
79bfcb668dc2b8e5ab4c93c24aabc46a
7c19dc7327303498ef5e8da001ce4209
Binds the tooltip text to controls.
{ if (!string.IsNullOrEmpty(this.TooltipText)) { this.toolTip1.SetToolTip(this.txtInput, this.TooltipText); } else { this.toolTip1.RemoveAll(); } this.toolTip1.SetToolTip(this.pict...
1
c129627be2f2ca761951972d139b8b1f
0adeaf110dc93fb6fe70fec3905fbb0c
Creates a new process and its primary thread. The new process runs in the security context of the user represented by the specified token.
namespace PDFConversionService static class GSHandler private static void CreateProcessAsUser(string exe, string commands) { IntPtr hToken = System.Security.Principal.WindowsIdentity.GetCurrent().Token; IntPtr hDupedToken = IntPtr.Zero; ProcessUtility.PROCESS_INFORMATION ...
1
44fb509758314cf8a08629e5f97fc221
1b8146515c6bf00460a9416b60e8c880
Deselects the current row and selects another.
namespace Ext.grid public class RowSelectionModel : Ext.grid.AbstractSelectionModel public extern virtual void selectNext();
0
aa71d48e13200877155042d029f56609
6d6d65d82255cae559cdc54ec81cdbae
更新遊戲維護狀態
class products_info_web extends baseCore{ protected function update_game_service($product){ $field = array( 1=>"is_character", 2=>"is_recharge", 3=>"is_top_up", 4=>"is_account", 5=>"is_coin", 6=>"is_props", 7=>"is_gift_bag" ...
0