teleren/devto huggingface dataset:
How to create installers for your Python application?🤔
Tags: python, ubuntu, pyinstaller, windows
Published: 2021-12-20 08:25:26

## Requirements
1. Debian operating system.
2. Windows operating system with Python 3, pip and inno setup installed.

## Creating inno setup installer (on windows)
In order to create an installer, we must convert the application script to executable. We can do this using pyinstaller.  
Step 1: create a directory `my_app`.  
Step 2: Create a new file `my_app/app.py` and copy the following contents to it:
```
import tkinter as tk

root = tk.Tk()
tk.Label(master=root, text="Hello world", font=("Arial", 30)).pack()
root.mainloop()
``` 
Step 3: Navigate to `my_app` directory and run the following command in CMD:  
```
pip install pyinstaller  
pyinstaller --onefile app.py -w
```
Step 4: Wait for the command to complete and open inno setup compiler.  
Step 5: On the inno setup welcome screen, click "Create a new script file using the Script Wizard" and hit ok.  
Step 6: Follow on screen instructions (main executable file is in `my_app/dist/app.exe`).  
Step 7: Compile the script and done!

## Creating deb package (On Debian OS)
Just like windows, we must create an executable from our script for deb package.  
Step 1: Create a directory `my_app`  
Step 2: Create a new file `my_app/app.py` and copy the following contents to it:
```
import tkinter as tk

root = tk.Tk()
tk.Label(master=root, text="Hello world", font=("Arial", 30)).pack()
root.mainloop()
```
Step 3: Navigate to `my_app` directory and run the following command in terminal:
```
pip install pyinstaller
pyinstaller app.py -w
```  
Step 4: wait for it to complete and create the following directories.  
```
my-app_1.0.0/DEBIAN
my-app_1.0.0/my_app
my-app_1.0.0/usr/share/applications
```  
Step 5: Create a file `my-app_1.0.0/DEBIAN/control` and copy the following contents into it.  
```
Package: my-app
Version: 1.0.0
Architecture: all
Maintainer: [Your name]
Copyright: [year] [Your name]
License: MIT
Homepage: [homepage url]
Description: My deb package.
```  
Step 6: Create a file `my-app_1.0.0/usr/share/applications/my-app.desktop` and copy the following contents into it.  
```
[Desktop Entry]
Type=Application
Exec=/my_app/app
Hidden=false
NoDisplay=false
Name=My app
Comment=My app.
```  
Step 7: Copy all files and folders from `my_app/dist` to `my-app_1.0.0/my_app`  
Step 8: navigate to the parent directory of `my-app_1.0.0` and execute the following command:  
```
dpkg-deb --build my-app_1.0.0
```  

Step 9: Wait for it to complete and done! You will find a deb package named `my-app_1.0.0.deb`
### [About me](https://jothin.tech)
### [![About me](https://cdn.jothin.tech/21366.png)](https://jothin.tech/)

**Thank you!**

Original article: https://blog.jothin.tech/how-to-create-installers-for-your-python-application
Advent of PBT 2021 - Day 20
Tags: challenge, testing, webdev, javascript
Published: 2021-12-20 09:17:50

---
title: Advent of PBT 2021 - Day 20
published: true
description: Advent of Property Based Testing - Day 20
tags: challenge,testing,webdev,javascript
//cover_image: https://direct_url_to_image.jpg
---

