Posts

Showing posts from March, 2007

Angular 2 Material Design Expand All / Collapse All

Image
Answer : 1- You should remove the mat-accordion to enable multiple expanded panels. 2- Use the expanded parameter to change multiple states at the same time. Here is a running example. EDIT From version 6.0.0-beta-0 you can use multi parameter and the openAll and closeAll functions : 1- Change the mat-accordion element to set the muti to true and get the MatAccordionComponent instance : <mat-accordion #accordion="matAccordion" [multi]="true"> 2- Then use the openAll and closeAll functions to open or close all panels : <button (click)="accordion.openAll()">Expand All </button> <button (click)="accordion.closeAll()">Collapse All </button> Here is a running example. Source Link For the latest version of Angular material 8 Template <button mat-flat-button color="primary" (click)="openAllPanels()"><b>Open Panels</b></button> &nbsp; &l

Bastions Minecraft Types Code Example

Example 1: types of bastions minecraft lol no i'm a speedrunner Example 2: types of bastion minecraft hey, are you into modding or something?

Bat File Comment Line Code Example

Example 1: comment lines in batch file :: This is a comment line Example 2: comment in batch file :: This is a comment REM This is also a comment

Descendant Selector Css Code Example

Example 1: descendent selector in css The descendant combinator — typically represented by a single space ( ) character — combines two selectors such that elements matched by the second selector are selected if they have an ancestor ( parent , parent 's parent, parent' s parent's parent , etc ) element matching the first selector . example : h1 ul { border : 1 px solid #f1f1f1 ; } Explanation : This above CSS code snippet will select all the 'ul' ( unordered list ) tags which are preceeded by an 'h1' ( header tag ) . /*the best way to understand is to practice by implemetation. Create a html file with lots of h1 and ul elements to understand by implementing CSS on them*/ Example 2: css select descendant with class Select an element with the ID "id" and the class "class" : # id . class { } example : < div > < strong id = "id" class = "class" > Foobar

Btrfs Snapshot To Non-btrfs Disk. Encryption, Read Acess

Answer : I will just add to Gilles' answer by saying that although you may use “ cp , rsync , etc.” to transfer your read-only subvolumes / snapshots, you may also send and store the subvolumes as btrfs streams using the btrfs send command. The btrfs Wiki mentions the following use: # btrfs subvolume snapshot -r / /my/snapshot-YYYY-MM-DD && sync # btrfs send /my/snapshot-YYYY-MM-DD | ssh user@host btrfs receive /my/backups # btrfs subvolume snapshot -r / /my/incremental-snapshot-YYYY-MM-DD && sync # btrfs send -p /my/snapshot-YYYY-MM-DD /my/incremental-snapshot-YYYY-MM-DD | ssh user@host btrfs receive /backup/home but you may also just save the streams for future use: # btrfs subvolume snapshot -r / /my/snapshot-YYYY-MM-DD && sync # btrfs send /my/snapshot-YYYY-MM-DD | ssh user@host 'cat >/backup/home/snapshot-YYYY-MM-DD.btrfs' # btrfs subvolume snapshot -r / /my/incremental-snapshot-YYYY-MM-DD && sync # btrfs send -p /my

Javascript Tonumber Code Example

Example 1: how to convert string to int js let string = "1" ; let num = parseInt ( string ) ; //num will equal 1 as a int Example 2: Javascript string to int var myInt = parseInt ( "10.256" ) ; //10 var myFloat = parseFloat ( "10.256" ) ; //10.256 Example 3: string to number javascript // Method - 1 ### parseInt() ### var text = "42px" ; var integer = parseInt ( text , 10 ) ; // returns 42 // Method - 2 ### parseFloat() ### var text = "3.14someRandomStuff" ; var pointNum = parseFloat ( text ) ; // returns 3.14 // Method - 3 ### Number() ### Number ( "123" ) ; // returns 123 Number ( "12.3" ) ; // returns 12.3 Number ( "3.14someRandomStuff" ) ; // returns NaN Number ( "42px" ) ; // returns NaN Example 4: javascript convert string to number or integer //It accepts two arguments. //The first argument is the string to convert. //The second argument is called

Bootstrap Add Margin To A Div Code Example

Example 1: bootstrap Margin and padding Use the margin and padding spacing utilities to control how elements and components are spaced and sized. Bootstrap 4 includes a five-level scale for spacing utilities , based on a 1 rem value default $spacer variable. Choose values for all viewports ( e.g. , .mr-3 for margin-right : 1 rem ) , or pick responsive variants to target specific viewports ( e.g. , .mr-md-3 for margin-right : 1 rem starting at the md breakpoint ) . <div class= "my-0 bg-warning" >Margin Y 0 </div> <div class= "my-1 bg-warning" >Margin Y 1 </div> <div class= "my-2 bg-warning" >Margin Y 2 </div> <div class= "my-3 bg-warning" >Margin Y 3 </div> <div class= "my-4 bg-warning" >Margin Y 4 </div> <div class= "my-5 bg-warning" >Margin Y 5 </div> <div class= "my-auto bg-warning" >Margin Y Auto</div>

Background Image Gradient Generator Code Example

Example: Gradient Color Code Generator background-image: linear-gradient(90deg, #020024 0%, #090979 35%, #00d4ff 100%);

Bootstrap: Add Margin/padding Space Between Columns

Image
Answer : Simply add a div within col-md-6 that has the extra padding that you need. The col-md-6 is the 'backbone' to keep the column integrity, but you can add additional padding within it. <div class="row"> <div class="text-center col-md-6"> <div class="classWithPad">Widget 1</div> </div> <div class="text-center col-md-6"> <div class="classWithPad">Widget 2</div> </div> </div> CSS .classWithPad { margin:10px; padding:10px; } Update 2018 Bootstrap 4 now has spacing utilities that make adding (or substracting) the space (gutter) between columns easier. Extra CSS isn't necessary . <div class="row"> <div class="text-center col-md-6"> <div class="mr-2">Widget 1</div> </div> <div class="text-center col-md-6"> <div c

C Program To Add Two Numbers Using Functions Code Example

Example 1: c program to add two numbers # include <stdio.h> int main ( ) { int number1 , number2 , sum ; printf ( "Enter two integers: " ) ; scanf ( "%d %d" , & number1 , & number2 ) ; // calculating sum sum = number1 + number2 ; printf ( "%d + %d = %d" , number1 , number2 , sum ) ; return 0 ; } Example 2: add 2 numbers in c # include <stdio.h> int main ( ) { int a , b , sum ; printf ( "\nEnter two no: " ) ; scanf ( "%d %d" , & a , & b ) ; sum = a + b ; printf ( "Sum : %d" , sum ) ; return ( 0 ) ;

Angular / TypeScript - Call A Function After Another One Has Been Completed

Answer : So remove the setTimeout part. It will call resolve or reject and then pass the execution to the next then or catch handler. If you have some asynchronous call in the Promise, you need to call resolve/reject in the result of that call. What about not waiting 1500ms - the given time is actually the lowest time after which the function may be called. Maybe after 2000ms This is related to the main thread in which JS code works. If main thread has no work to done, then the results of the asynchronous calls are going to be executed. function f1() { return new Promise((resolve, reject) => { console.log('f1'); resolve(); }); } function f2() { console.log('f2'); } f1().then(res => f2()); If f1 is synchronous , there is nothing special to do: global() { f1(); f2(); } If f1 is asynchronous and return an Observable , use Rxjs operator , like concatMap: global() { f1().concatMap(() =>

Appendix Latex Code Example

Example: appendices latex \documentclass{article} \usepackage[title]{appendix} \begin{document} \section{title 1} \section{title 2} \begin{appendices} \section{Some Notation} \section{Some More Notation} \end{appendices} \end{document}

Bitbucket Git Credentials If Signed Up With Google

Answer : You should do a one-time setup of creating an " App password " in Bitbucket web UI with permissions to at least read your repositories and then use it in the command line. How-to: Login to Bitbucket Click on your profile image on the right (now on the bottom left) Choose Bitbucket settings (now Personal settings ) Under Access management section look for the App passwords option (https://bitbucket.org/account/settings/app-passwords/) Create an app password with permissions at least to Read under Repositories section. A password will be generated for you. Remember to save it, it will be shown only once! The username will be your Google username. Solved: Went on the log-in screen and clicked forgot my password . I entered my Google account email and I received a reset link. As you enter there a new password you'll have bitbucket id and password to use. Sample: git clone https://<bitbucket_id>@bitbucket.org/<repo> It's M

Autohotkey Comment Code Example

Example: autohotkey coment ; AutoHotkey single line comment /* AutoHotkey multi-line comment */

Binding Only Part Of The Margin Property Of WPF Control

Answer : Have you tried using a converter like this? in VB.Net Public Class MarginConverter Implements IValueConverter Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert Return New Thickness(0, CDbl(value), 0, 0) End Function Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack Return Nothing End Function End Class Or in C# public class MarginConverter : IValueConverter { public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) { return new Thickness(0, System.Convert.ToDouble(value), 0, 0); } public object ConvertBack(o

Android Check Internet Connection

Answer : This method checks whether mobile is connected to internet and returns true if connected: private boolean isNetworkConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected(); } in manifest, <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> Edit: This method actually checks if device is connected to internet(There is a possibility it's connected to a network but not to internet). public boolean isInternetAvailable() { try { InetAddress ipAddr = InetAddress.getByName("google.com"); //You can replace it with your name return !ipAddr.equals(""); } catch (Exception e) { return false; } } Check to make sure it is

Bootstrap 3 Offset Code Example

Example 1: bootstrap 3 offset col-sm-offset-2 Example 2: bootstrap container width -------------------------------------------------------------------------------------- Bootstrap Container Width | Size | Class Prefix -------------------------------------------------------------------------------------- Extra small devices Phones (less than 768px) | None (auto) | .col-xs- Small devices Tablets (greater than equals 768px) | 750px | .col-sm- Medium devices Desktops (greater than equals 992px) | 970px | .col-md- Large devices Desktops (greater than equals 1200px) | 1170px | .col-lg-

Code With Mosh Hamedani Code Example

Example: mosh Master the Coding Skills to Become an Engineer Companies LOVE to Hire Hi! His name is Mosh Hamedani. His life’s mission is to help novice and professional software engineers increase their skills, make more money and ultimately change their lives for the better.

Angular 5 Remove Query Param

Answer : You can remove a query parameter by using the merge option of queryParamsHandling and passing in null for any params you wish to remove. // Remove query params this.router.navigate([], { queryParams: { 'yourParamName': null, 'youCanRemoveMultiple': null, }, queryParamsHandling: 'merge' }) This option is simpler and requires less work to ensure you are not removing other params. You also do not need to worry about cleaning up an observable subscription when your component is destroyed. UPDATE: @epelc's answer below is the up-to-date and correct way to do this: https://stackoverflow.com/a/52193044/5932590. Unfortunately, there is no clear-cut way to do this currently: https://github.com/angular/angular/issues/18011. However, as jasonaden commented on the linked thread, This could be done manually by merging the old and new query params, removing the key you don't want. Here is one way to do that: Let's say