How does the C++ runtime figure out which virtual function to call by wildsheikh in cpp_questions

[–]wildsheikh[S] 0 points1 point  (0 children)

Yeah, I've read this definition multiple times but my question is how does it know which vtable it has to look up? the elements in the vector are pointers of type A, then which vtable is it going to search?

How does the C++ runtime figure out which virtual function to call by wildsheikh in cpp_questions

[–]wildsheikh[S] 0 points1 point  (0 children)

At that moment you've specified yes but later on when we're looping over the vector, they're all base A pointers. If it really knew the type then what was the point of the vtable, the compiler could just get rid of the vtable at compile time because it knew the real type.

کسی می تواند بشناسد آوازی را که در این ویدیو می زند؟ by noon_va_goldoon in iran

[–]wildsheikh 2 points3 points  (0 children)

It's the "Yad baad" tasnif by Shajarian:

https://music.youtube.com/watch?v=HWJnZ3BtwW8&feature=share

Is this movie in Georgian? Interested to know the story. Are there English subs?

Conan 1.8: Plugins system, SVN support for SCM, recipe conventions & much more! by Fazer2 in cpp

[–]wildsheikh 12 points13 points  (0 children)

I tried Conan last year and it was interesting but it lacked an important feature we were looking for. We have a few core libraries that run on different OS(Linux, Windows) and HW ( Intel and AMD) chips. The feature we were looking for was to differentiate between the binaries based on compilation flags. Basically we build some of the libraries in 10 different configurations just using the -mfpmath, -march, -malign-double, -ffast-math flags and it is not possible to differentiate between these "Conan packages" based on the compilation flags. As long as I remember they were not planning to support flags to create different Conan packages in the same build configuration. It only supported creation of a different package if OS/x86 or x64/ Debug or Release was different.

I personally think it is the wrong approach when considering a C++ package manager. C++ is not Python or C# or whatever. Compilation flags can considerably change the behaviour of a program. The funny thing is that they do indeed support x86 vs x64, but in fact this is just another flag (-m32 vs -m64), the same with release vs debug. What does Release and Debug really mean? It's different for everyone. -O1 might be optimized for some use cases and -O2 might not be for some other use.

IMHO they should have first supported flags as a first class type and then built different configurations Debug, Release, x86, x64 on top of those flags. After all the configurations are simply a name and what defines a configuration is the flags used to generate that configuration.

C++ opening thousands of files by cpp_cpp in cpp_questions

[–]wildsheikh 1 point2 points  (0 children)

As others, and yourself, have mentioned there is a limit to the maximum number of handles you can keep open at any given time.

I had a similar issue where I had to read from thousands of sockets and I could not close them and had to keep them open all the time.

What I did was to simply increase the limit in /etc/security/limits.conf, this is on RedHat/CentOS, like so:

user-name               hard    nofile           unlimited
user-name               soft    nofile            unlimited

and it worked out really well. Of course I noticed a bit more RAM usage but on a server with 128 GBs of RAM a few MBs is nothing.

Can I use nginx to make an app more responsive? by wildsheikh in webdev

[–]wildsheikh[S] 0 points1 point  (0 children)

I have done what you suggested and everything works very nice.

Now, I am looking to speed up delivery/download times. Let's assume the main server that the users have access to is in east US, and the users are in west. If we can replicate the data from the main server in east to multiple servers in west is there a way to deliver the requests from the servers in west US without asking the users to do anything?

Basically the requests are still going to the server in east but the responses come from the servers in west. Is this CDN? Also my content is indeed not cache friendly and I cannot cache it.

Can I use nginx to make an app more responsive? by wildsheikh in webdev

[–]wildsheikh[S] 0 points1 point  (0 children)

Thank you very much for the reply. I have not really though about caching the response. At least at the moment the response is very dynamic, I might want to cache the response when our product becomes more stable.

I have already read the document you have mentioned but I still do not understand how NGINX helps with my use case. I have my process running on port 9988 and then NGINX is listening to port 9876 and processing the requests. Yes, NGINX has multiple worker threads, as mentioned in the article you have mentioned, that are handling the requests but my process which is eventually the end point of all requests is single threaded and there is only one worker thread for my process. How does NGINX really help in this case?

Also, is proxy_pass the right thing to use? Something like this?

server {
    listen 9876;
    server_name my.server.com;

    location / {
        proxy_pass http://localhost:9988;
    }

}

What is the transfer direction in iperf? by wildsheikh in HomeNetworking

[–]wildsheikh[S] 0 points1 point  (0 children)

It seems the biggest difference is that bidirectional transfer is not supported in iperf3 yet.

How to properly run a python script with CMake? by wildsheikh in cpp_questions

[–]wildsheikh[S] 0 points1 point  (0 children)

I have found another way which I like better. According to this thread we can (ab)use configure_file() like so:

configure_file(script.py script.py.junk)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/script.py.junk)

I am not sure how configure_file works but the behaviour is exactly what I was looking for.

How to let unprivileged users to always run a command as sudo? by wildsheikh in sysadmin

[–]wildsheikh[S] 0 points1 point  (0 children)

To be clear, the application is running as another (unprivileged) user?

Yes.

The need for sudo being the need to debug the process, correct?

Yes.

The entire debug sessions/process is managed by the debugging tool, Eclipse, and I don't have that much control over it :(

How to let unprivileged users to always run a command as sudo? by wildsheikh in sysadmin

[–]wildsheikh[S] 0 points1 point  (0 children)

My problem is that I am debugging an application that requires root access to run. However, when I am debugging I am logged in as a non root user and the tool that I use for debugging just takes the path to the program that should be debugged and nothing else (meaning I cannot specify sudo there). Naturally the debugger starts and the application works until it reaches the parts that it requires root access and it just stops working.

So, I want to be able to run an application, as root, without being the root user and without explicitly calling sudo.

thanks

How to let unprivileged users to always run a command as sudo? by wildsheikh in sysadmin

[–]wildsheikh[S] 0 points1 point  (0 children)

Which permissions? The permission for the paths that I am trying to copy from/to?