Posts

Showing posts from June, 2018

Quicksort Gfg Recursive Code Example

Example: Quick Sort in c++ # include <bits/stdc++.h> using namespace std ; void swap ( int * a , int * b ) { int t = * a ; * a = * b ; * b = t ; } int partition ( int arr [ ] , int low , int high ) { int pivot = arr [ high ] ; int i = ( low - 1 ) ; for ( int j = low ; j <= high - 1 ; j ++ ) { if ( arr [ j ] < pivot ) { i ++ ; swap ( & arr [ i ] , & arr [ j ] ) ; } } swap ( & arr [ i + 1 ] , & arr [ high ] ) ; return ( i + 1 ) ; } void quickSort ( int arr [ ] , int low , int high ) { if ( low < high ) { int pi = partition ( arr , low , high ) ; quickSort ( arr , low , pi - 1 ) ; quickSort ( arr , pi + 1 , high ) ; } } void printArray ( int arr

Amc Stock Trading View Code Example

Example 1: amc stock There once was a stock that put to sea, the name of the stock was $AMC. The price blew up and the shorts dipped down, hold my bully boys HOLLDDD Example 2: amc stock DON'T LET THEM WIN!

Cpp Shell Code Example

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

Amd Ryzen 5 3500u Vs Intel I5 11th Gen Code Example

Example: ryzen 5 vs intel i5 10th gen AMD won by 1 point overall they all are dope

Convert Integer (YYYYMMDD) To Date Format (mm/dd/yyyy) In Python

Answer : You can use datetime methods. from datetime import datetime a = '20160228' date = datetime.strptime(a, '%Y%m%d').strftime('%m/%d/%Y') Good Luck; Build a new column with applymap : import pandas as pd dates = [ 20160228, 20161231, 20160618, 20170123, 20151124, ] df = pd.DataFrame(data=list(enumerate(dates, start=1)), columns=['id','int_date']) df[['str_date']] = df[['int_date']].applymap(str).applymap(lambda s: "{}/{}/{}".format(s[4:6],s[6:], s[0:4])) print(df) Emits: $ python test.py id int_date str_date 0 1 20160228 02/28/2016 1 2 20161231 12/31/2016 2 3 20160618 06/18/2016 3 4 20170123 01/23/2017 4 5 20151124 11/24/2015 There is bound to be a better solution to this, but since you have zeroes instead of single-digit elements in your date (i.e. 06 instead of 6), why not just convert it to string and convert the subsections? using datetime would also get you the

Set Data-id In Jquery Code Example

Example 1: jquery set data attribute value //<div id= "myElementID" data-myvalue= "37" ></div> var a = $ ( '#myElementID' ) . data ( 'myvalue' ) ; //get myvalue $ ( '#myElementID' ) . data ( 'myvalue' , 38 ) ; //set myvalue Example 2: set data attribute with a string jquery alert ( $ ( '#outer' ) . html ( ) ) ; // alerts <div id= "mydiv" data-myval= "10" > </div> var a = $ ( '#mydiv' ) . data ( 'myval' ) ; //getter $ ( '#mydiv' ) . attr ( "data-myval" , "20" ) ; //setter alert ( $ ( '#outer' ) . html ( ) ) ; //alerts <div id= "mydiv" data-myval= "20" > </div> Example 3: jquery get data attribute <a data-id= "123" >link</a> var id = $ ( this ) . data ( "id" ) ; // Will set id to 123 Example 4: jquery data attribute data attribute in jquery For setting at

Css Font Bold Strong Code Example

Example 1: css text bold font-weight : bold ; Example 2: how to bold text css inline <p style= "font-weight:bold" >Hey there</p>

CSS Selector-How To Locate Parent Element

Answer : Referring to the Is there a CSS parent selector? topic, there is no parent selector in CSS . Leave the "getting the parent" part to the XPath: WebElement we = dr.findElement(By.cssSelector("div[id='gf-BIG']")); WebElement parent = we.findElement(By.xpath(".."));

C Strstr Example

