teleren/devto huggingface dataset:
Useful Python Functions
Tags: python
Published: 2020-03-15 11:08:37

I am going to be discussing two useful functions in [Python](https://python.org/) `enumerate()` and `zip()`.

## enumerate()
Suppose we have a list and we want to keep track of both the iterable and the count of the iterable. To perform this task Python comes with a built-in function called `enumerate()`.

Let's understand this better with the help of an example:

```python
>>> some_values = [2,7,4,3,2]
>>> list(enumerate(some_values))
[(0, 2), (1, 7), (2, 4), (3, 3), (4, 2)]
```
Consider a list with some values. When we perform `enumerate()` on this list. We get tuples of the form (counter, value).

Now by default the counter starts at 0 unless we specify otherwise.

```python
>>> some_values = [2,7,4,3,2]
>>> list(enumerate(some_values, 1))
[(1, 2), (2, 7), (3, 4), (4, 3), (5, 2)]
```

Here is another example where we set the start counter to 1. This is helpful in cases where we want to visualize the index of an element in a list with 1 instead of a 0. Also, we can choose the start counter to be any integer not only 1. 

## zip()

Consider two tuples, one consisting of names of people and the other their respective ages.

```python
name = ("John", "Charles", "Mike")
age = (21, 43, 35)
``` 
Now, what the `zip()` function does is that it takes in 'n' number of iterables and then for each of the passed iterables it pairs the first items, then second items until it finds the last item in the iterable.
```python
>>> list(zip(name,age))
[('John', 21), ('Charles', 43), ('Mike', 35)]
```
The `zip()` function is also useful when dealing with matrices. With the help of this function we can find the transpose of a matrix very easily.

```python
>>> matrix = [[1,2,3],[4,5,6],[7,8,9]]
list(zip(*matrix))
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
```

Yes, creating transpose of a matrix is that easy!
SMS Reminder For Customers - Idea Validation
Tags: discuss, startup, leadership, help
Published: 2020-03-15 10:59:02

Hi, my name is Bobo!

I have a business idea and I need your opinion.

This is a web application that allows you to schedule the date and time when an SMS will be sent to your customers. The purpose is to remind them about you, the next revision (car, ITP, gas, electricity, heating central), insurance or other services that expire. You will have the possibility to personalize the messages, to be closer to them. The customers are yours, you come with them, and you keep them by your side.

I am waiting for your honest answer to the following questions:
https://forms.gle/LMxoWEmhSRyqGUYN7
(Unofficial) API's for Instagram
Published: 2020-03-15 10:36:12

In 2018, Instagram shut down its public API. Meaning, third-party apps can no longer access the API from Instagram without permission. Third-party apps now need to be approved by Instagram before they can access the API.
*Source* [Hubspot](https://blog.hubspot.com/marketing/instagram-api-guide)

##What is Instagram
For those dwelling under rocks, Instagram is a Facebook-owned social networking service mainly used for sharing photos and videos. It’s one of the most popular social media platforms in the world; as of October 2019, it averaged more than 1 billion monthly active users.

Because of Instagram’s popularity, there are several unofficial [Instagram API](https://blog.api.rakuten.net/top-instagram-apis/) (Application Programming Interfaces) that have been created to assist developers to integrate its features into their applications.

I evaluated several Instagram APIs based on the following criteria:

* __API features__ Features that makes the API stand out.
* __Price__ Cost of integration and free tier.
* __Ease__ Ease of implementing and consuming the API.

Here are the results (Drum roll!)

##Instagram Brand Analytics API
With the Instagram Brand Analytics API, you can see your brand’s top rated posts and other helpful information, enabling you to tell what people think about your offerings. You can use the API to search for all comments from a particular post or search for the trending posts about your brand. It’s the API you need to gauge the sentiment of your customers on Instagram.

##Easy Instagram Service API
With the Easy Instagram Service API you can get an Instagram post by shortcode, get Instagram profile by username—including follower, following, average like, and last post—and get a list of Instagram posts by Instagram ID.

##Hashtagy
With the Hashtagy – Generate Hashtags API, you can get a comprehensive list of hashtags based on your keyword. If you provide a keyword, the API will automatically generate related hashtags that you can use to increase interaction on the Instagram platform as well as on other social media sites. Furthermore, the API allows you to get related hashtags fetched directly from Instagram.

##The Gram API
The Gram API provides a wide range of Instagram tools you can use to enhance the capabilities of your application. With the Gram API, you can retrieve user highlights list by username, retrieve user avatar by username, retrieve user stories by username, and search users by username. The API will assist you to easily grab the information posted publicly on Instagram and increase the engagement of your app’s users.

## Instagram Facebook Media Downloader API
The Instagram Facebook Media Downloader API allows you to download any media from both Instagram and Facebook. With the Instagram Facebook Media Downloader API, you can easily download photos, videos, and other media from Instagram and Facebook. Consequently, you can use the downloaded media to stimulate your audience’s attention, increase your brand’s visibility, or improve your content’s quality.

I hope you find these APIs useful. Happy coding!
7 Habits of Highly Effective People - Book Summary
Published: 2020-03-15 10:34:04

---
title: 7 Habits of Highly Effective People - Book Summary
published: true
date: 
tags: 
canonical_url: https://bhavaniravi.com/7-habits-book-review/
---

# 7 Habits Of Highly Effective People

> I am mostly writing this summary for myself and a few of my friends, all the views are my perspective, you might have read the book and your views may or may not be different. After all, we are all humans, that's what this book is all about.

## Top 5 Takeaways

1. Seek to understand
2. Personal victory before the public victory
3. Start with the end in mind
4. Resourcefulness and Initiative
5. First Creation

## What I liked about this book?

Trust me, the book is intense, even for someone who reads nothing but self-help and psychological books over the years. But the book is so fluidly written that you won’t even know you are learning so much. The book does something to your personality that’s beyond explanation. Everyone should read this book at least once in their life, and I can guarantee you would want to reread it.

## Why should you read this book?

### [Continue Reading](https://bhavaniravi.com/7-habits-book-review/)
Is RxJS more popular than React?
Tags: rxjs, react, discuss, question
Published: 2020-03-15 10:32:49

I saw the comparison of npm package installations:

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

RxJS is double that of ReactJS.  At first I thought I saw the digits wrong... is RxJS more popular than React?  Why aren't there any jobs I heard that requires RxJS, while there are many jobs that require ReactJS?
Check out this new library: useWorker
Tags: javascript, react, webdev, libraries
Published: 2020-03-15 10:30:58

---
title: Check out this new library: useWorker
published: true
description: 
tags: javascript,react,webdev,libraries
---

![useWorker](https://raw.githubusercontent.com/alewin/useWorker/develop/logo.png)

Hi there! 👋

A friend of mine made [this](https://github.com/alewin/useWorker) tiny library that lets you use [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) with ease in a React application.

Check it out and leave a feedback 🦄
Yahoo Finance API - Can It Still be Used?
Tags: api, yahoo, finance
Published: 2020-03-15 10:11:01

Yahoo! closed down Yahoo! Finance API some time back. A finance API does not show up on [Yahoo Developer Homepage](https://developer.yahoo.com/api/). It was a great API for developers looking to build an app. It was cheap (free?) and offered a wealth of financial data. But is it still possible to use Yahoo Finance API? API Dojo offers an API called Yahoo Finance. It is probably not an official API. Notice the missing exclamation mark. However, let's take this API for a spin.

##Setting up Yahoo Finance API
To get started you’ll need:
* Javascript editor and npm unirest package that will speed up code writing.
* Subscribe to the [Yahoo Finance API](https://blog.api.rakuten.net/api-tutorial-yahoo-finance/). You can subscribe via Rakuten RapidAPI by [clicking here](https://english.api.rakuten.net/apidojo/api/yahoo-finance1).

## The API has the following Endpoints

* **market/get-summary**: Get live summary information at the request time
* **market/get-movers**: The live day gainers / losers / actives in specific region
* **market/get-quotes**: Retrieve the quotes by symbols
* **market/get-charts**: Get data to draw charts for a specific symbol and its comparisons
* **market/auto-complete**: Get auto complete suggestion for stocks
* **stock/get-detail**: Get detail information of each stock
* **stock/get-histories**: Get stock histories to draw charts
* **stock/get-news**: Get latest news related to a symbol, the result may be empty if there are no news in that region.

###Get Market summary

    1. Start by clicking on the market/get-summary function on the left menu.
    2. The header parameters will be prefilled automatically
    3. Enter the region and language code you wish to get summary information from
    4. Click on the Test Endpoint button to make a request and see the result
    5. Your code is ready to be copied on the right side of the screen

###Get Market Quotes:

    1. Start by clicking on the market/quotes function on the left menu.
    2. The header parameters will be prefilled automatically
    3. Enter the region, language, and symbols you wish to get quotes for
    4. Click on the Test Endpoint button to make a request and see the result
    5. Your code is ready to be copied on the right side of the screen

###Get Stock details:

    1. Start by clicking on the stock/get-detail function on the left menu.
    2. The header parameters will be prefilled automatically
    3. Enter the region, language, and symbol you wish to get quotes for
    4. Click on the Test Endpoint button to make a request and see the result
    5. Your code is ready to be copied on the right side of the screen

That is it. This API is simple to use.
Have you meet hook trap? see how concent resolve it
Tags: react, concent
Published: 2020-03-15 09:38:51

Star [Concent](https://github.com/concentjs/concent) if you are interested in it, I will appreciate it greatly.

## attention hook dependency
When we write the below code, eslint may tip us pass dependency if you want the component works well
```js
function NormalDemo() {
  const [count, setCount] = useState(0);
  const dom = useRef(null);
  useEffect(() => {
    const cur = dom.current;
    const add = () => setCount(count + 1);
    cur.addEventListener("click", add);
  }, []);
  return <div ref={dom}>normal {count}</div>;
}
```
so we should add the count to dep-list
```js
  useEffect(() => {
    // ...
  }, [count]);
```
we should attention that in every render period, we add a event listener to the dom ref, but we forget to remove the ref's previous render period listener, so the right code should be like below
```js
  useEffect(() => {
    // ...
    cur.addEventListener("click", add);
    return ()=> cur.removeEventListener("click", add)
  }, [count]);
```

## if we use concent, no traps any more
With concent `setup` feature, and it supports class component and function component both, we can easily write the right code.
- define setup first
```js
const setup = ctx=>{
  const addCount = () => {
    const count = ctx.state.count;
    ctx.setState({count: count + 1});
  }

  // just like useEffect, but here no dependency
  ctx.effect(()=>{
    const cur = ctx.refs.dom.current;
    cur.addEventListener('click', addCount);
    return ()=>cur.removeEventListener('click', addCount);
  }, []);

  return { addCount }
}
```
- declare a class component
```js
// or @register({setup, state:{count:0}})
@register({setup})
class ConcentClassDemo extends React.Component{
  state = {count:0}
  render(){
    const {useRef, state, settings} = this.ctx;
    // this.ctx.state === this.state
    return (
      <div>
        <div ref={useRef('dom')}>class {state.count}</div>
        <button onClick={settings.addCount}>add</button>
      </div>
    )
  }
}
```
- declare a function component
```js
function ConcentFnDemo() {
  const {useRef, state, settings} = useConcent({setup, state:{count:0}});
  return (
    <div>
      <div ref={useRef('dom')}>fn {state.count}</div>
      <button onClick={settings.addCount}>add</button>
    </div>
  )
}
```

Just look the code above, you will find concent expose the 100% same api to class component and function component both, so it allow you switch component style whatever you want.

## one more thing
If we want to do something when count change, how could we do? just put the key name is enough.
```js
const setup = ctx=>{
  ctx.effect(()=>{
    //detect count changed in didMount or didUpdate
  },['count']);
}
```

here is online demo
{% codesandbox no-hook-trap-z0gs8 %}
I don't know why React users downvote my StackOverflow questions just like PHP users
Tags: discuss
Published: 2020-03-15 08:46:59

I used to asked PHP questions and Ruby questions on StackOverflow and the users responding came from all over the world.  The users who responded or viewed my PHP questions, they are more likely to downvote.  The users who responded or viewed by Ruby questions, they tried to answered, and even if they don't know the answer, they didn't downvote usually.

The PHP users, if they don't like the question just by personal taste, or if they don't know the concept enough to answer, or if they think they cannot just type for 30 seconds and get upvotes for their answers, they downvoted my question.

For some reason, I am seeing the same for my ReactJS questions, just like the PHP questions situation.  I wonder why... but it is interesting I heard in the old days, Facebook used PHP, and Facebook invented React... I am not sure if there is any relation to this.
Interview Question: What is the difference between the `new` operator and `Object.create` Operator in JavaScript
Tags: javascript, beginners, typescript, tutorial
Published: 2020-03-15 08:28:01


## new Operator
- This is used to create an object from a constructor function 
- The `new` keywords also execute the constructor function


```
function Car() {
  console.log(this) // this points to myCar
  this.name = "Honda";
}

var myCar = Object.create(Car)
console.log(myCar) // Car {name: "Honda", constructor: Object}
console.log(myCar.name) // Honda
console.log(myCar instanceof Car) // true
console.log(myCar.constructor) // function Car() {}
console.log(myCar.constructor === Car) // true
console.log(typeof myCar) // object

```

## Object.create
- You can also use `Object.create` to create a new object
- But, it does not execute the constructor function
- `Object.create` is used to create an object from another object


```
const Car = {
  name: "Honda"
}

var myCar = Object.create(Car)
console.log(myCar) // Object {}
console.log(myCar.name) // Honda
console.log(myCar instanceof Car) // ERROR
console.log(myCar.constructor) // Anonymous function object
console.log(myCar.constructor === Car) // false
console.log(typeof myCar) // object

```


---

### More JavaScript Lessons(from my [blog](http://ngninja.com/)):

[Most Frequently Asked JavaScript Interview Questions](http://ngninja.com/posts/frequently-asked-javascript-interview-questions)
[Super powerful JavaScript tips & tricks - Part 2](http://ngninja.com/posts/javascript-tips-tricks-part-2)
[JavaScript Quiz: How well do you know JavaScript?](http://ngninja.com/posts/javascript-quiz)
Share your LinkedIn handles below
Tags: watercooler
Published: 2020-03-15 08:05:58

Hey DEVvers,

I love the kind of thoughtful content that gets shared here. Nothing would make me happier than making my LinkedIn feed a bit more... well... DEVvy. 

Drop me a [connection request](https://www.linkedin.com/in/netheavy) or share your handles below. 

*p.s. I'm not as active on [Twitter](https://twitter.com/netheavy), but feel like I should be. If you want to share your account handles below, I'll check them out too.*
Day 4 [D&D Character Sheets]
Tags: 100daysofcode
Published: 2020-03-15 07:43:51

# Report
Yay! Server and initial database setup is done. From now on I can focus on actually building out the app! I got hung up for a while before I realized I was calling app.use() in the wrong place.

I had it here(see below). Which meant it wouldn't trigger for any of my routes! The app would get to my router module and execute my routes before attaching the db object to the request. I wasted a lot of time overlooking this.
```
// index.js
app.use(require("./router"));
app.use(async (req, res, next) => {
	const db = await dbPromise;
	req.context = { ...db };
	next();
});
```

The fix was this simple:

```
// index.js
app.use(async (req, res, next) => {
	const db = await dbPromise;
	req.context = { ...db };
	next();
});
app.use(require("./router"));

```

Once that was done I had my database accessible throughout my whole server wrote my first simple view to test the connection.

```
// router/users/index.js
router.get("/", (req, res) => {
	req.context.models.Player.find().then(players => {
		res.render("users", {
			data: {
				users: players || []
			}
		});
	});
});
```

```
// views/users.ejs
<% data.users.forEach(user => { %>
    <li><%= user.username %></li>
<% }); %>
```

I've only been working an hour each day, so getting this setup felt like it took forever. Tomorrow I'd like to spend some time getting some type of character sheet view working.
 
# Project
{% github ApproachingApathy/100days-dnd-character-sheets %}

The First project will be an app to keep D&D character sheets.

## Stack

I'll be using Node.js and building a full-stack Express app with MongoDB.
### Requirements
#### Minimum Viable 
- [ ] Present a D&D Character Sheet
    - [ ] The sheet should display all the same info as the first page of the 5e Official sheet.
- [ ] Users should be able to log in and create player-characters.
- [ ] Users should be able to edit character sheets.
- [ ] Users should be able to organize character sheets into groups (parties/tables)
- [ ] Sheets should auto calculate basic stats like ability modifiers.
    - [ ] Support Proficiency Bonuses 

### Cake
- [ ] Extend character creation to allow the user to use any of the three common stat gen methods.
    - [ ] Point Buy
    - [ ] Standard Array
    - [ ] Roll
- [ ] Extend the character sheet to all the info in the 5e official sheet.
- [ ] Allow for image uploads for character portraits.
- [ ] Allow for extended descriptions/backstories.
    - [ ] Characters should have nice full page backstories.
    - [ ] Preferably use a markdown editor.
I developed a Pokédex with React, Redux and Material UI
Tags: react, redux, javascript
Published: 2020-03-15 07:39:23

Hi all,

For learning purposes I have developed a Pokédex to learn React with Redux using Redux Saga and Redux thunk as middlewares.

I've used the following tools:

- PokéAPI: https://pokeapi.co/
- Material UI: https://material-ui.com/
- React
- Redux Thunk
- Redux Saga

See it live here: 
https://master.d1or1a1srkom3l.amplifyapp.com/

Github repo:
https://github.com/sanderdebr/pokedex

You need to press 'Fetch Pokemon' to fetch a list of 100 Pokemon. Live search is available to search specific Pokemon.

On the profile page of a Pokemon, you can switch between Pokemons really quickly by using the arrows.

Only if you scroll down, the moves are being fetched. When you click on a move, only then the move information will be fetched too to increase performance.

Please let me know what you think or if something can be improved.
How to set set up telegram font size as the Khmer language

Published: 2020-03-15 07:05:30


1. Go to click window and search run and type

   > Regedit

2. Go to 

   > HKEY_LOCAL_MACHINE
   >
   > SOFTWARE
   >
   > MICROSOFT
   >
   > Windows NT
   >
   > CurrentVersion
   >
   > FontSubstitutes

3. Go to change 

   > MS Shell Dlg 2 

   with you local font
Introducing the Slim Coder
Tags: webdev, watercooler, career, devrel
Published: 2020-03-15 06:46:20

P.S : This post features the introduction of one of my fiends @viveksharmaui

# Who Am I ?

As a full time software developer,  I always had a thought of sharing my experiences either good or bad which I have gained during my learning phase.

I specifically wanted to share my perspectives, advice and struggles with my community members so that they can visualize my life. 

Since, I have been working for 1 year in open source community, I have learned a lot being contributing in it. But, Now I want to introduce you all to the 2nd personality of my self namely, 'Slim coder'.
 
# Who is 'Slim Coder' ?

You all might be wondering about this second personality.

Let me make it easier for you all.

Slim coder is an open source enthusiast. He's a person who loves to serve  the tech community. He lives with the ambition to help others and will remain continue to help you, to motivate you and to make you believe in yourself that you can code too!

# How to reach out?

Now, you might be wondering how to reach out Mr.'Slim Coder'?

So, You can easily connect with 'Slim Coder' though below mentioned platforms :

GitHub: https://github.com/viveksharmaui
YouTube: https://www.youtube.com/channel/UCRfB2PR9Vlf0C1l17qup-Wg
Stack overflow: https://stackoverflow.com/users/story/11727445
Medium: https://medium.com/@vvkofficial
DEV Community: https://dev.to/viveksharmaui

If you want to listen to 'Slim Coder' talks and videos and would love to hear his advice to uplift your career then, don't forget to subscribe the channel; Your 'Slim Coder' is always here to help you. 

Also, if you want to share your suggestions/recommendation or want to connect with Vivek; you can follow me on below mentioned platforms:

Facebook : https://web.facebook.com/vvk.anand.official
Instagram : https://www.instagram.com/i.am.vvk
LinkedIn : https://www.linkedin.com/in/vvkofficial
Twitter : https://twitter.com/i_am_viveksh

After you connect, You will get to know about the journey of Vivek as 'Slim Coder'.

And don't forget!

Many other things are on the way.

Are you coming to meet me on YouTube! See ya there. 

Thank You for taking your time to read this.