teleren/devto huggingface dataset:
★ Preventing spam submitted through forms
Tags: php, laravel
Published: 2020-01-02 23:15:50

---
title: ★ Preventing spam submitted through forms
published: true
date: 2019-01-07 11:00:00 UTC
tags: php, laravel
canonical_url: https://freek.dev/1240-preventing-spam-submitted-through-forms
---

When adding a form to a public site, there's a risk that spam bots will try to submit it with fake values. We recently released a new package, called [laravel-honeypot](https://github.com/spatie/laravel-honeypot), that can detect these spammy requests.

## How honeypots work #

The majority of spam bots are pretty dumb. You can thwart most of them by adding an invisible field to your form that should never contain a value when submitted. Such a field is called a honeypot. These spam bots will fill all fields, including the honeypot. When a submission comes in with a filled honeypot field, our package will discard that request.

## Using the package #

Using it is easy. First, you must add the `@honeypot` blade directive to any form you wish to protect.

```html
<form method="POST" action="{{ action(App\Http\Controllers\ContactFormSubmissionController::class, 'create') }}")>
    @honeypot
    <input name="myField" type="text">
</form>
```

`@honeypot` will add two fields: `my_name` and `my_time` (you can change the names in the config file).

Next, you must use the `Spatie\Honeypot\ProtectAgainstSpam` middleware in the route that handles the form submission. This middleware will intercept any request that submits a non-empty value for the key named `my_name`.

Most humans need a bit of time to fill out a form. The other field added by the Blade directive, `my_time`, is used to detect if the form was submitted faster than a second.

```php
use App\Http\Controllers\ContactFormSubmissionController;
use Spatie\Honeypot\ProtectAgainstSpam;

Route::post([ContactFormSubmissionController::class, 'create'])->middleware(ProtectAgainstSpam::class);
```

If your app has a lot of forms handled by many different controllers, you could opt to register it as global middleware.

```php
// inside app\Http\Kernel.php

protected $middleware = [
   // ...
   \Spatie\Honeypot\ProtectAgainstSpam::class,
];
```

## In closing #

