Posts

Showing posts from March, 2006

Boto S3 List Files In Folder Code Example

Example: list file in s3 boto import boto3 s3 = boto3.resource('s3') my_bucket = s3.Bucket('my_bucket_name') for object_summary in my_bucket.objects.filter(Prefix="dir_name/"): print(object_summary.key)

How To Offset A Border Css Code Example

Example: css offset border * { box-sizing : border-box ; } .container { height : 200 px ; width : 200 px ; position : relative ; background-color : red ; margin : 20 px ; } .inner { width : 100 % ; height : 100 % ; position : absolute ; border : 2 px solid black ; top : -10 px ; left : -10 px ; z-index : 10 ; }

Css Text Transform First Letter Uppercase Code Example

Example 1: css all caps .uppercase { text-transform : uppercase ; } #example { text-transform : none ; /* No capitalization, the text renders as it is (default) */ text-transform : capitalize ; /* Transforms the first character of each word to uppercase */ text-transform : uppercase ; /* Transforms all characters to uppercase */ text-transform : lowercase ; /* Transforms all characters to lowercase */ text-transform : initial ; /* Sets this property to its default value */ text-transform : inherit ; /* Inherits this property from its parent element */ } Example 2: css capitalize first letter & ::first-letter { text-transform : capitalize ; } Example 3: css text transform #example { text-transform : none ; /* No capitalization, the text renders as it is (default) */ text-transform : capitalize ; /* Transforms the first character of each word to uppercase */ text-transform : uppercase ; /* Transforms all characters to uppercas

Build Python Script To Executable File For Windows/MacOS/Linux

Answer : This tutorial will show you how to convert Python to exe using PyInstaller. Make sure you have Python installed # The first thing is, of course, you have to install Python. Please don't forget to add Python to your PATH environment. Install Pyinstaller # Open your command promt/terminal and execute the command to install PyInstaller pip install Pyinstaller Build Python script to executable binary file # Let say we have a very simple Python script that just print the Hello world text to the console. This file name is "test.py" test.py : print ( "Hello world" ) To build that Python to exe we can use Pyinstaller which was installed in previous step pyinstaller --onefi

Get Involved Html And Css W3schools Code Example

Example: how to use css <link rel="stylesheet" href="stylesheet .css " > <div class="mydiv" > </div > <style > .mydiv { background-color : /*Color*/ ; color : /*Another color*/ ; } </style>

Cross Font Awesome Icon Code Example

Example 1: cross icon font awesome < i class = " fa fa-times " aria-hidden = " true " > </ i > Example 2: cross icon font awesome < i class = " fa fa-times " aria-hidden = " true " > </ i > Example 3: close button in font awesome < i class = " fas fa-times-circle " > </ i >

Add A Discount Programmatically To An Order In Woocommerce 3.2+

Image
Answer : The only available feature to make a discount programmatically for an Order , is tricking the Fee API . For info, this trick is not recommended by woocommerce, but used by many people as there is not a discount feature in Woocommerce outside Coupons. The following function will allow you to make a fixed discount of any amount or a percentage discount. The order need to exist (to be saved before) . The function code (For Woocommerce versions 3.2+) : /** * Add a discount to an Orders programmatically * (Using the FEE API - A negative fee) * * @since 3.2.0 * @param int $order_id The order ID. Required. * @param string $title The label name for the discount. Required. * @param mixed $amount Fixed amount (float) or percentage based on the subtotal. Required. * @param string $tax_class The tax Class. '' by default. Optional. */ function wc_order_add_discount( $order_id, $title, $amount, $tax_class = '' ) { $order = wc_ge

Count Days Between Two Dates In Sql Code Example

Example: sql get number of days between two dates DATEDIFF ( DAY , '1/1/2011' , '3/1/2011' )

Code Blocks C++ Online Compiler Code Example

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

Cookie Clicker Hack Extension Code Example

Example 1: cookie clicker hack // change number of cookies (you can still click on things that look unselectable) Game . cookies = 100000000 // and auto clicker: function myFunction ( ) { document . getElementById ( "bigCookie" ) . click ( ) ; document . getElementById ( "bigCookie" ) . click ( ) ; document . getElementById ( "bigCookie" ) . click ( ) } ; window . setInterval ( myFunction , 0.0001 ) Example 2: cookie clicker hack extension // change number of cookies (you can still click on things that look unselectable) Game . cookies = 100000000 // and auto clicker: function myFunction ( ) { document . getElementById ( "bigCookie" ) . click ( ) ; document . getElementById ( "bigCookie" ) . click ( ) ; document . getElementById ( "bigCookie" ) . click ( ) } ; window . setInterval ( myFunction , 0.0001

3. What Is DDL , DML? What's The Difference ? Code Example

Example: difference between ddl and dml DDL 1-It stands for Data Definition Language. 2-It is used to create database schema and can be used to define some constraints as well. 3-It basically defines the column (Attributes) of the table. 4-It doesn’t have any further classification. 5-Basic command present in DDL are CREATE, DROP, RENAME, ALTER etc. 6-DDL does not use WHERE clause in its statement. DML 1-It stands for Data Manipulation Language. 2-It is used to add, retrieve or update the data. 3-It add or update the row of the table. These rows are called as tuple. 4-It is further classified into Procedural and Non-Procedural DML. 5-BASIC command present in DML are UPDATE, INSERT, MERGE etc. 6-While DML uses WHERE clause in its statement.

Can I Add Visualization To VLC

Answer : ... a solution for windows: 1) Browse to the VLC folder, e.g. C:\Program Files (x86)\VideoLAN\VLC , and create a new folder called visualizations 2) Download the latest preset_samples of ProjectM, e.g. presets-2.0.0-Source.tar.gz and extract all the .milk files to the visualizations folder created above. 3) In VLC open Preferences from the menu, go to the audio tab and under Output select "Directx audio output" as your Output module. Also make sure that "LibprojectM effect" is selected as your Visualisation. 4) Still in the Preferences menu, click the "All" radiobutton at the bottom left corner. Go to advanced preferences > Audio > Visualizations > projectM and set the "projectM preset path" to C:\Program Files (x86)\VideoLAN\VLC\visualizations 4) Save your preferences, then activate the visualizations by going to the audio menu > visualizations > and select projectM VLC will now begin using random visua

