Posts

Showing posts from December, 2019

Convert List To Csv File Python Code Example

Example 1: how to convert list into csv in python import pandas as pd list1 = [1,2,3,4,5] df = pd.DataFrame(list1) df.to_csv('filename.csv', index=False) #index =false removes unnecessary indexing/numbering in the csv Example 2: write a list into csv python # Convert a list into rows for a column in csv import csv for_example = [1, 2, 3, 4, 5, 6] with open('output.csv', 'w', newline='') as csv_1: csv_out = csv.writer(csv_1) csv_out.writerows([for_example[index]] for index in range(0, len(for_example)))

Fa Fa-icon Bootstrap Code Example

Example: font awesome fa Posting random icons in grepper doesn't make sense guys , you need the visuals on the page

Find Pair.first In Vector Code Example

Example: find in set of pairs using first value cpp auto it = std :: find_if ( st . begin ( ) , st . end ( ) , [ ] ( const pair < int , int > & p ) { return p . first == 1 ; } ) ;

Add Opacity To Background Image Css Code Example

Example 1: set background image opacity #bg { background-image : url ( 'images/wood1.jpg' ) ; opacity : 0.2 ; width : 300 px ; height : 300 px ; } Example 2: css opacity example .opacity30 { opacity : 0.3 ; filter : alpha ( opacity= 30 ) ; /* For IE8 and earlier */ } Example 3: background image opacity css body ::before { content : "" ; position : absolute ; top : 0 ; right : 0 ; bottom : 0 ; left : 0 ; z-index : -1 ; background-image : url ( image.jpg ) ; /*Put your image url*/ background-size : cover ; background-position : center ; opacity : 0.25 ; /*Value from 0.0 to 1.0*/ } Example 4: background image opacity css /* Two ways to make images opaque */ div { background-color : rgba ( 120 , 120 , 120 , 0.5 ) /* the 0.5 is the value of opacity on a scale of 0-1 */ } /* OR */ div { background-color : blue opacity : 50 % } Example 5: css ...

Grid In Css Mdn Code Example

Example: css grid mdn /* Answer to: "css grid mdn" */ /* The grid CSS property is a shorthand property that sets all of the explicit grid properties (grid-template-rows, grid-template-columns, and grid-template-areas), and all the implicit grid properties (grid-auto-rows, grid-auto-columns, and grid-auto-flow), in a single declaration. For more information, go to: https://developer.mozilla.org/en-US/docs/Web/CSS/grid */

Css Triangle Borders Code Example

