teleren/devto huggingface dataset:
Php Crop Image Before Upload
Published: 2020-02-22 12:40:14

---
title: Php Crop Image Before Upload
published: true
date: 2020-02-13 00:00:00 UTC
tags: 
canonical_url: 
---

In this tutorial you will learn Php cropper js example this example will help you Php crop image before upload This tutorial will give you simple example of crop image using cropperjs Php you will learn Php crop image before upload cropperjs Lets see bellow example cropper js Php example
Working with AWS Lambda and SQS
Tags: engineering, general
Published: 2020-09-16 05:48:16

---
title: Working with AWS Lambda and SQS
published: true
date: 2020-02-13 00:00:00 UTC
tags: Engineering,General
canonical_url: https://www.loginradius.com/engineering/blog/working-with-aws-lambda-and-sqs/
---

This blog is a short guide on implementing AWS Lambda and SQS together. First, we’ll introduce these technologies and explain why they work well together, then walkthrough some configurations and invocation using a simple Nodejs script. What are they?AWS Lambda is popular…

   
[Read On](https://www.loginradius.com/engineering/blog/working-with-aws-lambda-and-sqs/)
Naming Conventions Cheatsheet: Rails
Tags: rails, beginners, ruby, syntax
Published: 2020-02-12 23:57:38

We all suffer from the stress that comes with realizing that you named something correctly but didn't follow the right convention... its 2020.. Let's put that stress to an end! 
Below ill give you a summary for ruby/rails naming conventions..

We'll start with general ones than go into filesystem related conventions! 

**Ruby**

(Class names) are CamelCase.

(Methods) and (variables) are snake_case.


**Database**

+--------------------------+
| top_food_spots           |
+------------+-------------+
| id         | ID          |
| sighted_at | DATETIME    |
| location   | STRING      |
+------------+-------------+

+------------------------------+
| Users                        |
+---------------------+--------+
| id                  | ID     |
| name                | STRING |
+---------------------+--------+

(Database tables) = snake_case. 
(Table names) = plural.
(Column names) in the database = snake_case (but are generally singular.)


**Model**

(Model class names) = CamelCase. 
These are singular, and will be writting automatically to the plural database table name.

(Model attributes and methods) = snake_case 
and match the column names in the database.

**
app/models/bigfoot_sighting.rb

class TopFoodSpots < ActiveRecord::Base
  # This class will have these attributes: id, sighted_at, location
end
**

**Controllers**

(Controller class names) = CamelCase 
but (The Controller suffix) is always singular. The name of the resource is usually plural.

(Controller actions) = snake_case 
and usually match the standard route names Rails defines 
(index, show, new, create, edit, update, delete).


app/controllers/profiles_controller.rb

ProfilesController < ApplicationController
  def show
    # ...
  end
  # etc
end
How do I secure this Spring Boot + Thymeleaf + Vue.js app?
Tags: spring, vue, java, help
Published: 2020-02-12 23:33:52

I have this app:

{% link https://dev.to/brunodrugowick/complete-crud-with-spring-boot-vue-js-axios-fg1 %}

And I'm wondering how do I properly secure it? The app has:

- Server-rendered pages with Thymeleaf.
- An API providing data for the pages.

What's the proper way to secure and its underlying limitations considering this architecture?

Some questions that pop on my mind, to help you understand why I'm asking:

- Can I go with Spring Security defaults (adding csrf token on my forms that POST/PUT with Vue.js)?
- How do I integrate this with my DELETE via API, for example?
- Should I disable csrf?
- Does this architecture makes sense? What are the caveats?

...

---

Cover image from [Christoph Scholz](https://www.flickr.com/photos/140988606@N08/28124222664).
PoEdit 2.3 - Now with Volt support
Tags: poedit, volt, translations
Published: 2020-02-12 23:48:22

---
title: PoEdit 2.3 - Now with Volt support
published: true
date: 2020-02-12 23:27:06 UTC
tags: poedit,volt,translations
canonical_url: https://blog.phalcon.io/post/poedit-2-3-now-with-volt-support
---

[Václav Slavík](https://github.com/vslavik), the owner of Poedit has recently released version 2.3.

For those that do not know, [Poedit](https://poedit.net) is a very handy editor for translating content that is stored in `po` files.

Václav wrote in our forum:

> I have released a new version of Poedit, the translation editor that is commonly used to handle gettext translations and in particular used to extract them from source code: [https://poedit.net/news/poedit-2.3/](https://poedit.net/news/poedit-2.3/)
> 
> Up until now, extracting translations from Volt templates into PO files involved some fragile hacks (see e.g. here on the forum) that sometimes missed some strings and was somewhat hard to setup.
> 
> Poedit Pro already had a solution for the same problem with Twig templates for a couple of years. Starting with v2.3, it can do the same for Volt. All it took was realize how similar the two languages are… thanks [@Zaszczyk](https://github.com/Zaszczyk) for nudging me in the right direction!

Thank you to [Václav](https://github.com/vslavik) for the integration!

* * *

Chat - Q&A

- [Discord Chat](https://phalcon.io/discord)
- [Forum](https://phalcon.link/forum)

Support

- [OpenCollective - Support Us](https://phalcon.io/fund)
- [Store - Merchandise](https://phalcon.io/store)

Social Media

- [Telegram](https://phalcon.io/telegram)
- [Gab](https://phalcon.io/gab)
- [MeWe](https://phalcon.io/mewe)
- [Parler](https://phalcon.io/parler)
- [Reddit](https://phalcon.io/reddit)
- [Facebook](https://phalcon.io/fb)
- [Twitter](https://phalcon.io/t)

Videos

- [BitChute](https://phalcon.io/bitchute)
- [LBRY](https://phalcon.io/lbry)
- [YouTube](https://phalcon.io/youtube)

<3 Phalcon Team
Five Myths of Salary Negotiation
Tags: career, discuss, tips, salary
Published: 2020-02-12 23:06:58

In this video I debunk five negotiation myths that I've seen personally and from talking with candidates.

Do these ring true for you? Is there something I missed or got wrong? Are there other negotiation myths you want to debunk?

Please discuss!

---


CANDIDATE PLANET:
Advice for candidates applying to tech companies by Lusen Mendel and Adam Dangoor. We answer questions from engineers, developer advocates, designers, marketers, all kinds of managers and many more.

Email ask@CandidatePlanet.com with questions. Adam and I will email you personal advice, and anonymize your question for the show so that other candidates can benefit, too.

SUBSCRIBE:
☆ YouTube ☆ https://youtube.com/channel/UCdvny6qs8e4VUJIG01puw2Q
☆ Newsletter ☆ https://dangoormendel.com/newsletter

MORE ABOUT US:
☆ Website ☆ https://dangoormendel.com
☆ Speaking Inquiries ☆ lusen@candidateplanet.com
☆ Client Inquiries ☆ hello@dangoormendel.com
☆ LinkedIn Lusen ☆ https://linkedin.com/in/lus
☆ LinkedIn Adam ☆ https://linkedin.com/in/adamdangoor
☆ Twitter Lusen ☆ https://twitter.com/staycalmcomic
☆ Twitter Adam ☆ https://twitter.com/AdamDangoor

{% youtube ceTWVMdxazw %}
Call() Apply() and Bind() in JavaScript
Tags: javascript
Published: 2020-02-12 23:00:35

**Disclaimer:** This post will not ruin Game of Thrones for you :)

**Call:** You can use the `.call()` method to invoke a function or bind methods to objects that do not have those methods. The first parameter is what the method being called is being bound to. The other parameters are arguments passed into that method. So it would look something like this:

`someMethod.call(what object you want a method to be bound to, parameters of method)`

In it's most basic form the `.call()` the method simply allows you to invoke a function

```javascript
function gameOfThrones(){
  return 'Jaime Lannister'
}

gameOfThrones.call() // Jaime Lannister
// This is the same as doing 
gameOfThrones() // Jaime Lannister

```

Now that we got that useless method out of the way, let us look at the heart of this built-in JavaScript method.

```javascript
const jonSnow = {
  name: "Jon Snow",
  getName: function() {
    console.log(this.name);
  },
  isStillAlive: function(boolean) {
    return boolean ? this.name + " is alive" : this.name + " is dead";
  }
};

// branStark object does not have the methods the `jonSnow` object has.
// How can we give it those methods?

const branStark = {
  name: "Bran Stark"
};

// We just called the getName method on the branStark object 
// by binding the getName method from the jonSnow object to branStark
jonSnow.getName.call(branStark); // Bran Stark


// We are binding the isStillAlive method to the branStark object
// the next parameter is the arguement to pass into the method
jonSnow.isStillAlive.call(branStark, true); // Bran Stark is alive

```

**Apply:** Apply does the same thing except the arguments passed into the methods are put into an array



```javascript
// the difference between call and apply is that apply takes
// in an array of parameters

jonSnow.isStillAlive.apply(branStark, [true]); // Bran Stark is alive

```
**Bind:** Bind returns a new function with its `this` keyword being bound to the argument passed into the method. Bind only does the first part of `call()` and `apply()` which is the binding. The function is also invoked manually. In apply and call we saw the methods invoked automatically. Here is an example:

```javascript
// bind does not run the function unlike call and apply.
// It simply returns a new function with a new this context

let isBranStillAlive = jonSnow.isStillAlive.bind(branStark,true);
isBranStillAlive(); // Bran Stark is alive

// or you could do
jonSnow.isStillAlive.bind(branStark, true)(); // Bran Stark is alive

// This will yield the same result as well
jonSnow.isStillAlive.bind(branStark)(false); // Bran Stark is dead

// In these examples, we see that we are manually invoking the functions.

```
Looking for an open source project that uses Rails + CircleCI
Tags: discuss
Published: 2020-02-12 22:59:11

---
title: Looking for an open source project that uses Rails + CircleCI
published: true
tags: discuss
---

**Seeking:** An open-source project built with Rails, using CircleCI, that would be interested in being set up with a dual boot for an upgrade. This setup would be complimentary, to be used in demo content!

The team at [Planet Argon](https://www.planetargon.com/) is looking for an open source project that uses CircleCI that would be interested in upgrading their application using a [dual boot method](https://medium.com/oreilly-engineering/upgrading-rails-apps-with-dual-boot-e5c271e68a6e) in the future. You don't have to be ready for an upgrade _right now_, as this would set you up for success when you decide to upgrade. 

Do you know any open source projects that might fit the bill? Have any leads to direct me to? Drop 'em in a reply below!

Thanks!
How to make a beautiful terminal
Tags: zsh, beginners, productivity, terminal
Published: 2020-02-12 22:46:10

In this video, we show you how to make your terminal looks more beautiful and attractive with iTerm2, Oh My Zsh, and the PowerLevel10K theme.

{% youtube JnJm4gRrWN8 %}

Although the tutorial is done on iTerm2, you can easily apply the same method to the default terminal app on your mac or linux computer if you want.

Powerlevel10k can be used as a replacement for Powerlevel9k theme. It's fast, flexible and easy to configure with interactive question-answer style.

Or if you prefer a minimalist theme, try the default robbyrussell:

{% youtube OWkLmY6rEQU %}

---

If you like the article, please [subscribe to our Youtube channel](http://bit.ly/techschoolguru) and [follow us on Twitter](https://twitter.com/techschoolguru) for more tutorials in the future.

---
If you want to join me on my current amazing team at Voodoo, check out [our job openings here](https://bit.ly/voodoojobs). Remote or onsite in Paris/Amsterdam/London/Berlin/Barcelona with visa sponsorship.
Good readings this week – Learning SEO
Published: 2020-02-13 10:20:31

---
title: Good readings this week – Learning SEO
published: true
date: 2020-02-12 22:32:20 UTC
tags: 
canonical_url: https://boobo94.github.io/
cover_image: https://i1.wp.com/boobo94.xyz/wp-content/uploads/2019/11/good-readings.jpg
---

In the last period I was very eager to learn more about [SEO](https://cmevo.com/seo-services/). For this week I have only these, but stay close, because more will come.

- https://www.codeinwp.com/blog/starting-a-blog/
- https://www.codeinwp.com/blog/content-strategy/
- https://www.orbitmedia.com/blog/internal-linking/
- https://www.codeinwp.com/blog/practical-seo-guide/
- https://themeisle.com/blog/guest-blogging-guide/
- https://themeisle.com/blog/guest-blogging-guide/

The post [Good readings this week – Learning SEO](https://boobo94.github.io/) appeared first on [boobo94](https://boobo94.github.io).
How do you write a breakpointed visual debugger?
Tags: help
Published: 2020-02-12 22:32:15

I wonder how to write a visual debugger? My question I guess is one that isn't asked all that often. And usually the articles are fairly hard to follow.

Given I have a hypothetical programming language and I want to step through some code, how exactly do I pause execution and evaluate and so on. Do these tools just read the an AST until a given point or is something more low level happening?

Has anyone wrote one? I'd love to hear your thoughts! 👨‍🔬
Hacking Random Generator (linear congruential generator)
Tags: security, computerscience, challenge, codeabbey
Published: 2020-02-12 20:56:05

New problem: [Cracking "LCG" Random Generator @ CodeAbbey](https://www.codeabbey.com/index/task_view/cracking-lcg)

Default random generators in some languages (`Python`, `PHP7`, `JavaScript`) switched to XorShift or Mersenne Twister. However in others - most notably, `Java` and linux/posix **rand** used in `C/C++` - it still uses linear congruential generator in very simple form:

    X_next = (A * X_cur + C) % M

The new problem at CodeAbbey is dedicated to exercise of hacking such generator. I.e. about predicting next results after observing few first ones.

This both helps to get better understanding of modular arithmetic - and to remember that default random generators shouldn't be used for hashing or encrypting sensitive data - or building online casinos :)
CKAD - Revision - Configuration
Tags: kubernetes, linux, devops, docker
Published: 2020-02-05 21:15:21

# ConfigMaps

Data in ConfigMaps in kubernetes **is not encoded or encrypted** and contains *key-value* pairs or plain configuration files in any format.

Here are a few uses of ConfigMaps:

* Pod env vars from single or multiple ConfigMaps
* Use ConfigMap values in Pod commands
* Populate Volume from ConfigMap
* Add ConfigMap data to specific path in Volume
* Set file names and access mode in Volume from ConfigMap data
* Can be used by system components and controllers.


### Creating ConfigMaps

ConfigMaps can be created in one of the three following ways:

```
kubectl create configmap myconfigmap \
--from-literal=city=London \             
--from-file=./myconfigmapfile.txt \
--from-file=./myconfigmapdirectory/
```
which results in the following ConfigMap:
```
k get configmap myconfigmap -o yaml

apiVersion: v1
data:
  city: London
kind: ConfigMap
metadata:
  creationTimestamp: "2020-01-12T11:22:43Z"
  name: myconfigmap
  namespace: default
  ...
```

# Security Context

A security context defines privilege and access control settings for a Pod or Container so we can limit what processes running in containers can do. For example we can limit:

* the user ID of the process (UID)
* the Linux capabilities
* filesystem groups

If we want to enforce that containers cannot run their process as root user we can add **runAsNonRoot: true** to the pod spec. Or we can define a PodSecurityPolicy to that effect.

**To automate the enforcement of security contexts, we can define [PodSecurityPolicies (PSP)](https://kubernetes.io/docs/concepts/policy/pod-security-policy/)**

Pod Security Policies are cluster-level rules that govern what a pod can do, what they can access, what user they run as...

For a PSP to be enabled we must first configure the admission controller of the **controller-manager** to contain **PodSecurityPolicy**.

# Service Accounts

Service accounts are used by processes to access the API (a service account provides an identity for processes than run in a pod)
Devlog #02 - Fixing bugs from pass days and adding Particle System Day 3~4
Tags: gamedev, devlog
Published: 2020-02-12 20:44:05

---
title: Devlog #02 - Fixing bugs from pass days and adding Particle System Day 3~4
published: true
description: Fixed bug that make character pass through the other
tags: 
- gamedev
- devlog
series: My First Game Jam Winter 2020
---
*You can read the original post in [my personal blog](https://luturol.github.io/gamedev/Devlog-02-Fixing-bugs-from-pass-days-and-adding-Particle-System)*

Days: 28/01 and 29/01

# Bugs fixed

In the last devlog we had an issue with the collision that I couldn't solve. But fortunately we found the answer in [Unity API!](https://docs.unity3d.com/Manual/CollidersOverview.html). The answer was in the rigid body added to Treant. 

>Colliders on a GameObject that has a Rigidbody are known as dynamic colliders. Static colliders can interact with dynamic colliders but since **they don’t have a Rigidbody, they do not move in response to collisions**

## Particle System

After the bug was fixed we add a particle system to make a blood effect for when the monster or player got a hit it shows up. In the beginning, it won't show in the treant. We had to make a Prefab from the particle system, edit the properties to make small and finally add to the Enemy script.

When we called from the script, it won't show the particles. To fix that bug we use this answer [Particle System object (tab Renderer) value of "Sorting Fudge" to -100](http://answers.unity.com/answers/1407848/view.html).

Now we have this:
![Player hitting the tree](https://media.giphy.com/media/fwtzcLu89NWlCFgTbb/giphy.gif)

The code to execute this is simple:

```csharp
var bloodClone = Instantiate(bloodEffect, 
                             gameObject.transform.position, 
                             gameObject.transform.rotation);

Destroy(bloodClone, bloodClone.GetComponent<ParticleSystem>().main.duration);
```

Added to Enemy.cs, TakeDamage method. Now every time the object gets hit, it will instantiate a particle system that will be destroyed when it`s over

### For the next days, we want to:

1. Change the scene layout for one that has snow ground and with trees
1. Add the bonfire
1. Add idle animations from is a side character
1. Fix the bug that character can damage enemy hitting from down or up if the enemy is near
Data engineering portfolio projects?
Tags: dataengineering, data, portfolio
Published: 2020-02-12 20:32:23

---
title: Data engineering portfolio projects?
published: true
description: 
tags: ["data engineering", "data", "portfolio"]
---

Hey everyone! 

There are TONS of examples out there for web development and software engineering portfolios, but are there are any notable data engineering examples for reference? I am already working as a junior data engineer, but I know that I need to do some projects to get my skills to the next level. I would really benefit from some inspiration! 

I would imagine that a data engineering portfolio should showcase some experience in the following:
* API usage
* cron jobs
* DAGs
* data cleaning
* data scraping
* data visualization
* ETL
* git/version management
* Python
* SQL

Does anyone have any thoughts on things I should add/cut from the general list I came up with above? I would love to see any example portfolios or projects that may be floating around. 

Cheers!
Rewrite this SQL for NoSQL, graph-db (e.g. Neo4j)
Tags: sql, database, help, nosql
Published: 2020-02-12 20:04:16

I'm trying to recollect some examples of SQL queries which I couldn't rewrite into queries for graph database some years ago. Then it was Orient, but for now, probably, let's assume Neo4j is used (or other NoSQL database you believe is suitable).

Here is one example, but I'm not sure. Please tell if it fits some NoSQL database (supposedly, graph db) nicely or not. Also feel free please to suggest your own queries to attempt translation, so we can think together.

```sql
-- mysql 5.6 or alike

create table users(id int, name text);
create table rooms(id int, label text);

insert into users values (1, 'Peter'), (2, 'Slava'),
  (3, 'Margo'), (4, 'Clown'), (5, 'Pedros');
insert into rooms values (1, 'alpha'), (2, 'beta');

-- now let's assign users to rooms according to modulo of their id

select concat(name, ' in ', label)
    from users u join rooms r
    on u.id % 2 + 1 = r.id;
```

This is a bit artificial, but the main idea is this - I need join, but on something which doesn't have meaning of real relation. E.g. users could be assigned to such rooms today, but tomorrow the 3-rd room is available and they are reassigned by `mod 3`. _I believe when I had difficulties with project, it was about assigning transactions to various periods and categories or something like this - don't remember well, regretfully - but it should be roughly the same..._
Convert a decimal fraction to binary
Published: 2020-02-12 19:52:06

In this article, we deal with item 5 of the following key skills that build up to understanding the [floating point system](https://en.wikipedia.org/wiki/IEEE_754):

1. Define and identify the most and least significant bits in a word. Count how many combinations are possible in a word given its bit length.
2. Encode a positive integer in binary. Decode an unsigned integer to decimal.
3. Encode an integer in two's complement notation. Decode a signed integer to decimal.
4. Use sign extension to expand the number of bits in a word. Explain the mathematics.
5. Convert a decimal fraction to binary. Explain why this does not require any particular encoding scheme, such as a floating point standard.

# Expanding our idea

We use the same method as we used before to convert number representations.

## Practice

**QUESTION 1** Convert the decimal number 25.5 to unsigned binary.

**Answer**: 25.5 - 16 = 9.5

9.5 - 8 = 1.5

1.5 - 1 = 0.5

0.5 - 0.5 = 0

The powers of two used are: the 4th, 3rd, 0th, and negative 1st. Negative powers of two gets placed to the right of the binary point. Arrange: `0001 1001.1`.

**QUESTION 2** Convert the decimal number 16.1 to unsigned binary.

**Answer**: 16.1 - 16 = 0.1

0.1 - 0.0625 [ or 2^-4 ] = 0.0375

0.0375 - 0.0315 [ or 2^-5 ] = 0.00625

0.00625 - 0.00390625 [ or 2^-8 ] = 0.00234375‬

0.00234375‬ - 0.001953125 [ or 2^-9 ] = 0.000390625‬

0.000390625‬ - 0.000244140625‬ [ or 2^-12 ] = 0.000146484375‬

...


We see that the pattern `.0001 1001 1001 ...` is repeating. Arrange the bits: `0001 0000.0001 1001 1001 ...`.

**QUESTION 3** Convert `1011.0101` to decimal.

The bits below the binary point (.) have the values of the negative powers of two.

The answer is 2^3 + 2^1 + 2^0 + 2^-2 + 2^-4 = 10.3125‬.

It's not that difficult!