Tutorial by Examples: dir

Normally, enums can't be recursive (because they would require infinite storage): enum Tree<T> { case leaf(T) case branch(Tree<T>, Tree<T>) // error: recursive enum 'Tree<T>' is not marked 'indirect' } The indirect keyword makes the enum store its payload with...
You can make Git ignore certain files and directories — that is, exclude them from being tracked by Git — by creating one or more .gitignore files in your repository. In software projects, .gitignore typically contains a listing of files and/or directories that are generated during the build proces...
Usually, you have to use git add or git rm to add changes to the index before you can git commit them. Pass the -a or --all option to automatically add every change (to tracked files) to the index, including removals: git commit -a If you would like to also add a commit message you would do: g...
> redirect the standard output (aka STDOUT) of the current command into a file or another descriptor. These examples write the output of the ls command into the file file.txt ls >file.txt > file.txt ls The target file is created if it doesn't exists, otherwise this file is truncated. ...
< reads from its right argument and writes to its left argument. To write a file into STDIN we should read /tmp/a_file and write into STDIN i.e 0</tmp/a_file Note: Internal file descriptor defaults to 0 (STDIN) for < $ echo "b" > /tmp/list.txt $ echo "a" >> ...
File descriptors like 0 and 1 are pointers. We change what file descriptors point to with redirection. >/dev/null means 1 points to /dev/null. First we point 1 (STDOUT) to /dev/null then point 2 (STDERR) to whatever 1 points to. # STDERR is redirect to STDOUT: redirected to /dev/null, # effect...
2 is STDERR. $ echo_to_stderr 2>/dev/null # echos nothing Definitions: echo_to_stderr is a command that writes "stderr" to STDERR echo_to_stderr () { echo stderr >&2 } $ echo_to_stderr stderr
If the preprocessor encounters an #error directive, compilation is halted and the diagnostic message included is printed. #define DEBUG #ifdef DEBUG #error "Debug Builds Not Supported" #endif int main(void) { return 0; } Possible output: $ gcc error.c error.c: error: #e...
const fs = require('fs'); // Read the contents of the directory /usr/local/bin asynchronously. // The callback will be invoked once the operation has either completed // or failed. fs.readdir('/usr/local/bin', (err, files) => { // On error, show it and return if(err) return console.er...
The keyword 'using' has three flavors. Combined with keyword 'namespace' you write a 'using directive': If you don't want to write Foo:: in front of every stuff in the namespace Foo, you can use using namespace Foo; to import every single thing out of Foo. namespace Foo { void bar() {} ...
import shutil source='//192.168.1.2/Daily Reports' destination='D:\\Reports\\Today' shutil.copytree(source, destination) The destination directory must not exist already.
Branching in Subversion is very simple. In the simplest form, creating a new branch requires you to run the command against the remote repository's URLs. For example, let's create a new branch out of the mainline trunk: svn copy https://svn.example.com/svn/MyRepo/MyProject/trunk https://svn.example...
Consider this simple project with a flat directory structure: example |-- example.asd |-- functions.lisp |-- main.lisp |-- packages.lisp `-- tools.lisp The example.asd file is really just another Lisp file with little more than an ASDF-specific function call. Assuming your project depends o...
The first two arguments to format are an output stream and a control string. Basic use does not require additional arguments. Passing t as the stream writes to *standard-output*. > (format t "Basic Message") Basic Message nil That expression will write Basic Message to standard ou...
The checked out file will overwrite not yet commited changes you did in this file. This command will check out the file file.example (which is located in the directory path/to/) and overwrite any changes you might have made to this file. git checkout some-branch path/to/file some-branch can be ...
Different flavors of application builds can contain different resources. To create a flavor-specific resource make a directory with the lower-case name of your flavor in the src directory and add your resources in the same way you would normally. For example, if you had a flavour Development and w...
Directives are one of the most powerful features of angularjs. Custom angularjs directives are used to extend functionality of html by creating new html elements or custom attributes to provide certain behavior to an html tag. directive.js // Create the App module if you haven't created it yet va...
package main import ( "fmt" "io/ioutil" ) func main() { files, err := ioutil.ReadDir(".") if err != nil { panic(err) } fmt.Println("Files and folders in the current directory:") for _, fileInfo := range fi...
Success output stream: cmdlet > file # Send success output to file, overwriting existing content cmdlet >> file # Send success output to file, appending to existing content cmdlet 1>&2 # Send success and error output to error stream Error output stream: cmdlet 2&g...
It's a bad idea to hard code paths in your application. One should always use relative urls so that your code can work seamlessly across different machines. The best way to set this up is to define a variable like this import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) Then use th...

Page 1 of 13