What does ‘\0’ mean?

C++ std::strings are “counted” strings – i.e., their length is stored as an integer, and they can contain any character. When you replace the third character with a \0 nothing special happens – it’s printed as if it was any other character (in particular, your console simply ignores it). In the last line, instead, you are printing a … Read more

Session TimeOut in web.xml

To set a session-timeout that never expires is not desirable because you would be reliable on the user to push the logout-button every time he’s finished to prevent your server of too much load (depending on the amount of users and the hardware). Additionaly there are some security issues you might run into you would … Read more

What’s the difference between git switch and git checkout

Well, according to the documentation you link to, its sole purpose is to split and clarify the two different uses of git checkout: git switch can now be used to change branches, as git checkout <branchname> does git restore can be used to reset files to certain revisions, as git checkout –<path_to_file> does People are confused by these different ways to use git … Read more

NS_BINDING_ABORTED Shown in Firefox with HttpFox

Because your server is not sending HTTP Expires headers, the browser is checking to see if what is in its cache is current. The way it does this is to send the server a request saying what the date of what it has in the cache is, and the server is sending 304 status telling … Read more

NS_BINDING_ABORTED Shown in Firefox with HttpFox

Because your server is not sending HTTP Expires headers, the browser is checking to see if what is in its cache is current. The way it does this is to send the server a request saying what the date of what it has in the cache is, and the server is sending 304 status telling … Read more

C++ network programming

To understand sockets and use them right, you need The Sockets Bible: W. Richard Stevens, Unix Network Programming, Volume 1: The Sockets Networking API (3rd Edition) You absolutely must have this book before you sit down to write a line of sockets code. Don’t leave home without it. Really. Starting around $35 used at Amazon. EDIT: The OP asked about … Read more

How do I delete a local repository in git?

Delete the .git directory in the root-directory of your repository if you only want to delete the git-related information (branches, versions). If you want to delete everything (git-data, code, etc), just delete the whole directory. .git directories are hidden by default, so you’ll need to be able to view hidden files to delete it.

Reading from text file until EOF repeats last line

Just follow closely the chain of events. Grab 10 Grab 20 Grab 30 Grab EOF Look at the second-to-last iteration. You grabbed 30, then carried on to check for EOF. You haven’t reached EOF because the EOF mark hasn’t been read yet (“binarically” speaking, its conceptual location is just after the 30 line). Therefore you … Read more

Converting a C program to MIPS

Currently you’re generating code for x86-64 – you need to select a MIPS compiler from the popup menu above the assembly pane: After you’ve done that you’ll probably see generated code like this: Note that the compiler has optimised away some of the redundant operations in the original C code. If you want to see an … Read more