teleren/devto huggingface dataset:
Effective Java Programing Part 2 - Creating and destroying objects.
Tags: java
Published: 2020-06-25 00:45:10

*Consider the static factory methods over the constructors*

One advantage of using factory methods over the constructors is that the factory method has a name. If the parameters that passed into the constructor is not helping to understand what object will be returned to the client code.

The factory method with a well-chosen name will help the client code easier to read.

The second advantage of using a factory method over the constructor is that it doesn't have to return a new object every time it was invoked. So this method is very helpful when we trying to create an object that will be used a lot or expensive to create. And that class will be called instance-controlled. Because the class controls the creation of its class. Those classes could be Singleton or Non-Instantiable. It allows immutable class can guarantee that no two equal instances exist. `a.equal(b)` if and only if `a == b`

The third advantage is that it could return any subtype of its return type. This will be a good practice to return an interface as return type and has the implementation-specific class hidden.

With Java 8, the interface could have the static method. I didn't know about that or how that could help me to do anything? Why would I need a static method for an interface?

 In the case of JDBC, Connection plays the part of the service interface, DriverManager.registerDriver is the provider registration API, DriverManager.getConnection is the service access API, and Driver is the service provider interface.
Como comenzar a programar y no fracasar en el intento
Tags: javascript, career, react, spanish
Published: 2020-06-25 00:29:20

Hice un post para aquellos que estan iniciando en la programacion y quieren hacer carrera, abordando un poco tambien lo que se necesita para ser desarrollador hoy en 2020:

