teleren/devto huggingface dataset:
Liman Üzerinde Fonksiyon Yetkileri
Tags: liman, eklenti, yetki
Published: 2022-04-04 07:54:28

Bir Liman eklentisinde fonksiyon yetkilendirmesinin nasıl yapıldığını inceleyeceğiz.

Örnek olarak Training eklentisindeki "Task Çalıştır" butonunu yetkiye göre görünür hale getirelim.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gszvu9dysqu3kvk73xxq.png)
  
## db.json
 
db.json'a aşağıdaki array'i ekleyelim. Array'in her bir elemanı bir fonksiyon yetkisine karşılık gelir.

> 
name: Fonksiyon Adı
description: Açıklama
isActive: Yetki Sistemine Dahil Et
display: Sunucu Loglarında Görüntüle
```json
"functions": [
        {
            "name": "runTask",
            "description": "RUN_TASK",
            "isActive": "true",
            "display": "true"
        }
],
```
## views/taskview/main.blade.php
Butonun olduğu dosyaya gidip butonu db.json'da tanımladığımız fonksiyon yetkisi ile bağlayalım.
```html
...
  @if(can('runTask'))
    <button class="btn btn-primary" onclick="exampleTask()"><i class="fas fa-check-circle"></i> {{ __("Task çalıştır") }}</button>
  @else
    <b> Task Çalıştırmak İçin Yetkiniz Yok ! </b>
  @endif
...
```
## Test

- Yetkisiz Kullanıcı

Liman arayüzünden yeni bir kullanıcı oluşturalım. Eklentinin çalıştığı sunucuya ve eklentiye yetki verelim. O kullanıcı ile giriş yaptığımızda eklentide butonun yerine bir uyarı mesajı olduğunu görebiliriz.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pssyj33xh9l4lrd4kqri.png)
 

- Yetkili Kullanıcı

Aynı kullanıcıya Administrator hesabı ile arayüzden fonksiyon yetkisi verelim.

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

Kullanıcı uyarı mesajı yerine butonu görebilir hale geldi.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5rjraptno2219cja5huf.png)
Skills Required for Machine Learning Engineer
Tags: machine, machinelearning, engineer
Published: 2022-04-04 07:51:55

Machine Learning is the particular sub-field of Artificial Intelligence. It assists to build automatic systems that may learn by on their own. Then, the device improves their performance simply by learning from encounter with no human treatment. This helps the particular machines make data-directed choices. Whatever the particular machines study through past experience utilizing the available data, the particular machines use it to create predictions. For instance, you'll want used Search engines Maps for routing. It attempts in order to show the quickest route with much less traffic and blockage. It accomplishes this particular task by utilizing Machine Learning algorithms.

## Skills Needed to Become a Machine Learning Engineer
There are particular skills that you need to understand for becoming a successful Device Learning Engineer and they are:

- Programming: Programming is one of the key aspects for any Machine Learning enthusiast. Regarding Machine Learning, we generally use R and Python programming. We can learn both. However, the scope of Machine Learning with Python is high. You may want to know more on R programming. https://writeupcafe.com/explanation-of-r-programming-language/

- Knowing of Data Structures: The data structure is the key of any software. Thus, it is recommended to possess a good grasp of the concepts of information structure.

- Mathematics: We all cannot perform calculation without mathematics. Therefore, we should have knowledge of implementing mathematical concepts into Machine Learning models. These concepts include calculus, linear algebra, statistics, and possibility.
Software engineering: Device Learning models are made to incorporate with the software. Thus, an ML Engineer must have a thorough knowledge of software engineering.

- Data Mining and Visualization: Once we built Machine Learning models on top of various data, it becomes necessary to understand the data. Just for this, a Machine Learning fanatic must have experience in data creation and mining.

- Machine Learning Algorithms: Together with all these, most importantly, we have to have experience in employing various ML methods.
Swift - Methods
Published: 2022-04-04 07:27:31

Methods are functions that are associated with a particular type. Classes, structures, and enumerations can all define :
  1. **Instance** methods 
  2. **Type** methods. 

Type methods by writing the **static** keyword before the method’s func keyword. Classes can use the **class** keyword instead, to allow subclasses to override the superclass’s implementation of that method.

- The **self** Property : 
For instance, it is exactly equivalent to the instance itself.
For Type property, it refers to the type itself.

- To modify the properties of your structure or enumeration within a particular method, you can opt in to **mutating** behavior for that method. It cannot be modified by default from a method. because structures and enumerations are value types.