Example: css triangle .arrow-up { width : 0 ; height : 0 ; border-left : 5 px solid transparent ; border-right : 5 px solid transparent ; border-bottom : 5 px solid black ; } .arrow-down { width : 0 ; height : 0 ; border-left : 20 px solid transparent ; border-right : 20 px solid transparent ; border-top : 20 px solid #f00 ; } .arrow-right { width : 0 ; height : 0 ; border-top : 60 px solid transparent ; border-bottom : 60 px solid transparent ; border-left : 60 px solid green ; } .arrow-left { width : 0 ; height : 0 ; border-top : 10 px solid transparent ; border-bottom : 10 px solid transparent ; border-right : 10 px solid blue ; }

Android: How To Programmatically Access The Device Serial Number Shown In The AVD Manager (API Version 8)

Answer : This is the hardware serial number. To access it on Android Q (>= SDK 29) android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE is required. Only system apps can require this permission. If the calling package is the device or profile owner then the READ_PHONE_STATE permission suffices. Android 8 and later (>= SDK 26) use android.os.Build.getSerial() which requires the dangerous permission READ_PHONE_STATE. Using android.os.Build.SERIAL returns android.os.Build.UNKNOWN. Android 7.1 and earlier (<= SDK 25) and earlier android.os.Build.SERIAL does return a valid serial. It's unique for any device. If you are looking for possibilities on how to get/use a unique device id you should read here. For a solution involving reflection without requiring a permission see this answer. Up to Android 7.1 (SDK 25) Until Android 7.1 you will get it with: Build.SERIAL From Android 8 (SDK 26) On Android 8 (SDK 26) and above, this field will return UN...

Text Gradient Color Css Code Example

Example 1: css gradient text h1 { font-size : 72 px ; background : -webkit-linear-gradient ( #eee , #333 ) ; -webkit-background-clip : text ; -webkit-text-fill-color : transparent ; } Example 2: text color as gradient css .gradient-text { background-color : #f3ec78 ; background-image : linear-gradient ( 45 deg , #f3ec78 , #af4261 ) ; background-size : 100 % ; -webkit-background-clip : text ; -moz-background-clip : text ; -webkit-text-fill-color : transparent ; -moz-text-fill-color : transparent ; } Example 3: gradient text color css h4 { background : linear-gradient ( to right , #494964 , #6f6f89 ) ; -webkit-background-clip : text ; -webkit-text-fill-color : transparent ; }

Bootstrap Row With Columns Of Different Height

Image
Answer : This is a popular Bootstrap question, so I've updated and expanded the answer for Bootstrap 3 and Bootstrap 4... The Bootstrap 3 "height problem" occurs because the columns use float:left . When a column is “floated” it’s taken out of the normal flow of the document. It is shifted to the left or right until it touches the edge of its containing box. So, when you have uneven column heights , the correct behavior is to stack them to the closest side. Note : The options below are applicable for column wrapping scenarios where there are more than 12 col units in a single .row . For readers that don't understand why there would ever be more than 12 cols in a row , or think the solution is to "use separate rows" should read this first There are a few ways to fix this.. (updated for 2018) 1 - The 'clearfix' approach (recommended by Bootstrap) like this (requires iteration every X columns). This will force a wrap every X number...

Bootstrap Shadows: Examples Example

Add or remove shadows to elements with box-shadow utilities. Examples While shadows on components are disabled by default in Bootstrap and can be enabled via $enable-shadows , you can also quickly add or remove a shadow with our box-shadow utility classes. Includes support for .shadow-none and three default sizes (which have associated variables to match). < div class = " shadow-none p-3 mb-5 bg-light rounded " > No shadow </ div > < div class = " shadow-sm p-3 mb-5 bg-body rounded " > Small shadow </ div > < div class = " shadow p-3 mb-5 bg-body rounded " > Regular shadow </ div > < div class = " shadow-lg p-3 mb-5 bg-body rounded " > Larger shadow </ div > Sass Variables $box-shadow : 0 .5rem 1rem rgba ( $black , .15 ) ; $box-shadow-sm : 0 .125rem .25rem rgba ( $black , .075 ) ; $box-shadow-lg : 0 1rem 3rem rgba ( $black ,...

Cron Job For Every 3 Hours Code Example

Example 1: cron every 3 hours 0 */3 * * * Example 2: cron every two hours 0 */2 * * *

Convert XML To JSON (and Back) Using Javascript

Answer : I think this is the best one: Converting between XML and JSON Be sure to read the accompanying article on the xml.com O'Reilly site, which goes into details of the problems with these conversions, which I think you will find enlightening. The fact that O'Reilly is hosting the article should indicate that Stefan's solution has merit. https://github.com/abdmob/x2js - my own library (updated URL from http://code.google.com/p/x2js/): This library provides XML to JSON (JavaScript Objects) and vice versa javascript conversion functions. The library is very small and doesn't require any other additional libraries. API functions new X2JS() - to create your instance to access all library functionality. Also you could specify optional configuration options here X2JS.xml2json - Convert XML specified as DOM Object to JSON X2JS.json2xml - Convert JSON to XML DOM Object X2JS.xml_str2json - Convert XML specified as string to JSON X2JS.json2xml_str - Convert JSON to XML s...

Padding In Bootstrap Code Example

Example 1: bootstrap Margin and padding Use the margin and padding spacing utilities to control how elements and components are spaced and sized. Bootstrap 4 includes a five-level scale for spacing utilities , based on a 1 rem value default $spacer variable. Choose values for all viewports ( e.g. , .mr-3 for margin-right : 1 rem ) , or pick responsive variants to target specific viewports ( e.g. , .mr-md-3 for margin-right : 1 rem starting at the md breakpoint ) . <div class= "my-0 bg-warning" >Margin Y 0 </div> <div class= "my-1 bg-warning" >Margin Y 1 </div> <div class= "my-2 bg-warning" >Margin Y 2 </div> <div class= "my-3 bg-warning" >Margin Y 3 </div> <div class= "my-4 bg-warning" >Margin Y 4 </div> <div class= "my-5 bg-warning" >Margin Y 5 </div> <div class= "my-auto bg-warning" >Margin Y Auto</div> Examp...

Ajax Cdn Code Example

Example 1: ajax cdn < script src = " https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js " > </ script > Example 2: jquery cdn google < script src = " https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js " > </ script > Example 3: jqeury cdn //Note: This is for version 3.5.0. You can change it here \/ < script src = " https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js " integrity = " sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ= " crossorigin = " anonymous " > </ script > Example 4: jquery script tag < script src = " https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js " > </ script > // Put this script in the head of your index.html to load jQuery // The Google Hosted Libraries is a stable, reliable, high-speed, // globally available content distribution network for the most popular, // open-source Jav...

Convert String To Utf-8 In Node Js Code Example

Example: node js utf8 encode //install using 'npm install utf8' const utf8 = require ( 'utf8' ) ; utf8 . encode ( string )