> _Advent of PBT 2021 — Learn how to use property based testing and [fast-check](https://github.com/dubzzz/fast-check) through examples_

Our algorithm today is: **drawTree**.
It comes with the following documentation and prototype:
```ts
/**
 * Draw a tree with:
 * - a trunc made of '^',
 * - leaves on the left made of '('
 * - and the ones on the right made of ')'
 *
 * @param size - Size of the tree >=1
 */
declare function drawTree(size: number): string;
```

We already wrote some examples based tests for it:
```ts
it("should be able to draw a tree of size 1", () => {
  // prettier-ignore
  expect(drawTree(1)).toEqual(
    "^\n" +
    "^\n" +
    "^"
  );
});

it("should be able to draw a tree of size 2", () => {
  // prettier-ignore
  expect(drawTree(2)).toEqual(
    " ^\n" +
    "(^)\n" +
    " ^\n" +
    " ^"
  );
});

it("should be able to draw a tree of size 5", () => {
  // prettier-ignore
  expect(drawTree(5)).toEqual(
    "    ^\n" +
    "   (^)\n" +
    "  ((^))\n" +
    " (((^)))\n" +
    "((((^))))\n" +
    "    ^\n" +
    "    ^"
  );
});
```

How would you cover it with Property Based Tests?

In order to ease your task we provide you with an already setup CodeSandbox, with examples based tests already written and a possible implementation of the algorithm: https://codesandbox.io/s/advent-of-pbt-day-20-61ylb?file=/src/index.spec.ts&previewwindow=tests

You wanna see the solution? Here is the set of properties I came with to cover today's algorithm: https://dev.to/dubzzz/advent-of-pbt-2021-day-20-solution-43nm

---

[Back to "Advent of PBT 2021"](https://dev.to/dubzzz/advent-of-pbt-2021-13ee) to see topics covered during the other days and their solutions.

More about this serie on [@ndubien](https://twitter.com/ndubien) or with the hashtag [#AdventOfPBT](https://twitter.com/search?q=%23AdventOfPBT).
Multiple Apis With ForwardsCalls Trait - Laravel
Tags: php, laravel, programming, tutorial
Published: 2021-12-20 09:08:15

Let's start quickly. I found an advanced way to call the api via ForwardsCalls and I want to share it with you.
First you create an Api.php page
```php
<?php

namespace App\Http\Apis;

use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Traits\ForwardsCalls;

abstract class Api
{
    use ForwardsCalls;

    protected PendingRequest $http;

    public function __construct()
    {
        $this->http = $this->initialize();
    }

    public function __call($method, $params)
    {
        return $this->forwardCallTo($this->http, $method, $params);
    }

    public abstract function initialize(): PendingRequest;
}
```
Create a Laratips Api.php page to take from the previous page
```php
<?php

namespace App\Http\Apis;

use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;

class LaratipsApi extends Api
{
    public function initialize(): PendingRequest
    {
        return Http::acceptJson()->baseUrl('http://laratips.test/api');
    }
}
```
So we come to the summons
```php
<?php

namespace App\Http\Controllers;

use App\Http\Apis\LaratipsApi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;

class DashboardController extends Controller
{
    public function index(Request $request)
    {
        return (new LaratipsApi)->get('users');
    }
}
```
It is also possible to call fakeapi and take a certain part of it I create a FakeStoreApi.php page
```php
<?php

namespace App\Http\Apis;

use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;

class FakeStoreApi extends Api
{
    public function initialize(): PendingRequest
    {
        return Http::acceptJson()->baseUrl('https://fakestoreapi.com');
    }    
}
```
So we come to the summons
```php
<?php

namespace App\Http\Controllers;

use App\Http\Apis\FakeStoreApi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;

class DashboardController extends Controller
{
    public function index(Request $request)
    {
        return (new FakeStoreApi)->get('products', [
            'limit' => 2
        ]);
    }
}
```
Source :- https://github.com/Laratipsofficial/tips-and-tricks/tree/laravel-feature/forwards-calls
Source :- https://www.youtube.com/watch?v=vzgNm86ezWE

I hope you enjoyed the code.
Day 96/100 Data Types
Tags: 100daysofcode, programming, javascript, motivation
Published: 2021-12-20 09:05:09


![banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h7w1rm52c041ih9k8q8o.png)

**Seven fundamental data types:**
- *Number*: Any number, including numbers with decimals: `4`, `8`, `1516`, `23.42`.
- *String*: Any grouping of characters on your keyboard (letters, numbers, spaces, symbols, etc.) surrounded by single quotes: `' ... '` or double quotes `" ... "`. Though we prefer single quotes. Some people like to think of string as a fancy word for text.
- *Boolean*: This data type only has two possible values— either `true` or `false` (without quotes). It’s helpful to think of booleans as on and off switches or as the answers to a “yes” or “no” question.
- *Null*: This data type represents the intentional absence of a value, and is represented by the keyword `null` (without quotes).
- *Undefined*: This data type is denoted by the keyword `undefined` (without quotes). It also represents the absence of a value though it has a different use than `null`.
- *Symbol*: A newer feature
to the language, symbols are unique identifiers, useful in more complex
coding. No need to worry about these for now.
- *Object*: Collections of related data.

## Code Snippets

```
var prices = [1.23, 48.11, 90.11, 8.50, 9.99, 1.00, 1.10, 67.00];

prices[0] = 2.33;
prices[2] = 99.00;
prices[6] = 3.00;

for (var index = 0; index<prices.length; index++){
    if(index===0){
       prices[index]=11;
    }
    else if(index===2){
       prices[index]=33;
    }
    else if(index===6){
       prices[index]=77;
    }
}
console.log(prices);

```

## Summary
Yesterday was the 2nd "Surprise" Drill in Technical line. Luckily, the electricity came back later the day and same time got extensions to pay the bills. I'm so coward that I could not afford to pay the bills on time, now I must submit my small useful blog on the same posting time.

[![resource](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/adu49y49en9cwc9fx8br.png)](https://blog.thepete.net/blog/2020/10/29/roadtrip-product-engineering-planning/)
A self-made funny animation series for programmers
Tags: motivation, programming, beginners, discuss
Published: 2021-12-20 08:29:00


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rtlst2bssoy5gya3imim.jpg)
I'm thinking about making a funny animation series for programmers. Here is the first episode: [Learning database, from zero to zero.](https://www.bilibili.com/video/BV1yS4y1Q7cT?spm_id_from=333.999.0.0)

I will upload the series to my [youtube channel](https://www.youtube.com/channel/UC4WkzUDZ4SmHW_wWCspk8ng) vey very soon.

Leave your comments and let me know what you are interested in.
A11y tips: bind label and form controls
Tags: a11y, tips, html
Published: 2021-12-20 08:24:02

Every form control **always needs to have a visible label**, so that the user can know at any time which field is being filled in, even if the `autocomplete` attribute is used in the HTML code.

An icon can also be a visible label as long as it is labeled appropriately.

Therefore, remember to **always bind a label to a form control** using the `for` attribute of the `<label>` to the `id` attribute of the form control, which thus receives its accessible name.

```
<label for="name">Name</label>
<input type="text" id="name" name="name">
```

In this way we obtain 3 advantages:
- The area to activate the form control is larger, since by clicking on the `<label>` the associated form control receives the focus.
- When a voice browser gives focus to a form control, it announces its associated `<label>`.
- A user using voice recognition software can activate the form control by saying the name of the associated `<label>`.

A special case is the `<input type="button">` that contain a correct `value` attribute, to which **it is better not to associate any label** as it can interfere with how some assistive technologies parse the form control. The same goes for `<button>`.
css media query
Published: 2021-12-20 07:49:35

Name: Choyon Das
Topic: Media Query css
Media Query CSS
Media query is an important tool for web development. People who are involved with web development should use media query tools. We use media query CSS to make our website responsive for different devices. For example, we can set the min-width and max-width and according to the width we can manage some components inside the website. This will make our website more attractive to the user. Nowadays this is a valuable part of responsive web design, as they allow us to create different kinds of layouts we can manage them depending on the viewport.
Media query is essential if we want to make any form of mobile responsive website design.
the syntax of writing media query:
@media media-type and (media-feature-rule) {
  /* CSS rules go here */
}
The syntax consists of the following topics:
•	At first, we should write @media. It’s a basic standard to write media queries. 
•	then we should specify the media types. There are several types we can use in the media query. For example(all, print, screen, speech). This media type will tell the browser for which media we use this code.
•	The next thing is a media expression, which should be a rule or any kind of condition. For example, we can add min-width or max-width.
•	The final thing is to set a CSS rule that will change our website. This CSS style will be applied according to our requirements.

For example:
Let’s insert some HTML code. 
<h1 class=”title”>Title</h1>
<p class=”subtitle”>Yunnan University</p>
Using CSS we can add some style for example we can change the color of the font:
Let’s write some CSS code to change the default font size and change the color:
.title{
Font-size:20px;
color:blue;
}
.subtitle{
Font-size:12px;
}
Using media query we can modify the style as our requirements.
@media all and (max-width:500px){
Body{
Color: blue;
}
}
Using this media query we can change the background color when the viewport will be less than or equal to 500px; if the size of the device is less than 500px then the background color will be blue.
We can also use media query in the following way:
@media all and (orientation: landscape ){
.title{
Color: red;
}
}
If the width of viewport is greater than the height then the text color of the title will be changed.
@media all and (orientation: portrait){
.subtitle{
Color: green
}
}
If the height Is larger than the width then the color of subtitle will be green.
We can use two statement together so that if two statement is true then the css will be applied:
@media all and (orientation:portrait)and (max-width:500px){
.subtitle{
Color:green
}
}
Building a REST API in Fastify
Tags: node, javascript, beginners, tutorial
Published: 2021-12-20 07:45:54

Create your first REST API with Fastify in Node.js with CRUD operations: Setup a fastify server with autoloading, create dummy data with Faker, add plugins (CORS), and integrate Swagger to document and test the API.

{% youtube 7p6J6sCKh3E %}
[Discord Event]Plato Talk-Share Views, Ideas, Suggestions Based On The Talk Topic 
Tags: privacy, devops, beginners, discuss
Published: 2021-12-20 07:15:17

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7eleqlgoc0t3at8bf2vf.png)
 
LatticeX Foundation connects with developers around the world through the Computation Fund. It aims to promote the development of distributed computation, blockchain, cryptography, artificial intelligence, and privacy-preserving computation while recruiting and supporting developers to jointly build a digital utopia. To this end, we strive to bring more global developers to PlatON and foster distributed intelligent agents who share our visions. Step by step, PlatON will build an autonomous open-source tech ecosystem.
To build an active community where discussions and exchanges are encouraged, we will hold Plato Talks so that users could air their views on privacy preservation, cryptography, and AI and offer inspirations for the development of PlatON.

Plato Talks encourage free discussions about the research and experiment of PlatON’s various functions during the life cycle of data, as well as the building of a closed loop that incorporates the privacy preservation of on-chain data, privacy-preserving storage of off-chain data, data capitalization, privacy-preserving computation, data trades, and algorithm/model trades.

## :point_right:How to participate
Each “Plato Talks” is given a topic. Participate in the activity by replying to your opinions, ideas, and suggestions on Discord(plato-talk)based on the topic.

> Discord（plato-talk）: https://discord.gg/CGz3cSfn9J 

Invite others to like your message and the user with the most likes will be rewarded.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r7e1jtkyca52ly0fjv16.png)

## :gift:Plato rewards
Users are encouraged to invite members of the PlatON community to like their views and suggestions, and the top 5 users (ranked by the total number of likes within 48 hours, excluding invalid replies) will receive awesome rewards from PlatON.
image

## :gift_heart:Participation reward
The first 5 users (excluding invalid replies and the above prize winners) participating in discussions will receive the participation reward.
image

_Notice
Only replies under discussions relating to the specified topic will be regarded as valid.
The rewards will be distributed the next Friday after the end of the event._


> **About PlatON：**
> PlatON Website：platon.network/en
> Alaya Website：alaya.network/en
> PlatON Privacy-Preserving Computation WhitePaper: link.medium.com/hHaZHcz9Djb
> PlatON 2.0 WhitePaper：link.medium.com/KCbkhaG9Djb
> PlatON 2.0 PPT：slideshare.net/ShiHeng1/privacypreserving-a..

> **Developer Program：**
> Hackathon：github.com/AlayaNetwork/Alaya-Season-Hackat..
> Grants: latticex.foundation/grants
> Dev-Bounty：github.com/LatticeX-Foundation/dev-bounties

> **Contact：**
> Twitter：twitter.com/PlatON_Network
> Discord：discord.gg/jAjFzJ3Cff
> Dev-Telegram：t.me/joinchat/LhO63AsZ_iozZGNl
Versioned documentation on  Azure
Tags: azure, webdev, devops, mkdocs
Published: 2021-12-20 07:10:21

[MKDocs](https://www.mkdocs.org/) is maybe an older product when it comes to easy lightweight documentation sites. But it is so simple, for building powerful, and easy to read documentation. Built on top of [ReadTheDocs](readthedocs.org)

Some of the cool features:
- version control
- simple search (yet powerful)
- easily write simple, yet powerful pages with Markdown syntax
- Static, lightning fast

For a professional site, we needed a simple documentation site for the users to find helpful things.

As with all things in the real world, the documentation was not scheduled, or planned - but needed. Instead of using a PowerPoint as documentation or user guide, I remembered I once had stood in a similar situation, where we ended up using [MKDocs](https://www.mkdocs.org/)

In order to create it using webapps, all we need is a yaml file in the root of our project `azure-pipelines.yml`

which will contain our pipeline behavior:

``` yaml
trigger:
- main

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '3.6'

- script: pip install mkdocs
  displayName: 'installing mkdocs'

- script: 'mkdocs build --clean'
  displayName: 'build mkdocs'
    
- task: AzureRmWebAppDeployment@4
  inputs:
    ConnectionType: 'AzureRM'
    azureSubscription: 'Name of subscription with ID (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)'
    appType: 'webAppLinux'
    WebAppName: '{appname}'
    packageForLinux: 'site/'
    RuntimeStack: 'STATICSITE|1.0'
```

The first part
```yaml
trigger:
- master
```
just sets the trigger, for the pipeline. `-main` is the branch we will listen for. So everytime we push changes to the `main` branch
How to read / make sense this multiple JOINS SQL query properly?
Tags: help, sql
Published: 2021-12-20 07:01:55

The query goes like this
```sql
SELECT
...
FROM
    A
    RIGHT OUTER JOIN (
        SELECT
            b1,
            b2,
            b3
        FROM
            B
    ) AS BB
    INNER JOIN (
        SELECT
            c1,
            c2,
            c3
        FROM
            C
    ) AS CC ON BB.b1 = CC.c1
    INNER JOIN D ON CC.c2 = D.d2 ON A.a2 = D.d2
```
That query above returns a table. The problem is the syntax is so weird to me. I can't read and make sense of it the way the writer intended. I didn't even know which table is on which side.

[Let's be friend 👋](https://beacons.ai/ranggakd)
Check assembly version in Azure WebApp
Published: 2021-12-20 07:01:33

If you need to verify dll versions in Azure WebApp, do the following.

1\. Go to Kudu from "Advanced Tool".

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w18v7376lauiduhbjwnn.png)

2\. From "Debug console", select Powershell.

3\. Run following command. In this case, I try to find all files includes "json.dll".

```powershell
ls -fi  *json.dll -recurse | % versioninfo
```
 
4\. You will find version like below.

```powershell
13.0.1+ae9fe4... 13.0.1.25517     C:\home\site\wwwroot\Newtonsoft.Json.dll  
```
What’s the connection between Virtual Space and Fintech?
Tags: webdev, programming, tutorial, devops
Published: 2021-12-20 06:53:24

It is possible like there’s going to be an emphasis in virtual reality and digital assets block chain, crypto and most frequently,video games actually the Meta verse can provide many more diverse and infinite opportunities for various sectors . The Meta verse is anticipated to become an essential digital platform that can be used for business and personal interactions, which includes financial transactions.

In reality, it is believed that the management of financial data and the techniques for managing financial transactions that are offered by fintech solutions that are comparable to real life is the key indicators to make the virtual world essential as the real world.

Imagine a virtual universe where objects, buildings, clothes or even avatars can be sold and bought just as on the ground. Or where you can stroll around buildings and take part in events that take place in the virtual world. This creates a vast economic ecosystem.

There are financial players who have entered the meta world rapidly in order to establish themselves as the leaders of technology-driven financial. According to The Korea Times reported in August 2021, brokers as well as banks from Korea have already started to develop interactive virtual spaces for their customers.
C# : Advanced LINQ - Use Subquery and Left Outer Join 
Published: 2021-12-20 06:53:20

LINQ is great tool to write query for any data source, but I sometime have no idea how to write correct code to execute what I want to run.

I am writing this blog for myself as I am sure to forget this sooner or later :)

# Left outer join

[Perform left outer joins](https://docs.microsoft.com/en-us/dotnet/csharp/linq/perform-left-outer-joins) explains details of how to write left outer join with LINQ.

The point is to use ``into`` and ``DefaultIfEmpty()`` method on it.

```csharp
var query = from person in people
   join pet in pets on person equals pet.Owner into gj
   from subpet in gj.DefaultIfEmpty()
   select new 
   {
       person.FirstName, 
       PetName = subpet?.Name ?? String.Empty 
   };
```

# Subquery

Subquery is more straight forward. We can use subquery both in ``new`` section and ``in`` section. If query gets longer, we can also define subquery as separate query and use it in main query.
Lightue 0.1.2 released
Tags: javascript, vue, react, lightue
Published: 2021-12-20 06:34:22

[link to github](https://github.com/smalllong/lightue)

Lightue is a startup front-end framework inspired by Vue and React. It features in lightweight and low overhead, which makes it suitable for small personal projects. The new versions add these new features:

- function value as the getter
- html shortcut methods
PinoyFlix
Published: 2021-12-20 06:33:55

Welcome to Pinoy Teleserye TV Replay, Watch your favorite Teleserye, <a href="https://pinoystambayantv.su" target="_blank" rel="noopener">Pinoy Tv Shows</a>, Pinoy Tambayan, Lambingan, Pinoy TV, Pinoy Channel Online.