Posts

Bella Ciao Song Which Language Code Example

Example: bella ciao song language Bella Ciao (Hugel Remix) El Profesor You can't look me in the eye You can't even Act like you believe your own story Answering questions with questions Swear it's all the truth You swear it is But tell me why are you so defensive? All this cheap talk is expensive If you gotta hurt me Don't take me for a fool Just hurt me I deserve that from you If you gotta hurt me By tellin' me the truth Then hurt me Don't love me, don't love me with a lie No lie One lie turning, no lie No lie Nothing left to lose And, no lie Know you feel it, no lie Stop tryna fake it, no lie Don't love me, don't love me with a lie Don't love me, don't love me with a lie No lie One lie turning, no lie No lie Nothing left to lose And, no lie One lie turning, no lie No lie Don't love me, don't love me with a lie Don't love me, don't love me, no Don't love me, don't love me with a lie Don't love me, don't lo...

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...

Add Python Path To Environment Variables Code Example

Example 1: add python to path windows 10 To add Python to the Windows Path , follow these steps : 1 . Start the Run box and enter sysdm . cpl 2 . In the System Properties window go to the Advanced tab and click the Environment Variables button 3 . In the System variable window , find the Path variable and click Edit 4 . Position your cursor at the end of the Variable value line and add the path to the python . exe file , preceeded with the semicolon character ( ; ) Example 2: python path to python executable >> > import sys >> > print ( sys . executable ) C : \path\to\python . exe Example 3: add python to path # On linux $ which python ; # Get Path of the executable $ export PATH = $PATH : { PATH_PYTHON } ; # but it isn't continue # ---------------------- $ which python ; # Get Path of the executable export PATH = $PATH : { PATH_PYTHON } ; # add in your ~/.bashrc or your ~/.zshrc

C# Datetime Format Yyyymmddhhmm Code Example

Example: C# datetime.now to string only numbers DateTime . Now . ToString ( "yyyyMMddHHmmss" ) ; // case sensitive

Cheerio: Extract Text From HTML With Separators

Answer : This seems to do the trick: var t = $('html *').contents().map(function() { return (this.type === 'text') ? $(this).text() : ''; }).get().join(' '); console.log(t); Result: One Two Just improved my solution a little bit: var t = $('html *').contents().map(function() { return (this.type === 'text') ? $(this).text()+' ' : ''; }).get().join(''); You can use the TextVersionJS package to generate the plain text version of an html string. You can use it on the browser and in node.js as well. var createTextVersion = require("textversionjs"); var yourHtml = "<h1>Your HTML</h1><ul><li>goes</li><li>here.</li></ul>"; var textVersion = createTextVersion(yourHtml); Download it from npm and require it with Browserify for example. You can use the following function to extract the text from an html separated by a whitespace ...

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...

400x Sorting Speedup By Switching A.localeCompare(b) To (ab?1:0))

Answer : A great performance improvement can be obtained by declaring the collator object beforehand and using it's compare method. EG: const collator = new Intl.Collator('en', { numeric: true, sensitivity: 'base' }); arrayOfObjects.sort((a, b) => { return collator.compare(a.name, b.name); }); Here's a benchmark script comparing the 3 methods: const arr = []; for (let i = 0; i < 2000; i++) { arr.push(`test-${Math.random()}`); } const arr1 = arr.slice(); const arr2 = arr.slice(); const arr3 = arr.slice(); console.time('#1 - localeCompare'); arr1.sort((a, b) => a.localeCompare( b, undefined, { numeric: true, sensitivity: 'base' } )); console.timeEnd('#1 - localeCompare'); console.time('#2 - collator'); const collator = new Intl.Collator('en', { numeric: true, sensitivity: 'base' }); arr2.sort((a, b) => collator.compare(a, b)); console.timeEnd('#2 - collator'); con...

Arduino Sprintf Float Code Example

Example: arduino sprintf float // On arduino, sprintf does not support formatting floats, but it can be done // with some simple integer formatting: float f = 3.14; sprintf(str, "Float value: %d.%02d", (int)f, (int)(fabsf(f)*100)%100); // str will now be: "Float value: 3.14"

Amenable Sentence Code Example

Example: dissuade sentence She said nothing to dissuade him.

