teleren/devto huggingface dataset:
Machine Learning
Tags: python, machinelearning, ai, codenewbie
Published: 2023-02-12 19:06:27

Over the next couple of weeks, I plan to share all that I have so far learned on the topic of machine learning. Like many, I still consider myself a newbie to this field as I am still learning and exploring ways to improve my coding and writing skills. That being said, how about we start from the top?

**What is machine learning?**
Machine learning is a subfield of the larger topic of artificial intelligence, that is primarily concerned with pattern recognition. Additionally, we can also define machine learning as the science of getting computers to work explicitly without any form of human interfacing. The beauty and strength of ML is that it learns and improves from examples.

This is why when we do a web search, even before having finished entering a query, the search engine already provides us with alternatives. This is also why certain emails are sent to the spam folder, cause the system has been trained to pick up on or flag some key words that suggest it is spam. Furthermore, this is also why certain medical applications can pick up tumors or other anomalies that are not visible to the human eye from scans, and this really aids medical professionals in the diagnosis of diseases.

Machine learning has also led to one of the most significant and currently compelling areas, which is the field of deep learning. As has been said before, the advent of big data and access to more computational processing power has put DL at the forefront and really brought its attention to the public. We have seen improvements in natural language processing (NLP) through the introduction of the transformer architecture; we have also seen deep learning's applications to computer vision areas like video and image data through the creation of object detection algorithms like the very popular YOLO (You Only Live Once) program, and other architectures in the form of ResNets, the AlexNet and the also popular VGG network.

As previously mentioned, I plan to use this platform to share my ideas and learnings of my journey so far using this innovative and dynamic technology of machine learning, whereby we look into the history, theory and practicality of this science.
Initializing and Creating a Testing Database in PostgreSQL 12.0 with Age Part 2
Published: 2023-02-12 18:26:33

