Ludovic 'Archivist'
Actually no, it's end of the first gen
~
Ahh cant send :(
Ludovic 'Archivist'
dm it to me
Ludovic 'Archivist'
I have references for dynamic data from database, here .Net is higher than drogon, although the .Net code is not a code a common .Net dev will write :( but this can be a reference in case you may want to squeeze every bit of performance of .Net
https://www.techempower.com/benchmarks/#section=data-r23&test=query
Ludovic 'Archivist'
Ahh cant send :(
The code written for drogon was extremelly convoluted, and used features of drogon that I would never use for their performance cost
Ludovic 'Archivist'
It was basically running on mostly one core because of that
Ludovic 'Archivist'
Ludovic 'Archivist'
Ludovic 'Archivist'
If there is one thing I pray C++ reflection will solve it is this shit: shitty ORMs
~
Umm may you explain more about the expensive content-type? Because in the code, he uses HttpResponse::newHttpJsonResponse() to set the content type which is the same as the one in the official drogon repo
~
There are 2 versions of Drogon tested there, one without orm and the other with orm. In the multi queries page, ctrl f and type drogon you should see 2 versions of Drogon, Drogon core (no orm), just Drogon (orm)
Ludovic 'Archivist'
Chat Boss
Both use the ORM, the core just uses a less weird version of the ORM that is faster
~ sent a code, it has been re-uploaded as a quote
Umm have you checked the controller DbCtrlRaw.cc, I don't find drogon orm method here
#include "DbCtrlRaw.h"
#include "World_raw.h"
#include <drogon/utils/Utilities.h>
#include <stdlib.h>
#include <thread>
#include <time.h>
void DbCtrlRaw::asyncHandleHttpRequest(
const HttpRequestPtr &req,
std::function<void(const HttpResponsePtr &)> &&callback)
{
// write your application logic here
static std::once_flag once;
std::call_once(once, []() { srand(time(NULL)); });
if (!*_dbClient)
{
*_dbClient = drogon::app().getFastDbClient();
}
int id = rand() % 10000 + 1;
auto callbackPtr =
std::make_shared<std::function<void(const HttpResponsePtr &)>>(
std::move(callback));
**_dbClient << "select * from world where id=$1" << id >>
[callbackPtr](const Result &rows) {
if (rows.size() == 1)
{
auto obj = World(rows[0]);
(*callbackPtr)(HttpResponse::newHttpJsonResponse(obj.toJson()));
}
else
{
Json::Value json{};
json["code"] = 0;
json["message"] = "Internal error";
(*callbackPtr)(
HttpResponse::newHttpJsonResponse(std::move(json)));
}
} >>
[callbackPtr](const DrogonDbException &err) {
Json::Value json{};
json["code"] = 1;
json["message"] = err.base().what();
(*callbackPtr)(HttpResponse::newHttpJsonResponse(std::move(json)));
};
}
Ludovic 'Archivist'
Aditya Pattewar
Hi I am new in c++ please help me
Zeth
Zeth
#meta
Rose
#meta
Don't ask meta questions. In other words, don't ask to ask. Questions like "Does anyone know XYZ?", "Has anyone used XYZ?" or "Can someone help me?" are all considered meta questions because they don't specify what your actual problem is.
These questions give the impression that you want people to approach you and offer their help as if they don't have any other work to do. Now doesn't that expectation make you look like an idiot?
If you have a question ask it directly. You are more likely to get a response that way.
Ludovic 'Archivist'
Cayetano
CodeBy
Help me understanding pointers and recursion in C
Vlad
Vlad
We'll start from there
Vlad
Otherwise sending you mucho texto for both will not help probably
Vlad
Damn his message got deleted
Vlad
1984
Vlad
pajeets have killed our freedom of speech
Metz
Good afternoon
Cayetano
Nice! @CodeByOm feedback with your expirence... 🙏
CodeBy
What you don't understand?
Like when I have to make projects I am unable to use them I watched some videos on YouTube too but it's confusing for me like to access value in a variable by its address,I always gets struck there and make errors
Vlad
CodeBy
Especially with pointer concepts
Vlad
So here's a somewhat real world example:
typedef struct { ... } Item;
Item inventory[3];
Item* currentItem = NULL;
void input(...)
{
if(keyPressed(KEY_1))
currentItem = &inventory[0];
if(keyPressed(KEY_2))
currentItem = &inventory[1];
if(keyPressed(KEY_3))
currentItem = &inventory[2];
if(keyPressed(KEY_E))
UseItem(currentItem);
}
Vlad
Using a pointer you can bind a currently chosen item
Vlad
Without doing weird stuff like copying it over to a seperate variable
Vlad
That you should then update if its slot changes for whatever reason
CodeBy
Okayy I think I need to practice this more
CodeBy
Vlad
Yup
Pointers are similar to foreign keys
Vlad
Serve the same purpose
CodeBy
Primary can be one unique key whereas foreign keys represents a value in other table
Vlad
Pointer is your key to get the value "from the other table"
Vlad
But instead of painfully doing joins
Vlad
You can just dereference it
CodeBy
Ok I'll continue asking tomorrow morning 😃 btw thanks for letting me understand it in easier termd
Demon 918
yo i need some dev or something
salami
Huh
Demon 918
Lucifa
Never Spam Bot
Faathin is now approved by the group admin and can send messages without any restrictions
Hey guys, I recently learn futex2 API : futex_wait, futex_wait, ``futex_waitv`, and futex_requeue but I don't how to use futex_requeue and the use case of it? Can someone tell me?
See spam? Quote the spam message in the group and reply with /spam
mito
yes
and the payment is gonna be drugs yo ?
Faathin
Hey guys, I recently learn futex2 API : futex_wake, futex_wait, futex_waitv, and futex_requeue but I don't how to use futex_requeue and the use case of it? Can someone tell me?
CodeBy
Can someone tell me why is my gets(str) is not working 😭 It doesn't even shows an option to input string just directly prints . I don't want to use scanf that why I'm using it but it doesn't work
Vlad
Vlad
It's unsafe
CodeBy
Why how will I input multiple words
Vlad
CodeBy
Use fgets
I used it fgets(str) it shows error
Vlad
So if the input string is too long it would just continue writing past that
CodeBy
Okayy
Vlad
Read the docs pliz
Vlad
It needs 3 params
CodeBy
What's that stream?
Vlad
char input[256];
fgets(input, sizeof(input), stdin);
CodeBy
Like address?
Vlad
Vlad
console input is also mapped as a FILE*
CodeBy
Okay so I have a string named str[300] now ?
CodeBy
Why can't I take input from printf() command it just prints itself not asking for input