teleren/devto huggingface dataset:
Adding options to CLI commands
Tags: python, cli
Published: 2019-08-07 09:47:22

In the previous post, we used `setuptools` to package our app and enable us to run it using a single executable command `hello`. In this post, we look at how to make CLI apps more functional and interactive using options.

## Options

Options are used to alter the default behavior of commands. This is often accomplished by passing in parameters in the form of `--option` or `-o` for short.

Let's assume that instead of just printing out "Hello World!", we wanted to have the option of printing it in all lowercase characters or all uppercase characters. We can add this functionality by adding an `option()` decorator.

```python
# helloworld.py

import click

@click.command()
@click.option('-c', '--case', type=click.Choice(['upper', 'lower']))
def hello(case):
    if case:
        click.echo('You selected {} case.'.format(case))
    # click.echo('Hello World!')
```

~~Every time a change is made to the code, we'll have to install the app again and run it to see the changes.~~
Edit: I was wrong about this. The only time you have to reinstall is when you make changes to `setup.py`. Thanks to [Fernando](https://dev.to/kodaman2) for the heads-up.


Then run the app, passing in the created option:

```bash
(venv) $ hello -c upper  # --case would also work
You selected upper case.
```

```bash
(venv) $ hello -c lower
You selected lower case.
```

Now try passing in some other option, like "normal":

```bash
(venv) $ hello -c normal
Usage: hello [OPTIONS]
Try "hello --help" for help.

Error: Invalid value for "-c" / "--case": invalid choice: normal. (choose from upper, lower)
```

It gives us an error: `invalid choice: normal` and even guides us on the options to choose from `(choose from upper, lower)`, since that's what we specified `type=click.Choice(['upper', 'lower'])`. Error handling on that part is handled by default.

Ok, now that the option is passed in successfully, we can add in the logic to see our desired output.

```python
import click

@click.command()
@click.option('-c', '--case', type=click.Choice(['upper', 'lower']))
def hello(case):
    response = "Hello World!"
    if case == 'upper':
        click.echo(response.upper())
    elif case == 'lower':
        click.echo(response.lower())
    else:
        click.echo(response)
```

All we've done is add an `if-else` to check the option passed in, and return the text in either upper case, lower case, or just normal. Now when we install our app again and run it, we get these results:

```bash
(venv) $ hello
Hello World!

(venv) $ hello -c upper
HELLO WORLD!

(venv) $ hello -c lower
hello world!
```

In the next post, we'll enhance our command even more by adding arguments.
Mobile Solution for Your Business
Tags: devops
Published: 2019-08-07 09:22:30

Mobile applications have become a popular trend and striking attribute of the modern world. Every day you can run across success stories of applications upswing and business cases related to app business growth. But what kind of businesses are now interested in having their own mobile applications? Maybe it is not that much needed as it may seem? Who is likely to use the application more than the site?

The main thing to understand here is that the application is just a tool behind which the most complex business processes take place. Mobile applications and mobile-friendly site have much in common but still their functions are different, so it is very important to know what would meet your business needs best.


We tried to outline the key features of each: 

an application can send push notifications to the user, information resulting in a good conversion if properly configured. This is not just a tool for sales and pre-sale, but also an array of messages about promotions and important company news. Mobile - friendly site, however, requires interaction with the clients: they need to open the browser, enter the site address and go to the website page directly or through the link from the post / SMS.
applications are aimed at loyal audience, >which will agree not just install, but also use the application on a regular basis. Speaking about the mobile-friendly site, a wide and diverse army of visitors lands on its pages: loyal customers, potential customers, competitors, partners, etc. So, applying comprehensive business approach, we can call these tools as different marketing channels for working with different segments of the client base;
most applications allow you to make at least part of the functionality work offline, while the mobile-friendly site requires a constant connection to the Internet.
the cost of building a high-quality application today is in the range of the development of the website. However, to reach the maximum audience with a mobile application, you need to develop it for at least three popular operating systems (iOS, Android and WinPhone).
Nevertheless, both types of this mobile-friendly technologies can help you to increase sales, get new customers as well as build trust and credibility.
Sources:
https://itmaster-soft.com/en/mobile-application-development-services
Started bpsfilter screen
Tags: popos, linux, ubuntu, bpsfilter
Published: 2019-08-07 08:49:34

---
title: Started bpsfilter screen
published: true
description: 
tags: pop_os, linux, ubuntu, bpsfilter
---

I updated nvidia driver and system update 2 day ago. Yesterday I faced this screen. I can't open laptop. Do you have any clue for this problem?
A maze called VPN logging policies 
Tags: security, privacy
Published: 2019-08-06 06:10:26

It would be an understatement to say that online privacy is a big issue today. Facebook-Cambridge Analytica, NHS handing over patient data to machine learning companies, and the list goes on and on. 

It's almost as if our private information is a free giveaway that companies obtain from us, often under false pretense, only to be sold to third-party companies to learn about us and throw personalized ads our way. Or for more nefarious purposes like influencing voter behavior in general elections.

In these state of affairs, it is natural to search for measures for improving your online privacy. VPN services are on the frontline of privacy protection tools and their usage is getting more popular everywhere in the world.

The unfortunate conundrum here is that VPNs can often be complicit in keeping logs of your data and even sell them to third-parties. The very tool that people rely on to stay safe on the web can actually be the culprit violating their privacy. 

Every VPN service provider has a privacy policy page where they must specify if they keep logs. But the question that should immediately arise is: what kind of logs does a VPN keep? 

This is where things get a little complicated. Most providers advertise themselves as being a "no-logs" service. But if you dig deep and read their privacy statements, you realize that they do keep logs, which may or may not be that big of a deal. 

It is impossible for any software tool like a VPN to work without keeping some user information such as payment IDs, transaction history, and in many cases IP addresses of users. 

What needs to be remembered is that not all data is equally hurtful to your privacy. Information about your bandwidth usage alone can't reveal all that much. But if that information is combined with other pieces of data such as your DNS, IP address, traffic, and connection timestamps, that's probably a situation that you need to worry about.

So, how can you decide if a VPN isn't keeping any more tabs on you than it absolutely needs to operate business? 

VPNs should not keep logs about your timestamps, IP address, DNS, and traffic. Period. Some providers keep none of these logs while others may retain some of this information.

To see logging details of popular VPN services at a glance, I created a VPN comparison spreadsheet. 

You can find this sheet here: https://www.vpnranks.com/vpn-comparison/

**Further reading** 
https://www.vox.com/policy-and-politics/2018/3/23/17151916/facebook-cambridge-analytica-trump-diagram

https://www.independent.co.uk/life-style/gadgets-and-tech/news/google-nhs-health-app-deepmind-artificial-intelligence-ai-privacy-streams-app-a8633316.html

https://hackernoon.com/what-vpn-services-arent-telling-you-about-data-logging-4ce15e4c90f0
Map object keys to vars and populate from values
Tags: codepen
Published: 2019-08-07 08:04:28

{% codepen https://codepen.io/rebelclause/pen/GVQNOQ %}

Template literals to the rescue, doing things tap dancing in the neighbourhood had already forbidden!

For the codepen, use 'global' in place of 'window' for Node, as Node has no window object, though I do wonder about server side headless rendering with the likes of rendertron, and others. Perhaps someone here has a perspective on it.

Also, for your consideration, as the left hand side shows destructuring doing both calculation and assignment:

```
soapand = [
    {name: 'far',
    email: 'quad'},
    {name: 'car',
    email: 'squad'}
]

// let {name: `${'wingedAngel'}`, email} = soapand
// global[`wingedAngel`] = `${}`
refreshed = soapand.map((item, idx) => {
    // console.log(item)
    window[`wingedAngel`] = `${item.name}`
    mad = ['holyWater']
    window[`${mad[0]}`] = item.email
    // window['holyWater'] = item.email
    return wingedAngel + ' ' + holyWater
})

// window[`wingedAngel`] = `${soapand[0].name}`
// window['holyWater'] = soapand.email
console.log(refreshed)
console.log(wingedAngel)
console.log(holyWater)
```


I was pretty happy about finding an obscure one line reference to this in MDN documentation. I hope this bit of movie magic helps you in some way.
Deleting repositories using Octokit
Tags: github, ruby
Published: 2019-08-07 08:02:31

I was trying to delete a few repositories from my GitHub account which had issues, but deleting one by one was cumbersome. Also, every time when you have to delete the repository, you have to type the repository name. So I googled and I found an amazing ruby gem [octokit](https://github.com/octokit/octokit.rb) which helped me to delete the selected repositories. I would really love to get feedback on my code. 

```
require 'octokit'

client = Octokit::Client.new(:login => 'USERNAME',
                             :password => 'PASSWORD')
repo_hash = {}
client.repositories('USERNAME').each do |i|
 repo_hash[i["id"]] = i["name"] #collecting ID as key and name as value
end

#array of repositories I wanted to delete
repos = ["ABC","XYZ","PQR"]

del_repos = []
repos.each do |repo|
  del_repos << repo_hash.key(repo) #delete_repository needs ID 
end

del_repos.each do |i|
  client.delete_repository(i)
end
```
How to be a Python developer?
Tags: discuss
Published: 2019-08-07 07:59:19

---
title: How to be a Python developer?
published: true
tags: discuss
---

Hi coders,

I'm a novice developer, I started writing code for one month and I really feel stuck in some concepts.
I think it is very important to have a method to start, but I honestly don't have and I think I have the right approach to programming (I look at many examples and try to understand, but when I have to do a simple exercise I am more often than not blocked because I don't know how to solve that kind of problem).

Many have advised me to approach Python as a language to get started, in fact I'd like to become a developer in Python (I've seen that it has many fields as a language compared to others).

I started reading the book Head First Python, wondering if there were other resources and what is the right approach to configure, or how to solve simple questions and then tackle difficult questions.
They also advised me to read the documentation too, but when I read it I don't understand much, so I would like to ask if there is a way or a method to read the documentation to be able to use it in my problems.
Thank you!!!
---@camicode----
What are some of the good resources to learn Hyperledger fabric blockchain?
Tags: hyperledger, hyperledgerdevelopment, blockchain, blockchaindevelopment
Published: 2019-08-07 07:58:05

Hyperledger Fabric is a permission blockchain infrastructure, originally contributed by IBM and Digital Asset, providing a modular architecture with a delineation of roles between the nodes in the infrastructure, execution of Smart Contracts ("chaincode") and configurable consensus and membership. Hyperledger (or the Hyperledger project) is an umbrella project of open source blockchains and related tools, started by the Linux Foundation, to support the collaborative development of blockchain-based distributed ledgers.

If you are searching for the best company who offer hyperledger blockchain fabric services in USA then I would like to recommend without hesitation you should go with ICODevelopment Company. They have experienced in hyperledger blockchain firm and also they have experienced and talented developing team. With work experience in Hyperledger development projects in Supply chain, Identity management, and Transportation industry they deliver products with quality. Their Hyperledger developers and blockchain experts can help build the Dapps faster and risk-free.

Using Fabric they can create Permission networks for enterprises. Development using fabric requires Identification of Peers, User Interfaces, Smart contract between the peers, Data visibility for different peers.

Hyperledger Fabric: Using Fabric they can create Permissioned networks for enterprises. Development using fabric requires Identification of Peers, User Interfaces, Smart contract between the peers, Data visibility for different peers.

Hyperledger Sawtooth: Hyperledger Sawtooth is an enterprise blockchain platform developed for producing distributed ledger applications and networks

Hyperledger Burrow: Hyperledger Burrow is a permission blockchain node that executes a smart contract code that follows the Ethereum specification.

Hyperledger Iroha: Hyperledger Iroha is intended to be smooth and straightforward to include into infrastructural projects demanding distributed ledger technology.

Hyperledger Indy: They implement Hyperledger Indy for creating independent digital identities rooted on blockchains or other distributed ledgers for interoperability.
Created my First Docker Image! for Self-Hosted HTML5 Internet Speed Test
Tags: javascript, docker
Published: 2019-08-07 07:40:32

This docker image contains the same application running at http://openspeedtest.com. This can run offline! So you can use it to test your Local Area Network or put it on a server to test your line speed to that server. Currently optimised to test speeds up to 1~2 Gbps. You can change the values and files inside this docker and can test even faster connection.

Index.html will be used by default. (Can Run Without Internet Connection)

If you need you can use hosted.html which will only run with an Internet connection and it will save results to our database.

You can view results by registering here http://openspeedtest.com/admin

Download HTML5 Internet Speed Test Application (Speedtest for Home/Office LAN! [Runs Offline!])

Install Docker and run the following command!

1) docker run --restart=unless-stopped --name=openspeedtest -d -p 80:8080 openspeedtest/latest

