Tutorial by Examples: dir

Enabled directory index means that if someone access to any folder which don't contains index.php , index.html, index.htm or any other default file defined in DirectoryIndex in apache configuration then all files in that folder will be listed in browser if you try to visit that page. Often director...
__dir__ is not a constant but a function __dir__ is equal to File.dirname(File.realpath(__FILE__))
public void iterate(final String dirPath) throws IOException { final DirectoryStream<Path> paths = Files.newDirectoryStream(Paths.get(dirPath)); for (final Path path : paths) { if (Files.isDirectory(path)) { System.out.println(path.getFileName()); } } ...
This is a nice trick to add a link to code, so it will be easy to jump to the code that issued the log. With the following code, this call: MyLogger.logWithLink("MyTag","param="+param); Will result in: 07-26...012/com.myapp D/MyTag: MyFrag:onStart(param=3) (MyFrag.java:236...
os.mkdir('newdir') If you need to specify permissions, you can use the optional mode argument: os.mkdir('newdir', mode=0700)
Use the os.getcwd() function: print(os.getcwd())
Remove the directory at path: os.rmdir(path) You should not use os.remove() to remove a directory. That function is for files and using it on directories will result in an OSError
Given a local directory with the following contents: └── dir1 ├── subdir1 └── subdir2 We want to create the same subdir1, subdir2 under a new directory dir2, which does not exist yet. import os os.makedirs("./dir2/subdir1") os.makedirs("./dir2/subdir2") R...
Windows : for %f in (C:\your_app_path\*.apk) do adb install "%f" Linux : for f in *.apk ; do adb install "$f" ; done
To make a new directory from a File instance you would need to use one of two methods: mkdirs() or mkdir(). mkdir() - Creates the directory named by this abstract pathname. (source) mkdirs() - Creates the directory named by this abstract pathname, including any necessary but nonexistent parent d...
Redirect to within application (another action of specific controller). return $this->redirect([ 'controller' => 'myController', 'action' => 'myAction' ]); Redirect to referrer page return $this->redirect($this->referer()); Redirect to outside of application or spec...
Passing Variable in URL as a method's parameter return $this->redirect([ 'controller' => 'users', 'action' => 'profile', $id ]); Url should be looks like this http://your_app_url/users/profile/{id} in UsersController.php file in profile() method class UsersController e...
The compiler can't find a file (a source file uses #include "someFile.hpp"). qmake: INCLUDEPATH += dir/Of/File cmake: include_directories(dir/Of/File) g++ call: g++ -o main main.cpp -Idir/Of/File
$> pwd /home/myUserHome $> cd .. $> pwd /home will print the current path to the console.
To know the path of the directory your file is in you can use: Esc to enter command mode :pwd This will print the path to the directory at the bottom of the editor, like this I'm a ninja ~ ~ ~ ~ ~ /home/ubuntu/myfolder 1,5 All Now...
To print the directory stack, use the command pushd without any parameters: @echo off cd C:\example\ pushd one pushd ..\two pushd ..\.. pushd echo Current Directory: %cd% echo: popd pushd three pushd echo Current Directory: %cd% Output: C:\example\two ...
If you want to provide a URL out of convenience for your user but map it directly to another one you're already using. Use a redirect: # config/routes.rb TestApp::Application.routes.draw do get 'courses/:course_name' => redirect('/courses/%{course_name}/lessons'), :as => "course&quot...
ASP.NET Core introduces the concept of dependency injection into Views via the @inject directive via the following syntax : @inject <type> <name> Example Usage Adding this directive into your View will basically generate a property of the given type using the given name within your ...
You can use using in order to set an alias for a namespace or type. More detail can be found in here. Syntax: using <identifier> = <namespace-or-type-name>; Example: using NewType = Dictionary<string, Dictionary<string,int>>; NewType multiDictionary = new NewType(); /...
Directive code angular.module('myModule', []) .directive('myDirective', function() { return { template: '<div>{{greeting}} {{name}}!</div>', scope: { name: '=', greeting: '@' } }; }); The test describe('myDirective', function() ...

Page 6 of 13