teleren/devto huggingface dataset:
All you need to know about TERMUX
Tags: security, linux, computerscience
Published: 2020-09-21 15:02:43

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

Hello guys, this blog post is about the famous application emulator of android "Termux". 

##**What is Termux?**

Termux is an android application which is an emulator and it is also a Linux environment app. There is no particular need of setting it up or rooting the phone, It works directly. The additional packages are available using APT package manager. Termux repositories are hosted by JFrog Bintray. 

##**What are the uses of Termux?**
There are many uses of termux, Some of them are:
* Data processing with Python.
* Programming in a development environment.
* Downloading and managing files and pages using time-established tools.
* Learning the basics of the Linux command line environment.
* Running an SSH client.
* Synchronizing and backing up your files. 

###**Some of the basic commands of Termux are:** 

**To Update**

```
apt update
```
###**To check whether app is properly installed, we use:** 
```
pkg install sl
sl
```
If the termux is properly installed, we will be seeing a moving train.

###**To see all the processes which are running in Termux, we use**
```
top
```
###**To display the text in a different style, we use**
```
apt install figlet
figlet word
```
###**To see matrix backgroud animation, we use**
```
apt install cmatrix
cmatrix + ENTER
```
Using termux we can also find the factors of numbers, To do that we need to install coreutils.
```
apt install coreutils
factor 2020
```

One of the commands that I personally like is w3m. It is used to open any url from this termux.
```
apt install w3m
w3m tdummies.blogspot.com
```

We can also install metasploit using termux. To do that we first need to install curl.

```
apt install curl
```
After installing curl, we need to transfer data.
```
curl -LO https://raw.githubusercontent.com/Hax4us/Metasploit_termux/master/metasploit.sh
```
To get the access permission.
```
chmod 777 metasploit.sh
```
Now,

