Mayıs, 2018 tarihine ait yayınlar gösteriliyor

Brief Introduction on Technologies

TomCat : Tomcat, is an open-source web server developed by the Apache Software Foundation (ASF). Tomcat implements several Java EE specifications including Java Servlet, JavaServer Pages (JSP), Java EL, and WebSocket, and provides a "pure Java" HTTP web server environment for Java code to run in. MongoDB : MongoDB is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster. Released under a combination of the GNU Affero General Public License and the Apache License, MongoDB is free and open-source software. MySQL : MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP open source web application software stack (and other "AMP" stacks)
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array. Example 1: Input: [1,3,5,6], 5 Output: 2 Example 2: Input: [1,3,5,6], 2 Output: 1 Example 3: Input: [1,3,5,6], 7 Output: 4 Example 4: Input: [1,3,5,6], 0 Output: 0 class Solution {     public int searchInsert(int[] nums, int target) {          //[1,3,5,6], 2         int prevItemValue = 0;         int len = nums.length - 1;               if(target == 0) return 0;         if(target > nums[len]) return len+1;               if(len == 0){ // there is only one item in the array             if(nums[0] == target){                 return 0;             }             return 1;         }               for(int i=0; i < len;  i++){             if(i != 0 ) prevItemValue = i-1;             int itemValue = nums[i];             if(itemValue == target){      

Find 2 integers that multiply to 20 - coding interview question

//Brute-force technic import java.io.*; import java.util.*; class Solution {   public static void main(String[] args) {         int[] array = {2 , 4, 1 , 6 , 5 , 40 , -1};         HashMap<Integer,Integer> multipliers = new HashMap<Integer,Integer>();         for(int i = 0 ; i < array.length -1; i++){       for(int j = i+1; j < array.length -1 - i; j++){         int firstItem = array[i];         int secondItem = array[j];         if( firstItem *  secondItem == 20){             multipliers.put(firstItem, secondItem);         }       }     }           for (int item: multipliers.keySet()){             int key = item;             int value = multipliers.get(item);              System.out.println(key + " " + value);        }   } }

Docker File System Exploration

We will now have a look inside the  /var/lib/docker/overlay2  folder where the image and container layers are stored. ls /var/lib/docker/overlay2 As we do not have any images yet, there should not be anything in this folder. Let’s pull an nginx image docker image pull nginx You should get something like the following where we can see that 3 layers are pulled. Using default tag: latest latest: Pulling from library/nginx 5040bd298390: Pull complete d7a91cdb22f0: Pull complete 9cac4850e5df: Pull complete Digest: sha256:33ff28a2763feccc1e1071a97960b7fef714d6e17e2d0ff573b74825d0049303 Status: Downloaded newer image for nginx:latest If we have a look to the changes that occurs in the /var/lib/docker/overlay2 folder ls /var/lib/docker/overlay2 we can see the following: 261fed39e3aca63326758681c96cad5bfe7eeeabafda23408bee0f5ae365d3fd 28f7998921ca5e4b28231b59b619394ba73571b5127a9c28cc9bacb3db706d2a backingFsBlockDev c1ae1be1c1c62dbaacf26bb9a5cde02e30d5364e06a437d0626f31c55

Bubble Sort in JAVA

public   void  bubbleSort( int [] arr) {        boolean  swapped =  true ;        int  j = 0;        int  tmp;        while  (swapped) {             swapped =  false ;             j++;              for  ( int  i = 0; i < arr.length - j; i++) {                                                           if  (arr[i] > arr[i + 1]) {                                                   tmp = arr[i];                         arr[i] = arr[i + 1];                         arr[i + 1] = tmp;                         swapped =  true ;                    }             }                       } } or void bubbleSort( int [] arr) { int n = arr.length; for ( int i = 0; i < n-1; i++){ for ( int j = 0; j < n-i-1; j++){ if (arr[j] > arr[j+1]) { // swap temp and arr[i] int temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; }                 } } } Time O(n^2)

Play With Docker

-download cassandra docker image docker pull cassandra docker image pull cassandra docker container run cassandra docker run -ti cassandra /bin/sh -run cassandra docker image docker run -d cassandra -d -> run container in background and print container ID docker run --name cass1 -d cassandra --name -> set container name first machine docker run --name cass1 -d -e CASSANDRA_BROADCAST_ADDRESS= -p 7000:7000 cassandra second machine docker run --name cass2 -d -e CASSANDRA_BROADCAST_ADDRESS= -p 7000:7000 -e CASSANDRA_SEEDS= cassandra BACKUP DOCKER IMAGE To backup docker images, use the docker save command that will produce a tar archive that can be used later on to create a new docker image with the docker load command. docker save cassandra > cassandra-docker-image-backup.tar BACKUP DOCKER CONTAINER You can backup a docker container by different means; -by committing a new docker image based on the docker container cur