Posts

Showing posts from November, 2004

Add Array To Arraylist In Php Code Example

Example: add item to array in php <?php $a = array ( "red" , "green" ) ; array_push ( $a , "blue" , "yellow" ) ; print_r ( $a ) ; ?>

Centos 7 Restart Cron Code Example

Example: restart crontab sudo service cron reload

Bootstrap 4 Accordion Expand Collapse Code Example

Example: bootstrap 4 accordion < div id = " accordion " > < div class = " card " > < div class = " card-header " id = " headingOne " > < h5 class = " mb-0 " > < button class = " btn btn-link " data-toggle = " collapse " data-target = " #collapseOne " aria-expanded = " true " aria-controls = " collapseOne " > Collapsible Group Item #1 </ button > </ h5 > </ div > < div id = " collapseOne " class = " collapse show " aria-labelledby = " headingOne " data-parent = " #accordion " > < div class = " card-body " > Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nes

Android Internet Permission Not Working Code Example

Example: android internet permission //Add this to app manifest < uses - permission android : name = "android.permission.INTERNET" / >

Types Of Bastions Minecraft 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 ?

Clear Screen In Bash Code Example

Example: bash command to clear screen Ctrl+L shortcut key

Avoiding Busy Waiting In Bash, Without The Sleep Command

Answer : In newer versions of bash (at least v2), builtins may be loaded (via enable -f filename commandname ) at runtime. A number of such loadable builtins is also distributed with the bash sources, and sleep is among them. Availability may differ from OS to OS (and even machine to machine), of course. For example, on openSUSE, these builtins are distributed via the package bash-loadables . Edit: fix package name, add minimum bash version. Creating a lot of subprocesses is a bad thing in an inner loop. Creating one sleep process per second is OK. There's nothing wrong with while ! test_condition; do sleep 1 done If you really want to avoid the external process, you don't need to keep the fifo open. my_tmpdir=$(mktemp -d) trap 'rm -rf "$my_tmpdir"' 0 mkfifo "$my_tmpdir/f" while ! test_condition; do read -t 1 <>"$my_tmpdir/f" done I recently had a need to do this. I came up with the following function that will al

Bootstrap Navbar W3schools Code Example

Example 1: dropdown navigation menu < nav role = " navigation " > < ul > < li > < a href = " # " > One </ a > </ li > < li > < a href = " # " > Two </ a > < ul class = " dropdown " > < li > < a href = " # " > Sub-1 </ a > </ li > < li > < a href = " # " > Sub-2 </ a > </ li > < li > < a href = " # " > Sub-3 </ a > </ li > </ ul > </ li > < li > < a href = " # " > Three </ a > </ li > </ ul > </ nav > Example 2: bootstrap navbar right <! DOCTYPE html > < html lang = " en " > < head > < title > Bootstrap Example </ title > < meta charset = " utf-8 " > < meta name = " viewpor

Architectures To Access Smart Card From A Generic Browser? Or: How To Bridge The Gap From Browser To PC/SC Stack?

Answer : The fact is that browsers can't talk to (cryptographic) smart cards for other purposes than establishing SSL. You shall need additional code, executed by the browser, to access smart cards. There are tens of custom and proprietary plugins (using all three options you mentioned) for various purposes (signing being the most popular, I guess) built because there is no standard or universally accepted way, at least in Europe and I 'm sure elsewhere as well. Creating, distributing and maintaining your own shall be a blast, because browsers release every month or so and every new release changes sanboxing ir UI tricks, so you may need to adjust your code quite often. And you probably would want to have GUI capabilities, at least for asking the permission of the user to access a card or some functionality on it. For creating a multiple-platform, multiple browser plugin, something like firebreath could be used. Personally, I don't believe that exposing PC/S

Angular Force Reload Component Code Example

