Posts

Showing posts from July, 2008

ChartJS Timeline With Images Code Example

Example 1: chartJS Timeline with images < script src = " https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.bundle.min.js " > </ script > < canvas id = " chart " height = " 28 " > </ canvas > Example 2: chartJS Timeline with images const img = new Image(16, 16); img.src = 'https://i.stack.imgur.com/Q94Tt.png'; var ctx = document.getElementById('chart').getContext('2d'); var myChart = new Chart(ctx, { type: 'line', data: { datasets: [{ data: [ { x: "2020-03-22", y: 0 }, { x: "2020-04-01", y: 0 }, { x: "2020-04-02", y: 0 }, { x: "2020-04-03", y: 0 }, { x: "2020-04-08", y: 0 }, { x: "2020-04-12", y: 0 }, { x: "2020-04-15", y: 0 } ], pointStyle: img, borderWidth: 1 }] }, options: { legend: { display: false }

Advanced Reference Qualifier Servicenow Code Example

Example: advanced reference qualifier servicenow javascript:"company=" + current.company

Angular 7 Test: NullInjectorError: No Provider For ActivatedRoute

Answer : You have to import RouterTestingModule import { RouterTestingModule } from "@angular/router/testing"; imports: [ ... RouterTestingModule ... ] Add the following import imports: [ RouterModule.forRoot([]), ... ], I had this error for some time as well while testing, and none of these answers really helped me. What fixed it for me was importing both the RouterTestingModule and the HttpClientTestingModule. So essentially it would look like this in your whatever.component.spec.ts file. beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ProductComponent], imports: [RouterTestingModule, HttpClientTestingModule], }).compileComponents(); })); You can get the imports from import { RouterTestingModule } from "@angular/router/testing"; import { HttpClientTestingModule } from "@angular/common/http/testing"; I dont know if this is the best solution, but this worked for me.

Bootstrap How To Make A Image Responsive Code Example

Example: how to make image responsive bootstrap 4 <img src= "..." class= "img-fluid" alt= "Responsive image" >

Change Status Bar Text Color When PrimaryDark Is White

Answer : I'm not sure what API level your trying to target, but if you can use API 23 specific stuff, you can add the following to your AppTheme styles.xml: <item name="android:statusBarColor">@color/colorPrimaryDark</item> <item name="android:windowLightStatusBar">true</item> when android:windowLightStatusBar is set to true, status bar text color will be able to be seen when the status bar color is white, and vice-versa when android:windowLightStatusBar is set to false, status bar text color will be designed to be seen when the status bar color is dark. Example: <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="

120 Dollars In Euro Code Example

Example: dollars in euros Stonks in european

Check If Array Has Value Jquery Code Example

