Posts

Showing posts from January, 2004

Bootstrap Cdn Links Code Example

Example 1: bootstrap cdn < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css " > Example 2: bootstrap cdn link <!-- Latest compiled and minified CSS --> < link rel = " stylesheet " href = " https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css " integrity = " sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u " crossorigin = " anonymous " > <!-- Optional theme --> < link rel = " stylesheet " href = " https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css " integrity = " sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp " crossorigin = " anonymous " > <!-- Latest compiled and minified JavaScript --> < script src = " https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js &qu

Angular Material Grid Layout

Image
Answer : I'll give you the basics. In Angular Material (for Angular 2/4) the most commonly used attributes are: fxLayout="row | column" fxLayoutAlign="start | center | end | stretch | space-around | space-between | none" (can accept 2 properties at the same time) fxFlex="number" (can accept numbers from 1 to 100) You can also use postfix as fxLayout.xs and so on to apply rules only for specific resolution. For more info you can look through the docs: https://github.com/angular/flex-layout/wiki/API-Documentation To play around with alignment, you can use the demonstration from Angularjs Material resource (it's totally the same as for Angular Material for Angular 2/4): https://material.angularjs.org/latest/layout/alignment And another one useful link: https://tburleson-layouts-demos.firebaseapp.com/#/docs

What Is Logger.getlogger In Python Code Example

Example: from logging import logger # ! / usr / bin / env python3 # - * - coding : UTF - 8 - * - import logging logger = logging . getLogger ( __name__ ) logging . basicConfig ( level = logging . DEBUG ) logger . debug ( 'Loging %s lewel' , 'DEBUG' ) logger . info ( 'Loging %s lewel' , 'INFO' ) logger . warning ( 'Loging %s lewel' , 'WARN' ) logger . error ( 'Loging %s lewel' , 'ERROR' ) logger . critical ( 'Loging %s lewel' , 'CRITICAL' )

Android: Statically Underline Dynamic Text In TextView

