Posts

Showing posts from March, 2001

Bootstrap 4 Navbar Active Class

Answer : There are multiple issues... The selector $('.nav li') does nothing because you have no .nav class used anywhere in the markup. It should be $('.navbar-nav .nav-link'). You have style="color:white" on the links which will override any changes you make with the active class. You have no CSS for the active class, and by default Bootstrap active class on navbar-dark is going to be white. What color are you trying to set? Set active in the nav-link instead of the li, .navbar-dark .nav-item > .nav-link.active { color:white; } $('.navbar-nav .nav-link').click(function(){ $('.navbar-nav .nav-link').removeClass('active'); $(this).addClass('active'); }) Demo: https://www.codeply.com/go/I3EjDb74My

Can I Install The Custom Document Well (vertical Tabs) Extension For Visual Studio 2019?

Image
Answer : Update #2 Vertical tabs are out of preview and are now officially part of Visual Studio 2019 v16.4! Update #1 The new "Vertical Document Tabs" feature is part of Visual Studio 2019 version 16.4 Preview 2. There is also a dedicated blog post. Original answer Download CustomDocWell.vsix Unzip the file, e.g. rename it to CustomDocWell.vsix.zip and extract the contents Download the workaround extension.vsixmanifest (non-raw page) The only change is that the upper bound of the InstallationTarget version has been removed Replace the original extension.vsixmanifest with the workaround file Download the workaround manifest.json (non-raw page) The only change is the sha256 for extension.vsixmanifest has been recalculated Replace the original manifest.json with the workaround file Zip the contents into a new CustomDocWell.zip Important : Make sure the root of the zip file is at the level of extension.vsixmanifest and manifest.json , as

Animate Method In Javascript Code Example