Android: TextColor Of Disabled Button In Selector Not Showing?

Answer : You need to also create a ColorStateList for text colors identifying different states. Do the following: Create another XML file in res\color named something like text_color.xml . <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- disabled state --> <item android:state_enabled="false" android:color="#9D9FA2" /> <item android:color="#000"/> </selector> In your style.xml , put a reference to that text_color.xml file as follows: <style name="buttonStyle" parent="@android:style/Widget.Button"> <item name="android:textStyle">bold</item> <item name="android:textColor">@color/text_color</item> <item name="android:textSize">18sp</item> </style> This should resolve your issue. 1.Create a color folder ...

How To Underline In Latex Code Example

Example: underline in latex \underline { science }

Can I Use CloudKit On Android Or Web-based App?

Answer : Yes you can. Apple provides CloudKit JS, specifically designed for web services. I don't know much about Android, but I'm pretty sure it'll be not a hard challenge to run JavaScript. Also CloudKit WebServices could be interesting for you. EDIT advice and discussion To give you an honest advice: Better use something "own". I currently work with a custom server on an AWS EC2 instance and am really happy. You could, for example, write a really simple server using Node.js and connect a Mongo DB NoSQL database. CloudKit is actually not more than this. This is really a simple task. I did this before and with some JavaScript experience and a few days Node exercises it is absolutely feasible; you'll write really nice servers very quickly. In the end, when dealing with more customers, CloudKit will be more expensive, actually. And if you, why ever, must move to a different service, you will have trouble with CK, because you are not able t...

Cluster Forming With Mosquitto Broker

Answer : You can't do clustering with mosquitto. Some other MQTT brokers out there which support clustering, including HiveMQ. HiveMQ has an elastic cluster ability with auto discovery and a distributed masterless architecture and works very well on cloud providers like AWS or Azure. You can see a full list of all brokers which support clustering here. Disclaimer: I'm a developer of HiveMQ, so this answer may be biased. Original source of this answer: Horizontal scaling for brokers. I just added the plugin support. Two functionalities of mosquitto broker combined could be used to setup a n node cluster. Mosquitto bridge support. Plugin support - mosquitto-auth-plug(1) The bridge functionality is used ONLY to synchronize messages between all mosquitto brokers while the mosquitto-auth-plugin could be used to save authorization and ACL in a single database back end. While setting up the bridge, notice the usage of in/out bridge topics to avoid forwarding loop...

Angularjs Select Option Selected Code Example

Example 1: angularjs dropdown < select ng-options = " v.name for v in variants | filter:{type:2} " ng-change = " calculateServicesSubTotal(item) " ng-model = " item.selectedVariant " ng-show = " item.id==8 " name = " posterVariants " ng-required = " item.id==8 && item.quantity > 0 " class = " ng-pristine ng-valid ng-valid-required " > < option value = " ? " selected = " selected " > </ option > < option value = " 0 " > set of 6 traits </ option > < option value = " 1 " > 5 complete sets </ option > </ select > Example 2: selectangularjs < select ng-model = " string " [name = " string " ] [multiple = " string " ] [required = " string " ] [ng-required = " string " ] [ng-change = " string " ] [ng-options = ...

Calculating A 2D Vector's Cross Product

Answer : Implementation 1 returns the magnitude of the vector that would result from a regular 3D cross product of the input vectors, taking their Z values implicitly as 0 (i.e. treating the 2D space as a plane in the 3D space). The 3D cross product will be perpendicular to that plane, and thus have 0 X & Y components (thus the scalar returned is the Z value of the 3D cross product vector). Note that the magnitude of the vector resulting from 3D cross product is also equal to the area of the parallelogram between the two vectors, which gives Implementation 1 another purpose. In addition, this area is signed and can be used to determine whether rotating from V1 to V2 moves in an counter clockwise or clockwise direction. It should also be noted that implementation 1 is the determinant of the 2x2 matrix built from these two vectors. Implementation 2 returns a vector perpendicular to the input vector still in the same 2D plane. Not a cross product in the classical sense but c...

Beautify Php Print_r Code Example

Example: print beauty php print ( "<pre>" . print_r ( $array_data , true ) . "</pre>" ) ;