Now Visit http://localhost/ or http://YOUR-IP/

Testing your WiFi speed you can decide where you need to place your router! or in which direction your need to add a repeater!
React TL;DR – A Human Filter For Most Useful React Content
Tags: react, tldr, todayilearned
Published: 2019-08-07 07:37:48

What is React TL;DR?

In short - it helps you decide which React content is worth your attention. 

Obviously, you can use content tools, but they are easy to fool and collect a lot of crap that doesn’t really help or improve your work and this is why I decided to select the most useful React content myself, with a help of my dev team.

Tidy TL;DR version delivers the essence from the article and helps you decide if it’s worth reading further to you.

Again – I don’t use engines or tools. It is all selected by me and my team, based on what we have learned and gained profit from. No b#$%it provided.

I post them once in a while, and I will also choose best articles each month and make a summary. 

Here's #1 with the content from July. 

https://blog.pagepro.co/2019/08/07/react-tldr-1-a-human-filter-for-most-useful-react-content/

Say hello to React TL;DR – a human filter for most useful React content.

Let me know what you think!
The Open Source World as I View It
Tags: motivation, opensource
Published: 2019-08-07 06:14:18

The word ‘Open Source’, a distinct combination of words that has let to create an ecosystem of self evolving production of ideals and thoughts. If we define the word ‘Open’, it would certainly mean allowing access or passage through something that is empty in space. We can assume by saying filling up the gap or filling up the void. The word source would define to an object or a thing from which some or many things originate or can be obtained. Now in context to the joining of these two words we would come up to a statement, stating that it is to originate from a point a thing which has been allowed access to everyone that gets exposed to it. Therefore, creating an endless cycle of re-origination of that thing by allowing public access to it.