## Testing:
In the previous article we learned how to install PostgreSQL and age from source.[ Part 1 here.](https://dev.to/moiz697/installation-of-apache-age-and-postgresql-from-source-in-mac-part-1-amd)

Creating and testing of database cluster.

## Database initialization:

Now we will initialize our database cluster. 

```
cd postgresql-12.0
which psql
ls /usr/local/pgsql/bin/
export PATH=/usr/local/pgsql/bin/:$PATH
export PGDATA=/usr/local/pgsql/bin/data
sudo chown -R moiz /usr/local/pgsql/ 
```


To initialize a database in a PostgreSQL database cluster, you can use the initdb command. This command creates the necessary directories and files for a new database cluster.

Here's the syntax:

```
initdb --username=<database superuser name> [other options] <database cluster location>
```

For example:

```
initdb
```


When you will execute the command the success message will be shown with the command to start the server.

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


## Starting Server:-

```
pg_ctl start -l log
```

## Checking Server Status:-

```
pg_ctl status -l log
```

## Postgres :-
The command psql postgres is used to connect to a PostgreSQL database named "postgres". psql is a command-line interface to the PostgreSQL database system. When you run the psql postgres command, you will be logged in to the "postgres" database as the current operating system user.



```
psql postgres
```
[Apache-Age:-https://age.apache.org/](https://age.apache.org/)
[GitHub:-https://github.com/apache/age ](https://github.com/apache/age)
Install NodeJs (LTS 18.14.0) on windows 7
Tags: node, windows7, npm
Published: 2023-02-12 18:26:24

Hi there, I'm Omar!
and it is my first DEV post.

the all of JavaScript~front-end~back-end (windows 7 user) users need to install latest version of nodejs...

actually we have two ways:
1. use the latest version that supports windows 7
2. or use this way... use the environments.

---

i have a 100%-guarantee way...
Continue with me:

1. first go to [nodejs](https://nodejs.org/en/download/) website.
## Note
> you need to download **Windows Binary (.zip)**

2. Extract *.zip* file in a desired directory *like-Program Files or Program Files(x86)*

3. Open **Edit Environment variables for your account** with search in windows start menu. open it.

4. in *User variables for [% system username account %]*, click on *New* button.

5. add **NODE_SKIP_PLATFORM_CHECK** on *Variable name*.

6. use **1** on *Variable value*

7. in the end, press OK. again OK...

---

## Note
for use in global, follow me:
1. copy the extracted path of the nodejs .zip file.
2. open again **Edit Environment variables for your account** but edit the *PATH*
3. add the path in here with use **;** in last character.

---

## Try it

now open cmd or power-shell or any command prompt and type *node -v*... i told you... it works!!

and finally, enjoy the NodeJS and Npm with latest version right now...

---

Forgive me if I made a mistake.
Because I don't speak English. And I'm learning it.

Tnx u!


## references:
- [nodejs wallpapers](https://wallpapercave.com/nodejs-wallpapers)
Magic!, useEffect running twice 🤔
Tags: react, nextjs, useeffect
Published: 2023-02-12 17:54:04

React's useEffect hook is an essential tool for managing side effects in your components. However, it's not uncommon to run into issues where the useEffect hook appears to be running twice in development mode, causing unexpected behavior in your application.

This issue occurs because React updates its components in a specific way during development mode. When a component re-renders, React first calls the component with the updated state and props, and then calls the useEffect hook with the same values. This ensures that the component and its effects are always in sync.

However, if you're not careful, this can lead to unexpected behavior. For example, consider the following code snippet:

```

import React, { useState, useEffect } from 'react';

const Example = () => {
  const [count, setCount] = useState(0);

  useEffect(() => {
    console.log('The count is:', count);
  }, [count]);

  return (
    <div>
      <p>The count is: {count}</p>
      <button onClick={() => setCount(count + 1)}>
        Increment
      </button>
    </div>
  );
};

```

In this example, we have a simple component that displays a count and increments it when a button is clicked. The useEffect hook logs the current count to the console whenever it changes.

If you run this code in development mode, you'll notice that the useEffect hook is called twice for each update: once with the old count and once with the new count. This is because React is first calling the component with the old values, and then calling the component and its effects with the updated values.

To avoid this issue, it's important to understand how React updates its components in development mode. You can also use the useDebugValue hook to display a custom label for your hook in the React DevTools, making it easier to distinguish between the initial render and subsequent re-renders.

Here's an updated example that uses useDebugValue:

```

import React, { useState, useEffect, useDebugValue } from 'react';

const Example = () => {
  const [count, setCount] = useState(0);

  useDebugValue(count, count => `Count: ${count}`);

  useEffect(() => {
    console.log('The count is:', count);
  }, [count]);

  return (
    <div>
      <p>The count is: {count}</p>
      <button onClick={() => setCount(count + 1)}>
        Increment
      </button>
    </div>
  );
};


```
With this change, you can see the custom label in the React DevTools and easily distinguish between the initial render and subsequent re-renders.

In conclusion, understanding why the useEffect hook may run twice in development mode is essential for avoiding unexpected behavior in your application. By using the useDebugValue hook, you can easily identify and debug issues related to double rendering in your application.
Drum Circle in Pune Providing Fun Team Building Activities
Tags: entertainment, drumming, teambuildingactivitiesinpune, music
Published: 2023-02-12 17:42:08


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

**Pune**, the cultural hub of India, has a plethora of team building activities to offer. One such unique activity that is gaining popularity is the drum circle, a fun and interactive way to build better teamwork skills. One company leading the charge in this area is [Taal Inc](https://www.taalinc.net/), a team building company that specializes in drum circle events.

**A drum circle** is a gathering of people who come together to play drums and other percussion instruments. The aim of the activity is to create a rhythm and beat together, thereby encouraging collaboration and communication among the participants. This activity is not only enjoyable but also helps in building better teamwork skills.

**At Taal Inc,** the drum circle is designed to be a team building activity for corporate groups. The experienced facilitators ensure that the activity is fun, engaging and helps to improve teamwork skills. The participants are given drums and other percussion instruments, and then they are divided into groups. Each group is then given a task to create a rhythm and beat together, while working towards a common goal.

**One of the key benefits** of the drum circle is that it helps to break down the barriers between team members and encourages them to work together. This activity is especially helpful for teams that are new or that have been working together for a long time and need a fresh perspective.

**Another benefit** of the drum circle is that it helps to build better communication skills. Participants are encouraged to listen to each other and work together to create a rhythm. This helps to improve their communication skills, as they have to listen and respond to each other in real-time.

**In conclusion** drum circle is a unique and effective way to build better teamwork skills. At Taal Inc, the experienced facilitators ensure that the activity is fun, engaging and helps to improve teamwork skills. If you're looking for a [team building activities in Pune](https://www.taalinc.net/corporate-team-building-activities-in-pune/), drum circle is a must-try. So, go ahead and book your drum circle experience with Taal Inc and see the positive impact it can have on your team!
JSON in ClickHouse
Tags: clickhouse
Published: 2023-01-14 10:12:38

---
title: JSON in ClickHouse
published: true
description: My takeaways from a talk I just watched
tags: clickhouse
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-01-14 10:07 +0000
---

I just watched [this talk](https://www.youtube.com/watch?v=mWEPHX8rlSM) about storing JSON in ClickHouse. It's quite insightful. My takeaways:
- There are performance-trimmed json-value-extraction functions that avoid parsing the entire blob in favor of performance.
JSON in String columns compresses pretty well.
- There're functions to convert simple JSON to maps and when you store the same data from the talk's example as a map instead of JSON, queries are 4-5x faster.
- You can insert data into a table with engine=null. Such a table doesn't store any data but it can be the source of a Materialized View. 
- It's pretty common for users to store the JSON in one column and then extract specific values into columns next to that. That will already boost performance if you're smart about it. You can further enhance performance by defining Data-Skipping Indexes on those columns.
- All the approaches explored in the talk are [documented here](https://clickhouse.com/docs/en/guides/developer/working-with-json/json-other-approaches).
- There's a [beta feature](https://clickhouse.com/docs/en/guides/developer/working-with-json/json-semi-structured) for the future of JSON data in ClickHouse with many under the hood optimizations (essentially, inserted data is schema-inferred and clickhouse will automatically create columns for all fields (even nested) and it will even create new columns as json object with new fields flow in).
Windows 11 Clone : Setting Menu
Tags: webdev, javascript, opensource, css
Published: 2023-02-12 16:49:49

<p>
Just created a component for windows 11 clone.
Windows 11 Setting shortcut clone.
</p>
<p>
Some of the functions I have included :
- Change brightness of the screen
- onClick change the background of the div
- Working sliders
</p>


{% codepen https://codepen.io/shreyaanp/pen/PodYPoB %}
How I work
Tags: productivity
Published: 2023-02-12 16:47:12

Here is a sample timeline of my typical day:


![Typical day timeline](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v3r3svueiln1qbjuropj.png)

# Respond to Urgent Requests
I start the day be responding to urgent requests. I check slack and e-mail and only respond if the request is urgent or fast to respond to. The less I can divide my attention the more effective I can be at completing the Daily Plan.

# Make a Daily Plan

The Daily plan is three items. The first item is the highest priority.

Here is a sample Daily Plan written in the margin of a work notebook:

![Sample Daily Plan](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jaetz2yzqs8dmh5wgxmn.jpg)

Plan achievable tasks. It is better to err towards small achievable tasks, than have big tasks that go unfinished. The more you finish the Daily Plan, the more you will trust yourself to stick to your Daily Plan.

For big tasks, I set daily tasks to spend time. E.g. if X is a task that will take several days, my daily task will be "Spend 1 hour on X" rather than "Do X".

Estimate to complete the Daily Plan with half of the time available in the day. E.g. if you are in meetings for 2 hours, you have 6 hours of working time. Estimate to spend 3 hours on the Daily Plan. This padding accounts for unexpected interruptions. If the Daily Plan is finished early, work on other backlog items.

# Review Input Streams
At the end of the day, I review a checklist of input streams. Streams are reviewed in order of urgency:
- Slack. Respond to all messages.
- Github. Review quick low complexity code reviews.
- Calendar. Accept/decline/reschedule all invites for the next day.
- E-mail. Respond/archive/delete/label all e-mails. Non-urgent e-mails requiring a response are often labeled with "Later".
- TODO list.
- Jira.

After reviewing the checklist, I have the state in my head of all pending items. Make the Daily Plan for the next day.

Here is a sample checklist to end the day, with the next day's Daily Plan:


![Sample checklist and next Daily Plan](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mv1m2vjvhi33fn8rf7y7.jpg)
From Around the Web: 10 Fabulous Infographics About JAMstack
Tags: webdev, javascript, jamstack, serverless
Published: 2023-02-12 16:45:00

From Around the Web: 10 Fabulous Infographics About JAMstack

A picture is worth a thousand words, so let's see what makes JAMstack so beloved through these infographics.

JAMstack Ecosystem

As a new standard for the web, Jamstack provides a bunch of tools and resources that allow you to do so much more with a static website than ever before.

JAMstack Frameworks

A JAMstack framework allows you to create a superfast, SEO-friendly, and user-friendly website.

Static site generator JAMstack and dynamical content

JAMStack is an ideal choice for static sites or static site generators, but the burning question is, how JAMstack operate with dynamic sites or content?

Wanna see what it looks like “Building Websites with JAMstack” or how Jamstack is breaking monolithic structures? Find out the rest of the infographics here ➡️ [https://thebcms.com/blog/10-fabulous-infographics-about-jamstack] (https://thebcms.com/blog/10-fabulous-infographics-about-jamstack)
The Power of Closures in JavaScript: A Beginner's Guide
Tags: webdev, javascript, beginners, tutorial
Published: 2023-02-12 16:33:44

Say goodbye to messy code and hello to organized, secure, and maintainable solutions with Closures.


Explained With real life example - Chef Secrets. 👨‍🍳 
**Code example below:**

_**But first of all what is closures ?**_

A closure in JavaScript is a function that has access to variables in its outer scope even after the function has completed its execution.


Now its hard to fully understand with only one line definition so

_**Time for a real life example..**_

Think of Closures as a chef and their kitchen secrets.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6xilxd7bnspl71io8pfc.jpg)


A basic function could reveal a simple recipe, 

but what if the chef wants to keep certain ingredients or cooking methods a secret?

This is where Closures come in. 

The chef can use closures to wrap up their secret ingredients or methods, creating a "closed-off" environment that can only be accessed by specific functions.

Just like a chef's secret recipe, a closure in JavaScript allows us to keep variables and functions private, only accessible within the closure scope.

This can help us manage state and make our code more organized, secure, and maintainable.

Just like a chef's kitchen, closures provide a neat and organized way to handle our code and make it work the way we want it to.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ed0w00ic9jeakwm37yyt.png)
Two Sum - LeetCode
Tags: javascript, beginners, tutorial, programming
Published: 2023-02-12 16:26:00



> Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.

In this challenge, you are given an array of integers `nums` and an integer `target`, and your goal is to return the indices of the two numbers such that they add up to the `target`. You may assume that each input would have exactly one solution, and you may not use the same element twice.

The solution to this problem can be achieved through a nested loop. The outer loop starts from the first element in the array, and the inner loop starts from the next element after the current outer loop element. The inner loop checks if the sum of the current outer loop element and the current inner loop element is equal to the target. If it is, we return an array of the indices of the two elements, which represent the solution to the challenge.

Here is the code for the solution:

```js
var twoSum = function(nums, target) {
  for (let i = 0; i < nums.length; i++) {
    for (let j = i + 1; j < nums.length; j++) {
      if (nums[i] + nums[j] === target) {
        let result = [i, j];
        return result;
      }
    }
  }
};
```

Let's walk through an example to understand how the code works. Let's say the array `nums` is `[2, 7, 11, 15]`
 and the target is `9`.

1. The outer loop starts with the first element in the array, which is `2`, and the inner loop starts from the next element, which is `7`.

2. The inner loop checks if `2 + 7 = 9`, which is true, and returns the indices of the two elements, which are `[0, 1]`.


As you can see, the solution to the two sum challenge can be easily achieved through a nested loop in JavaScript. The time complexity of this solution is `O(n^2)` because it has two nested loops, but it still works well for small arrays.
Being a Developer Advocate: Week 21
Tags: devrel, learninpublic
Published: 2023-02-12 16:20:21

This weeks post is late as I caught a cold on friday and rested for the weekend :/

And I am not fully recovered yet, so this is a little less unstructured than usual.

There was much going on this week. Apart from two talks I helped in moderating our monthly Meetup. If you want to talk about something related to testing, shoot me a message and you might get a nice sketchnote of your talk, too!

I noticed a few things giving my talks and moderating:

* There is not fear any more when I have to speak publicly in English (second language for me).
* Livecoding is so much fun, when you are confident and able to spot errors and correct them on the fly
* Doing something for our community feels so nice as I really care about people and can be authentic and energetic.

On another note: Our Twitter engagement and views dropped to pracically zero. Is this the new normal now with everything that happens there? :(

Apart from that I managed to brush up our companies YouTube channel and it looks more professional now :D

Also the docs rework is coming along nicely. Our goal is to structure everything in a nice way. So far we have:

* Integrated our Gitpod-TryOut repository
* Removed some pages at the start -> Less clicks to Getting started (only 1 now!)
* Added more Guides to help with using our product
* Restructured and expanded our Troubleshooting section

Next week I will go on and improve our API reference with more examples and gifs.

This is fun!
Learn Git, Github, and Opensource
Tags: series
Published: 2023-02-19 14:56:09

---
title: Learn Git, Github, and Opensource
published: true
date: 2023-02-12 16:00:12 UTC
tags: Series
canonical_url: https://codesource.io/learn-git-github-and-opensource/
---

 ![Learn Git, Github, and Opensource](https://codesource.io/content/images/2023/02/github-course.png)

This course will introduce you to git with some of its most important commands everyone should know.

In this course, we will use the command-line tool to leverage the full potential of git as it is a good way to use git.

We will be more practical in explaining the basic concept and commands so make sure you ride along.

**What you will learn**

At the end of this article, you will understand

- Why Git and GitHub are necessary for the development of software.
- How to use Git and GitHub for your project.
- What open-source software is
- how you can contribute to some Open Source projects.

**Lesson 1**

In this lesson, you will be introduced to Git, the benefits of using Git, important Git commands and how to install Git.

[Read Lesson 1](https://codesource.io/introduction-to-git/)

**Lesson 2**

In this lesson, you will be able to configure Git on your machine, you will know what a repository is, what GitHub is, how to make changes, add changes and also undo changes in a repository.

[Read Lesson 2](https://codesource.io/getting-started-with-git-on-your-machine/)

**Lesson 3**

In this lesson, you will be introduced to branching in Git and why branching is necessary for Git as I will walk you through a practice project.

[Read Lesson 3](https://codesource.io//understanding-branching-in-git/)

**Lesson 4**

In this lesson, you will learn how to synchronise a local repository with GitHub, how to invite people to your repository and how to add multiple people to the same repository.

[Read Lesson 4](https://codesource.io/how-to-synchronize-your-local-repository-with-github/)

**Lesson 5**

In this lesson, you will understand what open-source software is, what a fork is in GitHub, how to fork a repository and how to contribute to an open-source project. Finally, to solidify your understanding of this course, you will contribute to the Open Source project for the course.

[Read Lesson 5](https://codesource.io/understanding-opensource/)

## **Conclusion**

With all the knowledge gathered from each lesson in this course, your confidence level and knowledge in making contributions to any Open Source project will increase intensively. Also, remember this course will serve as a reference while contributing to open source projects in the future.