teleren/devto huggingface dataset:
How to check if an item exists in a tree or table in RCPTT
Tags: rcptt, eclipse, item, tree
Published: 2020-04-08 10:29:11

When working with trees and tables, have you ever faced a case where you want to check whether a given item is visible?

In RCPTT, an item is obtained using the <code>get-item</code> ECL command. If you try to get an item that does not exist then an error is returned saying that the item could not be found and the test case fails immediately.

In general, invoking <code>get-item</code> can be enough to verify that an given item exists but what to do if we want to continue the execution of the test case to perform other verifications even if the item does not exist.

We create a procedure to handle the case where an item is not found so the error can be captured using <code>try</code> and <code>catch</code> commands as follows:
```
proc itemExists [val parent -input] [val path] {
	try {
		$parent | get-item $path
		bool true
	} -catch {
		bool false
	}
}
```
As you can see, it is simple and lets us have control over the execution of any command that can fail. In this case, the procedure returns true if the item exists or false if an error occurs when getting the item.
###Example of general usage
```
get-preferences-menu | click
with [get-window Preferences] {
	get-tree | itemExists Help | verify-true
    get-tree | itemExists HelpNotFound | verify-false
}
```
###Example of specific usage with conditions
```
if [itemExists Help] {
    // item is found, do more verifications
} -else {
    // item is not found, do more verifications if you want
}
```
The Ultimate Git Tutorial Part 7: .gitignore
Tags: git, productivity, beginners, github
Published: 2020-04-08 10:24:41