```
./metasploit.sh
```
To learn more about different commands that can be used in linux terminal [click here](https://linuxjourney.com/)

In the above mentioned manner you can install any packages to your smart phone based on your need. To learn more about different packages available [you can read it here](https://github.com/termux/termux-packages)
Avoid the retry strategy to make your tests reliable
Tags: testing, architecture
Published: 2020-09-21 15:26:01

## What is a retry strategy?
Retry strategy is an approach you can implement into your test to run it again when it fails by any condition: assertion error or exception.

If a test fails the retry strategy will execute it again N times leading to the successful execution when one of the N executions got success or to will fail if all N executions have failed.

### What might cause a test exception?
* Network
* Concurrency
* Configuration
* Asynchronous Wait
* Dynamic UI content
* Test Order Dependency
* Poor Data Management
* [Add yours in the comment section]

## Why you must avoid the retry strategy?

### To get rid of the Non-Deterministic tests
Martin Fowler coined the term [Non-Determinism](https://martinfowler.com/articles/nonDeterminism.html) which is the tests that sometimes pass and sometimes fail. You can read his article to get some tips on how to deal with it and to learn why retry isn’t an option.

You might found many articles saying that you can apply a retry strategy to identify flaky tests. If you apply it your test might fail during the first run and pass in the second or following ones, so you have a Non-Determinism test using the retry strategy (but you shouldn’t use it)

### To properly investigate the root cause
I have seen many software engineers using retry strategies to reduce the amount of time they need to investigate the errors because they are saying that is hard to find the root cause for the network, waiting time, or test script issues.

Imagine that you are continuously running your tests, whatever are the levels you use, through a pipeline. You will trust in the end result and might now see the failures between the retries. So it extremely risky to rely on that.

We must properly investigate the root cause and provide a solution for the failures, otherwise, we will lose the confidence we have in the pipeline or any approach you are using to run the test.

## Name yours
I would like to hear from you why you think the retry strategy should or shouldn’t be in use.
Web Components using LIT-HTML and LIT-ELEMENT
Tags: help
Published: 2020-09-21 15:23:23

Have you used these two libraries?  They've been around for a while now and look good to me but I haven't yet dug into them.  Would you recommend them to be one of the best web component libraries going today? 

[Lit-Html](https://lit-html.polymer-project.org/)
[Lit-Elements](https://lit-element.polymer-project.org/)

The smartest way to use change detection:

>Unlike VDOM libraries, lit-html only ever updates the parts of templates that actually change - it doesn't re-render the entire view

**Other Similar Offerings**
- [HTMLJS](https://github.com/nhanfu/htmljs)
  ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/602ihitbgy30e1eyg1p0.png)
- [HTML5 Template](https://www.html5rocks.com/en/tutorials/webcomponents/template/) Inert until Activated!
Daily problem-solving challenge. 
Tags: 100daysofcode, challenge, codenewbie, beginners
Published: 2020-09-21 15:22:33

I'm starting a daily problem-solving challenge😅
Each week from Monday to Friday I'll solve one problem from Codewars, Leetcode, or Hackerrank. 

Mainly I'll use JavaScript but sometimes TypeScript, Python, Ruby, Dart, or Swift.

If you want to join me I post a coming problem on Instagram 
✅ https://www.instagram.com/short_dev_tips/ 
and the next day there will be the solutions.
Also will be available on Twitter 
✅ https://twitter.com/andrew_losseff

For the first week, there will be easy problems. And then we see how it's going, and hopefully, start on more complicated ones.

Would be great seeing you join the challenge!👍

If you have any ideas or suggestions, please let me know. I'm looking forward to hearing from you 🙏
Flatland Space Stations Explain - Solution | Javascript
Tags: hackerrank
Published: 2020-09-21 15:15:23

```javascript

function flatlandSpaceStations(n, c) {
  const distance = [];
  for (let i =0; i < n; i++) {
    let temp = [];
    for (let j =0; j < c.length; j ++) {
      temp.push(Math.abs(c[j] - i));
    }
    distance.push(Math.min(...temp));
  }
  return Math.max(...distance);
}

flatlandSpaceStations(5, [0, 4]);
```

[Problem](https://www.hackerrank.com/challenges/flatland-space-stations/problem?h_r=next-challenge&h_v=zen)
Would you recommend a dentist to switch to software development?
Tags: discuss, career
Published: 2020-09-21 15:08:16

A close friend of mine said how difficult being a dentist during Corona is:
- no home office
- equipment (in particular masks) are lacking during pandemic, thus higher risks of being infected
- if being ill, it's not possible to just stay at home because the dental surgery would make less money
- payment is less than some software engineering jobs
- no flexible working hours

The friend sees how privileged I am as a software developer and is considering switching to software development. 

Would you recommend that?
Closures in JavaScript
Published: 2020-09-21 15:04:48

 Closures in JavaScript are one of most important and interesting concept.However if you don't understand them you may find them not interesting.
 In this article, i will try to make closures more interesting for you.
Before going into the world of closures, let's first understand lexical scoping.  Let's take a closer look:
![code1](https://dev-to-uploads.s3.amazonaws.com/i/ebb59rhr4r2w56gfbtmp.png)
From the output above, the inner function can access the outer function's variable. This is lexical scoping, where the scope and value of a variable is determined by where it is defined/created.

## So what is a closure? ##

A closure is created when an inner function has access to its outer function variables and arguments. The inner function has access to – 
1. Its own variables.
2. Outer function's variables and arguments.
3. Global variables.

Closure is when a function is able to access its lexical scope, even when that function is executing outside its lexical scope or, Inner functions can access its parent scope, even after the parent function is already executed. For example:
![code2](https://dev-to-uploads.s3.amazonaws.com/i/xvgvbcqi77zghfwzhl27.png)
Here we are returning the inner function and executing it later.  In some programming languages, the local variable exists during the function’s execution. But once the function is executed, those local variables don’t exist and they will not be accessible. 
Here, however, the scene is different. After the parent function is executed, the inner function (returned function) can still access the parent function's variables. Yes, you guessed right. Closures are the reason. 
The inner function preserves its lexical scope when the parent function is executing and hence, later that inner function can access those variables.

## More examples of closures. ##

![code3](https://dev-to-uploads.s3.amazonaws.com/i/nq4139cos6ptvdya5cz2.png)
Every time you call countValue, the count variable value is incremented by 1. Wait – did you think that the value of count is 0? 
Well, that would be wrong as a closure doesn’t work with a value. It stores the reference of the variable. That’s why, when we update the value, it reflects in the second or third call and so on as the closure stores the reference. 
 Let’s look at another example:
![code4](https://dev-to-uploads.s3.amazonaws.com/i/2q0zm9y7xtlqbklo03pe.png)
This happens because countValue1 and countValue2, both preserve their own lexical scope. They have independent lexical environments.

That’s it! I hope you can now say that you find closures interesting.
Caching and fetching data in PWA
Tags: 100daysofcode, javascript
Published: 2020-09-21 14:43:41

I am back with a working service worker. The article covers caching data and fetching cached data in a Progressive Web App, which were today's lessons.

To cache data you have to declare two variables, one holds the cache name and the other holds the data/files to be cached (should be an array of files). 
```javascript
const cacheName = 'cache-v1';
const cacheResources = [
  'index.js',
  'style.css',
]
```
Caching resources/data:
```javascript
self.addEventListener("install", event => {
  console.log('Service Worker install event');
  event.waitUntil(
    caches.open(cacheName)
    .then(cache => {
      console.log("Service Worker: Caching files");
      return cache.addAll(cacheResources );
    })
    .catch(err => console.log(err))
  );m
});
```
Code Explained:
Self points to the global scope which in this case is the service worker. You attach an event listener which listens for the install event, opens: `.open()` cache storage with the declared cache name and adds all the files `addAll()`.

Fetching data:
```javascript
self.addEventListener("fetch", event => {
  console.log('Sw: fetching');
  event.respondWith(caches.match(event.request)
  .then(cachedResponse => {
    return cachedResponse || fetch(event.request)
  }))
})
```
Code Explained:
To fetch data you'll listen for the fetch event and check if the requested data matches the cached data: `caches.match()`. If the data matches send back the data if not make a network request. This should be within `respondWith()` function which prevents the default browsers fetch handling.

_That's it for Day 67_
_Let's do this again tomorrow_
AzureFunBytes Short - Create a @Azure Linux Virtual Machine
Tags: azure, tutorial, linux, beginners
Published: 2020-09-21 14:41:30

AzureFunBytes! - Byte-sized content with a live Twitch show! Learn about

Today we'll look at how to create a Linux VM using Microsoft Azure!

{% youtube -IfKjp-mlrE %}

Azure fundamentals with me!


Live stream is available on Twitch at 2 pm EDT Thursday. You can also find the recordings there as well.

https://twitch.tv/azurefunbytes
https://twitter.com/azurefunbytes

Join me, ask questions, and learn about Azure!

Microsoft Learn: Azure Fundamentals - https://cda.ms/1nx
What is IaaS? https://cda.ms/1Df
Linux virtual machines in Azure - https://cda.ms/1G3
Microsoft Learn: Create a Linux virtual machine in Azure -  https://cda.ms/1ny
Microsoft Azure: $200 Free Credit - https://aka.ms/funbyte04
Lisa's Workbook Explain - Solution | Javascript
Tags: hackerrank
Published: 2020-09-21 14:24:56

```javascript
function workbook(n, k, arr) {
  let special = 0;
  let page = 1;
  for (let i = 0; i < n; i ++) {
    const problems = arr[i];
    let temp = 1;
    const up = Math.ceil(problems / k);
    while (temp <= up) {
      const start = temp === 1 ? 1 : (k * (temp -1)) + 1;
      console.log(start, up);
      const end = temp === up ? problems : temp * k;
      if ( page >= start && page <= end) {
        special++;
      }
      page ++;
      temp++;
    } 
  }
  return special
}

workbook(10, 5, [3, 8, 15, 11, 14, 1, 9, 2, 24, 31])

```

[Problem](https://www.hackerrank.com/challenges/lisa-workbook/problem)
Internet Privacy
Tags: privacy
Published: 2020-09-21 14:24:52

After watching "The Social Dilemma" on Netflix, I'm now keenly interested in Internet Privacy, and, more broadly, the ways in which private organizations follow us across websites and collect our data.

Does anyone have any recommendations on ways to prevent private organizations from following you around? 

I currently use the Firefox web browser and Ghosterly. Sometimes, I use Tor. 

Also, could someone suggest resources to learn more about internet privacy?
Which CSS Framework Should You Learn?
Tags: bootstrap, webdev, productivity, framework
Published: 2020-09-21 14:23:22

As a web developer, you may have mixed feelings about CSS and design. You may love it. You may hate it. You might be afraid of it.
Regardless of those feelings, one thing you can't do is ignore it.

Every project requires design and CSS. The poorer your design, the less likely users are to use, the less likely buyers are to buy, and the less likely bosses are to ……reward.

If like me, you fall into the camps of either hating or fearing design and CSS, then you have extra work to do. Eventually, you have to do some design and CSS whether it's a small personal project or when the CSS expert on the team is just too busy to get to it.

So the question is, which CSS framework should you learn? I recently tweeted a poll and got some pretty interesting results.

I chose 3 frameworks specifically because of their position as being popular in use, and also seeming to be popular with current/new projects. Those were Bootstrap, Foundation, and Tailwind CSS. I also included an "other" option to see if I was missing something. Based on the results and replies, I didn't.

Here are the results:

![image](https://cdn-images-1.medium.com/max/800/0*VUkId13eZdC0avOC?)

**My Assessment**

So why did Bootstrap & Tailwind come up as the winners, and everything else falls way behind?

Simple:

1) **Bootstrap** is the most popular CSS framework ever used, and it has no indication of slowing down. This makes it a compelling choice to learn. There is more documentation, more ancillary tools, talks, and touting of it than any other framework. It's well supported and will likely maintain its position for many years to come.

2) **Tailwind CSS** is the most promising framework (subjectively). It appears to be the hottest new thing. Their philosophy is similar to Bootstrap, but they have really re-thought things. Their documentation is good, there are tons of people talking about it right now, so if anything could unseat Bootstrap, at the moment Tailwind CSS looks to be it.

Happy coding!

Signup for my newsletter [here](https://thinkster.io/?previewmodal=signup?utm_source=devto&utm_medium=blog&utm_term=whichcssframework&utm_content=&utm_campaign=blog).

Visit Us: [thinkster.io](https://thinkster.io?utm_source=devto&utm_medium=blog&utm_term=whichcssframework&utm_content=&utm_campaign=blog) | Facebook: @gothinkster | Twitter: @GoThinkster
The ultimate list of places you can host your apps - free:
Published: 2020-09-21 14:23:19

Free Hosting The ultimate list of places you can host your apps for free. Enjoy.

    Netlify: https://netlify.com
    FIrebase: firebase.google.com
    AWS: aws.amazon.com
    Heroku: heroku.com
    Github Pages: pages.github.com
    Vercel vercel.com
    Surge: surge.sh
    Render: render.com
    Gitlab Pages docs.gitlab.com/ee/user/project/pages

If you liked this article, be sure to ❤️ it.
CakePHP Form button Customize
Tags: php
Published: 2020-09-21 14:21:21

#how to

- Add the class you want to adapt to create

```PHP
<?= $this->Form->create(null, ['class'=> 'aaa' , 'url' => ['controller' => 'Advices', 'action' => 'heart']]); ?>
<?= $this->Form->hidden( 'advice_id', ['value'=>$advices->id ]); ?>
<?= $this->Form->button(__('Heart')) ?>
<?= $this->Form->end() ?>
```

- How to write on the button of the class

```CSS
.aaa .button, .aaa button, .aaa input[type='button'], .aaa input[type='reset'], .aaa input[type='submit'] .aaa {
    background-color: #db116c;
    border: 0.1rem solid #db116c;
}
```

- Appearance after change

---

 ![Appearance after change](https://dev-to-uploads.s3.amazonaws.com/i/38ulj0rvu4pg9dsjnfm5.png)        

---

#A little more

- Image of unpressed heart

```PHP
<?= $this->Form->button(__('♡')) ?>
```

```CSS
.aaa .button, .aaa button, .aaa input[type='button'], .aaa input[type='reset'], .aaa input[type='submit'] .aaa {
    background-color: #f1f2f4;
    border: 0.1rem solid #606c76;
    -moz-border-radius: 50%;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    font-size: 2rem;
    color: #606c76;
}
```

---

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

---

- Image of pressed heart

```PHP
<?= $this->Form->button(__('♥')) ?>
```

```CSS
.aaa .button, .aaa button, .aaa input[type='button'], .aaa input[type='reset'], .aaa input[type='submit'] .aaa {
    background-color: #db116c;
    border: 0.1rem solid #db116c;
    -moz-border-radius: 50%;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    font-size: 2.3rem;
    color: white;
}
```

---

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

---
World of WoqlCraft - Ep.24 Graph visualisation on Jupyter notebook
Tags: python, jupyter, visulization, database
Published: 2020-09-21 14:18:15

---
title: World of WoqlCraft - Ep.24 Graph visualisation on Jupyter notebook
published: true
description: Today we will have a quick look at the new plug-in of the TerminusDB client which gives customisable interactive graph visualisation on Jupyter notebook. JavaScript did the heavy lifting but the users are just required to write in Python.
tags: python, jupyter, visulization, database
---
Today we will have a quick look at the new plug-in of the TerminusDB client which gives customisable interactive graph visualisation on Jupyter notebook. JavaScript did the heavy lifting but the users are just required to write in Python. 

Find the source code from our [tutorial repo](https://github.com/terminusdb/terminus-tutorials).

Join the TerminusDB community at [Discord](https://discord.gg/Gvdqw97)
Kotlin: 'null' does not equal 'true', but also not 'false'
Tags: kotlin, nullability
Published: 2020-09-21 14:17:54

> **TL;DR** Kotlin has the `===` operator for referential integrity and none of `true`, `false` or `null` references the same thing. Don't forget that, when comparing nullable booleans.

Today I stumbled upon a hint from IntelliJ. I wanted to write something like the following:
```kotlin
val potentiallyNull: Any? = null // in real world, we wouldn't know whether it's null or not
if (potentiallyNull?.equals("foo") ?: false) {
    println("not printed when null")
}
```
In words: *if `potentiallyNull` is not null, check for equality with `"foo"`; otherwise return `false`*.

So, IntelliJ kindly told me: `Equality check should be used instead of elvis for nullable boolean check`

I thought to myself, alright then, let's apply that nice hint.

What I got was:
```kotlin
if (potentiallyNull?.equals("foo") == true) {
    println("not printed when null")
}
```

However, later on, I wanted to invert the condition. So naively, I simply replaced `true` by `false`:
```kotlin
if (potentiallyNull?.equals("foo") == false) {
    println("print also when null")
}
```

Unfortunately, the result was not as expected. There was not a single character printed to the console. *What went wrong?*

Actually, it's quite obvious, but it took me a moment to realize: **of course, `null` is neither the same as `true` nor as `false`**.

So, I took a step back and rewrote my original condition:
```kotlin
if (potentiallyNull?.equals("foo") ?: true) {
    println("print also when null")
}
```

IntelliJ again told me to change that and use the equality check, so what I got now was:
```kotlin
if (potentiallyNull?.equals("foo") != false) {
    println("print also when null")
}
```

The first thing I thought was: *How is `... != false` different to `... == true`*? 

But again, **`null` is neither the same as `true` nor as `false`**. So the comparison has actually three possible results: `true`, `false` or `none of them`. 

`... != false` in this case means `true` or `none of them`, whereas `... != true` means only `true`.

For more on equality in Kotlin, I recommend to read the official docs on [equality](https://kotlinlang.org/docs/reference/equality.html)

All in all, that wasn't my most brilliant moment for sure, but I thought others might stumble upon that as well. Hope you liked it.
How would you setup a portfolio site?
Tags: discuss, career, brand, portfolio
Published: 2020-09-21 14:16:17

---
title: How would you setup a portfolio site?
published: true
description: 
tags: discuss, career, brand, portfolio
---

I do have multiple domains. Some for my different usernames, and some for my actual name.
Now I would like to setup a blog and a portfolio site that I can show off to possible employers.

Now my question: Would you build a site with the domain of my real name that includes the portfolio and the blog. Or would you separate the blog to a domain with my username?