Answer : The easiest solution is probably to create a custom UnderLineTextView component deriving from TextView, override setText() and set the entire text as underlined, something like this (underline code from the link you referred to above): @Override public void setText(CharSequence text, BufferType type) { // code to check text for null omitted SpannableString content = new SpannableString(text); content.setSpan(new UnderlineSpan(), 0, text.length(), 0); super.setText(content, BufferType.SPANNABLE); } It's then just a matter of using your new component in the layout and setting the text as usual. The rest is handled automatically. More info on custom components: http://developer.android.com/guide/topics/ui/custom-components.html You can underline text over Html.fromHtml(String source) Example: textView.setText(Html.fromHtml("this is <u>underlined</u> text"));

Center Box With Css Code Example

Example 1: css align center //HTML < div class = " parent " > < span > Hello World </ span > </ div > //CSS .parent { display: flex; justify-content: center; align-items: center; } Example 2: css align items vertical center .parent { display: flex; justify-content: center; align-items: center; } Example 3: css center text in div /* For horizontal align: */ parent-element {text-align:center;} /* For horizontal and vertical align: */ parent-element {position: relative;} element-to-be-centered { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } /* See https://www.w3schools.com/css/css_align.asp for more info */ Example 4: how to center a div vertically and horizontally .container{ margin: 0; position: absolute; top: 50%; left: 50%; -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: /* Define the width here; */ height: /* Define the hei

Alter Table Add Column After Another Column Mysql Code Example

Example 1: add column in mysq ALTER TABLE Table_name ADD name_column INT ( 255 ) ; Example 2: mysql alter table add column ALTER TABLE table ADD [ COLUMN ] column_name column_definition [ FIRST | AFTER existing_column ] ;

Batch Update In Knex

Answer : I needed to perform a batch update inside a transaction (I didn't want to have partial updates in case something went wrong). I've resolved it the next way: // I wrap knex as 'connection' return connection.transaction(trx => { const queries = []; users.forEach(user => { const query = connection('users') .where('id', user.id) .update({ lastActivity: user.lastActivity, points: user.points, }) .transacting(trx); // This makes every update be in the same transaction queries.push(query); }); Promise.all(queries) // Once every query is written .then(trx.commit) // We try to execute all of them .catch(trx.rollback); // And rollback in case any of them goes wrong }); You have a good idea of the pros and cons of each approach. I would recommend a raw query that bulk updates over several async updates. Yes you can ru

Collider Oncollisionenter Unity Code Example

Example 1: unity oncollisionenter void OnCollisionEnter ( Collision col ) { //This method will run when your game object //collides with something Debug . Log ( "Collided" ) ; } Example 2: oncollisionenter unity void OnCollisionEnter ( Collision collision ) { if ( collision . gameObject . tag == "Door" ) { // DoorScript is the name you gave to the script on the door DoorScript script = collision . gameObject . GetComponent < DoorScript > ( ) ; // OpenDoor is a method in your door object's script script . OpenDoor ( ) ; } }

Angular/Material Mat-form-field Input - Floating Label Issues

Answer : assuming you are using latest stable version of material 2, you can use floatLabel="never" to force label to not to float. here is live working demo this is clear in documentation https://material.angular.io/components/form-field/api <form class="search-form"> <mat-form-field class="example-full-width" appearance="standard"> <input class="toolbar-search" type="text" matInput> <mat-placeholder>Search</mat-placeholder> <mat-icon matSuffix style="font-size: 1.2em">search</mat-icon> </mat-form-field> </form> Please set the appearance of mat-form-field to standard and the placeholder will stop behaving like label. Explanation : By default the mat-label in mat-form-field floats and the appearance of mat-form-field is "legacy". That means if a mat-label is not present with the form field then placeholder will start behavin

Bootstrap Cdnjs Link Code Example

Example 1: bootstrap javascript cdn < script src = " https://code.jquery.com/jquery-3.4.1.slim.min.js " integrity = " sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n " crossorigin = " anonymous " > </ script > < script src = " https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js " integrity = " sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo " crossorigin = " anonymous " > </ script > < script src = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js " integrity = " sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6 " crossorigin = " anonymous " > </ script > Example 2: bootstrap cdn link < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css " integrity = "

Array Append Php Code Example

Example 1: php append to array $myArr = [ 1 , 2 , 3 , 4 ] ; array_push ( $myArr , 5 , 8 ) ; print_r ( $myArr ) ; // [1, 2, 3, 4, 5, 8] $myArr [ ] = - 1 ; print_r ( $myArr ) ; // [1, 2, 3, 4, 5, 8, -1] Example 2: php append element to array array_push ( $cart , 13 ) ; Example 3: array_push $array [ $key ] = $value ; // or $array [ ] = $value ; // or array_push ( $array , [ mixed $ ... ] ) ; Example 4: php add to array $fruits = [ "apple" , "banana" ] ; // array_push() function inserts one or more elements to the end of an array array_push ( $fruits , "orange" ) ; // If you use array_push() to add one element to the array, it's better to use // $fruits[] = because in that way there is no overhead of calling a function. $fruits [ ] = "orange" ; // output: Array ( [0] => apple [1] => banana [2] => orange ) Example 5: php add item to array <?php $z = [ 'me' , 'you

5 Feet 6 Inches In Cm Code Example

Example: 6 foot 5 to cm 6foot 5inches is 195,58 cm

Angular Firestore Get Document By Id Code Example

Example 1: firestore get id of new document async function addCity(newCity) { const { id } = await db.collection("cities").add(newCity) console.log("the new city's id:", id) } Example 2: get doc id firestore const racesCollection: AngularFirestoreCollection < Race > ; return racesCollection.snapshotChanges().map(actions => { return actions.map(a => { const data = a.payload.doc.data() as Race; data.id = a.payload.doc.id; return data; }); });

Font Awsome Circle Info Icon Code Example

Example: font awsome circle info icon fa - info - circle

Check Constraint - Subqueries Are Not Allowed In This Context

Answer : SQL Server does not currently support subqueries for CHECK CONSTRAINTs. As you have discovered, there can be trouble with CHECK constraints involving UDFs when attempting to circumvent the subquery limitation. The alternative constraint implementation strategies are triggered procedural and embedded procedural . The former is preferred because, in common with declarative constraints, they cannot be circumvented. Implementing a triggered procedural strategy that is well optimized and handles concurrency issues is non-trivial but still doable. I highly recommend the book Applied Mathematics for Database Professionals By Lex de Haan, Toon Koppelaars, chapter 11 (the code examples are Oracle but can be easily ported to SQL Server). As others have mentioned already, this type of Check constraints is not yet implemented in SQL-Server. Besides triggers, you could also examine the possibility of changing the table's design. A possible alternative includes storing the

Bootstrap Selectbox Code Example

Example 1: bootstrap radio <div class= "form-check form-check-inline" > <input class= "form-check-input" type= "radio" name= "inlineRadioOptions" id= "inlineRadio1" value= "option1" > <label class= "form-check-label" for= "inlineRadio1" > 1 </label> </div> <div class= "form-check form-check-inline" > <input class= "form-check-input" type= "radio" name= "inlineRadioOptions" id= "inlineRadio2" value= "option2" > <label class= "form-check-label" for= "inlineRadio2" > 2 </label> </div> <div class= "form-check form-check-inline" > <input class= "form-check-input" type= "radio" name= "inlineRadioOptions" id= "inlineRadio3" value= "option3" disabled> <label class= "fo

Java Method Return Multiple Values Code Example

Example: how to return two values from a function in java int [ ] ans = new int [ 2 ] ; ans [ 0 ] = a + b ; ans [ 1 ] = a - b ; return ans ;

Change Google Maps Marker Icon When Clicking On Other

Answer : What duncan said: What you want to do is add all your markers to an array. In your click event handler, loop over that array, updating each marker's icon. Then finally set the icon for just the marker that's been clicked. google.maps.event.addListener(marker, 'click', (function (marker, i) { return function () { infowindow.setContent(locations[i][0], locations[i][6]); infowindow.open(map, marker); for (var j = 0; j < markers.length; j++) { markers[j].setIcon("https://cdn3.iconfinder.com/data/icons/musthave/24/Stock%20Index%20Up.png"); } marker.setIcon("https://cdn3.iconfinder.com/data/icons/musthave/24/Stock%20Index%20Down.png"); }; working fiddle working code snippet: var markers = []; var map; function initialize() { map = new google.maps.Map(document.getElementById('map'), { zoom: 12, // center: new google.maps.LatLng(-33.92, 151.25), center: new google.maps.LatLng(36.8857, -7