teleren/devto huggingface dataset:
Quick Start Guide for Magento Commerce Cloud Sandbox
Tags: magento, magentocommerce, magentocommercecloud
Published: 2020-11-14 15:56:03

[On this tutorial, i will quickly guide how to request and use Magento Commerce Cloud Sandbox for Developers to develop and test against Magento Commerce Cloud and submit for selling components to Magento Marketplace.](https://bit.ly/MCCloud)
Como inicializar el DHTMLX Menu en español
Published: 2020-11-14 15:44:58

En la entrada de hoy aprenderemos a usar el dhtmlxMenu para inicializar y usar una carga desde XML, se debe puede usar este componente para desarrollar interfaces de usuario ricas que necesiten de una herramienta que tenga posibilidades y/o nececisades de comunicacion con AJAX.

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

Un ejemplo de una necesidad de este tipo puede ser: un menu que carga de acuerdo al perfil del usuario de nuestra aplicacion, o un menu que necesite cambiar en el tiempo.

A continuacion les muestro un video desarrollado para mostrar como inicializar este componente desde una pagina web.

https://youtu.be/GRuigCNrds8


DhtmlxMenu es flexible, potente, ligero y fácil de usar.


Se puede configurar como un menú desplegable o un menú contextual. Usted puede definir libremente la apariencia del menú visual y la estructura simplemente cambiando sus parámetros. Los elementos de menú se pueden alinear o bien a la izquierda o en el lado derecho del panel de menú.

Al igual que otros componentes DHTMLX, nuestro menú de JavaScript proporciona compatibilidad entre navegadores, una potente API de cliente, y una amplia gama de opciones de personalización (a través de JavaScript o XML). Carga dinámica de XML ofrece la posibilidad de cambiar el menú de navegación completamente sin recargar.

Este menú dinámico habilitado para Ajax le permite crear sistemas de navegación de carga rápida en cuestión de minutos. dhtmlxMenu ofrece maneras fáciles de integrar con otros componentes de la línea de productos DHTMLX. Puede ser fácilmente incluido en dhtmlxWindows, dhtmlxLayout y dhtmlxAccordion. También se puede utilizar como un menú contextual para dhtmlxGrid, TreeGrid, y dhtmlxTree.
Best Mechanical Keyboard for coding?
Tags: discuss, productivity, setup
Published: 2020-11-14 15:40:55

Have been looking for a good mechanical keyboard for coding/development, I'm not a big fan of RGB/gaming keyboards. I've seen people using [vortexgear race 3](https://www.amazon.com/Mechanical-Keyboard-Vortexgear-Mx-Brown-Aluminium/dp/B071J5WTT6) but this one doesn't ship to my country and can't find it anywhere else. So looking for suggestions and personal experiences with mechanical keyboards (if possible)
INTEGRATION OF PANDADOC INTO PYTHON / DJANGO WEB APPLICATION
Tags: django, python, webdev
Published: 2020-11-14 15:31:46

To integrate PandaDoc with your Django / Python you can either write your own library or use the one I have already developed. It’s available under the name python-pandadoc and wraps all the REST API calls into easy to use classes.
Below is a simplified example of how to use the library:

from pandaworkspace import PandaWorkspace

from pandarecipient import Pandarecipient



# for django - use memcached to implement limit manager

# from django_memcached_request_limit_manager import DjangoMemcachedRequestLimitManager

# workspace = PandaWorkspace(request_limit_manager=DjangoMemcachedRequestLimitManager)

# otherwise we can use a simple sleep limit manager which should work for a single threaded application



from request_limit_manager import SleepRequestLimitManager




workspace = PandaWorkspace(request_limit_manager=SleepRequestLimitManager)

employee = Pandarecipient(

email='some_employee@example.com',

first_name='Kos',

last_name='Smarty',

role='Employee',

)



employer = Pandarecipient(

email='some_employer@example.com',

first_name='Kos',

last_name='Ovechko',

role='Employer',

)


recipients = [employee, employer]



document = workspace.documents.create(

template_uuid="Cu2NZisX2Hrnug6FgrYX4d",

folder_uuid="6SoNkr3e6FiCMA8KsVbQZ8",

recipients=recipients,

name="Test Document in Folder",

)



document.send(

message='TEST: Sending through PandaDoc API. If you see it then the test works.',

subject='TEST: Sending through PandaDoc API.',

silent=False,

)



#get document status

document.status()


#get document details

document.details()


#get a url to share or embed

document.share(recipient=recipients[0], lifetime=72000)


#download document

document.download()

# or

document.download_large()

# or

document.download_protected()


#get the list of the documents

workspace.documents.list(status_=workspace.documents.Document.sent)


#delete document

document.delete()
Randomize ElasticSearch results with PHP
Published: 2020-11-14 15:27:22

Simple example of how to re-order your original query and wrap it to randomize the results.

This is using the official PHP ES library: https://github.com/elastic/elasticsearch-php

```php
<?php

if ($this->random) {
    $originalQuery = $this->params['body']['query'];

    $this->params['body']['query'] = [
        'function_score' => [
            'query' => $originalQuery,
            'random_score' => (new \stdClass()),
        ],
    ];
}

$searchRawResult = $this->client->search($this->params);
```
GitHub CLI: gh repo
Tags: github, cli, projectbenatar
Published: 2020-11-14 15:16:52

![image](../static-files/ghrepoweb.png)

```shell
gh repo create
gh repo view
gh repo fork
gh repo clone
```

# gh repo create

This creates a new repository on your GitHub

I just realized that I couldn't create a repository using the \`gh repo create\` without initializing git in the working directory (folder).\
First, you initialize git in your project folder, simply by:

```shell
git init
```


After that, you can now start the process, open the folder on your terminal or cmd, and type in the command:

```shell
gh repo create
```

First, you'll be asked to enter the name of the repo, by default the name of the current folder will be the repo name, then the description of the repo and the visibilty of the repository.

Once you are done, tap on <kbd>Enter</kbd> and confirm your details. The repo will be created for you, from the terminal.

[Learn More On `gh repo create`](https://cli.github.com/manual/gh_repo_create`)

## gh repo view

```shell
gh repo view
```

These commands give you a web view of your repository on the GitHub website.
By default, it will show on the terminal, if your repo has a README.md file, the preview will be displayed on your terminal.

To view directly on the browser, use the command:

```shell
gh repo view --web
```

After executing the command, you'll be taken to the web page of the repository

[Learn More on `gh repo view`](https://cli.github.com/manual/gh_repo_view)

## gh repo clone

```shell
gh repo clone
```

This is used to clone a repository remotely.

Syntax:

```shell
gh repo clone {github username}/{repository}
```

[Learn More on `gh repo clone`](https://cli.github.com/manual/gh_repo_clone)

### Conclusion

GitHub CLI is a very useful tool that saves time and gets your work done just straight from the terminal/cmd

To learn more on `gh repo clone` command, and all available commands visit the manual page <https://cli.github.com/manual>
Ordinary Puzzles: A React-Native puzzle game playable on the web
Tags: showdev, githunt, reactnative, react
Published: 2020-11-14 14:56:20

---
title: Ordinary Puzzles: A React-Native puzzle game playable on the web
published: true
description: Ordinary Puzzles, an open-source mobile puzzle game built with React-Native, is now playable one the web as a Progressive Web App
tags: #showdev #githunt #reactnative #react
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/od2boqj9uicl2tqnm1ab.png
---

[Ordinary Puzzles](https://www.ordinarypuzzles.com/), a puzzle game I published last year in the [App Store](https://apps.apple.com/us/app/ordinary-puzzles/id1489599807) and in the [Play Store](https://play.google.com/store/apps/details?id=com.mmazzarolo.ordinarypuzzles), is now also [**playable on the web**](https://ordinarypuzzles.com/play).  

Ordinary Puzzles is built with [React-Native](https://reactnative.dev/) and it’s playable on the web as a Progressive Web App thanks to [React Native for Web](https://github.com/necolas/react-native-web), a toolkit that makes it possible to run React Native components and APIs on the web using React DOM.

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

Ordinary Puzzles is open-source: you can find the source-code of the app on [GitHub](https://github.com/mmazzarolo/ordinary-puzzles-app).

{% github https://github.com/mmazzarolo/ordinary-puzzles-app %}

Any kind of discussion or feedback is warmly welcome!

Have fun!
How to install react-grid-Layout ?
Published: 2020-11-14 14:21:21

Hello and thank you in advance for your  help.

I'm a reactjs beginner.

I would like to use this reactjs tool :

https://github.com/STRML/react-grid-layout

I create a folder in htdocs, I clone the project.

Have I also use npm after the clone ?

I see this, but I'm not able to make something else :

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

Thank you in advance for your help and sorry for this question
How to Become a Better Freelancer by Avoiding These 3 Mistakes
Tags: business, selfemployed, work, entrepreneurship
Published: 2020-11-15 18:47:01

---
title: How to Become a Better Freelancer by Avoiding These 3 Mistakes
published: true
date: 2020-11-14 14:02:43 UTC
tags: business,selfemployed,work,entrepreneurship
canonical_url: https://medium.com/swlh/how-to-become-a-better-freelancer-by-avoiding-these-3-mistakes-6643ee3b9a1c
---

[![](https://cdn-images-1.medium.com/max/1920/1*deU1Z1Z6N4M2hieeyl3pRA.jpeg)](https://medium.com/swlh/how-to-become-a-better-freelancer-by-avoiding-these-3-mistakes-6643ee3b9a1c?source=rss-8f1b0c5dd7cc------2)

And not turn your next project into a banana skin situation.

[Continue reading on The Startup »](https://medium.com/swlh/how-to-become-a-better-freelancer-by-avoiding-these-3-mistakes-6643ee3b9a1c?source=rss-8f1b0c5dd7cc------2)
Code Smell 24 - Boolean Coercions
Tags: oop, tutorial, boolean, coercion
Published: 2020-11-14 14:02:08

*Booleans should be just True and false*

> TL;DR: Don't do magic castings to boolean. You will regret on a friday night.
 
# Problems

- Hiding Errors

- Accidental complexity coupled to one particular language.

- Readability

- Difficulty to hop among languages.

- [IFs](https://dev.to/mcsee/how-to-get-rid-of-annoying-ifs-forever-1jfg)

# Solutions

1. Be explicit.

2. Work with booleans for boolean conditions. Not integers, not [nulls](https://dev.to/mcsee/null-the-billion-dollar-mistake-1h1c), not strings, not lists. Just booleans.

3. [Fail fast](https://dev.to/mcsee/fail-fast-48dm)

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/1f5d0d7328e2e49f0695323e6c210c3e)
```python
virus = ['MERS', 'SARS']
vaccines = []
 
if vaccines:
	print ("let's get vaccinated")
else:
	print ("We have no vaccines yet. Keep researching")
    
if virus:
	print ("There are some virus around. Take extra care")
else:
	print ("We are free to get out. Not masks are necessary")

#equivalent     
    
if not vaccines:
	print ("We have no vaccines yet. Keep researching")
else:
	print ("let's get vaccinated")
    
if not virus:
	print ("We are free to get out. Not masks are necessary")
else:
	print ("There are some virus around. Take extra care")
```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/0c8dd91896ff91852dfa0e8711093a06)
```python
if len(vaccines) == 0:
	print ("We have no vaccines yet. Keep researching")
else:
	print ("Let's get vaccinated")
    
                    
if len(virus) == 0:
	print ("We are free to get out. Not masks are necessary")
else:
	print ("There are some virus around. Take extra care")
```

# Detection

This is a language feature. Some strict languages show warnings with this magic wizardry.

# Tags

- Coercions

- Primitive

# Conclusion

Some languages encourage doing some magic abbreviations and automatic castings. This is a source of errors and a *Premature Optimization* warning.

We should always be as **explicit** as possible.

# Relations

{% post https://dev.to/mcsee/code-smell-06-too-clever-programmer-37lb %}

{% post https://dev.to/mcsee/code-smell-69-big-bang-javascript-ridiculous-castings-49ij %}

# More Info

{% post https://dev.to/mcsee/fail-fast-48dm %}

* * *

> It is not the language that makes programs appear simple. It is the programmer that make the language appear simple!

_Robert Martin_

{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}
  
* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}

*Last update: 2021/07/07*
Persisting DataLoader between requests and using it as a cache
Tags: discuss, graphql, javascript
Published: 2020-11-14 13:46:27

I'm working on a project where I use the DataLoader to batch requests (N + 1 Problem). I accidentally created DataLoader beforehand and started to pass it in the context, instead of initializing the DataLoader in the context. I'll explain.

DataLoader is meant to be used for "per request batching and caching". Therefore, you would do something like this to implement DataLoader normally.

```javascript
// app.js

app.register(..., {
  schema: ...
  context: () => {
    return {
      userLoader: new DataLoader(batchFunction);
    };
  },
});

```

This would make it so that the DataLoader exist only in the context of a particular request. However, what I accidentally did was this:


```javascript
// app.js

userLoader = new DataLoader(batchFunction);

app.register(..., {
  schema: ...
  context: () => {
    return {
      userLoader
    };
  },
});

``` 

This started to cache the data between requests. It was not hitting my database for the data it already had. So I started wondering if there was anything wrong in caching the data in this way. I get batching. I get caching without having to manually implement it. I can clear the data->id from the cache when the database is updated. So far so good. 

But there has to be issues with this implementation. One limitation I found is that as the cache grows, eventually the entire database will be cached. I don't know if that's an issue or not. This can be avoided by using `{ cache:false }` option in the loader to cache only the required data.

It would be great if someone more experienced could give me some feedback and shed some more light on this. Thank you!
Can't get fcitx to work in WSL2. Also, Win10 multilingual input method sucks, nor does it work with WSL
Tags: wsl, linux, windows, help
Published: 2020-11-14 13:20:21

Problems should be solved if I use VirtualBox, I think; but I probably won't have that much access to WSL.

- **Win10 multilingual input method doesn't leak to WSL2 X410**
- Win10 multilingual input method isn't very customizable, compared to **fcitx** or **IBus**
- I use xfce4 Ubuntu in WSL2, and I tried both X410 (similar to VcXsrv) and xrdp (i.e. Remote Desktop Protocol).

![why afrikaans](https://dev-to-uploads.s3.amazonaws.com/i/2z60ebrsgf67uva6dubo.png)

**Why am I having Afrikaans here, and I cannot remove it?**

I can add Japanese and Chinese language support; but I cannot remove Input method, while retaining language support...

Windows 7 might be decent, but **Windows 10 sucks** for multilingual input. MacOS can indeed install VM, but does not have the performance of WSL2.

I am tempted to use purely Linux, but cannot run Windows/macOS-only apps that are not ported to Linux; in particular [LINE](https://line.me/en/), which does not work in [WINE](http://www.winehq.org/).
Using GitLab to Deploy a .NET Application on AWS Instances or Containers
Tags: aws, devops, dotnet, security
Published: 2020-11-14 13:10:01

Amit and I had a lot of fun putting this session together. I hope it is helpful to anyone deploying .NET to AWS services to understand gitlab's rich gitops workflow and deep DevSecOps integration that uniquely nurtures Continuous Vulnerability Remediation in every developers existing code iteration habit loop.

https://page.gitlab.com/webcast-gitlab-aws-ec2.html
Code Quality Measurement
Tags: review, codequality, smells, watercooler
Published: 2020-11-14 13:06:32

---
title: Code Quality Measurement
published: true
description: Good code vs bad code in code review
tags: review, quality, smells, watercooler
//cover_image: https://direct_url_to_image.jpg
---

Lifecycle of a code review 🤩

**Developer Skills 101:** Being able to read and make sense of other people's code (especially legacy codes that's been spoilt by too many cooks). Writing code is the easy part. 😅 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7v0mz3ggxeigusjaztbq.png)
Daily Developer Jokes - Saturday, Nov 14, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-11-14 13:00:09

---
title: "Daily Developer Jokes - Saturday, Nov 14, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Saturday%2C%20Nov%2014%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1259d077252.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Which programming language is the shortest?

___A:___ HTML. Because it doesn't have a neck between its `<head>` and `<body>`.
 -->
Completed my first Hactoberfest!
Tags: hacktoberfest
Published: 2020-11-14 12:36:44

<!-- ✨ Completed it on the very last day of October! Learned how to pull requests and contribute to open source ✨ -->


### [Intro Heading]
<!-- An E&TC student who aspires for CS job  --> 

### Progress

<!-- Completed 4 successful pull requests -->

### Contributions

<!-- I contributed some of the complex codes which I had written, while learning Python as a beginner  -->
Validate your cloud function with 1 line of code
Tags: typescript, tutorial, serverless, node
Published: 2020-11-14 12:23:38

[typescript-is](https://github.com/woutervh-/typescript-is) is a library which enables type checks at run-time! This is an incredible tool to validate input and make your code more type-safe 🎉.

Validating the input of cloud functions can be a challenging problem. Re-using your types to ensure that your input matches your type solves a big part of the validation problem. To do this with the `typescript-is` library, the only thing you need to do is to use the `assertType` method that `typescript-is` exports:

```ts
// 2. Use the `assertType` method to perform your runtime check
assertType<MyEvent>(input)
```

Above we use `assertType` to check whether our runtime object `input` matches our type `MyEvent`. If it doesn't match the `MyEvent` type, an error is thrown. `typescript-is` has a bunch of other methods such as `is` or `strictEqual`. If you'd like to throw the error yourself you could do this for example:

```ts
if (!is<MyEvent>(input)) {
  throw new Error('input does not match type')
}
```

That's pretty much all it takes to add a run-time type check of your cloud functions input (provided you are a typescript user 🙃). Whereas previously you might have reached for validation libraries such as [joi](https://github.com/sideway/joi) or god-forbid, written your own validator, it's now just one line of code. What are you going to do with all this new-found time?

Below is the entirety of an AWS lambda function handler with this pattern applied:

```ts
import { Handler } from 'aws-lambda'
import { assertType } from 'typescript-is';

type MyEvent = {
  msg: string
}

async function handler<Handler>(event: MyEvent) {
  assertType<MyEvent>(event)
  return { msg: 'Hello World' }
}

exports.handler = handler
```

🚀

For a fully working example of this pattern including deployment scripts for AWS and compilation with webpack please have a [look at this boilerplate I've put together](https://github.com/juliankrispel/typescript-aws-lambda-terraform).

👍

Thanks for reading, [this post was originally published on my website](https://jkrsp.com/typescript-validate-lambda/).
My #100daysOfCode Challenge - Python 100 projects in 100 days - Journal Entry - Day 3
Tags: beginners, python, codenewbie, 100daysofcode
Published: 2020-11-14 12:12:39

Day 3 - Treasure Island



print('''
*******************************************************************************
          |                   |                  |                     |
 _________|________________.=""_;=.______________|_____________________|_______
|                   |  ,-"_,=""     `"=.|                  |
|___________________|__"=._o`"-._        `"=.______________|___________________
          |                `"=._o`"=._      _`"=._                     |
 _________|_____________________:=._o "=._."_.-="'"=.__________________|_______
|                   |    __.--" , ; `"=._o." ,-"""-._ ".   |
|___________________|_._"  ,. .` ` `` ,  `"-._"-._   ". '__|___________________
          |           |o`"=._` , "` `; .". ,  "-._"-._; ;              |
 _________|___________| ;`-.o`"=._; ." ` '`."\` . "-._ /_______________|_______
|                   | |o;    `"-.o`"=._``  '` " ,__.--o;   |
|___________________|_| ;     (#) `-.o `"=.`_.--"_o.-; ;___|___________________
____/______/______/___|o;._    "      `".o|o_.--"    ;o;____/______/______/____
/______/______/______/_"=._o--._        ; | ;        ; ;/______/______/______/_
____/______/______/______/__"=._o--._   ;o|o;     _._;o;____/______/______/____
/______/______/______/______/____"=._o._; | ;_.--"o.--"_/______/______/______/_
____/______/______/______/______/_____"=.o|o_.--""___/______/______/______/____
/______/______/______/______/______/______/______/______/______/______/_____ /
*******************************************************************************
''')
question1 = input('You\'re at a cross road. Where do you want to go? Type "left" or "right" ')
question1_lowercase = question1.lower()
if question1_lowercase == "left":
  question2 = input('You come to a lake. There is an island in the middle of the lake. Type "wait" to wait for a boat. Type "swim" to swim across ')
  question2_lowercase = question2.lower()
  if question2_lowercase == "wait":
   question3 = input('You arrive at the island unharmed. There is a house with 3 doors. One red, one yellow and one blue. Which door do you choose? Type "red", "yellow" or "blue" ')
   question3_lowercase = question3.lower()
   if question3_lowercase == "yellow":
      print("You Win!")
   else:
      print("Game Over.")
  else:
    print("Game Over.")
else:
  print("Game Over.")

#https://www.draw.io/?lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=Treasure%20Island%20Conditional.drawio#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1oDe4ehjWZipYRsVfeAx2HyB7LCQ8_Fvi%26export%3Ddownload

Key Takeaways:

1. Learned about Conditional Statements 
2. Logical Operators
3. Code Blocks and Scope