teleren/devto huggingface dataset:
How to use Vuex’s state/getters with composition-api in Vue component
Tags: vue, typescript, compositionapi, vuex
Published: 2020-05-16 07:45:32

---
title: How to use Vuex’s state/getters with composition-api in Vue component
published: true
description: Vuex with composition-api
tags: Vuejs, Typescript, Composition API, Vuex
---

The composition-api is the next generation paradigm of Vue.js. I would say that it’ll be a standard way in Vue.js v3.
But now, you can use it in a v2 project by using https://github.com/vuejs/composition-api package.
We can easily find the way how to replace existing components with composition-api, but how can we use it with Vuex’s state/getters?

Firstly, I tried to use like below:

```ts
export default defineComponent({
  setup() {
    const state = reactive({
      count: store.state.count,
    })
    return {
      state,
      increment() {
        store.dispatch('increment')
      }
    }
  }
})
```

But it doesn’t work reactively. If the component doesn’t change the count variable directly, it won’t be incremented. Because the count variable is just a number but not connected between Vuex’s state and component lifecycle.

So, I changed the code

```ts
import { reactive, Ref, ref, onUnmounted } from '@vue/composition-api'
import { store } from './store' // your vuex store

function useVuex<T> (getState: () => T): Ref<T> {
  const data = ref<T>(getState()) as Ref<T>
  const unwatch = store.watch<T>(
    getState,
    (newVal: T) => {
      data.value = newVal
    }
  )
  onUnmounted(() => {
    unwatch()
  })
  return data
}

export default defineComponent({
  setup() {
    const state = reactive({
      count: useVuex<number>(() => store.state.count),
      doubleCount: useVuex<number>(() => store.getters['doubleCount'])
    })
    return {
      state,
      increment() {
        store.dispatch('increment')
      }
    }
  }
})
```

This code would work perfectly!
I used the watching system of Vuex to connect composition-api’s lifecycle.
Give it try out with your project!
Maximum Sum Circular Subarray
Tags: array
Published: 2020-05-16 07:40:54

---
title: Maximum Sum Circular Subarray
published: true
description: LeetCode Medium Problem
tags: array
---

Given a Circular Sub Array we need to find maximum possible sum

This Problem is an extension of Kadane's Algorithm which is used to find maximum sum in a non Circular Sub Array

Let's consider the following cases

## Case 1: All Positive Numbers

arr = [1,2,3,4]

The answer is *10*, since the whole array makes upto Maximum sub array

## Case 2: All Negative Numbers

arr = [-1,-2,-3,-4]

The answer is the smallest number in the array which is *-1*

## Case 3: Mix of Positive and Negative Numbers

The solution can be at two places

1. [1,-2,3,-2]
	 The answer is *3* which is in the middle
2. [5,-3,5]
   The answer is *10* which is part of starting sub array and ending sub array
	 
