teleren/devto huggingface dataset:
9 Developer Tutorials You Should Try from August 2021
Tags: containers, ibmdeveloper, kubernetes, machinelearning
Published: 2021-09-02 18:29:20

---
title: 9 Developer Tutorials You Should Try from August 2021
published: true
date: 2021-08-27 23:26:38 UTC
tags: Containers,IBMDeveloper,Kubernetes,MachineLearning
canonical_url: https://maxkatz.org/2021/08/27/9-developer-tutorials-you-should-try-from-august-2021/
---

I want to share developer articles, tutorial and videos from [IBM Developer](http://developer.ibm.com) North America team. These resources offer high-quality developer education so I believe you will find them valuable.

[![Summer](https://katzmax.files.wordpress.com/2021/08/pexels-photo-1152359.jpeg)](https://katzmax.files.wordpress.com/2021/08/pexels-photo-1152359.jpeg)<figcaption>Photo by MarcTutorials on <a href="https://www.pexels.com/photo/palm-trees-1152359/" rel="nofollow">Pexels.com</a></figcaption>

📖[Deploying a containerized app to IBM Code Engine](https://dev.to/godspowercuche/deploying-a-containerized-app-to-ibm-code-engine-379h-temp-slug-4546333) by [Mrina Sugosh](https://twitter.com/mrinasugosh)

📖[Deploying a Python Flask App to Kubernetes](https://dev.to/godspowercuche/deploying-a-python-flask-app-to-kubernetes-5dmp-temp-slug-5725205) by [Mrina Sugosh](https://twitter.com/mrinasugosh)

📖[Docker Cheatsheet](https://dev.to/ibmdeveloper/docker-command-cheatsheet-1pe8) by [Mrina Sugosh](https://twitter.com/mrinasugosh)

📖[Get FREE Kubernetes Certification with IBM](https://dev.to/ibmdeveloper/get-free-kubernetes-certification-with-ibm-3o83) by [Jenna Ritten](https://twitter.com/jritten)

📖[Can’t push to your GitHub repo? I can help with that](https://dev.to/ibmdeveloper/can-t-push-to-your-github-repo-i-can-help-with-that-1fda) by [Jenna Ritten](https://twitter.com/jritten)

📖[Journey to the Cloud: IBM Cloud Deployment 4 Ways](https://dev.to/ibmdeveloper/journey-to-the-cloud-ibm-cloud-deployment-4-ways-o5b) by [Jenna Ritten](https://twitter.com/jritten)

📖[IBM Cloud Deployment 4 Ways: IBM Cloud Code Engine](https://dev.to/ibmdeveloper/ibm-cloud-deployment-4-ways-ibm-cloud-code-engine-1i12) by [Jenna Ritten](https://twitter.com/jritten)

📖[How Game Dev and Betting on Myself Altered My Career Path Forever](https://dev.to/bradstondev/how-game-dev-and-betting-on-myself-altered-my-career-path-forever-17bn) by [Bradston Henry](https://twitter.com/BradstonDev)

📖[Simple Guide to Deploying a Node Server to Red Hat OpenShift](https://dev.to/ibmdeveloper/simple-guide-to-deploying-a-node-server-to-red-hat-openshift-aa9) by [Bradston Henry](https://twitter.com/BradstonDev)

One more thing. If you are looking to join our live online meetups, you will find weekly developer education events on our [Crowdcast channel](http://crowdcast.io/ibmdeveloper).
python: module has no attribute error
Tags: python
Published: 2021-08-29 02:42:12

# Problem
I have a directory ~/dev/python3/pylib, which contains handy small modules. One of them is DB.py, which defines functions to connect to different databases.

If a script requires connection to a database, I can simply do
```
import site
site.addsitedir('/home/xqy/dev/python3/pylib')
import DB

db = DB.connectlocaldb()
```

But why I got error like below?

**AttributeError: module 'DB' has no attribute 'connectlocaldb'**

I checked several times to make sure the lib dir is correct and the file DB.py includes function "connectlocaldb()", but the error still persists.

# Reason:
When importing a module, python will go through a list of directories included in **sys.path**, and searching for the specified module, the first one found will be used.

xqy@voyager:~/dev/python3$ python
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print("\n".join(sys.path))
''
/usr/lib/python37.zip
/usr/lib/python3.7
/usr/lib/python3.7/lib-dynload
/home/xqy/.local/lib/python3.7/site-packages
/usr/local/lib/python3.7/dist-packages
/usr/lib/python3/dist-packages

**the empty entry '' means the current directory**

There is another DB.py under ~/dev/python3/, as my current directory is ~/dev/python3, the module file ~/dev/python3/DB.py is used instead of /home/xqy/dev/python3/pylib/DB.py

And there is no "connectlocaldb" function in ~/dev/python3/DB.py

We can also find out sys.path using below command
 
xqy@voyager:~/dev/python3$ python3 -m site
sys.path = [
    '/home/xqy/dev/python3',
    '/usr/lib/python37.zip',
    '/usr/lib/python3.7',
    '/usr/lib/python3.7/lib-dynload',
    '/home/xqy/.local/lib/python3.7/site-packages',
    '/usr/local/lib/python3.7/dist-packages',
    '/usr/lib/python3/dist-packages',
]
USER_BASE: '/home/xqy/.local' (exists)
USER_SITE: '/home/xqy/.local/lib/python3.7/site-packages' (exists)
ENABLE_USER_SITE: True

xqy@voyager:~/dev/python3$ cd ~
xqy@voyager:~$ python3 -m site
sys.path = [
    '/home/xqy',
    '/usr/lib/python37.zip',
    '/usr/lib/python3.7',
    '/usr/lib/python3.7/lib-dynload',
    '/home/xqy/.local/lib/python3.7/site-packages',
    '/usr/local/lib/python3.7/dist-packages',
    '/usr/lib/python3/dist-packages',
]
USER_BASE: '/home/xqy/.local' (exists)
USER_SITE: '/home/xqy/.local/lib/python3.7/site-packages' (exists)
ENABLE_USER_SITE: True`

Therefore, by deleting file ~/dev/python3/DB.py or changing current directory, the error will not appear any more.
Programming knowledge
Published: 2021-08-28 09:08:51

programming knowledge had diminished to a point that it no longer was sufficient for him to get a job. In the course of a five-hour interview, he was told he was the very best of the bunch, but, he said, he was not hired. When he contacted him years later, he said, the hiring manager wrote that he was sorry he had passed over Latko, but there was a vacancy at a much better company.
Github 101
Tags: github, beginners, opensource, webdev
Published: 2021-08-28 10:13:17

Hey, if you are absolute beginner or just started to code recently, and have seen your peers showcasing their projects and works in platforms like GitHub, then you are at the right spot!

I'll let you know some quick easy peasy tools online where in you can code and "PUSH" your code to github by just a click.
Also, I will let you know how to push your entire codebase from your system to GitHub.

(Now here I am assuming that you have created an account on GitHub, if not - do it first, it's simple , create an account directly from your Google Account.)

01 ) If you are quite new to web dev and just trying your hands on experimenting a few stuffs here and there, then try using platforms such as CodeSandbox and Repl.
All you need to is , go to the github icon, connect your sandbox to your github by providing your credentials and after authorization(this is just a one time step) you just need to type out your repository name, a few words about your project and hit the Create button. Similar steps for Repl too. Isn't that easy?
Now you are all set to show case your project.
Bonus here is: You can copy the URL from the output sample browser in your sandbox, go to your Github repo, and in the about section,paste this link under the wesite input field.
So, now your work is all set, pushed into github and your peers can also directly view your project up and running from the URL that you had provided from the Sandbox!

02) If you want to push your project from your System to Github, download GitBash terminal, it helps you to do this in no time.
Now follow the steps:
Step 0: Open the GitBash terminal in the directory wherein your desired project folder(s) exists.
Now type the following commands.
Step 01:git init
Step 02:git add <folder1> <folder2> <etc.>
Step 03:git commit -m "Your message about the commit"
(Now go to GitHub, under repositories create a new Repo by hitting the New button and provide the name of your repository and give some description about it, and you may also set you repo to private or public)
Step 04:git remote add origin https://github.com/yourUsername/yourRepository.git
Step 05:git push -u origin master
Step 06:git push origin master
That's it, now you can check your repo(give a refresh maybe), and in the master branch you would be able to see the changes.
Similar to 01) if you want to host it live, we'll that's for some other day , for sure!
Introducing image download sites in the production of high quality content
Published: 2021-08-28 12:04:19



Hello, we are at your service with another training and introduction. Today, we want to introduce websites for you that you can download photos from these websites in good quality for free and for money, but it is necessary to mention that some of these Website in Iran is banned

Freepik

This site has two sections, free and paid, you can also download open layer images in vector format from this site for free, download from this site is only possible for its members. And some images are available for free on the free courier site.

Picjumbo

On this site you can find a lot of amazing and beautiful images in any subject and title that you do not need to get a license to use on your site.

Pexels

This site is one of the largest free image directories   . This site has collected many images from various other sites, so you can have a large and diverse collection of images in one place. So if you do not have much time to search for images when producing blog content or copywriting, this site can be one of the best.

Stocksnap

The stocksnap.io site, like other photo download sites, has very good quality images that you can download by subscribing to the site and use it to produce your content.

Flickr

In this site, in addition to being able to access high quality photos, you can also share your own photos. You can also edit your images on this site. Of course, you can use the features of this site when you must register on this site. This site is also a social network

Until the next training, God bless the producer Amir Reza Karimi
Cara membuat custom command pada terminal
Tags: linux, zsh, bash
Published: 2021-08-28 13:09:01

terkadang menuliskan banyak command untuk satu hasil sangatlah menyebalkan, disini saya akan memberikan sedikit tutorial untuk membuat custom command pada terminal

- buka terminal dan jalankan perintah 
```bash
sudo gedit ~/.bashrc
```

- setelah itu tambahkan 
```
alias custom-command='perintah1;perintah2;dst'
```

- sebelum
![Sebelum Menggunakan Custom Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9mmhrwuj0bb6p0mxc6t3.png)

- setelah
![Setelah Menggunakan Custom Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jkpi8melflu6ir3j5w7.png)
How on earth does this work?
Tags: security
Published: 2021-08-28 15:28:32

I was browsing the internet the other day and came across a site known as spur.us. The site claims to "Stops fraud and abuse on the internet" by collecting and indexing IP usage, VPN IPs, and proxy IPs.

Its a very interesting site, you can get info on any IP by visiting spur.us/context/youriphere. My question is, how does it work? How does a site collect data on every IP address out there? How do they know that X amount of people are on my IP address? How do they know that I have connected to the Tor network or used ProtonVPN?
.NET Core 2.1 container images were deleted from Docker Hub!
Tags: docker, dotnet
Published: 2021-08-28 16:03:20

If you started receiving errors when pulling old versions of dotnet docker images (like the `.NET 2.1`), it's because Microsoft deleted them from Docker Hub on August 21st, 2021. That date is not a coincidence, the `.NET Core 2.1` reached end of support in the same date. For more details take a look at the official [dotnet announcement](https://github.com/dotnet/announcements/issues/197) or also the [dotnet blog](https://devblogs.microsoft.com/dotnet/net-core-2-1-container-images-will-be-deleted-from-docker-hub/).

In my case, the error below was thrown when pulling the `microsoft/dotnet:2.2-aspnetcore-runtime` image:

```bash
Error response from daemon: pull access denied for
microsoft/dotnet, repository does not exist or may
require 'docker login': denied: requested access to
the resource is denied
```

As mentioned before, the reason was: microsoft moved the `out of support` images from docker hub to [microsoft container registry](https://github.com/microsoft/containerregistry) (MCR). To solve that problem, I updated the image to `mcr.microsoft.com/dotnet/core/runtime:2.2`. So, instead of pulling images from docker hub (`microsoft/dotnet`) you should pull them from MCR (`mcr.microsoft.com`), just like described below:

```bash
microsoft/dotnet:2.1-sdk -> mcr.microsoft.com/dotnet/sdk:2.1
microsoft/dotnet:2.1-aspnetcore-runtime -> mcr.microsoft.com/dotnet/aspnet:2.1
microsoft/dotnet:2.1-runtime -> mcr.microsoft.com/dotnet/runtime:2.1
microsoft/dotnet:2.1-runtime-deps -> mcr.microsoft.com/dotnet/runtime-deps:2.1
```

> **NOTE**: see the full list of `from docker hub to MCR images` [here](https://devblogs.microsoft.com/dotnet/net-core-2-1-container-images-will-be-deleted-from-docker-hub/#pulling-images-from-mcr)

Maybe you're asking yourself: why microsoft announced that they removed the 2.1 images from docker hub but not the 2.2 images? The response is simple: `.NET 2.2` was deprecated in December 23, 2019, so microsoft don't need to announce as they are not supporting it anymore 🤷‍♂️

> **NOTE**: it's strongly recommended move to later `.NET` versions instead of using `out of support` versions like 2.1 or 2.2
Git alias to checkout & pull the default branch of GitHub repositories
Tags: git, productivity, github, bash
Published: 2021-09-04 15:50:51

---
title: Git alias to checkout & pull the default branch of GitHub repositories
published: true
date: 2021-09-04 15:48:00 UTC
tags: #git #productivity #github #bash
canonical_url: https://mmazzarolo.com/blog/2021-08-28-git-alias-to-checkout-default-branch-github/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mbwonzf0orasdtd9f59r.png
---

Short post here.

In my daily job, I switch between different projects/repositories quite often.  
These projects can have different _default_ branches (`master`, `main`, `develop`), and they’re all GitHub repositories.  
Something I do frequently is checking out the repositories’ default branch and pulling down the most recent updates.  
Since I don’t remember what each repo’s default branch name is, I’m using a GitHub alias that automatically detects it:

```bash
# .gitconfig
[alias]
    # checkout and pull the default branch
    m = !git rev-parse --abbrev-ref origin/HEAD | cut -c8- | xargs -n 1 git checkout && git pull origin $(git rev-parse --abbrev-ref HEAD)
```

I invoke it with `git m`.

It took me a bit to write this alias, mixing a few answers from this StackOverflow thread: [git - how to get default branch?](https://stackoverflow.com/questions/28666357/git-how-to-get-default-branch).  
I went through some trial and error. I played with GitHub’s `gh` CLI, `git symbolic-ref`, and a few other options, but it looks like there’s no silver-bullet solution for this problem yet. Still, this command is working well for my use cases.

On the same topic, I’ve also found [this reply](https://stackoverflow.com/a/65710958/4836602) to the [“How to get the default for the master branch in Git?” StackOverflow question](https://stackoverflow.com/questions/65703168/how-to-get-the-default-for-the-master-branch-in-git) quite insightful.
AxleJS - Fetch, supercharged.
Tags: javascript, typescript, webdev
Published: 2021-08-29 00:49:59

# AxleJS

## Why?

Good'ol Fetch API. Simple and easy, but bad error handling, long options, and doesn't always follow redirects. 

Thats where AxleJS ***supercharges*** fetch, with better error handling, easier to use options, can automatically follow redirects, and an easier way to manage and view headers and search queries!

## Features

* Functions for all HTTP Restful Methods
* Middleware and Middleware Options for code reusabilty.
* Only ~9KB minified and ~15KB unminified
* Custom, Extended Response and Request classes
* Built-in way to cancel requests
* Still keeps Fetch simple and easy to use
* Fully written in TypeScript
* Includes Type definitions
* And a lot more..

## GitHub Repository

AxleJS is free and open-source using the [MIT License](https://github.com/ksplatdev/AxleJS/blob/main/LICENSE)!

<https://github.com/ksplatdev/AxleJS>
Create a Netflix clone from Scratch: JavaScript PHP + MySQL Day 34
Tags: php, javascript, webdev, tutorial
Published: 2021-08-29 05:50:26

Netflix provides streaming movies and TV shows to over 75 million subscribers across
the globe. Customers can watch as many shows/ movies as they want as long as they are
connected to the internet for a monthly subscription fee of about ten dollars. Netflix produces
original content and also pays for the rights to stream feature films and shows.

In this video,we will be creating category edit functionalities

{% youtube gyjn97EWJuo %}


If you like my work, please consider
[![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jm11knj7d8zwcvo150q2.png)](https://www.buymeacoffee.com/cglikpo)
so that I can bring more projects, more articles for you

If you want to learn more about Web Development, feel free to [follow me on Youtube!](https://www.youtube.com/c/ChristopherGlikpo)
How to Export All iCloud Note From Macbook to Markdown or Txt File
Tags: apple, machinelearning, ios, node
Published: 2021-08-29 09:23:50


![](https://cdn-images-1.medium.com/max/5872/1*0DkVZKNJ8cEgLMJ1dsWvXw.png)

## How to Export All iCloud Note From Macbook to Markdown or Txt File

If you’re using a MacBook to store all the apple notes on your device, how do you migrate all other notes to different applications such as Evernotes, Microsoft Notes, or some other app? Here is the most simple way and safe way to help you ensure all the files and information is transferred.

## **Download the Exporter from App Store**
[**‎Exporter**](https://apps.apple.com/us/app/exporter/id1099120373?mt=12)

![](https://cdn-images-1.medium.com/max/5524/1*qAwlS200_z_8zFZzo5hBxg.png)

Once you download and install, just go-ahead to open the app

![](https://cdn-images-1.medium.com/max/2000/1*AukbmJ8d1wZXPfiJ24PVMQ.png)

Once you download it, you can just click on the export button and it will scan and analyze all the note files on the mac.

![](https://cdn-images-1.medium.com/max/2000/1*9c5SPQJBQN4o91JmRZinXQ.png)

You will see all your files under your selecting location.

Now you will see all the files in the mdformat. you can change it to txtif you are not familiar with .md

![](https://cdn-images-1.medium.com/max/2832/1*z3p7WHWmg-5Knoht9OqGrA.png)

Congratulation! now you can drag the folder or zip it importing to Evernotes, Bear, Microsoft Notes.

This is not about the promotion but the way to save your time .
Mobile Charging cable – Can be an EVIL, Can Send Data to a Remote Attacker
Published: 2021-09-14 12:40:19

A new and upgraded version of a malicious Lightning cable that can steal user data and remotely send it to an attacker illustrates the threat of untrusted accessories.

Security researcher Mark Green, (who goes by MG) has revealed to the Vices team at Motherboard that he and his team have upgraded their version of a hacked Lightning cable in a way that allows a hacker to record keystrokes and then to send the data to a designated site. This would allow the device to be used to steal passwords and other sensitive information.

The OMG Cable, which looks exactly like a standard lightning to USB cable, was first demoed back in 2019 by security researcher MG. Since then, MG was able to work with cyber security vendor Hak5 to mass-produce the cables for researchers and penetration testers.

It can hack both Android, Apple devices and hack your systems

If you have a device and you plug it in there, there's a possibility that your confidential information will be hacked. The data will be sent to the remote attacker.

There are USB charging cable with IP Address included also a vulnerable to attackers and can be operate from miles away. The attackers can exploit the user's device by obtaining their data when the cable was connected. 

So please aware, while borrowing USB cable from someone or charging in a public place
XOR in Python
Tags: python, programming, codenewbie, tutorial
Published: 2021-09-14 22:09:14

---
title: XOR in Python
published: true
date: 2021-09-14 13:21:07 UTC
tags: #python #programming #codenewbie #tutorial
canonical_url: https://itsmycode.com/xor-in-python/
---

ItsMyCode |

XOR Operator in Python is also known as  **“exclusive or”**   that compares two binary numbers bitwise if two bits are identical XOR outputs as 0 and when two bits are different then XOR outputs as 1. XOR can even be used on booleans.

XOR is mainly used in situations where we don’t want two conditions to be true simultaneously. In this tutorial, we will look explore multiple ways to perform XOR (exclusive OR) operations in Python with examples.

## Bitwise Operator

Bitwise operators in Python are also called binary operators, and it is mainly used to perform Bitwise calculations on integers, **the integers are first converted into binary** , and later the **operations are performed bit by bit.**

## Python XOR Operator

Let’s take a look at using the XOR  **`^` ** Operator between 2 integers. When we perform XOR between 2 integers, the operator returns the integer as output.

```python 
a= 5 #0101
b = 3 #0011

result	= (a ^ b) #0110

print(result)

# Output
# 6 (0110)
```

Let’s take a look at using XOR on two booleans. In the case of boolean, the true is treated as 1, and the false is treated as 0. Thus the output returned will be either true or false.

```python 
print(True ^ True)
print(True ^ False)
print(False ^ True)
print(False ^ False)
```

**Output**

```python 
False
True
True
False
```

## XOR using Operator Module

We can even achieve XOR using the built-in **`operator `** module in Python. The operator module has a **`xor()`** function, which can perform an XOR operation on integers and booleans, as shown below.

```python 
import operator

print(operator.xor(5,3))
print(operator.xor(True,True))
print(operator.xor(True,False))
print(operator.xor(False,True))
print(operator.xor(False,False))

```

**Output**

```python 
6
False
True
True
False
```

The post [XOR in Python](https://itsmycode.com/xor-in-python/) appeared first on [ItsMyCode](https://itsmycode.com).
Talking about JavaScript function
Tags: javascript, function
Published: 2021-09-14 15:13:54

### What is Function in JavaScript?
In JavaScript, functions are defined with the *'function'* keyword.
* There is an another way to define a function, called *'Arrow Function'*.

### Declaration a Function
*Syntax*
```
function firstFunction () {
     // Code here ...
}
```
*Example*
```
function firstFunction () {
     console.log('JavaScript function');
}
firstFunction();
// JavaScript function
```
### Function Expressions
A function expression can be stored in a variable.
*Syntax*
```
let firstFunction = function () {
    // Code here ...
}
```
*Example*
```
let firstFunction = function () {
     return "JavaScript function";
}
firstFunction();
// JavaScript function
```
### Arrow Function 
Arrow function allows a short syntax for writing function expressions.
* We don't need the *'function'* keyword, the *'return'* keyword and the *'curly'* brackets.

*Syntax*
```
let change = (argument1, argument2) => Code here ... ;
```
*Example:*
```
let add = (x , y) => x + y; 
add(4, 6);
// Output will 10 
```
### Function Parameters
If you want to build a *dynamic function* then you have to use *parameters*.
* Parameters are like an *input*. Based on your *input it gives you the output*.

*Syntax with example*
```
function add(x, y) {
  return (x + y);
}
add(10, 5); // Output: 15,
// Here, x is 10, y is 5.
```
### Default Parameters
If a function is called with *missing arguments*, the missing values are set to *undefined*.
* It is better to assign a *default value*  to the *parameter*.

*Syntax*
```
function myFunction (argument1 = default value) {
   // Code here ...
}
```
*Example*
```
function sum (x = 1, y = 1) {
    return (x + y);
}
sum(4, 6); // here x is 4, y is 6
sum(4); // here x is 4 but y is 1 (default value)
sum(); // here x is 1, y is 1
```