Posts

Linear Gradient W3schools Code Example

Example 1: css linear gradient #grad { background-image : linear-gradient ( to right , #f1b1b1 , #82e6e8 ) ; } Example 2: html css background linear-gradient background : linear-gradient ( #333 , #333 50 % , #eee 100 % ) ; \\code for a basic gradient background #grad { background-image : linear-gradient ( red , yellow ) ; } Example 3: html css background linear-gradient #background { background-image : linear-gradient ( to left , #4B2C4C , #151F28 ) ; }

Angular7 And NgbModal: How To Remove Default Auto Focus

Answer : The focus is needed to be within modal for accessibility and keyboard navigation reasons. By default the focus is on the first focusable element within modal, which in your case is the close button. You can add ngbAutofocus attribute to the element where you want the focus to be. Focus management demo. <button type="button" ngbAutofocus class="btn btn-danger" (click)="modal.close('Ok click')">Ok</button> You can read more on github If you don't mind the close button actually focused but want to get rid of the ugly outline, you can use outline: none . template.html : <button type="button" aria-label="Close">Close</button> styles.css : button[aria-label="Close"]:focus { outline: none; } It's an ugly hack, but you can add a non visible element as the first element: <input type="text" style="display:none" />

Latex Blank Line Between Paragraphs Code Example

Example: latex space between paragraphs and lines \setlength { \parindent } { 4 em } \setlength { \parskip } { 1 em } \renewcommand { \baselinestretch } { 1.5 }

Cache Network Image Provider Flutter Code Example

Example: flutter cached network image not working Worked for me after searching all over the sites :=> 1. Install the latest dependency for cached_network_image: 2. Stop and Restart the app if you are debugging or running If not goahead with other steps: 3. Flutter clean 4. Quite from IDE 5. Reopen your IDE and run pub get Example: CachedNetworkImage( imageUrl: 'https://picsum.photos/250?image=9', fit: BoxFit.cover, width: MediaQuery.of(context).size.width, placeholder: (context,url) => CircularProgressIndicator(), errorWidget: (context,url,error) => new Icon(Icons.error), ) ###### OR ###### Image(image: CachedNetworkImageProvider('https://picsum.photos/250?image=9'))

Div Element In Css Code Example

Example 1: how to make a div in html <div class= "myDiv" > <h2>This is a heading in a div element</h2> <p>This is some text in a div element.</p> </div> Example 2: html div //div tag <div> //content </div> //a div is an invisible box

ACE Editor Autocomplete - Custom Strings

Answer : you need to add a completer like this var staticWordCompleter = { getCompletions: function(editor, session, pos, prefix, callback) { var wordList = ["foo", "bar", "baz"]; callback(null, wordList.map(function(word) { return { caption: word, value: word, meta: "static" }; })); } } langTools.setCompleters([staticWordCompleter]) // or editor.completers = [staticWordCompleter] If you want to persist the old keyword list and want to append a new list var staticWordCompleter = { getCompletions: function(editor, session, pos, prefix, callback) { var wordList = ["foo", "bar", "baz"]; callback(null, [...wordList.map(function(word) { return { caption: word, value: word, meta: "static" }; }), ...ses...

Entity Framework Update Child Collection Code Example