Example: jquery check value exists in array if ( $ . inArray ( 'example' , myArray ) != - 1 ) { // found it }

Can Not Run Configure Command: "No Such File Or Directory"

Answer : If the file is called configure.ac, do $> autoconf Depends: M4, Automake If you're not sure what to do, try $> cat readme They must mean that you use "autoconf" to generate an executable "configure" file. So the order is: $> autoconf $> ./configure $> make $> make install The failsafe for generating a configure script is autoreconf -i , which not only takes care of calling autoconf itself, but also a host of other tools that may be needed. It's just problem with permissions Run chmod +x ./configure Should work

Quicksort Gfg Recursive Code Example

Example: Quick Sort in c++ # include <bits/stdc++.h> using namespace std ; void swap ( int * a , int * b ) { int t = * a ; * a = * b ; * b = t ; } int partition ( int arr [ ] , int low , int high ) { int pivot = arr [ high ] ; int i = ( low - 1 ) ; for ( int j = low ; j <= high - 1 ; j ++ ) { if ( arr [ j ] < pivot ) { i ++ ; swap ( & arr [ i ] , & arr [ j ] ) ; } } swap ( & arr [ i + 1 ] , & arr [ high ] ) ; return ( i + 1 ) ; } void quickSort ( int arr [ ] , int low , int high ) { if ( low < high ) { int pi = partition ( arr , low , high ) ; quickSort ( arr , low , pi - 1 ) ; quickSort ( arr , pi + 1 , high ) ; } } void printArray ( int arr

Adding Admin Menu Separators In WordPress

Answer : You should hook in admin_menu : add_action('admin_menu','admin_menu_separator'); And use something lower than 220 . The biggest offset I got in my system is 99 . Check this very fine class to deal with Admin Menus. It appeared in this WPSE Question: Add a Separator to the Admin Menu?

Irremoteesp8266 Example

Example: irremoteesp8266 example # include <IRremoteESP8266.h> int RECV_PIN = D4 ; //an IR detector connected to D4 IRrecv irrecv ( RECV_PIN ) ; decode_results results ; void setup ( ) { Serial . begin ( 9600 ) ; irrecv . enableIRIn ( ) ; // Start the receiver } void loop ( ) { if ( irrecv . decode ( & results ) ) { Serial . println ( results . value , HEX ) ; irrecv . resume ( ) ; // Receive the next value } delay ( 100 ) ; }

Angular2 Dynamic Change CSS Property

Answer : 1) Using inline styles <div [style.color]="myDynamicColor"> 2) Use multiple CSS classes mapping to what you want and switch classes like: /* CSS */ .theme { /* any shared styles */ } .theme.blue { color: blue; } .theme.red { color: red; } /* Template */ <div class="theme" [ngClass]="{blue: isBlue, red: isRed}"> <div class="theme" [class.blue]="isBlue"> Code samples from: https://angular.io/cheatsheet More info on ngClass directive : https://angular.io/docs/ts/latest/api/common/index/NgClass-directive.html Just use standard CSS variables: Your global css (eg: styles.css) body { --my-var: #000 } In your component's css or whatever it is: span { color: var(--my-var) } Then you can change the value of the variable directly with TS/JS by setting inline style to html element: document.querySelector("body").style.cssText = "--my-var: #000"; Otherwise you

Bootstrap Accordion, Scroll To Top Of Active (open) Accordion On Click?

Answer : You can animate the scroll by getting the top of the 'target element' and then calling animate on the body.. $('html, body').animate({ scrollTop: $("#target-element").offset().top }, 1000); modifying it to be something like this will help you achieve what you are after $('.panel-collapse').on('shown.bs.collapse', function (e) { var $panel = $(this).closest('.panel'); $('html,body').animate({ scrollTop: $panel.offset().top }, 500); }); source: http://www.abeautifulsite.net/smoothly-scroll-to-an-element-without-a-jquery-plugin-2/ complementary fiddle: https://jsfiddle.net/hjugdwbp/ Edit: 2018-05-25 Bootstrap 4 Example Using the accordion example at: https://getbootstrap.com/docs/4.0/components/collapse/#accordion-example I have modified the code to support cards. $('.collapse').on('shown.bs.collapse', function(e) { var $card = $(this).closest('.card

Cannot Run Firebase Init Code Example

Example 1: angular install firebase tools npm install -g firebase-tools Example 2: You're about to initialize a Firebase project in this directory: fgirebase 1) locate the firebase.json file in your /Users/username directory 2) delete that firebase.json file 3) Now run the firebase init command in your new project directory

Cannot Create A New Table After "DROP SCHEMA Public"

