Tutorial by Examples: dir

Now that the routes are set up, we need some way to actually change routes. This example will show how to change routes using the template, but it is possible to change routes in TypeScript. Here is one example (without binding): <a routerLink="/home">Home</a> If the user...
git clean -fd Will remove all untracked directories and the files within them. It will start at the current working directory and will iterate through all subdirectories. git clean -dn Will preview all directories that will be cleaned.
It is possible to mount a host directory to a specific path in your container using the -v or --volume command line option. The following example will mount /etc on the host to /mnt/etc in the container: (on linux) docker run -v "/etc:/mnt/etc" alpine cat /mnt/etc/passwd (on windows) do...
git difftool -t meld --dir-diff will show the working directory changes. Alternatively, git difftool -t meld --dir-diff [COMMIT_A] [COMMIT_B] will show the differences between 2 specific commits.
git diff myfile.txt Shows the changes between the previous commit of the specified file (myfile.txt) and the locally-modified version that has not yet been staged. This also works for directories: git diff documentation The above shows the changes between the previous commit of all files in ...
To ignore a file foo.txt in any directory you should just write its name: foo.txt # matches all files 'foo.txt' in any directory If you want to ignore the file only in part of the tree, you can specify the subdirectories of a specific directory with ** pattern: bar/**/foo.txt # matches all file...
You can perform redirection in Rails routes as follows: 4.0 get '/stories', to: redirect('/posts') 4.0 match "/abc" => redirect("http://example.com/abc") You can also redirect all unknown routes to a given path: 4.0 match '*path' => redirect('/'), via: :get ...
Deleting files The unlink function deletes a single file and returns whether the operation was successful. $filename = '/path/to/file.txt'; if (file_exists($filename)) { $success = unlink($filename); if (!$success) { throw new Exception("Cannot delete $filename&qu...
fs.access() determines whether a path exists and what permissions a user has to the file or directory at that path. fs.access doesn't return a result rather, if it doesn't return an error, the path exists and the user has the desired permissions. The permission modes are available as a property on ...
Due to Node's asynchronous nature, creating or using a directory by first: checking for its existence with fs.stat(), then creating or using it depending of the results of the existence check, can lead to a race condition if the folder is created between the time of the check and the time of ...
public void iterateAndFilter() throws IOException { Path dir = Paths.get("C:/foo/bar"); PathMatcher imageFileMatcher = FileSystems.getDefault().getPathMatcher( "regex:.*(?i:jpg|jpeg|png|gif|bmp|jpe|jfif)"); try (Direc...
Assuming the route: resources :users, only: [:index] You can redirect to a different URL using: class UsersController def index redirect_to "http://stackoverflow.com/" end end You can go back to the previous page the user visited using: redirect_to :back Note that i...
Use this option if you don't need an Application subclass. This is the simplest option, but this way you can't provide your own Application subclass. If an Application subclass is needed, you will have to switch to one of the other options to do so. For this option, simply specify the fully-quali...
Current file You can get the name of the current PHP file (with the absolute path) using the __FILE__ magic constant. This is most often used as a logging/debugging technique. echo "We are in the file:" , __FILE__ , "\n"; Current directory To get the absolute path to the di...
A bi-directional value converter utilizes two methods in your Value Converter class: toView and fromView these methods are aptly named to signify which direction the data is flowing. In our example we will be creating a prepend Value Converter which will make sure that an amount entered in our app ...
use lib 'includes'; use MySuperCoolModule; use lib 'includes'; adds the relative directory includes/ as another module search path in @INC. So assume that you have a module file MySyperCoolModule.pm inside includes/, which contains: package MySuperCoolModule; If you want, you can group as ma...
demoApp.directive('demoDirective', function () { var directiveDefinitionObject = { multiElement: priority: terminal: scope: {}, bindToController: {}, controller: controllerAs: require: restrict: templateNamespace: template: templateU...
First, import the libraries that work with files: from os import listdir from os.path import isfile, join, exists A helper function to read only files from a directory: def get_files(path): for file in listdir(path): full_path = join(path, file) if isfile(full_path): ...
If you need to call an Objective-C method from C code, you have two ways: using objc_msgSend, or obtaining the IMP (method implementation function pointer) and calling that. #import <objc/objc.h> @implementation Example - (double)negate:(double)value { return -value; } - (doubl...
You can redirect the debug output to a text file by adding a TextWriterTraceListener to the Debug.Listeners collection. public static void Main(string[] args) { TextWriterTraceListener myWriter = new TextWriterTraceListener(@"debug.txt"); Debug.Listeners.Add(myWriter); Deb...

Page 2 of 13