Tutorial by Examples: o

import cv2 import numpy as np img = cv2.imread('<your_image>') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.imshow('image', img) cv2.imshow('gray', gray) cv2.waitKey(0) cv2.destroyAllWindows()
django-filter is generic system for filtering Django QuerySets based on user selections. The documentation uses it in a function-based view as a product model: from django.db import models class Product(models.Model): name = models.CharField(max_length=255) price = models.DecimalField(...
Salesforce Navigator (Google Chrome) Force.com Logins (Google Chrome, Firefox) Salesforce Developer Tool Suite (Google Chrome) Salesforce Lighting Components Inspector (Google Chrome) Salesforce Developer Tool Suite (Google Chrome) Salesforce Schema Builder Expander (Google Chrome) Boostr fo...
The following procedure is a generic one which will be used to log all errors in an application to a common error log table. CREATE OR REPLACE PROCEDURE log_errors ( p_calling_program IN VARCHAR2, p_error_code IN INTEGER, p_error_description IN VARCHAR2 ) IS PRAGMA AUTONOMOUS_TRANSAC...
Atomic types are the building blocks of lock-free data structures and other concurrent types. A memory ordering, representing the strength of the memory barrier, should be specified when accessing/modifying an atomic type. Rust provides 5 memory ordering primitives: Relaxed (the weakest), Acquire (f...
Put the following code in functions.php: function themify_custom_excerpt_length( $length ) { return 50; } add_filter( 'excerpt_length', 'themify_custom_excerpt_length', 999 ); Use 999 as the priority to ensure that the function runs after the default WordPress filter, otherwise it would ov...
To do this, put the following code in functions.php: function custom_excerpt_more($more) { return '<a href="'. get_permalink($post->ID) . '">Read More</a>'; } add_filter('excerpt_more', 'custom_excerpt_more'); The results should look like this:
In our functions.php function new_excerpt_more( $more ) { return '.....'; } add_filter('excerpt_more', 'new_excerpt_more'); We should get this:
Open a new command line or terminal window and create a clean folder for testing. Protractor needs two files to run, a spec file and a configuration file. Let's start with a simple test that navigates to the todo list example in the AngularJS website and adds a new todo item to the list. Copy the...
Use the analytical function row_number(): with t as ( select col1 , col2 , row_number() over (order by col1, col2) rn from table ) select col1 , col2 from t where rn between N and M; -- N and M are both inclusive Oracle 12c handles this more easily with OFFSET and FETCH.
TestNG allows defining groups which can include other groups. MetaGroups logically combine one or more group(s) and control the execution of the @Testmethods belonging to those groups. In below example there are various @Test methods belonging to different group(s). Few are specific to particular s...
Create a new browser bookmark, for example, in Chrome click the star icon at the right in the address bar, make sure the Folder is Bookmarks Bar, and then click the Edit... button: In the edit box that opens paste the following code as the URL: javascript:(function(){var root=(window.location.pa...
If you were to hide a link by setting display: none in the CSS then screen readers wouldn’t find it. Instead, we position it absolutely, with clipping. CSS .offscreen { position: absolute; clip: rect(1px 1px 1px 1px); /* for Internet Explorer */ clip: rect(1px, 1px, 1px, 1px); padding: 0; b...
There are a few way's to install WebSocket's to your project. Here are some example's: npm install --save ws or inside your package.json using: "dependencies": { "ws": "*" },
To add ws to your file's simply use: var ws = require('ws');
To open a new WebSocket, simply add something like: var WebSocket = require("ws"); var ws = new WebSocket("ws://host:8080/OptionalPathName); // Continue on with your code... Or to open a server, use: var WebSocketServer = require("ws").Server; var ws = new WebSocketS...
var WebSocketServer = require('ws').Server , wss = new WebSocketServer({ port: 8080 }); // If you want to add a path as well, use path: "PathName" wss.on('connection', function connection(ws) { ws.on('message', function incoming(message) { console.log('received: %s', message); ...
add_action('wp_head','hook_javascript'); function hook_javascript() { $output="<script> alert('Page is loading...'); </script>"; echo $output; }
Using composer, execute the following command in the directory in which the application will be installed: composer create-project zendframework/zend-expressive-skeleton expressive-skeleton. During installation process, you will be asked to make various decisions. For the default installation qu...
Assuming that you have node and npm installed and available, create a project folder with a valid package.json. Install the necessary dependencies: npm install --save-dev metalsmith metalsmith-in-place handlebars Create a file called build.js at the root of your project folder, containing the fo...

Page 646 of 1038