Answer : The error message pops up when none of the schemas in your search_path can be found. Either it is misconfigured. What do you get for this? SHOW search_path; Or you deleted the public schema from your standard system database template1 . You may have been connected to the wrong database when you ran drop schema public cascade; As the name suggests, this is the template for creating new databases. Therefore, every new database starts out without the (default) schema public now - while your default search_path probably has 'public' in it. Just run (as superuser public or see mgojohn's answer): CREATE SCHEMA public; in the database template1 (or any other database where you need it). The advice with DROP SCHEMA ... CASCADE to destroy all objects in it quickly is otherwise valid. That advice can cause some trouble if you have an application user (like 'postgres') and run the DROP/CREATE commands as a different user. This would happen

Best Sensitivity For Pubg Gyroscope Android For High Gyro Player Code Example

Example: best pubg gyro sensitivity TPP with no scope: 95-100% FPP with no scope: 95-100% Red Dot, Holographic, Aim Assist: 90-95% 2x Scope: 120-125% 3x Scope: 60-65% 4x Scope, VSS: 50-55% 6x Scope: 40-45% 8x Scope: 30-35%

Angular Material Datepicker: Change Event Not Firing When Selecting Date

Answer : There's a dateChange event that's raised both when the date is edited in the text box and when the date is changed via the calendar control. See here <mat-form-field> <input matInput [matDatepicker]="datepicker" required placeholder="Choose a date" (dateChange)="valueChanged()"> <mat-datepicker-toggle matSuffix [for]="datepicker"></mat-datepicker-toggle> <mat-datepicker #datepicker></mat-datepicker> </mat-form-field> Replace change with ngModelChange Change from <input mdInput [mdDatepicker]="datePicker" placeholder="Choose Date" name="date" [(ngModel)]="date" (change)="updateCalcs()" required> To <input mdInput [mdDatepicker]="datePicker" placeholder="Choose Date" name="date" [(ngModel)]="date" (ngModelCha

ADB Root Is Not Working On Emulator (cannot Run As Root In Production Builds)

Answer : To enable root access: Pick an emulator system image that is NOT labelled "Google Play". (The label text and other UI details vary by Android Studio version.) Exception: As of 2020-10-08, the Release R "Android TV" system image will not run as root. Workaround: Use the Release Q (API level 29) Android TV system image instead. Test it: Launch the emulator, then run adb root . It should say restarting adbd as root or adbd is already running as root not adbd cannot run as root in production builds Alternate test: Run adb shell , and if the prompt ends with $ , run su . It should show a # prompt. Steps: To install and use an emulator image that can run as root: In Android Studio, use the menu command Tools > AVD Manager . Click the + Create Virtual Device... button. Select the virtual Hardware, and click Next . Select a System Image. Pick any image that does NOT say "(Google Play)" in the Target column. If you dep

Add Day To Date Javascript Code Example

Example 1: js date add 1 day let date = new Date ( ) ; // add a day date . setDate ( date . getDate ( ) + 1 ) ; Example 2: javascript add day to date function addDays ( date , days ) { var result = new Date ( date ) ; result . setDate ( result . getDate ( ) + days ) ; return result ; } Example 3: javascript add days to date var myCurrentDate = new Date ( ) ; var myFutureDate = new Date ( myCurrentDate ) ; myFutureDate . setDate ( myFutureDate . getDate ( ) + 8 ) ; //myFutureDate is now 8 days in the future Example 4: javascript date add days function addDays ( originalDate , days ) { cloneDate = new Date ( originalDate . valueOf ( ) ) ; cloneDate . setDate ( cloneDate . getDate ( ) + days ) ; return cloneDate ; } let appointment = new Date ( "February 12, 2021 00:00:00" ) ; let newAppointment = addDays ( appointment , 7 ) ; console . log ( appointment . getDate ( ) ) ; // 12 console . log ( newAppoin

Border: InputBorder Properties Flutter Code Example

Example: input border flutter TextField ( decoration : new InputDecoration ( focusedBorder : OutlineInputBorder ( borderSide : BorderSide ( color : Colors . greenAccent , width : 5.0 ) , ) , enabledBorder : OutlineInputBorder ( borderSide : BorderSide ( color : Colors . red , width : 5.0 ) , ) , hintText : 'Mobile Number' , ) , ) ,

Catching SIGTERM Vs Catching SIGINT

Answer : The accepted answer is wrong. From https://en.wikipedia.org/wiki/Unix_signal SIGTERM The SIGTERM signal is sent to a process to request its termination... SIGINT is nearly identical to SIGTERM. The description around command kill is incorrect. You can catch both of them and still be able to close the process with a SIGKILL - kill -9 pid That's wrong. Again, from above wiki: The SIGKILL signal is sent to a process to cause it to terminate immediately (kill). In contrast to SIGTERM and SIGINT, this signal cannot be caught or ignored, and the receiving process cannot perform any clean-up upon receiving this signal. So, all in all, SIGINT is nearly identical to SIGTERM . From https://en.wikipedia.org/wiki/Unix_signal: SIGINT is generated by the user pressing Ctrl + C and is an interrupt SIGTERM is a signal that is sent to request the process terminates. The kill command sends a SIGTERM and it's a terminate You can catc