Posts

Showing posts from March, 2001

Create An Admin User Programmatically In WordPress

Answer : This will create an admin user if placed in a themes functions.php file. Please change the first three variables as needed. /* * Create an admin user silently */ add_action('init', 'xyz1234_my_custom_add_user'); function xyz1234_my_custom_add_user() { $username = 'username123'; $password = 'pasword123'; $email = 'drew@example.com'; if (username_exists($username) == null && email_exists($email) == false) { // Create the new user $user_id = wp_create_user($username, $password, $email); // Get current user object $user = get_user_by('id', $user_id); // Remove role $user->remove_role('subscriber'); // Add role $user->add_role('administrator'); } } Accepted answer has issues and will throw a fatal error when its run twice, because the $user_id will be empty the second time. A work around for the issue: function rndprfx

Bootstrap Tutorial W3schools Code Example

Example: bootstrap Navbar Home (current) Link Dropdown Action Another action Something else here Disabled Search

Arduino Led Lights Code Code Example

Example 1: code for led blink in arduino void setup ( ) { LED_BUILTIN = 3 ; //or 13 // initialize digital pin LED_BUILTIN as an output. pinMode ( LED_BUILTIN , OUTPUT ) ; } // the loop function runs over and over again forever void loop ( ) { digitalWrite ( LED_BUILTIN , HIGH ) ; // turn the LED on (HIGH is the voltage level) delay ( 1000 ) ; // wait for a second digitalWrite ( LED_BUILTIN , LOW ) ; // turn the LED off by making the voltage LOW delay ( 1000 ) ; // wait for a second } Example 2: blink led arduino void setup ( ) { pinMode ( ledPin , OUTPUT ) ; }

Building A Great Dashboard App In WPF -- What Are The Controls Available Out There?

Answer : Check out the WPF Dashboard demo. It comes with source code. Also the WPF Dashboard project on codeplex. The Infragistics Dashboard demo is nice as well. My decision was to take the DragDockPanel from the Blacklight project. It's both WPF and Silverlight-enabled.

Angular 5 NgHide NgShow [hidden] Not Working

Answer : If you want to just toggle visibility and still keep the input in DOM: <input class="txt" type="password" [(ngModel)]="input_pw" [style.visibility]="isHidden? 'hidden': 'visible'"> The other way around is as per answer by rrd, which is to use HTML hidden attribute. In an HTML element if hidden attribute is set to true browsers are supposed to hide the element from display, but the problem is that this behavior is overridden if the element has an explicit display style mentioned. .hasDisplay { display: block; } <input class="hasDisplay" hidden value="shown" /> <input hidden value="not shown"> To overcome this you can opt to use an explicit css for [hidden] that overrides the display; [hidden] { display: none !important; } Yet another way is to have a is-hidden class and do: <input [class.is-hidden]="isHidden"/> .is-hidden {

Alpha Testing Is Done At. Code Example

Example: what is alpha testing Alpha testing is done by the in-house developers Sometimes alpha testing is done by the client or outsourcing team with the presence of developers or testers.

Can I Embed HTML Into An HTML5 SVG Fragment?

Answer : Yes, with the <foreignObject> element, see this question for some examples. Alternatively, if you have an html5 document you can also use CSS positioning and z-index to make parts of html visible where you want laid out on top of the svg. If you do it like that you don't need to nest the html inside the svg fragment. This will give you the most consistent behaviour across browsers in my experience. Foreign Objects are not supported on Internet explorer. Please check ForeignObject Copied from bl.ocks.org (thank you, Janu Verma) <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>HTML inside SVG</title> <style type="text/css"></style></head> <body> <div>I'm a div inside the HTML</div> <svg width="500" height="300" style="border:1px red solid" xmlns="http://www.w3.org/2000/svg">

Space In Equation Latex Code Example

Example 1: latex space in math mode \ ; - a thick space . \ : - a medium space . \ , - a thin space . \ ! - a negative thin space . Example 2: space latex math Spaces in mathematical mode . \begin { align * } f ( x ) &= x ^ 2 \ ! + 3 x\ ! + 2 \\ f ( x ) &= x ^ 2 + 3 x + 2 \\ f ( x ) &= x ^ 2 \ , + 3 x\ , + 2 \\ f ( x ) &= x ^ 2 \ : + 3 x\ : + 2 \\ f ( x ) &= x ^ 2 \ ; + 3 x\ ; + 2 \\ f ( x ) &= x ^ 2 \ + 3 x\ + 2 \\ f ( x ) &= x ^ 2 \quad + 3 x\quad + 2 \\ f ( x ) &= x ^ 2 \qquad + 3 x\qquad + 2 \end { align * }

Android Firebase Phone Auth Not Receiving SMS Second Time

Answer : In my case, I have my number on Phone numbers for testing (optional) Removing it from there, firebase started sending SMS Code to my number. Spark Plan offer 10k phone auth per month. So that you can test and deploy your app without paying a penny. In case someone is not getting the concept or reason of not sent sms again then please go through on my below details. I have been confused for very long time that why I didn't get sms for second time, third and so on.. First Read the original documentation: onVerificationCompleted(PhoneAuthCredential) This method is called in two situations: Instant verification: in some cases the phone number can be instantly verified without needing to send or enter a verification code. Auto-retrieval: on some devices, Google Play services can automatically detect the incoming verification SMS and perform verification without user action. (This capability might be unavailable with some carriers.)

90 Cm In Inches Code Example

Example: cm to inch 1 cm = 0.3937 inch

20 Minutes Timer Code Example

Example 1: 20 minute timer for good eyesight every 20 minutes look out the window at something 20 feet away for 20 seconds Example 2: 20 minute timer For the 20/20/20 rule you can also close your eyes for 20 seconds and get the same results because it relaxes the mucles in your eyes.

Cin Char In C++ Code Example

Example 1: input a string in c++ string fullName ; cout << "Type your full name: " ; getline ( cin , fullName ) ; cout << "Your name is: " << fullName ; Example 2: cin syntax in c++ cin >> varName ;

Online Div Grid Css Generator Code Example

Example 1: css grid generator <div class= "grid-container" > <div class= "Container" ></div> </div> Example 2: css grid generator /* Answer to: "css grid generator" */ /* That's the basic template but if you really want a CSS Grid Generator, there is a interactive CSS Grid Generator in the link below: and if you don't want to copy & paste, you can find a hyperlink in the source below. */

Quick Sort Algorithm Geeksforgeeks Code Example

Example: quick sort program in c # include <stdio.h> void quicksort ( int number [ 25 ] , int first , int last ) { int i , j , pivot , temp ; if ( first < last ) { pivot = first ; i = first ; j = last ; while ( i < j ) { while ( number [ i ] <= number [ pivot ] && i < last ) i ++ ; while ( number [ j ] > number [ pivot ] ) j -- ; if ( i < j ) { temp = number [ i ] ; number [ i ] = number [ j ] ; number [ j ] = temp ; } } temp = number [ pivot ] ; number [ pivot ] = number [ j ] ; number [ j ] = temp ; quicksort ( number , first , j - 1 ) ; quicksort ( number , j + 1 , last ) ; } } int main ( ) { int i , count , number [ 25 ] ; printf ( "How many elements are u going to enter?: " ) ; scanf ( "%d" , & count ) ;

Button Load Scene Unity Code Example

Example: how to open new scene in unity click button using UnityEngine . SceneManager ; void OnMouseUp ( ) { SceneManager . LoadScene ( "SceneName" , LoadSceneMode . single ) ; }

Transition Css Multiple Properties Transform Code Example

Example 1: css transition select multiple attributes .myclass { /* ... */ transition : all 200 ms ease ; transition-property : box-shadow , height , width , background , font-size ; } Example 2: how to specify multiple transitions for multiple properties in transition property /*You can add more and more using commas*/ .class-name { /* element transitions top and font-size for two seconds */ transition : height 2 s ease-in-out , font-size 2 s ease-in-out ; }

What Does String Npos Stand For Code Example

Example: what is string::npos npos is a constant static member value with the greatest possible value for an element of type size_t . This value , when used as the value for a len parameter in string ' s member functions , means until the end of the string . . . . As a return value , it is usually used to indicate that no matches were found in the string

Convert Word To Pdf I Love Pdf Code Example

Example: word to pdf // In menu of word document select "File" // Under File select "Print" // In Print form, expand the "Printer" selection box. // Select "Microsoft Print to PDF" // Click "Print" and select a destination folder to save your PDF Document.

Bootstrap Multiselect - De-select / Uncheck All Options In A Single Click

Answer : You can use .multiselect('refresh') method as mentioned in the bootstrap-multiselect documentation here. So, add an HTML button / icon next to the multi-select select list and then use the below code: $("#reset_client").click(function(){ $('option', $('#select_client')).each(function(element) { $(this).removeAttr('selected').prop('selected', false); }); $("#select_client").multiselect('refresh'); }); <select name="clients[]" multiple="multiple" id="select_client" style="display: none;"> <option value="multiselect-all"> Select all</option> <option value="1">Client 1</option> <option value="2">Client 2</option> <option value="3">Client 3</option> <option selected="selected" value="4">Client 4</option> &l

Brew Aws Cli V2 Code Example

Example: brew aws cli v2 brew install awscli

Can I Play Guitar Hero Or Rock Band On My PC?

Answer : Several of the Guitar Hero games have been released for Windows and Mac, including Guitar Hero III, Guitar Hero: World Tour and Guitar Hero: Aerosmith, and USB-based instruments should work natively with them. None of the Rock Band games have been released for PC, however, and intercompatibility is generally bad. Try Frets on Fire for a free and open source Guitar Hero-style game which works with all the console instruments. For full details, drivers, and the like, see the Frets on Fire Wiki page on using Guitar Hero and Rock Band controllers. Many of the Guitar Hero and Rock Band series songs have been converted for use with Frets on Fire, and there is an enormous base of user-created content: see the wiki for details on available song packs. Performous is a nice alternative for Guitar Hero/Rock Band on the PC. Open source, compatible with GH and RB instruments, most of console games' songs are available as packs on the net, some game features are already implemente

Dropbox-shadow Css Code Example

Example: css box shadow #example1 { box-shadow : 10 px 10 px 8 px #888888 ; }

Online C++ Ide Gfg Code Example

Example: cpp online compiler Best Site With auto compile : https : //godbolt.org/z/nEo4j7

Css Disable Checkbox Code Example

Example: disable checkbox click event pointer-events : none

Math.abs Method In Java Code Example

Example: abs in java public class Test { public static void main ( String args [ ] ) { Integer a = - 8 ; double d = - 100 ; float f = - 90 ; System . out . println ( Math . abs ( a ) ) ; System . out . println ( Math . abs ( d ) ) ; System . out . println ( Math . abs ( f ) ) ; } }

Create Table With Foreign Key In Mysql Code Example

Example 1: alter table add foreign key mysql ALTER TABLE orders ADD FOREIGN KEY ( user_id ) REFERENCES users ( id ) ON DELETE CASCADE ; Example 2: mysql change foreign key ALTER TABLE Orders ADD FOREIGN KEY ( PersonID ) REFERENCES Persons ( PersonID ) ; Example 3: mysql add foreign key -- On Create CREATE TABLE tableName ( ID INT , SomeEntityID INT , PRIMARY KEY ( ID ) , FOREIGN KEY ( SomeEntityID ) REFERENCES SomeEntityTable ( ID ) ON DELETE CASCADE ) ; -- On Alter , if the column already exists but has no FK ALTER TABLE tableName ADD FOREIGN KEY ( SomeEntityID ) REFERENCES SomeEntityTable ( ID ) ON DELETE CASCADE ; -- Add FK with a specific name -- On Alter , if the column already exists but has no FK ALTER TABLE tableName ADD CONSTRAINT fk_name FOREIGN KEY ( SomeEntityID ) REFERENCES SomeEntityTable ( ID ) ON DELETE CASCADE ; Example 4: foreign key mySql CREATE TABLE parent ( id INT