Selecting database for building highly scalable and available URL shortner service

We want to build a URL shortening service.

Design goals :

a) Scalable

b) Highly available

I was analysing which type and specifically which database to use for the purpose.

a) Relational DB : Rejected

- Data is not relational   - SQL DB with ACID compliance is hard to scale  

b) Graph DB : Rejected

- Data model is not inherently graphical  

c) Persistent Key-value store : An option

- Most of the DB queries would be around slug   - It is faster to read from a key-value store due to limited   - Analytics will be taken care of separately   - The clustered mode will be easy to scale 

d) Document Store : An option

- Scalable   - Queries from various fields of a document are supported   - Data is not nested  

Based on the mentioned points, persistent Key-value store should be the best option for the same.

Can someone please help me out, if I missed anything in the consideration or if I may be wrong here. It would be of help.

If a persistent key-value store is best available option, then what is the correct way to select amongst the available options (REDIS, Couchbase, Aerospike, etc)

How to handle java8 installation issue when building h2o docker image [using Dockerfile in the repository]

I’m trying to build an H2o docker image, using

It gets the following error:

E: Package ‘oracle-java8-installer’ has no installation candidate

The command ‘/bin/sh -c echo ‘DPkg::Post-Invoke {“/bin/rm -f /var/cache/apt/archives/.deb || true”;};’ | tee /etc/apt/apt.conf.d/no-cache && echo “deb xenial main universe” >> /etc/apt/sources.list && apt-get update -q -y && apt-get dist-upgrade -y && apt-get clean && rm -rf /var/cache/apt/ && DEBIAN_FRONTEND=noninteractive apt-get install -y wget unzip python-pip python-sklearn python-pandas python-numpy python-matplotlib software-properties-common python-software-properties && add-apt-repository -y ppa:webupd8team/java && apt-get update -q && echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections && DEBIAN_FRONTEND=noninteractive apt-get install -y oracle-java8-installer && apt-get clean && wget -O latest && wget –no-check-certificate -i latest -O /opt/ && unzip -d /opt /opt/ && rm /opt/ && cd /opt && cd find . -name 'h2o.jar' | sed 's/.\///;s/\/h2o.jar//g' && cp h2o.jar /opt && /usr/bin/pip install find . -name "*.whl" && cd / && wget && chmod +x && wget && gunzip train.csv.gz && wget && wget && wget’ returned a non-zero code: 100

I’m assuming it may be related to the recent Oracle JDK License Update.

Is there a way to resolve this error in building the docker image?

Building complex sentences based on a data structure

I really do not like how bad this looks. It is not readable and I am not sure if I need the stacked map’s. There are a lot of iterations going on here (map, join, replace) and performance is really important, please help 🙁


const alternatives = [   "flex",   "float",   [     "background-size",     "background-image"   ] ] 

Expected Output:

'Consider using 'flex', 'float' or 'background-size' with 'background-image' instead.' 

Working Code:

const result = `Consider using $  {alternatives                  .map((alternative) => {                    return Array.isArray(alternative)                      ? => `'$  {a}'`).join(' with ')                      : `'$  {alternative}'`;                  })                  .join(', ')                  .replace(/, ([^,]*)$  /, ' or $  1')} instead.` 

Quality Offpage Seo, Backlink Building for $60

What do you expect from me as an SEO expert? ✓ 100% White Hat. ( Guest Post, PBN, Niche Links ) ✓ Full site links analysis compares with major competitors Backlinks. ✓ Action plan to get a result in the shortest possible time. Note 1: I do not provide any low-quality backlinks. I do S E O for future quality traffic which builds your business for going concern theory.Note 2: I need minimum time more months to rank a site because it is quite impossible to rank a site in rush. Note 3: Guaranteed rank first in Google if you give permission to access your admin for on-page optimization and content update or new contents.

by: todayinfotech
Created: —
Category: Link Building
Viewed: 192

Guest Posts on Beauty & Health Niche SEO Backlink Building for $10

Hi, Are you looking for any High-Quality Guest Posts on Beauty & Health? If so, I will be providing you Do Follow Links, Permanent Guest Posts and Unique Backlinks. It will help you to get more traffic and improve your ranking. I will never delete your article or any post from my site. I am giving you a Permanent Links. I own a list of websites have High DA and PA of Beauty & Health Niche. Please make sure that your content must be unique. If you have any question, Please contact me. Thank you for your Precious Time. Minhaas Jamil

by: MinhaasJamil19
Created: —
Category: Guest Posts
Viewed: 254

Permanent Guest Posts on Fashion & Shopping Niche Sites Backlink Building for $10

