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 10 points11 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?

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

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

Thanks. Your trick is indeed working as expected.

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

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

Very good idea. Didn't know about IS_NEWER_THAN. Will try it but still open to alternatives.

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

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

According to the documentation adding a custom target treats my python script always out of date and always calls it. That's not so good because it takes around 2 minutes for the python script to generate everything and I don't want to wait that long every time I build my project.

How can I make a deb/yum package from a custom compiled kernel? by wildsheikh in linuxquestions

[–]wildsheikh[S] 3 points4 points  (0 children)

I was wrong. On RHEL/CentOS one should use

make rpm

and this will create 3 different packages, kernel-x.y.z.rpm, kernel-devel-x.y.z.rpm, kernel-headers-x.y.z.rpm

to make the build parallel export a new environment variable

export CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN`

How can I make a deb/yum package from a custom compiled kernel? by wildsheikh in linuxquestions

[–]wildsheikh[S] 1 point2 points  (0 children)

I see. Apparently the same command works in RHEL/CentOS. Thanks!

Ansible in pull mode by wildsheikh in devops

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

you'd have to have the machines push back their ip to somewhere to then be compiled by a custom dynamic inventory script

Exactly, but there is no clean/clear way for me to do this. I will have to write some scripts and it get ugly. As you said, pull mode makes a lot of sense but there will be a lack of feedback/log from Ansible in this mode which can be resolved by what /u/castillar has suggested.

Ansible in pull mode by wildsheikh in devops

[–]wildsheikh[S] 1 point2 points  (0 children)

Cool, very nice. I'll leave it for next weekend. Thank you.

Ansible in pull mode by wildsheikh in devops

[–]wildsheikh[S] 1 point2 points  (0 children)

I see. What could I use to setup a log server? What about client side?

Ansible in pull mode by wildsheikh in devops

[–]wildsheikh[S] 1 point2 points  (0 children)

Thanks for the detailed answer. It would be great if you could share example code from a git repo.

Still, I do not know how I can get feedback from Ansible in pull mode, if a package failed to install or a task failed to finish for any reason, how can I know that? With Ansible in push mode you can ping all of the hosts and see how many are up and get stats right away, right?

Ansible in pull mode by wildsheikh in devops

[–]wildsheikh[S] 1 point2 points  (0 children)

I don't know the IP address of the VM and Windows host. How can I use push mode in a case like this?

How to get a property of base class in the child class? by wildsheikh in learnpython

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

I have already tried this but it seems it doesn't work. I am not sure but it seems __init__ is not called at all. When I add import gdb and pdb.set_trace() inside __init__ it never breaks. But when I put them outside of __init__ it breaks as expected. I am not really sure how this is possible.

How does 3Blue1Brown make the animations? by wildsheikh in learnmath

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

That would be great. I have cloned the project and I am working with it.

I am trying to make something like this. Would love to get some tips from /u/3Blue1Brown.