Lets talk about, Tim Berners-Lee, born in the United Kingdom, 8th June 1955, he worked as an English Independent contractor at CERN in switzerland. Tim created something by 1990 for which a lot of companies wanted him to patent it, then in 1993, in the University of California, a person named by Micheal Doyle claims to patent the same technology that Tim didn't. Now did Tim create?. Its called the World Wide Web. At one of the patent trials Tim said patents like these could be a serious threat to the web otherwise the web wouldn't have existed.

Now to take away, just imagine this article you are reading on your phone or browser and all that the web has brought you, if all of a sudden became proprietary, technologies like Linux, Web Servers, Content Management Systems, even dev.to might not even be possible, in this due 30 years of time, from the creation of the web. It has only been possible because open access was given to people like Ben Halpern, Jess Lee and Peter Frank. Imagine not having a youtube or a reddit. Concepts like free to play are branches of open sources, where not only it gives open access to all but new Internet Green Possibilities of seeding money to its creators and this is where in a point of time, minds collide and new opportunities of endless galaxies are formed, for us to create planets in them, some small some large. 

So to take from all this information, i`d say, learn and teach back, collect and create back, knowledge is like abundant rain falling on earth, which makes the soil fertile that absorbed the rain and brought forth vegetation, fruits and grass in abundance. Another portion of it was hard, so it collected and the people benefited from it by utilizing it for drinking for them and their animals. They irrigated it for cultivation, now the third was barren which could neither hold the water nor bring forth vegetation and it gave no benefits. It's called a desert.
The Unfortunate Dominance of English in I.T. (A Programmer's Bill of Rights)
Tags: programming, learning, idealism, languages
Published: 2019-08-07 04:11:55

**A Programmer's Bill of Rights**

- To be able to instruct a computer in their own native language
  - Have variables, field names, and attributes in their own native language

  - Have the programming lexemes semantically significant in their own language

  - Have programmatic components interrelated in a manner significant in their own language

  - Not to have to learn a foreign language to get by

- To be able to share their work with other people without loss of expressivity or meaning

So said Dr. Diarmuid J. Pigott in 2007. And yet the hegemony of the English language, especially in Information Technology, reigns. In the wider political world we decry artificial distinctions based on gender and skin colour and yet don't even acknowledge, let alone address, the distinction based on whether one can read, write and speak English.
Favourite Debugging Trick in Ruby
Tags: ruby, debugging
Published: 2020-01-18 13:59:39

---
title: Favourite Debugging Trick in Ruby
published: true
date: 2019-08-07 03:37:38 UTC
tags: ruby, debugging 
canonical_url: https://cassidy.codes/blog/2019-08-06-favourite-debugging-trick/
---

Last week I wrote about some of my favourite debugging tools in Ruby. I forgot one trick that I find super useful!

Today I was writing a script that would iterate through objects in an S3 bucket and group these objects by similar names. The naming structure looked like this:

```
original.jpg
tumb_original.jpg
profile_original.jpg
```

So all three of those images should get grouped together because they all come from `orignal.jpg`. But I got my name comparison muddled and something wasn’t working right. It would work perfectly for 200 images then it blew up on the 201st!

Printing logs or putting a binding in a loop like this is gnarly. I don’t want to loop through 200 successful iterations to find what I need!

## Conditional Bindings!

To solve this problem, I just made my binding conditional.

```
s3_objects.each do |img|
  binding.pry if img.key =~ /badfilename.jpg/
end
```

This time we’ll only hit the binding if the image key contains the filename that’s giving me grief!