Example: javascript animate elements document .getElementById ( "tunnel" ) .animate ( [ // keyframes { transform : 'translateY(0px)' } , { transform : 'translateY(-300px)' } ] , { // timing options duration : 1000 , iterations : Infinity } ) ;

Atlassian Gitflow Workflow Code Example

Example 1: git flow hotfix #Start hotfix git flow hotfix start VERSION #Finish hotfix, Remember to increase your app version! git flow hotfix finish VERSION #Remember to push all branches and tags git push --all --follow-tags Example 2: gitflow workflow diagram $ git checkout -b myfeature develop Switched to a new branch "myfeature" Example 3: gitflow atlassian $ git flow hotfix start hotfix_branch

CakePHP Log (namespace)

Classes summary Log Logs messages to configured Log adapters. One or more adapters can be configured using Cake Logs's methods. If you don't configure any adapters, and write to Log, the messages will be ignored. LogEngineRegistry Registry of loaded log engines Traits summary LogTrait A trait providing an object short-cut method to logging.

Bootstrap Free Download Code Example

Example 1: npm install bootstrap npm install bootstrap @ latest Example 2: bootstrap 4.5 cdn < ! - - Bootstrap 4.5 CSS - -> < link rel = "stylesheet" href = "https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity = "sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin = "anonymous" > < ! - - Bootstrap JS Requirements - -> < script src = "https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity = "sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin = "anonymous" > < / script > < script src = "https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity = "sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin = "anonymous" > < / script > < script src = "https://stackpath.boo

Android Studio - Manually Download System Image For Emulator

Answer : In windows: First locate your android-sdk. By default it's in your C:\Users\Your.name\AppData\Local\ in it's root folder. where you can find: SDK Manager.exe, make a folder name it "system-images", my api 25 image is at system-images\android-25\google_apis\x86_64\Files Hope you can Figure it out. Comment if you have any problem. In mac OSX: ~/Library/Android/sdk/system-images/android-[API_VERSION]/[API_TYPE]/x86 Replace [API_VERSION] with Android version you are downloading and the [API_TYPE] can either be google_apis_playstore or google_apis depending on whether the image you are downloading comes with Google Play or not. On Windows 10: Download the file from e.g.: https://dl.google.com/android/repository/sys-img/google_apis/x86-27_r09.zip. Extract the zipped file. Copy (OR Cut, not recommended) the contents of the extracted folder e.g.: x86 . Find the android-sdk folder. By default, it should be located at C:\Users\[YOUR USER NA

Angular New Date Format Code Example

Example 1: angular date formats 'short' : equivalent to 'M/d/yy, h:mm a' ( 6 / 15 / 15 , 9 : 03 AM ) . 'medium' : equivalent to 'MMM d, y, h:mm:ss a' ( Jun 15 , 2015 , 9 : 03 : 01 AM ) . 'long' : equivalent to 'MMMM d, y, h:mm:ss a z' ( June 15 , 2015 at 9 : 03 : 01 AM GMT + 1 ) . 'full' : equivalent to 'EEEE, MMMM d, y, h:mm:ss a zzzz' ( Monday , June 15 , 2015 at 9 : 03 : 01 AM GMT + 01 : 00 ) . 'shortDate' : equivalent to 'M/d/yy' ( 6 / 15 / 15 ) . 'mediumDate' : equivalent to 'MMM d, y' ( Jun 15 , 2015 ) . 'longDate' : equivalent to 'MMMM d, y' ( June 15 , 2015 ) . 'fullDate' : equivalent to 'EEEE, MMMM d, y' ( Monday , June 15 , 2015 ) . 'shortTime' : equivalent to 'h:mm a' ( 9 : 03 AM ) . 'mediumTime' : equivalent to 'h:mm:ss a' ( 9 : 03 : 01 AM ) . 'longTime' :
Note This plugin is part of the awx.awx collection (version 17.0.1). To install it use: ansible-galaxy collection install awx.awx . To use it in a playbook, specify: awx.awx.tower_application . Synopsis Parameters Notes Examples Synopsis Create, update, or destroy Ansible Tower applications. See https://www.ansible.com/tower for an overview. Parameters Parameter Choices/Defaults Comments authorization_grant_type string Choices: password authorization-code The grant type the user must use for acquire tokens for this application. client_type string Choices: public confidential Set to public or confidential depending on how secure the client device is. description string Description of the application. name string / required Name of the application. organization string / required Name of organization for application. redirect_uris list / elements=string Allowed urls list, spa

Change Action Bar Color Android Studio Code Example

Example 1: how to change actionbar color in android programmatically getSherlockActivity ( ) . getSupportActionBar ( ) . setBackgroundDrawable ( new ColorDrawable ( 0xff00ACED ) ) ; mActionBar . setBackgroundDrawable ( new ColorDrawable ( 0xff00DDED ) ) ; mActionBar . setDisplayShowTitleEnabled ( false ) ; mActionBar . setDisplayShowTitleEnabled ( true ) ; Example 2: actionbar content color in android getActionBar ( ) /* or getSupportActionBar() */ . setTitle ( Html . fromHtml ( "<font color=\"red\">" + getString ( R . string . app_name ) + "</font>" ) ) ;

Belt Balancer Problem (Factorio)

Image
Answer : UTU = Universally throughput unlimited There exist UTU balancers for 3, 4, and 5 belts, and likely for any number of belts . Examples are given in this Jupyter notebook, along with a Python implementation of an iterative algorithm for computing the flow for any set of belts and splitters . I will quote some of the notebook here for those who don't wish to follow the link. I refer to splitters as junctions, since that's how they really function. Each belt is composed of unit length segments, referred to in the game as tiles. In the model, we imagine each belt flowing from left to right along coordinate direction x x x and each junction uniting two belts at the left edge of a given tile. Note that some balancers used in practice contain loops and could not be represented by our model without an infinite length belt. The state of a belt tile is represented by a density 0 ≤ ρ ≤ 1 0 \le \rho \le 1 0 ≤ ρ ≤ 1 and a velocity 0 ≤ v ≤ 1 0 \le v \le 1 0 ≤ v ≤ 1 . T

Are Property Values In CSS Case-sensitive?

Answer : (updating @ÁlvaroG.Vicario answer and comments, and complementing this answer... This is a Wiki, please edit to enhance ) Example: for CSS3 (and HTML5) there are new explicit rules, as " font-face property must be case-insensitive".[2] Context W3C interoperating standards, mainly XML, HTML, CSV and CSS. CSS general rules CSS2 (a W3C standard of 2008) fixed basic conventions about "Characters and case", and CSS3 (a W3C standard for 2015) added something more. By default "all CSS syntax is case-insensitive (...)" [1] There are exceptions , "(...) except for parts that are not under the control of CSS"[1] 2.1. element names are case-sensitive in HTML5 (?) and XML, but case-insensitive in HTML4. 2.2. identifiers (including element names, classes, and IDs in selectors) are case-sensitive. HTML attributes id and class , of font names, and of URIs lies outside the scope of the CSS specification. .... The Case

Angular JS: What Is The Need Of The Directive’s Link Function When We Already Had Directive’s Controller With Scope?

Image
Answer : After my initial struggle with the link and controller functions and reading quite a lot about them, I think now I have the answer. First lets understand , How do angular directives work in a nutshell: We begin with a template (as a string or loaded to a string) var templateString = '<div my-directive>{{5 + 10}}</div>'; Now, this templateString is wrapped as an angular element var el = angular.element(templateString); With el , now we compile it with $compile to get back the link function. var l = $compile(el) Here is what happens, $compile walks through the whole template and collects all the directives that it recognizes. All the directives that are discovered are compiled recursively and their link functions are collected. Then, all the link functions are wrapped in a new link function and returned as l . Finally, we provide scope function to this l (link) function which further executes the wrapped link functions

Border After Each Row In CSS Grid

Answer : Instead of justify-content to center content you could add additional columns before and after your content, both with 1fr . Then position the first div and the div after .line to the start at the second column. Fiddle * { box-sizing: border-box; } .outer { width: 80%; margin: 0 auto; } .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; display: grid; grid-template-columns: 1fr repeat(3, auto) 1fr; } .wrapper>div:not(.line) { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper > div:first-of-type, .line + div { grid-column: 2; } .line { grid-column: 1 / -1; height: 1px; background: black; } <div class="outer"> <div class="wrapper"> <div>1111111</div> <div>222</div> <div>3333333333</div> <div class="line"></div>

Checking If Errno != EINTR: What Does It Mean?

Answer : Many system calls will report the EINTR error code if a signal occurred while the system call was in progress. No error actually occurred, it's just reported that way because the system isn't able to resume the system call automatically. This coding pattern simply retries the system call when this happens, to ignore the interrupt. For instance, this might happen if the program makes use of alarm() to run some code asynchronously when a timer runs out. If the timeout occurs while the program is calling write() , we just want to retry the system call (aka read/write, etc). the answers here are really good and i want to add some internal details : System calls that are interrupted by signals can either abort and return EINTR or automatically restart themselves if and only if SA_RESTART is specified in sigaction(2) and the one responsible for this task is the restart_block which used to track information and arguments for restarting system calls

Arrayformula Vlookup Code Example

Example: vlookup with arrayformula ={"Payment Type"; ARRAYFORMULA(IF(LEN(A2:A), VLOOKUP($A2:A&B2:B,{'S2'!$A$2:A7&'S2'!$B$2:B7, 'S2'!$C$2:C7},2,FALSE),))}

Binary Diff/patch For Large Files On Linux?

Answer : You should probably take a look at the rsync-related tools: rdiff and rdiff-backup . The rdiff command lets you produce a patch file and apply it to some other file. The rdiff-backup command uses this approach to deal with entire directories, but I'm guessing you're working with single-file disk images, so rdiff will be the one to use. xdelta can do everything you want. Fair warning though, if your images aren't very similar, you can end up with a very large patch, because xdelta uses half of the defined memory buffer for finding differences. More information is available at the TuningMemoryBudget wiki page. Increasing the buffer size may help out quite a bit. bsdiff is another option, but it's very RAM hungry and completely inappropriate for anything the size of a disk image. bsdiff is quite memory-hungry. It requires max(17*n,9*n+m)+O(1) bytes of memory, where n is the size of the old file and m is the size of the new file. bspatch

@admin.register Django Code Example

Example 1: django admin register mdoel from django.contrib import admin from myproject.myapp.models import Author admin.site.register(Author) Example 2: django admin register from django.contrib import admin from .models import Author @admin.register(Author) class AuthorAdmin(admin.ModelAdmin): pass Example 3: show post id on django admin interface class BookAdmin(admin.ModelAdmin): readonly_fields = ('id',) admin.site.register(Book, BookAdmin) Example 4: what is admin.tabularinline django from django.contrib import admin class BookInline(admin.TabularInline): model = Book class AuthorAdmin(admin.ModelAdmin): inlines = [ BookInline, ] Example 5: what is admin.tabularinline django from django.db import models class Author(models.Model): name = models.CharField(max_length=100) class Book(models.Model): author = models.ForeignKey(Author, on_delete=models.CASCADE) title = models.CharField(max_length=100)

Code. Oge Code Example

Example: coding Hello, you searched up coding! Please read this announcement. So I am a somewhat well-known grepper code answerer. I just wanted to say that a lot of my old answers, such as "How to draw a circle in javascript" where made when I used only the p5.js library to code. I now know how to code in ACTUAL javascript. Just letting you know that a lot of my old code answers about Javascript probably won't get you far. ok bye no need to like up up and away, happy hamster will SAVE THE DAY

Angular 10 Route Params Code Example

Example 1: angular router with wuery param goProducts ( ) { this . router . navigate ( [ '/products' ] , { queryParams : { order : 'popular' } } ) ; } http : / / localhost : 4200 / products ? order = popular constructor ( private route : ActivatedRoute ) { } ngOnInit ( ) { this . route . queryParams . filter ( params => params . order ) . subscribe ( params => { console . log ( params ) ; // { order: "popular" } this . order = params . order ; console . log ( this . order ) ; // popular } ) ; } Example 2: home page routing in angular const routes : Routes = [ { path : 'home_page_path' , component : HomePageComponent } ] ; add this in app routing file /* I Hope it will Help You. Namaste _/\_ */ Example 3: angular routing url params const appRoutes : Routes = [ { path : 'crisis-center/:param1' , component : CrisisListC

Automatically Open Chrome Developer Tools When New Tab/new Window Is Opened

Image
Answer : On opening the developer tools, with the developer tools window in focus, press F1 . This will open a settings page. Check the "Auto-open DevTools for popups". This worked for me. UPDATE 2: See this answer . - 2019-11-05 You can also now have it auto-open Developer Tools in Pop-ups if they were open where you opened them from. For example, if you do not have Dev Tools open and you get a popup, it won't open with Dev Tools. But if you Have Dev Tools Open and then you click something, the popup will have Dev-Tools Automatically opened. UPDATE: Time has changed, you can now use --auto-open-devtools-for-tabs as in this answer – Wouter Huysentruit May 18 at 11:08 OP: I played around with the startup string for Chrome on execute, but couldn't get it to persist to new tabs. I also thought about a defined PATH method that you could invoke from prompt. This is possible with the SendKeys command, but again, only on a new instance. And DevTools do

Can I Programmatically Move The Steps Of A Mat-horizontal-stepper In Angular / Angular Material

Answer : Yes. It is possible to jump to a specific stepper by using selectedIndex property of the MatStepper . Also, MatStepper exposes public methods next() and previous() . You can use them to move back and forth. In your template: Add an id to your stepper e.g. #stepper . Then in your goBack() and goForward() methods, pass the stepper id: <mat-horizontal-stepper #stepper> <!-- Steps --> </mat-horizontal-stepper> <!-- second option --> <div> <button (click)="goBack(stepper)" type="button">Back</button> <button (click)="goForward(stepper)" type="button">Next</button> </div> .. and in your typescript: import { MatStepper } from '@angular/material/stepper'; goBack(stepper: MatStepper){ stepper.previous(); } goForward(stepper: MatStepper){ stepper.next(); } Link to stackblitz demo . You can also use ViewChild to get a reference to

Stl Stack Code Example

Example 1: stack c++ stack < int > stk ; stk . push ( 5 ) ; int ans = stk . top ( 5 ) ; // ans =5 stk . pop ( ) ; //removes 5 Example 2: stack stl # include <iostream> # include <stack> # include <algorithm> using namespace std ; int main ( ) { stack < int > st ; stack < int > st1 ; st . push ( 100 ) ; st . push ( 90 ) ; st . push ( 80 ) ; st . push ( 70 ) ; st . pop ( ) ; st1 . push ( 10 ) ; st1 . push ( 20 ) ; st1 . push ( 30 ) ; while ( ! st . empty ( ) ) { cout << st . top ( ) << " " ; st . pop ( ) ; } cout << endl ; while ( ! st1 . empty ( ) ) { cout << st1 . top ( ) << " " ; st1 . pop ( ) ; } cout << endl ; st . push ( 100 ) ; st . push ( 90 ) ; st . push ( 80 ) ; st . push ( 70 ) ; st . pop ( ) ; st1 . push ( 10