Defined in header <string.h> char * strstr ( const char * str , const char * substr ) ; Finds the first occurrence of the null-terminated byte string pointed to by substr in the null-terminated byte string pointed to by str . The terminating null characters are not compared. The behavior is undefined if either str or substr is not a pointer to a null-terminated byte string. Parameters str - pointer to the null-terminated byte string to examine substr - pointer to the null-terminated byte string to search for Return value Pointer to the first character of the found substring in str , or NULL if no such substring is found. If substr points to an empty string, str is returned. Example # include <string.h> # include <stdio.h> void find_str ( char const * str , char const * substr ) { char * pos = strstr ( str , substr ) ; if ( pos ) { printf ( "found the string '%s

Disable Scrollbar Css Code Example

Example 1: hide scrollbar css /* Hide scrollbar for Chrome, Safari and Opera */ .scrollbar-hidden ::-webkit-scrollbar { display : none ; } /* Hide scrollbar for IE, Edge add Firefox */ .scrollbar-hidden { -ms-overflow-style : none ; scrollbar-width : none ; /* Firefox */ } Example 2: remove scrollbar css /* Hide scrollbar for Chrome, Safari and Opera */ .example ::-webkit-scrollbar { display : none ; } /* Hide scrollbar for IE and Edge */ .example { -ms-overflow-style : none ; } Example 3: disable scroll css /* Answer to: "disable scroll css" */ /* You must set the height and overflow of the body, to disable scrolling. */ html , body { margin : 0 ; height : 100 % ; overflow : hidden } Example 4: css stop scrollbar html { scrollbar-width : none ; /* For Firefox */ -ms-overflow-style : none ; /* For Internet Explorer and Edge */ } html ::-webkit-scrollbar { width : 0 px ; /* For Chrome, Safari, and Opera */ } Example 5:

How To Convert An Integer To A String In Arduino Code Example

Example: int to string arduino String stringOne = "Hello String" ; // using a constant String String stringOne = String ( 'a' ) ; // converting a constant char into a String String stringTwo = String ( "This is a string" ) ; // converting a constant string into a String object String stringOne = String ( stringTwo + " with more" ) ; // concatenating two strings String stringOne = String ( 13 ) ; // using a constant integer String stringOne = String ( analogRead ( 0 ) , DEC ) ; // using an int and a base String stringOne = String ( 45 , HEX ) ; // using an int and a base (hexadecimal) String stringOne = String ( 255 , BIN ) ; // using an int and a base (binary) String stringOne = String ( millis ( ) , DEC ) ; // using a long and a base String stringOne = String ( 5.698 , 3 ) ;

Angular: Conditional Class With *ngClass

Answer : Angular version 2+ provides several ways to add classes conditionally: type one [class.my-class]="step === 'step1'" type two [ngClass]="{'my-class': step === 'step1'}" and multiple option: [ngClass]="{'my-class': step === 'step1', 'my-class2':step === 'step2' }" type three [ngClass]="{1:'my-class1',2:'my-class2',3:'my-class4'}[step]" type four [ngClass]="(step=='step1')?'my-class1':'my-class2'" [ngClass]=... instead of *ngClass . * is only for the shorthand syntax for structural directives where you can for example use <div *ngFor="let item of items">{{item}}</div> instead of the longer equivalent version <template ngFor let-item [ngForOf]="items"> <div>{{item}}</div> </template> See also https://angular.io/docs/ts/latest/api/common/index/NgCl

Conda Command Is Not Recognized On Windows 10

