teleren/devto huggingface dataset:
Better together
Tags: csharp, womenintech, codenewbie
Published: 2020-10-22 00:51:59

Today I’d like to share my experience with pair programming.  I will admit that it was something I was not looking forward to when I began the boot camp experience.  Years ago I was part of a group project that went horribly awry.  I have had many successful group experiences since then, including at least one for each of the classes I completed for my MBA, but that one awful experience has left me dreading group work.  I am happy to say that the pair programming experiences I have had during the Tech Elevator boot camp have given me the opportunity to see just how awesome pair or group work can be.  

We have had several smaller pair exercises so far as well as having completed our first mini capstone at the end of our first module of learning (C#).  We actually begin the mini capstone for the end of Module 2 tomorrow.  The first advantage to the pair work is that it provides an opportunity to form a stronger connection with a classmate in this virtual environment.  While we all keep our video on during lecture and participate in a chat, I definitely appreciate the opportunity to get to know people in a more one-on-one setting that is a bit absent in this virtual experience.  The pair work allows for feeling a bit more connected as we work our way through the boot camp experiences.

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

Another advantage to the pair work is that everyone seems to learn the concepts a bit differently.  In every pair I have worked in so far, regardless of if we started the boot camp on equal footing, we have been able to take turns leading the work and gotten things done in a smooth and simple manner.  Whenever one of the pair got stuck, the other partner had a slightly different understanding of the concept and was able to get us back on track and past the snarl.  It has been a learning process that has allowed me to learn new ways to think about the problems encountered as well as to learn more about myself and how far I have come on this journey.  Just over a month ago I had never seen a line of code.  At the end of the first module, I was able to build a fully functioning catering/vending machine software with a pair partner.  Tomorrow I start working on a reservation system utilizing SQL databases.  This is fun and I can’t wait to get started!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uwdfyxm5vfsmf3s0yliy.jpg)
Would it make sense to have "Symbol.promise" as standard JavaScript Symbol?
Published: 2020-10-22 00:12:50

**Updated**: I've tried to provide a better context for this discussion with my new post: ["Thenable: how to make a JavaScript object await-friendly, and why it is useful"](https://dev.to/noseratio/we-can-make-any-javascript-object-await-able-with-then-method-1apl).

Asking for opinions. Would it make sense to have a standard symbol for the object's default awaitable, e.g. `Symbol.promise`, by analog to [`Symbol.asyncIterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator)?

