Posts

Converting HTML To Plain Text In PHP For E-mail

Answer : Use html2text (example HTML to text), licensed under the Eclipse Public License. It uses PHP's DOM methods to load from HTML, and then iterates over the resulting DOM to extract plain text. Usage: // when installed using the Composer package $text = Html2Text\Html2Text::convert($html); // usage when installed using html2text.php require('html2text.php'); $text = convert_html_to_text($html); Although incomplete, it is open source and contributions are welcome. Issues with other conversion scripts: Since html2text (GPL) is not EPL-compatible. lkessler's link (attribution) is incompatible with most open source licenses. here is another solution: $cleaner_input = strip_tags($text); For other variations of sanitization functions, see: https://github.com/ttodua/useful-php-scripts/blob/master/filter-php-variable-sanitize.php Converting from HTML to text using a DOMDocument is a viable solution. Consider HTML2Text, which requires PHP5: http://www.howtocreate.co.uk/p...

Could Not Find Com.android.tools.build:gradle:5.6

Answer : Don't confuse gradle with the Android Gradle plugin. classpath 'com.android.tools.build:gradle:5.6' It is the Android Gradle plugin and 5.6 doesn't exist . Use the latest stable release: classpath 'com.android.tools.build:gradle:3.5.0' Check the release notes for other versions. To change the gradle version, edit the file gradle/wrapper/gradle-wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip More info in official doc. There is currently no version 5.6 for the Gradle plugin version. The link below lists all the latest releases for the Gradle plugin versions on Google's Marvel repository. https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google I think what you mean is the distributionUrl version in your Gradle wrapper properties: Go to your gradle-wrapper.properties file and complete as required: distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GR...

164 Cm In Inches Code Example

Example 1: cm to inch 1 cm = 0.3937 inch Example 2: cm to inches const cm = 1 ; console . log ( `cm : $ { cm } = in : $ { cmToIn ( cm ) } ` ) ; function cmToIn ( cm ) { var in = cm / 2.54 ; return in ; }

Adb Logcat Specific App Code Example

Example: android logs for app on terminal adb logcat | grep -F "`adb shell ps | grep com.asanayoga.asanarebel | tr -s [:space:] ' ' | cut -d' ' -f2`"

Array Initializer List Java Code Example

Example: java array initialization int [ ] data = { 10 , 20 , 30 , 40 , 50 , 60 , 71 , 80 , 90 , 91 } ; // or int [ ] data ; data = new int [ ] { 10 , 20 , 30 , 40 , 50 , 60 , 71 , 80 , 90 , 91 } ;

Sass And Scss Tutorial Code Example