- Swift structs are **immutable** objects, calling a mutating function actually returns a **new** struct in-place

example :

``` swift
struct Point {
    var x = 0.0, y = 0.0
    mutating func moveBy(x deltaX: Double, y deltaY: Double) {
        x += deltaX
        y += deltaY
    }
}
var somePoint = Point(x: 1.0, y: 1.0)
somePoint.moveBy(x: 2.0, y: 3.0)
```
- Mutating methods can assign an entirely new instance to the implicit self property.

example 1:

``` swift
struct Point {
    var x = 0.0, y = 0.0
    mutating func moveBy(x deltaX: Double, y deltaY: Double) {
        self = Point(x: x + deltaX, y: y + deltaY)
    }
}
```
example 2:
``` swift
enum TriStateSwitch {
    case off, low, high
    mutating func next() {
        switch self {
        case .off:
            self = .low
        case .low:
            self = .high
        case .high:
            self = .off
        }
    }
}
```
How to Manage Coding Consistency?
Tags: beginners, writing, help, health
Published: 2022-04-04 07:20:25

Hi , Welcome Again!

_It All Started....Few days back_
When I felt that I am losing my consistency. 

At some point when you realize that you are declining in your performance.

1. **You Procrastinate**
2. Admire for a long break from things.
3. **Taking breaks too often.**

_Always remember this quote from Bruce Lee- **I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times.**_.
Its very very necessary to HAVE CONSISTENCY. Without consistency - No EXAM , No Code , No Work can be achieved.

## How to Work Consistently?

```
Now the questions arises- How to Work Consistently?
```

> _Step-1_
Remember, Whenever you start feeling any of the above indications- 
**start analyzing what could be the most defensible reasons for such decline?**

1. **Saturation Point?** - Either you are doing the same thing for a much longer period.
2. **Working without any progress**?
3. **Taking no day off**?
4.** Not spending adequate time on managing time**?
5. **Toxic peers**?
6. **Not accomplishing targets**?

> _Step-2_
Your body needs a balance to work efficiently. **Plan Your day in such a way that it contains, sufficient time for joy, and health activities - despite of hectic schedule.** You must allocate a holiday once in a week for yourself.


> _Step-3_
**Make daily short achievable goals**, don't plan for a month in advance. Complete those Goals - strikethrough the completed task in your diary



> _Step-4_
**Create your own environment**, Add the people who have same mentality like you, they should be motivated and focused.



Comment Down More Such Topics.
Myfe - The End?
Tags: discuss, programming, startup
Published: 2022-04-04 07:17:23

So I’ve lost momentum of making  Myfe.
Should I:
1) continue on Myfe, even if it is boring
2) change Myfe to a place where there will be cryptography competitions
3) start on a project

Comment below on what you think I should do, and if you think I should start another project, then comment on what ideas you have for that.
react arrayMap utils
Tags: javascript, webdev, react, opensource
Published: 2022-04-04 06:59:57

Hello React developers,

I created a utility function called reactMap and arrMap. You can make use of it. Please find the attached code below

```
import React from 'react';

export function reactMap(arr, ifFn, elseFn) {
  if (!arr || !Array.isArray(arr) || arr.length === 0) {
    if (elseFn) {
      if (typeof elseFn === 'function') return elseFn();
      else return elseFn;
    } else return false;
  } else {
    if (ifFn) {
      if (typeof ifFn === 'function') {
        return React.Children.toArray(arr.map(ifFn));
      } else return React.Children.toArray(arr.map(() => ifFn));
    } else if (elseFn) return false;
    else return true;
  }
}

export function arrMap(arr, ifFn, elseFn) {
  if (!arr || !Array.isArray(arr) || arr.length === 0) {
    if (elseFn) {
      if (typeof elseFn === 'function') {
        const result = elseFn();
        if (result && Array.isArray(result)) return result;
      } else {
        if (elseFn && Array.isArray(elseFn)) return elseFn;
      }
    }
  } else {
    if (ifFn) {
      if (typeof ifFn === 'function') {
        return arr.reduce((acc, item, i) => {
          const value = ifFn(item, i, arr);
          if (value === false || value === undefined) return acc;
          else return [...acc, value];
        }, []);
      } else return arr.map(() => ifFn);
    } else if (!elseFn) return arr;
  }
  return [];
}

```

Below is the snippet for you to know the way to use it, and also the new structure you can use replacing with the old structure.

