Skip to content

Instantly share code, notes, and snippets.

Một số ảo tưởng về nghề nghiệp và lương của lập trình viên
  1. IOC (Inverse of Control) Container Or service container. In software engineering, inversion of control (IoC) describes a design in which custom-written portions of a computer program receive the flow of control from a generic, reusable library. A software architecture with this design inverts control as compared to traditional procedural programming: in traditional programming, the custom code that expresses the purpose of the program calls into reusable libraries to take care of generic tasks, but with inversion of control, it is the reusable code that calls into the custom, or task-specific, code.

  2. SQL Query Order of Execution https://www.periscopedata.com/blog/sql-query-order-of-operations

public function searchThreadES($query, $lastId, $context, $conditions = [])
{
$conditions = $this->convertJsonToAssAr($conditions);
$conditions = $this->buildInitEdgeValue($conditions);
if ($lastId == 0) {
$lastId = Thread::max('id') + 1;
} else {
$lastId = (int)$lastId;
}
[2018-09-03 16:46:29] local.INFO: Array
(
[0] => Array
(
[$match] => Array
(
[$or] => Array
(
[0] => Array
(
[2018-09-03 10:50:28] local.INFO: Array
(
[0] => Array
(
[$match] => Array
(
[$and] => Array
(
[0] => Array
(
public function findMatching($threadId, $text = '', $lastMessageId = 0, $comparison = '<', $limit = 3)
{
if ($lastMessageId == 0) {
$lastMessageId = $this->message->max('id') + 1;
}
$querySeri = [
[
'match' => [
'message' => $text,
test 6 user cocurrent, localhost, kết quả trung bình 10 lần
/* 1 */
{
"_id" : "test time addMessage user",
"value" : 257.488
}
/* 2 */
{
"_id" : "test time search keyword",
/* 1 */
{
"_id" : ObjectId("5b876ecb12d8a8dac5044d93"),
"name" : "test time addMessage",
"time" : "365ms",
"memory" : "11.25Mb",
"created_at" : ISODate("2018-08-30T04:12:59.000Z"),
"thread_id" : 458,
"updated_at" : ISODate("2018-08-30T04:12:59.000Z")
}
3,2018:08:30:10:08:10,2018:08:30:10:08:19
2,2018:08:30:10:08:10,2018:08:30:10:08:18
0,2018:08:30:10:08:12,2018:08:30:10:08:19
5,2018:08:30:10:08:13,2018:08:30:10:08:19
1,2018:08:30:10:08:13,2018:08:30:10:08:20
4,2018:08:30:10:08:14,2018:08:30:10:08:20
4,2018:08:30:10:08:09,2018:08:30:10:08:16
1,2018:08:30:10:08:09,2018:08:30:10:08:16
5,2018:08:30:10:08:10,2018:08:30:10:08:18
ysql> show variables;
+----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value |
+----------------------------------------------------------+--------------