teleren/devto huggingface dataset:
HacktoberFest 2022: Embark on an open-source adventure!
Tags: hacktoberfest, opensource, codenewbie, beginners
Published: 2022-10-01 23:42:39

With Hacktoberfest in full motion, there has never been a better time to embark on an open-source adventure.

Today I want to talk to you about Hacktoberfest and by the end of this article we will have covered: 

- What Hacktoberfest is!
- Why it exists
- What makes it an ideal first step into the open-source community?

If you'd prefer this in video format, I have that here: 

{% embed https://www.youtube.com/watch?v=jZXV8XBqZHA %}

## What is Hacktoberfest?

Hacktoberfest is the biggest Opensource event for creative individuals of all skill levels and skill sets.  A month-long annual event held throughout the month of October each year aimed at encouraging community collaboration to accelerate the progression of all open-source projects on Github.

You might be asking “Why should I participate” and that is a totally fair question so here are 4 reasons why I think you can’t afford to miss out on this opportunity:

### 🎓 THE LEARNING EXPERIENCE

Contributing to open source in my opinion is one of the best environments to gain valuable experience in a wide range of things you will use throughout your career.  Such as: 
- Your Communication Skills
- The ability to work alongside others or in teams
- The ability to pick up new Technologies, procedures & workflows
- Develop an understanding of version control such Git and Github
- Become comfortable with receiving and providing code reviews.


### 💰  THE SWAG 
The swag provided to all participants is always a nice little incentive to get involved. The swag kit generally includes a range of awesome stickers from the various brands of the sponsors. But for many, the sweet little t-shirt is the main prize. 

### 💯  COMMUNITY ENRICHMENT
Of course, we can’t talk about reasons why to participate in Hacktoberfest without touching on the main reason Opensource projects exist in the first place. Nearly every project that can be found on Github or other open source platforms is generally there to be built, developed, tested and enhanced by the wider community. Some of the best software is maintained by the community. 

### 🤝  CONNECTIONS
Opensource projects have a unique way of bringing like-minded people together. Over the last several years I have been fortunate enough to connect with some really talented people from all over the world from many different backgrounds. These connections are extremely valuable, not only does each connection have their own unique journey and skill set that you can learn from but these people might also be your next co-worker, boss or even co-founder. Just remember to provide them as much value as you can in order to create symbiotic relationships and your connections will help propel your career. 


--- 

I hope you found some value in this quick overview of Hacktoberfest and why I think it is a great event to get started with Opensource. Let me know what you think about it in the comments below.
FOOD ZONE
Published: 2022-10-01 23:34:18

  I make this program for a restaurant which serves a number of customers everyday. The cashiers are unable to take orders fast, so that this system can help them to do it. This will create better profit and services. 

  The program works by taking inputs from the user based on their interest and calculates prices. In addition it provide payment services based on customer's willing.

  Ultimately, this program will generate a solution for the restaurant by speeding up the services. Therefore customers will have positive perspective about it.

The link for the program is {https://github.com/tamke425/tamrat1.git}
Ruby: Why to use private_constant (pt 1)
Published: 2022-10-01 22:29:16

I don't want to muddy the waters by going over all the reasons to use private_constant (e.g. for inner classes, that's pt 2) since I want to focus on what we most commonly think of as constants in ruby i.e. `FOO = 1`. 

I'm too used to seeing classes that define constants at the top of the class (great!) but then leave me wondering .. is that constant being used from outside the class? In a small code base that isn't a problem; in a large code base it's **essential** that a classes public interface is public for a reason, not by chance.

Sometimes people do consider this and we end up with:

```
class Foo
   def blahblah = FOO
...
  private
  FOO = 1
end
puts Foo:FOO
```
:shocked_pikachu_face: when people discover that the above quite happily prints `1`

The proper way to declare a private constant is to use ... `private_constant`

```
class Foo
  FOO = 1
  private_constant :FOO

  def blahblah = FOO
end
puts Foo::FOO
```

Now we have a private constant:

```
ruby private_constants.rb
private_constants.rb:7:in `<main>': private constant Foo::FOO referenced (NameError)

puts Foo::FOO
        ^^^^^
```

Encapsulation is **vital** in complex software systems. Please watch your privates!
Global Key ile Snackbar Kullanımı
Tags: flutter, dart, snackbar, globalkey
Published: 2022-10-01 22:17:41

### 1. Snackbar oluştur:

```
import 'package:flutter/material.dart';

class Utils {
 static final messengerKey = GlobalKey<ScaffoldMessengerState>();

  static showSnackBar(String? text) {
    if (text == null) return;
    final snackBar = SnackBar(
      content: Text(text),
      backgroundColor: Colors.red,
    );

    messengerKey.currentState!
      ..removeCurrentSnackBar()
      ..showSnackBar(snackBar);
  }
}
```

### 2. MaterialApp'e key i ekle

```
MaterialApp(
      scaffoldMessengerKey: Utils.messengerKey,
...

```

### 3. İstediğin yerde kullan

```
  Utils.showSnackBar("mesajını yaz");
```
Ruby: Why to use private attr_reader
Tags: ruby
Published: 2022-10-01 22:10:13

I was just reminded of why I use `private att_reader` in my code. 

I know the advice is to always use an interface but a point of discussion between myself and a colleague has been why not to use an instance variable, with the argument that it is much more readable. 

I have to agree with him in that with `@foo` it's obvious that it's an instance variable being referred to. I agree it's better than plain old `foo` in terms of readability. 

That is about where the benefit ends however and there is a **huge** downside. Consider the following:

```
class Foo
  def initialize(some_variable) = @some_variable = some_variable
  def some_op = @some_varible
end

class BetterFoo
  def initialize(some_variable) = @some_variable = some_variable

  def some_op = some_varible

  private attr_reader :some_variable
end

puts "----"
puts Foo.new("BAR").some_op
puts "----"
puts BetterFoo.new("BAR").some_op
puts "----"
```

The typo in the above is probably glaringly obvious since it's a small piece of code ... did you spot it? If not compare the output:

```
ruby some_variable.rb
----

----
some_variable.rb:10:in `some_op': undefined local variable or method `some_varible' for #<BetterFoo:0x00007fdba9d26090 @some_variable="BAR"> (NameError)

  def some_op = some_varible
                ^^^^^^^^^^^^
Did you mean?  some_variable
               @some_variable
	from some_variable.rb:18:in `<main>'
```
  
Did you spot it now?
  
IMO the use of a `private attr_reader` so as to ensure the variable you are using has been initialised to a value other than nil overrides **any** readability argument; let's not mention that it more easily allows the interface to be changed internally in the future should the need arise. The fact that it's private makes it an implementation detail but an implementation detail that will save you a lot of time.
(S+C) (EO) = Neil Patel
Tags: beginners, programming, seo, productivity
Published: 2022-10-01 19:50:48

After dissecting Nell Patel's article covering 5 rules for sub brand keyword strategy, I found it interesting how brands make sub brands to target new audiences and market different products. Also, key to SEO is to be realistic of the key words to rank well on Google. This opened my eyes as to how brands have to see the importance of including SEO in their initial conversation when making their new product/brand. 

Source: https://neilpatel.com/blog/keyword-research-for-multiple-domains-in-the-same-niche/?ref=dailydevbytes.com
I opened up my projects for Hacktoberfest.
Tags: hacktoberfest, webdev, opensource, programming
Published: 2022-10-01 19:40:41

Hacktoberfest hacktoberfest open-source pull-request merge-request hacktoberfest-2022 hacktoberfest-accepted

Ignore those words, they are for SEO. Anyway, You must have heard about the month-long hacktoberfest which is all about contributing to public repositories. 

Well, I joined as a project maintainer. Since the start of 2022, I have been building side-projects to improve my technical abilities. Which placed me in prime position to open up my projects for outsiders to contribute. So, I did. [ To learn how to open up your project for others, click here](https://dev.to/ifeanyichima/hacktoberfest-as-a-project-maintainer-3oih).


![BMC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9jex6wptcnsbf1is31r.gif)

## Advantages

**1.** SWAGS: 

yes, I know you have to contribute to projects to qualify. I am doing that too as well as accepting pull-requests to my projects.

**2** GitHub streaks

I have been able to keep up my GitHub streak without having to build more projects. Honestly, I am tired of building side-projects. I have **50** 😞😞 

**3** Recognition
I got a star from GitHub (You want it, You merge it). Something I never imagined I would get. I also got (Pull shark) 🦈

**4** Learning How to Merge

I got the opportunity to review the pull-request made by other people and I learnt how to merge them. 💪 

**5** Upgrade Resume

After completing this I would update my Resume to reflect my contributions, and hopefully I would be able to get a Job.

**6** DEV Badge

As a project contributor, I got a badge from DEV and hacktoberfest. I can display this badge on my social media profiles.


<a href="https://www.buymeacoffee.com/ifeanyichima" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>


**Thank you, please follow me**

[![HTML](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://linkedin.com/ifeanyi-thankgod-chima)&nbsp;[![GitHub](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/masterifeanyi)
Moving rows from one table to the other 🐘 🚀
Tags: postgres, yugabyte, sql, database
Published: 2022-10-01 19:34:20

With multitenant application, you may have one table storing many customers. You can use PostgreSQL Row Level Security to isolate them. For physical isolation, you can use dedicated partitions (by list) on different tablespaces. With YugabyteDB, this can be sufficient to have them in dedicated nodes, zones or regions. You may also decide to have some customers in different schemas, databases, or even clusters. In this case, moving rows must be done with an INSERT (or COPY) into the destination table, and a DELETE from the source table.

Here is a simple way to do it combining PostgreSQL features: **RETURNING** clause and **WITH** clause (**Common Table Expression**), and **Foreign Data Wrapper** when this is cross-databases. 

I'm running this in YugabyteDB, where all those features are available.

I create a demo table:
```sql
create table demo as select tenant_id, id, 0 a, 0 b, 0 c
 from generate_series(1,100) tenant_id, generate_series(1,1000) id
;

```
I create a Foreign Data Wrapper table pointing to it, to show how it works when between different databases:
```sql
create extension if not exists postgres_fdw;

create server my_source_fdw foreign data wrapper postgres_fdw
 options (host 'yb0.pachot.net', dbname 'yugabyte')
;

create schema my_source_schema;

create user mapping for "yugabyte" server my_source_fdw;
import foreign schema public limit to ( demo )
 from server my_source_fdw into my_source_schema
;

```

I create an empty table with the same structure:
```sql
create table demo2 as 
 select * from my_source_schema.demo
 where null is not null --> always false, to read no rows
;

alter table demo2 add primary key (tenant_id, id);
```

And now, ready to move rows for tenant_id=42 
```sql
with deleted_rows as (
 delete from my_source_schema.demo
 where tenant_id=42 --> this is the condition for rows to move
 returning *
) insert into demo2 select deleted_rows.* from deleted_rows
;
```

This supposes that the application doesn't change the state of the rows while they are moved. You can set SERIALIZABLE isolation level (`set default_transaction_isolation to serializable`) to have it automatically retried or failed. In some cases, I got `Read time should NOT be specified for serializable isolation level` - check [#14284](https://github.com/yugabyte/yugabyte-db/issues/14284)

If you cannot afford application downtime on the rows that are moved, there are other solutions: [triggers](https://docs.yugabyte.com/preview/explore/ysql-language-features/triggers/) or [Change Data Capture](https://docs.yugabyte.com/preview/explore/change-data-capture/#java-cdc-console-client).
Why PHP?
Published: 2022-10-01 19:09:01

- PHP is much easier to learn and use.
- PHP was written specifically for dynamic Web page creation.
- PHP is both free and cross-platform.
- PHP is the most popular tool available for developing dynamic Web sites.
- PHP you are not limited to output by HTML but include other outputting methods like images, PDF files, and even Flash movies (using libswf and Ming) generated on the fly. You can also output easily any text, such as XHTML and any other XML file. PHP can autogenerate these files, and save them in the file system, instead of printing them out, forming a server-side cache for your dynamic content.

- One of the strongest and most significant features of PHP is its support for a wide range of databases. Writing a database-enabled web page is incredibly simple by using one of the database-specific extensions (e.g., MySQL), using an abstraction layer like PDO, or connecting to any database supporting the Open Database Connection standard via the ODBC extension. Other databases may utilize cURL or sockets, like CouchDB.
To read more Visit the website:(https://tutorialsprog.com/php)
#31DaysofNeurodivergence
Tags: mentalhealth
Published: 2022-10-01 18:53:48

It's October and that means it's #ADHDAwarenessMonth! As I've been mentioning I collected messages of support from folks with a Neurodivergency to give you a message of support if you're newly diagnosed or have been considering seeking a diagnosis.

These messages were collected anonymously. I'll be sending one tweet a day with the following image card and the hashtag #31daysofNeurodivergence.

![orange twitter image card](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccs3cl0hkn464ry3bj7l.jpg)

Whether it's ADHD, ASD, Dislexia, Bipolar, or PTSD, or any other Neurodivergence, I hope these messages will be a voice of encouragement for you this month to speak with someone.

## About the folks who participated in this.

Folks were asked a bit about their journey with mental health. While this isn't a comprehensive study. It definitely matches that of the experiences I heard from others.

Many of the folks in that filled this out belonged to one or more underrepresented group in their career. 

![survey results for underrepresented groups](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n121q2hac1e7ro8lp2p6.png)

These folks were mostly also diagnosed later in life.
 
![survey results for diagnosis](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ugkbowihnw1sx0xinwa.png)

The majority of folks also didn't speak openly about mental health and a large group of folks were often discouraged from seeking professional help by their culture.


![survey results for mental health and family](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xn2dz62v5j8726bpsd8m.png)

If you want to want to receive these messages, be sure to follow [me on Twitter](https://twitter.com/kjaymiller).

Lastly, a majority of these folks were encouraged after hearing about others with neurodivergencies. That is why we're sharing this information in hopes that we can encourage others.

![survey about hearing about mental health from others](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nwazrtr46hppoofpon78.png)
How to record a video for your app
Tags: showdev, speaking, tutorial
Published: 2022-10-01 18:38:53

The best way to explain how your app or your SaaS works, it's provide to your users or investors a video.
People prefer to watch a video than read a long document with features, texts and image.

## The Script
Try to write down some bullet points with the main topics you would like to show to the users.
Then, expand all bullet points into sentences with some details but it's important to have a simple and informal language and style.
There isn't a fixed rule about the length of the final video: some pitch for the investors are one minutes or two, but if you want to explain all the features to the end users, you can also create videos longer than five minutes.

## Record the video
There are several software to record your screen and your camera. I used to use Camtasia (actually it's installed on my machine in this moment) but other people use Loom or other very known software like OBS. It's up to you.
But in the last few weeks I discovered a new good alternative to Camtasia and it's free and it's very powerful!
The application is called [Clipchamp](https://apps.microsoft.com/store/detail/clipchamp-video-editor/9P1J8S7CCWWT?hl=en-us&gl=us).

![](https://store-images.s-microsoft.com/image/apps.45314.14506576373691712.f142bb8f-4517-4ff3-80c8-442338d9b06c.c2993bfc-e274-46fb-9802-437568f0f8da)

This application is preinstalled on your Windows 11, but if not, you can find it from the Windows Store.

I found a good tutorial about Clipchamp and you can watch it if you are not familiar with video editing.

{% embed https://www.youtube.com/watch?v=AMH38LNONoU %}

You can use the app for free, but there is also a plan with a lot of premium features.

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

## Voice Over
You can decide to record your video with your webcam or without the webcam. In this case, if you use Clipchamp, you are not allow to record your voice, but just your screen.
It's not a big problem because, honestly, the free version is enough for the most of us.

By the way, on Windows 11, you can record a voice over with another free app from the Store:[ Windows Sound Recorder](https://apps.microsoft.com/store/detail/windows-sound-recorder/9WZDNCRFHWKN?hl=en-us&gl=us).

![](https://store-images.microsoft.com/image/apps.21550.9007199266246865.df745838-28cf-4f03-a3cf-006430b9bfd9.4e2b686e-e974-40d8-ae4f-cc1bb3212027)

With this tool, you can record your voice, save the file on your pc and use it into Clipchamp or another video editor.

## Background Music
Finding the right background music is never easy and you must pay attention on the royalty for the music.
This is the reason why very often I use [Audiojungle](https://audiojungle.net/).
It's another Envato store but it's full of good music and sounds. Prices are very low and starting from 1$ you can have a good quality. I totally recommend it.

## Conclusion
Create the perfect videos for users and investors is never easy, but you have the right tools, it's just more easy. 😊
Have a nice video recording and editing!
Objects in JavaScript
Tags: javascript, es6
Published: 2022-10-01 18:07:00



## There are many ways to create objects in javascript as below
1.**Object constructor:**
The simplest way to create an empty object is using the Object constructor. Currently this approach is not recommended.

`var object = new Object();`
2.**Object's create method:**
The create method of Object creates a new object by passing the prototype object as a parameter
`var object = Object.create(null);`
3.**Object literal syntax:**
The object literal syntax (or object initializer), is a comma-separated set of name-value pairs wrapped in curly braces.

```
var object = {
     name: "Neeraj Kumar",
     age: 25
};

Object literal property values can be of any data type, including array, function, and nested object.
```
Note: This is an easiest way to create an object
4.**Function constructor**
Create any function and apply the new operator to create object instances.

```
function Person(name) {
  this.name = name;
  this.age = 21;
}
var object = new Person("Neeraj Kumar");
```
5.**Function constructor with prototype**
This is similar to function constructor but it uses prototype for their properties and methods
```
function Person() {}
Person.prototype.name = "Neeraj Kumar";
var object = new Person();
```
This is equivalent to an instance created with an object create method with a function prototype and then call that function with an instance and parameters as arguments.

```
function func() {};

new func(x, y, z);
```
**(OR)**

```
// Create a new instance using function prototype.
var newInstance = Object.create(func.prototype)

// Call the function
var result = func.call(newInstance, x, y, z),

// If the result is a non-null object then use it otherwise just use the new instance.
console.log(result && typeof result === 'object' ? result : newInstance);
```
6.**ES6 Class syntax:**
ES6 introduces class feature to create the objects

```
class Person {
  constructor(name) {
    this.name = name;
  }
}

var object = new Person("Neeraj Kumar");
```
7.**Singleton pattern**
A Singleton is an object which can only be instantiated one time. Repeated calls to its constructor return the same instance and this way one can ensure that they don't accidentally create multiple instances.

```
var object = new (function () {
  this.name = "Neeraj Kumar";
})();
```