Example 1: css sass scss /*SMART DIFFERENCE*/ /*CSS*/ body { font : 100 % Helvetica , sans-serif ; color : #333 ; } /*SCSS*/ $ font-stack : Helvetica , sans-serif ; $ primary-color : #333 ; body { font : 100 % $font-stack ; color : $primary-color ; } /*SASS*/ $ font-stack : Helvetica , sans-serif $ primary-color : #333 body font : 100 % $font-stack color : $primary-color Example 2: Sass Tutorial /* Define standard variables and values for website */ $ bgcolor : lightblue ; $ textcolor : darkblue ; $ fontsize : 18 px ; /* Use the variables */ body { background-color : $bgcolor ; color : $textcolor ; font-size : $fontsize ; }

Angular Material: Mat-select Not Selecting Default

Answer : Use a binding for the value in your template. value="{{ option.id }}" should be [value]="option.id" And in your selected value use ngModel instead of value . <mat-select [(value)]="selected2"> should be <mat-select [(ngModel)]="selected2"> Complete code: <div> <mat-select [(ngModel)]="selected2"> <mat-option *ngFor="let option of options2" [value]="option.id">{{ option.name }}</mat-option> </mat-select> </div> On a side note as of version 2.0.0-beta.12 the material select now accepts a mat-form-field element as the parent element so it is consistent with the other material input controls. Replace the div element with mat-form-field element after you upgrade. <mat-form-field> <mat-select [(ngModel)]="selected2"> <mat-option *ngFor="let option of options2" [value]="option.id...

Boxes Placement In Tcolorbox

Image
Answer : Obviously, you would use the \tcbox macro version for your boxes, rather than the environment form. Calculation of the stackgap is shown automated in this MWE. (Note: this example works starting with V2.30 of tcolorbox). \documentclass{article} \usepackage{stackengine} \usepackage{tcolorbox} \begin{document} \def\boxone{\tcbox[nobeforeafter]{This is a test}} \def\boxtwo{\tcbox[nobeforeafter]{Another test}} \def\boxthree{\tcbox[nobeforeafter,minipage,width=0.7in]{this is a very long box}} \stackon[\heightof{\boxthree}-\heightof{\boxone}-\heightof{\boxtwo}]% {\boxtwo}{\boxone}~\boxthree \end{document} Taking a similar tack to Steven Segletes's answer but using the xcoffins package, which allows us to pick points on the various boxes to line up: \documentclass{article} \usepackage{tcolorbox} \usepackage{xcoffins} \NewCoffin{\CoffinA} \NewCoffin{\CoffinB} \NewCoffin{\CoffinC} \begin{document} % Set up content in three coffins \SetHorizontalCoffin{\CoffinA}...

Android: API Level VS. Android Version

Image
Answer : Well, API is for development, so the changes in new API version are more "inside". But new version of Android usually adds more features for users, that are "visible". Check this page http://developer.android.com/guide/appendix/api-levels.html, there is a table that shows relations between versions and API levels. Multiple versions of Android can have the same API level but the API as an integer allows developers to more easily target devices. The chart below will give you an idea of their relationship but only the documentation contains exhaustive listings of the API levels and how they differ from each other. Source: developer.android.com. Because this data is gathered from the new Google Play Store app, which supports Android 2.2 and above, devices running older versions are not included. However, in August, 2013, versions older than Android 2.2 accounted for about 1% of devices that checked in to Google servers (not those that actually vi...

Pip Install Clear Cache Code Example

Example 1: ignore cache pip # Add --no-cache-dir before install pip --no-cache-dir install scipy Example 2: clear pip cache # this doesnt clear it but allows install with no cache pip install PACKAGE --no-cache-dir Example 3: pip clear download cache pip cache dir

Bottom Border On Bootstrap Row

Answer : You could do this with a pseudo element with left and right margin to overcome the padding issue: @import "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"; .row-bordered:after { content: ""; display: block; border-bottom: 1px solid #ccc; margin: 0 15px; } <div class="container"> <div class="row row-bordered"> <div class="col-xs-10"> Heading Text </div> <div class="col-xs-2 text-right"> <a href="#"><span class="glyphicon glyphicon-pencil"></span></a> <a href="#"><span class="glyphicon glyphicon-trash"></span></a> </div> </div> </div> The solution above longer works in Bootstrap 4 due to switching to Flexbox, but a few modifications fixes it: .row-bordered { position: relative; } .row-bordered:after...

Brew Install Node And Npm Code Example

Example 1: brew install npm brew install node Example 2: install node brew brew update # As a safe measure you should run brew doctor to make sure your system is ready to brew . Run the command below and follow any recommendations from brew doctor . brew doctor # Next , add Homebrew’s location to your $ PATH in your . bash_profile or . zshrc file . echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~ / . profile echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~ / . profile # Next , install Node ( npm will be installed with Node ) : brew install node node - v Example 3: install nodejs via homebrew $ / usr / bin / ruby - e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Coding Language To Make Unity Code Example

Example: what language does unity use C# : most used by far Boo : obscure language that looks Python UnityScript : version of JavaScript , but not identical to

Print Name In C Code Example

Example 1: print variable c printf ( "%d\n" , x ) ; Example 2: print name of file argv c int main ( int argc , char * argv [ ] ) { int i ; for ( i = 0 ; i < argc ; ++ i ) { printf ( "%s\n" , argv [ i ] ) ; } }

C# Invoke Unity Code Example

Example: unity invoke void Start ( ) { Invoke ( /*In quotes is the function name*/ "TurnLastPOff" , /*Time to wait*/ 2 ) ; } public void StartWithDelay ( ) { print ( "This should be printed after 2 seconds" ) ; }

Amazon Linux AMI Vs Ubuntu

Answer : Amazon Linux AMI is a red hat based distro so things like the package installer or the tools for service manage are different, and another thing you need to consider is the way of bootstraping, amazon instances are more flexible to do some things in cloudformation in the ubuntu way the best form to do it is with cloudinit https://help.ubuntu.com/community/CloudInit, you need to consider the packages too are multiple packages that not are native supported by Amazon Linux.