teleren/devto huggingface dataset:
How to run a Flask Linux-only app on windows
Tags: flask, linux
Published: 2020-11-09 10:38:07

---
title: How to run a Flask Linux-only app on windows
published: true
description: Twerking a linux-only app to run on windows
tags: flask, linux
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/4o50fxf47tctcaxizprm.png
canonical_url: https://www.pythonkitchen.com/run-flask-linux-only-windows-afpy/
---

There are in the Python world many Flask Linux-only apps. However in many case, with some twerking we can make them work on Windows. We'll take the case of the AFPy site.

First fork the [AFPy site](https://github.com/AFPy/site)

Then clone it

```bash
git clone https://github.com/<your-username>/site.git
```

The makefile looks like this

```makefile
VENV = $(PWD)/.env
PIP = $(VENV)/bin/pip
PYTHON = $(VENV)/bin/python
FLASK = $(VENV)/bin/flask
ISORT = $(VENV)/bin/isort
BLACK = $(VENV)/bin/black

all: install serve

install:
	test -d $(VENV) || python3 -m venv $(VENV)
	$(PIP) install --upgrade --no-cache pip setuptools -e .[test]

clean:
	rm -fr dist
	rm -fr $(VENV)
	rm -fr *.egg-info

check-outdated:
	$(PIP) list --outdated --format=columns

test:
	$(PYTHON) -m pytest tests.py afpy.py --flake8 --isort --cov=afpy --cov=tests --cov-report=term-missing

serve:
	env FLASK_APP=afpy.py FLASK_ENV=development $(FLASK) run

isort:
	$(ISORT) -rc .isort.cfg afpy.py tests.py

black:
	$(VENV)/bin/black afpy.py tests.py

.PHONY: all install clean check-outdated test serve isort black

```

We also do not see any requirements.txt but see them listed in setup.py

```python
    install_requires=[
        'Flask',
        'Flask-Caching',
        'libsass',
        'docutils',
        'feedparser',
        'python-dateutil',
        'itsdangerous',
    ],
```

We need to install the package to get the setup working

First setup a virtual environment. If you checked the .gitignore you will see that it is not the usual github one. You will need to add `venv/` to it. See [reapplying gitignore](https://stackoverflow.com/questions/19663093/apply-gitignore-on-an-existing-repository-already-tracking-large-number-of-file). Let's name our virtual environment venv

```batch
python -m venv venv
```
Then we install the package

```
pip install -e .
```

Flask apps use `flask run` to run. But first some variables must be set. From the makefile:

```makefile
serve:
	env FLASK_APP=afpy.py FLASK_ENV=development $(FLASK) run
```

Translated to batch

```batch
set FLASK_APP=afpy.py
set FLASK_ENV=development
```

On running you can see a locale error. You can comment it out and rerun.

![](https://dev-to-uploads.s3.amazonaws.com/i/4o50fxf47tctcaxizprm.png)

_The AFPy promotes Python in the French world and is a combination of many organising bodies_

Note of caution: recomment out the locale line before comitting!

### Testing

For testing you will need to run black, flake8, tests.py
(Safely) Detect touch support with JavaScript
Tags: javascript, webdev
Published: 2020-11-09 10:19:11

I just needed to solve this very problem and I thought that some of you might need it later:

As user agent strings are both unreliable and *about to be phased out*, we need better ways to detect if the user has a touch-enabled device. Luckily, we have CSS4 media queries:

```javascript
const deviceHasAMouse = window.matchMedia("(any-hover: hover)").matches;
```

See also [MDN.](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover)

Enjoy.
SharePoint Là Gì- Các Tính Năng Vượt Trội Của SharePoint
Published: 2020-11-09 10:09:19

Chắc rằng, câu hỏi sharePoint là gì đang khiến nhiều người dùng không khỏi băn khoăn và thắc mắc.Hãy để chúng tôi giải đáp ngay bằng các thông tin dưới đây.  Xem chi tiết tại: https://blog.itnavi.com.vn/sharepoint-la-gi/
Run python scripts with less typing...
Tags: python, bash, cli
Published: 2020-11-09 10:08:32

When you run a lot of python scripts from the linux command line there is a nice way to save some key strokes. 

You have to put the following in the first line of your script. This is a called a shebang line. Although i have no idea why it has that name. 

```python
#!/usr/bin/env python
```

After this you have to make the script executable. 

```bash
chmod +x generate.py
```

If all this is done, you can just run the script like a regular shell script. 

before:

```bash
python test.py
```

after: 
```bash
./test.py
```
Ngôn Ngữ Lập Trình Là Gì -Các Loại Ngôn Ngữ Lập Trình Hiện Nay
Published: 2020-11-09 10:01:43

Ngôn ngữ lập trình là nền tảng cơ bản để bạn theo đuổi  con đường sự nghiệp IT. Nhưng bạn đã biết ngôn ngữ lập trình nào đang được quan tâm? Xem chi tiết tại: http://nghelaptrinh.net/ngon-ngu-lap-trinh/
Start With Telescope
Tags: opensource, csharp, dotnet, linux
Published: 2020-11-07 04:19:48

We're gonna work on an open-source application called [Telescope](https://github.com/Seneca-CDOT/telescope) which is developed and maintained by Seneca College open-source community in the remaining of this semester. This week's lab is a start for students to set up the environment and get familiar with the application.

It took me a while to set up the environment. Thanks to the PRs I did in Hacktoberfest, I'm getting used to facing difficulties while setting up the environment for application development. The first difficulty I encountered was **low disk space**, as I mentioned in the [previous experience using docker](https://dev.to/yuanleemidori/hacktoberfest-this-is-not-the-end-244g), I knew installing docker engine and running dockerized application are going to occupy at least 2 GB disk space. It is hard for me to free up the spaces anymore. Therefore, I decided to re-partition my hard drive!

My OS is Linux 19.2 Tina, my disk partitions were 20 GB for `/` and about 350 GB for `/home`. I planned to shrink the partition of `/home` and increase the `/` partition. I was trying to use a GUI tool called GParted. However, I found that I wasn't able to unmount the `/home` which means I wasn't able to make any changes on that partition including resizing and moving. I searched for similar issues' posts on different forums, and I got the conclusion that I have to be *not using any process in /home* to unmount the partition. According to those posts on different forums, there should be several ways to achieve it. I've tried some of them, but they did not work. I ended up using [GParted live USB](https://gparted.org/liveusb.php). 

The instructions are quite clear. After 3 hours (most of them are waiting time), I finally got my drive re-partitioned and got a bigger partition for `/`! Hooray!

The rest of setting up environment for Telescope was smooth, the document is quite useful. However, the steps of installing docker might not work on Linux Mint OS. I had this issue while I installed docker by following the steps from the official docker website. I got the solution from some posts in the Linux Mint forum. I'll spend some time to truly figure it out and send the conclusion to the Telescope community and discuss if we should update the document.

The lab for this week is to use the [link checker tool](https://dev.to/yuanleemidori/are-you-a-bad-link-or-a-good-link-fgb) with Telescope. Telescope will return the latest 10 posts with their ids and URLs. Our mission is to use the link checker to check these URLs. What I did to achieve the goal were to fetch the data from the localhost, downloading the string and convert it to JSON objects to access the URL properties, and finally, check the links.

Looking forward to working on Telescope in the upcoming weeks! It is impressed that this project was built by previous students in this course. Can't wait to be part of it.
State of Lambda Functions in 2020 by Dashbird
Tags: serverless, aws, devops
Published: 2020-11-09 09:54:17

2020 - what a ride it's been! The state of the world this year has definitely been unpredictable and ever more surprising. So for some interesting insights and stability, we've turned to Lambdas. Namely, the state of Lambda functions in 2020! 

Ever wondered how others look *without *their face masks on? At [Dashbird](http://dashbird.io/features), we get to *(metaphorically speaking)* see what everyone looks like behind their serverless masks *(read: stacks)*, and identify trends and patterns. Our platform gives us the ability to look at the state of Lambda. Sharing is caring and we're happy to share these insights with you, offering the chance to compare and contrast your Lambda functions to others, or just have a nose around. 

> For reference, here's our article on the [state of Lambda functions in 2019](https://dashbird.io/blog/state-of-lambda-functions-2019/).

What's a "normal" amount of Lambda functions? 
----------------------------------------------

As we know, there is no "normal" but we see an average of 147 Lambda functions per client in total. A slight increase from our 2019 figures of 123 functions. 

![average number of Lambda functions](https://mk0dashbirdioctwpb7t.kinstacdn.com/wp-content/uploads/2020/11/Screenshot-2020-11-08-at-16.20.46-300x135.png)

What about their runtimes? 
---------------------------

Node.js is undoubtedly the most widely used, with Java8 and Python following behind. 

![Lambda runtimes usage](https://mk0dashbirdioctwpb7t.kinstacdn.com/wp-content/uploads/2020/11/Runtimes-usage-1024x728.png)

And, what's the regional spread? 
---------------------------------

There's no change here as us-east-1 and eu-west-1 remain the most popular, but it's great to know that over half of Dashbird accounts use more than one region. 

![AWS Lambda Regions](https://mk0dashbirdioctwpb7t.kinstacdn.com/wp-content/uploads/2020/11/Regions-1024x648.png)

Digging into the Functions 
---------------------------

Let's look at the functions and how they perform now. 

![Average code size](https://mk0dashbirdioctwpb7t.kinstacdn.com/wp-content/uploads/2020/11/Average-code-size-1024x614.png)

![Average memory size](https://mk0dashbirdioctwpb7t.kinstacdn.com/wp-content/uploads/2020/11/Average-memory-size-1024x591.png)

![Average timeouts](https://mk0dashbirdioctwpb7t.kinstacdn.com/wp-content/uploads/2020/11/Average-timeouts-1024x634.png)

We can see that Java leads in all of these areas, which makes sense given its nature of a lengthier startup but also its smooth running once set up. 

X-Ray is being used with 16% of the functions on average
--------------------------------------------------------

![X-Ray usage](https://mk0dashbirdioctwpb7t.kinstacdn.com/wp-content/uploads/2020/11/X-Ray-usage-1024x651.png)

So, how did you compare? What we can say is, everyone has a nose and a mouth under their mask -- they often just look and feel a bit different from yours!
filter() in Python
Tags: python, filter
Published: 2020-11-09 09:47:24

Ce matin, je prends qq minutes pour apprendre la fonction `filter()` de Python. Voici mes notes. Pour l'info, je suis ce tutorial de ce site:

[https://www.liaoxuefeng.com/wiki/1016959663602400/1017404530360000](https://www.liaoxuefeng.com/wiki/1016959663602400/1017404530360000)

============= notes begins here =============
和`map()`类似，`filter()`也接收一个函数和一个序列。和`map()`不同的是，`filter()`把传入的函数依次作用于每个元素，然后根据返回值是**True**还是**False**决定保留还是丢弃该元素。

```python
###  function used for filter() should return result of boolean type

def is_odd(n):
    return n % 2 == 1

a = list(filter(is_odd, [1, 2, 4, 5, 6, 9, 10, 15]))
print(a)    # 结果: [1, 5, 9, 15]

def not_empty(s):
    return s and s.strip()

b = list(filter(not_empty, ['A', '', 'B', None, 'C', '  ']))
print(b)    # 结果: ['A', 'B', 'C']
```

Voici un petit exemple pour tester.

```python
##  check if n is in format such like 121, 1331, 34543, 123321, etc... 

def is_palindrome(n):
    res = []
    while True:
        a = n % 10
        n = n // 10
        res.append(a)
        
        if n == 0 :
            break
    l = len(res) 
    bool_res = True
    for i in range(0, l//2):
        bool_res = bool_res and (res[i] == res[l-i-1])
        if not bool_res:
            break
    return bool_res


### 测试:
output = filter(is_palindrome, range(1, 1000))
print('1~1000:', list(output))
if list(filter(is_palindrome, range(1, 200))) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191]:
    print('测试成功!')
else:
    print('测试失败!')
```
Ce que j'ai eu de ce test:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/p1agr7bxqfkyrygyadli.PNG)
HADOOP Là Gì - Cấu Trúc & Thành Phần Công Nghệ HADOOP
Published: 2020-11-09 09:47:14

Vậy Hadoop là gì? Lịch sử hình thành của Hadoop?Các ưu điểm của Hadoop bao gồm những gì? Tất cả sẽ được giải đáp trong phần tiếp theo của bài viết sau Xem chi tiết tại: https://blog.itnavi.com.vn/cau-truc-va-thanh-phan-cua-cong-nghe-hadoop/
Created a Profile Storage SmartContract and Deployed on XinFin XDC Network.
Tags: blockchain, xdc, xinfin
Published: 2020-11-09 09:44:09

Created a SmartContract in Solidity language to store the user's profile with Name, description, URL, Image. Deployed the #SmartContract on XinFin XDC Network.
Check the code here:

`pragma solidity ^0.5.0;
contract Profile {
    struct User {
       string name;
       string subtitle;
       string sdescription;
       string ldescription;
       string weburl;
       string imghash;
    }
    mapping(address => User) public users; 
  function set(string memory _name, string memory _subtitle, string memory _sdescription,string memory _ldescription, string memory _weburl, string memory _imghash) public {
    users[msg.sender] = User(_name, _subtitle, _sdescription, _ldescription, _weburl, _imghash);
  }
  function get() public view returns (string memory, string memory, string memory, string memory, string memory, string memory) {
    return (
        users[msg.sender].name, 
        users[msg.sender].subtitle, 
        users[msg.sender].sdescription, 
        users[msg.sender].ldescription, 
        users[msg.sender].weburl, 
        users[msg.sender].imghash
    );
}}`
How to Craft a Developer Resume
Tags: career
Published: 2020-11-10 04:38:35

---
title: How to Craft a Developer Resume
published: true
date: 2020-11-09 09:38:50 UTC
tags: career
canonical_url: https://giftegwuenu.dev/how-to-craft-a-developer-resume/
---

Do you want to stand out in your job applications, show the recruiter at one glance your abilities and strength? This video will give you tips and ideas for creating a great tech resume that you can be sure will make you stand out in the pool of job applications.

{% youtube akNtVGUUBAw %}

🌱 Timestamps

[0:00](https://www.youtube.com/watch?v=akNtVGUUBAw&t=0s) Intro 

[1:28](https://www.youtube.com/watch?v=akNtVGUUBAw&t=88s) Why you need a great resume?

[2:11](https://www.youtube.com/watch?v=akNtVGUUBAw&t=131s) Tools for creating a Resume

[4:50](https://www.youtube.com/watch?v=akNtVGUUBAw&t=290s) Key sections to include in your resume 

[14:17](https://www.youtube.com/watch?v=akNtVGUUBAw&t=857s) Tips for creating a resume that stands out 

[20:18](https://www.youtube.com/watch?v=akNtVGUUBAw&t=1218s) Outro & Subscribe ❤️ 

[Canva Resume Demo](https://www.canva.com/design/DAEMua0hkjY/RIdjaLf20fj3FiPKApSVHg/view?utm_content=DAEMua0hkjY&utm_campaign=designshare&utm_medium=link&utm_source=publishsharelink)

Hope you enjoy the video :)
How to Installing a Laravel app on Heroku with Database?
Tags: laravel, heroku, database, devops
Published: 2020-11-09 08:27:42


{% youtube 639Pe0PpVLQ %}

## Prerequisites :
* Php and Laravel knowledge
* Heroku user account
* Heroku toolbet (Heroku CLI)
* Git

## Create the project
Any way you like, get your Laravel application initialized.

```
laravel new laravel-heroku
cd laravel-heroku
```

## Add your Procfile
As per the documentation, By default, Heroku serves the files from the root index. So to tell Heroku to serve the app from `public/` directory, you have to make a `Procfile`.

```
web: vendor/bin/heroku-php-apache2 public/
```

## Initialize the git repo
OK, our code is ready to go. Let's get it into git.
```
git init
git add .
git commit -m "Initial commit"
```

## Create the Heroku app
Since you have the Heroku Toolbelt installed, you can create and modify your apps directly from the command line.

```
heroku create
```

output:
```
± heroku create
Creating app... !
 ▸    Invalid credentials provided.
heroku: Press any key to open up the browser to login or q to exit:
Logging in... done
Logged in as me@email.com
Creating app... done, ⬢ app-name-here
https://app-name-here.herokuapp.com/ | https://git.heroku.com/app-name-here.git
```

Add an `APP_KEY`
Generate a new key:
```
php artisan key:generate --show
```

Copy the output of that, and then run this command:

```
heroku config:set APP_KEY=the_key_you_copied_here
```
output:
```
Setting config vars and restarting ⬢ app-name-here... done, v3
APP_KEY: the_key_you_copied_here
```

## Deploy your code to the Heroku app
With Heroku, you push new code to your site by pushing to the heroku git remote.

```
git push heroku master

```
output:
```
----> Launching... done, v3
       http://app-name-here.herokuapp.com/ deployed to Heroku
```

Now it is deployed on heroku. And your laravel app is on `http://app-name-here.herokuapp.com/` url.

Reference
- **[Deployment of Laravel app on Heroku with database](https://www.youtube.com/watch?v=639Pe0PpVLQ)**
- **[Install Laravel app on Heroku with database](https://qirolab.com/posts/how-to-deploy-a-laravel-application-to-heroku-with-database-1604920912)**
What are your favorite VS Code extensions?
Tags: discuss, vscode, productivity
Published: 2020-11-09 09:36:37

---
title: What are your favorite VS Code extensions?
published: true
description: 
tags: discuss, vscode, productivity
cover_image: https://i.ytimg.com/vi/O1Eg29E7BGU/maxresdefault.jpg
---
VS Code extensions let you add languages, debuggers, and tools to your installation to support your development workflow. 

Some of my favs include [Settings Sync](https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync), [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode), [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint), [Bracket Pair Colorizer](https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer), [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker), [Better Comments](https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments), [Path Intellisense](https://marketplace.visualstudio.com/items?itemName=christian-kohler.path-intellisense), [Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer), [ES7, React, Redux & GraphQL Snippets](https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets), [GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens), [Markdown All in One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one).

Curious to see what are your favorites?
Code less, code smart! 
Tags: productivity
Published: 2020-11-09 09:35:50

You've probably heard this sentence in a slightly different way:
> Study less, study smart! - Marty Lobdell 

The author of this book tried to explain How can you boost your productivity by studying smart and following some steps to reduce the amount of effort and put it into something valuable. 
*I am going to do the same thing here but with coding*. 

1. **Know your Syntax!** 
Coding is basically knowing the syntax of a programming language add-up to some problem solving skills. But wouldn't it be more efficient and time saving if you found out that you can transform your 30 lines of code into 10 lines? That would be awesome right?
In order for you to achieve such thing, you need to be more familiar with the language syntax. to highlight the best possible choice that suits your needs. There are many alternatives you can choose from. You just need to dig deeper. 

2. **Think!** 
*Yeah, I know*
In my CS class the moment we start looking for a solution to the problem at hand more than 90% of the students dive into coding without taking a minute to actually think. and actions like this will lead you to many bugs and errors.
The point here is that before leaning your fingers into keyboard and start typing take a minute to think: How can I solve this problem? what am i going to do at first? ..etc
-- Take a breath. Think, Solve the problem (Algorithm), Implement the solution. 

3. **Code, Fix, Upgrade, Repeat!** 
The first piece of code you've written is not your best version. Always try to optimize your code to the ideal version you can possibly get. You're an artist, you have to make sure you give it all for your best work. 
Don't forget to stop at each code-block and think. Review your code as and markup your plan as much as possible. Doing that can reduce a huge amount of time you would've spend on debugging and fixing logical-errors. 


I hope you liked this one. It is the first version, I will come back later to optimize it :3 
@KMx404
Fix Mongo db Compass 'Initializing' screen error
Tags: mongodb, errors, issue, fixed
Published: 2020-11-09 09:26:52

## 👨‍💻 Finally Fixed

### _Namaste everyone !_

---

While installing a new software 80% percent chances are that your software will run perfectly fine,
but sometimes due to improper installation, the software does not work properly and finding the issue and then solution for it is quite time consuming also sometimes hard to find the solution

---

While installing _MongoDB Compass_ on your machine many of you must have been stuck on your `INITIALIZING COMPASS / ACTIVATING PLUGINS` screen and unable to fix it.

---

I came across the same issue and was unable to find a way to fix it,
In the developers tools in compass there was an error message shown

```
Error: Command failed: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption
'powershell' is not recognized as an internal or external command,
operable program or batch file
```

---

This occurs most probably because of **Windows failing to add the MongoDB path** so we have to do that manually.

This error can be resolved easily by just adding
```
C:\Windows\System32\wbem
```
in your `path` of `user variables` in `Environment variables`

---

> ### **_Just follow the steps :_**

* **Copy** (above path)
* goto **Advance system settings** 
* select **Advanced** 
* select **Environmental Variables** 
* select **Path** (User variables) 
* **Edit** 
* **New** 
* **Paste** and OK.

### `Reopen you Mongodb Compass`

---
### _And Viola it's resolved_ 🚀💯