this is old structure
```
const arr = [1,2,3,4,5];

{arr && Array.isArray(arr) && arr.map(val=>
    <div key={val}>{val}</div>
)}

{arr && Array.isArray(arr) && arr.length===0 &&
    <div>No data to show</div>
}

{arr && Array.isArray(arr) && arr.length!==0 &&
    <div>arr has content</div>
}

```
this is new structure
```
import { reactMap } from 'utils/reactMapUtils';

const arr = [1,2,3,4,5];

{reactMap(arr, val => <div>{val}</div>, <div>No data to show</div>)}

{reactMap(arr) && <div>arr has content</div>}

```

by using the above structure, we have the advantages that are listed below. 
1. No more null check is required.
2. We don't have to pass the key prop anymore.
3. We don't have to to write array empty condition seperatly anymore too.
4. Don't have to check whether the arr contains data or no.

arrMap functionality similar to reactMap but arrMap always returns an array. it is useful when we want to manipulate array contents
PHP Data Types:
Published: 2022-04-04 06:58:57

**PHP Data Types:**
Variables can store data of different types, and different data types can do different things.
PHP supports the following data types:

- String
- Integer
- Float (floating point numbers - also called double)
- Boolean
- Array
- Object
- NULL
- Resource
**PHP String:**
A string is a sequence of characters, like "Hello world!".
A string can be any text inside quotes. You can use single or double quotes:

```
<?php
$x = "Hello world!";
$y = 'Hello world!';

echo $x;
echo "<br>";
echo $y;
?>
```
**PHP Integer:**
  An integer data type is a non-decimal number between -2,147,483,648 and 2,147,483,647.
Rules of integer:
- An integer must have at least one digit
- An integer must not have a decimal point
- An integer can be either positive or negative
- Integers can be specified in: decimal (base 10), hexadecimal (base 16), octal (base 8), or binary (base 2) notation.
In the following example $x is an integer. The PHP var_dump() function returns the data type and value:

```
<?php
$x = 5985;
var_dump($x);
?>
```
**PHP Float:**
A float (floating point number) is a number with a decimal point or a number in exponential form.
In the following example $x is a float. The PHP var_dump() function returns the data type and value

```
<?php
$x = 10.365;
var_dump($x);
?>
```
**PHP Boolean:**
A Boolean represents two possible states: TRUE or FALSE.
Booleans are often used in conditional testing. You will learn more about conditional testing in a later chapter of this tutorial.

```
$x = true;
$y = false;
```
**PHP Array:**
An array stores multiple values in one single variable.

```
<?php
$cars = array("Volvo","BMW","Toyota");
var_dump($cars);
?>
```
**PHP Object:**
Classes and objects are the two main aspects of object-oriented programming.
A class is a template for objects, and an object is an instance of a class.
When the individual objects are created, they inherit all the properties and behaviors from the class, but each object will have different values for the properties.

```
class Car {
  public $color;
  public $model;
  public function __construct($color, $model) {
    $this->color = $color;
    $this->model = $model;
  }
  public function message() {
    return "My car is a " . $this->color . " " . $this->model . "!";
  }
}

$myCar = new Car("black", "Volvo");
echo $myCar -> message();
echo "<br>";
$myCar = new Car("red", "Toyota");
echo $myCar -> message();
```

**PHP NULL Value:**
Null is a special data type which can have only one value: NULL.
A variable of data type NULL is a variable that has no value assigned to it.

```
$x = "Hello world!";
$x = null;
var_dump($x);
```
**PHP Resource:**
The special resource type is not an actual data type. It is the storing of a reference to functions and resources external to PHP.
A common example of using the resource data type is a database call.
Cloud computing or Blockchain
Tags: webdev, cloud, blockchain
Published: 2022-04-04 06:31:25

Tl;dr Want to specialize in a new field. Cannot decide between Cloud or Blockchain.


Let's start with a little bit of background about myself.
I am a final year student in studying Computer Engineering. Over the past year, I have gotten into web development and have been learning full stack development. I think I have got a pretty good grasp of concepts specializing in frontend ReactJS.

I won't claim to be expert or even good at any of these. I just have gotten my hands dirty with each, got comfortable and done a few side projects on my own.
 
Working on front end is something I enjoy but I feel I haven't found my true calling and with things moving so fast, I don't want to miss out on things. It might just be *FOMO*(fear of missing out) but I do want to get my hands dirty with both - but let's start out with one.