![Cases for Circular Sub Array Max Sum](https://i.imgur.com/ZOgirSp.png)

From above image we can solve for the first case (max sum lies in the middle of array) by just applying Kadane's Algorithm

For the second case (max sum lies in the beginning and ending of array):

1. Compute NonCircularMaxSum
2. Find the Total Sum of the Array
3. Here's the tricky part, we change the array to negative array and apply Kadane's algorithm which will now return the min (check above image)
4. Now the max subarray sum for circular is *total - min* (In the example it's 13 - 3 = 10)
5. If the circular sum is less than or equal to 0 return non circular sum (case for all negative numbers where total sum - min sum equals to 0 [-3,-2,-1]) 
6. return max of circular sum and non circular sum

Here's the solution

```js
/**
 * @param {number[]} A
 * @return {number}
 */
var maxSubarraySumCircular = function(A) {
	let nonCircularSum = kadaneMaxSum(A)
	
	let totalSum = 0

	A = A.map(elem => {
		totalSum += elem
		return -elem
	})

	let circularSum = totalSum + kadaneMaxSum(A)

	if(circularSum <= 0) {
		return nonCircularSum
	}

	return Math.max(circularSum, nonCircularSum)
};

let kadaneMaxSum = (arr) => {
	let max = arr[0], cur = arr[0]
	for(let i = 1; i < arr.length; i++) {
		cur = arr[i] + Math.max(cur, 0)
		max = Math.max(max, cur)
	}
	return max
};
```
Need Suggestions!!
Tags: discuss, beginners, showdev
Published: 2020-05-16 07:25:13

# What are the skills required to become a Data Analyst?


# What is the difference between a Data Analyst and Business Analyst?


# Does the Data Analysis/Analytics work required programming expertise?


# What are some of the best semi-technical career options in the IT industry?

I have a lot of similar questions!! Please tell me what do you think, in the comments section!
How to format the file containing json objects to json array
Tags: javascript
Published: 2020-05-16 07:14:24

I am writing a javascript to format JSON objects to array of JSON objects.
My input is,
{
  Name:"nom1",
  Cities:['city1','city2']
}
{
  Name:"nom2",
  Cities:['city4','city5']
}

And I want the output as,

var data = [ { Name:"nom1", Cities:['city1','city2'] }, { Name:"nom2", Cities:['city3','city4'] } ]}; 

How to write a script to achieve this?
# Introduction to Node.js
Tags: node, javascript, tutorial, codequality
Published: 2020-05-16 06:48:55

Node.js is a runtime javascript, well node.js uses V8, and V8 simply is the name of a javascript engine built by google that runs javascript in the browser.
![Alt text of image](https://miro.medium.com/max/1031/1*2RqYMpvCRYwTn704430qDA.png)
V8 is the simply named, the creator gave their engine and what does the engine mean. It means that the engine takes javascript code and compiles it to machine code, V8 itself is written in C++

**What Node.js does ?**
It allows you to run javascript on your computer and it adds useful functionalities to the javascript engine so that you can do more stuff there (like file handling etc). with the help of node.js, you can build web app, RESTful API, Chat app, and more

Next Article [Role of Node.js](https://dev.to/shubhamggupta/understanding-the-role-and-usage-of-node-js-2mn2)

Find my medium post [Click here](https://medium.com/@shubhamggupta/node-js-introduction-3de32effbe30)
String in Typescript - simple explanation with examples
Tags: typescript, javascript, tutorial, beginners
Published: 2020-05-16 06:30:48

Just like `number`, the `string` type is pretty straight forward: it specifies that we want something to be a string and a string only. It's used in the same manner:

```javascript
let firstName: string = "Allan";
let lastName: string = "Korb";
```
If we try to misuse it, and store a boolean inside of a variable of type number, for example, the editor will complain:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5g7qu1phcr8fey9egexx.PNG)

A super simple situation in which we could use this is when trying to print some of the properties of an object (let's say we got it back from the server after making an API call). We're trying to print a name made out of two strings but we use by mistake a property that stores a number. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/io9lwrycfluzctj67tlo.PNG)

*Image source: Brett Jordan/ @brett_jordan Unsplash*
Brazen Epiphany
Tags: brazenepiphany, theabbie, abhishekchaudhary
Published: 2020-05-16 05:20:37

#Plot

Jennifer, daughter of a single mother after claiming the position of the best journalist in india sat down for a interview. During this interview she is confronted with reasons to what does she owe her success. Throughout conversation we get to know that it is just not her love for the profession but her past, her fears and much more than that which lead to India giving birth to such a powerful journalist.

# Cast

* Abhishek Chaudhary
* Trevor Dcosta
* Elisha Gras
* Bryan Francis
* Jennifer James
* Kushagra goel
* Aaron pereira
* Ujjwal chakraborty
* Monish Meher
* Aldrin rego
* Steve Rodrigo
* Justin enoch
* Celine Fernandes
* Devanshi singh
* Shubham thorat
* Pratik lomte
* Jyotsana nair
neal.fun
Published: 2020-05-16 05:18:16

---
title: neal.fun
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/neal-fun
---

Bringing back the weird web one post at a time. At 332 meters, this is the deepest any human has ever scuba dived. Set by Ahmed Gabr in 2014. No sunlight is able to reach this deep. Many deep-sea creatures cope ... Explore the scale of the universe on this interactive page. Go from astronaut all the way to the observable universe! What would you do with 90 billion dollars? Find out by spending all of Bill Gates' money! Find out what's happened in your lifetime Draw Logos From Memory. Draw the McDonalds logo. Reveal Logo. Draw the Nike logo. Reveal Logo. Draw the Apple logo. Reveal Logo. Draw the Starbucks logo. Reveal Logo. Life Checklist. Be born. ‍ Take first steps. Say first words. ‍ Learn to read. 🤗 Make a friend. ‍ Learn to ride a bike. Read a book. ‍ Learn to swim. Finish elementary ... Neal.fun. Printing Money. Made by Neal Agarwal. Minimum Wage ($7.25/hr). Teacher ($16/hr). Software Engineer ($45/ hr). Physician ($90/hr). Fortune 500 CEO ($4k/hr ... Can you guess the price of these paintings? Draw your favorite person. ClearErase. Draw a campfire. ClearErase. Draw smoke. ClearErase. Your Island. Your island is looking a little sparse. Try adding some more things. Paper. 0 folds. You have a piece of paper. It is 0.1mm thick. Unfold Fold. Buy me a coffee! You may also like. The Deep Sea · Speed. Made with ❤️ by Neal Agarwal · Neal.fun. Compared to neighboring stars, our sun is moving toward a local star called Vega at 43,000 mph! So that combined with the Earth spinning and the Earth traveling around the Sun ... A visualization of who was alive during any given year! View history in a new and interesting way. Progress. Next minute. 50 seconds left. Next hour. 15 minutes left. Next day. 22 hours left. Next month. 19 days left. Next year. 232 days left. Next Valentine's Day. What is the future of the universe? Well, using some science we can make a few predictions... In 2061. Halley's Comet will return again. In 2178. Pluto will complete its first orbit ... Baby Map. Flashes every time a baby is born in that country. Total Babies Born: 1. CountryBabies Born India1. You may also like. Life Checklist · Universe Forecast. Made with ❤️ by ... Do you ever wonder where your days are going? Supposedly there are 24 hours in a day, but some days seem to not even happen. Sleep takes up about 7 hours a day for most ... Share This Page. Share with Link. Share with Screenshot. Share with Meme. Share with Email. Share with Printer. Share with Letter. Share with Text. Share with Facebook. Share ...
literacy is not equal to intelligence
Published: 2020-05-16 05:17:12

---
title: literacy is not equal to intelligence
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/literacy-is-not-equal-to-intelligence
---

literacy is having a certification that you have passed the basic education requirements, this is not related to intelligence Literacy rate in India is around but intelligence rate might not even be I am not saying intelligence is not related to literacy, most of the intelligent population is literate, intelligence is using your knowledge properly. The Indian education system along with our mentality is the main reason why India is dumb the main focus of indian education system is to teach as much as possible, without knowing how much is understood and applied. that's the biggest problem, if you know trigonometry but have no idea how to apply it, it's useless, you are not intelligent, and for me, illiterate too the focus of this post is not about following passion and why subjects are useless, they are pretty useful but only if we know how to
infinite non-repeating sequence
Published: 2020-05-16 05:16:56

---
title: infinite non-repeating sequence
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/infinite-non-repeating-sequence
---

We have a recursive function which generates infinite non-repeating sequence of numbers the function has been demonstrated here Pi to first 50 digits is This continues forever and never repeats

https://theabbie.github.io/files/random
TheAbbie blog
Published: 2020-05-16 05:16:14

---
title: TheAbbie blog
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/index
---

Hey guys, I am Abhishek Chaudhary Abhishek Chaudhary A.K.A TheAbbie born in 2002 is a computer engineer from Fr. Conceicao Rodrigues institute of technology, and he made he acting and writing debut in 2019 short film Brazen Epiphany, The film was made as a part of India Film project 50 hour filmmaking challenge. He is currently writing for TVF sketches. He also currently makes YouTube videos. Apart from acting and writing, his main fields of interests include programming and photography and podcasting
foolproof gender predictor
Published: 2020-05-16 05:15:54

---
title: foolproof gender predictor
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/foolproof-gender-predictor
---

This tool uses psychological techniques to determine your gender in a fool proof way it uses psychological techniques, ie. it does not ask you silly questions like who is your favourite actor and all it is completely unbiased and independent of person's educational qualification it's similar to IQ or aptitude test It uses color choice as a determination method is the creator of this superb app please use it ethically and don't try to pretend like other gender or lie to it do the tasks normally and not in attempt to fool it, please

https://theabbie.github.io/gender
how is tanmay bhat ruling youtube
Published: 2020-05-16 05:15:21

---
title: how is tanmay bhat ruling youtube
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/how-is-tanmay-bhat-ruling-youtube
---

The fat guy from AIB who was severely trolled for being a psychopath is ruling youtube right now All India Bakchod is a Mumbai-based comedy group, and was the name of their podcast, YouTube channel and production company. The name is a parody of All India Radio, with bakchod being Hindi slang for 'dumb fuck'. It began in 2012 as a humorous/pop-culture podcast by comedians Tanmay Bhat and Gursimran Khamba. after being shut down by allegations, it lost it's charm and all the comedians went back to their usual life after being shutdown, Tanmay Bhat went into a phase of depression and did not come back until 1 year During the 1 year shutdown he introspected himself and his life, he wanted to do something but couldn't He is just nailing it, other youtubers should be aware that he might one day steal their jobs as well
estimate pi using random numbers
Published: 2020-05-16 05:14:43

---
title: estimate pi using random numbers
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/estimate-pi-using-random-numbers
---

pi is an and it has infinite decimal places we will use the concept of probability and definition of pi to calculate the value of pi since we are randomly plotting points inside the square, the probability of it lying inside the circle is since we are plotting many points, empirical probability says that since we know the empirical probability we will use it to find value of pi ie. n/N = Pi/4 this is also know as Monte Carlo method, this works perfectly when number of pounts is fairly high
codejam 2020 review
Published: 2020-05-16 05:14:21

---
title: codejam 2020 review
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/codejam-2020-review
---

I am a first-year engineering student and I participated in Codejam 2020 This was my first codejam and my first coding competition too I used Node.Js for the competition as I am pretty fluent in JavaScript Though JavaScript is a very popular programming language, within a few problems I realised that it's not very perfect for competitive programming the qualification round was extremely easy and anyone with decent programming knowledge would qualify easily since, this was my first attempt in competitive programming, I was not very prepared for algorithm stuff this, along with many other factors was the main reason of my failure
circumference of ellipse
Published: 2020-05-16 05:14:07

---
title: circumference of ellipse
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/circumference-of-ellipse
---

Though, there is no exact formula for circumference of ellipse, like we have for circle, we have an approximate formula which works in most cases. There is no general formula for the circumference of an ellipse in terms of the semi-major and semi-minor axes of the ellipse that uses only elementary functions. However, there are approximate formulas in terms of these parameters. One such approximation, due to Euler (1773), for the canonical ellipse, The given formula is the most exact representatiin of circumference of ellipse till date An ellipse is described as a curve on a plane that surrounds two focal points such that the sum of the distances to the two focal points is constant for every point on the curve. Ellipse has two types of axis – Major Axis and Minor Axis. The longest chord of the ellipse is the major axis. The perpendicular chord to the major axis is the minor axis which bisects the major axis at the center. Given the lengths of minor and major axis of an ellipse, the task is to find the perimeter of the Ellipse.
best programmer in the world
Published: 2020-05-16 05:13:49

---
title: best programmer in the world
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/best-programmer-in-the-world
---

Gennady Korotkevich is a Belarusian sport programmer who has won major international competitions since age 11, as well as numerous national competitions. Korotkevich was born in Gomel (Homiel), southeastern Belarus. His parents, Vladimir and Lyudmila Korotkevich, are programmers in the mathematics department at Francysk Skaryna Homiel State University. At age 6, he became interested in his parents' work. When he was 8, his father designed a children's game he could use to learn programming. His mother consulted departmental colleague Mikhail Dolinsky, who gave Korotkevich a small book to read. Dolinsky, one of the top computer science teachers in Belarus, recalled, "A month went by, and then another one ... No news from Gena. Then suddenly Lyudmila comes by and brings me a programming notebook: when summer and football were over, her son sat at the computer. As a second-grader at a national competition, he took second place, which gained him an automatic entry into a technical university without taking any entrance exams. Somehow he solved the problem of a body immersed in water. At that time, Gena didn't even know about Archimedes' principle of buoyancy. Korotkevich first gained global attention when he qualified for the 2006 International Olympiad in Informatics (IOI) at the age of 11, a world record by a large margin. He took the silver medal at his first IOI event and received gold medals from 2007 to 2012. To date, he is the most successful competitor in IOI's history. Google Code Jam: 2014 champion At 21, Gennady Vladimirovich Korotkevich is already a legend. Tourist, as he's known online, is now the world's top sport programmer. He competes against other people to solve coding puzzles, and he's darn good at it
Best Node.js Hosting Platforms
Published: 2020-05-16 05:13:34

---
title: Best Node.js Hosting Platforms
published: true
date: 
tags: 
canonical_url: https://theabbie.github.io/blog/best-node-js-hosting-platforms
---

Netlify is a web developer platform that multiplies productivity.By unifying the elements of the modern decoupled web, from local development to advanced edge logic, Netlify enables a 10x faster path to much more performant, secure, and scalable websites and apps.Our bet on the JAMstack is quickly coming true. The web is rapidly changing away from monolithic to decoupled apps, and web developers are storming ahead with more power than ever. Netlify is built to cater to that movement, and in just a few years we’ve on-boarded more than half a million businesses and developers, and are building and serving millions of web projects daily around the globe.Fun fact: in the time it took you to read the above, Netlify served over 350,000 requests. When Node.js receives a request, the body is in the format of a ReadableStream.To get the data from the stream, you need to listen to its data and end events. To do this requires a few lines of code which you would much rather not have to repeat.By using helper properties, the request is already parsed for you, allowing you to access the data immediately. RunKit notebooks are interactive javascript playgrounds connected to a complete node environment right in your browser. Every npm module is pre-installed. Auth0 Webtasks is a simple, lightweight, and secure way of running isolated backend code that removed or reduces the need for a backend.It is a secure and cost efficient solution to the challange of supporting extensibility through custom code in multi-tenant systems.It is an ideal companion for mobile or single page applications that need just a little bit of a backend.Finally, webtasks are a flexible and lightweight mechanism that supports a variety of integration scenarios.Auth0 Webtasks and the webtask.io service were created and are supported by Auth0, Inc. In fact, we are using Webtasks internally as a key element of our identity management platform. Coding on Glitch is like working together in Google Docs–multiple people can work on the same project at the same time. There’s no setup, and you can see changes live on the web as you type. Heroku makes it easy to deploy and scale Node.js applications. Run any recent version of Node.js. Deploy apps in seconds using dependency caching.