Dataset Viewer
Auto-converted to Parquet Duplicate
query
stringlengths
10
8.11k
document
stringlengths
17
398k
negatives
sequencelengths
19
20
metadata
dict
Returns a list of entities using a fulltextsearch
public function findByFulltext($search, $limit = 10, $offset = 0);
[ "function elgg_tokeninput_search_all($term, $options = array()) {\n\n\t$term = sanitize_string($term);\n\n\t// replace mysql vars with escaped strings\n\t$q = str_replace(array('_', '%'), array('\\_', '\\%'), $term);\n\n\t$entities = elgg_get_config('registered_entities');\n\t$subtypes = array(0);\n\tforeach ($enti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a user ID return connections connections ids
function getConnectionsConnectionsIds($userConnections){ $userConnectionsConnections=[]; foreach($userConnections as $k=>$v){ array_push($userConnectionsConnections,getConnectionsFromUserId($v)); } return $userConnectionsConnections; }
[ "function getConnectionsFromUserID($userID){\n require \"includes/dbh-inc.php\";\n $userConnectionsIDs = [];\n $sql = \"SELECT Connections.UserB_Id\n FROM Connections\n WHERE Connections.UserA_Id = {$userID};\";\n $result = $conn->query($sql);\n if($result->num_rows > 0){\n while...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate MYSQL for float
public function generateMySQL($param) { $size = $this->getSize($param["params"]); $size = ($size == "") ? "(11)" : "($size)"; $null = $this->getNull($param["params"]); $null = ($null == true) ? "NULL" : "NOT NULL"; $default = $this->getDefault($param["params"]); $default = ($default == "") ? "" : "DEFAULT '$default'"; return "`" . $param['name'] . "` FLOAT$size $null $default"; }
[ "function getFloat($column_name) {}", "function SetColFormatFloat($col, $width=-1, $precision=-1){}", "function escapeFloat4Sql($f){\n\t\treturn (string)$f;\n\t}", "protected function getDecimalSql($value)\n {\n return (float) $value;\n }", "function writeFloat(){\r\n\t\tdie('Not implemented');...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update company member table and set permission values
function set_company_member_permission($user_id, $company_id, $values) { echo "<pre>"; print_r($values); exit(); $data = $this->get_company_member_data($user_id, $company_id); if ($data) { $original_values = !empty($data['permissions']) && $data['permissions'] != 'null' ? json_decode(stripslashes($data['permissions']), TRUE) : array(); $new_values = array_merge($original_values, $values); $this->db->where('id', $data['id']); $res = $this->db->update($this->company_member_table, array('permissions' => json_encode($new_values))); if ($res) { return true; } } return false; }
[ "function ncn_admin_assign_member_to_am($member_id, $am_uid)\n{\n// $query = \"UPDATE member_id_pool SET am_uid=$am_uid WHERE member_id='$member_id'\";\n $result = db_query('UPDATE {member_id_pool} SET am_uid=:a WHERE member_id=:b',\n array(':a'=>$am_uid ,':b'=>$member_id));\n if ($result->rowCount()=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the current node is a sibling of a supplied node. (Both have the same direct parent)
public function is_sibling($target) { if ( ! ($target instanceof $this)) { $target = self::factory($this->_object_name, $target); } if ((int) $this->pk() === (int) $target->pk()) return FALSE; return ((int) $this->{$this->_parent_column} === (int) $target->{$target->_parent_column}); }
[ "public function isSiblingOf($node)\n {\n $this->checkNotNewModel(); \n $owner = $this->owner;\n if ($this->isRoot() || $node->isRoot()) {\n return $owner === $node;\n }\n return $owner->{$this->getPathFieldName()} == $node->{$this->getPathFieldName()};\n }", "p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fungsi Add To Cart
function add_to_cart(){ $data = array( 'id' => $this->input->post('for_id'), 'name' => $this->input->post('title'), 'price' => $this->input->post('price'), 'qty' => $this->input->post('quantity'), //cart sesion dari controller cart ); $this->cart->insert($data); echo $this->show_cart(); //tampilkan cart setelah added }
[ "private function addToCart() {\n\t}", "public function add()\n\t{\n\t\t$product = ORM::factory('product', $this->input->post('product_id'));\n\t\t$quantity = $this->input->post('quantity', 1);\n\t\t$variant = ORM::factory('variant', $this->input->post('variant_id'));\n\t\t\n\t\t$this->cart->add_product($product,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get reverse path to current path part.
public function getReversePath() { return $this->pageContext->getReversePath(); }
[ "public function\t\t\tgetReversePath()\n\t{\n\t\treturn is_null($this->remainPath) ? \"\" : \\net\\dryuf\\core\\StringUtil::replaceRegExp(\\net\\dryuf\\core\\StringUtil::replaceRegExp($this->remainPath, \"[^/]+/\", \"../\"), \"[^/]+\\$\", \"\");\n\t}", "public function getRelativePath()\n\t{\n\t\t$baseName = $thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List all and search movies (/movies/index)
function index() { $search = isset($_POST["searchterm"]) ? $_POST["searchterm"] : ''; $this->set('active','list'); $this->set('search',$search); if($search) { $this->set('title','Results for '.$search . ' - Netflix Movies'); $this->set('data',$this->Movie->search($search)); } else { $this->set('title','All Results - Netflix Movies'); $this->set('data',$this->Movie->selectAll()); } }
[ "public function searchMovies() {\n $query = Input::get('title');\n\n if (!$query) {\n return Redirect::back();\n }\n\n $results = [];\n $response = Tmdb::getSearchApi()->searchMovies($query);\n $num_of_pages = $response['total_pages'];\n\n if ($num_of_pag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END function test_formEmail provide_formEmail() Provides data to use for testing the formEmail method of the Rx_View_Helper_FormEmail class
public function provide_formEmail ( ) { return array( 'simple test' => array( 'expected' => '<input type="email" name="test_name" id="test_name" value="test-value" class=" input email" />', 'name' => 'test_name', 'value' => 'test-value', ), 'disabled attribute test' => array( 'expected' => '<input type="email" name="test_name" id="test_name" value="test-value" disabled="disabled" class=" input email" />', 'name' => 'test_name', 'value' => 'test-value', array( 'disable' => true, ) ), ); }
[ "public function validEmailValidDataProvider() {}", "function testEmailFieldPopulation() {\n\n\t\t$this->get('EmailFieldTest_Controller');\n\t\t$this->submitForm('Form_Form', null, array(\n\t\t\t'Email' => 'test@test.com'\n\t\t));\n\n\t\t$this->assertPartialMatchBySelector('p.good',array(\n\t\t\t'Test save was su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the metricType property value. The user experience analytics metric type.
public function setMetricType(?string $value): void { $this->getBackingStore()->set('metricType', $value); }
[ "public function setMetricClass($type, $class)\n {\n $this->metricClasses[$type] = $class;\n }", "public function setAnomalyType(?UserExperienceAnalyticsAnomalyType $value): void {\n $this->getBackingStore()->set('anomalyType', $value);\n }", "public function getMetricsType()\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets query for [[MstStatus]].
public function getMstStatus() { return $this->hasOne(MstStatus::className(), ['id' => 'mst_status_id']); }
[ "public function getStatus()\n {\n return $this->queryStatus;\n }", "public function get_mms_status()\n {\n if ($this->_mms_status && is_array($this->_mms_status)) {\n return $this->_mms_status;\n } else {\n return FALSE;\n }\n }", "public function getStatus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the native translation of greaterThan token.
public function greaterThan(TokenConditionGreaterThan $token, TokenBase $previous = null) { return "`{$token->property}` > '{$token->value}'"; }
[ "public static function greater() { return self::$gt; }", "function gt($value)\n{\n return new Expr\\Expression('%s > ?', [$value]);\n}", "public function greaterThanOrEquals(TokenConditionGreaterThanOrEquals $token, TokenBase $previous = null) {\n\t\treturn \"\\t{$token->property} >= {$token->value}\";\n\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the value of segni_taglio
public function getSegni_taglio() { return $this->segni_taglio; }
[ "public function get_tag();", "public function setSegni_taglio($segni_taglio)\n {\n $this->segni_taglio = $segni_taglio;\n\n return $this;\n }", "function tag()\n {\n return di()->get('tag');\n }", "public function getTag()\n {\n return $this-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Links tag to the note
public function linkTag($tag) { if (empty($tag)) return false; $tagInstance = Tag::findByName($tag); if (is_null($tagInstance)) $tagInstance = Tag::createNew($tag); $connection = \Yii::$app->db; $connection->createCommand()->insert('note_tag', array( 'note_id' => $this->id, 'tag_id' => $tagInstance->id ))->execute(); }
[ "function get_tag_link($tag)\n {\n }", "function dbt_the_LinkTag($text=\"Bookmark on del.icio.us\",$attr=\"\") {\r\n\t\tglobal $post;\r\n\t\tif($post && is_object($post) && $post->ID>0) {\r\n\t\t\tdbt_addJavaScript();\r\n\t\t\techo \"<a href=\\\"#\\\" onclick=\\\"return dbt_bookmark('\" . get_permalink($pos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler: _copyMultiple If multiple arrays are passed as arguments mulitple will be returned. Otherwise _copy is used.
private static function _copyMultiple($function, $args) { $function(...$args); $arrays = []; foreach ($args as $arg) { if (is_array($arg)) { $arrays[] = $arg; } } if (count($arrays) === 1) { return $arrays[0]; } return $arrays; }
[ "public static function batchCopy() {\n $result = array();\n $copied = lC_Products_Admin::batchCopy($_GET['batch'], $_GET['new_category_id'], $_GET['copy_as']);\n if ($copied) {\n $result['rpcStatus'] = RPC_STATUS_SUCCESS;\n }\n\n echo json_encode($result);\n }", "public function copy($ids);"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test for new lines removal.
public function testNewLines() { $this->assertEquals('testnewlines', $this->getSlugger()->slugify("test\nnew\rlines\n\r")); }
[ "function line_endings_cleanup() {\n\tglobal $fcontents;\n\n\t$ct = preg_match(\"/\\r\\n(\\r\\n)+/\", $fcontents);\n\t$ct += preg_match(\"/\\r\\r+/\", $fcontents);\n\t$ct += preg_match(\"/\\n\\n+/\", $fcontents);\n\tif ($ct>0) {\n\t\t$fcontents = preg_replace(array(\"/(\\r\\n)+/\", \"/\\r+/\", \"/\\n+/\"), array(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve home_enabled in json format
public function get_home() { $obj = new View(); if (! $this->authorized()) { $obj->view('json', array('msg' => 'Not authorized')); return; } $queryobj = new Icloud_model(); $sql = "SELECT COUNT(1) as total, COUNT(CASE WHEN `home_enabled` = 1 THEN 1 END) AS 'yes', COUNT(CASE WHEN `home_enabled` = 0 THEN 1 END) AS 'no' from icloud LEFT JOIN reportdata USING (serial_number) WHERE ".get_machine_group_filter(''); $obj->view('json', array('msg' => current($queryobj->query($sql)))); }
[ "function getEnabled() {\n\t\treturn $this->getData('enabled');\n\t}", "public function get_vnc_enabled()\n {\n $obj = new View();\n if (! $this->authorized()) {\n $obj->view('json', array('msg' => 'Not authorized'));\n return;\n }\n \n $queryobj = new Ard_mod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if bcmath extension is loaded
public function checkBcMath() { return extension_loaded('bcmath') ? 2 : 1; }
[ "public static function isBcMathAvailable()\n {\n return extension_loaded(static::EXTENSION_BCMATH);\n }", "static protected function _useBCMath()\n {\n if (!function_exists('bccomp')) {\n throw new \\LogicException('BC Math extension currently is required', 1405066207);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Category widget for unresolved / resolved posts
function jl_unresolved_posts_cat_register_widget() { register_widget( 'jl_unresolved_posts_cat_widget' ); }
[ "private function getPostCategory()\n\t{\n\t\t$default_category=$this->pluginOptions['default_category'];\n\n\t\t$this->categoriesStringToArray();\n\n\t\t$categories=$this->feed_item->categories;\n\n\t\t$this->feed_item->category=$default_category;\n\n\t\tif(count($categories)==0&&count($this->feed->categories_arra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get specific employee data by his Desktime email.
public function getEmployeeByEmail($email) { $result = new \stdClass(); $result->pass = FALSE; $all_employees = $this->all(); if (($all_employees->pass) && isset($all_employees->body->employees)) { $employees = reset($all_employees->body->employees); if (count($employees) > 0) { foreach ($employees as $employee) { if ($email == $employee->email) { $result->pass = TRUE; $result->data = $employee; break; } } } } return $result; }
[ "public function getEmployeeByEmail(Request $request) \n {\n $employee = Employees::getEmployeeByEmail($request->input('email'));\n $employee = $this->generateEmployeeData($employee); \n\n return $employee;\n }", "public function getEmployeeByEmail($email){\n\t\t\n\t\t$this-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the [podtdesc2] column value.
public function getPodtdesc2() { return $this->podtdesc2; }
[ "public function getDesc2()\n {\n return $this->desc2;\n }", "public function getOedtdesc2()\n {\n return $this->oedtdesc2;\n }", "public function getPodtdesc1()\n {\n return $this->podtdesc1;\n }", "public function getOedhdesc2()\n {\n return $this->oedhdesc2;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renders a closing option group tag
public static function renderOptionGroupClose(){ self::out( self::closeTag('optgroup') ); }
[ "protected function endOptgroup()\n {\n $this->html .= $this->indent(1, \"</optgroup>\");\n $this->optlevel -= 1;\n }", "public function end_el(&$output, $item, $depth){\n $output .= \"</option>\\n\";\n }", "public function end_el(&$output, $item, $depth = 0, $args = array()){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter for deleted files.
public function getDeletedFiles(): Collection { return $this->files->filter(function (File $file) { return $file->getStatus() === File::FILE_DELETED; }); }
[ "public function _get_deleted() {\n\t\treturn $this->_deleted;\n\t}", "public function get_deleted()\n {\n return $this->deleted;\n }", "public function getDeleted()\n {\n return $this->deleted;\n }", "public function getdeleted()\n {\n return $this->deleted;\n }", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get country by ip
function get_country_by_ip($user_ip='') { if ($user_ip) { // Запрос на получение страны по IP $url = "http://ip-to-country.webhosting.info/node/view/36"; $ch = @curl_init(); curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, "ip_address=$user_ip&submit=Find+Country"); // add POST fields $result = curl_exec($ch); // run the whole process curl_close($ch); preg_match("/IP Address(.*?)belongs to(.*?)\./i", $result, $matches); if (strlen($matches[2])>0) { $matches[2]=strip_tags($matches[2]); if (!ereg('Dont', $matches[2])) $country=$matches[2]; else $country="Unknown"; } else $country="Unknown"; return trim($country); } else return; }
[ "public function getCountryForIp(string $ip) : IpInfo;", "function skyGetCountry($ip=''){\n\tglobal $getCountryByIpClass;\n\tif(!$ip)\n\t\t$ip=$_SERVER['REMOTE_ADDR'];\n\t$getCountryByIpClass->set_ip($ip);\n\t$getCountryByIpClass->dist_ip();\n\t$getCountryByIpClass->count_ip();\n\t$info = $getCountryByIpClass->se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests the setCpteCollectifFrn() method.
public function testSetCpteCollectifFrn() { $obj = new Constantes(); $obj->setCpteCollectifFrn("cpteCollectifFrn"); $this->assertEquals("cpteCollectifFrn", $obj->getCpteCollectifFrn()); }
[ "public function testSetCollectif() {\n\n $obj = new Clients();\n\n $obj->setCollectif(\"collectif\");\n $this->assertEquals(\"collectif\", $obj->getCollectif());\n }", "public function testSetNumCptCollectif() {\n\n $obj = new Clients();\n\n $obj->setNumCptCollectif(\"numCpt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the list of KYC documents for the contractor record.
public function kycDocuments() { return $this->hasMany(KycDocument::class); }
[ "public function documents()\n {\n return $this->hasMany(KycDocuments::class, 'kyc_verification_id');\n }", "function getdocuments($ClientID){\n $table = TableRegistry::get(\"documents\");\n return $table->find('all', array('conditions' => array('client_id'=>$ClientID)));\n }", "pu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sanitize the value by replacing special chars with their html unicode equivalent
protected function sanitizeHtmlencode($value) { return filter_var($value, FILTER_SANITIZE_SPECIAL_CHARS); }
[ "function replace_special_characters($value)\n {\n // Detecta a codificação da string.\n $originalEncode = mb_detect_encoding($value);\n\n // Resgata os caracteres que serão substituídos.\n $toSearch = config('constant.specialCharacter.search');\n $toReplace = config('constant....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
17