teleren/devto huggingface dataset:
How to write modern PHP application without OOP?
Tags: help, php, discuss
Published: 2020-03-04 09:03:05

Hello!

I would love to hear your input about this topic.

I can find a lot of resources on how to build web apps using OOP "the right way". However, I cannot see the same with procedural style. There are a few notes here and there, but a void on best practices for modern PHP development using procedural programming. Does procedural programming come down only to avoid deep nesting and writing a bunch of functions? What are the best practices for procedural programming?

I'm asking that, because I'm planning to write an e-commerce website (vanilla PHP, no framework) without OOP. I'm not sure if I will use MVC even. I prefer feature folder structure. I'm curious if anyone had tried anything alike this before.
Understanding String and &str in Rust
Tags: rust
Published: 2020-03-04 08:18:35

Most likely, soon after you’ve started your Rust journey, you ran into this scenario where you tried to work with string types (or should I say, you thought you were?), and the compiler refused to compile your code because of something that looks like a string, actually isn’t a string.

I've been there as well. That's why I wrote an article that explains the difference between `String` and `&str` in Rust:

https://blog.thoughtram.io/string-vs-str-in-rust/

Let me know what you think in the comments below and what you want to learn about next!
A closer look at Ownership in Rust
Tags: rust
Published: 2020-03-04 08:16:50

So you want to learn Rust and keep hearing about the concept of Ownership and Borrowing, but can’t fully wrap your head around what it is.
 
Ownership is so essential that it’s good to understand it early on in your journey of learning Rust, also to avoid running into compiler errors that keep you from implementing your programs.

I wrote this article to help you learn faster: https://blog.thoughtram.io/ownership-in-rust/

Let me know in the comments what you think or what you'd like to learn about next!
Python Packaging & Executables on Windows
Tags: programming, windows, python, systemadministration
Published: 2020-07-17 21:11:59

---
title: Python Packaging & Executables on Windows
published: true
date: 2020-03-04 07:57:46 UTC
tags: programming,windows,python,systemadministration
canonical_url: https://medium.com/@jmarhee/python-packaging-executables-on-windows-c61de9829092
---

I recently began developing on, and for Windows, and while I continue to develop my skills in Powershell and C#, I rely on my go-to…

