query_id string | corpus_id string | query string | code string | label int64 |
|---|---|---|---|---|
5df9b82dade75c67745b6cfe433847be | 610bdee8267079bf751feb8566a347fc | Returns the value of the '<em><b>VId</b></em>' attribute.
<!-- begin-user-doc -->
<p>
If the meaning of the '<em>VId</em>' attribute isn't clear,
there really should be more of a description here...
</p>
<!-- end-user-doc --> | @Nullable String getVnfdId(); | 0 |
c1b4824660bfbe1ae52219236c3d972e | 10134e69b001a9490eb195ade55ac191 | 创建一个新的麻将,啥也不干 | class MajiangService extends ExtGameRpcService{
public function createRoom($request){
PlatformDao::saveSender($this->senderUid,$this->sender);
PlatformDao::saveRole($this->senderRole);
$createData = $request['createData'];
$jushu = 8;
$feng = isset($createData['feng']) ? ((int)$c... | 1 |
2e5f449bfb7eb92714ae23caad2c674c | a924304a06e01733b90842465b4000e6 | 오프라인 서비스 글 목록 조회 | List<MOfoffline> getOfofflineList(String rows, String page, String queryName); | 1 |
f4c18b2db756b783bb32c46bf715190c | 38b6727f41b295b6b165e0d1693a143b | return a subset of GeneCollection object and return a new one without changing the original set | if len(index) == 0:
raise ValueError('Grouping yielded an empty island.')
result = copy(self)
result.individuals = [result.individuals[i] for i in index]
result.intended_size = len(result.individuals)
result.pool = None
result.id += '-' + subset_id
r... | 1 |
278882d469c1fc604250999ffb6203d0 | 38cb7d18a210d3c32befad466a4479f3 | Σ1 function | def sigma(x):
return tf.div(tf.constant(1.0),
tf.add(tf.constant(1.0), tf.exp(-x))) | 1 |
9abe18d00194311f493a088ff7461b0e | b3492f2a449270c44377f2d5232deb7b | Find the given render target and place it in the free pool | {
if(IsSet(target->GetFlags(), RenderTarget::F_NO_DRAW))
{
RenderTarget* targetNormal = GetTarget(false);
ID3D11Texture2D* texMS, *texNormal;
target->GetRenderTargetView()->GetResource(reinterpret_cast<ID3D11Resource**>(&texMS));
targetNormal->tex->GetResource(reinterpret_cast<ID3D11Resource**>(&texNormal));
... | 0 |
27dea0059762d476295b4efb6c71a1ff | 69058bb33a9b05911909811cf24d7490 | Checks whether the target exists in the scene or the initial state will set to wander. | {
if (rand.NextDouble() > 0.1f && (whenInEmotionState == null || bhEmo?.IsInEmotionState(whenInEmotionState) != true)) return false;
if (whenInEmotionState != null && bhEmo?.IsInEmotionState(whenInEmotionState) != true) return false;
if (whenNotInEmotionState != null && bhEmo... | 1 |
66ab3b066c12d2a6646a1a990ec3c046 | 7e0a00299ade2a435ac1963de5936b04 | 将stream规约成list的2种方式 | public void test1() {
List<String> list = new ArrayList<>();
Stream<String> stream1 = list.stream();
Person[] persons = new Person[10];
Stream<Person> stream2 = Arrays.stream(persons);
Stream<String> stream3 = Stream.of("aa", "bb", "cc");
Stream<Integer> stream4 = St... | 0 |
79d9055a892ce515f1437764f6e82d6a | aff51cfe60d3fdb7ca36b28044989c42 | Make an aggregation of values for each tree data in val_fields
Aggregation is done with gr_fields list (first : parent, second : child... etc) | def agg_grandchild(df, parent_df, parent_var, grandparent_var, df_name):
parent_df = parent_df[[parent_var, grandparent_var]].copy().set_index(parent_var)
df_agg = agg_numeric(df, parent_var, '%s_LOAN' % df_name)
df_agg = df_agg.merge(parent_df,
on = parent_var, how = 'left')
... | 0 |
481fa7874d402df46a6c392c4861cf91 | a3f2f4bccf5339d028eae78a892cdfa7 | Метод получение кода положения точки относительно окна по алгоритму Коєна-Сазерленда | {
double result = 0;
if (coord.Length / 2 > 3)
{
result = (SumCoord(coord) + (coord[coord.Length - 2] * coord[1]) - DiffCoord(coord) - (coord[0] * coord[coord.Length - 1])) / 2;
}
else { result = ((coord[0] - coord[4]) * (coord[3] - coo... | 0 |
b31d84f7fe2fddaa3f77f21b1a8e50c5 | 23a2e7f982bdf36c090038841df23cc7 | Model tuning based on KFold split and GridSearch | def param_fitting(X_train, X_test, y_train, y_test, loops_v, loops_t, seed, model, param_grid, scorer):
cv_params = []
for i in range(loops_v):
X_train_s, X_test_s, y_train_s, y_test_s = split_data(X_train[i], loops_t, seed)
for j in range(loops_t):
clf = grid_search(X_train_s[j], X_... | 1 |
702e67ab99b8c7462b80a883e095394d | 99e2c15f91e67a0d60e6a7584e3f4d79 | 返回所有未删除的业务类型 | @Repository("BusinessActivityTypeDao")
@Transactional
public class BusinessActivityTypeDaoImpl implements BusinessActivityTypeDao
public List<BusinessActivityType> findAll() throws DaoException {
List<BusinessActivityType> list = this.sqlSessionTemplate.selectList("com.community.app.module.dao.BusinessActivityTypeD... | 0 |
636b25c1051d78dc32eb1c941f857bce | 288a454e94afb746801f69df78c1d0ae | We have to convert nullable value types to System.Nullable | {
string pattern1 = @"System.Nullable<System.(?<type1>\w+)>";
code = Regex.Replace(code, pattern1, "${type1}?");
string pattern2 = @"System.Nullable<(?<type2>\w+)>";
code = Regex.Replace(code, pattern2, "${type2}?");
return code;
} | 0 |
a40defb043613f0f6b576c7299d3cd67 | ada653834ba3ac51078b0fa9344725c2 | 获取玩家报名期间更新战斗信息的冷却时间 | {
int[] times = CommandConfigManager.Instance.lastBattleData.battleCountUpdateTimes;
for(int i=0;i<times.Length;i++)
{
if(currentTime < times[i])
{
return times[i];
}
}
return 0;
} | 1 |
4e4415d48bbdda688e2ca51a83c1c1bb | aaa555608e5b11ce49343729e250c985 | 创建数据表,建表时自动判断是否有id字段,如果没有,自动添加,然后将id设为主键 | class databaseByDictory(object):
def create_table(self, fields):
self.addTable({})
self.setId(0)
self.setFields(fields)
return '创建表的属性:' + str(self.getFields()) | 0 |
24a0faad80bffb7739e1b4ce9d136e8b | 25169c98deb86ac628c85b05d1e70e28 | 判断能否开除 | public boolean canInvite(InvitationIdDto dto) throws Exception {
if(userIdExist(dto.getInvitedId())){
if(hasHalf(dto.getInvitedId())){
throw new Exception("无法邀请");
}
Users invited =userMapper.selectUserByIdOnInvite(dto.getInvitedId());
Users in... | 0 |
7ede159553b72ef39fe560080ff8ba8b | 5ebc7ad1fed701d64028cbb803ea22e4 | UpdateLang updates language sources for the specified state | class LangController extends Controller
public function saveState(Request $request)
{
switch ($request->action) {
case 'create':
return $this->create($request);
break;
case 'edit':
return $this->update($request);
break;
... | 0 |
fb0e4c67e030bb170bb402f68b79e9f2 | efbcd0da1a6a741e8985516f31c54a14 | Returns true is the stroke has been set or false otherwise. | export class HTMLStyle
get stroke() {
return this._extendStyle.stroke;
} | 0 |
e610ee64bd63b1240fe4c1c58725a992 | 2d3a1a7c3e523bdbdf51e3864095fed5 | Method to get Global top 50 tracks | class Client:
def get_country_top_50(self, country_uri):
username = country_uri.split(':')[2]
playlist_id = country_uri.split(':')[4]
response = None
try:
response = self._client.user_playlist(username, playlist_id)
except spotipy.client.SpotifyException as e:
... | 0 |
5846877e318c6159d7ddcda3e9c6309c | 3b020a707b1e88f6871c6e47504f796a | Indicates whether given position is inside the knob. | if (y < 0 || y > getHeight())
return false;
float min = mGap;
if (y >= 0 && y < 0.5f * mSideLength) {
min = mGap + (mSideLength - 2 * y) * (float) Math.sqrt(0.75);
} else if (y > getHeight() - 0.5f * mSideLength) {
min = mGap + (2 * y - 3 * mSideLength... | 1 |
ad191c7ff369d248b9ccf0771bcd2db6 | 60be01a8b9b523274567162cd3a9f260 | Gets the problem mask. | class ControlStage:
def mask(self):
return(self.__mask) | 1 |
d14095e721902548429e5b6bb9cf28ae | 5c280c074c61a29057d0c9f2911f5f29 | broken because of a space instead of underscore | bonus_col.each do |type|
type.gsub!(' ', '_') unless type.nil?
end
end | 1 |
ab3bff0cd533d2e64e180db7d07a5f2d | c7f398fd50f2470be87c3787462cef5b | Draw a rectangle, only border. | pts = array(((x, y),
(x, y+sy),
(x+sx, y+sy),
(x+sx, y),))
self.lines(pts)
self.close_path('rect') | 1 |
8e2d0dcd8a1d219de6a8354d048bd8bc | 24c76b43668391a08857ec3439f5f655 | ブロックの入力一覧を返す。 | public class ModuleElement extends BlockElement
public MountPointIn[] getInputs() {
return inputs;
} | 1 |
fa3a1913dad92f8313325bb21f46d3af | ff0f1194136bb81a72790a7e6e3a4921 | 根据配送方式分线上线下分别减去库存 | if(type == FOOD_MAIN){
switch (typeCC){
case 1:
canClickCommit(true);
BigDecimal couponPrice = goodsSum;
if (useingCoupon != null){
couponPrice = goodsSum.subtract(BigDecimal.valueOf(useingCoupon... | 0 |
f01659ff1c88bf3b837d810364337572 | f12ff03769dd0e8add778cc74510c57a | Test checking for new mangas and make sure 'pings' are sent out correctly | feed = Feed(url='http://feeds.nos.nl/nospodcastbuitenland')
feed.save()
self.assertTrue(feed.entries.exists())
self.assertTrue(feed.entries.filter(enclosures__isnull=False).exists())
response = self.client.get(self.rss_url)
parsed = feedparser.parse(response.content)
... | 0 |
b3230091259c49fd88581ad358f9c329 | 90f84514c63ab71d4b73df58b98bacfd | Gets a mutable reference to the value for the specified property. | int GetValue(
[In] ref PropertyKey propertyKey,
[Out] out PropVariant value
); | 0 |
e6e1e7dfa88c751d404467c797faeef1 | b5ea7d4fdcb9c40db920a0f82c8da8b3 | 파일처리현황 그리드에 값 반영한다. | namespace DemoClient.View.BAS
public partial class BAS0780 : DemoClient.Controllers.BaseForm
private void gridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
try
{
foreach (DataGridViewRow row in gridView1.Rows)
{
switch (row.Cells["_DOC_FILE_TYPE"].Value.ToStrin... | 1 |
b039edd0285241ba081d74e43980e432 | 22c0ff6502697e5e07ccf3f4ee5639f5 | Triggers the rebalance operation. | public class TaskCoordinator implements GroupListener<WorkerNode>, WorkItemListener
public void rebalance() {
List<String> workItems = repository.listWorkItemLocations();
Set<String> members = group.members().keySet();
balancingPolicy.rebalance(context, workItems, members);
} | 1 |
1714b884dfb8395fe9f92d53c680ab5d | 430e81ff3b6fae283850ecbb51ccc65b | Import all CSV data to a SQLLite database | {
MarketTable dt = new MarketTable();
DataTable ds = new DataTable();
string filePath = PathNameGet;
FileInfo shortPath = new FileInfo(filePath);
string dir = shortPath.DirectoryName;
String noCsv = "";
List<string> partsF = ne... | 0 |
f62112b68f0ebebc1699fa4a0c4fb8c8 | 285ed91351161157fe3ad68fe8b27324 | Отобразить список ресурса в зависимости от выбранной категории. | class PostController extends Controller
public function index($categoryId)
{
$categoryType = DB::table('categories')->where('id', $categoryId)->first()->type;
if ($categoryType == 1) {
$posts = DB::table('posts')->where('category', $categoryId)->orderBy('title', 'asc')->get();
}... | 1 |
1c301e45e67013ac864b8ec157a82a37 | d22cc3f5ebd10d54fed6fbf27c132541 | Return true if given product is an application product, false otherwise. | def is_product(x: str) -> bool:
result = re.match(r'pr\d{1,3}$', x)
return False if (result is None) else True | 0 |
13bc8b83c808bb3345c33caa42c48b54 | d4bd86a4a4a0174a6deeab55d0ccb9c7 | 選択されたグループに選択されたオンラインメンバを追加する | $member_srl = Context::get('member_srl');
if(!$member_srl) return new Object(-1,'msg_invalid_request');
$member_srls = explode(',',$member_srl);
$group_srl = Context::get('group_srls');
$group_srls = explode('|@|', $group_srl);
if(!$group_srl) retu... | 1 |
77f23f6832e0fcb47bbc35863f6ab3e3 | 8e69b1f9f023df0ee7d0751f7b6165dd | Tests the GetSanitizedEventValues function. | class MySQL4n6TimeOutputModuleTest(test_lib.OutputModuleTestCase):
def testGetSanitizedEventValues(self):
output_mediator = self._CreateOutputMediator()
output_module = mysql_4n6time.MySQL4n6TimeOutputModule(output_mediator)
expected_dict = {
'type': 'Content Modification Time',
'host': 'ubu... | 1 |
93fd74e393184055137210138ed40734 | a613c29644506e1bc932a469067d6048 | Gets query for [[RequestItems]]. | class Request extends \yii\db\ActiveRecord
public function getRequestItems()
{
return $this->hasMany(RequestItem::className(), ['request_id' => 'request_id']);
} | 1 |
0999052f2834c5e0477411bcdf80354d | e62d3826c23340aef134091edf33c923 | Returns a delegate base property map from which values will be derived if not found within
the local property map. | PropertyInfo property)
where TConstructedType : TBaseType, TDeclaringType
where TBaseType : TBase, TDeclaringType; | 0 |
0bc4156ee032157413ef6dfac3dfc5b2 | 297fe7e343246cde001568be4e97baf5 | Swap long endianness and return the swapped value. | namespace FallDave.Trifles
public static class BinaryData
public static Int64 Swapped(Int64 value)
{
return (Int64)Swapped8((UInt64)value);
} | 1 |
ea1b1dca16e433e3c761a26af6b9199b | 47496748db7aa184a395b57acc85d08a | 根据ActionId,获取Action类的路径 | {
if (routeData == null)
return "";
var path = string.Format("|{0}|{1}|{2}", GetAreaName(routeData), GetControllName(routeData), GeActionName(routeData));
while (path.IndexOf("||") > -1) {
path = path.Replace("||", "|");
}
... | 0 |
6c9814a5c06c7e2b613e4c909d9fe3cc | 4bdae34c2c524bb0f69f7ac47540f516 | draw rectangles and Strings in different colors | t_point polypts[3] = {{500.,400.},{450.,480.},{550.,480.}};
t_point polypts2[4] = {{700.,400.},{650.,480.},{750.,480.}, {800.,400.}};
clearscreen();
setfontsize (10);
setlinestyle (SOLID);
setlinewidth (0);
setcolor (BLACK);
drawtext (110.,55.,"colors",150.);
setcolor (LIGHTGREY);
fillrect (150.,30.,200.,80... | 1 |
44eeaf9a1c3178ee8098d886a864c332 | 21d9c925738eff25409e2abd1a451172 | 使用了WinAPI来移动控制台的光标 | void move(HANDLE hout, const int X, const int Y)
{
COORD coord;
coord.X = X;
coord.Y = Y;
SetConsoleCursorPosition(hout,coord);
} | 1 |
9af1e813f33ca60754aa6d6186bdfbb3 | cad2beaf04c1be890ee15d77d7f4ea53 | 测试auth方法,当email错误 | {
$bad_auth_data = ['email' => 'first_user@email.com'];
$data = $this->getJsonWithError('/api/auth/register', 'POST', $bad_auth_data);
$this->error_message($data->message);
} | 1 |
c231edad16115756a9e59f4abf288333 | 7f61448ad6da3ef0f9cb03f40c5be655 | Map Path | cases like (1) | 0 |
6e7b9da91ffc3a237c69daf52637d4f0 | ce1b67c5ab41a332b3d5fe6e8f0be58b | Gets the enabled state of component (wtDisciplinaryEditInput) | namespace ssCaseConferencing.Flows.FlowSafeguarding public class ScrnAgenciesInvolvedPopup: OSPageViewStateCompressed, IWebScreen, INegotiateTabIndexes, IBookmarkableURL
public bool inputwt_Input10_isEnabled() {
return true;
} | 0 |
f41eed81af0d81b294c91c9c7b2dccb8 | 52691b878ade31a5f1078071cb36aa04 | 检索发货单的付款记录 | List<SmtPaymentRecord> getPaymentRecordList(ReceiveVO rVo); | 1 |
bf99191d52a72403c4109ab7022d3a25 | a529ef80906f451709d215060c9bd459 | Returns the document host (used into references...) | abstract class Node /* extends EventTarget // try factoring events out? */
public function __node_document(): Document
{
return $this->_ownerDocument ?? $this;
} | 1 |
409bc2c5391ea74315ae03672681a509 | bc32d16792c61dc20309463c53baedeb | Handles submission of form data and posts it to backend | class CreateForm extends React.Component
handleSubmit(event) {
this.setState({
loading: true
})
event.preventDefault();
const postData = {
id: this.state.id,
fullname: this.state.fullname,
sex: this.state.sex,
age: this.state.age,
race: this.state.race,
limbLev:... | 1 |
49e10a2ca0999de8941b02a79674dfe4 | 5fbff628700b82465b829ee4ea86062c | Determines if this {@link PaymentGatewayPluginInvoker} is resolved. | public function isResolved(); | 1 |
05af97be1121a663f0f04a397be880db | 137ec1bd1fe45328bdfe308628a7c3ef | function to determine whether a hand as two pairs | def check_one_pairs(hand):
frequencies={}
frequencies_list=[]
ranks = [i[0] for i in hand]
for rank in ranks:
if rank not in frequencies:
frequencies[rank] = 1
else:
frequencies[rank] += 1
for frequency in frequencies.values():
frequencies_list.append... | 0 |
273187c6a208a2374a7c5e338e875e95 | 314ec254cb90e09c70e22f4ee71ef9d8 | Give a user a role. | class User(UserMixin, db.Model):
def give_role(self, given_user, new_role_name):
log = ManageLog()
log.managed = given_user
log.manager = self
log.old_power = given_user.role.name
log.new_power = new_role_name
new_role = Role.query.filter_by(name=new_role_name).first()
... | 1 |
45414ce84da603ce25b6041026acdfe7 | de949db679001b1ecc9c987414f18cda | Description: performing grid search on the logistic regression model parameters. | from sklearn.model_selection import GridSearchCV
param_grid = {
'penalty': ['l1', 'l2'],
'C':np.logspace(-4,4,20)
}
clf = LogisticRegression()
grid_search = GridSearchCV(estimator = clf, param_grid = param_grid)
grid_search.fit(X_train, y_train)
print(grid_search.best_params_... | 1 |
6e73002d412e6b5516be4fa793bf8a39 | 450569faf7077af2b55154ee66236cfb | When the button that corresponds with this code is clicked, everything affected will change to "End!" | {
StartCoroutine(DisableAllButtonsForSeconds(0.6f));
ToggleButton_3();
if (m_Button1_IsOn == true)
{
ToggleButton_1();
}
if (m_Button2_IsOn == true)
{
ToggleButton_2();
}
i... | 0 |
2f9a206f2fafe01b4864f9d6cda3ff14 | d239b8f78c6bc01f99e60390c583a6d5 | Calculates the 'leave-one out' (LOO) predictions for the data, where each data
point is removed from the training set and then has its value predicted using
the remaining data.
This implementation is based on equation (5.12) from Rasmussen & Williams. | def ordinal_loo(stats, rankings, model=LinearRegression()):
n_obs = stats.shape[0]
n_rankings = rankings.shape[1]
errs = np.empty([n_obs, n_rankings])
stats = Imputer().fit_transform(stats)
rankings[np.isnan(rankings)] = 999
loo = LeaveOneOut(n_obs)
for train, test in loo:
reg = mo... | 1 |
e893c465a6ec298360f55d75360a4594 | be7a35951fa6e860e10e835efd35615f | Creates a Solr index with the given name | abstract class Engine
abstract public function createIndex($name, array $options = []); | 1 |
48336f964f0259508a9479a2f0d165e5 | 962f13fbe7d405488f1493b7c323eeb7 | Uses randomized integration to determine definite integral of polynomial function. | namespace routines
Number integrate_rt(std::string function_name, Number a, Number b)
{
if(map_functions[function_name].num_arguments != 1)
{
throw ARGUMENT_ERROR;
}
Number sign (1.0); Number temp;
if(b < a)
{
temp = b;
b = a;
... | 1 |
fcffdd75f86390aaf4b9559806039c39 | 0adc0de77389ba87a83e320314b68dc3 | set to true to have generated urls use the domain, false to have them use
absolute paths without the domain | public class Configuration
public void setStandardUrlType(Boolean standardUrlType) {
this.standardUrlType = standardUrlType;
} | 1 |
5f97d89e64f78cd14b122b19ca25246a | 3b4ab594f72b1e3bed7f962a9278a2a5 | # Since there is only one scalar measure to use in Construct 4,
# we don't build a composite. However, the z-score of this measure
# is still set according to the Control group mean/sd to be
# consistent with the other constructs. | ppnt.summary <- my.df%>%group_by(IDnumber)%>%
summarize(ppnt.mean=mean(likertRating),ppnt.sd=sd(likertRating))%>%ungroup()
for(i in 1:nrow(my.df)){
my.df[i,"Zscore"]=(my.df[i,"likertRating"]-ppnt.summary[which(ppnt.summary$IDnumber==my.df[i,"IDnumber"]),"ppnt.mean"])/ppnt.summary[which(ppnt.summ... | 1 |
7b96a95f90b687831421bf8cdf3fcecb | 1464e2b0272358bf95653c9a697f7793 | Creates a command to disable the ramp functionality | public class ElevatorGoUp extends CommandBase
@Override
public void initialize() {
RoboVader.disengageRatchet();
RoboVader.setSpeed(0.55);
} | 0 |
759b9444426265e4a2858721a80f6cc7 | 7eaee37e357eec1248f689ee8a6d45fe | make an easily read label from a path | def getLabelFromPath(path):
return os.path.basename(os.path.dirname(os.path.normpath(path))) | 1 |
70a50f3230d7dc0c6646e9def6fcdabf | 7d5c8f2d2481dd22e560ebed8acfafaa | 清除无用的AudioSource | namespace Framework
public sealed class AudioManager : MonoSingleton<AudioManager>
public void ClearIdleWorldAudioSource()
{
HashSet<GameObject> removeSet = new HashSet<GameObject>();
foreach (KeyValuePair<GameObject, AudioSource> audio in _worldAudio)
{
i... | 1 |
d2482d4bd8b78478421dec5e3d41ca83 | 44493e1b878bb9a7fb62c1ec50877028 | First, create offsets based on the input values to keep the sampled
points from being near a integer boundary. This is a result of
using perlin noise, which returns zero at integer boundaries. | {
EffectParameter weightsParameter, offsetsParameter;
weightsParameter = postProcessingFXInverse.Parameters["SampleWeights"];
offsetsParameter = postProcessingFXInverse.Parameters["SampleOffsets"];
int sampleCount = weightsParameter.Elements.Count;
flo... | 0 |
1ce4ff6034ec915b94d5a147e29ac799 | 521e05ede2973d6c5fb4846c8a4e8509 | ValidateDriverName validates the driver name | userName := c.Param("userName")
if len(userName) < 5 {
c.Error(errors.NewCustomError(400, "userName debe tener al menos 5 caracteres"))
c.Abort()
return
}
} | 0 |
d3e9d9801b48db07a34bf42d5ec6865a | e115706fd70fa86ab51946f0b0ce008a | Muestra los numeros pares del 1 al 100. No toma ni retorna nada. | namespace programacionestructurada20171001
class Program
static void Escribe10al20()
{
int i;
i = 10;
while (i <= 20)
{
Console.WriteLine(i);
i = i + 1;
}
} | 0 |
c1965a8d74df20f1800061ce72143abc | cba670f710b035acf5b1f989269b35e3 | Takes desired width or height and source width and height and
fills in missing information to maintain correct ratios.
If both width and height are passed, they are used as-is | {
if (!$width && !$height) {
throw new UnderflowException('You have to pass at least width or height.');
}
if ($width instanceof Size) {
return new static($width->width(), $width->height());
}
if ($width && $height) {
return new static($wid... | 1 |
1e3b9ed5623492497cf2be602220d19e | ed1c030011a5ac724569fb8bb77eedff | Подготовка исходящего сообщения c файлом | class MailObject
private function prepareFiles($msg):string{
$message = $msg;
if(!empty($_FILES) && count($_FILES['file']['name'])>0 && $_FILES['file']['name'][0]!==""){
for($i =0 ; $i<count($_FILES['file']['name']) ; $i++){
$file_name = $_FILES['file']['name'][$i];
... | 1 |
8ac4e36d53c2928d72ccbb2662a13290 | ea422a2f4880b98726f650d318127be3 | Convert confusion matrices of respective classification to an accuracy vector. | per_class_accuracy = np.diag(confusion_matrix) / (confusion_matrix.sum(axis=1) + 1)
per_class_accuracy = np.nan_to_num(per_class_accuracy, nan=0)
output = (per_class_accuracy).round(2)
return output | 1 |
498dbc9235a0870e1abebb6f25d8602f | b2ef2e35854605b85a904aadbc748633 | Convert from per Second to per Hour | class Car
public double convertSecsToHours(double ts){
return ts / 3600;
} | 1 |
ba3ec50b6f5d9ba057015f2457273ff1 | b0157b7a0ac52781eb31394e0e54b4c4 | Called when the device configuration changes. | namespace ZXMAK2.Engine.Entities
public abstract class BusDeviceBase
protected void OnConfigChanged()
{
if (!m_isConfigLoading)
{
var handler = ConfigChanged;
if (handler != null)
{
handler(this, EventArgs.Empty);
... | 1 |
b293d98c201c6960e18d9b1e802caaea | 11ab8b59befdb644f386152101115509 | 获取fundId的方法 | {
if(String.IsNullOrEmpty(FUND_IDENTIFIER))
{
return String.Empty;
}
else
{
return "MF";
}
} | 0 |
925e7c1be85a03fbde3a1868cc98b92c | eed37a3a42c7465f6c80eceb90e8513b | This will remove all of the special membership provider properties which were required to display the property
editors
for editing - but the values have been mapped back to the MemberSave object directly - we don't want to keep these
properties
on the IMember because they will attempt to be persisted which we don't wan... | this MembershipProvider membershipProvider)
{
var baseProvider = membershipProvider as MembershipProviderBase;
return new Dictionary<string, object>
{
{"minPasswordLength", membershipProvider.MinRequiredPasswordLength},
... | 1 |
5c11d8995313aa958520b4e97b600dc8 | 1eb2377901524a9f848979a6080872fc | Get the id (type) of a ModNPC by class. Assumes one instance per class. | types = [:object, :item, :npc]
unless types.include?(type)
fail "Invalid type of #{type} specified, must be one of #{types}"
end
Kernel.const_get("#{type.capitalize}Definition").lookup(id).name.to_s
end | 0 |
583eeaa9336e845b022e3a199e2a3303 | 1121030b65e5dd9f4ff1b0cd5ba78cbc | POST: First/Create | {
ViewBag.ModelFirstId1 = new SelectList(db.ModelFirstSet, "Id", "Nombre");
return View();
} | 0 |
dac3e7350c6195403d9ac4b0b19606e1 | bcfc6ac6c673877b58796df58c772297 | Try to acquire an exclusive lock around the contained value | if self.raw.try_lock_exclusive() {
Some(self.write_guard())
} else {
None
}
} | 1 |
27760f59e0455a14e6e17eb6863294d7 | 4cbf81ba7acdf9f993945ba7a4b6cca6 | Открыть окно для добавления новой записи в базу | {
WindowAddNewFeed win = new WindowAddNewFeed();
win.Owner = this;
win.DataContext = this.DataContext;
if (win.ShowDialog() ?? false)
{
sender.Execute();
}
} | 1 |
af85e4109ca4de2315cb4c23e4fa0f7b | ec52c845bff910c71e76693d113494e5 | 会员自动注册邮件通知 | {
$data = [
'url' => route('email.verify',['token'=>$user->confirmation_token]),
'name'=>$user->name
];
$this->sendTo('zhihu_app_register',$user->email,$data);
} | 1 |
e1787c2a355e7d362e6bbdf3f8c36352 | c4d2c4cb14b121ff1d45c60e2f3b1aba | 跳转到众筹发布页 | @Controller
public class PostController
@RequestMapping("/toPublish")
public String toPublish(){
return "publish";
} | 1 |
a65ab83a8125e105736ad2cdb25c8310 | b9d78778cef8f817b7f866e3582cf091 | 指定されたDateTime値から年を取得する | {
if (IsDateTimeFormat(dateTimeStr))
{
DateTime dt = DateTime.Parse(dateTimeStr);
return dt.Year.ToString();
}
return "";
} | 1 |
29e0a859f97300344a970bf9f6bff590 | 71b800c138eda26f89146c122ad46cbe | Summons a Lost Soul projectile fired in the direction of the player. | {
var projectile = new Projectile();
var pos = new Vector2();
double angle = _player.Angle;
pos.X = _player.Position.X + (int) (_playerTexture.Width/2.0*Math.Cos(angle));
pos.Y = _player.Position.Y + (int) (_playerTexture.Height/2.0*Math.Sin(angle));
... | 1 |
6b602a16807d2b5c3356c690ddd3e3ed | 39a583d53d0aee22e26ec65f5908a4f4 | saving the include history option value to be retained for all Add to Type in add activity | function ToggleIncludeSelection() {
disableButton("btnSave", false);
var inclusionChkVal = document.getElementById("chkAllLesson").checked;
var noOfRecords = document.getElementsByClassName("chkIsLessonIncludedClass").length;
for (var i = 0; i < noOfRecords; i++) {
document.getElementsByClassNam... | 0 |
78bed6f36326e065fbddfba36e3abda3 | d36be9cbaa7e0e47ba15193d78d4412a | 获取每日0点时计数总量 | {
TodayStaticData();
string sp = "exec SP_StaticCountToday";
MainRespority<FindQQDataTable> main = new MainRespority<FindQQDataTable>(ConnString);
List<int> ret= main.ExecuteSPSelect<int>(sp, null).ToList();
if (ret.Any())
{
... | 1 |
86a3b31a193d19acba8dcf73b350c254 | 1fbfcb3462644e4b764b723192f25669 | Return the number of session variables. | class Session
public function count()
{
return count($this->storage->getAttributes()->all());
} | 1 |
dfb14592681ddc52af7f4ed9b3600455 | afa69fb4c6141a9968f95dd1fa8530a1 | Build a new restriction for the branch and bound algorithm. | if(vrt.isBroad()){
if (!(vrt.getRight().isEqualTo(0) && vrt.getGroup().equals(mainGroup) && vrt.getRtt().equals(RestrictionType.LessOrEqualThan))){
Logger.println("error","Forbidden restriction: " + vrt);
System.exit(1);
}
return false;
... | 1 |
94c1db4bfe578d0c17c8d0ffad98f58d | 1d46c440bd8fff420354fd8236cfeaf2 | Returns a surface Object of a named frame | {
if (!mFrameDict.ContainsKey(FrameName))
{
mFrameDict.Add(FrameName, new FrameContentStack());
}
return mFrameDict[FrameName];
} | 0 |
e10567cf6ca82431a59cf86e0103c583 | 2b594a05187477ed2cffd74d2df4c654 | 随机下载一张图片 | public class MainActivity extends AppCompatActivity
public void downLoadPic(View view) {
random = new Random();
int index = random.nextInt(imgUrlList.size() - 1);
request = new Request.Builder().get().url(imgUrlList.get(index)).build();
okHttpClient.newCall(request).enqueue(new Callback(... | 1 |
d3fcc9f9285b6e27226fc371d069428e | 85a9ab0306255ca08489461e6ebf641d | Reloads the translation hashes | class TranslationsPress_Updater
public static function refresh_all_translations() {
static $done;
if ( $done ) {
return;
}
self::$all_translations = null;
self::set_all_translations();
$done = true;
} | 1 |
69975c356313e0a64db03347db90f632 | 0be18d9c405f4db636b4c680fd0da181 | GET: UserCv | {
int userid =Convert.ToInt32(Session["User_id"]);
ycsv.Userabout = users.GetUserById(userid);
return View(ycsv);
} | 1 |
eeacf55d71515fca65fca674892431df | 5c607993c75209a2f32b3392a6f1be2e | Marks an opportunity as Hidden from the frontend. | public boolean markOpportunityAsHidden(OpportunityDTO dto); | 1 |
4be428fc57c8a3be015c19f128ad417b | 329d2f5ec96b48472581a8c594247dd3 | Returns the HttpRequest factory instance. | final class Builder
public function getRequestFactory(): RequestFactoryInterface
{
return $this->requestFactory;
} | 1 |
ba7d83fc1e189fef955156e7611e69fb | cc11711b16b318156acbc72e0c202108 | Test for axis=2 | class TestFeaturesAndLabels(TestCase):
def test_2d(self):
fl = FeaturesAndLabels(["a", "b", "c"], ["d", "e"], feature_lags=range(4))
shape = fl.shape
self.assertEqual(shape, ((4, 3), (2, ))) | 0 |
b29a85903f2a3e90b00972cd51a3bf4d | 6f0496b8f1f9a30035c11dfecfab872b | 竞赛统计页面 | def home(request):
uid = request.GET.get('uid', '')
kind_id = request.GET.get('kind_id', '')
created = request.GET.get('created', '0')
try:
kind_info = CompetitionKindInfo.objects.get(kind_id=kind_id)
except CompetitionKindInfo.DoesNotExist:
return render(request, 'err.html', Competi... | 0 |
70798e39e6d423f600c9900e60ded7b2 | 117b5816d95fde443e039c2a9f5a9646 | merge the selected regions into a single larger region | if len(self.scene.selectedItems())>0:
mergeArea = None
for item in self.scene.selectedItems():
area = item.combinedRect()
if not mergeArea:
mergeArea = area
else:
mergeArea = mergeArea.united(area)
... | 1 |
c0d081e5b4be36c96fe07e82a783469e | 716a5225acf260425a4e175fc6e18347 | Exemplo de utilização de thread passando valores por parâmetro para um método. | namespace Exam70483
public class ThreadingExamples
static void ParmThreadMethod(object o)
{
for (int i = 0; i < (int)o; i++)
{
Console.WriteLine("Threadproc: {0}", i);
Thread.Sleep(0);
}
} | 1 |
76d00c528ad59db4f72892d76f4ea2d6 | 411f002c596436d7b247160516e6ce23 | Creates a new timer group | public class TimerGroup
public TimerGroup createThread() {
if (thread == null) {
synchronized (this) {
thread = new TimeThread();
}
}
return this;
} | 0 |
2fac1a92b68407d73ba896c8e7ddbb83 | b120af34aa74012249669f1340028251 | 棋譜を再現 | class ChessBoard
Redo()
{
if(this.undo_route.length < 2) return
var i = 0;
while(i < 2) {
var s = this.undo_route.pop()
this.Play(s, s.player)
i++
}
} | 1 |
653ff856b3e7c74693518093e793de60 | b65f890712631e0ab88d2954dca3b80d | Test whether a stack can accept more pushes | {
if (stack_ptr < count) {
*status = -EOVERFLOW;
return 0;
}
return 1;
} | 1 |
fbabdeafb79205c616b47f49f93603d4 | ec5ec6552908b5fd38d85b127089ad37 | Close the Predictor window for the selection of the input data and renames
the selected varaibles in the window.
When closing the window, the label in BCI window will be updated | class CrocoGui(wx.Frame):
def onCrocoVariableChoice(self, event):
self.variableName = self.CrocoVariableChoice.GetString(self.CrocoVariableChoice.GetSelection())
self.DerivedVariableChoice.SetSelection(0)
self.updateVariableXY()
self.drawxy() | 0 |
d2be97abdc4bafca72a08e1b5be75401 | a59570f6a4f307080fc87531fb88822c | sets up the dimensions, number of walkers, number of steps, and bounds on the
coefficients | : m_power(power), m_difficulty(difficulty) {
double step = .01;
int size = 500;
int i;
if(m_difficulty == "simple")
m_error = 1.5;
else if(m_difficulty == "intermediate")
m_error = 1.0;
else if(m_difficulty == "difficult")
m_error = 0.5;
else
m_error = 0.001... | 0 |
1528dfe598ddb3818cdbb6b225ae9ed3 | 817ffb284ac1e5da5aab8c2e2d41aa3e | Plays cast animation facing right | {
if (weapon != null && !isFacingRight && weapon.animation.isPlaying)
weapon.animation.Stop();
isFacingRight = true;
if (CanMoveRight())
{
rigidbody.velocity = new Vector3(0, rigidbody.velocity.y, 0);
rigidbody.MovePosition(transform.position + (Vector3.right * moveSpeed * Time.deltaTime));
}
} | 0 |
286afb939cbc69b0d233664a192cf971 | 6b7a607104bba28f47e162d28c50a30f | sqsにキュー登録を行う | public class AmazonGlacierBaseUtil
public final void initSqs() {
CreateQueueRequest request = new CreateQueueRequest().withQueueName(SQS_QUEUE_NAME);
CreateQueueResult result = sqsClient.createQueue(request);
sqsQueueUrl = result.getQueueUrl();
GetQueueAttributesRequest queueRequest = ne... | 1 |
54dfa746fc86cb23046565f505400ca5 | 930e2f637632bc5e80d0782196437e74 | Extracts the number of data layers and data blocks from the layer around the bull's eye | {
var layer = _image.Layers.OrderBy(l => l.DigitCount(0)).First();
return layer.DigitCount(1) * layer.DigitCount(2);
} | 0 |
ae59df0eba0effa0a266b195c9672afe | 386dfb2e595aa293b931e8d3e8230402 | Gets the device_type of this Thermostat. # noqa: E501 | class AirConditioningCompanionStatus:
def device_type(self) -> int:
return self.air_condition_model[1] | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.