teleren/devto huggingface dataset:
How I Build a MySql plugin for QT5 (Windows, MinGW32)
Tags: qt5, mysql, plugin
Published: 2019-10-21 13:28:33

---
title: How I Build a MySql plugin for QT5 (Windows, MinGW32)
published: true
description: Guide to Build a MySql plugin for QT5
tags: QT5, QT5, Mysql, Plugin
cover_image: https://thepracticaldev.s3.amazonaws.com/i/jg2gxkzdoyt7qdrfwewv.png
---
1.  Download MySql C Connector v6.1.

	>   Download the MySql Installer from:
	>   <https://dev.mysql.com/downloads/installer/>
	>   Install C Connector 6.1 (Note the location we will need it later)
2.  Getting QT Source Ready

	>    To build a plugin for QT u need to get its source. You can install it from Maintenance Tool or manually get it from github repository.

4.  Building Plugin

    1.    Open MinGW CMD (Windows -\> Start Menu -\> Programs -\> Qt 5.13.1 -\>
    5.13.1-\> MinGW 7.3.0 (32-bit) -\> Qt 5.13.1 (MinGW 7.3.0 32-bit) )

    2.  cd to sqldrivers path in qt source
	```
	cd D:\\QT\\Qt5.13.1\\5.13.1\\Src\\qtbase\\src\\plugins\\sqldrivers
	```
    3.   Run qmake here. `qmake sqldrivers.pro` (to create qtsqldrivers-config.pri )

    4.   cd to mysql.
	```
    cd D:\\QT\\Qt5.13.1\\5.13.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\mysql
	```
    5.  Run qmake here. qmake mysql.pro

5.  Add the plugin to the list

    Once successfully build you will find qsqlmysql.dll and qsqlmysqld.dll in
    the following location
`D:\QT\Qt5.13.1\5.13.1\Src\qtbase\src\plugins\sqldrivers\plugins\sqldrivers`

    Copy both qsqlmysql.dll and qsqlmysqld.dll and place them in the compiler’s
    plugin directory
`D:\QT\Qt5.13.1\5.13.1\mingw73_32\plugins\sqldrivers`

<br>
<br>

Error in Building?

1.  Library 'mysql' is not defined.

    In file cd
`D:\QT\Qt5.13.1\5.13.1\Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro`

    Commend the line `QMAKE_USE += mysql`

2.  Adding Library path and Include path.

    Add the following to mysql.pro at end

	    LIBS += -L'C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/lib/'
	    -llibmysql

	    INCLUDEPATH += 'C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/include'

	    DEPENDPATH += 'C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/include'

2.  QSqlDatabase: QMYSQL driver not loaded 
    
    Add the .dll files from C:/Program Files (x86)/MySQL/MySQL Connector C 6.1/lib to D:\QT\Qt5.13.1\5.13.1\mingw73_32\bin
Getting python's pip to behave under Mac OS Catalina
Tags: catalina, pip, macos
Published: 2019-10-21 13:14:56

Pip broken under Mac OS X Catalina? TLDR;

`pip install --global-option=build_ext --global-option="-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/" --global-option="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/" --prefer-binary -r requirements.txt`


As Apple has announced, Mac OS Catalina now runs under its own read only file system:

> macOS Catalina runs on a dedicated, read-only system volume called Macintosh HD. This volume is completely separate from all other data to help prevent the accidental overwriting of critical operating system files. [1]

Sounds great. But if you need to change that volume, or if you use software that expects to be able to find files on that read only volume that aren't there and can't be added, you're kind of stuck.

One example is Python's pip which, for some packages, will expect to find header files located in /usr/include. Apple gave developers a get-out-of-jail-free card in Mojave:

> As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided. [2]

and in true Apple fashion, the package was taken away. This creates problems if you want to install commonly used, but maybe not so commonly maintained, libraries. One example is Pillow, an image processing library. This will well and truly fail to compile if you just try `pip install Pillow`. It looks for the headers and libraries, and doesn't find them.

What can we do? Well, for pip there's a few options. The first is simply not to compile at all, but to prefer a binary. This is as simple in some cases as the `--prefer-binary` option. But what if, like Pillow, there is no precompiled binary for your platform? Or for reasons of information security, you _have_ to compile it yourself?

Fortunately, pip can be directed to look in different places using the "global-options" flag. To get Pillow to build, use the command at the top of this article, reproduced below:

`pip install --global-option=build_ext --global-option="-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/" --global-option="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/" --prefer-binary -r requirements.txt`

