teleren/devto huggingface dataset:
Adding validation when you code up webforms in Alpas
Tags: webdev, validation, alpas, kotlin
Published: 2020-05-27 01:46:00

---
title: Adding validation when you code up webforms in Alpas
published: true
date: 2020-05-27 01:44:27 UTC
tags: web-development,validation,alpas,kotlin
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/0*4umHmtXR3ShGmbgz)<figcaption>Photo by <a href="https://unsplash.com/@neonbrand?utm_source=medium&amp;utm_medium=referral">NeONBRAND</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption>

When you’re coding up a website, chances are, you’ll end up adding a form sooner or later. Whether it’s for a simple email newsletter signup, a registration form, or a contact form, webforms will likely make an appearance. And, you’ll probably be wanting to validate the entries users are typing in before writing to your database.

With the [Alpas](https://alpas.dev) web framework, [validation](https://alpas.dev/docs/validation) is one of the many batteries-included features available to you.

In the Alpas backend, when you are calling the form data over http, you can apply a set of pre-configured rules.

Let’s look at the following example:

```kotlin
fun create(call: HttpCall) {
     call.applyRules("email", failfast = true) {
          required()
          max(100) { attr, value -> val len = value?.toString()?.length "$attr is $len characters long. It should be no more than 32."
           }
          email()
          unique("emails")
     }.validate()
```

There are some pretty cool and convenient things going on this small example.

- You can list out rules you want to apply to the email field validation using `call.applyRules()` and passing the form key to apply the rules to
- Adding `failfast` and setting it to `true` will stop validation on first fail; convenient for saving additional processing time and quickly getting an error in front of the user
- You can make a form field required
- You can set a max character limit (also a min)
- All of the validation comes with default error sent back to the front-end, in which you can easily update the message as shown
- You can validate an email address against RFC 2822 standards
- You can ensure an entry is unique within a database table column

These are just some of the many default validation rules you can apply. [Check out the documentation](https://alpas.dev/docs/validation) for more examples and out-of-the-box validation.

Looking to customize your own validation rules? No problemo!

I’ll show you how you can customize validations in the next post. 👍

* * *
I don't know what you did to make DEV much more readable on iPad, but thanks!
Tags: a11y, website
Published: 2020-05-27 01:39:53

The recent changes made the site so much more usable for people like me who interact with iPads more than other methods. Even the posting experience is better, albeit more indirectly as it has not been changed as much, if at all. Real shame Safari is the laggard on web standard support, or it would be better still. Excited for what updates the future brings!

Major kudos to the developers for all the work! It shows!
Coming Soon: Obie One
Tags: startup, hustling
Published: 2020-05-27 01:37:50

We're currently planning to release Obie One: a new way for everyday folks to get easy access to their knowledge, wherever it lives. Currently [Obie](https://obie.ai) lives in Slack only... but all of that is about to change.

I'll be documenting some of the story behind the scenes, and if I enjoy writing, maybe I'll keep it up forever!

In case you were wondering... yes, Obie One is a play on "Obi Wan", but there is no relation to the Jedi. Obie is a friendly knowledge beaver... although...

![Jedi Beaver](https://dev-to-uploads.s3.amazonaws.com/i/9foeyoyz7a8x4xlfu33k.jpg)
JavaScript Data Types
Tags: javascript, datatypes, beginners, programming
Published: 2020-05-27 01:32:10

## JavaScript data types and data structures

### Topics covered in this video:

* Overview of data types
* Type system in programming languages
* High-level overview at the difference between dynamically typed languages and statically typed languages
* Data types and data structures
* Primitive data types: String, Number, Boolean, Undefined, Null, BigInt and Symbol
* Non-Primitive data types: referred to collectively as Objects

{% youtube AsJhjDirCUI %}

📄 Check out the [JavaScript String Methods article](https://dev.to/_elmahdim/javascript-string-methods-you-probably-havent-heard-of-and-thats-okay-23hc)

▶ [Course Playlist](https://www.youtube.com/playlist?list=PLq2_2u8CDe3RSYnDqBlUNwHoJalovMK7j)

[Subscribe](https://www.youtube.com/channel/UCWaZqFpykcDUwC3q7JPDZ8g?sub_confirmation=1) for more videos, and stay tuned for [updates](https://www.youtube.com/playlist?list=PLq2_2u8CDe3RSYnDqBlUNwHoJalovMK7j)!
The future of Podcasts, Joe Rogan + Spotify
Tags: watercooler, podcast
Published: 2020-05-27 01:24:48

So I've just started getting into podcasts and I'm curious what people think about Spotify's latest purchase of the Joe Rogan Experience?

https://www.theverge.com/21265005/spotify-joe-rogan-experience-podcast-deal-apple-gimlet-media-ringer

What do you think about Spotify's future plans? Is it the start of a new podcast era?

One thing I'd like is that if I pay for Spotify Premium there should be *no* ads in my podcasts just like the current Spotify experience.
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2020-05-27 01:06:08

---
title: Top 5 DEV Comments from the Past Week
published: true
description: Highlighting some of the best DEV comments from the past week.
tags: bestofdev
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--7VrAA2ln--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/qmb5wkoeywj06pd7p8ku.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.

@ryansmith left a great comment in the **[React vs Vue: Compare and Contrast](https://dev.to/ben/react-vs-vue-compare-and-contrast-13jp)** thread:
{% devcomment pele %}

@madarsbiss shared their 80/20 rule derivation in **[What are your worst habits as a developer?](https://dev.to/jess/what-are-your-worst-habits-as-a-developer-5049)**:
{% devcomment pa5i %}

In the same thread, @botanical followed up with their habit:
{% devcomment pa4l %}


@mrrcollins tugged at the nostalgia heartstrings with this still-functional submission to **[Workspace Wednesday: Show me pics of your at-home setup](https://dev.to/ben/workspace-wednesday-show-me-pics-of-your-at-home-setup-43bi)**:
{% devcomment p883 %}

@jakesweb offered their take in **[Should remote workers be paid differently based on location?](https://dev.to/damcosset/should-remote-workers-be-paid-differently-based-on-location-3apf)**:
{% devcomment pbha %}

See you next week for more great comments ✌
Find The Vowels used in a String with JavaScript
Tags: javascript, algorithms, code, challenge
Published: 2020-05-27 00:51:16

Count the vowels in a string with JavaScript. Short and simple!

**Challenge**
```
---Directions
Write a function that returns the number of vowels used in a string. To confirm, vowels are the characters 'a', 'e', 'i', 'o' and 'u'.
---Example
vowels('Hello') ---> 2
vowels('Javascript') ---> 3
vowels('crypt') ---> 0
```
We will start with creating a counter variable starting with 0, and then we will iterate through our string and make sure we will lowerCase our vowels.
```javascript
function vowels(str) {
  let counter = 0;
   
   for (let char of str.toLowerCase()){

   }
 }
```
We could of do a bunch of IF statements, but our code would look messy. Instead, we will use the helper method **includes()** that determines whether an array includes a certain value among its entries, returning true or false as appropriate. Read more about it [here.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes)

Let's create an array that will hold all of our vowels.
```javascript
const check = ['a','e','i','o','u']
```
Now we have to use some logic in our loop. If the char that we are looking for is included in an array we will increment the counter. We'll iterate through all of our characters and then return them.
```javascript
function vowels(str) {
  let counter = 0;
  const check = ['a','e','i','o','u']
   
   for (let char of str.toLowerCase()){
    if (check.includes(char)) {
      counter++
     }
   }
   return counter
 }
```
Output in console.
```
// vowels("Today is a rainy day!") --> 7

// vowels("Shy gypsy slyly spryly tryst by my crypt") --> 0

```
How I got cheated my two months salary $2600 during covid-19 period by a Turkish person. 
Published: 2020-05-27 00:49:40

During this lockdown period, i had got an offer of software development from a Turkish person. I have told him my experience and he chooses myself for his work. I started my work at 26th march 2020 and work continuing during 26th May. 

While i got the offer from the person i told him to send me a NDA , he told me we are new company we will send you once the current situation get over. He stated my salary as basic $1500 per month and Extra if i work more. 

Atleast 6 hours a day i had worked for him and he was quite happy on work on me. When the first month over, he told he have no money as the covid-19 period going. He stated that he will pay once he get credit from bank. I was waiting and working as before. 

One day he told me my fund will be transferred soon he got the credit. I said thanks to him. But the sad part is after completion of three of his apps he disconnected me from the messaging Chanel. He is not responding yet. 

The person is from Turkey , I have all of his places names original photos and everything for identifying and contact. Can i get any chance to trace to him and get my salary back.

Any Turkish developer community, who can help me to achieve my salary.
SpaceX Falcon 9 Rocket CSS
Tags: codepen
Published: 2020-05-27 00:21:56

---
title: SpaceX Falcon 9 Rocket CSS
published: true
tags: codepen
---
Tomorrow is the start of a human spaceflight era. God speed @nasa @spacex
Stream the event here - nasa.gov/live on May 27th, 4:33 p.m. EDT.

I drew this SpaceX Falcon-9 Rocket in pure CSS 2 years ago because I was fascinated by its capability and mission.
{% codepen https://codepen.io/kelvien/pen/ayRQoo %}
Go - 接口
Tags: go
Published: 2023-08-13 02:09:36

---
title: Go - 接口
published: true
date: 2020-05-27 00:00:00 UTC
tags: go
canonical_url: https://manon.icu/blog/go/09-interface
---

在Go语言中，接口（Interface）是一种类型，它定义了一组方法的契约。接口定义了方法的集合，而不关心方法的具体实现。接口提供了一种抽象的方式来描述对象的行为。

Go中的接口由一组方法签名组成，方法签名定义了方法的名称、参数列表和返回值类型。一个类型只要实现了接口中定义的所有方法，就被认为是实现了该接口。通过这种方式，接口实现了多态的特性，即不同类型的对象可以以相同的接口类型进行处理。

## 接口定义

```go
type 接口类型名 interface{
    方法名1(参数列表1) 返回值列表1
    方法名2(参数列表2) 返回值列表2
    …
}
```

## 接口实现

```go
type 类型名 struct{
    //字段
}
//实现接口方法
func (变量名 类型名) 方法名1(参数列表1) 返回值列表1{
    //方法体
}
func (变量名 类型名) 方法名2(参数列表2) 返回值列表2{
    //方法体
}
```

接口的实现是隐式的，不需要显式声明。只要一个类型实现了接口中定义的所有方法，即可视为实现了该接口。例如：

```go
type Animal interface {
    Speak() string
}

type Dog struct {}

func (d Dog) Speak() string {
    return "Woof!"
}

func main() {
    var animal Animal
    animal = Dog{}
    fmt.Println(animal.Speak()) // 输出: "Woof!"
}
```

在上面的例子中，我们定义了一个 Animal 接口，只有一个 Speak 方法。然后，我们创建了一个 Dog 结构体，并为 Dog 类型实现了 Speak 方法。在 main 函数中，我们将 Dog 类型赋值给 Animal 类型的变量 animal，并调用了 Speak 方法。
接口的特点和用途包括：

- 多态性：接口允许在不同的类型之间实现多态。通过将对象视为接口类型，可以处理不同类型的对象，而无需关心其具体的类型。
- 松耦合：接口可以实现组件之间的松耦合，组件只需要关注接口定义的方法，而不需要关心具体的实现。
- 可插拔性：接口可以作为插件或模块的契约，允许将不同的实现替换为其他实现，而不会影响使用该接口的其他代码。
Changing the colour of VSCode's menu bar
Tags: webdev, tutorial, software
Published: 2020-06-02 16:12:02

---
title: Changing the colour of VSCode's menu bar
published: true
date: 2020-05-27 00:00:00 UTC
tags: webdev, tutorial, software
canonical_url: https://conermurphy.com/changing-vscode-menu-bar-colour/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/7dmfhmbpve7a0okjj3lt.png
---

To change the menu bar colour of your VSCode instance per project you just need to add the following folders and files to your project and no matter who picks it up your colours will be there for all to see.

Start by creating a '.vscode' folder in the root of your project and inside this folder add a 'settings.json' file, so your structure will be like:

```
/
  .vscode
      settings.json
  ...Other folders in your project root
```

With your folder and file structure set-up, open your settings.json file and drop the following code into it:

```
{
    "workbench.colorCustomizations": {
        "titleBar.activeBackground": "",
        "titleBar.inactiveBackground": ""
    }
}
```

Now, all you need to do is change the two empty strings to be two hex values of your choosing.

And, there you go your VSCode menu bar now changes colour per project and if you're active or not on that window.

If you have any questions or just want to chat you can find me on Twitter [@MrConerMurphy](https://twitter.com/MrConerMurphy)
You're not ready. Do it anyway
Tags: motivation, programming, learning
Published: 2020-06-22 16:38:00

---
title: You're not ready. Do it anyway
published: true
date: 2020-05-27 00:00:00 UTC
tags: motivation,programming,learning
canonical_url: https://tndl.me/blog/2020/do-it-anyway/
cover_image: https://artvee.com/saconud/2020/05/11543pofm.jpg
---

In _Surely You're Joking Mr. Feynman_, Richard Feynman talks about spending a summer at Caltech to "Just try out biology", a field he was completely untrained in and unfamiliar with:

_"After the war, every summer I would go traveling by car somewhere in the United States. One year, after I was at Caltech, I thought, ";'This summer, instead of going to a different place, I'll go to a different **field**.'_

_...I went over to the biology lab to tell them my desire, and Bob Edgar, a young post­doc who was sort of in charge there, said ... "You'll have to really do some research, just like a graduate student, and we'll give you a problem to work on." That suited me fine._"

Feynman goes on to do work in the field and even contributes some non-trivial new findings to biology. Later in the book he sums up his experience with:

_"I always do that, get into something and see how far I can go."_

I read this memoir in the last year or so, and this section made me think some uncomfortable things about my own mindset when it comes to growing in one way or another. I realized that I've approached new and interesting things as a [collector](https://zettelkasten.de/posts/collectors-fallacy/), excited about a topic or field or tool, but [never quite _ready_](https://nesslabs.com/start-now) to go beyond a superficial exploration of that topic. I've piled up bookshelves with resources on all kinds of things I'd love to learn about, but never seem to find the time for. Months, or even years later, I've looked at some of those books and said to myself, "Wow, I thought I'd know all about that by now".

My rationales for not being ready have been pretty straightforward: "I have to learn some more of the basics before getting to that", or "I need to learn this other thing before that'll make sense".

Reading about Feynman's detour into biology made me think about that rationale a little more critically. And after some thought, it started to crumble. You can't _really_ be 'ready' for much of anything. Now I've been thinking, if you ever find yourself 'ready', that's probably a good indication that you could go a bit farther, dig a bit deeper, try something even more novel.

So now, I'm getting into some things. We'll see how far I can go.
Web Surgery - Ep.8 - Final fine tuning of my website
Tags: webdev, tutorial, jekyll
Published: 2020-05-26 23:53:23

---
title: Web Surgery - Ep.8 - Final fine tuning of my website
published: true
description: This is the last episode of Web Surgery as I will dedicate this time every week to start a new series. Today we gonna quickly wrap up the series with a little improvement of my website. Thank you for supporting this series. Let me know what you would like to learn and any suggestions at my Twitch.
tags: webdev, tutorial, Jekyll
---
This is the last episode of Web Surgery as I will dedicate this time every week to start a new series. Today we gonna quickly wrap up the series with a little improvement of my website. Thank you for supporting this series. Let me know what you would like to learn and any suggestions at my [Twitch](https://www.twitch.tv/cheukting_ho).
How to use Google Sheets API 
Tags: api, googlesheetsapi, spreadsheetapi, callapi
Published: 2020-05-26 23:47:20


---
title: How to use Google Sheets API 
published: true
description: Learn to use the Google Sheets API. In this week’s episode, I show you how you can turn any Google Spreadsheet into a data store that is accessible via API.
tags: API, google sheets API, spreadsheet API, call API
canonical_url: https://api-university.com/blog/how-to-use-google-sheets-api/
cover_image: https://api-university.com/wp-content/uploads/2020/05/google-sheets-splash.jpeg
---

Learn to use the Google Sheets API. In this week’s episode, I show you hands-on how you can turn any Google Spreadsheet into a data store that is accessible via API.

{% youtube pFpytftOYiw %}

Don’t miss any upcoming episode and [subscribe to the API-University channel](https://www.youtube.com/c/api-university?sub_confirmation=1) on youtube.

In the video, I show you how to use the worksheet as a step-by-step guide. It makes your life much easier because it guides you through the process, and helps you to get all the nitty-gritty details right. Without it, you would probably spend a lot of time reading the documentation or figuring it out by trial and error.

[Get the Google Sheets API Worksheet](https://api-university.com/blog/how-to-use-google-sheets-api/)


Learn about APIs in a more structured way, with step-by-step guides:

- [Book on RESTful API Design](https://api-university.com/books/api-design/)
- [Course on RESTful API Design](https://api-university.com/courses/restful-api-design-course/)
- [Books on other API Topics](https://api-university.com/books/)
- [Courses on other API Topics](https://api-university.com/courses/)
Internal Communications Promoter for Organizations
Tags: beginners, python, computerscience, GUI
Published: 2020-05-26 23:28:19

#Here is my video
{% youtube jV8ybmF5o9A %}

This program is for promoting internal communication of organizations, and also my final project for Code in Place 2020 by Stanford University.

Firstly the program reads employee database which includes employee numbers, names and pictures this time.
It then randomly creates groups of four, and giving group ID so the groups can use it as Zoom ID directly if they would like.
The program shows your group number, group members names and employee pictures when the user inputs employee number.

#Why did I create this program?
My manager asked me, "Do you often grab lunch or talk with our colleagues outside our team? Any close ones?", when I had 1-on-1 meeting.
I answered "Not really." I have always thought about making connections/network outside company but have not taken that in account.
He then recommended me to make connections within the company to easily collaborate with other divisions at the meeting.

However, the problem was I did not know 'How' to connect with employees I do not work with.

I have been thinking about that, and finally come up with this idea,
'I can build a program by myself if there is no such tool in my company.'

Additionally, all employees are apart because they have been working from home lately, and I have always wanted to create a platform so that people can virtually and mentally feel connected.

I hope you enjoy my video, and feel free to comment if you have any.
Day 140 : The Return
Tags: hiphop, code, coding, lifelongdev
Published: 2020-05-26 23:23:50

_liner notes_:
- Saturday : Did the radio show. Had a great time. You can check it out at https://kNOwBETTERHIPHOP.com Afterwards, I watched the Bounty Killer and Beenie Man Verzuz clash on Instagram. Pretty Epic! Brought back so many memories.

![Radio show episode image of Malcolm X smiling with the words May 23rd 2020, Magnifique](https://dev-to-uploads.s3.amazonaws.com/i/yxmz9p03z6viw0jd55rt.jpg)

- Sunday : Did some post radio show promo work basically spent the rest of the day working on a side project. Think that's it. haha.

- Monday : It was Memorial Day, so I spent the day relaxing and working more on my side project. Got a lot done.

- Professional : Wooo! Today was the return to work after being off for a little more than a week. There was quite a few things to catch up on. Responded to some questions. Watched a recording of a meeting last week. Had an introduction meeting with some folks that I'll be working on this with in the future. Looking forward to that. Finished the day, trying to get my recent blog post imported to dev.to. I used iframes in the orginal blog and apparently you can't embed iframes on dev.to. Awesome. Basically ended up taking screenshots of the iframes and put a link.

- Personal : What a time off! I put in the windows into my van. That was a task! haha Fixed an old project that was broken when YouTube made a change. Had my radio show. Did ALOT of work on a side project! It was pretty much bare bones and I got the layout, included the web component and worked on tying the different components together. Got 1 out of the 3 different modes I want to start off with completed. The others shouldn't be too bad that I got this one working.

![View of the Paptsdorf, Germany countryside at dusk with hills](https://dev-to-uploads.s3.amazonaws.com/i/z4yv6irqx5hvy71mkzsi.png)

Going to keep working on this side project. Want to get it in front of some folks to test out by the end of the week.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube E2GV7ErWNPo %}
ng-select Filtering Internals!
Tags: ngselect, angular, typescript
Published: 2020-05-26 23:20:43

Sometimes, we as developers loose a lot of time because we don't know the internals of the components we are using and the documentation is very poor.

So we just have to dig in and figure it out.

**NG-Select**

This is the StackOverFlow question and answer I created on ng-select internals related to filtering the infamous  'no items found' message when typing in letters in the dropdown list.

I believe this was a challenge due to the fact our list was not a simple string list, it was an object with many properties...

This is how it was solved.

{% stackoverflow 62027728 %}

Jwp2020
79/100 100daysofcode Flutter
Tags: 100daysofcode
Published: 2020-05-26 22:54:54

day 79/100 of #100daysofcode #Flutter
Learning Flutter , courses Udemy from
@maxedapps

Today learn Select map, goolemaps plugin from official flutter, markers, pick location
https://github.com/triyono777/100-days-of-code/blob/master/log.md