hakuna matata

Рейтинг
223
Регистрация
14.01.2012
Danforth:
Because the Go no ported re2. It will be free time -'ll dig.

No, I made a mistake and thought that he was there.

Actually I'm surprised about the go, "I thought to be much better than all" (c).

And at the same time advise on what spamilku write. The task - just send 1 post request and parse the response. Now I send via php-curl, ceto is already at 5k flows eats percent and memory (I generally every request - 1 process php-cli, know what's funny). I wrote above that are not a programmer, I think that's something to read, but do not know that :) node or the second?

I can certainly nakostylit something in php to guzzle, but it is interesting to listen to your advice.

danforth:
быстрый язык в одних задачах не всегда быстр в других.

А тебе не сложно сейчас взять re2 для твоего go кода и проверить еще раз? Я прост смотрю и не вижу особой разницы в скорости с pcre :)

Danforth:
fast language in some tasks are not always quick in the other.

And you do not take re2 difficult now to go your code, and check again? I just look at it and do not see much of a difference in speed with pcre :)

danforth:
Почему не согласны?

Потому что надо брать не простую строку в 50 символов, а что-то большее;

дальше стер, потому что я не программист и спорить лень.

---------- Добавлено 15.06.2020 в 21:51 ----------

danforth:
Тут не в сотый,

Тут не в сотый, а на условном SO в сотый. Высосали задачу из пальца и пишете новое решение, хотя все давно написано и либы давно есть.

Если уж совсем прямо, то у sly32 бомбануло от уровня этого раздела форума (что логично, учитывая двух долбоебов sevlad и sitealert) и он решил начать меряться кодом. Но я думаю (да вы и сами знаете), что это не тот форум для такого уровня.

Danforth:
Why do not you agree?

Because it is necessary to take not a single line of 50 characters, and something more;

further erased, because I am not a programmer and argue laziness.

---------- Posted 15.06.2020 at 21:51 ----------

Danforth:
It's not the hundredth,

It's not the hundredth, and conditional SO hundredth. Sucked from the finger task and write a new solution, but all have been written for a long time there, and libs.

If we are really straight, then sly32 bombanulo the level of this forum section (which is logical, given the two dunce sevlad and sitealert) and he decided to start code to be measured. But I think (yes you and know) that this is not the forum for such a level.

danforth, не совсем согласен с бенчмарками, но спасибо за объяснение. Вообще я не поклонник таких тредов тут, это показательное решение синтетических задач которое в реальности работает иначе.

Ну и зачем вы в сотый раз меряетесь потоковым парсером json, тоже не понимаю.

Danforth, not quite agree with the benchmarks, but thanks for the explanation. Generally I'm not a fan of these threads of here, this is indicative of synthetic solution of problems which, in reality, works differently.

Well, why are you for the hundredth time to measure a streaming parser json, I do not understand.

danforth:
например регулярки в PHP быстрее чем в Go

Если что, я не докапываюсь, но это как? Точнее, какие библиотеки сравнивались? Не верю :)

В php видимо PCRE (или PCRE2?), а в go?

Danforth:
eg regular season in PHP faster than Go

If I do not get to the bottom, but it's like? More precisely, what compared libraries? I do not believe :)

In php apparently PCRE (or PCRE2?), And go?

sparsame:
спасибо! пока не получается custom_field, но спасибо за направление.

Смотри, сейчас взял с рабочего постера по xmlrpc, добавил твоё кастом поле:

<?xml version="1.0"?>

<methodCall>
<methodName>metaWeblog.newPost</methodName>
<params>
<param><value><array><data>
<value><int>0</int></value>
<value><string>admin</string></value>
<value><string>passwd</string></value>
<value><struct>
<member><name>title</name><value><string>hello world title2</string></value></member>
<member><name>description</name><value><string>hello world body2</string></value></member>
<member><name>dateCreated</name><value><dateTime.iso8601>20200615T14:18:04</dateTime.iso8601></value></member>
<member><name>mt_allow_comments</name><value><int>0</int></value></member>
<member><name>mt_allow_pings</name><value><int>0</int></value></member>
<member><name>post_type</name><value><string>post</string></value></member>
<member><name>custom_fields</name><value><array><data>
<value><struct>
<member><name>key</name><value><string>thumbnail_external</string></value></member>
<member><name>value</name><value><string>https://my_site/image.jpg</string></value></member>
</struct></value>
</data></array></value></member>
</struct></value>
<value><boolean>1</boolean></value>
</data></array></value></param>
</params></methodCall>

Формируется так:

$date = new IXR_Date(time());                          


$postData = [ 'title' => 'hello world title2',
'description' => 'hello world body2',
'dateCreated' => $date,
'mt_allow_comments' => 0,
'mt_allow_pings' => 0,
'post_type' => 'post',
'custom_fields' => [ [ 'key' => 'thumbnail_external',
'value' => 'https://my_site/image.jpg',
]
]
];


$client = new WP_HTTP_IXR_CLIENT( $url);
$client->debug = false;

if (!$client->query('metaWeblog.newPost', array(0, $login, $passwd, $postData, true))) {
echo "err: " . $client->getErrorMessage() . "\t";
return null;
}


---------- Добавлено 15.06.2020 в 17:38 ----------

sparsame:
- по ID записи добавляю в БД запись нужного url.

Если вдруг хочется делать именно так (непонятно, зачем), можно через wp-cli еще:

usage: wp post meta add <id> <key> [<value>] [--format=<format>]
or: wp post meta delete <id> [<key>] [<value>] [--all]
or: wp post meta get <id> <key> [--format=<format>]
or: wp post meta list <id> [--keys=<keys>] [--fields=<fields>] [--format=<format>] [--orderby=<fields>] [--order=<order>] [--unserialize]
or: wp post meta patch <action> <id> <key> <key-path>... [<value>] [--format=<format>]
or: wp post meta pluck <id> <key> <key-path>... [--format=<format>]
or: wp post meta update <id> <key> [<value>] [--format=<format>]
Всего: 2166