Tutorial by Examples: direct

We can avoid providing direct access to resource intensive constructors, like for databases. public class DbConnection { private static final int MAX_CONNS = 100; private static int totalConnections = 0; private static Set<DbConnection> availableConnections = new HashSet<DbConnectio...
The per-directory context is a part of the static configuration file between <Directory> and </Directory> tags. The entire content of dynamic configuration files is within the per-directory context of the folder in which the .htaccess resides. RewriteRule's in per-directory context matc...
Directives can be decorated just like services and we can modify or replace any of it's functionality. Note that directive itself is accessed at position 0 in $delegate array and name parameter in decorator must include Directive suffix (case sensitive). So, if directive is called myDate, it can be...
A common question among new Angular programmers - "What should be the structure of the project?". A good structure helps toward a scalable application development. When we start a project we have two choices, Sort By Type (left) and Sort By Feature (right). The second is better, especially...
2.04 Bash treats some paths as special and can do some network communication by writing to /dev/{udp|tcp}/host/port. Bash cannot setup a listening server, but can initiate a connection, and for TCP can read the results at least. For example, to send a simple web request one could do: exec 3</...
<PropertyGroup> <DirectoryToCreate>NewDirectory</DirectoryToCreate> </PropertyGroup> <MakeDir Directories="$(DirectoryToCreate)" />
<PropertyGroup> <DirectoryToRemove>TempData</DirectoryToRemove> </PropertyGroup> <RemoveDir Directories="$(DirectoryToRemove)" />
add_action( 'init', function() { // do something here } ); Using a function block to hook a set of instructions. With the init hook, the set of instructions will be executed right after wordpress has finished loading the necessary components.
Professionally made web applications don't expose the internal details of the server environment to the user. When you place an order at your retailer, you don't see (or have to type) https://mydealer.com:8443/Dealerapp/entryPage.html, but just mydealer.com, although the app server needs all the det...
<div oc-lazy-load="['path/to/lazy/loaded/directive.js', 'path/to/lazy/loaded/directive.html']"> <!-- myDirective available here --> <my-directive></my-directive> </div>
michael@who-cares:~$ The symbol ~ after the who-cares: is the current directory. ~ actually means the person's home directory. In this case, that's /home/michael. michael@who-cares:~$ cd Downloads michael@who-cares:~/Downloads$ Looks for Downloads in the current directory, then makes that th...
A cycle in a directed graph exists if there's a back edge discovered during a DFS. A back edge is an edge from a node to itself or one of the ancestors in a DFS tree. For a disconnected graph, we get a DFS forest, so you have to iterate through all vertices in the graph to find disjoint DFS trees. ...
public ActionResult Index() { //Redirects to another action method by using its URL. return new RedirectResult("http://www.google.com"); } Action methods typically return a result that is known as an action result. The ActionResult class is the base class for all action resu...
public ActionResult PopulateFoods() { // Redirects to another action method. In this case the index method return RedirectToAction("Index"); } Action methods typically return a result that is known as an action result. The ActionResult class is the base class for all action ...
interface IMyDirectiveController { // specify exposed controller methods and properties here getUrl(): string; } class MyDirectiveController implements IMyDirectiveController { // Inner injections, per each directive public static $inject = ["$location", "...
ASP.NET Core provides the status code pages middleware, that supports several different extension methods, but we are interesting in UseStatusCodePages and UseStatusCodePagesWithRedirects: UseStatusCodePages adds a StatusCodePages middleware with the given options that checks for responses with...
vagrant ssh-config >> ~/.ssh/config ssh default
To add for instance a directory scripts to the distribution package: Add to the project a folder scripts On top of the build.sbt, add: import NativePackagerHelper._ In build.sbt, add a mapping to the new directory: mappings in Universal ++= directory("scripts") B...
//Before: antipattern 3 global variables var setActivePage = function () {}; var getPage = function() {}; var redirectPage = function() {}; //After: just 1 global variable, no function collision and more meaningful function names var NavigationNs = NavigationNs || {}; N...
Extract all file contents of a zip file import zipfile with zipfile.ZipFile('zipfile.zip','r') as zfile: zfile.extractall('path') If you want extract single files use extract method, it takes name list and path as input parameter import zipfile f=open('zipfile.zip','rb') zfile=zipfile.Z...

Page 9 of 13