The import org.junit cannot be resolved

You need to add junit library to the classpath of your project. There are several choices to achieve it depending on your development setup. Command line: In the case of command line invocations, you will have to add junit.jar to the classpath of your application with java -cp /path/to/junit.jar. Take a look at the answers here. Using eclipse: Eclipse distributions are … Read more

“for loop” with two variables?

If you want the effect of a nested for loop, use: If you just want to loop simultaneously, use: Note that if x and y are not the same length, zip will truncate to the shortest list. As @abarnert pointed out, if you don’t want to truncate to the shortest list, you could use itertools.zip_longest. UPDATE Based on the request for “a … Read more

How to copy/select a whole file or buffer in Emacs?

C-x h will select the entire buffer. You can search for help within Emacs using the built-in help system. C-h f will look for help for specific functions. In this case, you could have searched for whole-buffer to find mark-whole-buffer. Other help commands of interest would be: C-h m to show available commands for the current modes C-h v for help related … Read more

What is the .git folder?

.git is initialized by git init. .git contains all information required for version control. If you want to clone your repo, copy .git is enough. 4 sub-directories: hooks/ : example scripts info/ : exclude file for ignored patterns objects/ : all “objects” refs/ : pointers to commit objects 4 files: HEAD : current branch config : configuration options … Read more

Regex difference: (\w+)? and (\w*)

(\w+)? and (\w*) both match the same (0..+inf word characters) However, there is a slight difference: In the first case, if this part of the regex matches “”, the capturing group is absent. In the second case, it is empty. In some languages, the former manifests as a null while the latter should always be “”. In Javascript, for example, In PHP … Read more

The difference between \n and
in php

<br /> is a HTML line-break, whereas \n is a newline character in the source code. In other words, <br /> will make a new line when you view the page as rendered HTML, whereas \n will make a new line when you view the source code. Alternatively, if you’re outputting to a console rather than somewhere that will be … Read more