Posts

Showing posts from August, 2017

ActiveMQ Vs Apollo Vs Kafka

Answer : Apache ActiveMQ is a great workhorse full of features and nice stuff. It's not the fastest MQ software around but fast enough for most use cases. Among features are flexible clustring, fail-over, integrations with different application servers, security etc. Apache Apollo is an attempt to write a new core for ActiveMQ to cope with a large amount of clients and messages. It does not have all nice and convenient feature of ActiveMQ but scales a lot better. Apache Apollo is a really fast MQ implementation when you give it a large multi-core server and thousands of concurrent connections. It has a nice, simple UI, but is not a "one-size-fits-all" solution. It seems that there is an attempt ongoing to merge a number of ActiveMQ features with HornetQ under the name ActiveMQ Artemis. HornetQ has JMS2.0 support, so my humble guess is that it's likely to appear in ActiveMQ 6.x. JIRA, Github Kafka is a different beast. It's a very simple message broker i

Angular's Ng-init Alternative In Angular 2

Answer : You can use a directive @Directive({ selector: 'ngInit', exportAs: 'ngInit' }) export class NgInit { @Input() values: any = {}; @Input() ngInit; ngOnInit() { if(this.ngInit) { this.ngInit(); } } } you can use it to pass a function to be called like <div [ngInit]="doSomething" or to make values available <div ngInit [values]="{a: 'a', b: 'b'}" #ngInit="ngInit"> <button (click)="clickHandler(ngInit.values.a)">click me</button> </div> ngInit addes the directive [values]="{a: 'a', b: 'b'}" sets some initial values #ngInit="ngInit" creates a reference for later use ngInit.values.a reads the a value from the created reference. See also Converting Angular 1 to Angular 2 ngInit function Another approach is by using the @Output decorator and EventEmitter: import {Directive, OnInit, Output, EventEmitter

Instagram Icon Color Gradient Code Example

Example: linear gradient instagram background : #f09433 ; background : -moz-linear-gradient ( 45 deg , #f09433 0 % , #e6683c 25 % , #dc2743 50 % , #cc2366 75 % , #bc1888 100 % ) ; background : -webkit-linear-gradient ( 45 deg , #f09433 0 % , #e6683c 25 % , #dc2743 50 % , #cc2366 75 % , #bc1888 100 % ) ; background : linear-gradient ( 45 deg , #f09433 0 % , #e6683c 25 % , #dc2743 50 % , #cc2366 75 % , #bc1888 100 % ) ; filter : progid : DXImageTransform.Microsoft. gradient ( startColorstr= '#f09433' , endColorstr= '#bc1888' , GradientType= 1 ) ;

Format String First Letter Uppercase Css Code Example

Example 1: css capitalize first letter & ::first-letter { text-transform : capitalize ; } Example 2: make first letter uppercase const publication = "freeCodeCamp" ; publication[ 0 ]. toUpperCase ( ) + publication. substring ( 1 ) ;

Detect Mobile Device Css Code Example

Example: detect mobile css @media only screen and ( max-device-width : 480 px ) { /* in mobile css commands */ }

Create A Batch File Or Shortcut To PuTTY (ssh) That Opens A Session And Runs A Command

Image
Answer : Use the commandline PuTTY version plink.exe to initate a SSH connection to a host of choice. Use the -ssh switch to connect with SSH. With the -m switch you can include a command file: plink.exe -ssh host1 -m C:\path\to\commands.txt You can download plink.exe from here. Last step would be to create a shortcut including plink.exe with the desired parameters. Check out the Plink documentation for other various parameters: Plink.exe documentation To automate a command execution, use Plink (from PuTTY package), not PuTTY itself. Plink accepts a command on its command line: plink.exe user@host command If you want to keep using PuTTY, you can use -m switch to specify a command file (Plink supports the -m switch too). You can use putty configurations to achieve this. Load putty and configure your session. Enter the remote command that you'd like to run here: Then, before clicking " Open ", go back to the " Session " tab (at the top), and save your co

Java Inline If Ternary Operators Code Example

Example 1: java ternary operator Object myObject = booleanExpression ? valueIfTrue : valueIfFalse ; Example 2: ternary operator java booleanExpression ? expression1 : expression2 ;

List Title Html Code Example

Example 1: html title <head> <title>This is the title of the Website</title> </head> Example 2: html unordered list <ul> <lh>ul Header</lh> <li>Item One</li> <li>Item Two</li> <li>Item Thre</li> </ul> Example 3: ui and li in html <ul> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul>

Angular 2 - How To Set Default Selected Option

Answer : <select [(ngModel)]="defaultValue"> <option>AM</option> <option>PM</option> </select> export class MyComponent { defaultValue = 'PM'; } Usually it's done like <select [(ngModel)]="defaultValue"> <option *ngFor="let value of values" [ngValue]="value">{{value}}</option> </select> export class MyComponent { values = ['AM', 'PM']; defaultValue = this.values[1]; } Hint For non-string values use `[ngValue]="..." <select [(ngModel)]="defaultValue"> <option [ngValue]="values[0]">AM</option> <option [ngValue]="values[2]">PM</option> </select> For a template driven form, I did this and got default selection. <select [(ngModel)]="defaultOption" name="identification"> <option [value]=null>Select</option

Add A Linkedin Link To Github Readme Code Example

Example: how to add link to github readme [ I 'm an inline-style link](https://www.google.com) [I' m an inline-style link with title ] ( https://www.google.com "Google's Homepage" ) [ I 'm a reference-style link][Arbitrary case-insensitive reference text] [I' m a relative reference to a repository file ] ( .. /blob/master/LICENSE ) [ You can use numbers for reference-style link definitions ] [ 1 ] Or leave it empty and use the [ link text itself ] . URLs and URLs in angle brackets will automatically get turned into links. http://www.example.com or < http://www.example.com > and sometimes example.com ( but not on Github, for example ) . Some text to show that the reference links can follow later. [ arbitrary case-insensitive reference text ] : https://www.mozilla.org [ 1 ] : http://slashdot.org [ link text itself ] : http://www.reddit.com

Inttostr In C Code Example

Example: c int to string # include <stdio.h> int main ( ) { char number_str [ 10 ] ; int number = 25 ; sprintf ( number_str , "%d" , number ) ; printf ( "Converted to string : %s\n" , number_str ) ; return 0 ; }

Bootstrap Login Form Examples

Example 1: bootstrap login form < form > < div class = " form-group " > < label for = " inputEmail " > Email </ label > < input type = " email " class = " form-control " id = " inputEmail " placeholder = " Email " > </ div > < div class = " form-group " > < label for = " inputPassword " > Password </ label > < input type = " password " class = " form-control " id = " inputPassword " placeholder = " Password " > </ div > < div class = " form-group " > < label class = " form-check-label " > < input type = " checkbox " > Remember me </ label > </ div > < button type = " submit " class = " btn btn-primary " > Sign in </

Sass Reference Another Class From Another Stylesheet Code Example

Example: sass class with another class .myclass { font-weight : bold ; font-size : 90 px ; } .myotherclass { @extend .myclass ; color : #000000 ; }