teleren/devto huggingface dataset:
Job Search Week 13
Tags: makers
Published: 2020-05-18 20:19:34

This week I was working on my message board app using mocha and chai. I also did a bit of work on an e-commerce app. I really enjoy building an API and I'm looking forward to getting stuck into mongo.

Day 1

I started the week by making a get function for my app. This function will return all the messages in the API. I also made an update and delete function, these were quite similar because they both collected the data and used it in some way changing it for update and removing it for delete.

Day 2

On Tuesday I did some refactoring mainly. I had to set the ids because I was finding the ids by their position in the array which caused problems when an item was deleted from that array. So I changed it to use the id of the last item in the array and add one.

Day 3

Wednesday I added a son file and changed my code to write to it so I could use it as a temporary database. I also solved some edge cases like deleting messages that aren't present or trying to make invalid updates.

Day 4

I spent Tuesday organising some files, writing my first express test and made the contents of the json file load on the home page. It was nice to see it coming together but I'll have to add Mongo later.

Day 5

On Friday I did more refactoring and also I made the post function for adding a message to the json file and created a route for it. I also spent some time setting up circle CI for my e-commerce project.

Summary

Overall I fell like I got a good amount done this week. Next week I will hopefully do some work on e-commerce project and maybe get the API set up for that.
No meio do caminho tinha uma pandemia
Tags: html, css, javascript, jquery
Published: 2020-05-18 19:54:55

  Passei na Reprograma e conseguimos ao menos fazer a primeira semana do curso presencial na estação Hack do Facebook mesmo e a primeira semana foi em UX o que eu achei ótimo de não terem começado mesmo em código e meio que “assustar” logo de cara. Na semana mesmo recebemos a notícia que que um funcionário da estação Hack foi infectado com a Covid-19 e então teríamos que não ter mais aulas no prédio e logo depois começou o isolamento na cidade de São Paulo para poder achatar a curva de infecção da Covid-19 e não sobrecarregar o sistema público de saúde. 
  Na semana seguinte tínhamos que enfrentar o desafio de aprender HTML e CSS, deixar qualquer preconceito com aulas online de lado e nos apegar com o que tínhamos de continuar o curso. Um misto de lidar com todas as dificuldades que têm uma aula online em questões de infraestrutura no caso de ter um computador minimamente bom, uma internet que aguente horas de transmissão online e um local decente de sentar e conseguir aprender e assimilar as coisas. Tenho que mencionar aqui o apoio fundamental e sensacional que a Reprograma tem tido com a nossa sala, um apoio tão importante e tão humano, eu sei o mínimo que elas têm feito e mesmo assim tenho um coração tão agradecido de pertencer e poder fazer parte disso tudo e não sentir que estamos tocando as aulas meio que linha de produção porque tem que formar turma e sim que estamos sendo acolhidas por ela no que elas conseguem minimamente fazer nisso tudo o que está acontecendo.
  Hoje já completamos um pouco mais da metade do curso e vejo uma sala que mesmo com algumas diferenças sejam sociais ou ideológicas é uma sala muito unida em fazer com que todas cheguem até o final, imaginem nós mulheres que largamos tudo para embarcar nessa loucura de aprender sobre uma área nova e entrar no mercado e não estamos sabendo até quando o isolamento irá durar e se teremos no fim um emprego, conseguem ? Nós não sabemos mesmo o que irá acontecer depois do curso acabar, mas estamos ainda lutando para aprender Javascript, Bootstrsp, JQuery e outras coisas mais e ainda conseguir construir nossos projetos e depois “brigar” com o git e github para ter um portfólio (entendedores entenderão!).
Testing DataTables JSON response in Laravel without using Dusk
Tags: laravel, datatables, service, json
Published: 2020-05-18 19:48:28

Recently, I needed to quickly test Datatables-as-a-service implementation but I didn't want to use Laravel Dusk for just one test. An easy workaround is to check that the JSON response contains the data that you're looking for. But because this is encoded I ran into a caveat with the random test data.

For example, I was filtering the datatable so that administrator users can see all the entries, but normal users can only see their own entries. We expect the JSON response to only have the data related to the specific user viewing the results.