I sometimes use the following pattern, in a nutshell ([codepen](https://codepen.io/noseratio/pen/eYzBBXp)):

```JS
class AsyncOperation {
  #promise = null;
  
  constructor(ms) {
    this.#promise = new Promise(r => setTimeout(r, ms));
  }
  
  then(resolve, reject) { 
    return this.#promise.then(resolve, reject); }
}

async function main() {
  await new AsyncOperation(1000);
  console.log("completed!")
}
```

This works, because we've made an instance `AsyncOperation` to be [`thenable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve).  

If however we had `Symbol.promise`, it'd be less boilerplate code for `AsyncOperation`:

```JS
class AsyncOperation {
  #promise = null;
  
  constructor(ms) {
    this.#promise = new Promise(r => setTimeout(r, ms));
  }
  
  get [Symbol.promise]() { return this.#promise; }
}
```

Wouldn't `Symbol.promise` be useful?

Here is a less contrived snippet, adapted from some real-life code of mine:

```JS
const subscription = createSubscription(
  cancellationToken, eventSource, "eventName"); 
try {
  await subscription;
}
finally {
  subscription.close();
}
```

The relevant part of `createSubscription` code:

```JS
  // ...
  return Object.freeze({
    close: () => unsubscribe(),
    then: (resolve, reject) => promise.then(resolve, reject)
  });
```

I'd like to be able to do:

```JS
  // ...
  return Object.freeze({
    close: () => unsubscribe(),
    get [Symbol.promise]() { return promise; }
  });
```

Of course, I could as well just expose `promise` as a property getter (and do `await subscription.promise`), or as a method, similar to [RxJS' `toPromise()`](https://www.learnrxjs.io/learn-rxjs/operators/utility/topromise). 

Yet the same arguments could possibly be used for iterable objects, which nevertheless expose their iterators via [`Symbol.iterator`] or [`Symbol.asyncIterator`]. Not via something like `array.iterator` or `array.getIterator()`.

IMO, it'd be convenient if `await` looked for `[Symbol.promise]` in the same way the `for...of` and `for await...of` loops look for iterators.

Given that **we already can `await` *any* expression in JavaScript** (not just a `Promise` or "thenable"), I think that would make sense.
How to focus on input HTML tag using JavaScript?
Tags: javascript
Published: 2020-10-22 00:00:00

---
  title: How to focus on input HTML tag using JavaScript?
  published: true
  tags: JavaScript
  date: Thu Oct 22 2020 05:30:00 GMT+0530 (India Standard Time)
  canonical_url: https://melvingeorge.me/blog/focus-input-text-box-element-javascript
  cover_image: https://melvingeorge.me/_next/static/images/main-5edd1232855a8c6e4b44e60a9a4fdcc6.jpg
  ---
  [Originally posted here!](https://melvingeorge.me/blog/focus-input-text-box-element-javascript)
  
Focusing on the input tag is a common feature in modern websites to give attention to the user visiting.

To set focus on an `input` tag element in HTML, you can use the `focus()` method on the element using JavaScript.

Let's say we have an input tag in HTML like this,

```html
<!-- Input tag -->
<input id="myInput" type="text" placeholder="Enter some text here" />
```

And we want the `input` tag to be on focus whenever the user visits the website.

Let's focus the `input` tag element using `focus()` method like this,

```javascript
// first get a reference to the input tag
const input = document.querySelector("#myInput");

// use the focus method
input.focus();
```

Now the input tag is focussed. ⭐️

See this example live in [JSBin](https://jsbin.com/batusadoqa/edit?html,js,output).

### Feel free to share if you found this useful 😃.

---
Operador de coalescência nula no PHP 7.4
Tags: php
Published: 2020-10-21 23:49:48

Uma novidade no PHP 7.4 é operador de coalescência nula. Mas o que diabos é coalescência?

De acordo com a internet:

_O conceito de coalescência, que tem origem no vocábulo latino coalescens, é a propriedade de as coisas se fundirem ou unirem. As substâncias ou os materiais coalescentes são aqueles que se podem unir num único corpo._

Boa, e como ele foi implementado no PHP?

Imagine que você precise atribuir um valor à uma variável. E como condição, caso essa mesma variável não esteja instanciada deve-se atribuir um outro valor:


### 1 - Primeira idéia:
```
if (isset($usuario)) {
    $usuario = 'outro valor' 
}
```

### 2 - Melhorando com operador ternário:
```
$usuario = isset($usuario) ? $usuario : 'outro valor';
```

### 3 - Usando coalescência agora:
```
$usuario = $usuario ?? 'outro valor';
```
ou enão de forma mais enxuta:
```
$usuario ??= 'outro valor';
```

Todos os exemplos acima fazem a mesma coisa. E uma dica extra, também é possível fazer vários encadeamentos, dessa forma:

```
$usuario =  $usuario ?? $_GET['usuario'] ?? $_POST['usuario'] ?? 'outro valor';
```

Nesse caso a variável `$usuario` será atribuída com o primeiro valor encontrado. 

### Referências:
1 - [https://www.php.net/manual/pt_BR/migration70.new-features.php](https://www.php.net/manual/pt_BR/migration70.new-features.php#migration70.new-features.null-coalesce-op)

2 - [https://cursos.alura.com.br/novidades-do-php-7-4-operador-de-atribuicao-com-coalescencia-nula-c291](https://cursos.alura.com.br/novidades-do-php-7-4-operador-de-atribuicao-com-coalescencia-nula-c291)
3 - [https://conceito.de/coalescencia](https://conceito.de/coalescencia)
Un punto de vista y una prediccion sobre IoT que nadie conoce
Tags: iot, tecnology, prediction, opinion
Published: 2020-10-21 23:06:48

El panorama de Internet está creciendo rápidamente. Ahora, la computadora, las laptops, los teléfonos inteligentes y las tabletas no son las únicas cosas de interés. Se está introduciendo una multitud de dispositivos conectados a Internet. Todos los dispositivos ahora son inteligentes.

El loco futuro que nos prometían las historias de ciencia ficción está bastante cerca.

Internet de las cosas es el término genérico para muchos objetos conectados a Internet. Muchas aplicaciones móviles en línea y fuera de línea están facilitando nuestro trabajo.

A continuación se muestran algunas de las predicciones sobre IoT que verá que se harán realidad en los próximos años.

Este artículo se centra en algunas de las predicciones sobre IoT que pronto se harán realidad. Algunos puntos principales explicados en este artículo son

> Dispositivos conectados
> IoT para piratas informáticos
> Ciudades inteligentes
> Enrutadores seguros
> Uso de productos inteligentes
> Ecosistemas de dispositivos específicos de la aplicación
> IoT para empresas
> Algunos inventos asombrosos:
> Disminución de la contaminación del aire por tecnología
> Sistema de estacionamiento inteligente

Estos son algunos temas que tengo como predicción que muchas empresas ya están implementando y se están adelantando a la tecnología.

Si te gusto el post y tienes interés sobre Iot puedes checar mi [ebook](https://amzn.to/2FDdwZd) donde planteo diferentes opiniones y modelos de negocio para internet de las cosas, es un libro muy completo de una investigación detallada de los procesos de iot, espero y te guste, puedes darle clic [aqui](https://amzn.to/2FDdwZd) y podrás comprar mi libro, muchas gracias.
My own realtime chat with react, graphql and postgresql [part 5 - Graphql playground]
Tags: node, graphql, postgres, realtime
Published: 2020-10-21 22:56:52

As we saw in the [previous part](https://dev.to/dalejan/my-own-realtime-chat-with-react-graphql-and-postgresql-part-4-server-j82), a playground interface has been deployed in our server url.

In this playground we can now check the schemas, queries, mutations and the typeDefs.

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

In the right section we have the `Docs` and the `Schemas` tabs.
The schemas show ... well, the secrets of the universe; and the docs shows us how to call the mutations, queries and subscriptions.

So let's run our first mutation, let's create an user.

```javascript
mutation signUpUSer(
  $usr: String
  $name: String
  $password: String
  $type: String
) {
  signUpUser(usr: $usr, password: $password, name: $name, type: $type) {
    name
    usr
  }
}

```
This is the mutation we wrote in our backend, and the typed params we defined. The notation `$` in those params allows us to use the `Query Variables` section, where we can define them as follows.

```javascript
{"usr":"dalejan","name": "David","password": "1234","type": "none"}
```


If we run this mutation it should print the name and the username in the right section. We can also verify if our database is correctly saving the user.

In our Elephantsql instance, we can run SQL queries as follows.
 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8ll3p98mme5g2o9a2qqb.JPG)

If everything was ok running this query must return a single row: our new user!

You can experiment with this playground in order to understand how the rest of the mutations and queries work here.

Now i would like to focus in the realtime functionality, for this you have to create the `createMessage` mutation.

Once you have setted up this query, you can now create the subscription `messageAdded` as follows.

````javascript
subscription {messageAdded{text,usr}}
```
If you run this subscription on the playground you'll see a `Listening` log in the right section. Now if we go back and run the `createMessage` mutation, and check the subscription log we can see the message added!

*Now our backend is ready.* 

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

In the next sections we'll be seeing how to implement a graphql client with react!
Learn Clojure Interactively Using eBooks
Tags: clojure, learning
Published: 2020-10-21 10:42:52

---
title: Learn Clojure Interactively Using eBooks
published: true
description: Learn Clojure Interactively By Turning eBooks into Literate Programming
tags: clojure,learning
//cover_image: https://direct_url_to_image.jpg
---

I recently decided to learn a bit of Clojure.  My first step was to setup my [preferred editor](https://neovim.io/) with a [Clojure plugin](https://github.com/Olical/conjure).  The Clojure tooling allows a developer to write code in a text buffer, then use a keyboard shortcut to execute a section of that code in the REPL.  This instant feedback makes for a really great developer experience.

After toying around a bit, I bought a copy of [Getting Clojure](https://pragprog.com/titles/roclojure/getting-clojure/) by Russ Olsen from the Pragmatic Bookshelf.  One of their download options is PDF format.  I read through the first chapter, typing the code examples into a text buffer and using a keyboard shortcut to execute them in the REPL.  Typing these examples got a bit tedious, so I started copying and pasting.  That's when I got an idea.

If only I could open this book in my editor, then I could just execute the snippets without having to type them.

So, I converted the PDF to a .clj text file using [pdftotext](http://manpages.ubuntu.com/manpages/bionic/man1/pdftotext.1.html) (I used the -layout flag for better formatting).  Then, I opened the newly converted text file in my editor and was able to execute the code-snippets with a keyboard shortcut.  Since this is just a plain-text file, I am able to modify the existing code and try things out with instant feedback.  This is a really interactive and engaging way to learn Clojure.
OpenHackDaySriLanka2020
Tags: hacktoberfest, hacktoberfest2020, openhackdaysrilanka2020, digitalocean
Published: 2020-10-21 22:10:10


Hacktoberfest is a great event for the beginners to start contributing to the open source projects & also to find and be updated about the projects you should start working on.

We, the FOSS Community NSBM in Sri Lanka had organized the OpenHackDaySriLanka 2020 hacktoberfest as an online event. It was very informative session & we discussed about what is git & github, open source projects, how to contribute and be a part of hacktoberfest and the github campus expert program.

you can see the full video of the event here:
https://www.youtube.com/watch?v=j9SgDkurrlo
Variables and Constants in Swift.
Tags: swift, apple, basics
Published: 2020-10-21 22:04:50

# Brief Introduction About Swift
Swift is a language developed by Apple which is made using modern approach, include safety features and software design patterns. As the name suggests swift is fast, safe and easy to use. It is basically made a replacement for c-based family(C, C++ and Objective-C). It can be used to make apps and can be also used for cloud services and it is among the fastest growing languages.

# What are Variables and Constants?
As the name suggests, values that can be varied later according to needs.

**Variables and Constants** are like containers for storing values. Let's say i have a box in which i stored a number 10, but later on i wished to change it to let's say 6 then what i will do is take the old value out and put a new value inside that box. 

But not the same happens in case of **Constants**. As their name suggests, their value remain constant over time and cannot be changed. Here if is stored 10 then it's gonna remain 10 and cannot be changed.

# How To Declare Variables and Constants ?

**Comments** in Swift : We use `//` for comments in swift.Comments are like if we do not want to include something in our code but we want it to be present in our code snippet. So compiler while compiling will ignore these comments.

**Variables**
They are defined with keyword `var`.

```swift
var variableOne = 10 // assigned value of 10 to a variable
// Swift has a cool feature of type inference that means that swift will automatically decides the type of variable for you. Like in above line swift will say okay this is variable of type Integer
var stringOne = "Hello, World!"
// Here swift will automatically infer the type of variable as String
var doubleOne = 1.00
//Here Swift will infer this variable as of type Double
var boolOne = true
//Here Swift will infer the type of variable as type Bool
```

```swift
var x = 1
x = 2
print(x) // this will print value of x as 2 
```

**Constants**
They are defined using keyword `let`

```swift
let x = 1
x = 2 // Swift will give error here as x is declared as constant in above line
```

**Type Annotation** - In above part we saw that **Swift** has power to infer the type of variable but what if we want to play safe and declare type of variable ourselves.

```swift
var a : Int // Here we are saying that we have variable a of type Int
var b : Double // Here we are saying that we have variable b of type Double

var c : String // Here we are saying that we have variable c of type String

var d : Bool // Here we are saying that we have variable d of type Bool
```

**Note : Semicolons after end of every statement are optional in Swift.**

This was all about Variables and Constants in Swift. I haven't included data types in detail but we will see that in next post.
Day 239: Finally
Tags: hiphop, code, coding, lifelongdev
Published: 2020-10-21 21:34:13

_liner notes_:
- Professional : Got up early to sit in on a Talk Prep session. Pretty good. Then I drove to my folks' house, it's my mother's birthday so I wanted to stop by and brought some breakfast. Got there (kind of far from where I was) and took a nap. haha. Got up and knocked my head against the warning I kept getting for a demo I built for a blog post I'm writing. Well... I finally got it!!! It was a setting I had to in the webpack config file. My rule of thumb is if I have to start messing with webpack to get something working, I stop using that framework. haha Point is, it is working and now I can write up this post! My brain was so fried after getting it to work. I tried SO MANY things and read SO MUCH documentation and forum posts! haha

- Personal : Last night, I cleaned up some of the code I was working on for my side project. Making sure the server is sending what I need for the front end to show. Got pretty late, then went to sleep.

![Snow capped mountains of Aconcagua, Argentina](https://dev-to-uploads.s3.amazonaws.com/i/8ld13987c715q4dxg6pi.png)

Probably going to just write up an outline for my blog post so all I have to do is just flesh it out and submit it for review. Then I'm going to get the recording of the last show submitted to be played at the radio station this weekend. Then maybe continue working on my side project.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube xk8mm1Qmt-Y %}
Snackbar, Snackbar Everywhere
Tags: dart, snackbar, flutter, instagram
Published: 2020-10-21 20:14:40

---
title: Snackbar, Snackbar Everywhere
published: true
date: 2020-10-21 19:33:55 UTC
tags: dart,snackbar,flutter,instagram
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/0*ErdZ3uKZhxHqfUz6)<figcaption>Photo by <a href="https://unsplash.com/@shambam?utm_source=medium&amp;utm_medium=referral">Sam 🐷</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

On Instagram when you bookmark a photo, it shows a snackbar on top of it. Today, we’re going to build a similar experience in Flutter without using any external dependencies & with minimal code!

_So, let’s get started. 🍕_🍫

### 👀 Demo

![](https://cdn-images-1.medium.com/max/800/1*ziqE7bjxHExWws4LtMkdxQ.gif)<figcaption><strong>Demo</strong></figcaption>

Create a fresh new flutter project:

```
flutter create snackbar_snackbar_everywhere
```

After that, remove everything from main.dart & paste the following content:

{% gist https://gist.github.com/piedcipher/1ec348937be801ce59b56349e0d214fb %}

- In this code, we start off with the MaterialApp & the main Scaffold.
- The main Scaffold’s body contains a ListView.
- Each ListTile consists of a Container whose child is another Scaffold.
- Each of these child scaffold’s have a unique GlobalKey so that a SnackBar can be shown using that key whenever ListTile is tapped 🐍.
- You can play around with the code on [**this dartpad**](https://dartpad.dev/1ec348937be801ce59b56349e0d214fb) ** 🎯**.

### That’s it for this one. Thank you for reading this 💙

**_You can find the complete source code in the above gist or dartpad._**

**_If you find this byte-sized post useful, press👏 button as many times as you can and share this post with others. You can leave your feedback/suggestions in the comments 💬 below._**

**_For any other issues feel free to reach out to me via Twitter:_** [https://twitter.com/piedcipher](https://twitter.com/piedcipher)

* * *
Laravel 7: Cache route error
Tags: php, laravel
Published: 2020-10-21 21:29:32

It is common to create laravel projects in subfolders, and perform an access configuration by subdomains, something similar to: <code>https[]()://mydomain.com/aliasdomain</code> , generally, this has been supported and at the time of caching the routes hasn't  been generated a type of conflict, however, in laravel 7 this has generated a mistake in the routes that are specified as:

```php
Route::get('/', '.....')
```

A solution implemented in a project to solve this problem with the route cache was:

1. Create a middleware with the following validation:

```php
class RouteCache 
{
	public function handle(Request $request, Closure $next)
	{
	    if ($request->path() === '/') {
	        $newURI = $request->server->get('REQUEST_URI') . 'index.php';
	        $request->server->set('REQUEST_URI', $newURI);
	    }
	
	    return $next($request);
	}
}
```

2. Add the middleware to the Kernel file in the middleware array:

```php
protected $middleware = [
	....,
	\App\Http\Middleware\RouteCache::class,
];
```

With this, what is achieved is that if a route <code> /</code> is declared within the project, the middleware validates when trying to access it and overwrites the <code> REQUEST_URI </code> value that the request carries by adding <code>index.php</code> (this will continue being transparent to the end user)
How to ask senior devs for help?
Tags: anonymous, discuss, beginners, career
Published: 2020-10-21 21:24:25

_This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment._

I'm a junior software developer with 1 year of experience as a product engineer. Sometimes I feel as though I'm asking for too much help & have too many questions.

How can I go about asking for help & to what extent should I ask for help? Is it normal for junior devs to asks programming or framework-related concepts to senior devs?