Tutorial by Examples: a

Many Flask applications are developed in a virtualenv to keep dependencies for each application separate from the system-wide Python installation. Make sure that mod-wsgi is installed in your virtualenv: pip install mod-wsgi Then create a wsgi wrapper for your Flask application. Usually it's kep...
The advantage of using Apache over the builtin werkzeug server is that Apache is multi-threaded, meaning that multiple connections to the application can be made simultaneously. This is especially useful in applications that make use of XmlHttpRequest (AJAX) on the front-end. /etc/apache2/sites-ava...
To set the environment to Development SET ASPNETCORE_ENVIRONMENT=Development Now running an Asp.Net Core application will be in the defined environment. Note There should be no space before and after the equality sign =. The command prompt should not be closed before running the application b...
Homebrew calls itself 'the missing package manager for macOS'. It can be used to build and install applications and libraries. Once installed, you can use the brew command to install PostgreSQL and it's dependencies as follows: brew update brew install postgresql Homebrew generally installs the...
Assume your data examples are already read to a python's variable and you would like to read it n times, in batches of given size: import numpy as np import tensorflow as tf data = np.array([1, 2, 3, 4, 5]) n = 4 To merge data in batches, possibly with random shuffling, you can use tf.train.b...
The following are the steps that you will need to follow to setup mysql datasource in JBoss AS 7. Download the MySQL jdbc zip file from here: Create a directory mysql inside /jboss-as-7.1.1.Final/modules/com Inside that create a directory structure like the following: /jboss-as-7.1.1.Final/m...
OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. It was built for various purpose such as machine learning, computer vision, algorithm, mathematical operations, video capturing, image processing etc. Over the years it has become ve...
Objective C: view.backgroundColor = [UIColor redColor]; Swift: view.backgroundColor! = UIColor.redColor() Swift 3 view.backgroundColor = UIColor.redColor
The <header> element represents introductory content for its nearest ancestor sectioning content or sectioning root element. A <header> typically contains a group of introductory or navigational aids. Note: The header element is not sectioning content; it doesn’t introduce a new secti...
local collections are not allowed in select statements. Hence the first step is to create a schema level collection. If the collection is not schema level and being used in SELECT statements then it would cause "PLS-00642: local collection types not allowed in SQL statements" CREATE OR R...
When mapping our entities to database table names we rely on a @Table annotation. But if we have a naming convention for our database table names, we can implement a custom physical naming strategy in order to tell hibernate to calculate table names based on the names of the entities, without explic...
from flask import Flask, render_template, redirect, url_for app = Flask(__name__) @app.route('/') def main_page(): return render_template('main.html') @app.route('/main') def go_to_main(): return redirect(url_for('main_page'))
# ... # same as above @app.route('/welcome/<name>') def welcome(name): return render_template('main.html', name=name) @app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': # ... # check for valid login, assign username ...
Multiton can be used as a container for singletons. This is Multiton implementation is a combination of Singleton and Pool patterns. This is an example of how common Multiton abstract Pool class can be created: abstract class MultitonPoolAbstract { /** * @var array */ protec...
This pattern can be used to contain a registered Pools of Singletons, each distinguished by unique ID: abstract class MultitonRegistryAbstract { /** * @var array */ protected static $instances = []; /** * @param string $id */ final protected function ...
To use auto layout we need to enable a boolean flag in storyboard. Its shown in the below image. After this we can use auto layout in our storyboard. There is another option if we want to use size classes or not. Size class is also a helpful option in auto layout which helps us to design for differe...
A pattern rule is indicated by a single % character in the target. The % matches a non-empty string called the stem. The stem is then substituted for every % that appears in the prerequisite list. For example, this rule: %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ Will match any target ending ...
If a target matches multiple pattern rules, make will use the one whose prerequisites exist or can be built. For example: %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ %.o: %.s $(AS) $(ASFLAGS) $< -o $@ Will compile foo.c to foo.o or assemble foo.s to foo.o, depending on which one of foo...
If the target pattern doesn't contain slashes, make will remove the directory part from the target it's trying to build before matching. The directory will then be put in front of the stem. When the stem is used to build the target name and prerequisites, the directory part is stripped from it, the ...
Pattern rules can have multiple targets but, unlike normal rules, the recipe is responsible for making all the targets. For example: debug/%.o release/%.o: %.c $(CC) $(CFLAGS_DEBUG) -c $< -o debug/$*.o $(CC) $(CFLAGS_RELEASE) -c $< -o release/$*.o Is a valid rule, which will buil...

Page 759 of 1099