Fas Fa Facebook Code Example

Example 1: fa fa-facebook < i class = "fa fa-facebook-square" aria - hidden = "true" > < / i > Example 2: font awesome facebook Font Awesome 5 : Letter F : < i class = "fab fa-facebook-f" > < / i > Round : < i class = "fab fa-facebook" > < / i > Square : < i class = "fab fa-facebook-square" > < / i > Messenger : < i class = "fab fa-facebook-messenger" > < / i >

1,000+ Python Practice Challenges // Edabit Go To : Https://edabit.com/challenges/python3 Code Example

Example: python challenges Edabit is a great website for python coding challenges Go to https : // edabit . com / challenges / python3

Latex Font Size Overleaf Code Example

Example 1: latex font sizes \Huge \huge \LARGE \Large \large \ normalsize ( default ) \small \footnotesize \scriptsize \tiny Example 2: latex font sizes Change global font size : \documentclass [ 12 pt ] { report }

Underscore In Latex Overleaf Code Example

Example: underscore latex \documentclass { article } \begin { document } \texttt { Samp\_Dist\_Corr } \verb | Samp_Dist_Corr | \texttt { Samp\ char `_Dist\ char `_Corr } \end { document }

Addforce Unity 3d Code Example

Example 1: Rigidbody.addforce using UnityEngine ; public class ExampleClass : MonoBehaviour { public float thrust = 1.0f ; public Rigidbody rb ; void Start ( ) { rb = GetComponent < Rigidbody > ( ) ; rb . AddForce ( 0 , 0 , thrust , ForceMode . Impulse ) ; } } Example 2: unity rigidbody addforce rb = GetComponent < Rigidbody > ( ) ; rb . AddForce ( new Vector3 ( 1.5f , 1.5f , 1.5f ) ) ; Example 3: rb.addforce c# rb . AddForce ( 0 , 0 , 5 * Time . deltaTime ) ; // Time.deltaTime is optional ( Make sure that "T" is caps) Example 4: rb.addforce 3d c# rb . AddForce ( 0 , 0 , 5 * time . deltaTime ) ; // time.deltaTime is optional

Convert Web Extension To Safari App Extension

Image
Answer : You should be able to reuse Content Scripts from your Web-Extensions (but you need to rewrite code to be able to send/receive messages with "background"). Background script will have to be re-written in Swift or Objective-C. You need to developp: a Mac Host Application (which will be a companion to the Extension) : Swift or Objective-C (this app must have minimum features to pass Apple review - check the Apple guidelines for Mac Apps) the extension : in Swift or Objective-C + HTML/JS (as for other browsers) The code in Swift (or Obj-C) for the extension is the equivalent of the background page you have in Web Extensions. It will control the toolbar button, life-cycle of the extension and can talk with injected scripts. You have an (small) example on Apple website : https://developer.apple.com/documentation/safariservices/safari_app_extensions?changes=_2&language=objc You should not use Extension Builder anymore (accessible from Developer menu in Safari) since

Css Smooth Scroll To Anchor Code Example

Example 1: javascript smooth scroll to anchor element //add smooth scrolling when clicking any anchor link document . querySelectorAll ( 'a[href^="#"]' ) . forEach ( anchor => { anchor . addEventListener ( 'click' , function ( e ) { e . preventDefault ( ) ; document . querySelector ( this . getAttribute ( 'href' ) ) . scrollIntoView ( { behavior : 'smooth' } ) ; } ) ; } ) ; //<a href="#someOtherElementID"> Go to Other Element Smoothly </a> Example 2: smooth scroll css html { scroll - behavior : smooth ; } /* No support in IE, or Safari You can use this JS polyfill for those */ http : / / iamdustan . com / smoothscroll / Example 3: how to smooth scroll in javascript window . scrollTo ( { top : 900 , behavior : 'smooth' } ) Example 4: smooth scroll // Scroll to specific values // scrollTo is the same window . scroll ( { top : 2500 , left : 0 ,

Letter Outline Font Css Code Example

Example 1: text border css h1 { -webkit-text-stroke : 1 px black ; } Example 2: 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 ; }

ForEach In Nodejs Code Example

Example 1: javascript foreach var colors = [ 'red' , 'blue' , 'green' ] ; colors . forEach ( function ( color ) { console . log ( color ) ; } ) ; Example 2: For-each over an array in JavaScript /** 1. Use forEach and related */ var a = [ "a" , "b" , "c" ] ; a . forEach ( function ( entry ) { console . log ( entry ) ; } ) ; /** 2. Use a simple for loop */ var index ; var a = [ "a" , "b" , "c" ] ; for ( index = 0 ; index < a . length ; ++ index ) { console . log ( a [ index ] ) ; } /**3. Use for-in correctly*/ // `a` is a sparse array var key ; var a = [ ] ; a [ 0 ] = "a" ; a [ 10 ] = "b" ; a [ 10000 ] = "c" ; for ( key in a ) { if ( a . hasOwnProperty ( key ) && // These checks are / ^ 0 $ | ^ [ 1 - 9 ] \d * $ / . test ( key ) && // explained key <= 4294967294