teleren/devto huggingface dataset:
How to Slice Lists in Python
Tags: python, beginners
Published: 2020-02-04 15:58:43

The <a href="https://python.org">Python</a> programming language has support for lists, a <a href="https://pythonspot.com/python-lists/">list</a> is a collection. It can be a collection of numbers, strings or other types of data.

The example below defines the list x:

```python
x = [ 1,2,3,4,5,6,7,8 ]
```
How do you get only a part of the list?
You may think a <a href="https://pythonbasics.org/for-loops/">for loop</a>, which does the job, but there's an easier way.

## Slice list

The Pythonic way is by defining brackets with start and ending position.
In between you write a colon, not a comma. Like this:

```python
>>> x[1:3]
```

This looks similar to defining a list, but instead it takes a slice of the list.

This starts at the 2nd position (the element in Python is zero), and ends at the 4th position (3rd counting from zero). This may be a bit confusing initially.

```python
>>> x = [1,2,3,4,5,6,7,8]
>>> x[1:3]
[2, 3]
>>> x[0:2]
[1, 2]
>>> x[0:3]
[1, 2, 3]
>>> 
```

If you want to start from the first character, you can leave the starting number out:

```python
>>> x[:2]
[1, 2]
>>> x[:3]
[1, 2, 3]
>>> 
```

To create a new list, you can just do this:

```python
>>> z = x[:2]
>>> z
[1, 2]
>>> 
```

You can use a list as an object, it supports function calls. This lets you sort the list, remove elements and more.

**Related links:**
* <a href="https://docs.python.org/3.8/tutorial/datastructures.html">List in Python docs</a>
* <a href="https://pythonbasics.org">Learn Python</a>
How to enable or disable the touchscreen in Manjaro or Arch Linux?
Tags: manjaro, archlinux, xinput, inputdevices
Published: 2020-02-04 15:57:49

In this post I will tell you how to enable or disable the touchscreen in Manjaro or Arch Linux?

_**Several times graphical tools doesn't work or we don't like to waste our time just to lookout for them._

For that purpose, we will use **Xinput**. It is a utility to configure and test X input devices, such as mouses, keyboards, touchpads, etc.


If Xinput is not already installed. Then you can install it using

 _**sudo pacman -S xorg-xinput**_

command.