A honeypot is an excellent first line of defense against spam. In my projects, it could prevent most cases of spam submission. Though a honeypot easily fools most bots, there are smarter bots around too that after a while can detect the honeypot fields. In that case, a [Google Recaptcha](https://www.google.com/recaptcha/intro/v3.html) or using a service like [Akismet](https://github.com/nickurt/laravel-akismet) can be a good second line of defense.

If you like [laravel-honeypot](https://github.com/spatie/laravel-honeypot), be sure to check out [the other packages](https://spatie.be/open-source) team [Spatie](https://spatie.be) has released previously.
PHPNews
Tags: php, laravel, symfony, wordpress
Published: 2019-01-07 10:43:53

---
title: PHPNews
published: true
description: Get latest PHP news and articles from top PHP developers and blogs.
tags: php, laravel, symfony, wordpress
cover_image: 
---

PHPNews is app for PHP programming language that keeps you updated with latest PHP news, articles and updates from top PHP developers and blogs. Being up-to-date with your language of choice is crucial to become a better developer by learning what is hot, trending and best practices.

[Checkout PHPNews](https://play.google.com/store/apps/details?id=io.codeinphp.phpnews)
What is your git merge strategy?
Tags: git, help, bestpractices
Published: 2019-01-07 10:37:11

---
title: What is your git merge strategy?
published: true
tags: #git #help #bestpractices
cover_image: https://raw.githubusercontent.com/meanin/dev-to-articles/master/img/2019-01-07-git-merge-strategy/git-flow.png
---

# Branching

Branching out is a common first step as you work on a new task. `git checkout -b 'name of your brand new branch'` should be familiar for most of you. This routine keep root branch (master/ develop whatever) clean, until someone finishes her/his work. Then you have to somehow put your changes into the root branch.
![img](https://git-scm.com/figures/18333fig0315-tn.png)

# Merge
The default strategy, for integrating changes into a root branch is merge operation. Of course, if you meet any conflicts, you have to resolve them, but finally, the code base will be integrated. 
![merge](https://git-scm.com/figures/18333fig0317-tn.png)

# Squash
There is an option while merging changes, to use `--squash`. You will end up with one merge commit, put on top of the root branch history. From my perspective, this method is really risky. When a team does not stick to the pull requests/branch naming convention, it can have dramatic consequences. Imagine going back in the repository history through commit named `update`, `align with newer version`, `test`, `more tests`, etc. This option will simplify history view, but it is only for mature teams.
![squash](https://raw.githubusercontent.com/meanin/dev-to-articles/master/img/2019-01-07-git-merge-strategy/squash.png)

# Mix
While I was doing a research for this article, I found [this](https://blog.carbonfive.com/2017/08/28/always-squash-and-rebase-your-git-commits/). A really nice mix of the merge and squash in a single approach. Again, here you will need a mature team, to follow the naming convention, but is a nice consensus.

# Question?
Personally, I prefer to use standard merge. I have met teams, which use a `--squash` option for all of the feature branch merge and I can see the pros of this approach. I miss detailed git history in that scenario after all. What is your default merge strategy?


Images source: [git-branching-and-merging](https://git-scm.com/book/en/v1/Git-Branching-Basic-Branching-and-Merging)
Feedback on New Idea
Published: 2019-01-07 06:55:11

---
title: Feedback on New Idea
published: true
description: Trying to find feedback for my new product idea.
tags: 
---


Hi Guys, 

Hope you are doing well.   
I am trying to validate an idea.   

I am working on a platform where a number of credible CTOs like you are available to normal startups and teams. 

They can get good insights and suggestions on their architecture or any technical limitations they are facing. 
The goal is to reduce inequality in technology by learning from product specific expert in that industry.

I am trying to find market fit so any feedback is welcome :)

Regards,
KM
Starting at My First Startup 
Tags: startup
Published: 2019-01-07 06:18:32

---
title: Starting at My First Startup 
published: true
description: 
tags: startup
---

No one likes change. It’s uncomfortable. It’s scary. It makes people uneasy trudging toward the unknown. But when I found myself at a fork in the road of my career, it became clear to me. I must change. Industries don’t stay static and neither should people.

I am no stranger to the software industry. I’ve worked at large corporations and mid-sized companies. I’ve built a comfortable career at fairly successful companies and have learned a great deal from working on interesting projects. I spent 12 years at my last company and though it was going fine, there was a little voice inside of me that kept reminding me to not get too comfortable.

When I received my opportunity to work at SKUR, I was ecstatic. I always wanted to work for a startup and loved the idea of being able to contribute to a company at the ground level. The first two weeks was a whirlwind of a lot of new information. This is true both on the technology front and domain front. I learned about AWS EC2 instances, S3 buckets and CodePipelines. I went over the architecture of a LAMP stack application, read Python code, committed changes to the website and gave UX input. I learned that many scans make up a point cloud and that all scans default to meters. These may just be many strange words for some, for me they represent a breaking out of my former comfort and the beginning of a journey with the exciting company that SKUR is.

I’ve been told the construction world is one of the slowest industries to adopt technology and companies are just starting to explore innovations that will push them to the next level. I am excited to help contribute towards that goal and excited to walk along that same path.

This article was [originally posted](https://skur.com/2018/06/19/starting-first-startup/) on the SKUR corporate blog.
Girl Geek Thoughts - Mentorship
Tags: mentorship
Published: 2019-01-07 05:51:35

---
title: Girl Geek Thoughts - Mentorship
published: true
description: 
tags: mentorship
---

My first tech mentor was named Simon. He sat me down in front a computer running MS-DOS when I was 9 years old. He encouraged me to explore the system using the `cd` and `dir` commands. He instructed me to look for files ending in `exe`, `bat` and `com` in order to run them. He taught me how to copy, move and rename files. He showed me his CAD drawings and how they related to his work with machinery. He was the best mentor a little girl could have. He was patient, understanding, enthusiastic, and he is also my father.

I have heard a lot about the Women in Tech movements over the years. I really love that there are more events and resources for women today, both young and mature, to advance their careers and raise awareness. Perforce has also participated in some of these events. In December of 2011, we hosted Bay Area Girl Geek Dinner #14. It was an awesome event, so I can’t tell you how pleased I was to hear we were going to have another one. I also thought it was impeccable timing that we sponsored Girl Geek Dinner #64 shortly after Google released statistics regarding the diversity in their workforce. It was interesting to read that women make up about 18% of all computer science graduates in the U.S. I was a CS major towards the end of the first dot com bubble, so for me the numbers were closer to 28%.

I am almost certain I would not have pursued a technical degree if it wasn’t for my father.

Mentorship is key. It’s important to encourage and be available to others. This can sometimes be difficult, especially when dealing with aggressive deadlines and maneuvering around in the sometimes crazy world called “the Software Industry.” At Perforce, I’ve been able to work with students from Girls Inc. and graduates from Hackbright Academy. Mentorship comes in many forms and it doesn’t necessarily need to be formalized. A little bit can go a long way. As a woman in a tech role, I am proud to be a part of a company that also gives me the opportunity to participate.

Oh, and thanks Dad.

This article was [originally published](https://www.perforce.com/blog/girl-geek-thoughts-mentorship) the Perforce Corporate Blog.
You might think you made your site accessible...
Tags: a11y, wcag
Published: 2019-01-07 03:52:21

---
title: You might think you made your site accessible...
published: true
description: Go the extra step. Here's how.
tags: accessibility, a11y, wcag
---

{% youtube j9RyZMKAFqc %}

NVDA:
https://www.nvaccess.org/download/

JAWS:
https://www.freedomscientific.com/Pro...

WCAG 2.1 Guidelines
https://www.w3.org/TR/WCAG21/

Deque University
https://dequeuniversity.com/

Axe extension:
https://chrome.google.com/webstore/detail/axe/lhdoppojpmngadmnindnejefpokejbdd
How to revive my career?
Tags: help, career
Published: 2019-01-07 03:49:24

---
title: How to revive my career?
published: true
description: 
tags: #help, #career
---

I'm not sure if revive, or start is more accurate. I've got a BA in Computer Science, and then about 10 years later, took some courses at a local community college to brush up on my skills and pick up some new ones, getting an Associate of Science degree in Computer Programming. I've only held one programming job, where I was a Software Engineer, using Visual Foxpro, and then Java. I stayed at that job for about 2 years. 

I know some Java, having used it when I was a Software Engineer, and then taking several courses in it, when I went back to school. I'm also familiar with C, having used it almost exclusively in the upper level CS courses I took for my first degree. Those are the languages in which I would feel most comfortable programming.

I've also taken courses in Pascal, C++ and VB, and have taught myself a little bit of Perl and Ruby, and have done some Unix scripting. I've used HTML and some CSS, enough to build a personal web page, however, I haven't updated it in years.

I am currently doing data processing, using Visual Foxpro, but I would much rather be doing something along the lines of application development, preferably in a Unix or Linux environment. Unfortunately, I don't see very many job postings around here for that, let alone entry level positions. Many of the entry level positions require skills or more experience than I have, and tend to be more for full stack or front end positions, neither of which match my interests. 

I'm not sure what to do. Relocation is not an option, and I can't really afford to go back to school yet again. I've considered trying to learn Javascript or Python, but neither interest me, and I don't want to end up in another job where I'm not happy. 

I'm open to any suggestions. Thanks.
Two conundrums with implementing social login
Tags: webdev, ux
Published: 2019-01-07 03:32:18

---
title: Two conundrums with implementing social login
published: true
description: 
tags: webdev, ux
---

Implementing social login is simple enough at first but there are a bunch of weird cases to think about with a lot of different potential ways to handle them.

For example, I am developing a web app where users can register with an email address, or certain social accounts. Users should be able to freely link or unlink any social accounts, right? I'm struggling to think of a way to handle a couple of cases without being too complicated for the user.

Example 1
===
Suppose a user registered with an email address, and now they want to link their Facebook account. However that Facebook account is already used on another account (most likely the same user clicked login with Facebook once and created a new account without meaning to.)

Would you prompt the user in this case to merge their accounts? (tricky to implement and destructive -- maybe they could merge the wrong account and you can't fix the mistake) Or would you tell the user "you must log on to the other account and unlink it first"? (difficult/time-consuming for the user)

Example 2
===
A user first registered with a social account, but now wants to unlink that account. There must be a way to verify the user's identity, so they'll need to provide an email address. It seems wrong to require the user to give up personal information in order to delete other information. But the only alternative I can see is giving the option to delete their account entirely which also seems hostile (you want to remove Facebook? Give me your email or kiss your account goodbye 😨) Or I could prompt them to set a username only to log on with, but that could be confusing too and they risk locking themselves out of their account with no way to recover it. They will need to provide a valid email for verification anyway so it seems like a pointless extra step.

Seems like there are no good answers! Social login is supposed to make things easier, isn't it? What to do?
Creating Your Own BeforeEach() in Go
Tags: go, tdd
Published: 2019-01-07 02:59:46

---
title: Creating Your Own BeforeEach() in Go
published: true
description: TDD with Go's built-in test framework
tags: go,tdd
---

I'm developing my own budgeting app using Go and have been using it to learn new things as well. For testing, because I'm TDD'ing the entire project, I decided to just use the built-in Go testing framework. I use Ginkgo at work and enjoy it, but decided to see what vanilla testing in Go is like.

After writing a bunch of tests for a lot of my boilerplate functions, I quickly had a lot of duplicated set-up code that looked like this at the start of all my tests:

```go
g := NewGomegaWithT(t)

db, err := createTestDb()
g.Expect(err).To(BeNil(), ErrorDidNotOccur)

api := NewApi(db, SelectedQueryLang)
```

I was having trouble figuring out how to pull this out into it's own function. Finally I saw a Stack Overflow answer that provided me with a solution (having trouble finding the link now!).

Here's how you create your own `BeforeEach()` function when using Go's testing framework.

First, create a `struct` that will hold the objects your test needs to access. Mine looks like this:

```go
type TestingBasics struct {
	GoMega *GomegaWithT
	Db     *sql.DB
	Api    *api
}
```

Then create your `BeforeEach()` function that will create this struct for your tests.

```go
func BeforeEach(t *testing.T, SelectedQueryLang *QueryLang) (tb TestingBasics) {
	tb.GoMega = NewGomegaWithT(t)

	var err error
	tb.Db, err = createTestDb()
	tb.GoMega.Expect(err).To(BeNil(), ErrorDidNotOccur)

	tb.Api = NewApi(tb.Db, SelectedQueryLang)

	return tb
}
```

Now all you need to do is call `BeforeEach()` at the beginning of your tests. I was able to reduce 4 lines of code down to 1 across **all** of my tests. Now the start of each of my tests look like this:

```go
t.Run("should add one transaction", func(t *testing.T) {
	tb := BeforeEach(t, SelectedQueryLang)
...
```

This can definitely be cleaned up even further, to the point where I wouldn't even need to call `BeforeEach()` at the start of each test. At that point though, I might as well have gone with [Ginkgo](https://onsi.github.io/ginkgo/). For me and this project, I am fine with this set up.
Discovering the Durable Functions API - Starting orchestrations (DurableOrchestrationClient part 1)
Tags: azure, serverless, dotnet, tutorial
Published: 2019-09-04 12:02:58

---
title: Discovering the Durable Functions API - Starting orchestrations (DurableOrchestrationClient part 1)
published: true
tags: azure, serverless, dotnet, tutorial
series: Durable Functions API
canonical_url: https://blog.marcduiker.nl/2019/01/07/durable-functions-api-durableorchestrationclient-1.html
---

![Methods in DurableOrchestrationClientBase](https://blog.marcduiker.nl/assets/2019/01/07/DurableOrchestrationClientBase1_900.png)

## DurableOrchestrationClient(Base) class - Starting & waiting for completion

This post is the first part of a series of blogs/vlogs to discover the Durable Functions API.

<!--more-->

In the video linked below, I’m looking into methods from the [`DurableOrchestrationClient`(`Base`)](https://github.com/Azure/azure-functions-durable-extension/blob/master/src/WebJobs.Extensions.DurableTask/DurableOrchestrationClientBase.cs) class on how to start a new orchestration instance and how to retrieve the status and the result of the instance:

- `StartNewAsync(string orchestratorFunctionName, object input)`
- `StartNewAsync(string orchestratorFunctionName, string instanceId, object input)`
- `CreateCheckStatusResponse(HttpRequestMessage request, string instanceId)`
- `WaitForCompletionOrCreateCheckStatusResponseAsync(HttpRequestMessage request, string instanceId)`
- `WaitForCompletionOrCreateCheckStatusResponseAsync(HttpRequestMessage request, string instanceId, TimeSpan timeout)`
- `WaitForCompletionOrCreateCheckStatusResponseAsync(HttpRequestMessage request, string instanceId, TimeSpan timeout, TimeSpan retryInterval)`

Here’s the video, please give it a thumbs up if you like it and subscribe to my channel so you’ll be notified of new videos:

{% youtube mRDesdK3W8Q %}

### Resources

- GitHub repo: [github.com/marcduiker/demos-azure-durable-functions](https://github.com/marcduiker/demos-azure-durable-functions).
- Microsoft docs: [Durable Functions HTTP API](https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-http-api).
- Microsoft docs: [Optional uri parameters and default values](https://docs.microsoft.com/en-us/aspnet/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2#optional-uri-parameters-and-default-values).

### Links to other posts in this series

- Starting orchestrations (DurableOrchestrationClient Part 1)
- [Retrieving the orchestration status (DurableOrchestrationClient Part 2)](/marcduiker/discovering-the-durable-functions-api-retrieving-the-orchestration-status-durableorchestrationclient-part-2-40kc)
- [Purge & Terminate Orchestrations (DurableOrchestrationClient Part 3)](/marcduiker/discovering-the-durable-functions-api-purge-terminate-orchestrations-durableorchestrationclient-part-3-59g6)
YAML Ain't Markup Language Sing Along Song
Tags: yaml, song, music, development
Published: 2020-09-11 19:49:43

---
title: YAML Ain't Markup Language Sing Along Song
published: true
date: 2019-01-07 00:00:00 UTC
tags: [yaml, song, music, development]
canonical_url: https://mrpowerscripts.com/yaml-song/
---

I’m really happy I was able to stop laughing long enough to upload this. Check out the new hit sing along song YAML Ain’t Markup Language.

<iframe width="560" height="315" src="https://www.youtube.com/embed/0GnWd4jiyH4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
MyClient very good client to Mysql
Tags: mysql, commandline, client, autocompletion
Published: 2019-01-06 22:21:01

---
title: MyClient very good client to Mysql
published: true
description: MyClient very good client to Mysql
tags: Mysql, Command line, Client, auto-completion
---

MyClient is a tool to Mysql of  auto-completion, look this:

Install Ubuntu:

Step 1: type to install mycli

`
 sudo aptitude install mycli
`

Next Step 2: type this to in client



    mycli -uroot

    Version: 1.5.2
    Chat: https://gitter.im/dbcli/mycli
    Mail: https://groups.google.com/forum/#!forum/mycli-users
    Home: http://mycli.net
    Thanks to the contributor - Ted Pennings
    mysql root@localhost:(none)> 



First Last one Step: Look at this picture to select the database:

![alt text](https://thepracticaldev.s3.amazonaws.com/i/4dj2s9a591ohfdg5zlon.png "Logo Title Text 1")

Last one Step: Look this picture to make query select table:


![alt text](https://thepracticaldev.s3.amazonaws.com/i/75dylaow43q59kz9xgzl.png "Logo Title Text 1")

See soon !!
Nevertheless, Erin Coded
Tags: wecoded
Published: 2019-01-06 22:17:30

---
title: Nevertheless, Erin Coded 
published: true
tags: shecoded
---

## I began/continue to code because...

I fell into coding after my first year at UBC.  We were required to take a programming class as a part of the Engineering program.  While staying up late, hunched over an assignment I had procrastinated on, I realized that I had been going for 5 hours straight with no bathroom breaks - an obvious sign that I was in a flow state? 

My relationship with programming has seen a lot of ups and downs. The downs having me question if I really wanted to be a programmer or if there was more out there for me.  Retrospection has made me realize that while essentially programming is the same everywhere, community is the thing that keeps me going. 


## I'm currently hacking on...

Building out my GraphQL knowledge by implementing subscriptions for real time notifications and status updates.  I'm also working on implementing automated accessibility checks into my team's workflow and coming up with a technical plan of attack for our accessibility debt. 


## My advice for allies to support women and non-binary folks who code is....

Community is what has saved me from quitting programming several times.  Find people you connect with and like working with and ask to be on their team or projects.  Reach out to people online and see if anyone wants to meet up for coffee to talk about shared experiences as a woman or non-binary person who codes.