Example: entity framework update child records public void Update ( UpdateParentModel model ) { var existingParent = _dbContext . Parents . Where ( p => p . Id == model . Id ) . Include ( p => p . Children ) . SingleOrDefault ( ) ; if ( existingParent != null ) { // Update parent _dbContext . Entry ( existingParent ) . CurrentValues . SetValues ( model ) ; // Delete children foreach ( var existingChild in existingParent . Children . ToList ( ) ) { if ( ! model . Children . Any ( c => c . Id == existingChild . Id ) ) _dbContext . Children . Remove ( existingChild ) ; } // Update and Insert children foreach ( var childModel in model . Children ) { var existingChild = existingParent . Children . Where ( c => c . Id == childModel . Id ) . SingleOrDefault ( ) ; if ...

Convert Excel Column Alphabet (e.g. AA) To Number (e.g., 25)

Answer : Try: var foo = function(val) { var base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', i, j, result = 0; for (i = 0, j = val.length - 1; i < val.length; i += 1, j -= 1) { result += Math.pow(base.length, j) * (base.indexOf(val[i]) + 1); } return result; }; console.log(['A', 'AA', 'AB', 'ZZ'].map(foo)); // [1, 27, 28, 702] solution 1: best performance and browser compatibility // convert A to 1, Z to 26, AA to 27 function lettersToNumber(letters){ var chrs = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ', mode = chrs.length - 1, number = 0; for(var p = 0; p < letters.length; p++){ number = number * mode + chrs.indexOf(letters[p]); } return number; } solution 2: best performance and compatibility and shorter code (Recommended) // convert A to 1, Z to 26, AA to 27 function lettersToNumber(letters){ for(var p = 0, n = 0; p < letters.length; p++){ n = letters[p].charCodeAt() - 64 + n * 26; } return n...

Android Can't Record Video With Front Facing Camera, MediaRecorder Start Failed: -19

Answer : I wrestled with this problem a bit today, too. First, make sure that your permissions are set up correctly. Specifically, to record video, you'll want: <uses-feature android:name="android.hardware.camera.front" /> <uses-feature android:name="android.hardware.microphone"/> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Second, and this is the tricky part, this line from the tutorial does not work with the front-facing camera! mMediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)); That signature for CamcorderProfile.get() defaults to a profile for the back-facing camera: Returns the camcorder profile for the first back-facing camera on the device at the given quality level. If the device has n...

Short Int In C++ Code Example

Example: range of long long in c++ Long Data Type Size ( in bytes ) Range long int 4 - 2 , 147 , 483 , 648 to 2 , 147 , 483 , 647 unsigned long int 4 0 to 4 , 294 , 967 , 295 long long int 8 - ( 2 ^ 63 ) to ( 2 ^ 63 ) - 1 unsigned long long int 8 0 to 18 , 446 , 744 , 073 , 709 , 551 , 615

Android - Can Thief Unlock Stolen Phone That Was Locked By Android Device Manager?

Answer : The answer is almost certainly yes. Someone could probably get past it in one way or another. (They could probably just use odin on a samsung device for example. Though I have never done something like that myself.) If you have sensitive data on there then a remote wipe might be the best thing. Did you report it stolen with your carrier? They could report the ESN / IMEI as stolen so at the very least the thief probably wouldn't be able to sell it. Of course I do not know your exact situation. If you know for sure it was stolen and not lost could the police recover it from the thief? Either way best of luck to you. It would depend on the phone, but as firesoul453 said in his answer, almost certainly yes. Locking the phone is intended to protect the data - In other words: the thief cannot get your data off of the phone. Due to the nature of the android system though, it's usually very easy to wipe out the data on the phone. Usually this can be done via r...

Input Type=textarea Code Example

Example 1: html textarea <textarea id= "txtid" name= "txtname" rows= "4" cols= "50" maxlength= "200" > A nice day is a nice day. Lao Tseu </textarea> Example 2: syntax is being placed in my textarea in html <textarea name= "comment" rows= "5" cols= "100" ></textarea></br></br> Example 3: textarea <textarea></textarea> Example 4: html input textarea Check this : https : //codepen.io/DevLorenzo/pen/wvzNPKz Example 5: form::textarea { !! Form : : textarea ( 'placeOfDeath' , null , [ 'class' => 'form-control' , 'rows' => 2 , 'cols' => 40 ] ) !! }

Latex Maketitle Add Spacing Code Example

Example: spacing lines latex \usepackage { setspace } \doublespacing

Brackeys Unity Code Example

Example 1: brackeys brackeys is god Example 2: brackeys Good choice, yes yes

Animation Play Unity Script Code Example

Example 1: how to play animation with code in unity public GameObject ExampleNPC ; void Update ( ) { if ( Input . GetButtonDown ( "Animation" ) ) // Make sure to refrence this in Input settings { ExampleNPC . GetComponent < Animator > ( ) . Play ( "Anim name" ) ; } } Example 2: play animation through script unity animator . Play ( "StateName" ) ;

C++ Vector Pop Front Code Example

Example 1: c++ vector pop first element std :: vector < int > vect ; vect . erase ( vect . begin ( ) ) ; Example 2: vector erase specific element vector . erase ( vector . begin ( ) + 3 ) ; // Deleting the fourth element Example 3: delete from front in vector c++ // Deleting first element vector_name . erase ( vector_name . begin ( ) ) ; // Deleting xth element from start vector_name . erase ( vector_name . begin ( ) + ( x - 1 ) ) ; // Deleting from the last vector_name . pop_back ( ) ; Example 4: vector erase specific element template < typename T > void remove ( std :: vector < T > & vec , size_t pos ) { std :: vector < T > :: iterator it = vec . begin ( ) ; std :: advance ( it , pos ) ; vec . erase ( it ) ; }