[Post original =>](https://medium.com/@holacoders/como-comenzar-a-programar-y-no-fracasar-en-el-intento-790ab30cdfe1)
FlytLabs
Tags: python, machinelearning, help, csharp
Published: 2020-06-25 00:25:42

I am forming a development group focused around decision - making AI and tools to aid developers and make every workflow increasingly efficient. Flytlabs.dev will house all of our ongoing projects. I am looking for developers and managers to aid in furthering these projects. I have some monetary opportunities to explore within these as well, and would like to offer more than fair splits towards projects and the people that help create them (80% +). I will personally be aiding in building every aspect, however I recognize that I can't build, expand and improve all of my ideas alone.

Thus, I am looking for Python, C, C#, and Javascript/Webdevs to aid in these projects. I hope to build online front ends which will allow users to interact with our AI projects, exchange plugins to expand previously less-expandable languages and libraries, safely send contact information, and more. I am looking for inspired, driven individuals to hopefully build a legally recognized entity with in the future, fueled by the original exposure of this groups ever-experimental and ambitious projects.

If you are interested find our findcollabs project here: 
https://findcollabs.com/project/flytlabs-7dCwnVjLineXkgK0BjBB

Or directly reach out to me here for more information: ben@flytlabs.dev

Thank you!
Password hashing with NodeJS
Tags: security, node
Published: 2020-09-10 05:45:20

---
title: Password hashing with NodeJS
published: true
date: 2020-06-25 00:00:00 UTC
tags: Security,NodeJS
canonical_url: https://www.loginradius.com/engineering/blog/password-hashing-with-nodejs/
---

In this blog, we’ll be implementing authentication with password hashing in a Node.js web application. For this, we’ll be using crypto, a package password hashing for Node.js. The Crypto module for Node JS helps developers to hash user passwords. Pre-requisites: Basic knowledge…

   
[Read On](https://www.loginradius.com/engineering/blog/password-hashing-with-nodejs/)
Learning Golang (some rough notes) - S01E00
Tags: go, learning
Published: 2020-06-29 11:29:10

---
title: Learning Golang (some rough notes) - S01E00
published: true
date: 2020-06-25 00:00:00 UTC
canonical_url: https://rmoff.net/2020/06/25/learning-golang-some-rough-notes-s01e00/
series: Learning Go
tags: go, learning
---

My background is not a traditional CompSci one. I studied Music at university, and managed to wangle my way into IT through various means, ending up doing what I do now with no formal training in coding, and a grab-bag of hacky programming attempts on my CV. My weapons of choice have been BBC Basic, VBA, ASP, and more recently some very unpythonic-Python. It’s got me by, but I figured recently I’d like to learn something new, and several people pointed to Go as a good option.

I thought it would be interesting to write up some notes as I went, because blogging is how I remember things and have a record to refer to later :) There’s also some things that puzzled me (given my background in coding so far) that I struggled to find an answer to on Google, so maybe it might even help others.

## Learning Go - where to start?

Pretty simple - [https://tour.golang.org/](https://tour.golang.org/) is really good for working through and building on concepts. I’m making myself do this since there’s a bunch that I probably wouldn’t understand if I tried to skip ahead and go and start looking at real code examples. I’m glad I’ve done this as it’s forcing me to work through things that I really don’t understand, like we’re about to see…

## Other materials

I’ve not tried it but [this course](https://www.udemy.com/course/go-the-complete-developers-guide/) was recommended to me on Twitter, as was [this one](https://www.udemy.com/course/learn-go-the-complete-bootcamp-course-golang).
FCC: Product Landing Page
Tags: codepen, css, html, beginners
Published: 2020-06-24 23:12:01

{% codepen https://codepen.io/notalexpareja/pen/zYrzNzB %}

I took inspiration from one of my favorite video games, Elite Dangerous, and created a simple landing page for one of its fictional spaceship manufactures.

This one had me diving deep into CSS flex box. Starting to get the hang of how it works, when it helps and when it does not help. Despite the projects simplicity there was a lot of head scratching here, but it was worth it as the vision in my head slowly came together. I now understand all the jokes about centering a div. Who knew?

One thing Im taking away from this project is building a button. Instead of using *button* element I just used an *anchor* tag link, tossed it in a div, and built a button around that. Creatively speaking, I found it to be more cooperative than trying to style a *button* element. At least until Im better at styling buttons.

I recently bought CSS: The Definitive Guide by Eric Meyer & Estelle Weyl and needless to say it helped me a bit during this project, as it goes into some core mechanics behind flex.
Ladies && Gentlemen please welcome PeerCynk
Tags: showdev, webrtc, javascript, node
Published: 2020-06-24 23:05:09

I am here to present my latest [Platform](https://bit.ly/peercynk) built on peer-to-peer technology for a Web-Community to exchange a resource in a pure peer-to-peer fashion.
Beta version has limited Access-token for Early-access users.

Checkout Platform: [Platform](https://bit.ly/peercynk) |  it is a PWA,so accessible both in mobile-web/Desktop-web

Please do read White-paper : [White-Paper](https://bit.ly/peercynk-white-paper)

Keep patience with Early Access, It will grow and will become interesting once user-base grow and start contribute on the platform.

So join and exchange information/resources if you have good intentions.

Any query/Bug Report DM on dev.to https://dev.to/jswalker_in ||  DM on twitter : https://twitter.com/jswalker_in

If you love WebRTC or Fan of Peer-To-Peer ideology this platform is for you.

##Note:I have Teeny-Tiny server so please forgive me if server meltdown few time.In the meantime please do read [White-Paper](https://bit.ly/peercynk-white-paper)
Don't call jsonSerialize() explicitly
Tags: php, oop, codequality, webdev
Published: 2020-06-24 22:58:07

TL;DR don't call `jsonSerialize()` directly, always pass the object implementing it to the `json_encode` function.

`JsonSerializable` is a [handy PHP feature](https://www.php.net/manual/en/class.jsonserializable.php) that was introduced in PHP 5.4.
It lets you define how an object should be transformed into JSON when passed to the `json_encode` function.
For example, if you were to order a box of chocolate and send a preview of it to someone you offer it to,
you might want to show the content of the box but not its price.

By defining an array of properties (but the return value could be anything that could be serialized to JSON), you get to decide what information will be returned in the resulting JSON:

```php
final class ChocolateBox implements JsonSerializable
{
    private int $price;
    private array $chocolates;

    /* Magic code to build the box... */

    public function jsonSerialize() : array
    {
        return [
            'chocolates' => $this->chocolates,
        ];
    }
}
```

So far, so good.
And then, in the client, usually a controller, I sometimes see this:

```php
final class ChocolateBoxController
{
    public function indexAction(Request $request, ChocolateBoxService $chocolateBoxService) : Response
    {
        $chocolateBox = $chocolateBoxService->getRandomBox();

        return new Response(
            json_encode($chocolateBox->jsonSerialize())
        );
    }
}
```

👆 Can you spot the problem in the code above?

We're calling `json_encode` and passing it the result of the `jsonSerialize` method.
That's not the idea... `json_encode` actually knows about the existence of the function if the object it's being passed
implements the JsonSerializable interface.

Therefore, simply passing the object to `json_encode` is enough:

```php
json_encode($chocolateBox)
```

👇 gives us

```javascript
{
    "chocolates" => [/* delicious list of chocolates */]
}
```

It even works when you bury the object in another structure, such as an array:

```php
json_encode([
    'data' => $chocolateBox,
])
```

👇 gives us

```javascript
{
    "data": {
        "chocolates" => [/* delicious list of chocolates */]
    }
}
```

By implementing the interface you allow `json_encode` to get what it needs out of an object.
Your work stops right after that, let `json_encode` do the rest...

---

Originally published on [quentin.delcourt.be](https://quentin.delcourt.be)
Problems with the compiler to change the color to something in C, this is the solution
Tags: c, mingw, cpp, go
Published: 2020-06-24 22:25:11

I always ran into the problem of my compiler I could not apply colors to something in C, after researching and searching many places I finally found the solution, we simply apply this line of code to the part that we want to change the color and then we have to repeat it with the original color, since the color is changed to everything below this line. It is perfect for the MINGW compiler, the cl function is what calls the color and the number is the selected color, these colors are the same ones used to change the color in win console.

this is the code 
void cl(int color)
{
    HANDLE h=GetStdHandle(STD_OUTPUT_HANDLE);
   SetConsoleTextAttribute(h,color);
}

int main()
{
    cl(5);
    printf("HI");
    cl(2);
    printf("\nMM");
    getche();
}
Open source diary #1
Tags: opensource, react, beginners, webdev
Published: 2020-06-24 22:02:05

Hi there, Some time ago I decided to start contributing to the open-source project. In this series, I'll share my thoughts, stories, successes, and failures in my contribution process.

## OK, I need to find some project

To be honest that wasn't an easy part for me. I wanted to join a small project without dozens of contributors and without very complex and advanced codebase because I'm not a JS expert yet. I wanted to start small. Also, I wanted to code in React I'm learning that tech right now and I want to keep mastering it.

I used the tool I built to easily find OS project/issues and start contributing https://justcontribute.netlify.app You can read more about it in my previous DEV post

{% link https://dev.to/dominikilnicki/i-built-side-project-helps-you-find-cool-open-source-projects-and-join-them-1fpo %}

It took me a while to find a good fit for me. Some of the projects weren't exciting, some of them used Svetle or Vue. But finally, I came across [TidyTweets repo](https://github.com/rlueder/tidytweets). There was just one developer and a bunch of `good first issues`. What's more, Rafael - the maintainer, is a much more experienced developer then I am so it was a great opportunity to learn new stuff.

## Setting up a dev environment was... hard
I tried to set all the things up on my local machine. It wasn't as easy. I couldn't force it to work. The project contains a lot of things that need to be configured like Netlify functions or Twitter Development Account. Rafael spent with me a lot of time to get it up and going. That was the biggest obstacle I faced so far in the project.

Right now new contributors don't need to make all those steps because TidyTwitts was added to the Netlify Open Source program so the configuration is much simpler. You just need to link TidyTweets netlify account to your local app using App ID.

## First issues and PR's 
Before I started I've read the contributing rules in the README. Rafael shared a great article about [a successful git branching model](https://nvie.com/posts/a-successful-git-branching-model/) It helped me to understand how to use git more efficient and systemize my work. Also, I've watched this [YT movie](https://www.youtube.com/watch?v=HbSjyU2vf6Y) about using GitHub fork.

As I mentioned I started small. Took 2 easy issues with a `good first issue` label. My first pull request was merged a couple of days ago and the second is in a review when I write this article.

## Sum up
Things are just getting started. I hope I'll take more advanced and complicated issues as time progress. I want to encourage you all to join Rafael and me and contribute to [TidyTweets](https://github.com/rlueder/tidytweets) all the help will be appreciated! 

Also If you want to find other great OS project check out[ JustContribute](https://justcontribute.netlify.app)
Day 161: Pray
Tags: hiphop, code, coding, lifelongdev
Published: 2020-06-24 21:48:31

_liner notes_:
- Professional : I guess the meetup took a lot more out of me than I thought. haha I got up a little later than normal. Had a couple of meetings with co-workers and got to know more about them. Had a lot of things in common. Even got to show some of the stuff I've been working on. Spoke to the Web Components team and told them my findings on figuring out how to get it working in environments where we can't npm install. Had a talk prep session. Started an open-wc Web Component, but this time using TypeScript, pray for me. haha

- Personal : Last night, I was determined to just finish up the current side project and get it deployed. I knew anything else would just be nitpicking. haha There are some things I want to add, but would like to get feedback on its current state so I know where to take it next or make some changes. Did that and fell asleep. Oh, the new site is https://hiphoptimer.com

![Overhead shot of a forest in Puerto Rico](https://dev-to-uploads.s3.amazonaws.com/i/avkqm154kiq3jx7wne77.png)

Going to upload the latest show to the station so that it can get played this week. Since I'll have that laptop open, I'll go through some submitted tracks. Got a random package in the mail from a place I didn't recognize. In it was a catalog I ordered. I thought I got everything in an earlier package. In the package, there was also some samples of the product. Pretty awesome. I'll probably spend the rest of the night planning out an order to make now that I have a full catalog and some samples.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube EzXnerP3kq4 %}
Is there such thing as a truly free cloud database?
Tags: discuss, database, sql, node
Published: 2020-06-24 21:45:21

I'm building a [news platform](https://informant.micahlindley.com/home.html) powered by [Vercel](https://vercel.com)'s Serverless Functions.  Posts are to be stored in some kind of database where Vercel's functions can retrieve and return the data.  However, as far as I can tell I'll need to use a database outside of Vercel as they don't support long-term data.  

So in a word, I'm looking for a free cloud database with a simple API that has: 
- No request limits
- High storage limits, or none

Have any of you found a service like this?  If you have, I'd love to take a look and see if it would work for me.  Currently I'm using Google's Cloud Firestore which is convenient, but its limits on the free Spark plan are very restrictive.
Running to break up the day
Tags: 100daystooffload
Published: 2020-06-24 21:22:25

Today was hot. So hot. Here in the UK we've had what seems like endless months of warm weather, but this week is where it gets silly. Now that's only relative; we're talking 29°C and some humidity, but it's too much for me. Funnily enough I have experienced the late summer temperatures of the Mojave desert but that always seems more bearable and a novelty than this (and it's probably helped by the fact that everything is air conditioned, whereas here instead we do what we can to stay warm in winter). Needless to say I don't like it.

So far this week, in accordance with a plan to break up my workday, I've finished my run every day before lunch. The original plan was that I would run as soon as I reached the end of my first block of productivity. That hasn't been too successful so far. The problem seems to be that when I reach a natural break I either move too quickly onto something else or get asked a question. So rather than heading out between 09:30 and 10:00, I've only managed 11:00, 13:30 and 11:30.

Despite the sub-optimal time to run, I have been quite pleased at being able to return to work when I get back, and I don't feel that my days are any less productive. I'd hope that in time I will see them as *more* productive, but it's very early days yet.

*I'm publishing this as part of 100 Days To Offload. You can join in yourself by visiting [https://100daystooffload.com](https://100daystooffload.com).*
CamelCase, kebab-case or snake_case folders?
Tags: discuss
Published: 2020-06-24 20:56:21

Which type of casing do you use when naming a folder in your project? `CamelCase`, `kebab-case` or `snake_case`, or all mixed and mashed together 😂?

Of course, this would also depend on which programming language you use, or style guide. But what do __YOU__ really feel like would be the best naming case for folder/directories?
#023 docker-compose versions
Tags: docker, devops, tutorial
Published: 2020-06-24 20:49:45

# Introduction

this is part 23 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.

And I will cover lot of tools as we move on.
***

# before compose
before docker-compose exist there was a tool called fig , it was an open source tool , after success she made docker decided to integrate it with docker as docker-compose name.
***
# Versioning

There are currently three versions of the Compose file format:

. Version 1, the legacy format. This is specified by omitting a version key at the root of the YAML.
because it's legacy so it's not recommended to use it.

. Version 2.x. This is specified with a version: '2' or version: '2.1', etc., entry at the root of the YAML.

. Version 3.x, the latest and recommended version, designed to be cross-compatible between Compose and the Docker Engine’s swarm mode. This is specified with a version: '3' or version: '3.1', etc., entry at the root of the YAML.

every version need to be compatible with an docker engine release , this is a table shown it :

|Compose file format| Docker Engine|
|------------- |:------------- |
| 1      | 1.9.0+ | 
| 2.0      | 1.10.0+      |   
| 2.1 | 1.12.0+      |
| 2.2, 3.0, 3.1, 3.2 | 1.13.0+      |
| 2.3, 3.3, 3.4, 3.5 |17.06.0+     |
| 2.4 | 17.12.0+      |
| 3.6  | 18.02.0+      |
| 3.7 | 18.06.0+      |

and every version contain new features so it's good to follow up with there [github repo](https://github.com/docker/compose/)
Starting something new: My own YouTube Channel
Tags: discuss, azure, help, youtube
Published: 2020-06-26 07:16:54

---
title: Starting something new: My own YouTube Channel
published: true
date: 2020-06-24 20:43:26 UTC
tags: discuss,azure,help,youtube
canonical_url: 
---

#### During Lockdown, I admittedly lost motivation to do regular blogging, so I decided to mix things up a bit

![](https://cdn-images-1.medium.com/max/1024/0*3svXehD7WGBiiEYo.png)

**Due to COVID-19** , New Zealand went into lockdown on 25th March. It’s not quite as severe as it sounds, we were allowed to go outside for walks for 30 minutes, we could go to supermarkets for essential items but at the end of the day, it was still a lockdown.

During this time, **I lost a lot of motivation to do any blogging**. I’m not the most regular blogger, but I like to think that I was able to keep it up. Lockdown changed my attitude towards blogging a lot. I had no desire to keep it going. Being worried about how long lockdown would last, trying to keep up some sort of routine during lockdown, making sure I was looking after myself and staying healthy etc. These things took priority over keeping up a blog.

Event though New Zealand has moved into Level 1 (Everything except borders), I wasn’t compelled to jump back into blogging again. I’ve wanted to mix things up a bit for a while now. I still wanted to contribute to the community, but I found the process of writing a blog post a bit mundane _(N.B, I’m not saying I’ll never blog again or that the art of blogging is pointless, just saying that I want to try something new _😊_)._

The silver lining of being in lockdown was that it gave me some time to think about different ways I could contribute back to the community. One of those ideas was to create make some videos on stick them on YouTube.

I used to write short articles on specific topics about Azure Cosmos DB and do more in-depth talks at conferences and meetups, but I now want to do short, simple videos on specific topics related to Azure Cosmos DB.

I’ve already made the first one, which you can view below:

{% youtube 1oqGi8h675Y %}

In the short term, I plan to release videos on the following topics:

- _Data Modelling in Azure Cosmos DB._
- _Understanding Partitioning._
- _Understanding Throughput._
- _Database and Container Design in Cosmos DB._
- _Understanding Global Distribution (might have to make multiple videos about this topic!)_

Thanks to the MVP Program, I was able to get my hands on a free Camtasia license. All I need now is a decent Microphone and hopefully I should be able to refine my technique with time. I’m not looking to be one of those YouTube types, but hopefully I can get comfortable enough to publish my own courses someday.

**One step at a time**. If you have any similar experiences starting your own YouTube channel or indeed creating your own video content, I’d love to hear about them!