Image
Answer : In Windows, you will have to set the path to the location where you installed Anaconda3 to. For me, I installed anaconda3 into C:\Anaconda3 . Therefore you need to add C:\Anaconda3 as well as C:\Anaconda3\Scripts\ to your path variable, e.g. set PATH=%PATH%;C:\Anaconda3;C:\Anaconda3\Scripts\ . You can do this via powershell (see above, https://msdn.microsoft.com/en-us/library/windows/desktop/bb776899(v=vs.85).aspx ), or hit the windows key → enter environment → choose from settings → edit environment variables for your account → select Path variable → Edit → New . To test it, open a new dos shell, and you should be able to use conda commands now. E.g., try conda --version . Things have been changed after conda 4.6 . Programs "Anaconda Prompt" and "Anaconda Powershell" expose the command conda for you automatically. Find them in your startup menu. If you don't wanna use the prompts above and try to make conda available in a normal cmd.exe a

Using Atoi In C Code Example

Example 1: atoi # include <stdlib.h> //atoi's library # include <stdio.h> int main ( void ) { string input = "9" ; int output = atoi ( input ) ; printf ( "%i" , output ) ; //this will print out 9 as an int not a string } Example 2: atoi c # include <stdio.h> # include <stdlib.h> # include <string.h> //CONVERT STRING TO INT int main ( ) { int val ; char str [ 20 ] ; strcpy ( str , "98993489" ) ; val = atoi ( str ) ; printf ( "String value = %s, Int value = %d\n" , str , val ) ; strcpy ( str , "tutorialspoint.com" ) ; val = atoi ( str ) ; printf ( "String value = %s, Int value = %d\n" , str , val ) ; return ( 0 ) ; } Example 3: what is atoi in strinf The C library function int atoi ( const char * str ) converts the string argument str to an integer ( type int ) . Note : It is

Position Two Divs Next To Each Other Css Code Example

Example: display div next to eachother display : inline-block ;

Javascript Strlen Code Example

Example 1: js string length let str = "foo" ; console . log ( str . length ) ; // 3 Example 2: javascript string lentrh var myString = "string test" ; var stringLength = myString . length ; console . log ( stringLength ) ; // Will return 11 because myString // is 11 characters long... Example 3: javascript longitud de un string cadena_primitiva = String ( "barra" ) ; // crea una Cadena primitiva cadena_primitiva = "barra" ; // crea una Cadena primitiva cadena_primitiva . length ; // 5 Example 4: javascript length var colors = [ "Red" , "Orange" , "Blue" , "Green" ] ; var colorsLength = colors . length ; //4 is colors array length var str = "bug" ; var strLength = str . length ; //3 is the number of characters in bug Example 5: length of string in javascript var str = "Hello World!" ; var n = str . length ;

Justify-content-space-between Bootstrap Code Example

Example 1: justify-content-between bootstrap 4 <div class= "d-flex justify-content-start" >...</div> <div class= "d-flex justify-content-end" >...</div> <div class= "d-flex justify-content-center" >...</div> <div class= "d-flex justify-content-between" >...</div> <div class= "d-flex justify-content-around" >...</div> Example 2: bootstrap justify-content-center for md <div class= "row justify-content-md-center" ></div> Example 3: justify content space between class bootstrap <div class= "row d-flex justify-content-between" ></div> Example 4: bootstrap justify-content-center for lg <div class= "row justify-content-lg-center" ><div> Example 5: display flex usnig bootstrap <div class= "d-flex p-2 bd-highlight" >I'm a flexbox container!</div>

Text Outline Css Code Example

Example 1: css text outline /* You have 2 options The first is experimental */ /* text-stroke */ #example { font-size : 1 em ; -webkit-text-stroke : 1 px #000000 ; } /* Use 4 shadows Probably best to use this until the above is standardised */ #example { font-size : 1 em ; text-shadow : -1 px -1 px 0 #000 , 1 px -1 px 0 #000 , -1 px 1 px 0 #000 , 1 px 1 px 0 #000 ; } Example 2: text border css h1 { -webkit-text-stroke : 1 px black ; } Example 3: css text black outline /* Written for h4 tag, modify as required */ .black-outline { -webkit-text-stroke : 1.11 px black ; /* stroke width and color */ color : rgb ( 255 , 255 , 255 ) ; -webkit-font-smoothing : antialiased ; font-weight : bold ; } Example 4: how to make border for letters in css h1 { -webkit-text-stroke : 2 px black ; /* width and color */ font-family : sans ; color : yellow ; } Example 5: text outline html .stroke { color : white ; text

Css Font List Code Example

Example 1: css comic sans font-family : "Comic Sans MS" , "Comic Sans" , cursive ; Example 2: sans serif font family css <style > .sansserif { font-family : Arial , Helvetica , sans-serif ; } </style> Example 3: css font family p { font-family : garamond , serif ; } Example 4: font-family css font-family : "Times New Roman" , Georgia , serif ; /* If the browser does not support the first font (ie: Times New Roman), it will then try the next font (ie: Georgia). The last font should always be a "generic-family" font (ie: serif, sans-serif, etc..). /* If font is more then one word, it must be put into quotes. */ Example 5: font family css font-family : "Comic Sans MS" , cursive , sans-serif ; Example 6: css font families p { font-family : "Times New Roman" , Times , serif ; }