Using %s in C correctly – very basic level

For both *printf and *scanf, %s expects the corresponding argument to be of type char *, and for scanf, it had better point to a writable buffer (i.e., not a string literal). Using %s in scanf without an explcit field width opens the same buffer overflow exploit that gets did; namely, if there are more characters in the input stream than the target buffer is sized to hold, scanf will … Read more

Categories C Tags

mongoError: Topology was destroyed

It seems to mean your node server’s connection to your MongoDB instance was interrupted while it was trying to write to it. Take a look at the Mongo source code that generates that error This does not appear to be related to the Sails issue cited in the comments, as no upgrades were installed to precipitate … Read more

What is DOM element?

Document object model.The DOM is the way Javascript sees its containing pages’ data. It is an object that includes how the HTML/XHTML/XML is formatted, as well as the browser state. A DOM element is something like a DIV, HTML, BODY element on a page. You can add classes to all of these using CSS, or interact … Read more

ASP.NET 5 MVC: unable to connect to web server ‘IIS Express’

What I’m doing: Opening Visual Studio Community 2015 File -> New -> Project Under Visual C#: Web -> ASP.NET Web Application Web Application And press f5 for the popup error “unable to connect to web server ‘IIS Express’.“ Deleting applicationhost.config, located in Documents\IISExpress\config, doesn’t change the error message. (There’s also an IISExpress folder in program files and program files (x86).) Something I … Read more

pretty-print JSON using JavaScript

Pretty-printing is implemented natively in JSON.stringify(). The third argument enables pretty printing and sets the spacing to use: If you need syntax highlighting, you might use some regex magic like so: See in action here: jsfiddle Or a full snippet provided below: Show code snippet