teleren/devto huggingface dataset:
A simple way to find installed games' uPlay IDs with python
Tags: tutorial, python, github, showdev
Published: 2020-06-23 07:32:35

First we need to find where and how ***ubisoft*** keeps track of the games installed by ***uPlay***.

After some digging and asking around, I was able to find that there are two ways of acquiring this data.

## First way : extracting info from folders

* uPlay makes these folders, which are named after the __uplayID__ itself

> C:\\Program Files (x86)\\Ubisoft\\Ubisoft Game Launcher\\data

**The names of the folders are the *uPlay IDs* of the installed games**

![pic](https://i.imgur.com/A2bQ5J1.png)

* Below is the python code for extracting IDs via these folders

```python
import winreg, os, re

# Finding Uplay IDs by going through the uPlay data folder
def getUplayIDs(filePath = 'C:\\Program Files (x86)\\Ubisoft\\Ubisoft Game Launcher\\data'):
    listOfFiles = os.listdir(filePath)

    def findIDs():
        result = re.findall(r'\d+', str(entry))
        try : return result[0]
        except : pass

    for entry in listOfFiles:
        uPlayID = findIDs() # '\d' finds any number (a digit)
        if uPlayID != None : print(uPlayID)       
#getUplayIDs()

```

## Second way : extracting info from Windows Registry

```python

def getUplayIDs():
    # ubisoftGameList = {}

    baseReg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
    subKey = winreg.OpenKey(baseReg, "SOFTWARE\\WOW6432Node\\Ubisoft\\Launcher\\Installs\\")

    for i in range(50) :
        try :
            gameId = winreg.EnumKey(subKey,i)

            gameNameKey = winreg.OpenKey(baseReg, "SOFTWARE\\WOW6432Node\\Ubisoft\\Launcher\\Installs\\" + gameId + "\\")
            name = winreg.EnumValue(gameNameKey, 1)

            path = name[1]
            path = os.path.dirname(path)
            gameName = os.path.basename(path)

            print('\nThe Game name is: ' + gameName + ' \nThe Game ID is: ' + gameId)
            
        except :
            pass

    winreg.CloseKey(baseReg)
```

These code snippets are taken from my github project : **Plei** 
Plei is a game-launcher which parses through the games installed by 

* Steam
* uPlay
* Origin
* Epic Games

and let's you play them from one single entry point

![Plei](https://raw.githubusercontent.com/sakshatshinde/Plei/master/plei.png)
If you wish to contribute or download the project visit the link below

https://github.com/sakshatshinde/Plei
20 Most Common TYPO3 Errors (And How to Fix Them)
Published: 2020-06-23 07:01:15

No matter, either you are a beginner or experienced TYPO3 developer, It’s always good to improve your TYPO3 error and debugging handling skills to get quality and productive work. Here are some tips, tricks, and tools to handle TYPO3 errors.

Error in TYPO3 by either system or human-based, It’s sometimes difficult to find out what, where, and how to fix such TYPO3 errors. Imagine, your customer's TYPO3 site suddenly stopped by saying “Oops and an error occurred” one of the famous TYPO3 error messages If you have a bit of experience how TYPO3 error handling works then you will be able to fix it hassle-free.

In this guide learn concepts and solutions about TYPO3 Errors like

- How to Enable TYPO3 Display Error?
- What Are Best Practices TYPO3 Errors Handling?
- What are the ways to check TYPO3 Error Logs?
- TYPO3 Oops an error occurred!
- Do you want to custom TYPO3 Error Handle?
- How can I configure the 404 error page in TYPO3?
- Do you want a PHP-based Custom 404 error handler in TYPO3?
- How to Solve 500 Internal Server Error in TYPO3?
- How to solve “No TypoScript Template Found” in TYPO3?
- Deprecation log handling in TYPO3 9
- How to Solve SMTP Errors in TYPO3?
- How to Solve ImageMagick Configuration Errors?
- How can I solve Error caused by the TYPO3 extension installation?
- How can I search for a TypoScript code error?
- How to solve Fatal error: Allowed memory size bytes exhausted in TYPO3?
- Useful TYPO3 Error Extensions
- How to make TYPO3 logs into a Dedicated Log File?
- TYPO3 Logging
- Log Writers
- How to PHP & TYPO3 Debug?
- PHP TYPO3 Debugging Tools

Read complete article at - https://t3terminal.com/blog/typo3-errors/
How to serve an API locally with webpack
Published: 2020-06-23 06:56:05

While developing a data driven web-app, the frontend may need to fetch data from various APIs provided by backend which may not be ready at the given time. In this case, we need to mock the response and serve it via dummy server, either local or remote. With Webpack this can be achieved without any dummy server. Webpack devserver allows custom handlers which can be used to serve the API response.  

We need to add a `devServer` entry to the webpack config, which would look something like this:

```Javascript
const data = require("./data.json");

module.exports = {
  mode: "development",
  entry: "./src/index",
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "build")
  },
  plugins: [],
  devServer: {
    before: function(app) {
      app.get("/getData", function(req, res) {
        res.json(data);
      });
    },
    open: true,
    port: 3000
  },
  resolve: {
    extensions: [".js"]
  },
  module: {}
};
```

There are various amazing things that we can do with devserver (check [here](https://webpack.js.org/configuration/dev-server/)), we consider three of them here
1. `open` - launch the browser once the app is compiled
2. `port` - set the port to serve the app
3. `before` - We can define custom paths with endpoints in this function, from the docs -  

> Provides the ability to execute custom middleware prior to all other middleware internally within the server. This could be used to define custom handlers.  

So for given webpack config, if the content of data.json is - `[{a: 1}, {b: 2}, {c: 3}]` then  response for `http://localhost:3000/getData` will be

```JSON
[
  { a: 1 },
  { b: 2 },
  { c: 3 }
]
```

The `app` param of `before` function can be considered as `express` object and be used in the same context, `app.get` has `req` and `res` params, which are `request` and `response` object for the API call made.  

> To see this in action please checkout [this project](https://github.com/tsl143/react-typescript-app) on github.  

**Bonus**: I use this technique to get around with CORS on my local setup, the following code does the trick for me:

```Javascript
  devServer: {
    before: function(app) {
      app.get('/api', async function(req, res) {
        try {
          const queryURL = req.query.q;
          const resp = await fetch(queryURL);
          const body = await resp.text();
          res.send(body);
        } catch (e) {
          res.status(500);
          res.send(e);
        }
      });
    }
  },
```

Here I fetch the remote URL on the server rather than the browser, so there is no CORS restriction and then serve on the response on the same server hence, eliminating CORS.

I highly recommend to look into [devserver options](https://webpack.js.org/configuration/dev-server/), this can save a lot of your efforts 😊
Inherit function parameters in TS
Tags: typescript, javascript, react, redux
Published: 2020-06-23 06:54:52

This article is relevant for all `typescript` users. 
Though, I haven't encountered this issue in `Node.js` yet..
If you want you can skip the background part, and jump straight to the code examples.
***
###Motivation
Recently I faced a new challenge with `typescript`, in my `react-redux` app.

One of the fundamental principles of `react-redux` is [separation of concerns](https://medium.com/@abhinav_jain123/react-redux-architecture-part-1-separation-of-concerns-812da3b08b46).
As a result of this separation we might need to pass a lot of parameters to an [action creator](https://redux.js.org/basics/actions).
In addition, we might want to use this `action creator` from different `components`.

Until now everything sounds normal.

Now lets add `Typescript`.

Adding `typescript` to `react-redux` app, forces us to define every `action creator` function that we use in our component.
of-course some of the functions can be defined as `Function` type, but there are a lot of places that we need the full function signature.
This boilerplate can be frustrating sometimes, especially when the team is getting bigger, and more people are starting to touch the code.

Me and my teammate [Lidor Levy](https://medium.com/@lidorlevy) looked for a solution for this problem and found resolution in this [Github issue](https://github.com/Microsoft/TypeScript/issues/26019).

Typescript is giving the option to inherit the parameters of a function!!
***
###This is how we do it
**Define your function wherever you want**
```
export const YOUR_FUNCTION_NAME = (
  param1: number,
  param2: Array<SOME_INTERFACE>,
  param3: string,
  param4: boolean
): YOUR_FUNCTION_TYPE => {
  // some logic, or even keep empty
}
```

**In your function type definition**
```
YOUR_FUNCTION_NAME: (
    ...YOUR_FUNCTION_NAME_Params: Parameters<
      typeof YOUR_FUNCTION_NAME
    >
) => YOUR_FUNCTION_TYPE
```
Don't forget to `import` your function definition.
***
Now, when you use the function, `typescript` will know the parameter types, and your IDE code-completion can help you regularly. 
Enjoy!
dotConnect for Dynamics CRM Now Supports OAuth 2.0 Authentication
Tags: dynamicscrm, dotconnect, oauth, authentication
Published: 2020-06-23 06:46:57

---
title: dotConnect for Dynamics CRM Now Supports OAuth 2.0 Authentication
published: true
description: Devart announced support of OAuth 2.0 authentication in dotConnect for Dynamics CRM. 
tags: DynamicsCRM, dotConnect, OAuth, authentication
---
*Devart announced support of OAuth 2.0 authentication in dotConnect for Dynamics CRM.*

Devart, a recognized vendor of professional database management software for developers and data connectivity solutions, released the new version of its popular ADO.NET provider, dotConnect for [Dynamics CRM v1.10](https://www.devart.com/dotconnect/dynamicscrm/). The new product version allows users to connect to Dynamics CRM using OAuth 2.0 authentication and also supports MultiSelect Option Set columns. 

From now on to use OAuth 2.0 authentication users have to create a connection in Server Explorer via web login and then use it in necessary applications. Alternatively, they may register an OAuth application in their Azure AD tenant and then use its client ID and client secret to obtain OAuth tokens in order to create a connection at run-time.

**dotConnect for Dynamics CRM** is an ADO.NET provider for working with Dynamics CRM data through the standard ADO.NET or Entity Framework interfaces. It allows you to easily integrate Dynamics CRM data into your .NET applications, and integrate Dynamics CRM services with widely used data-oriented technologies.

**About Devart**

Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration and backup solutions. The company also implements Web and Mobile development projects.
For additional information about Devart, visit https://www.devart.com/
Using Laratrust Permission and Roles Other Than Users Relation
Tags: laravel, laratrust, php, roles
Published: 2020-06-23 06:20:13

Laratrust is a laravel package that lets you handle very easily roles and permission inside your application.
laratrust by default make use of users relation but sometimes you wish not to use users relation in order to do so there are few steps to follow.


step 1: install the package using composer.
## 
       composer require santigarcor/laratrust

step 2: public the configuration files.
##

       php artisan vendor:publish --tag="laratrust"

step: 3 Now before setting up laratrust you have to make a few changes to config/laratrust.php in laratust.php file make changes to tables array like so

##

        'tables' => [
            'roles' => 'roles',
            'permissions' => 'permissions',
            'teams' => 'teams',
            'role_user' => 'role_admin',
            'permission_user' => 'permission_admin',
            'permission_role' => 'permission_role',
         ],
Note: do not change keys of tables array let it be as it is.

step: 4 And now a slight change to the foreign keys array instead of using user_id it should now be admin_id like so.
##
             'foreign_keys' => [
                   'user' => 'admin_id',
                   'role' => 'role_id',
                   'permission' => 'permission_id',
                   'team' => 'team_id',
                  ],

now you are all set to use laratrust with admin table instead of users table. 

Run the following artisan command to setup your laratrust migration.
##
     php artisan laratrust:setup

in migration of laratrust you would be able to see that migration is setup for admin table now simply migrate using.

##
     php artisan migrate

and that’s all for using laratrust with a different relation than users.

For further details please go to laratrust official site https://laratrust.santigarcor.me

Thank you
A simple guide to install linux-zen (The "Zen" kernel) on Arch Linux for Systemd-boot
Tags: linux, tutorial, archlinux
Published: 2020-06-23 06:19:00

* Firstly run the following command with the appropriate privilege:

```bash
sudo pacman -S linux-zen linux-zen-headers
```

* When asked for confirmation, type 'y', press ENTER
* Now the kernel is installed on your system.

__We need to tell systemd-boot to boot with the newly kernel installed__

* Open up a terminal and type these commands:

```bash
su
```

> [Enter your password]

```bash
cd /
ls 
```

* At these stage there should be a folder named "boot"
Run the following command:

```bash
cd boot/loader/entries
```

* There should be a ".conf" file. This could be named anything. In my case it is "arch.conf"

**NOTE : You can use any text editor / CLI editor you like. Here I am using nano**

```bash
nano arch.conf
```

* After opening the file edit these entries to the new one ( '->' = to)

`linux /vmlinuz-linux` -> `linux /vmlinuz-linux-zen`
`initrd /initramfs-linux.img` -> `initrd /initramfs-linux-zen.img`

* SAVE the file and exit
* Now we are done. Simply reboot and enjoy! :)

**If you wish to contribute to this project, visit** : 

{% github  https://github.com/zen-kernel/zen-kernel %}
Postman Collection: I Give You Best Price
Tags: postman, collection, automation, scraping
Published: 2020-06-23 05:43:02

![I Give You Best Price](https://i.imgur.com/ojqy8RQ.gif)

#### Looking to buy something soon? Make sure you get the best price.

**Disclaimer:** I recently started working at Postman, and this post is in an attempt to explore what the app can do and it's abilities in terms of automation.

### Introduction

This is a simple collection that you can run/monitor to search for a specific product on various e-commerce websites (made for Indian markets) and shows you a graph of all the prices, along with where you get the product the cheapest.

It also sends you a slack notification at the end with information about the daily deal.

### Test Run

Try the collection right here by clicking on the button and running on Postman. Be sure to create an environment before you start :)

[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/c17d494ece7c11628797)

### Workflow

For example, I've been looking to buy a simple keyboard for my secondary PC that my dad works on. I've been looking at the Dell KB216 for some time now, but just looking for the best deal.

I've set up the collection as shown below to look for the Dell KB216 on various websites.

![Amazon - Dell KB216](https://i.imgur.com/NUSq1eA.png)

Each request has an associated Test Script along with it to be able to scrape the data off of the HTML body. Here's the test script for Amazon India.

```js
const $ = cheerio.load(responseBody);
const firstProductElement = $('.s-result-item').first();
const priceElement = firstProductElement.find('.a-price-whole');
const price = parseFloat(priceElement.text());

pm.test("Amazon has returned a valid price", function () {
    pm.expect(price).to.be.a('number');
    pm.environment.set("amazon_price", price);
});
```

Going through individual websites like Flipkart, Snapdeal, Shopclues and eBay, it collects the price information and stores it as environment variables in the workspace.

Finally, using Postman's Visualize Tab, I draw up a chart courtesy of Charts.js and pit against the prices from all the sites.

![Price Graph](https://i.imgur.com/YZrVa4J.png)

This eventually sends out a notification on a Slack Channel that I've made specifically for this purpose.

![Slack Notification](https://i.imgur.com/etpUvGg.png)

As you can see here, over the course of waiting just a single day, I've saved ₹100. Do this over and over again, and you'll be a millionaire in no time! :)

That's my time, hope you found this useful!
Map drive letter to local folder
Published: 2020-06-23 05:38:23

We have a group policy or something at work that tries to add some network drives at startup. This doesn't always work, espacially when working remotely.

This causes an error when using the azure cli, resulting in this type of error.

```
❯ az account show
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure\cli\__main__.py", line 33, in <module>
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure\cli\core\__init__.py", line 599, in get_default_cli
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure\cli\core\azlogging.py", line 30, in <module>
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure\cli\core\commands\__init__.py", line 28, in <module>
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure\cli\core\extension\__init__.py", line 18, in <module>
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-_kvuguic\knack\knack\config.py", line 38, in __init__
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-_kvuguic\knack\knack\util.py", line 111, in ensure_dir
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-_kvuguic\knack\knack\util.py", line 108, in ensure_dir
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\os.py", line 210, in makedirs
    makedirs(head, mode, exist_ok)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\os.py", line 220, in makedirs
    mkdir(name, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'P:\\\\'
```

Mapping the failing drive letter to a local folder solves the problem, like this

``` powershell
subst p: c:\temp
```

To remove the mapping, do

``` powershell
subst p: /D
```
What is SAP Software?
Tags: sappro
Published: 2020-06-23 05:26:02

SAP stands for System, Application, and Products for data processing. It was established the standard for Enterprise Resource Planning (ERP) software. 

SAP provides centralized data management that can be used for multiple business functions. This helps the business organization to manage complex business processes by providing real-time insights across the enterprise.

SAP software is used for effective business functions that are as follows:
For more info visit:<a href="https://mindmajix.com/community/53492/what-is-sap-software-used-for">Sap Software Usage</a>
How to run scripts via cron jobs
Tags: cronjob
Published: 2020-06-23 05:22:11

If you want to run scripts on a scheduled basis, keep in mind the following:

1. According to our Acceptable Use Policy, running cron jobs with intervals of less than 5 minutes or setting up more than 5 simultaneous cron jobs is not allowed on all shared servers.

2. If you do not add >/dev/null 2>&1 at the end of the command, the server will send an email notification each time a cron job runs. While it may be useful for testing purposes and monitoring, if not attended, such emails will be accumulating in the email account specified in the Cron email field, and if it is one of your cPanel email accounts, they might cause issues with inodes usage.

NOTE: If your script does not generate any output, it is possible that notification emails are not sent either, however, the cron job is working.

In order to set up a cron job, go to cPanel > section Advanced > Cron Jobs menu: 



PLEASE NOTE: Cron jobs are run according to the server time.

General cron job format is as follows:

[path to environment] [Path to script] [Script parameters]


For example, if you want to run a PHP script located in the public_html directory, the correct cron command will be:

/usr/local/bin/php /home/cPaneluser/public_html/yourscript.php

/usr/bin/php -q /home/cPaneluser/public_html/yourscript.php (for business servers)


or if you want to use a relative path (different commands are divided by “;”):

cd /home/YourcPuser/public_html/; /usr/local/bin/php yourscript.php

cd /home/YourcPuser/public_html/; /usr/bin/php -q yourscript.php (for business servers)

For Python and Perl scripts, there is no need to use a full path to the environment, the environment interpreter directive will be enough on shared servers.

python /home/YourcPuser/public_html/yourscript.py

perl /home/YourcPuser/public_html/yourscript.pl


Alternatively, you can just use curl request as the cron job command for the same purpose:

curl “http://yourdomain.com/script.php?argument1=arg1&argument2=arg2”
curl “http://yourdomain.com/script.py”
curl “http://yourdomain.com/script.pl”

However, unlike the first method, curl-based cron jobs will work only if URLs specified in curl requests are resolving, e.g., DNS records for the domain are correct and running.
You can find more information about the curl tool usage here.

You can also check if a cron command is executed correctly by running it in the command line via SSH.

We will use this simple summing script with external parameters and run it using a web browser, Cron and SSH:




First, let's just run it in the browser pulling arguments after the script name and “?” directive:

http://nctest.info/script.php?arg1=2&arg2=3



Now, in order to get the same result via cron we will use this command and add parameters after the script path:

/usr/local/bin/php /home/nctest/public_html/script.php 2 3


The email notification contains the same output:




In CLI, you can run both cron commands and CURL requests, just log into your cPanel account via SSH and input them like shown below:




This is it!
React Tutorials - Youtube Player Refactoring - 2
Tags: react, javascript, showdev, webdev
Published: 2020-06-23 04:38:22

I had recently started my YouTube channel — The Web Dev. I had decided to start putting all my blogs into the YouTube channel.

The youtube player which we have created so far uses the usual bootstrap. It is very easy to convert it to use CSS Grid.

Now the older float were really the great road-block for any developer learning CSS and they tends to go toward bootstrap.
With the recent addition of flexbox and Grid, it now easy for anyone to ditch bootstrap.

And here is my YouTube video.

[![alt text](https://res.cloudinary.com/dxkxvfo2o/image/upload/v1592799320/React_tutorial_-_YouTube_player_refactor_fjkdqf.png)](https://youtu.be/wNqoNVvjneE "Youtube Player Refactoring - 2")

Please do like it and [Subscribe](https://www.youtube.com/channel/UCRf7mazcufqZxd2pR3oQJuQ?sub_confirmation=1) to my channel for more videos.

You can also read the complete blog here -

https://thewebdev.tech/refactoring-youtube-player-to-use-grid
Box Model - Drop Shadow vs. Border
Tags: css
Published: 2020-06-23 04:29:38

Don't know who needs to hear this but...

`drop-shadow` is not part of the box model. Notice how it doesn't appear centered and also "drops" off at the bottom.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/32qcf14fx8lovdufszlu.png)

`border` however is. Notice that it appears centered and doesn't drop out of view.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1hwcdrgchg2r08emf2wi.png)