There are several operations which you can perform using [Xinput](https://www.x.org/archive/current/doc/man/man1/xinput.1.xhtml) utility. Now to disable the touchscreen.


First, run 

 _**xinput list --long**_

command in your terminal.

Above command's output will be like this -

![Xinput list --long](https://1.bp.blogspot.com/-XrUs2toHKVc/XjmMK3FQK9I/AAAAAAAAAs0/JBffLDG1tpk-ztmzZbDegXnFIDLnBE7dgCLcBGAsYHQ/s1600/b1.png)


Through which you will get the list of all of your input devices. Now from that list, find your touchscreen device which will be listed in pointer category.


After that you just need to run

 _**xinput disable/enable <device_id>**_

or

 _**xinput disable/enable <"device_name">**_

command.

But this change will not last permanently. I mean when you will restart your PC, the touchscreen will start working again if you used disable command or vice-versa.

So, to make the changes permanent. We will add this command to run every time when the system starts-up.

_**There is another way to make the changes permanent via Xorg configuration file. I tried using it but I messed up. Lemme know if anybody knows how to make the changes permanent using Xorg config file._

Thus,

_**Below steps are based on KDE Plasma Desktop Environment._

1. Open your System Settings. Go to Start up and Shutdown option.
2. Go to Auto start tab.
3. There you just need to add a Desktop file with the appropriate command in it.
4. Then just Save it or click OK.

It's done.


![Manjaro KDE System Settings](https://1.bp.blogspot.com/-0aTB__8DazA/XjmMu-VlsDI/AAAAAAAAAs8/PGtnD70BlXwBI3NP79raHESHAWnzsdGpACLcBGAsYHQ/s1600/b2.png)

Feel free to give me any suggestions regarding this blog or the post's format.

Don't forget to visit my blog to get more posts like this [ganofins.com](https://ganofins.com/blog)
Go 1.14 Overlapping Interfaces
Tags: discuss, go
Published: 2020-02-04 15:48:54

---
title: Go 1.14 Overlapping Interfaces
published: true
description: What is the usefulness or change you will benefits from overlapping interfaces when it's release in Go 1.14?
tags: #discuss #go
---

What is the usefulness or change you will benefits from overlapping interfaces which will be release in Go 1.14?

https://github.com/golang/proposal/blob/master/design/6977-overlapping-interfaces.md
My VSCode shortcuts and extensions for development
Tags: vscode, productivity, tools, webdev
Published: 2020-02-04 15:39:42

# Hello everyone, Good Day :blush:

Knowing shortcuts of your editor give you an upper hand while developing. Below are the some **shortcuts** and extensions that I use/frequently use - 
### Keyboard shortcuts

`Ctrl+Shift+E` - Open file explorer
`Ctrl+Shift+D` - Open debugger
`Ctrl+Shift+X` - Open extensions
`Ctrl+Shift+P` - Open command palette
`Ctrl+Shift+I` - Format code (Linux)
`Ctrl+Shift+K` - Delete line
`Ctrl+Shift+L` - Select all occurrences of current selection
`Ctrl+Shift+[` - Fold the selected line of code
`Ctrl+Shift+]` - Unfold code
`Ctrl+Shift+V` - This command lets you to get the preview of the **.md** file
`Ctrl+Shift+Enter` - Insert line above
`Ctrl+Shift+` - Open new terminal

`Ctrl+B` - Toggle on/off sidebar
`Ctrl+P` - Go to file in the current folder
`Ctrl+L` - Select the current line in the cursor
`Ctrl+G` - Go to line number
`Ctrl+R` - Shows all the folder in the current directory 
`Ctrl+F` - Find anything in the file
`Ctrl+H` - Replace any word
`Ctrl+D` - Add selection to next match
`Ctrl+,` - Open settings
`Ctrl +k, Ctrl+T` - Open themes
`Ctrl+J`/`Ctrl+`` - Quick open to current terminal


`Alt+UpArrow` - Shift current line above
`Alt+DownArrow` - Shift current line down
`Alt+Click` - Add new cursor 

`Alt+Shift+UpArrow` - Copy and shift current line/selected lines to above
`Alt+Shift+DownArrow` - Copy and shift current line/selected lines to down
`Alt+Shift+F` - Format code (Windows)

`Ctrl+Alt+Shift+DownArrow`/ `Ctrl+Alt+DownArrow` - Add cursor down 
`Ctrl+Alt+Shift+UpArrow`/ `Ctrl+Alt+UpArrow` - Add cursor above

You can change or make any shortcut willingly. 

### Extensions
#### [Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer)
This extension is way too good when you are making a static website using html,css. After installation, all you need to open the live server. You can do this by clicking `Go Live` from the status bar or simply press `Alt+L, Alt+O`. You can terminate server by pressing `Alt+L, Alt+C`
#### [Live Sass Compiler](https://marketplace.visualstudio.com/items?itemName=ritwickdey.live-sass)
It will compile all your code written in  **.scss** format to **.css** format
#### [ES7 React/Redux/GraphQL/React-Native snippets](https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets)
It provides some cool shortcuts if you use **React**
#### [Polacode](https://marketplace.visualstudio.com/items?itemName=pnp.polacode)
It lets you to take nice screenshots of your code. Press `Ctrl+Shift+P` and write polacode and hit enter. It will open a panel in the right side. Now Select your code and take screenshot.
#### [Material Icon Theme](https://marketplace.visualstudio.com/items?itemName=PKief.material-icon-theme)
It provides material icons in your files.
#### [Dracula Official](https://marketplace.visualstudio.com/items?itemName=dracula-theme.theme-dracula)
There are lots of black themes but I like this one.

These are the shortcuts and extensions I use. Any kind of suggestions would be appreciated. Thank you
Working with custom exceptions in namespaced files
Tags: php, exceptions, namespaces
Published: 2020-02-04 15:33:26

Hello fellow devs !
today I came across a situation where I need to use `Exceptions` within a namespaced project, It was either I use the global namespace `\Exception` or I create a custom one. And of course we wouldn't be reading this if I choose the former :", Okay enough chat, let's dig in !

Assuming that you are familiar with [composer autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading)

let's create our namespaced class `checker.php`
```php
<?php
namespace SHD;
class Checker
{
    public function checkPalindrome($text){
        $text = preg_replace('/[^A-Za-z0-9]/', '', $text);
        $text = strtolower($text);
        $before = $text;
        $after = strrev($text);
        if ($before == $after){
            echo "Wow, you can read this text correctly from both ways";
        } else {
            echo "This text isn't a palindrome!";
        }
    }
}
?>
```

now let's try using it in `index.php`
```php
<?php
//Composer autoload
require 'vendor/autoload.php';
//Loading the class and create new instance
use SHD\Checker as Checker;
$checker= new Checker;
//Performing our actions
echo $checker->checkPalindrome("A man, a plan, a canal – Panama");
?>
```

So far so good, right ? lets tweak the above code to create our custom exception`checker.php`
```php
<?php
namespace SHD;
//Loading our custom Exception Class
use SHD\Exception;
class Checker
{
    public function checkPalindrome($text){
        //previousCode
        try {
            if ($before == $after){
                echo "Wow, you can read this text correctly from both ways";
            } else {
                throw new palindromeException("Not valid palindrome", 4);
            }
        } catch (palindromeException $e) {
            echo $e->showError();
        }
    }
}
?>
```
`exception.php` file where the custom exceptions are!
```php
<?php

namespace SHD;
//Loading global exception is a must before it can be extended
use Exception;
class palindromeException extends Exception
{
//This code is required to make the exception code and message not optional
	public function __construct($message, $code, Exception $previous = null) {
//Passing 'em to the Exception calss itself
		parent::__construct($message, $code, $previous);
	}
//Our custom method
	public function showError(){
		$error = $this->message;
		if ($this->code == "4") {
			$error = $this->code .":".$this->message;
		}
		return $error;
	}
}

?>
```
All done, now back to `index.php` and change the sentence a bit to trigger the exception and watch your hard work pays off

Maybe most of you (lovely readers who reached this point of the article) already knew this, but for people like me who struggles with such easy tasks, this will be a quick reference.
Thank you all for reading <3
Arrow Functions Return Rules in JavaScript
Tags: javascript, webdev, beginners, codenewbie
Published: 2020-02-04 14:02:45

<img src="https://miro.medium.com/max/650/1*GG9YZmW3GEEW6FZPqS8RRQ.png" alt="Arrow Functions Return Rules in JavaScript" />

There are 2 ways for returning values in arrow functions:
1. Explicit Return
2. Implicit Return

## 1. Explicit Return

#### What is Explicit Return?

A function is returned values using the return keyword, it’s called an explicit return.

#### The Rules of Explicit Return

You must use an explicit return statement in a block body.

#### Example

```javascript
// Single-line
const explicit = (value) => { return value; }

// Multi-line
const explicit = (value) => {
  return value;
}
```

## 2. Implicit Return

#### What is Implicit Return?

A function is returned values without using the return keyword, it’s called an implicit return.

#### The Rules of Implicit Return

You must use an implicit return in a concise body.

#### Example

```javascript
// Single-line
const implicit = (value) => value;

// Multi-line
const implicit = (value) => (
  value
);
```

#### Issue Returning Objects

When using implicit returns, object literals must be wrapped in parenthesis so that the curly braces are not mistaken for the opening of the function’s body.

```javascript
const implicit = () => { value: 1 };
implicit(); // undefined

const implicit = () => ({ value: 1 });
implicit(); // { value: 1 }
```

## Parens Rules

Arrow functions can omit parentheses when they have exactly one parameter.

```javascript
// Arrow Functions, with parentheses
const myFunction = (p) => {}

// Arrow Functions, without parentheses
const myFunction = p => {}
```

In all other cases (multiple parameters), the parameter(s) must be wrapped in parentheses.

```javascript
// Arrow Function, with parentheses
const myFunction = (p1, p2) => {}
```

## References

* <a href="https://jaketrent.com/post/javascript-arrow-function-return-rules">JavaScript Arrow Function Return Rules</a>
* <a href="https://eslint.org/docs/rules/arrow-parens">Eslint — arrow-parens rules</a>
* <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions">MDN Web Docs — Arrow functions</a>

Thanks for reading ❤ Say Hello! <a href="https://github.com/bunlong">Github</a> | <a href="https://www.linkedin.com/in/bunlongvan">LinkedIn</a> | <a href="https://twitter.com/bunlongvan">Twitter</a>
The Benefits And Challenges Of Building A Data Trust - Episode 118
Published: 2020-02-04 15:24:40

<p>Every business collects data in some fashion, but sometimes the true value of the collected information only comes when it is combined with other data sources. Data trusts are a legal framework for allowing businesses to collaboratively pool their data. This allows the members of the trust to increase the value of their individual repositories and gain new insights which would otherwise require substantial effort in duplicating the data owned by their peers. In this episode Tom Plagge and Greg Mundy explain how the BrightHive platform serves to establish and maintain data trusts, the technical and organizational challenges they face, and the outcomes that they have witnessed. If you are curious about data sharing strategies or data collaboratives, then listen now to learn more!</p><p><a href='https://www.dataengineeringpodcast.com/brighthive-data-trust-episode-118/'>Listen Now!</a></p>
Flutter or Kotlin?
Tags: discuss, help, kotlin, ios
Published: 2020-02-04 15:07:54

I made post about starting kotlin being iOS developer. it’s not because of any external force. it is my own decision of starting something new or experimenting with something new. 

So instead of going to Kotlin. is it better to go for Flutter or should i go all native and choose Flutter being a swift developer. 

I like playing with newer frameworks like Mobile Machine Learning and Augmented Reality. 

Please help me narrowing my decision down for Flutter or Kotlin!
Hey Gatsby fans - what's so great about Gatsby?
Tags: gatsby, jekyll, ssg, web
Published: 2020-02-04 15:02:31

---
title: Hey Gatsby fans - what's so great about Gatsby?
published: true
description: Someone give me a clue why Gatsby is becoming more popular than Jekyll?
tags: gatsby, jekyll, ssg, web
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/3augpqdy0t1g874bsrb7.png
---

I love [Jekyll](https://jekyllrb.com/). I've built tons of sites in Jekyll. It's easy to set up and work with, and it Just Works with GitHub pages, Netlify and the rest (I suppose GitHub Pages was the reason Jekyll first got popular).

Recently, I've seen many a post here about [Gatsby](https://www.gatsbyjs.org/). Now my question is this - **"What's so great about Gatsby?"** ...as compared to the other static site generators?

I have a feeling - feel free to correct me - that the answer boils down to "Because JavaScript"

I see that it builds React apps so obviously that's worth hype points right out of the gate. 

So please can all the Gatsby users and enthusers jump into the comments and fill me in? Maybe somebody can convince me that I'm missing out!
How to Run a Python Script via a File 
Tags: python, beginners
Published: 2020-02-04 14:58:41

Before writing <a href="https://python.org">Python</a> scripts, you should be able to run them. If you run a Python script, Python makes sure the computer understands the code: it interprets. 

Any Python script should end with the .py extension. So program names could be:

* hello.py
* world.py
* sort_names.py

The way to execute Python differs on systems (Linux,Mac,Windows), but comes down to the same idea. Any script will do, you can use the <a href="https://pythonbasics.org/execute-python-scripts/">hello world</a> script.

## Windows

On Windows, you likely installed Python in C:\Python..\python.exe
But your program is most probably somewhere else, like on your desktop. 
First open a command prompt (Win+R, cmd or command.exe)
You can run it with this command:

    C:\Python35\python.exe C:\Users\Username\Desktop\my_python_script.py

On older versions of windows, Python is not installed by default. If that's the case, install it first.

## On Mac OS X or Linux

If you use Apple Mac or Linux, Python is often installed by default. On top of the program, you can add one of these lines:

    #!/usr/bin/env python

or

    #!/usr/bin/env python3

This defines that you want to use Python environment. Save your file (hello.py).

Then in the command line, make it executable:

    chmod +x hello.py

Then you can run it like any other program. An alternative is to run it with the python interpreter:
```python
    python hello.py
```
## Alternatives

Working from the command line can be quite challenging. For a single file you can do it, but for larger apps this gets cumbersome.

Most developers use an app to develop, a so called <a href="https://pythonbasics.org/getting-started/#PythonIDE">IDE</a>. This lets you work with multiple files easily, run with a keyboard shortcut and other simplifications.

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

Sometimes people work directly in the Python shell, sometimes named <a href="https://pythonprogramminglanguage.com/repl/">REPL</a>. This lets you interact with Python, but doesn't require a file.

To open the Python shell, you simply type 'python' in the command prompt. That sets you into the shell.

    ➜  ~ python3
    Python 3.7.5 (default, Nov 20 2019, 09:21:52) 
    [GCC 9.2.1 20191008] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
 
To exit the shell, press Ctrl+Z.

**Related links:**
* <a href="https://python.org/">Python language homepage</a>
* <a href="https://pythonbasics.org/">Python tutorial</a>
Who I Am
Tags: kopechli
Published: 2020-02-04 14:53:29

I was born as Pechlivanidis Konstantinos on a winter of 1987. 
As a child i didn't had broken toys, i had disassembled toys 😃. In school i had stable grades always in the good territory, not perfect not bad but good! 

I actually was an "anomaly", a dyslexic kid that gaved away his right to oral exams to compete in equal plane with the other students. By high school no one knew and no one can tell that i was dyslexic. I didn't need therapy or doctors, because i treated it like handicap and a head start for the others, i always played in hard mode.

I started working from my 14 in intensive manual labor (carpet washing, car washing and olive processing plant), then in my 20s moved to tech support in telecommunication. Unable to seeing my self doing that for long, after getting my bachelor in information management i enlisted in army, as it is mandatory in my country, but i applied for the military school of signals and communications, graduated and discharged as second lieutenant. 

The next years after the military, my life was in nightmare mode. Between the economic crisis (Greece) and personal tragedies those years left me static, it was like eating a sledgehammer on your head every time you tried to look up. Some pieces fell some broke BUT i am still here and the game is not over.

I am trying to return to web development after an extensive pause in my life. I managed to resumed my life in 2019 and worked as junior web developer in my 31! In 2019 i Worked with a custom MVC php-framework, Html, Css, MySQL (SDBA, xCRUD), javascript (Jquery,Ajax) and bootstrap you can say i was working as old full-stack 😃. 

I was involved with web development from my college days and i actually launched a live web application for building management as my dissertation, the free subdomain of the app obviously doesn't exist anymore, but i will never show that code again to a single sole! 😃.

Now I am learning vuejs and JAMStack architecture. I use visual studio code and love git / stackexchange 😍.

In a nutshell I am :
- Introvert but extrovert with friends
- Logician with self harming brutal honesty
- Interested in how things work and networks
- Hard mode player
- With 3D modelling as a hobby

Ιn the 32 years i have been in this world,
i distilled three basic things about life :

- The most difficult to achieve in life is balance
- A fear of missing information, leads to fear of life
- Truth is a costly commodity, often returns negative value. Beware of those who sell truth and make money!
How to structure your CV when you have limited experience
Published: 2020-02-04 14:51:32

It’s #TipTuesday - my (not so new) little mini series where I share little things that can make a big difference in helping you to secure as many interviews as possible and stop you from getting lost in the mix.



Tip number 4 is about how to structure your CV when you haven’t got much experience (i.e. for entry level or graduate roles).



I’m not going to lie to you, it’s tough out there. Everyone seems to be looking for a fresh grad with 10 years’ experience and you’re sifting through job ads like poor Winona here.

![Alt text of image](https://media.giphy.com/media/26xBI73gWquCBBCDe/giphy.gif)


Here’s what I know to help you navigate through one of the most difficult stages of your career:



1) Hands down the most valuable things you can do to land your dream graduate role are sandwich years and internships / graduate programmes. If you’ve done these, highlight them right at the top of your CV above your education. If you haven’t, I would seriously look into it. Roughly a year of experience through a either a sandwich year or internship is what employers are looking for when they’re asking for experience in entry level / grad roles.



2) Keywords (see #TipTuesdays numbers 3 and 4) are still important – what tech have you used / studied? List out everything you can, including personal projects.



3) Showcase your portfolio by adding links to your CV



4) Participate in the tech community – twitter, LinkedIn, https://buff.ly/2A0lKXV, etc (Tae'lur Alexis is an incredible example of this - https://buff.ly/38QbVbl)



5) Contribute as much as you can (https://buff.ly/1QxPHQb)



6) Don’t underestimate the power of networking – I heard of one lady who wrote a list of the top companies she wanted to work for after graduating and reached out to friends and family asking if any of them knew anyone working at any of those companies. She was able to set up 20 or so coffee dates in her final year. This Forbes article also offers some good tips - https://buff.ly/2RzZoDg





Hope you found this #TipTuesday helpful. It’s a bit of a difficult topic and I don’t specialist in graduate recruitment but you guys requested so I’ve done my best.



Would love to hear your thoughts in the comments and what you’d like advice on in future #TipTuesdays!





If you’ve missed the rest of my #TipTuesday series, you can find them all here:

Week 1 - https://buff.ly/30vh5Xk

Week 2 – https://buff.ly/38PB32i

Week 3 – https://buff.ly/37DCgcw