Tutorial by Examples

Simple line plot import matplotlib.pyplot as plt # Data x = [14,23,23,25,34,43,55,56,63,64,65,67,76,82,85,87,87,95] y = [34,45,34,23,43,76,26,18,24,74,23,56,23,23,34,56,32,23] # Create the plot plt.plot(x, y, 'r-') # r- is a style code meaning red solid line # Show the plot plt.show...
<html> <head> <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script> <script src="https:...
response = requests.get("https://api.github.com/events") text_resp = response.text JSON response: for json-formatted responses the package provides a built-in decoder response = requests.get('https://api.github.com/events') json_resp = response.json() This method will raise a Valu...
The attribute status_code contains the status code of the response good_req = requests.get('https://api.github.com/events') code_200 = good_req.status_code notfound_req = requests.get('https://api.github.com/not_found') code_404 = notfound_req.status_code requests.codes.__dict__ will provid...
In Visual Studio go to your Solution Explorer then click on Project you will be adding model Right mouse. Choose ADO.NET Entity Data Model Then choose Generate from database and click Next in next window click New Connection... and point to the database you want to generate model from (Could be M...
jQuery datepicker has two options to allow displaying dropdowns for month and year selection. These options make navigation through large timeframes easier. <input type="text" id="datepicker"> <script> $("#datepicker").datepicker({ changeMont...
class AnimatedImage extends Component { constructor(props){ super(props) this.state = { logoMarginTop: new Animated.Value(200) } } componentDidMount(){ Animated.timing( this.state.logoMarginTop, { toValue: 100 ...
We have 2 way, we can install Universal app in windows 10 devices (OS/Phone). One app works for both mobile and OS 1 Install using Power Shell command Step 1: Make sure app not have any error and developed, then right click on Universal app project in solution explorer. Step 2: Select Store and C...
We can use $q to defer operations to the future while having a pending promise object at the present, by using $q.defer we create a promise that will either resolve or reject in the future. This method is not equivalent of using the $q constructor, as we use $q.defer to promisify an existing routin...
<style> input:in-range { border: 1px solid blue; } </style> <input type="number" min="10" max="20" value="15"> <p>The border for this value will be blue</p> The :in-range CSS pseudo-class matches when an element...
Let's say we want to change main loop, only for specific taxonomy, or post type. Targeting only main loop on book post type archive page. add_action( 'pre_get_posts', 'my_callback_function' ); function my_callback_function( $query ) { if( !$query->is_main_query() || is_admin() ) return;...
add_action( 'pre_get_posts', 'single_category' ); function single_category( $query ) { if( !$query->is_main_query() || is_admin() ) return; $query->set( 'cat', '1' ); return; }
Sometimes you would like to change main WordPress query. Filter pre_get_posts is the way to go. For example using pre_get_posts you can tell main loop to show only 5 posts. Or to show posts only from one category, or excluding any category etc. add_action( 'pre_get_posts', 'my_callback_function' ...
add_action( 'pre_get_posts', 'single_category_exclude' ); function single_category_exclude( $query ) { if( !$query->is_main_query() || is_admin() ) return; $query->set( 'cat', '-1' ); return; }
All we need to do is to use set() method of $query object. It takes two arguments, first what we want to set and second what value to set. add_action( 'pre_get_posts', 'change_posts_per_page' ); function change_posts_per_page( $query ) { if( !$query->is_main_query() || is_admin() ) retu...
Let's say you need to check if an email address appears in a long list of email addresses. Use the MATCH function to return the row number on which the email address can be found. If there is no match, the function returns an #N/A error. =MATCH(F2,$D$2:$D$200,0) The value you're retrieving ...
This will rollback both inserts due to an invalid datetime: BEGIN TRANSACTION BEGIN TRY INSERT INTO dbo.Sale(Price, SaleDate, Quantity) VALUES (5.2, GETDATE(), 1) INSERT INTO dbo.Sale(Price, SaleDate, Quantity) VALUES (5.2, 'not a date', 1) COMMIT TRANSACTION END TRY BEG...
The as operator will cast to a supertype. As it cannot fail, it does not return an optional. let name = "Ringo" let value = string as Any // `value` is of type `Any` now
DECLARE @xmlIN XML = '<TableData> <aaa Main="First"> <row name="a" value="1" /> <row name="b" value="2" /> <row name="c" value="3" /> </aaa> <aaa Main="Second"> &l...
Singletons in Java are very similar to C#, being as both languages are object orientated. Below is an example of a singleton class, where only one version of the object can be alive during the program's lifetime (Assuming the program works on one thread) public class SingletonExample { priva...

Page 595 of 1336