Hi, Do you want to get more organic and natural traffic to your site? If “Yes” then you came to the right service. I am providing you a Permanent Posts and Do Follow Links on Fashion and Shopping Niche. I have a large number of visitors on my Fashion and Shopping site on a monthly basis. You can also send your content related to these topics. Beauty ProductsClothsLadies WearMen’s WearLife StyleAccessoriesJewelryWatchesHand BagsFoot WearCosmeticsIf you have any question, Please contact us. I do work on time because our main goal is the client’s satisfaction. Thank You! Minhaas Jamil

by: MinhaasJamil19
Created: —
Category: Guest Posts
Viewed: 228

Publish Guest Posts on Automotive & Travel Niche Sites BackLink Building for $10

Hi, Are you looking for Automotive and Travel Niche Guest Posts, with a huge number of original and organic traffic? If “Yes” you came to the right service. I have detailed knowledge of Search Engine Optimization and Social Media Marketing. I will publish Guest Posts on Automotive and Travel Niche SEO Backlinks Building. You will get Permanent Guest Posts and in that way, you will get more traffic. Topics that we accept CarsBikesTrucksRepairingBuy and SellingDriving TipsMaintainsTravelTourismTripsHolidaysIf you have any question related to it, Please contact me Thank You! Minhaas Jamil

by: MinhaasJamil19
Created: —
Category: Guest Posts
Viewed: 236

Publish Guest Posts on Health Niche SEO Backlink Building for $10

Hello I am providing you a Permanent Guest Posts and Do Follow Backlinks on Health Niche. This service will boost your site and gives you many benefits. My website has a large number of visitors every month. We have the best and unique content on our website. Once your content is published, I will not remove your content. I will give my service according to your requirements. If you want to know anything, please contact me. We can also provide High-Quality Guest Posts on different niches, Like Automotive & TravelingBeautyFashion & ShoppingTechnologyHome ImprovementBusiness & FinanceThanks! Minhaas Jamil

by: MinhaasJamil19
Created: —
Category: Guest Posts
Viewed: 260

Find busiest period in building

The task

You are given a list of data entries that represent entries and exits of groups of people into a building. An entry looks like this:

{“timestamp”: 1526579928, count: 3, “type”: “enter”}

This means 3 people entered the building. An exit looks like this:

{“timestamp”: 1526580382, count: 2, “type”: “exit”}

This means that 2 people exited the building. timestamp is in Unix time.

Find the busiest period in the building, that is, the time with the most people in the building. Return it as a pair of (start, end) timestamps. You can assume the building always starts off and ends up empty, i.e. with 0 people inside.

const stamp = [   {"timestamp": 1526579928, count: 3, "type": "enter"},   {"timestamp": 1526580382, count: 2, "type": "exit"},   {"timestamp": 1526579938, count: 6, "type": "enter"},   {"timestamp": 1526579943, count: 1, "type": "enter"},   {"timestamp": 1526579944, count: 0, "type": "enter"},   {"timestamp": 1526580345, count: 5, "type": "exit"},   {"timestamp": 1526580351, count: 3, "type": "exit"}, ]; 

My imperative solution:

const findBusiestPeriod = lst => {   let visitors = 0;   const busiestPeriod = {     start: null,     end: null,     maxVisitors: null,   };    lst.forEach((v, i) => {     visitors = v.type === "enter" ?       visitors + v.count :       visitors - v.count;      if (visitors > busiestPeriod.maxVisitors) {       busiestPeriod.maxVisitors = visitors;       busiestPeriod.start = v.timestamp;       busiestPeriod.end = lst[i + 1].timestamp;     } else if (visitors === busiestPeriod.maxVisitors){       busiestPeriod.end = lst[i + 1].timestamp;     }   });   return [busiestPeriod.start, busiestPeriod.end]; };  console.log(findBusiestPeriod(stamp)); 

My functional solution

const findBusiestPeriod2 = lst => {   const {start, end} = lst.reduce((busiestPeriod, v, i) => {     busiestPeriod.visitors = v.type === "enter" ?       busiestPeriod.visitors + v.count :       busiestPeriod.visitors - v.count;     const visitors = busiestPeriod.visitors;     if (!busiestPeriod.maxVisitors || visitors > busiestPeriod.maxVisitors) {       busiestPeriod.maxVisitors = visitors;       busiestPeriod.start = v.timestamp;       busiestPeriod.end = lst[i + 1].timestamp;     } else if (visitors === busiestPeriod.maxVisitors){       busiestPeriod.end = lst[i + 1].timestamp;     }     return busiestPeriod;   }, {visitors: 0, maxVisitor: null,});   return [start, end]; };  console.log(findBusiestPeriod2(stamp));