Tutorial by Examples

If you want to handle such scenario just add an if/else statement. if ( have_posts() ) : while ( have_posts() ) : the_post(); var_dump( $post ); endwhile; else : __('This Query does not have any results'); endif;
An identifier has block scope if its corresponding declaration appears inside a block (parameter declaration in function definition apply). The scope ends at the end of the corresponding block. No different entities with the same identifier can have the same scope, but scopes may overlap. In case o...
#include <stdio.h> /* The parameter name, apple, has function prototype scope. These names are not significant outside the prototype itself. This is demonstrated below. */ int test_function(int apple); int main(void) { int orange = 5; orange = test_function(oran...
#include <stdio.h> /* The identifier, foo, is declared outside all blocks. It can be used anywhere after the declaration until the end of the translation unit. */ static int foo; void test_function(void) { foo += 2; } int main(void) { foo = 1; test_functi...
The jQuery API may be extended by adding to its prototype. For example, the existing API already has many functions available such as .hide(), .fadeIn(), .hasClass(), etc. The jQuery prototype is exposed through $.fn, the source code contains the line jQuery.fn = jQuery.prototype Adding functio...
A common use case for wanting to calculate the frame a label will take up is for sizing table view cells appropriately. The recommended way of doing this is using the NSString method boundingRectWithSize:options:attributes:context:. options takes String drawing options: NSStringDrawingUsesLineFr...
The following code will show week of the year number on the left side of the datepicker. By default the week start on Monday, but it can be customized using firstDay option. The first week of the year contains the first Thursday of the year, following the ISO 8601 definition. <input type="t...
jquery-ui-rotatable is a plugin for jQuery UI that works in a similar way to Draggable and Resizable, without being as full-featured. By default, it puts a small rotation icon in the bottom left of whatever element you want to make rotatable. <html> <head> <title>My Ro...
Generally, dialog relies on a div within the HTML. Sometimes you may want to create a dialog from scratch, programmatically. Here is an example of a complex modal dialog created dynamically with interactive functions. HTML <div id="users-contain" class="ui-widget"> &lt...
Redis is an in-memory remote database that offers high performance, replication, and a unique data model to produce a platform for solving problems. Redis is an open source (BSD licensed), in-memory data structure , used as database, cache and message broker. It is categorized as a NoSQL key-value s...
View jsFiddle: https://jsfiddle.net/HimmatChahal/jb5trg67/ Copy + Pasteable code below: <html> <body> <h1>This will fade in at 60 frames per second (or as close to possible as your hardware allows)</h1> <script> // Fad...
The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object. Use it to assign values to an existing object: var user = { firstName: "John" }; Object.assign(user, {last...
An enum is a set of logically related constants. Enum Size Small Medium Large End Enum Public Sub Order(shirtSize As Size) Select Case shirtSize Case Size.Small ' ... Case Size.Medium ' ... Case Size.Large ' ....
Each of the enum members may be initialized with a value. If a value is not specified for a member, by default it's initialized to 0 (if it's the first member in the member list) or to a value greater by 1 than the value of the preceding member. Module Module1 Enum Size Small ...
With the <Flags> attribute, the enum becomes a set of flags. This attribute enables assigning multiple values to an enum variable. The members of a flags enum should be initialized with powers of 2 (1, 2, 4, 8...). Module Module1 <Flags> Enum Material Wood = 1 ...
public class Email { public string To { get; set; } public string From { get; set; } public string Subject { get; set; } public string Body { get; set; } } public class EmailBuilder { private readonly Email _email; public EmailBuilder() { _email = ...
git commit -m 'Fix UI bug' --date 2016-07-01 The --date parameter sets the author date. This date will appear in the standard output of git log, for example. To force the commit date too: GIT_COMMITTER_DATE=2016-07-01 git commit -m 'Fix UI bug' --date 2016-07-01 The date parameter accepts t...
To set up a controller with user authentication using devise, add this before_action: (assuming your devise model is 'User'): before_action :authenticate_user! To verify if a user is signed in, use the following helper: user_signed_in? For the current signed-in user, use this helper: current_us...
6 An array can be destructured when being assigned to a new variable. const triangle = [3, 4, 5]; const [length, height, hypotenuse] = triangle; length === 3; // → true height === 4; // → true hypotneuse === 5; // → true Elements can be skipped const [,b,,c] = [1, 2, 3, 4]; co...
This design pattern is useful for generating a sequence of asynchronous actions from a list of elements. There are two variants : the "then" reduction, which builds a chain that continues as long as the chain experiences success. the "catch" reduction, which builds a chain t...

Page 222 of 1336