[Continue reading on Medium »](https://medium.com/@jmarhee/python-packaging-executables-on-windows-c61de9829092?source=rss-d532e3e97d0f------2)
Flutter plugin to filter list data
Tags: flutter, package, widget
Published: 2020-03-04 07:11:19

Working on Flutter plugin filter_list that can reduce efforts and time to make custom widgets to filter data from list. 

Feel free to suggest new feature, raise issues or submit pull request.
Plugin link:- https://lnkd.in/fMQE_WN
Source code:- https://lnkd.in/fjMVGqE
 #sourcecode#github#android#plugins
Contributors on JS (Svelte) app for decentralized network
Tags: contributorswanted, help, javascript, svelte
Published: 2020-03-04 06:44:19

I'm looking for people to help bring javascript app to it's first release, critical issues are pagination and routing. App is client-to-server implementation of ActivityPub protocol (https://www.w3.org/TR/activitypub/), most known implementation is Mastodon.  List of help wanted issues on github https://github.com/autogestion/pubgate-philip/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22 , I would appreciate any help.
Contact me on github or in fediverse odesa@fosstodon.org
DeepCode's Top Findings #10: Confusing Use of '!'
Tags: deepcode, javascript, codequality
Published: 2020-03-04 06:27:19

[DeepCode](https://deepcode.ai) offers an AI-based Static Program Analysis for Java, JavaScript and TypeScript, and Python. As you might know, DeepCode uses thousands of open source repos to train our engine. We asked the engine team to provide some stats on the findings. On the top suggestions from our engine, we want to introduce and give some background in this series of blog articles.

*Language:* JavaScript
*Defect:* Confusing Use of '!' (Category Defect)
*Diagnose:* Negation applied before *instanceof*. Check operator priorities - negation has higher priority than *instanceof*.

This instance is sponsored by [npm cli](https://github.com/npm/cli) - as usual, you can open the project in [deepcode](https://deepcode.ai) and follow along.

Have a look at the code below: 
```javascript
  if ((!strings instanceof Array))
    throw new TypeError('argument must be an Array[String]');
```

For me, this is a typical issue of _syntax_ versus _semantics_. As from a syntactical perspective, this is fine code, it compiles, and kind of works. But seeing the double parenthesis, I guess the developer intended a different behaviour. Per definition, the condition will always be `false` (see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof) see _Not Instance Of_). It is pretty likely the developer made a mistake here.

DeepCode correctly provides an explanation of the problem. The negation operator (`!`) has a higher priority than `instanceof` and is there executed before. `!` reviews the operand and if the value is _truthy_ (see [MDN Truthy](https://developer.mozilla.org/en-US/docs/Glossary/truthy) ) negates that and delivers a `false`. Otherwise a `true`. Then comes instance of and obviously, both of them can never be an `Array`. The condition will always be false. The code should look like this:
```javascript
  if (!(strings instanceof Array))
    throw new TypeError('argument must be an Array[String]');
```


DeepCode has seen this in 202 projects and also provides examples below. For me, these examples are extremely helpful as they nicely show the before / after. Especially when parenthesis and their ordering comes into play, I tend to get blind sometimes. So this helps enormously.

If you have another 5 minutes to spare, have a look at this table here [MDN Operator precedence](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence). Always good to refresh things a bit. My general advise: Instead of trusting on operator precedence wizardry - use correct parenthesis :-)  

And if you are not sure if you have seen this in your own code, give it a check - [deepcode.ai](https://deepcode.ai).
What measures are available for Google Cloud Functions / Firebase Functions to protect from DDoS?
Tags: discuss, serverless, security, webdev
Published: 2020-03-04 06:18:00

Google Cloud Functions offers the service at a great affordable price but it has missing pieces like protecting from DDoS and Rate Limiting.

It's very tough to go public with out protecting the product from abuse as at some point down the line we may get unexpected volumes of requests leading to huge bills!


# Solutions i'm aware but seems not effective
Cloud Endpoints : Can be used for rate limiting but the pricing part is way more higher than the cloud functions pricing. Instead of using Endpoints, it looks like it better to handle in cloud functions as endpoints have the same problems.

Cloud Armour : No friendly pricing plans and a starter.


# Questions
* Is it fine if I add Cloud Flare to handle the DDoS attacks? Does it add any extra latency to the Rest API services?
* Does having a reverse proxy for rate limiting and DDoS shield work? At what level of traffic I need to upgrade the reverse proxy server (Nginx) to make sure its scalable? I know it beats the purpose of serverless functions as i'm limited by the reverse proxy performance but I don't see any other alternative If i go with this.



I would like to know what measures you guys follow to protect serverless functions from abuse.
Java by Comparison by Simon Harrer, Jörg Lenhard, Linus Dietz
Tags: books, beginners, java, watercooler
Published: 2020-03-04 06:17:46


I'm not a Java developer - anymore - yet I find that a big part of [this book](https://amzn.to/2Ie6E28) can be useful for any junior programmer. Maybe not only for them, as the book has elements that are always useful to be reminded to. In addition, it gives you ideas on how and what to teach to less experienced people.

But I ran forward too fast.

[Java by Comparison](https://amzn.to/2Ie6E28) promises you to become a Java craftsman through 70 examples. Of course, you will not become a craftsperson just by reading this book, you'll have to practice. A lot. But this book is a good start.

It indeed provides something like 70 examples organized in the most readable way I have ever seen.

There is a bad example always on the left side and a better one on the next page, so you'll always see the two together, you don't have to turn pages. It's extremely easy to digest as such.

Of course, this structure also has some downsides, one is that each explanation is relatively short. Too short sometimes, in my opinion. But at least people won't get bored and it's an obvious price for this organization.

The examples are organized around 9 different topics including ones such as naming, comments, exception handling, design, and a sneak peek on what you should learn next.

As you can see, it's really diverse. You'll not be a master of any of these topics, but you can level up your knowledge sufficient enough to write much better code.

Anyway, you cannot become a pro from one step to the other. And that's an idea of the examples in the book as well. Sometimes an example that was on the right side will show on the left in a few pages later. Because, as the authors say, a better solution is not necessarily the good one. There might be several steps leading to an optimal result - if there is any such as thing optimal.

One thing I missed is further readings at the end of each chapter, but probably it's due to the lack of space.

All in all, I liked [Java by Comparison](https://amzn.to/2Ie6E28) a lot! I wish I had one like that when I started my developer career. And I'm pretty sure my former colleagues would have wished for the same!

Happy reading!

_This article has been originally posted on my [blog](http://sandordargo.com/blog/2020/03/04/java-by-comparison). If you are interested in receiving my latest articles, please [sign up to my newsletter](http://eepurl.com/gvcv1j) and [follow me on Twitter](https://twitter.com/SandorDargo)._
Minceraft
Tags: python3
Published: 2020-03-04 06:08:38

---
title: Minceraft
published: true
description: Python3 text adventure walking you through the first day in the world of Minceraft
tags: Python3
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/ckm88fs3vjlzrdrjvnnv.png
---

For my Intro to Computer Programming class, I made a #Python3 text-adventure on @repl.it walking you through the first day in the world of Minceraft! (you read that right!) 

[jpk.codes/minceraft](https://jpk.codes/minceraft)
How to Create a Simple PHP REST API
Tags: howto, php
Published: 2020-03-04 05:43:11

REST(RESTful) API is the most used method of data transfer. However, there are several other ways to transfer data transfer, but REST is popular among them, so let’s know a little bit about REST APIs.

## What is the REST API?

REST API is known as RESTful API is a universal method of data transfer, and it becomes more popular due to its flexibility.

It returns data in JSON format which is supported by all languages. REST API can be integrated with all development platforms.

Here we are going to discuss how to create a simple REST API in Core PHP.

## REST API in PHP

PHP is a popular back-end language in web programming. In addition, it can handle simple to complex APIs. Let’s look at an example about REST API in Core PHP.

PHP has an inbuilt function **json_encode()** to convert PHP objects into JSON format.

### Example

```
<?php
$object = ['Name' => 'Nachiket Panchal', 'Link' => 'errorsea.com', 'data' => ['Key1' => 'Value1', 'Key2' => 'Value2', 'Key3' => 'Value3']];
header("content-type: application/json");
echo json_encode($object); ?>

```

**Explanation**

- First, we define a **PHP object** named $object.
- Next, we set a **header** of **content-type: application/json** to provide content information to the receiver.
- Finally, we convert our $object variable into json with **json\_encode()** function and echo it.

We can also use a database to create a dynamic API for high-end application development.

### Conclusion

We have now learned the most basic REST API development using PHP. We can also develop a more advanced API using PHP.

The post [How to Create a Simple PHP REST API](https://errorsea.com/how-to-create-a-simple-php-rest-api/) appeared first on [errorsea](https://errorsea.com).
A complete guide to UX Design Process
Tags: uiweekly, ux, webdev, design
Published: 2020-03-04 05:39:52

A Complete Guide to UX Design Process

https://bit.ly/2vX2B7y

The advancement of an industry depends upon its reputation in the competitive market.

Users have their own expectations or requirements from a product, system or service.

Fulfilling these essentials will result in a good reputation.


Hence, UX Design assists in understanding the market, client, and end-users before implementing the final product, system or service, in this case, a website.

The Accessibility, Usability and various other factors of the users are identified.

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

#ui #ux #design #hireuidesigner #hireuxdesigner #uxdesign #uidesign #uiux #userinterface #userexperience #appdesigner #webdesigner #productdesign #graphicdesign #uidesigner #uxdesigner #uxtrends #uitrends #cronj #uiinspiration #uxinspiration #uxdesignservices #uidesignservices #uxprocess #creativedesigners #digitaldesign #designers
How to find the Best UI Designer for Web application
Tags: uiweekly, ux, webdesign
Published: 2020-03-04 05:32:48

https://bit.ly/2PEHrCk

Finding the best UI Designer for a web application is an exhausting process, its like finding a needle in a haystack without a magnet. So delve into my blog to understand the works of the UI Designers and their qualities. I hope you'll like it.

Thank you.

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

#ui #ux #design #hireuidesigner #hireuxdesigner #uxdesign #uidesign #uiux #userinterface #userexperience #appdesigner #webdesigner #productdesign #graphicdesign #uidesigner #uxdesigner #uxtrends #uitrends #cronj #uiinspiration #uxinspiration #uxdesignservices #uidesignservices #uxprocess #creativedesigners #digitaldesign #designers
How TO Find Best UI Designer for Mobile Application  
Tags: ux, uiweekly, typescript, android
Published: 2020-03-04 05:32:07

Looking for a UI Designer, great! But are you in a hectic position where you don’t know how to find the best one? Don't worry let me help you.

https://bit.ly/2Iaj3UZ

First things first, Do you have any idea who is a UI Designer? and what role does he play in designing Mobile Applications?

User interface(UI) Designer is an innovative person who comes up with unique ideas to gratify the expectations of end-users. He is the backbone for any Mobile Application and constitutes a crucial part in the success of any Application. He builds a bridge that helps the user to meet and experience the visual and graphical typography.

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

The success of any App depends upon the UI Design. A top-notch UI design helps in fulfilling any task easily without causing any unnecessary glitch.
The design of UI must be done with the utmost care, by balancing all the technical and visual elements precisely to produce a system that is usable and adaptable rather than being only operational.

#ui #ux #design #hireuidesigner #hireuxdesigner #uxdesign #uidesign #uiux #userinterface #userexperience #appdesigner #webdesigner #productdesign #graphicdesign #uidesigner #uxdesigner #uxtrends #uitrends #cronj #uiinspiration #uxinspiration #uxdesignservices #uidesignservices #uxprocess #creativedesigners #digitaldesign #designers
https://www.cronj.com/blog/best-ui-designer-graphic-designer-for-mobile-application
Easy way to Install Docker on Ubuntu
Tags: docker
Published: 2020-03-04 05:00:43

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
 sudo apt-get update
sudo apt install docker.io -     For Official Ubuntu Repositories
--------next step  ->>> 
sudo docker ps
sudo chmod 777 /var/run/docker.sock
sudo docker container ls
sudo docker image ls
sudo docker run hello-world - for normal test
docker-compose up
project setup according to developer:-
mvn openmrs-sdk:setup -DserverId=dserver1 -Ddistro=nwhdistribution-package:1.0.3-SNAPSHOT
Wait untill finish
Mysql 5.6 isn't supported on ubuntu 18.04 version

Tags: mysql
Published: 2020-03-04 04:58:54

sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
sudo apt-get update
sudo apt install mysql-server-5.6 mysql-client-5.6
sudo service mysql restart  / sudo /etc/init.d/mysql restart
mysql -u root -p

sudo /etc/mysql/mysql.conf.d/mysqld.cnf 
Then  -> bind-address = 127.0.0.1 to bind-address = 0.0.0.0
sudo systemctl restart mysql.service
sudo apt install mysql-workbench
GUI Remote Desktop For Windows and Linux
Tags: remote
Published: 2020-03-04 04:52:47

# sudo apt-get update
# sudo apt install xrdp
# sudo systemctl enable xrdp
Grant user remote accesse on client machine.
#sudo apt-get install xauth 
Then use username and passord.
# rdesktop -d dbaport.com -u sumantk  -fP remote IP
Common Linux log files names and usage

Tags: logfildetails
Published: 2020-03-04 04:46:36

/var/log/messages : General message and system related stuff
/var/log/auth.log : Authenication logs
/var/log/kern.log : Kernel logs
/var/log/cron.log : Crond logs (cron job)
/var/log/maillog : Mail server logs
/var/log/qmail/ : Qmail log directory (more files inside this directory)
/var/log/httpd/ : Apache access and error logs directory
/var/log/lighttpd/ : Lighttpd access and error logs directory
/var/log/boot.log : System boot log
/var/log/mysqld.log : MySQL database server log file
/var/log/secure or /var/log/auth.log : Authentication log
/var/log/utmp or /var/log/wtmp : Login records file
/var/log/yum.log : Yum command log fil
iptable any port enable
Tags: iptableanyportenale
Published: 2020-03-04 04:44:49

Login to your server and follow the below steps.
Step-1 : iptables-save > iptable.bak
Step-2 : vim iptable.bak
-> Press i and paste the below rule
-> A INPUT -p tcp -m state --state NEW -m tcp --dport <replace-with-required-portno> -j ACCEPT
-> To paste the rule press Ctrl+Shift+V
-> Then press ESC and then enter :wq! and hit ENTER to save and exit
Step-3 : iptables-restore < iptable.bak
Step-4 : iptables-save
Step-5 : service iptables restart
Step-6 : iptables -L
Post doing the above steps, please check if you're able to access it now.
What is ReactJS?
Tags: react, javascript, webdev, opensource
Published: 2020-03-04 03:26:53

<img src="https://curatti.com/wp-content/uploads/2017/11/ReactJS-1000x500.jpg" width="100%" height="40%" alt="ReactJS"><br>
<b>What is  React JS?</b>
ReactJS is a Javascript library for building frontend web application or UI.
ReactJS allows us to create reusable UI components. It is developed by Facebook.

<b>Features of React</b>
1. Reusable Components
2. Open Source
3. Efficient and fast
4. Work in Browser
5. Large Community

<b>Basic part of React library</b>
a. Components
b. Props.

<b>Components</b>
Components are the building blocks of any React app. Basically any class or function in React is considered as <b>component</b>.

<b>Props</b>
<b>“Props”</b> is a special keyword in React, which stands for properties and is being used for passing data from one component to another.

<b> How React Works?</b>
<br>
<img src="https://content.altexsoft.com/media/2017/05/Real-vs-Virtual-DOM.png" width="80%" height="40%" alt="Working Demostration of React">
<br>
React make the changes and it is done by creating a Virtual DOM by comparing the virtual DOMs with existing loaded DOMs.
React find the changes and render the exact code which is changed instead of rendering the whole page or whole code.

<b> Pros & Cons of React </b>
<b>Pros:</b>
1. Virtual DOM makes the User experience better and the developer’s work faster.
2. Permission to reuse React components significantly saves time.
3. One-direction data flow in ReactJS provides a stable code.
4. An Opensource Facebook library: constantly developing & open to the community.
5. Redux: convenient state container.
6. Wide React and Redux toolset

<b>Cons:</b>
1. The high pace of development.
2. Poor documentation.
3. ‘HTML in my JavaScript!’ – JSX as a barrier.
4. Additional SEO hassle.

As a ReactJs learner and developer, I quite observed a problem is lack of good documentation which leads to some big problems for beginners. So I decided to share my journey on React with my community so I can provide a better explanation of react stuff in a quite simple and easy way and yeah also not bulky in words and paragraphs or I say in minimum words. This is my first post on Dev.to I hope you like it. If you like my post please show your support and give your opinion on comments and tell me if you want more ahead on ReactJs.
Remove Duplicate from Array and Object from Array 
Tags: javascript
Published: 2020-03-04 04:39:17

# From Array
**_.uniq(array) From Lodash**

Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only the first occurrence of each element is kept.

Example 
```
const arr = [1 , 1 , 2 , 3]
const removeDuplicate = _.uniq(arr);
console.log(removeDuplicate)
// Result => [1,2,3]
 ```
# Object From Array 

**_.uniqBy[array, objectName] From Lodash**

This method is like _.uniq except that it accepts iteratee which is invoked for each element in array to generate the criterion by which uniqueness is computed. 

Example 
```
const arr = [{id: 1 , name: 'Dota'}, {id:1 , name: 'Dota'} , {id:2 , name:'LOL'}]
const removeDuplicate = _.uniqBy(arr, 'id');
console.log(removeDuplicate)
// Result => [{id: 1 , name: 'Dota'} , {id:2 , name:'LOL'}]
```
Building an offline To-Do App with React
Tags: react, github
Published: 2020-03-04 04:25:47

In this tutorial, we will create a to-do list app in reactjs. We will use browser local storage to save the tasks, which will keep the tasks even after we close the browser. In the end, we will host this application on Github pages. 

The complete tutorial is originally published on [codesource.io](https://codesource.io/building-an-offline-to-do-app-with-react/).
WP Creative

Published: 2020-03-04 04:20:00

WP Creative provides best Wordpress Web Design by Sydney based Top Rated Designers are Developers. We have successfully completed over 500 projects and have served from Startups to Big Media Agency Websites in Wordpress.

Our dedicated and talented designers, programmers, user-interface specialists, strategists, writers, and project managers are passionate about the level of service and quality of work they deliver. For more details at: https://www.wpcreative.com.au
Spring boot vs Express
Tags: help
Published: 2020-03-04 03:29:54

Hi , I think I should give you a little of background about me. Currently I work with django, and although I like it a lot I think It is time to learn a new framework so I was wondering which one should I learn. I have work with java and Javascript in the past, and although I don´t considered an expert I can work with both technologies in a decent level. I have some current ideas that I can implement with django, but I want to learn a new framework. Some ideas would use AI and multi age systems,others would use a lot of multimedia (mp3 files, mp4,  and large documents), and others would use computer vision.

I know it is a really hard question to answer but if you have any advice on which to choose and why, I would really appreciate the input. Thank you