Example 1: How to Reload a Component in Angular reloadComponent ( ) { let currentUrl = this . router . url ; this . router . routeReuseStrategy . shouldReuseRoute = ( ) => false ; this . router . onSameUrlNavigation = 'reload' ; this . router . navigate ( [ currentUrl ] ) ; } Example 2: refresh current component angular reloadCurrentRoute ( ) { let currentUrl = this . _router . url ; this . _router . navigateByUrl ( '/' , { skipLocationChange : true } ) . then ( ( ) => { this . _router . navigate ( [ currentUrl ] ) ; console . log ( currentUrl ) ; } ) ; } Example 3: angular refresh component without reloading page /*You can use a BehaviorSubject for communicating between different components throughout the app. You can define a data sharing service containing the BehaviorSubject to which you can subscribe and emit changes. Define a data sharing service */ import { Injecta

Bootstrap 4 Tutorial 2020 Code Example

Example: bootstrap 4 < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css " integrity = " sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh " crossorigin = " anonymous " >

Centering Latex Code Example

Example 1: figure centering latex \begin{figure} \centering ... (Code for pictures, captions) ... \end{figure} Example 2: centering text latex \documentclass{article} \begin{document} This is a really long sentence as an example. The second have of this\\ \centerline{sentence should be centered.} \end{document} Example 3: aligning latex \begin{align*} x&=y & w &=z & a&=b+c\\ 2x&=-y & 3w&=\frac{1}{2}z & a&=b\\ -4 + 5x&=2+y & w+2&=-1+w & ab&=cb \end{align*}

Why C And C++ Are Platform Dependent Code Example

Example: is c and c++ platform independent In C , C ++ the compiled code ( compiler given code ) is machine language code which is understandable only by the cureent operating system . Hence this compiled code can not be executed in another platform . Due to this reason these languages are considered as platform dependent programming languages .

Angular 2/TypeScript: @Input/@output Or Input/output?

Answer : Angular 2 Style Guide According to the official Angular 2 style guide, STYLE 05-12 says Do use @Input and @Output instead of the inputs and outputs properties of the @Directive and @Component decorators The benefit is that (from the guide): It is easier and more readable to identify which properties in a class are inputs or outputs. If you ever need to rename the property or event name associated with @Input or @Output , you can modify it a single place. The metadata declaration attached to the directive is shorter and thus more readable. Placing the decorator on the same line makes for shorter code and still easily identifies the property as an input or output. I've personally used this style and really appreciate it helping keep the code DRY. One of the cool thing that I know you can do with decorators but I'm not if it's possible with the other way, is aliasing the variable: export class MyComponent { @Output('select') $onSelec

Angular Scrollable Mat-selection-list?

Answer : Simple CSS mat-selection-list { max-height: 400px; overflow: auto; } StackBlitz Demo By setting custom CSS properties? CSS for fancy scroll bar which only supports Chrome browsers: .custom-scroll-bar{ height:70vh; overflow-y:scroll; overflow-x: hidden; } .custom-scroll-bar::-webkit-scrollbar{ width: 5px; } .custom-scroll-bar::-webkit-scrollbar-thumb{ background: rgba(0,0,0,.26); } For Firefox and Internet explorer just simply use: .custom-scroll-bar{ height:70vh; overflow-y:scroll; } HTML: <mat-selection-list #shoes class="custom-scroll-bar"> <mat-list-option *ngFor="let shoe of typesOfShoes"> {{shoe}} </mat-list-option> </mat-selection-list> StackBlitz Example You can try with: <mat-card fxFlex="33%"> <mat-selection-list [style.overflow]="'auto'" [style.height.px]="'300'"> <mat-list-item

Checkout SVN With Credentials In Jenkins Pipeline?

Image
Answer : You can use the Snippet Generator for General SCM step. This displays the familiar Subversion configuration options, and takes credentials as parameter as usual. The Snippet Generator will produce a tad ugly representation of your parameter selections and looks something like this: checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[credentialsId: '34761a89-1402-47d7-96e2-aec22ffdc50b', depthOption: 'infinity', ignoreExternalsOption: true, local: 'cable_branch', remote: "https://trac.nci.org.au/svn/cable/branches/$SVN_
Answer : You can use the ARCamera.transform property to get the current transform of your camera. The following code is from Introducing ARKit at WWDC 2017 which you probably want to watch as an introduction. We are using the transform to place a node 10 cm in front of the camera. In Swift: var translation = matrix_identity_float4x4 translation.columns.3.z = -0.1 // Translate 10 cm in front of the camera node.simdTransform = matrix_multiply(currentFrame.camera.transform, translation) In Objective-C matrix_float4x4 translation = matrix_identity_float4x4; translation.columns[3][2] = -0.1; // Translate 10 cm in front of the camera node.simdTransform = matrix_multiply(currentFrame.camera.transform, translation)

About Android Launchmode "singleTask"

Image
Answer : You sound right. Why don't you test it. There is also this app that can help explain launch mode: https://play.google.com/store/apps/details?id=com.novoda.demos.activitylaunchmode Sources are at https://github.com/gnorsilva/Activities-LaunchMode-demo The ActivityC will be removed from task1 and ActivityB becomes the top Activity. Yes, you are Right... ActivityC will be removed from i.e. the onDestroy method of the ActivityC will be called. Hence when the user launches Task 1 again, the ActivityB is shown rather than ActivityC. Have created 2 Tasks (Projects) and uploaded the same @ SendSpace. Try it out... If you look at androids documentation it says " A "singleTask" activity allows other activities to be part of its task. It's always at the root of its task, but other activities (necessarily "standard" and "singleTop" activities) can be launched into that task." This means that when you click the hom