Posts

Showing posts from October, 2017

Staircase Problem Solution

Image
In the beginning of learning programing, Staircase problem become a common challenge which startup programmer must solve. The purpose of this challenge is simple. Just make staircase made of some character with the height you input. Now let's begin, consider the n value is 5. Watch that its base and tallness are both equivalent to , and the picture is drawn utilizing # images and spaces. The last line isn't gone before by any spaces. Write a program that prints a staircase of size . Remember The staircase is correct adjusted, made out of # images and spaces, and has a tallness and width of n=6. Solution import java.util.Scanner; public class Solution { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); for (int i=n;i>0;i--) { int j=(i-1); int k=j; for ( ;j>0;j--) { System.out.print(" "); } for (;k<n;k++) { System.out.print(&q

RSYSLOG for Logging HAProxy

Image
RSYSLOG is the rocket-fast system for log processing. It offers high-performance, great security features and a modular design. While it started as a regular syslogd, rsyslog has evolved into a kind of swiss army knife of logging, being able to accept inputs from a wide variety of sources, transform them, and output to the results to diverse destinations. RSYSLOG can deliver over one million messages per second to local destinations when limited processing is applied (based on v7, December 2013). Even with remote destinations and more elaborate processing the performance is usually considered "stunning". No need to install rsyslog on Linux OS because the default linux ubuntu is already installed rsyslog. The configuration file is in /etc/rsyslog.conf Just run the rsyslog configuration for the haproxy log. Then edit the rsyslog.conf file        nano /etc/rsyslog.conf remove the # character as shown above. The option is useful to open port 514 with udp protocol

Time Conversion Program in Java

Image
Introduction Time is the uncertain proceeded with advance of presence and occasions that happen in clearly irreversible progression from the past through the present to what's to come. Time is a part amount of different estimations used to succession occasions, to look at the term of occasions or the interims amongst them, and to evaluate rates of progress of amounts in material reality or in the cognizant experience. Time is frequently alluded to as a fourth measurement, alongside three spatial measurements. There are two time model which we are using up until now. they are 24-hour and 12-hour clock. The 24-hour clock is the tradition of time keeping in which the day keeps running from midnight to midnight and is partitioned into 24 hours, showed by the hours go since midnight, from 0 to 23. This framework is the most ordinarily utilized time documentation on the planet today. On the other hand, 12-hour clock is a time tradition in which the 24 hours of the day are pa

How To Use HAProxy to Set Up HTTP Load Balancer

Image
HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is really suited for very high traffic web sites and powers quite a number of the world's most visited ones. Over distributed and distributed by default in cloud platforms. In this case, we use 6 server to setup this environment. 1 server for main web, 4 server for nginx balancer and 1 server for HAProxy. main web server :       192.168.1.10 nginx node-1 :      192.168.1.11 nginx node-2 :      192.168.1.12 nginx node-3 :      192.168.1.13 nginx node-4 :      192.168.1.14 HAProxy :      192.168.1.15 In main web server, put your code of web app that you build. In nginx node 1 - 4 configure proxy pass to protect main web server.  Installing HAProxy use command apt-get to install        apt-get install haproxy We need to enable HAproxy to be started by init script.