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...
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...
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...
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...
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"...
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();
/...