What is the convention in JSON for empty vs. null?

It is good programming practice to return an empty array [] if the expected return type is an array. This makes sure that the receiver of the json can treat the value as an array immediately without having to first check for null. It’s the same way with empty objects using open-closed braces {}. Strings, Booleans and integers … Read more

Use of “this” keyword in C++

Yes, it is not required and is usually omitted. It might be required for accessing variables after they have been overridden in the scope though: Also, this: It is pretty bad style; if you need an initializer with the same name use this notation: More info here: https://en.cppreference.com/w/cpp/language/initializer_list

mount: nfs access denied by server

Am trying to mount a NFS device in my linux machine. My /etc/fstab is like this, 192.168.0.5:/volume2/Asterisk_Recordings /var/spool/newnfs nfs rsize=32768,wsize=32768,intr,noatime 1 0 My /etc/mtab is like this, 192.168.0.5:/volume2/Asterisk_Recordings /var/spool/newnfs nfs rw,addr=192.168.0.5 0 0 I have enabled NFS in my NAS device. When i type mount ” mount -t nfs -v 192.168.0.5:/volume2/Asterisk_Recordings /var/spool/newnfs/” I get like … Read more

What does “\r” do in the following script?

The ‘\r’ character is the carriage return, and the carriage return-newline pair is both needed for newline in a network virtual terminal session. From the old telnet specification (RFC 854) (page 11): The sequence “CR LF”, as defined, will cause the NVT to be positioned at the left margin of the next print line (as would, for example, the … Read more

What does “<<" and ">>” mean in C++ for cout/cin?

It depends on how you overload it for you class. In case of std::cout, << is used to write to standard output. >> is not overloaded for std::cout. So std::cout >> x would give compilation error. In case of std::cin,>> is used to read from standard input. << is not overloaded for std::cin. So std::cin << x would give compilation error. For your custom class, you can overload << or >>, or both, … Read more

pygame.error: video system not initialized

You should stop your main loop when you want to exit the game. My suggestions, either of call exit() after pygame.quit() set finish = True and start = False (though due to some indentation issues with your pasted code it’s not possible to tell that this would actually work) You should call pygame.quit() only when you want to terminate your Python session. My suggestion: … Read more