To understand this more fully, take a look at https://stackoverflow.com/questions/18783390/python-pip-specify-a-library-directory-and-an-include-directory.

If you need to do a similar function as part of other install tools, common environment variables are `LD_LIBRARY_PATH` (deprecated[3], but still commonly used), `LIBRARY_PATH` and `INCLUDE_PATH`. Setting these to the library paths (/Library ... /usr/lib) and include paths (/Library ... /usr/include) respectively may help.


[1]https://support.apple.com/en-gb/HT210650
[2]https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624
[3]https://stackoverflow.com/questions/18241517/c-include-path-vs-ld-library-path
The Building an Indie Business Podcast- My Failure to Design for Thousands of Users
Tags: podcast, design, startup, webdev
Published: 2019-10-21 13:05:19

In this episode I discuss the gap in my knowledge of knowing how to design a product for thousands of users, why I have this gap, and how I plan to fix it.
[Episode Page](https://baib-podcast.com)
[Revenue Research](https://revenueresearch.co/)

https://overcast.fm/+RG5jnnRpA
React: An Introduction
Tags: beginners, react
Published: 2019-10-21 12:51:26

_**This is the first of a series where we will go from absolute newbies to building functional applications in react.**_

> _React is a JavaScript library for building user interfaces_

React is a powerful tool for creating dynamic web applications that are super-responsive and is created and maintained by **Facebook**.
### Thinking in React.

> In react, separation of concerns is not talking about separating the structure, style and behavior of the application.

Rather it is separating the application into various single-purpose components that come together to for the entire application. So, when building applications using react, you think of the application as a combination of various single-purpose components.
consider the image below:

![todo application with various components](https://thepracticaldev.s3.amazonaws.com/i/iifsne9t8daryjb30yqt.png)

The different components of the application are identified with the rectangles. 
> _**It is important to note that the number of components you have in your application depends totally on you**_

However, it makes it easier to make each component responsible for only one action in your application. This helps to detect bugs easily and gives you the option to reuse each component in other areas of the application.

This post is just to introduce us to the way react allows us to think about our applications. In the next part, we will take a look at how components are created.
React and JSX
Tags: reactjsjsxjavascript
Published: 2019-10-21 12:51:20

---
title: React and JSX
published: true
description: 
tags: reactjs jsx javascript
cover_image: https://ferrariwebdevelopment.s3.us-east-2.amazonaws.com/assets/jsx.jpeg
---

## What is JSX and how to use it

`JSX` is the language used in React. It's similar to `HTML` or `XML`, which is a superset of `HTML`.

We write our React components in `JSX` but the browser doesn't understand `JSX` natively, so we need to have a way to translate `JSX` into Javascript.
When we translate one language into another one, we say that we *transpile*, the language.

`JSX` gets transpiled into Javascript by a program (in our case written in Javascript) that is called a transpiler.
A transpiler is a program that takes code in one language and translates it into another language. The transpiler that is used often with React is Babel.
You can find detailed information about Babel at its [home page](https://babeljs.io).

So, to quickly summarize what we have learned so far:

- we write our React components in a HTML-like language called JSX
- the JSX is transpiled down to Javascript
- the browser executes the transpiled Javascript.

In order to write `JSX` we need support for it into our files, that's why we import React at the top of all our component files.
Without this import, the browser would have trouble understanding the `JSX` syntax in our Javascript files.
The way we import React is to add this import statement at the top of each component file:

```
import React from 'react';
```

This works, as long as we install the necessary Node modules to work with React.
One way to work with React and create and manage React application is through
the `create-react-app` module.
Tomorrow we will learn more about `create-react-app` and how to use it to jumpstart a React application.
TIL: Ecto's pin is coercing
Tags: elixir, ecto
Published: 2019-10-21 12:45:48

## TL;DR

This:

```elixir
query |> where([account], account.owner_id == "42")
```

is *not* the same as this:

```elixir
owner_id = "42"
query |> where([account], account.owner_id == ^owner_id)
```

In the latter case, the value `"42"` is coerced to the integer `42` (if the `owner_id` of an account is an integer according to the Ecto schema).

## Background

Today I found a bug in some code I wrote a long time ago.

The code was supposed to take a map of `atom => String.t` and convert some of the values to integers. But it didn't. And my other code dependent on this still ran without errors!

Time to pick up the Sherlock Holmes monocle and find out why this bug never yielded an actual error.

It turns out I later used the value like so in Ecto:

```elixir
query |> where([account], account.owner_id == ^owner_id)
```

The account's `owner_id` is an integer, but I try to compare it with a string, because of the above bug. And it does not fail!?

I opened up an iex and tried this:

```
iex> Account |> where([account], owner_id: "42") |> Repo.all()
** (Ecto.QueryError) iex:2: value `"42"` cannot be dumped to type :id.
   Or the value is incompatible or it must be interpolated (using ^) so it may be cast
   accordingly in query:

from a0 in Account,
  where: a0.owner_id == "42",
  select: a0

    (elixir) lib/enum.ex:1440: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3 
    (elixir) lib/enum.ex:1440: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
    (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3

```

This fails. Ah, finally some sanity :)

The error message also suggests that I might need a pin operator to interpolate the value. So I tried this:

```
iex> Account |> where([account], owner_id: ^"42") |> Repo.all()
[]
```

And this is why my code did not fail. It was simply ignoring that I had to do with a string and coerced it into a integer.

I thought the pin-operator was only for inserting values of variables, but now I know it also acts as a coercer (or interpolator).
Low Coupling & High Cohesion là gì ? 
Tags: coupling, lowcoupling, cohesion, highcohesion
Published: 2019-10-21 12:42:59

1. Mục đích của giai đoạn thiết kế trong vòng đời phát triển phần mềm là tạo ra giải pháp cho một vấn đề được đưa ra trong tài liệu SRS(Software Requirement Specification). Đầu ra của giai đoạn thiết kế là SDD (Sofware Design Document).
2. Về cơ bản, thiết kế là một quá trình lặp lại gồm hai phần:
 * Phần đầu tiên là thiết kế ý tưởng cho khách hàng biết hệ thống sẽ làm gì.
 * Thứ hai là thiết kế kỹ thuật cho phép người xây dựng hệ thống hiểu được phần cứng và phần mềm thực tế cần thiết để giải quyết vấn đề của khách hàng.

## Thiết kế khái niệm hệ thống:
 * Viết bằng ngôn ngữ đơn giản tức là ngôn ngữ khách hàng dễ hiểu.
 * Giải thích chi tiết về đặc điểm hệ thống.
 * Mô tả chức năng của hệ thống.
 * Độc lập thực hiện.
 * Liên kết với tài liệu yêu cầu.

## Thiết kế kỹ thuật hệ thống:
 * Thành phần phần cứng và thiết kế.
 * Chức năng và phân cấp của thành phần phần mềm.
 * Kiến trúc phần mềm.
 * Kiến trúc mạng.
 * Cấu trúc dữ liệu và luồng dữ liệu.
 * Thành phần I/O của hệ thống.
 * Giao diện hiển thị.

# Modularization
Đề cập đến quá trình phân chia một hệ thống phần mềm thành nhiều module độc lập trong đó mỗi module hoạt động độc lập. Ví dụ : Những nhân viên làm việc về bảng lương, hóa đơn, hồ sơ giấy tờ nên được tách riêng ra thành một bộ phận trong công ty.  Tương tự đối với những nhân viên làm việc liên quan tới coding website, android/iOS app thì cũng nên tách ra thành một bộ phận riêng.
Có nhiều lợi thế của Modularization trong công nghệ phần mềm. Một số trong số này được đưa ra dưới đây:
 * Dễ hiểu hệ thống.
 * Bảo trì hệ thống dễ dàng.
 * Một module có thể được sử dụng nhiều lần theo yêu cầu của họ. Không cần phải viết đi viết lại.

# Coupling
Đề cập đến mức độ liên quan hoặc phụ thuộc của các class/module đối với nhau. Ví dụ : kế toán viên nên làm việc ở bộ phận kế toán.  Web developer nên làm việc ở bộ phận CNTT. 2 bộ phận nên tách rời nhau, không phải xung đột hay phụ thuộc nhau trong quá trình làm việc.
 * Đối với High Coupling sẽ gây khó khăn cho việc thay đổi và duy trì code của bạn, vì các class/module được liên kết chặt chẽ với nhau, nên việc thay đổi có thể yêu cầu viết lại toàn bộ hệ thống.
 * Đối với Low Coupling, việc thay đổi thứ gì đó trong một class/module sẽ không ảnh hưởng đến class/module kia. (Dependency Inversion Principle : xem chữ D trong SOLID)

# Cohesion
Đề cập đến những class/module có thể làm những chức năng nhiệm vụ gì. Ví dụ :  bộ phận kế toán nên làm việc liên quan tới bảng lương, hóa đơn, hồ sơ,... bộ phận kết toán không nên tự ý sửa đổi sourcode của bộ phận phát triển web. Tương tự bộ phận CNTT không nên tự ý sửa đổi tăng lương lên x2.
 * Low Cohesion là class/module thực hiện rất nhiều hành động - phạm vi hoạt động rộng và dàn trãi không rõ ràng và chuyên biệt, không tập trung vào những gì nó nên làm (God Object).
 * High Cohesion là class/module tập trung vào những gì nó nên làm, tức là chỉ các phương thức liên quan đến ý định của Class (Single Repository Principle : xem chữ S trong SOLID).
SOLID là gì ? 
Tags: solid, srp, dependency, interface
Published: 2019-10-21 12:42:50

SOLID là 5 nguyên lý trong thiết kế phần mềm giúp code trở nên dễ hiểu, linh động và dễ bảo trì hơn. 5 nguyên lý trong SOLID bao gồm:
* S: Single responsibility principle
* O: Open/closed principle
* L: Liskov substitution principle
* I: Interface segregation principle
* D: Dependency inversion principle

## S — Single Responsibility Principle (SRP)
A class should have only a single responsibility.
Một class nên chỉ xử lý đơn nhiệm.

```javascript
class Accountant
{
    codeJS() : void ;
}
```
=> correct it
Nhiệm vụ code JS nên được giao cho developer JS.
```javascript
class JSDeveloper{
     codeJS() : void ;
}
```
Accountant chỉ nên làm việc liên quan tới kế toán như : về bảng lương, hóa đơn, hồ sơ giấy tờ.
```javascript
class Accountant
{
    prepareAccountsAndTaxReturns() : void ;
    administerPayrolls() : void ;
    controllingIncomeAndExpenditure() : void ;
}
```
## O — Open-Closed Principle
Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.
Nên mở rộng/kế thừa các class đã tồn tại thay vì sửa đổi chúng.

```javascript
class ReactJSDeveloper extends JSDeveloper
{
    codeReactJS() : void ;
}
```
Một JSDeveloper ngoài biết code JS thuần ra về lâu dài còn có khả năng học và code React JS với tư duy reactive. 

## L — Liskov Substitution Principle
Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
Các đối tượng của class cha có thể được thay thế bởi các đối tượng của các class con mà không làm thay đổi tính đúng đắn của chương trình.

```javascript
class ReactJSDeveloper extends JSDeveloper
{
    codeJS(): void {
      //  override code logic
    }
}
```
ReactJS Developer ngoài biết code ReactJs mà còn phải biết code JS thuần.

## I — Interface Segregation Principle
Many client-specific interfaces are better than one general-purpose interface.
Nên tách thành nhiều interface nhỏ cho các mục đích riêng, không nên để 1 interface phình quá to cho nhiều mục đích.
```javascript
interface IAccountant {
    prepareAccountsAndTaxReturns(): void;
    administerPayrolls(): void;
    controllingIncomeAndExpenditure(): void;
}
interface IJSDeveloper{
   codeJS(): void;
}
interface IReactJsDeveloper extends IJSDeveloper
{
    codeReactJS(): void;
}
```

## D — Dependency Inversion Principle
Depend on abstractions, not on concretions.
Các module cấp cao không nên phụ thuộc vào các module cấp thấp. Cả hai nên phụ thuộc vào abstraction.
Abstraction không nên phụ thuộc vào detail. Detail nên phụ thuộc vào abstraction.
```javascript
class VueJSDeveloper  extends IJSDeveloper
{
    codeJS(): void {
        // override improve JS performance
    }
    codeVueJS(): void ;
}
class WebProject{
    private jsDeveloper : IJSDeveloper;
    constructor(jsDeveloper VueJSDeveloper){}
    kickOff(): void {
        jsDeveloper.codeJS();
    }
}
```
Khi lựa chọn developer cho Frontend  dự án thì có thể chọn VueJS Developer làm đầu vào.
Dự án tiếp theo có thể  chọn ReactJS Developer làm frontend.
Step-by-Step Guide to Deploying Admin Panel in Go using QOR
Tags: go, qor, code, coding
Published: 2019-10-21 12:24:30

Full article: https://yalantis.com/blog/deploy-admin-panel-in-go-using-qor/

When building a platform-like application, you’ll need to create an admin panel to manage all app data. There’s a plethora of tools and approaches that allow developers to create admin panels without hassle. But such a variety of ready-made solutions creates difficulties with choosing the most effective one. 

At Yalantis, we’ve tried different tools for deploying admin panels using Go, and our choice is the QOR package. In this article, we provide you with a step-by-step guide to quickly build a configurable, easy-to-use admin panel for your application.

QOR overview

QOR is a set of libraries written in Go that abstract common features needed for ecommerce systems, content management systems, and business applications.

It contains several modules that will come in handy for working with content management systems and ecommerce apps:

Admin. QOR admin panels comply with Google Material Design principles. It allows developers to build responsive admin dashboard page for Golang and works well on both desktop and mobile devices. It is a great tool for ecommerce and CMS development.

Roles. Not all users are supposed to have rights for managing data. The roles package helps to define roles and permissions for controlling access to specific data fields. 

Inline Edit. This package allows developers to configure which content can be edited by which user role. It also provides convenient tools for defining and creating flexible, configurable widgets for frontend editing.

Worker. This package allows you to run batch processing and other time-consuming calculations in the background. 

Internationalization (i18n) and localization (i10n). When you’re going to expand your business abroad, you may need to translate or localize your application into new languages. These tools allow you to quickly provide multi-language support for your app.

QOR has well-written official documentation, so implementing this tool won’t take much time and effort. In the example below, we’ll tell you how to quickly create an admin panel in Golang for ecommerce website.
Looking for Podcasters
Tags: podcast
Published: 2019-10-21 12:14:07

Hey everyone!

I'm working on a great new project that will benefit podcasters, helping them advertise their podcast much more easily to their own followers and their friends.

To make my project as good as it can possibly be, I need to work closely with active podcasters, who are willing to test and suggest functionality. 

If you're a podcaster or you know a podcaster who wants to help create a product that will help people like them, please send me a message!

Thanks!
Italy 4 Travellers
Published: 2019-10-21 12:10:10

Le Marche lies between the Apennine Mountains to the west and the Adriatic Sea to the east. This region is blessed with several native grape varieties which produce world famous Le Marche wine. Find out more about Le Marche wine below.
The Marche region has been producing wine for thousands of years. Le Marche wine production has been influenced by various cultures such as the Etruscans, Romans and Lombards. In Roman times, the Greek historian Polybius mentioned the famous Le Marche wine. The Roman historian Pliny the Elder also said that emperors loved drinking it. The influence of all these different cultures is the main reason for the wide variety of wine types in this region. For more details at:https://italy4travellers.com/the-cavalcata-of-assunta
Website Databases in Windows Plesk

Tags: wordpress, webdev, design
Published: 2019-10-21 11:59:35

If site incorporates custom data processing applications or it is designed for generating websites dynamically. You may need a database for storing and retrieving data.

In Plesk, you will be able to do the following tasks:

1)Making the copy of databases(https://www.hostingraja.in/).
2)View the connection information of hostname, username, database name.
3)Export and import database dumps and also backup databases as the part of the subscription backup.
4)To Link the database to any one of the websites on your subscriptions.
5)Will be able to create the manual database for your website.
6)Managing the database user accounts and also setting up of access rules.
7)Can check the database for any issues and repair the database.
8)Will be able to move the database to the different subscription.
9)Managing the data with external database management tools like phpMyAdmin.

You can perform these operations by selecting Websites & Domains tab and clicking on Databases.



Database Management Tools:

With the help of third-party database management tools with Plesk, you'll be able to edit tables in databases, run SQL queries and export and import data. These tools are accessible from the corresponding link in Websites & Domains tab > Databases. Eg: Plesk makes use of phpMyAdmin to manage the MySQL databases.

Accessing Databases with the ODBC:

If you want to deploy the application that works with the database with an Open Database Connectivity (ODBC) driver. You have to create a reliable ODBC data sources in the OS. In Plesk for Windows, you'll be able to add ODBC data sources for several supported ODBC drivers.

Active & Classic Lists:

As a default, the list of databases will be displayed within the Active List view mode. To change to the Classic List mode, you can use the icon right next to the search box. The important distinction between the modes is that in the Active List mode you'll be able to view statistics on the databases and also the name of the website to which the data will be assigned.

Automated Creation of Databases:

While installing the app from the application Catalog, all you needed is databases. A database user accounts are created automatically. Additionally, you'll be able to assign a manually created user account to a database created by the web app. For more details go to the web applications and select App Databases.