I'm not totally new to Cloud- I have worked with some Virtual instances fire up, run a web server. I'm particularly fascinated with containers and want to try that out next on cloud and also other stuff it has to offer but the sheer amount of things it has to offer paralyze me.

The blockchain hype is surreal. It is everywhere and since it isn't mature so well there might not be so much to learn (not as much as cloud anyways I hope). I have been listening to some talks to get a general overview about what it is and it is something I want to be part of. I think the idea is pretty cool (even though currently most popular use is being used  for scams, NFT and rug pulls). I think it has potential and want to give it a go.

I am a final year student(currently giving final exams - just got easy electives remaining). I also have a part time job (remote - full time after exams) as React developer so I cannot pursue both or progress as fast (want to maintain work-life balance).
I don't want to get stuck (maintaining legacy codes, developing on merge conflicts). I just need someone to guide to guide or if possible perhaps be a mentor. At the very least, I need someone to clarify and help me choose one.

Thanks a lot!
Empleos en Data y Analytics LATAM — Abr 2022 - I
Published: 2022-04-04 06:31:00

Te compartimos las ofertas laborales del mes para áreas de Data, Analytics y Cloud 👨‍💻👩‍💻.

✅[Data Analyst- PwC (Perú, Lima)]
(https://pe.indeed.com/viewjob?jk=60577595d65c9133&tk=1fvpjps0oqt7a802&from=serp&vjs=3)
✅[Data Engineer- Cognite AS (Colombia, Bogotá)]
(https://co.indeed.com/viewjob?jk=b822d187a5877283&tk=1fvpjrpqtpvud802&from=serp&vjs=3)
✅[Data Scientist - Banco Pichincha (Ecuador, Quito)]
(https://ec.indeed.com/viewjob?jk=6820b27eb9fa44bf&tk=1fvpk08s2kf0r802&from=serp&vjs=3)
✅[Machine Learning Analyst - Santander (Chile, Valparaíso)]
(https://cl.indeed.com/viewjob?jk=2d5c1ace7e852a80&tk=1fvpju3tlk26s800&from=serp&vjs=3)
✅[Data Analyst - Atos Global (Mexico, Ciudad de México)]
(https://mx.indeed.com/viewjob?jk=6664d2596af11e79&tk=1fvpk1linm6dc801&from=mobhp_jobfeed)
✅[Data Engineer- Toptal (Bolivia, Santa Cruz)]
(https://www.linkedin.com/jobs/view/2748042263/?eBP=JOB_SEARCH_ORGANIC&recommendedFlavor=SCHOOL_RECRUIT&refId=31fmZPVev8lJkuJ9aXuj6Q%3D%3D&trackingId=71a936Qjlgdg8jOW2aOsVQ%3D%3D&trk=flagship3_search_srp_jobs)
✅[Data Scientist - Disney Media & Entertainment Distribution (Argentina, Buenos Aires)]
(https://ar.indeed.com/viewjob?jk=b698434c06562f9a&tk=1fvpk6insq6rs802&from=mobhp_jobfeed)
✅[Machine Learning - Canonical - Jobs (Venezuela, Caracas)]
(https://ve.indeed.com/viewjob?jk=e54164aa02c349e0&tk=1fvpk8h7mq03v800&from=serp&vjs=3)

Aprende, aplica y crece en proyectos de Data y Analytics en Cloud.

Visita nuestra página:
👉🌐 datahack.la
Websocket not working in React.Js production build
Tags: react, node
Published: 2022-04-04 05:41:18

---
title: Websocket not working in React.Js production build
published: true
description: ReactJs in build cannot connect to nodejs server
tags: react, reactjs, nodejs
---

I created a react App which talks to a node back-end. Everything works fine in development mode. The connection between the front-end and back-end is made through websocket.

Most interesting thing is, that after doing yarn build to create the production build of the app, all the pages work fine. The only thing is that, the page that integrates connection with the back-end is returning error when I inspected it in the browser. I am using Apache Server to run the build version of the app on localhost.

I am using Apache server since python server throws errors on page refresh.

Below is the screenshot. As you can see, node server command, return the expected response from the backend app. The structure of the app is also shown; revealing the relationship between the front-end (smartschool and smartresult) and back-end (smartapi). Only the smartresult makes the request to back-end. How do I resolve this connection problem? Any help will be appreciated. Thank you.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uu5eb50s5ep53hy43817.png)
Useful Utility React.js Libraries
Published: 2022-04-04 06:29:26

1. React-table. It is a collection of hooks for building powerful tables and datagrid experiences that are fast & lightweight. Here is a link to it: https://react-table.tanstack.com

2. Draft-js. It is a JavaScript rich text editor framework, built for React and backed by an immutable model. Here is a link to it: https://draftjs.org

3. Perfect-scrollbar. This a a minimalistic but perfect scrollbar plugin. Here is a link to it: https://perfectscrollbar.com

4. React-select. A flexible select input control for React with multiselect, autocomplete, async and creatable support. Here is a link to it: https://react-select.com

5. React-tabs. An accessible and easy tab view component for ReactJS. It's a great library to add tab functionality. The link: https://reactcommunity.org/react-tabs

6. React-slick. A carousel component built with React. It is a React part of slick carousel library. https://react-slick.neostack.com

7. react-spinners. It is a great collection of loading spinners with React.js based on Halogen. https://www.davidhu.io/react-spinners

8. React-dnd. A set of React utilities to help you build complex drag & drop interfaces while keeping components decoupled. https://react-dnd.github.io/react-dnd

See you soon.
Create navigation screens in expo project 🧑‍💻
Tags: reactnative, expo, javascript, beginners
Published: 2022-04-04 06:26:51

Today ,we are creating navigation screens in expo project from scratch. For that let's first of all create a react-native project.

```
expo init online-store
```
after running above command click enter , it will choose default options.

Now ,we have our react-native project. now we need to install some more dependencies, which are as follow -

```
npm install @react-navigation/native @react-navigation/native-stack
```
```
expo install react-native-screens react-native-safe-area-context
```
Now go to app.js and delete existing code, we don't need it. we need below code.

```
import { StyleSheet, Text, View } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import Homepage from "./Screens/Homepage";
import MenSection from "./Screens/MenSection";
import WomenSection from "./Screens/WomenSection";
import Contactus from "./Screens/Contactus";
const stack = createNativeStackNavigator();
export default function App() {
  return (
    <NavigationContainer>
      <stack.Navigator>
        <stack.Screen
          name="Home"
          component={Homepage}
          options={{ title: "Welcome to online store" }}
        />
        <stack.Screen name="Men" component={MenSection} />
        <stack.Screen name="Women" component={WomenSection} />
        <stack.Screen name="Contact" component={Contactus} />
      </stack.Navigator>
    </NavigationContainer>
  );
}
```
If you run your project now, you can see homepage on first time. If we want to go to another page then we can use button or any other onClick method here and for that we have prop **{navigation}** which can help us to redirect to another page.

```
const Homepage= ({ navigation }) => {
  return (
    <Button
      title="Go to men's section"
      onPress={() =>
        navigation.navigate('Men', { state: 'Id of clothing' })
      }
    />
  );
};
const Men= ({ navigation, route }) => {
  return <Text>This is {route.params.state}'s profile</Text>;
};

```

## Conclusion
That's it for react-native navigation, now you can play it with more as use case and make it more advance as you want.
Marketing Games as a Part of Brand Strategy
Tags: marketing, gamedev, brand, games
Published: 2022-04-04 06:26:37

{% youtube -nMmsof91f4 %}

Hi! This time some business&marketing topics. Why do a brand might need a marketing game? Let us briefly explain how to use mobile games in a brand strategy and how to build a competitive advantage thanks to them. 

Enjoy! You can also read the article at [Frontend House](https://frontendhouse.com/experts-zone/marketing-games-as-a-part-of-brand-strategy-experts-zone-17).
Changing the style of Information. Startup Recruitment.
Tags: solidity, ethereum, blockchain, smartcontracts
Published: 2022-04-04 06:19:15

This is Ame Amengan,
I’m looking for the best and brightest pro in the Ethereum smart contract community to be the lead developer in a venture-backed ETH startup company.
A solid understanding of oop and software
architecture is a must.

The ideal candidate would have at least several years of web application development experience, having built applications from the ground up. Experience in a start-up environment is a plus or just being super hard-working, self-motivated, and creative. If you think you have no life or can devote as many hours as the job needs then sure, come.

Compensation can be in the form of equity or a salary, or somewhere in-between, depending upon how things go.
If interested, please send your answers to the following questions at amraditya nine eight nine at gmail dot com (amraditya989@gmail.com)

- What are your qualifications for this position?
- What interests you about smart contracts and development in general?

From there, we can talk about things like compensation and references and I can answer your questions as well. Thanks in advance to any interested parties. If anyone knows another good place to recruit, I am all ears.