## Test That Users Can Only See Their Entries
```php
public function testUserCanOnlySeeTheirEntries() {
    $user = factory('App\User')->create();
    // Create one that belongs to me
    $user_entry = factory('App\Entry')->create(['user_id' => $user->id]);
    // Create one that is random
    $other = factory('App\Entry')->create();

    $this->actingAs($user)
       ->getJson(route('entries.index'), ['HTTP_X-Requested-With' => 'XMLHttpRequest'])
       // See the users' results as expected
       ->assertJsonFragment(['end' => $user_entry->end->format('m/d/Y h:i A')])
       ->assertSeeText($user->name)
      // Don't see results that do not belong to me
       ->assertJsonMissing(['end' => $other->end->format('m/d/Y h:i A')])
       ->assertDontSeeText($other->user->name);
    }
```

This test worked great, until it didn't. If Faker happened to generate a user's name with special characters, like `Ellie O'Neil` the test would fail due to encoding. `Ellie O'Neil could not be found in string: Ellie O&#039;Neil`

Technically the application was working fine -- since this data will be passed to the browser for display it doesn't matter if it's encoded or not. But we want our CI pipelines to succeed no matter what the randomly generated data might be.

Quick fix for this is to use [htmlspecialchars](https://www.php.net/manual/en/function.htmlspecialchars.php) to encode the search string so that it will match the JSON results no matter what.

```php
// Change
->assertSeeText($user->name)
// to
->assertSeeText(htmlspecialchars($user->name, ENT_QUOTES))
```

Make sure to use the ENT_QUOTES flag so that apostraphes are encoded as well as everything else.
Introduction to the Series
Tags: javascript, javascript30, wesbos, webdev
Published: 2020-05-18 19:35:33

Before heading into the first blog post, allow me to share a little bit about my experience as a web developer and why I took the [**JavaScript30**](https://javascript30.com/) course. 

## Background
In 2014, I got my first contract as a WordPress developer. Two years later, I was working 70 hours a week as a freelance web developer while keeping a 25-hour-per-week part-time job. I couldn’t hang with the 95 hour weeks, so I quit the job and became a full-time freelance developer. For the next four years, I got by. I was just good enough to get contracts and make a little money from them. Early this year (2020), I landed a GREAT contract, the best one ever. Two months later, I _lost_ that contract because my JavaScript skills weren’t at the level needed by the client.

## Failure is a Strong Motivator
The loss of that contract made me question if I should even continue being a web developer. After a week or so, I decided to solve the problem. Over the following weeks, I leaned on my [**Coding Coach**](https://codingcoach.io) mentor **Robert Mion** to help me find a way forward that would help me fill in the gaps in my knowledge and skills. Along the way, I discovered **Wes Bos’** [**JavaScript30**](https://javascript30.com/) course and signed up for it. It was free and, what’s the worst that can happen -- I discover the course isn’t what I need and I find another one? 

As it turns out, the **JavaScript30** course was a perfect fit. What follows are a series of posts, one per lesson, where I share what the lesson was about and what I learned from it.

Turns out that I learned a lot more than just JavaScript. I’ll share those details as I write each blog post. 

## My Approach
Since I already have six years of experience as a web developer, I am approaching each lesson with a ‘let’s see if I can do this on my own first’ approach. In some cases, I was pretty close to Wes’ code. Other times, I couldn’t have been more lost if I had wandered into a strange land without a compass, precisely my experience with the first lesson. 

So, let’s dive into the **Javascript30 Drum Kit** lesson and find out how I got lost so fast!
Python Zero to Hero - Ep.7 - Unit testing with Pytest
Tags: python, beginners, tutorial, testing
Published: 2020-05-18 19:24:17

---
title: Python Zero to Hero - Ep.7 - Unit testing with Pytest
published: true
description: Testing is very important in software development. Unit testing is the smallest building block of your tests. It locks a unit of your code in place so making debugging much easier. Today we will use Pytest, a popular testing library in Python, to do some unit testing. We only cover the basics today and if you are interested to learn more about testing using pytest or other libraries, please leave your comment at my Twitch channel
tags: python, beginner, tutorial, testing
---

Update: the reason why I cannot install pytest in my environment is that I have installed conda yesterday and it messed up the path. Somehow conda overrides the pyenv paths so they cannot exist together. You can either keep it and use `python -m pytest` every time instead of `pytest` or, like me, remove conda so it works again.

Testing is very important in software development. Unit testing is the smallest building block of your tests. It locks a unit of your code in place so making debugging much easier. Today we will use Pytest, a popular testing library in Python, to do some unit testing. We only cover the basics today and if you are interested to learn more about testing using pytest or other libraries, please leave your comment at my [Twitch channel](https://t.co/7sqvTilzF1?amp=1)

You can get the slide deck [here](https://slides.com/cheukting_ho/python-pytest/) and the example code and homework form [GitHub here](https://github.com/Cheukting/python02hero). Ask questions at my [Twitch channel](https://t.co/7sqvTilzF1?amp=1)

Also, check out Naomi Ceder's [Twitch channel](https://t.co/hXhTu0ZIG8?amp=1) for more beginner's (slightly more advance) tutorial.
My Macbook & my productivity
Tags: productivity
Published: 2020-05-18 19:12:34


I've been struggling with my productivity lately with my messed up desktop and unorganized folders, so I made some tweaks to it to help me overcome it and be more productive.

## Don't pay for what you don't use
I always kept my unused apps open for no reason. Terminal tabs running my side projects which I work on my weekends. So, they are basically the apps dedicated to waste my Laptop's memory. It also gave me a feeling that I'm not focussing on one thing at a time so these are the rules that I follow. The following will be the list of apps I use and the rules I enforced on them.

### Google Chrome
I use Chrome for communication, Development, and of course to search Stack Overflow. 

Let's first sort out the communication, 

 1. **Slack** - I don't have a dedicated slack app (why should I if I can pin a tab) and I also asked Slack to notify me only when someone mentions me to I avoid unwanted annoying Slack notification sound (at least for me). This is my first pinned tab in Chrome.
 2. **Gmail** - Pinned as my second tab with no additional settings. I get a web notification when I receive an e-mail, I reply/interact with the ones which need immediate attention (Mostly emails from Sentry/Rollbar :p)

These are the static tabs that stay on whenever Google Chrome is open. If I have a web server running, it hangs as the third one. I'm trying to follow the **1 Tab Policy** (more or like 1 Additional Tab policy in my case). Whenever the tab has fulfilled its purpose, I close it immediately.

### VS Code & iTerm
I follow the same principles as Chrome here. To be honest, it's the basic principle of this whole post. **Close anything that has served its purpose**. I also minimize the sidebar and will always use shortcuts whenever possible.

These may differ from each other and might look simple, but these changes increased my productivity to a great extent. Now I have what I do at that moment.

I'd be happy to listen to some of your suggestions as well. :D
Elixir + RTMP
Tags: elixir, rtmp, membrane
Published: 2020-05-18 17:41:41

Elixir is a widely used language for real time systems. For example, [Discord uses Elixir](https://blog.discord.com/scaling-elixir-f9b8e1e7c29b). However, there is a point that should not be confused. The current topic is RTMP (Real-Time Messaging Protocol) and I will try to explain streaming video and audio with Elixir in this topic.

Why Elixir?
-
Elixir is a young, dynamic language based on flexibility. Therefore, it is used and preferred in real time systems. So it would be good to choose Elixir for RTMP as well.

I have a framework related to streaming: [Membrane Framework](https://www.membraneframework.org/) As they say, Membrane is an easy to use abstraction layer for assembling mostly server-side applications which consume, produce or process multimedia streams. It is written in Elixir + C with Erlang VM underneath that gives us a rock solid and battle-tested foundation. It is also the first multimedia framework that puts as priority reliability and concurrency. It does not mean that we don’t care about performance, low latency or efficient memory use, but if we have to make a tradeoff, it is going to be made in favor of reliability and scalability.

"Good fortune is what happens when opportunity meets with planning."
- Thomas Edison

You can follow me on [LinkedIn](https://www.linkedin.com/in/fsuaterdogan/)
Converting opacity from percentage to hexadecimal in cli
Tags: npm
Published: 2020-05-18 18:41:29


I have been working on my own color theme for the past couple of weeks. As I have been working with colors a lot I realized that I was checking this really useful [Hexadecimal color code for transparency](https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4) gist multiple times per coding session to check what is e.g. 30% opacity in hex _(btw it's 4D, I got it memorized!)_.

Always checking the gist became tiring and over the weekend, I created this nifty npm package to quickly convert any opacity value into hex directly from my cli.

You can install it with 

```bash
npm install -g @mskri/hex-opacity
```

Once installed you can then run following command in your cli to get the percentage value in hexadecimal

```bash
hex-opacity <opacity value>
```

For example converting 30% opacity to hexadecimal would be

```bash
$ hex-opacity 30
4D
```

Check out the package at https://www.npmjs.com/package/@mskri/hex-opacity
Deno in Docker on Google Cloud Run
Tags: deno, docker, gcp, cloudrun
Published: 2020-05-18 18:19:50

This weekend I read a lot about [Deno](https://deno.land), "_A secure runtime for JavaScript and TypeScript_." It's built on V8 and Rust, by Ryan Dahl, the creator of Node.js and it would basically ['fix' many things that are 'wrong' about Node.js and would be a "fun and productive scripting environment"](https://deno.land/v1).

It intrigued me, so I took a first look 😊

## Playing around

After some [playing](https://deno.land/manual) and reading ([this is an amazing source!](https://www.freecodecamp.org/news/the-deno-handbook/)) I figured it would be nice to have an easy starting point for a Deno project running inside Docker and also on Google Cloud Run.

## Deno in Docker (on Cloud Run)

I wanted to make a concrete example of Deno, running on Cloud Run. So I build just that. A "Hello world" of Deno, with a Dockerfile (that pre fetches all dependencies) to easily run it anywhere + deployment to Cloud Run.

You can see the result here: [https://github.com/rogiervandenberg/deno-docker-cloudrun](https://github.com/rogiervandenberg/deno-docker-cloudrun) Of course with an easy single click deployment button 🎉
Install Terminus Plugins In Lando
Published: 2020-05-18 18:12:37

---
title: Install Terminus Plugins In Lando
published: true
description: Use this tried and true method to install Pantheon Terminus plugins on your Lando developer environment.
tags: 
---

## Background

When you use Lando with Pantheon, and you want to install a Terminus plugin to your Lando local development environment, you'll want to go with something like the following.

### Do it

```
services:
  appserver:
    build:
      - /bin/sh -c "[ -d /var/www/.terminus/plugins ] || mkdir -p /var/www/.terminus/plugins"
      - /bin/sh -c "[ -d /var/www/.terminus/plugins/terminus-secrets-plugin ] || composer create-project -d /var/www/.terminus/plugins pantheon-systems/terminus-secrets-plugin:~1"
```

### Why this way?

This avoids an error:

```
Creating a "pantheon-systems/terminus-secrets-plugin:~1" project at "./terminus-build-tools-plugin"

                                                                                            
  [InvalidArgumentException]                                                                
  Project directory "/var/www/.terminus/plugins/terminus-secrets-plugin" is not empty.
```

The problem is that it is trying to override already existing directory and files.
One Minute NiFi Tip:   Calcite SQL Notes
Tags: 2020, apachenifi
Published: 2020-05-20 14:28:33

---
title: One Minute NiFi Tip:   Calcite SQL Notes
published: true
date: 2020-05-18 18:00:00 UTC
tags: 2020,apache nifi
canonical_url: 
---

 **NiFi Quick Tip on SQL**

  

  

You sometimes have to cast, as fields aren't what you think they are.   I have some temperatures that are stored as string, yeah I know let's yell at who did that.   Maybe it was some lazy developer (Me?~??~?~?!!!).    Let's just cast to a type that makes sense for math and comparisons.    **CAST** is my friend.

> SELECT \* 
> 
> FROM FLOWFILE
> 
> WHERE CAST(temperaturef as FLOAT) > 60

  

  

Apache NiFi (and lots of other awesome projects) use Apache Calcite for queries.   So if you need some SQL help, always look here:   [https://calcite.apache.org/docs/reference.html](https://calcite.apache.org/docs/reference.html)

  

You can also include variables in your **QueryRecord** queries.

  

> SELECT \* 
> 
> FROM FLOWFILE
> 
> WHERE CAST(temperaturef as FLOAT) >= (CAST(${predictedTemperature} as FLOAT) - 5)

  

  

There are wildcard characters that you may need to watch.
  

Underscore has special meaning.  Also there often column names that are reserved words.   I got a lot of columns coming from IoT often with names like timestamp, start, end and other ones used by SQL.   Just put a `start` around it.

  

Watch those wildcards.

  


select \* from flowfile where internal = false
                    and name not like '@\_@\_%' ESCAPE '@'
Getting remote xorg to display to local machine
Tags: tutorial, linux, beginners
Published: 2020-05-18 17:58:10

---
title: "Getting remote xorg to display to local machine"
published: true
description: A basic tutorial on getting X Forwarding working
tags: tutorial, linux, beginner
---

I was talking to some coworkers recently. Working at IBM I have access to a cloud that allows me to use it for remote workloads. We started talking about getting [xorg][Xorg] working on our remote machine and connect via X to my local laptop.

These are my notes to getting this working with a CentOS remote machine with a Ubuntu laptop.
Though any machine running xorg, and any machine that can take these configurations should work.

1) Spin up a remote machine with CentOS installed, I have tested this with CentOS 7 server and Ubuntu 18.04 laptop.

2) Confirm you can SSH to your remote machine, if you remote in as `root` I suggest creating a user and giving them `sudo` access. I suggest reading [this link][sudo] if you have never set it up.

3) `SSH` as your user with the following command:
```bash
ssh -X username@your_remote_machine
```

3.1) Now you might see this error, if so you should fix it by the following:
```bash
$ ssh -X username@server
X11 forwarding request failed on channel 0
[username@server]$
```

You need to edit your `sshd` configuration:
```bash
[username@server]$ sudo vi /etc/ssh/sshd_config
# Note if you don't have sudo as your username ssh in as someone who can, or as root if you have access
```

Uncomment the following lines:
```
X11Forwarding yes
X11UseLocalhost no
```

And restart `sshd`:
```bash
[username@server]$ sudo service sshd reload
Redirecting to /bin/systemctl reload sshd.service
```

3.2) If you still see the error, make sure you have Xorg installed, if not run this command:
```bash
sudo yum groupinstall "X Window System"
```

4) Now if you don't have `xauth` installed you'll see this error:
```bash
ssh -X username@server
Last login: Tue Mar 12 11:27:17 2019 from localmachine
/usr/bin/xauth:  file /home/username/.Xauthority does not exist
```
Finally Go ahead and install `dbus-x11`, `xauth` and `xeyes` via this:
```bash
$ sudo yum install xauth xeyes dbus-x11
```

5) Go ahead and logout/exit from the machine after your setup, and `ssh` back in with the
following command and use `xeyes` to validate your set up. Run `Control-C` to close
`xeyes` (which is running on the remote machine but displayed locally).
```bash
ssh -X username@server
Last login: Tue Mar 12 12:09:32 2019 from localmachine
[username@server]$ xeyes
```

Congratulations! You now have a way to run remote X applications and display them
on your local machine. Go ahead install something like `firefox` or `chrome`
and go to <https://whatsmyip.org> and then open it on your local machine,
it should be radically different!


[sudo]: https://linuxize.com/post/create-a-sudo-user-on-centos/
[xorg]: https://www.x.org/wiki/
How do I learn Web Development
Tags: beginners, help
Published: 2020-05-18 17:35:57

---
title: How do I learn Web Development
published: true
description: I am a beginner to Dev world and just completed an online course, What should I focus on?
tags: #beginner #help
---
I just started learning web development a month ago, I started with an outdated course from 2015 , Web Dev Bootcamp by Colt Steele,
https://www.udemy.com/course/the-web-developer-bootcamp/ 
I knew it was outdated but proceeded anyways because I loved his teaching style.( I did learn c++ , Java a little, in high school with no real practical application) but that still helped me while learning javaScript concepts. 
Now I've completed the course and learned mongo , node , express, bootstrap and a few other concepts.
Difficulties I'm facing.
- The course is outdated, The concepts I learnt are pre-ES6.
- I haven't really got much practice.

So should I practice making applications with the concepts I've learnt or should I learn the newer concepts and syntax first.
What are the important concepts I should focus on?
Will these courses be a step in the right direction? 
https://www.udemy.com/course/the-advanced-web-developer-bootcamp/
https://www.udemy.com/course/javascript-beginners-complete-tutorial/
Are there any books/tutorials that would be helpful for me??
How do you find time for your side projects?
Tags: discuss
Published: 2020-05-18 17:33:10

It's common for a developer to have side-projects, whether it's a blog, an app to build, an open-source library to maintain, or a course to watch or read. Aside from a full-time job, it can be hard to dedicate time to them.

Often, I like to get up one hour early and work on it. I often find myself working on Saturday morning if I feel like it. What about you? What are your strategies, tips and tricks to manage your time for your side projects?