teleren/devto huggingface dataset:
HTTP 🤩🤩 !!!! Flutter 
Tags: flutter, flutterdev
Published: 2020-05-08 03:50:47

Flutter is meant to create UI/Client oriented stack, but without a backend we cannot deliver a full fledged business functionality to the user.

In this post we are going to see how we can consume the http services.

Let see in action 😇
Our first step would be add the package [HTTP](https://pub.dev/packages/http) to *pubspec.yaml* file

We are going to see the Four major methods of HTTP (GET, PUT, POST, DELETE) using the open API [JsonPlaceholder](https://jsonplaceholder.typicode.com).

Package ❤️🥰 http ❤️🥰 does all the things for us, we just need to use it as rest client like PostMan

###Get🧐
``` javascript
import 'dart:convert';
import 'package:http/http.dart';
import 'models/post.dart';

Future<List<Post>> getPosts() async {
    Client client = Client();
    try {
      var response =
          await client.get('https://jsonplaceholder.typicode.com/posts');
      List posts = jsonDecode(response.body);
      return posts.map((post) => Post.fromJson(post)).toList();
    } finally {
      client.close();
    }
  }
```

###POST😮
``` javascript
Future<Post> newPost(Post editedPost) async {
    Client client = Client();
    try {
      String url = 'https://jsonplaceholder.typicode.com/posts/';
      var body = jsonEncode(editedPost.toJson());
      var response = await client.post(
        url,
        body: body,
        headers: <String, String>{
          'Content-Type': 'application/json; charset=UTF-8',
        },
      );
      var post = jsonDecode(response.body);
      return Post.fromJson(post);
    } finally {
      client.close();
    }
  }
```

###PUT🙄
``` javascript
Future<Post> editPost(Post editedPost) async {
    Client client = Client();
    try {
      String url = 'https://jsonplaceholder.typicode.com/posts/${editedPost.id}';
      var body = jsonEncode(editedPost.toJson());
      var response = await client.put(
        url,
        body: body,
        headers: <String, String>{
          'Content-Type': 'application/json; charset=UTF-8',
        },
      );
      var post = jsonDecode(response.body);
      return Post.fromJson(post);
    } finally {
      client.close();
    }
  }
```

###DELETE🥺
``` javascript
Future deletePost(int id) async {
    Client client = Client();
    try {
      String url = 'https://jsonplaceholder.typicode.com/posts/${id}';
      await client.delete(url);
      print('post deleted succesfully');
    } finally {
      client.close();
    }
  }
```

for full sample [GitHubRepo](https://github.com/Prakash-Selvaraj-Ash/prakash.selvaraj-outlook.com/tree/master/http_tuto)

Happy Fluttering 😇😇
Want to develop real time app 
Tags: help, react, node, mongodb
Published: 2020-05-08 04:35:00

Hey guys, this is kind of a newbie question.
So right now, I'm not too much experienced with MERN (Mongo, Express, React NodeJS) development... I mean I've made some projects but that's it. I want to develop a real-time app and I suggested MERN as the solution for this app, even though I don't know too much about, I thought I would be much easier to get started. My question is: Do you guys think it will be harder for me developing this app with very few knowledge? and  What topics should I learn more about before diving into it? 

Thanks a lot
JavaScript .flatMap()
Tags: beginners, codenewbie
Published: 2020-05-16 04:58:35

In my previous post, I wrote about [Celebrating JavaScript .flat()](***LINK HERE***) and how to flatten arrays, giving a lot of love to `flat()`. I naturally wanted to follow it up with a post about `flatMap()` and look at how it works and what it does.

###flatMap()
The `flatMap()` method is a super merger of `flat()` and `map()`. 

*Although based on the order of operations maybe it should be called `mapFlat()` 🤔.*

**`flatMap()` goes through each element using a mapping function first before the returned result is flattened into a new array of depth one.** It's just like using `map()` followed by `flat()` with a depth of 1, but is slightly more efficient (an excellent 2-for-1 method).

**As `flatMap()` only flattens 1 level, if you need to flatten beyond 1 level, you can separately call `map()` then `flat()` on your array.**

####Syntax
```javascript
arr.flatMap(function callback(currentValue[, index[, array]]) {
  // do work and return element for newArray
}
```
The callback function for `flatMap()` takes three arguments: 
  * currentValue: the current element being processed
  * index (optional): the index of the currentValue
  * array (optional): the array `map()` was called upon

```javascript
const arr = ['take me out', '', 'to the ball', 'game'];
arr.flatMap(a => a.split(' ')); 
// ["take", "me", "out", "", "to", "the", "ball", "game"]
```

Using `flatMap()` is useful when you want to add and remove items during a `map()`, as it can map many to many items by handling each input item separately, versus `map()` itself that is always one-to-one. This means the resulting array can grow during the mapping, and it will be flattened afterward.

[MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap) has a great example below that highlights how `flatMap()` works to add and remove elements.
```javascript
// Let's say we want to remove all the negative numbers and
// split the odd numbers into an even number and a 1
let a = [5, 4,    -3, 20,  17,  -33, -4, 18]
//       |\  \     x   |   | \   x    x   |
//      *[4,1, 4, [], 20, 16, 1, [], [],  18]  
// *this line helps to visualize what the array will look 
// like during mapping, with negative numbers represented as empty [] 

a.flatMap( (n) =>
  (n < 0) ?      [] :
  (n % 2 == 0) ? [n] :
                 [n-1, 1]
)
// [4, 1, 4, 20, 16, 1, 18]
```

`flatMap()` is yet another useful addition to the JavaScript Array toolbox and I’ll be using this when I need to going forward. Happy coding!

*Resources*
[Array.prototype.flatMap()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap)
Code Tryouts - Natural Selection
Tags: simulation, life, gene, animals
Published: 2020-05-09 14:28:16

Hey,
In the last week I wrote simulation in Unity3d,
In this simulation we have animals that can walk around the map and they search for food, water and another animal to mate with.

Each animal currently have 2 genes - Speed and Search Radius.

When a new animal is born it can inherent each gene from one of the parents,
and in 80% of the cases the gene will also change a bit.

I let the simulation run twice, each time for 5 minutes and the results are
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vjumgeciaw6bgynhz3oa.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0xhv08xslhsjrnj68c6v.png)

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

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

What that shocked me was that in the second run the Search radius didn't raise all the time as the first run, and I think that the reason for that is because the population explodes, and so there are more animals that are probably closer to water and food.

I think I'll revisit this project in the future and will add predators and will see what happens. 

For more information you can watch the development process in youtube:
{% youtube 7q5YEbVfQKA %}

Click [here](https://github.com/eranelbaz/naturalselection) to this project github page
Click [here](https://drive.google.com/open?id=12Aur4OPsm_lEYYqKjvRAcQMCfYSitHnz) to download the run data

Have a great day :yum:

> Like this post? 
> Support me via [Patreon](https://www.patreon.com/eranelbaz)
> Subscribe to my [YouTube Channel](https://www.youtube.com/channel/UCVUNeBGM5wZJKcOx0QwAaTA?sub_confirmation=1)
Vue.js + GitHub + Tailwind Css
Tags: showdev, vue, github, todayilearned
Published: 2020-05-08 10:41:58

I implemented this small application that generates a card with Tailwind CSS based on data from the GitHub REST API V3 using the Vue.js framework.

{% github davidesantangelo/github-vue-card %}

deployed on netlify at https://github-vue-card.netlify.app
how developers can cope with stress
Tags: devops, productivity, codenewbie
Published: 2020-05-08 13:20:59

We are in a period where working from you living room, kitchen or garage is the norm. Remote work is new to some industries. But it isn't the case for developers. 

All a developer needs to get to work is his laptop, a connection to the internet and a good electricity supply. There are many software systems available.

There is a side to remote work that devs need to deal with. STRESS. Is it not true that leaving your office and working from home will reduce your stress level.

TAKE SOME DAYS OFF
It is not a good idea to code everyday. You have to take some days off. Doing so will refresh your mind. We find that the time we spend doing nothing, is very important.

EXTEND YOUR PROJECT'S DEADLINE
Take a look at your schedule for your project. Are you giving it little time? In order to deal with stress, you could extend the deadline. For example, a typical website project could take up to a month to finish the first prototype.

You could extend this time to about a month and a half. The additional half is so that you could include time to take rest and enjoy some hobby.
BULMA - A CSS Only alternative for Bootstrap
Tags: bulma, bootstrap, css, uiframework
Published: 2020-05-23 08:55:10

## Monotonous Bootstrap ##
After the usage of bootstrap in multiple projects i got monotonous with bootstrap. Particular with [Bootstrap4](https://getbootstrap.com/). I lost my fun towards bootstrap and started looking for alternatives. The next famous UI framework that shine before me was Googles Material design. It looks good and inspire lot of fun but it requires lot of attentions. There is a steep learning curve in order to use the Material design. Search continues for alternatives.

## Why to include Script for UI Design ? ##
One more thing that strikes me is the need for lot of javascripts that needs to include in order to use a UI framework. Frameworks like bootstrap, material design and other frameworks that come with a heavy js code for its interactions. 

In that search for the CSS Only alternative framework that got my attention is __[Bulma](https://bulma.io/)__.

## Bulma - To The Rescue ##
Bulma is a very light weight framework with which you can able to build a whole website without the need for any additional UI library. You just need to link the CSS from [CDNJs](https://cdnjs.cloudflare.com/ajax/libs/bulma/0.8.2/css/bulma.min.css) and start to build. 
It size very less approximately __~190Kb__. Bulma contains all the need elements like

* Responsive Design
* Layout Helpers
* Grid System
* Utility Helpers
* Form Utilities
* Components

If you have already used bootstrap then you can able to find all you bootstrap components available in Bulma with detailed [Documentation](https://bulma.io/documentation/), 
Starting from

* Hero Component
* Themed Buttons
* Themed Alerts
* Cards & Modal Dialogs
* Menus & Dropdowns
* Tabs & Accordion
* Breadcrumbs & Paginations
* etc.

Off-course the interactions for tabs and accordion we have to write on our own. But with jQuery, we can achieve that in not more than a line.

Bulma enables Rapid Application Development with very less or no learning curve.

## SAAS Support ##
If you can work on SAAS than you can build you own theme with the help of exposed 419 Variables and Mixins. With the help of Node or Webpack we can create the task of building your own themed Css. 

If any one planning for a new project then you can try out Bulma. I am sure you won't regret it.
Park Street 11 - 3D CSS
Tags: codepen
Published: 2020-05-08 18:32:50

<p>Move your cursor around the screen to get a nice 3D effect, and scroll up and down to zoom in and out!</p>

<p>Patterns on this building's facades always amazed me. It did so much so that I decided to re-make it with CSS! Bricks are done using grid. </p>

<p>The place can be seen in Google Maps here: <a href="https://www.google.com/maps/@60.1561377,24.9508849,3a,22.1y,327.35h,101.71t/data=!3m6!1e1!3m4!1sd4qWGRwTewJ5RijP9fFKgg!2e0!7i13312!8i6656" target="_blank">https://www.google.com/maps/@60.1561377,24.9508849,3a,22.1y,327.35h,101.71t/data=!3m6!1e1!3m4!1sd4qWGRwTewJ5RijP9fFKgg!2e0!7i13312!8i6656</a></p>

{% codepen https://codepen.io/pavlovsk/pen/YzyYbLV %}
Bring fortune to your Linux terminal with cowsay figlet lolcat
Tags: linux
Published: 2020-05-08 21:07:41

We will cover a few interesting commands today, they are `figlet` `toilet` `lolcat` `fortune` `cowsay` `shuf`. To learn a new command, I believe the best way is always to check `tldr` for the basic usage and then play with it.


![](https://www.chuanjin.me/images/figlet.png)
![](https://www.chuanjin.me/images/toilet.png)
![](https://www.chuanjin.me/images/lolcat.png)
![](https://www.chuanjin.me/images/fortune.png)
![](https://www.chuanjin.me/images/cowsay.png)
Not only *cow* and *dragon*, but also many other options are available to choose. Check them with
```
ls /usr/share/cowsay/cows
```
To pick one randomly, `shuf` comes in. And to fetch only file name without extension, there're more than one way to do so.
![](https://www.chuanjin.me/images/shuf.png)

Now, time to put them all together, and try to run it a few more times to see the results.
![](https://www.chuanjin.me/images/together.png)

{% youtube b30SXMhuyqo %}
```
echo "Enjoy and have fun\!" | lolcat -a
```
Day39:Generate random value - 100DayOfRust
Tags: rust
Published: 2020-05-09 03:53:39

We can use external crate `rand` to generate random value.

In `Cargo.toml`:
```
rand="0.7.3"
```

In `main.rs`:
```rust
use rand::{prelude::*, Rng, distributions::Alphanumeric};
// Rng stands for "random number generator"

fn main() {
    let num: u32 = rand::random();
    println!("generated rand integer: {}", num);

    let c: char = rand::random();
    println!("generated rand char: {}", c);

    let mut rng = rand::thread_rng();
    // gen function is a generic-type function
    let b1: bool = rng.gen();
    println!("generated boolean is {}", b1);

    let n1: u32 = rng.gen();
    println!("generated integer is {}", n1);

    let f1: f32 = rng.gen();
    println!("generated float is {}", f1);

    // generate number within range
    let range_num = rng.gen_range(0, 10);
    println!("number b/t 0-10 is {}", range_num);

    let range_decimal = rng.gen_range(0.0, 1.0);
    println!("number b/t 0-1 is {}", range_decimal);
    
    // generate a string with specified length
    let rand_str: String = rng.sample_iter(&Alphanumeric).take(15).collect();
    println!("generated random string: {}", rand_str);

    // shuffle some array
    let mut nums: Vec<i32> = (1..10).collect();
    // .shuffle need rand::prelude::*
    nums.shuffle(&mut rng);
    println!("num list: {:?}", nums);
}
```

Run it `cargo run`:

```
generated rand integer: 2802536511
generated rand char: 񭌀
generated boolean is true
generated integer is 497331788
generated float is 0.0054394007
number b/t 0-10 is 3
number b/t 0-1 is 0.23074173856274816
generated random string: 97lbEyO3SVJgt7k
num list: [8, 1, 2, 3, 5, 4, 9, 6, 7]
```

## Reference:
* https://rust-lang-nursery.github.io/rust-cookbook/algorithms/randomness.html
* https://rust-random.github.io/rand/rand/index.html
* https://rust-random.github.io/rand/rand/trait.Rng.html#method.gen
Serverless Cobol
Tags: serverless, docker, showdev, php
Published: 2020-05-19 08:32:25

I'm currently in the process of writing a post covering how to run Laravel Serverless on Google Cloud. There I was, sitting there hashing out the post and I wrote this:

> This pretty much means you can run anything that responds to HTTP request, hell you could even run Cobol if you wanted!

Well, I can't really claim that without actually trying it, can I? Well, an hour or so later and were running serverless cobol!

https://serverless-cobol-max7gzuovq-uc.a.run.app/cobol+dev.to=%3C3

It was actually surprisingly easy to build a docker container to run cobol, despite it being a 60+ year old language. There's a modern re-implementation called [GnuCobol](https://en.wikipedia.org/wiki/GnuCOBOL) which support modern OSes like Ubuntu.

Here's the [dockerfile](https://github.com/atymic/serverless-cobol/blob/master/Dockerfile) which compiles the cobol source code & sets up apache (which interfaces with the cobol program as a CGI script).

```docker
FROM ubuntu:bionic

RUN apt-get update
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:lud-janvier/gnucobol
RUN apt-get update
RUN apt-get install gnucobol apache2 -y

COPY . /var/www/public
WORKDIR /var/www/public

RUN cobc -x -free serverless.cbl -o the.app
RUN chmod +x ./the.app

COPY docker/apache.conf /etc/apache2/sites-available/000-default.conf

EXPOSE 8080


RUN echo "Listen 8080" >> /etc/apache2/ports.conf && \
    chown -R www-data:www-data /var/www/ && \
    a2enmod rewrite && \
    a2enmod cgid

CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
```

Building the container & getting the cobol code to run was the hard part, deploying to Cloud Run is incredibly easy - two command and a few minutes later and we're running cobol in the cloud!

Is it useful? Definitely not. Was in fun? Sure was 🙃

[Source code on Github](https://github.com/atymic/serverless-cobol).
Now to do some actual work 😬
Constructor Overloading in C++
Published: 2020-05-19 10:29:01

<a href="https://www.chlopadhe.com/constructor-overloading-in-c/">Constructor Overloading in C++</a>
A constructor can overload to overloading functions in a similar way.
Constructors overloaded have the same name (class name) but a varying number of arguments.
A specific constructor is named according to the number and form of arguments transferred.
Since multiple constructors are present, the argument should also be passed on to the constructor when constructing an entity.
Constructors could also be overloaded as with other member functions. If you have both default and parameterized constructors specified in your class, you will have overloaded constructors, one without parameter and one with parameter.
In a class, you can have any number of Constructors varying in the parameter list.
The Knowledge Base: A Podcast on Personal Productivity Tools
Tags: discuss, productivity, tools, digitalgarden
Published: 2020-05-19 11:16:04

# The Why

Today, the landscape of productivity tools is vast and vibrant. Each one of us is using a different set of tools to manage their own personal knowledge base. We also vary in what parts of our knowledge base we manage: some annotate books, others stick to their to do lists, bookmarks and/or personal finances. I think that there's a tremendous value in mapping this landscape. 

# What is it?

**The Knowledge Base is a podcast and a community dedicated to reviewing the tools in the ecosystem and finding the best workflows.** The podcast will be used to interview some of the builders of the best apps and experts on the topic. The community will be used to share knowledge and experience.

# The Goal
Working on improving our productivity results in developing good habits which, we all know, are essential to self-improvement. When these are shared in the community, it's tremendously easier to find the best patterns. Our goal is to make this improvement x100 easier. 

# The Next Steps
I want to hear your opinions, before I share the next steps with you. Are you with me? Do you have any suggestions to make this better?

In the meantime you can follow this [Twitter account](https://twitter.com/theknowledgeba5). 

Let's build The Knowledge Base together!
Democratizar el lenguaje de signos
Tags: text2sign, asl, lse, video
Published: 2020-05-19 17:03:50

## Primera clase en todos los videos
Mientras pensaba en mi [post previo](https://dev.to/carloshm/como-publicar-traducciones-de-microsoft-translate-en-microsoft-stream-4naf) sobre capacidades de traducción en videos, mientras veía la sesión de [Microsoft Build](https://build.microsoft.com), me he dado cuenta de un nuevo icono en el streaming de las sesiones, para ver la traducción en lenguaje de signos americano (ASL) de la sesión. Increíble trabajo el de #MSBuild
![ASL Lenguaje de signos en videos](https://raw.githubusercontent.com/carloshm/devto-articles/master/images/ASL%20in%20video.png)
Puedes ver una corte de la traducción de la presentación de Imagine Cup
<video width="640" controls>
  <source src="https://github.com/carloshm/devto-articles/blob/master/images/ASL_Video.mp4?raw=true" type="video/mp4">
  Your browser does not support the video tag.
</video>

## Lenguaje de signos para todos
¿No sería fantástico poder incluir esta funcionalidad siempre en todos tus videos?
Hay un proyecto en Github que emplea el servicio https://www.signingsavvy.com/search/hello {% github https://github.com/Waasi/text_2_sign %}

que podríamos usar para incluir el resultado en los video de Stream.

## Material de aprendizaje
Empezaré por leer un poco de [Wikipedia](https://es.wikipedia.org/wiki/Lengua_de_se%C3%B1as) para aprender sobre su diversidad con el objetivo de centrarme en Speech2Text2Sign. Existen proyectos interesante para hacer traducción en tiempo real, empleando modelos entrenados mediante DNN, pero veo más factible su inclusión partiendo de texto.

**Nota** Proyecto añadido a mi listado: Prototipo para incluir lenguaje de signos y mezclarlo
Announcing Torah && Tech; The Book.
Tags: showdev, books, learning, coding
Published: 2020-05-19 19:38:25

---
title: Announcing Torah && Tech; The Book.
published: true
date: 2020-05-19 19:01:30 UTC
tags: showdev,books,learning,coding
canonical_url: https://blog.yechiel.me/announcing-torah-tech-the-book-2cf2e9c91d82
series: Torah && Tech
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--wMEq9tYJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/0%2AxL9qpvQ2KX4ynJuZ.png
---

About a year and a half ago, my friend [Ben Greenberg](https://dev.to/benhayehudi) and I were trying to come up with a project that would allow us to keep in touch as his family made Aliyah and moved halfway across the planet.

![The Torah and Tech logo.](https://cdn-images-1.medium.com/max/257/1*OhjCxTFwZ6sQcywFBTR_ZQ.png)

The result was **Torah && Tech**, a weekly newsletter that covers the two interests we both have in common: tech and Jewish laws and ethics.

The following 75 weeks (and counting!) have been loads of fun! We grew our readership from just the two of us (and our supportive spouses) to close to 200 weekly subscribers.

The newsletters covered topics ranging from office etiquette and mentorship to the future of AI and the use of pointers in Golang to coping strategies during COVID-19 imposed quarantine.

As we hit the one-year mark, the realization hit that this wasn’t just a side project that would last a month or two and that we were in this for the long-haul. The idea came up to collect the first year’s worth of Torah thoughts and publish them in a book.

The idea sounded intimidating at first, but thanks to some help from a few good friends, we are happy to announce, just in time for Shavuot, that the first volume of Torah && Tech is available for pre-order!

![](https://cdn-images-1.medium.com/max/1024/0*xL9qpvQ2KX4ynJuZ.png)

Unfortunately, due to coronavirus related delays, the print version won’t be available for another few weeks. Still, the e-book version is available for pre-order at most retailers and will be delivered to your favorite e-reader device on June 1st.

Just head over to [**torahandtech.dev**](https://torahandtech.dev/) and order your copy today.

Of course, while you’re there, you can use the opportunity to sign up for the newsletter so you can get a preview of volume two before anyone else. You will get a weekly Torah though in your inbox every week, just in time to share it at your Shabbat table.

If you have any comments or feedback about the book, please don’t hesitate to reach out to Ben or me on our social media. We LOVE talking about anything Torah/tech-related!

* * *