**About Me:** I've been a professional web developer for just over 10 years now. I'm currently the lead web development instructor at [Better Coding Academy](https://codebetter.com.au), and as part of what I do, I post videos on our YouTube channel at [https://www.youtube.com/c/BetterCodingAcademy](https://www.youtube.com/c/BetterCodingAcademy).

_(Subscribe for awesome web development content!)_

I'm releasing a full series covering the use of Git from the very beginning! This series will cover everything from cloning, pulling, branching, merging, and so much more. Here's the seventh video in the series - stay tuned for more to come very soon!

{% youtube h-1EBRYBUwA %}

Happy coding!
🔥🔥🔥 Copying object keys and values to a class.🔥🔥🔥
Tags: javascript, typescript, vue
Published: 2020-04-08 10:02:49

---
title: 🔥🔥🔥 Copying object keys and values to a class.🔥🔥🔥
published: true
description: Yesterday I face a challenge to copy the and object parameter key and values to my class keys and replace the value to the object values.
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/9o7j3xvhr2jx13ggv6d6.png  
tags: js, typescript, vuejs, JavaScript
---

## Coping the values of and object parameter to `` this`` in a class 


- At first I declare the type and default values for my class keys,
but then  I realize that I will need to set the values in the constructor again.
So the first solution that I thought of was the fallowing: 

```javascript  
//typescript
export default class Project {
    id: string = "";
    name: string = "";
    date_end: string = "";
    description: string = "";
    parent: number | null = null;
    //....MORE keys

    constructor(data?: any) {
         let self = this;
        if (data) {
            Object.getOwnPropertyNames(data).forEach(key =>{
              self[key] = data[key].value
            })
        }
    } 
}
```
But this solution it seems to dirty and crazy so i try the fallowing :

```javascript
export default class Project {
    id: string = "";
    name: string = "";
    date_end: string = "";
    description: string = "";
    parent: number | null = null;
    //....MORE keys

    constructor(data?: any)
        if (data) {
            Object.assign(this, data);
        }cover_image: direct_url_to_image.jpg 
    } 
}
```

So what is ``Object.assing(target,source)`` doing ? 

* Only copies enumerable and own properties from a source object to a target object.
*  It uses ``[[Get]]`` on the source and ``[[Set]]`` on the target.
*  It assigns properties versus just copying or defining new properties.



The other option for me would be doing, the fallowing :
```javascript
export default class Project {
constructor(data?: any){
   if (data) {
    this.id: string = data.id;
    this.name: string = data.name;
    this.date_end: string = data.date_end;
    this.description: string = data.description;
    this.parent: number | null = data.parent;
    //....MORE keys
    }     
   } 
}
```

> Please any opinion or suggestions, about this topic or what is the best or a better implementation of assigning key -> values from obj1 to obj2, are more than welcome.
When JavaScript Becomes a Part of You
Tags: codenewbie, womenintech, javascript, devjournal
Published: 2020-04-08 09:44:02

When I was *first* learning to code over a year ago with HTML and CSS and wondering what I'd move on to next - I remember talking on Slack with one of my colleagues - an engineer. This coworker was really such a helpful source during those first few months with his encouragement and perspective.

One really helpful thing he said to me definitely made an effect - so much so that I immediately wrote it down at the time for fear of not remembering it one day (and I'm so glad I did!):



_JavaScript is going to be a new journey - since it’s a full-blown programming language. However, the fun is also on a whole new level - it’ll make you feel like a wizard!_

_Don’t look at it all at once. Start one step at a time - you won’t even notice how it’ll become a part of you._



That final 'you won't even notice how it'll become a part of you' is so incredibly accurate. With every passing day of learning and sharpening the skills we have, programming becomes a part of us.

It becomes a part of us in the way we think. In the way we solve problems. In the way we accept that we don't know the answer right now but give us some time and we have the confidence to figure it out.

_This post was originally published on April 8, 2020 on [my blog](https://alexlsalt.github.io/blog)._
Why testing-library fails to do what it set out to do
Tags: react, javascript, webdev
Published: 2020-04-08 09:31:08

---
title: Why testing-library fails to do what it set out to do
published: true
description: A rent about how testing-library alone is not enough to test from the perspective of a user
tags: react, javascript, discuss, webdev
---

The problem that `testing-library` aims to solve is that when we write tests for our components, we rely upon the implementation details of said component, which in turn make our tests fragile, and not refactor proof. This goal is an admirable one and something which could help every developer to ship reliable and maintainable code.

The problem with this is not a conceptual one, but an execution one.

I was testing a custom input component because I found a bug. In a specific situation, the user could not type in it. Yes, it was a bug I introduced but thought before fixing it, I'll write tests to cover this. TDD, right? It turns out you cannot cover this scenario with `react-testing-library` and `jest`, because how it only partially implements a DOM.

What I needed was to test if, in the given situation, the user focuses the input and starts typing, the value of the input changes accordingly. The test has failed as it should have. So I began fixing the issue. It was quick and easy and could confirm the fix in my browser. When I went back to check up on my tests, they still failed.

My test consisted of using `keyDown` events to emulate typing. Because this is the user does, right? Well, it turns out that according to `testing-library`, the user is not pressing buttons, but fires `change` events! AS we all do when we do a Google search. We hit it up, and fire `change` event left and right and boom, here comes the search result.

My issue with this concept is that there are cases when firing a change event works, but pressing keys does not. And I could not find a solution for this since.

This issue is similar to not being able to query `innerText` because you'd need a layout engine for that. As if the user would be using your components without one. But worry not, there is `data-test-id`. Which is a way of saying, do not test implementation details, but implement details to test the thing.

I think while the concept is excellent, the tools are not in place to deliver yet. You still need `puppeteer`, `playwright` or `selenium` to get into the shoes of your end-user. If you know of any ways to run my existing `testing-library` specs in a browser a way that allows for querying elements by input text, like an `xPath` selector or something, and has a complete chain of events, please let me know.

Thank you, rant over
Use SimpleSQL from Github pages
Tags: simplesql, api, javascript, webdev
Published: 2020-04-08 08:50:47

[SimpleSQL](https://simplesql.redbeardlab.com/) is an HTTP API that allow complete control over a SQLite database.

Underneath [SimpleSQL](https://simplesql.redbeardlab.com/) is based on [RediSQL](https://redisql.com/) to manage all the different databases, connections, backups, replication, etc.

One of the most compelling use case is to [SimpleSQL](https://simplesql.redbeardlab.com/) to create completely static webpages that can operate against one database. This would allow to create very powerful webapp that don’t need a server backend. All the interaction with the backend can happen directly on the client code.

A common way to host a simple web app, is to use [Github pages](https://pages.github.com/), which offer a free space for open source projects.

In order to use [SimpleSQL](https://simplesql.redbeardlab.com/) you need to allow the browser to make CORS requests against `simplesql.redbeardlab.com`. Doing so allow the browser to make HTTP requests against the `simplesql.redbeardlab.com` domain.

Fortunately github pages already allow it, so no step is necessary for the CORS.

[SimpleSQL](https://simplesql.redbeardlab.com/) provide also a [JS SDK](https://github.com/RedBeardLab/SimpleSQLSDK/), which makes writing application simpler.

In order to use [the SDK](https://github.com/RedBeardLab/SimpleSQLSDK/) is sufficient to import it adding the following line in the head section of your html pages.

```html
<script type="text/javascript" src="https://unpkg.com/@redbeardlab/simplesql@>=1.0.8"></script>
```

Once imported the SDK it will be possible to invoke all the SimpleSQL functions, like: `SimpleSQL.newDatabase()` to create a new database, or `SimpleSQL.command(db, "select 1;")` to execute a command against one database, all this from client code.

An example, hosted on Github pages, is [available here](https://redisql.redbeardlab.com/SimpleSQLSDK/) with the [source being here](https://github.com/RedBeardLab/SimpleSQLSDK/blob/master/index.html).

[The documentation for the SDK is on github.](https://github.com/RedBeardLab/SimpleSQLSDK/)

[While the raw HTTP API are documented on swagger.](https://app.swaggerhub.com/apis-docs/redbeardlab/simplesql.redbeardlab.com/)
💻🚀 Tech bites: What is the cloud?
Tags: cloud, beginners, codenewbie, technology
Published: 2020-04-08 09:17:23

---
title: 💻🚀 Tech bites: What is the cloud?
published: true
description: Everything is "on the cloud" these days. But what exactly is the cloud, anyway? Find out with this infographic.
tags: cloud, beginners, codenewbie, technology
series: Tech bites
---

These days everything is _on the cloud_ - but what is this so called "cloud"? This infographic aims to help you all learn more about how the cloud works and what it is.

![cloud 101](https://res.cloudinary.com/nezahualcoyotl/image/upload/v1586337294/cloud_101_i1o1qs.png)

You can find the pdf version [here](https://github.com/trallard/tech-bites/blob/master/EN/cloud-computing/what_is_the_cloud.pdf) which is released under CC-BY.


✨ This post is part of a series of visuals I will be working on over the next few months so I will be adding al the visuals to this GitHub repository {% github trallard/tech-bites %}
Twilio Hackathon office hours on Twitch with Phil and Dom
Tags: twilio, twiliohackathon
Published: 2020-04-08 08:53:05

---
title: Twilio Hackathon office hours on Twitch with Phil and Dom
published: true
description: 
tags: twilio, twiliohackathon
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/9m69asb1yit2e3ks2t8t.png
---

_Office hours on Twitch are over for now. Check out [the help thread](https://dev.to/thepracticaldev/twilio-hackathon-help-thread-1jno) for asynchronous help or for access to the hackathon DEV Connect group channel. We'll be back on Twitch again, so follow [Twilio on Twitch](https://www.twitch.tv/twilio) to get notifications for that._

How is your [#twiliohackathon](https://dev.to/t/twiliohackathon) project going? At Twilio, we hope that you're full of ideas and that the code is flowing. But it's not always that easy...

Don't worry, we're here to help. There is, of course, the [Big Twilio Hackathon Help Thread](https://dev.to/thepracticaldev/twilio-hackathon-help-thread-1jno) for all your asynchronous questions. For more live support you can get an invite to the DEV connect channel.

If you want something a bit more interactive then text support then you can join us on Twitch. We'll be chatting hackathons, answering your questions, bouncing around ideas and checking out some of the projects people are working on. **Hackathon office hours will be hosted by [Dominik](https://dev.to/dkundel) and [myself](https://dev.to/philnash) and will be hosted on the [Twilio Twitch channel](https://www.twitch.tv/twilio)** at:

19:00 EDT Wednesday 8th April 
16:00 PDT Wednesday 8th April
09:00 AEST Thursday 9th April

(They're all the same time, I'm just a day ahead in Australia!)

We'll see you on Twitch right here: https://www.twitch.tv/twilio
Getting ready for a Golang Interview?
Tags: go, interview
Published: 2020-04-08 08:38:13

Wanting to get hired or make your next move within the Golang market place. Here are a few hints, tips and questions to help you out in your next interview. 

So, let’s start.

**General questions**

- What is the difference between TCP and UDP? In which case is UDP preferred?
- Is it possible to kill a thread inside a specific process with the kill command?
- How can I sort a file by 100GB, in which the numbers are arranged in random order, by 1 number per line? Limitations — the amount of RAM on the machine is 1GB.
- What is your favorite technology (can it be a database, a queue server, a library — anything)? And why?
- What decisions would you make as a technical director at your current / past job?

**Questions about microservices**

- What do you think are microservices?
- What advantages do you see in microservice architecture in comparison with monolith? And what are the disadvantages?
- What difficulties have you encountered in building a microservice architecture?
- What have you used (or heard about) to trace services? For monitoring? And for logging?
- How to deal with the consistency of data between several microservices?

**Questions about infrastructure and deployment**

- What is blue-green deployment?
- What was the process of deployment in your current (or previous) place of work? - What disadvantages do you see in this approach?
- What tasks the container orchestration systems solve?

**Questions about caching and databases**

- What problems in data caching did you encounter?
- How would you solve a problem when at the same time many clients do not receive data from the cache, and all of them go to the master data source at the same time (for example, to the database)?
- What are the pros and cons of relational DBMS in comparison with NoSQL solutions? In which case would you prefer to choose NoSQL? What NoSQL solutions did you work with? And what difficulties did you encounter while working with these solutions?

**Golang questions**
- What is the string data type in the Golang language? Can I change a specific character in a string? What happens when concatenating strings?
- What will happen when a concurrect map write occurs? How can this problem be solved?
- Should I lock a structure with a mutex if there is a concurrent write in a different fields of the struct?

Hope this helps and for those looking within the Golang space make sure you check out [Golang Works](https://www.works-hub.com/hire-golang-developers) for some of the latest roles across the globe.

Original content by [VictorNerd](https://medium.com/@victor_nerd)
How I can enable s3 caching on an existing aws codebuild project?
Tags: help, aws, codepipeline, codebuild
Published: 2020-04-08 08:29:00

I have made a CI/CD pipeline using amazon aws codepipeline, aws codebuild and github for a laravel rest api project. Now what I want to achieve is to cache the composer dependencies in a common bucket therefore any other project could use the same dependencies without need to download them all over again.

So can you help me with that look bellow for more info regarding my issue:
https://devops.stackexchange.com/q/11271/4396
#PureCSS - Responsive Mo Salah Poster
Tags: codepen, purecss, css
Published: 2020-04-08 08:24:10

---
title: #PureCSS - Responsive Mo Salah Poster
published: true
tags: codepen, purecss, css
---

<p>Responsive Mo Salah Poster using CSS</p>

{% codepen https://codepen.io/AsyrafHussin/pen/QWjLqqx %}
Dev Humor in a Pandemic
Tags: jokes
Published: 2020-04-08 07:53:05

During a conversation in Slack
![Marcin said "ACK", then Egbert said SYN, then Marcin said "Shit, no handshakes"](https://dev-to-uploads.s3.amazonaws.com/i/3a8bwi154km3wgeotu7b.png)
Announcing the Docker Compose Specification
Tags: docker, devops, microservices
Published: 2020-04-08 07:36:20

Docker [announced](https://www.docker.com/blog/announcing-the-compose-specification/) that they have open-sourced the Docker Compose specification. 

Here is the new Docker Compose spec - https://www.compose-spec.io/

Great news for enabling a great standard, Compose in direction of Cloud Native tooling
Cypress Tutorial for Beginners: LIVE Project #1
Tags: testing, cypress, javascript, beginners
Published: 2020-04-08 07:34:45

In this video of Cypress Tutorial for beginners, We are going create full end to end cypress test cases for the demo Katalon app from start to finish.

Cypress is a JavaScript test automation solution for web applications.

It enables teams to create web test automation scripts.

This solution aims to enable frontend developers and test automation engineers to write web tests in the de-facto web language that is JavaScript.

Cypress also supports the Mocha test framework so the core technologies in which you would develop your web test automation are Java Script on top of Mocha.

It is a test automation tool that enables developers to automate web browser testing.
The Selenium WebDriver protocol enables sending commands in various development languages like Java, JavaScript, C#, Python, and others from the test environment (IDEs) to a selected desktop browser (Chrome, Firefox, Edge, Safari).

- App URL: [Demo App Used](https://katalon-demo-cura.herokuapp.com)
- Full Source Code: [Download Code](https://github.com/dailypoison/cypress-live-project1)

### Learn more at 👉👉 : [Cypress Tutorial for Beginners: With LIVE Project and CI/CD Jenkins, Docker Support.](http://cypresstutorial.com)
-----------------------------------------------------
- 👪 Join our Community - http://bit.ly/learntesting2019
- ✅ Automation Community - https://thetestingacademy.com
- 🐦Follow us on Twitter  - https://twitter.com/itstechmode
- 📖 Like us on Facebook - https://www.facebook.com/scrolltest
- 🎤 Listen to our Podcast - https://anchor.fm/thetestingacademy
------------------------------------------------------

Over to you...

--
Be sure to subscribe for more videos like this!

[![ TheTestingAcademy](https://dev-to-uploads.s3.amazonaws.com/i/r7vcy6wbvyjbk1y1uu0o.png
)](https://www.youtube.com/TheTestingAcademy?sub_confirmation=1 "TheTestingAcademy")
How to use monospace fonts in Safari console
Tags: safari, javascript
Published: 2020-04-08 07:06:42

---
title: How to use monospace fonts in Safari console
published: true
description: 
tags: safari, javascript
---

The default font on error console of Safari 9 is not monospace. 

I really don't like this.

![safari error console](https://qiita-image-store.s3.amazonaws.com/0/18973/abb62059-271b-3a89-361c-9a290a0de84e.png)

I would like to change it, but it seems that error console does not have any preference, so to change it, I had to edit css settings manually. 

The path of the file to edit is `/System/Library/StagedFrameworks/Safari/WebInspectorUI.framework/Versions/Current/Resources/Main.css`.

Looking into the file, we can find these lines at somewhere.

```css
.console-messages {
    display: flex;
    flex-direction: column;
    word-wrap: break-word;
    font-family: -webkit-system-font, sans-serif;
    font-size: 12px;
    min-height: 100%;
    outline: none
}
```
Change a little bit on font attributes like below.

```css
.console-messages {
    ...

    font-family: Menlo, monospace;
    font-size: 10px;
}
```

Now we got a monospace font!

![monospace font safari](https://qiita-image-store.s3.amazonaws.com/0/18973/6092ae29-2803-7f0a-45ae-420355a1e60f.png)

Related: http://stackoverflow.com/questions/27912919/how-do-i-change-the-web-inspector-font-for-safari-8
What's the etiquette on posting to both Stack Overflow and dev.to?
Tags: etiquette
Published: 2020-04-08 07:05:07

I'm fairly new to dev.to. 

I love the features and UX of Stack Exchange, but have found it quite frustrating when asking questions about software architecture and design philosophies on softwareengineering.stackexchange.com not being well received. 

So where dev.to has looser 'what's on topic' requirements I'm figuring I can post here. 

Now the thing is - I've recently asked a [pretty technically specific question](https://dev.to/dwjohnston/what-s-going-on-with-index-types-in-typescript-1dln) that would probably be well received on Stack Overflow -but is that considered bad form, either here or there?
How to use bash "autocd" option in Mac 
Tags: bash, mac
Published: 2020-04-08 06:57:18

---
title: How to use bash "autocd" option in Mac 
published: true
description:
tags: bash, mac
---

Run this command to check the version of Bash installed in your Mac.  

```bash
$ /bin/bash --version  
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)    
Copyright (C) 2007 Free Software Foundation, Inc.  
```  
If it is not 4.0 and more, you should install the newer one with homebrew  

```bash
$ brew update
$ brew install bash
```
Make sure where the new Bash has been installed into and if it has been updated or not. Finally, use `echo` and write the path of it into `/etc/shells`

```bash
$ which bash
...
$ /usr/local/bin/bash --version
...
$ echo /usr/local/bin/bash | sudo tee -a /etc/shells
...

```
Last but not the last, use `chsh` command to change the current shell, and check the result of `shopt -p` sure has `autocd`

```bash
$ chsh -s /usr/local/bin/bash
...
$ shopt -p
...
```