teleren/devto huggingface dataset:
Alternative eloquent model ?
Tags: laravel, eloquent, database, help
Published: 2022-03-02 21:24:54

Current version of the eloquent model seems bloated with lots of unnecessary code for just querying the database .

No reusable query builder inside model ,new query class for each db interogation
 vast of model code (logic ) moved into controller.
 This one doesn't inspire much also : https://github.com/crocodic-studio/laravel-model
display latest posts, most viewed posts, most comented  on  home page
Each database interogation is a new model, new query builder, each result is a eloquent model. 
Each  result model has Concerns\HasAttributes,
        Concerns\HasEvents,
        Concerns\HasGlobalScopes,
        Concerns\HasRelationships,
        Concerns\HasTimestamps,
        Concerns\HidesAttributes,
        Concerns\GuardsAttributes,
        ForwardsCalls;
 to array , means looping on result , just looking for a simple model , not to bring hole script into memory  for extract 20 results
Web2 VS Web3
Tags: web3, web2, blockchain
Published: 2022-03-02 21:24:29

So, there is a new buzz word out there in the Tech streets, web3.

What does it even mean?
And how is it different from web2? 

I guess those are some of the questions you are thinking of right now, I am just guessing 😅.

Well, I will try to solve this puzzle in the next few lines.

So, what is web3?
To answer that we have to know what web2 is first.

Web 2 is the internet that we are familiar with today, before web 2 there was a web 1 which was just filled with bland pages linked with hypertext,which aided in searching for resources alot faster,a super basic network of pages linked with hypertext, this then evolved to web 2 which includes interactivity, better page presentations, with the advent of web2 it supports user- generated content leading to its wide adoption and creation of social media websites,forums and the totality of the internet we know of today.

Web3 is the next evolution of the internet with emphasis on decentralisation.

As the world adopts web3, information shared will be decentralised, so what does mean anyway?

Decentralisation in this context means information on web3 are not being stored by a single central entity as the case is in web 2.

In web2, when a user visits a website, the user's information is saved on the website's server, this information is controlled by a central entity, the central entity can wake up one day, decides they don't like your face and delete your account off their website, there is little to nothing you can do in this instance.

In web3, the user has more control over their information,their information can not be changed or removed by a single person, it would take convincing 51% of stakeholders on the networkto do that, that's nearly impossible.

Let's compare web2 and web3

**WEB2**
1. Centralised - some John Doe controls the data

2. Authorization - you have to register, input your email, create a profile before you get authorized to do the basics of things 

3. Severs can go down - just imagine clicking on submit after filling a long online form,only for the server to be down 😭


**WEB3**

1. Decentralised - You have control of your data.
2. Permissionless - you don't need to be authorized by a governing body to do what you want to do.

3. Servers can't go down as web3 runs on a decentralised network with 1000s of computers as their backend.
 

This is just a summary of the difference between web2 and web3.

Web3 has enormous potentials and it is still evolving, it includes other things like the semantic Web, artificial intelligence/machine learning, and so much more.

I hope this article whets your appetite to go learn more about web3.





[Zuri Team](https://blockgames.gg/)

[Nestcoin](https://nestcoin.com/)

[Blockgames](https://blockgames.gg/)
What's New In DativeJs
Tags: javascript, tutorial, dativejs
Published: 2022-03-02 21:04:15


![dativejs logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0fw6rwk4gyz2qf3fmjsn.png)

## What's New in DativeJs


DativeJs has released a new version recently ``v2-alpha.1``

What does it bring 

DativeJs has added new feautures like
- animations
- helpers

Some global methods has been deprecated like 
- ``Dative.importstyle(href: string)`` use the normal ``<link>`` now
- ``Dative.use(plugin, ...opts)`` use ``app.use``


Some options has been deprecated,changed
- ``update`` has been deprecated
- ``mounted`` has been changed to ``onmounted``
- ``created`` has been changed to ``oncreated``


New Options has added

- ``animate`` for defining animations
- ``use`` for installing a plugin
- ``property`` for creating a local property 
- ``attach`` for attaching a Dative Component/Instance to another Dative Instance


New Global Methods added


- ``defineApp`` 
This is a shorter way of creating a dative instance. No Need For ``new`` keyword with the defineApp methods

```js
import { defineApp } from 'dativejs'


var app = defineApp({
   el: "#app" // or a css selector or a tag 
})
```


- ``defineProperty`` 
 It's used to create property in DativeJs see [defineProperty in DativeJs Docs](https://dativejs.js.org/guide/index.html#property)

```js
import { defineProperty } from 'dativejs'


defineProperty('foo',()=>{
  return 'bar' 
})
```

- ``extend`` 
 It's used to extend Dative Instance in DativeJs see [extend in DativeJs Docs](https://dativejs.js.org/guide/index.html#extend)

```js
import Dative from 'dativejs'


export let SideBar = Dative.extend({
   // same options with the dative option but no el options
})

// index.js

import { SideBar } from './sidebar.dative.js'


new SideBar({
   el: "#sidebar"
})
```

The new way of installing a plugin in Dative.Js is quiet more easy

[See Plugin In DativeJs Docs](https://dativejs.js.org/guide/index.html#plugin)






### [See Migration Path](https://dativejs.js.org/api/index.html)
All about my Outreachy journey  -- Wrap Up
Published: 2022-03-02 20:59:33

I still find it hard to believe that my Internship is almost over. It is really true that time flies when you are doing what you really love. 
The three past months have been a life changing experience for me. 

In this blog post I would talk about my experience, my growth path and my future plan to keep contributing to the open source community. 

## What was one fear I had about the internship that turned out to not come true

In the contribution phase, I had about seven projects I was interested in because they require Python and I was conversant with it. 

After going through each project on GitHub something stood out about the KCIDB project. It is core Python which I wanted, It is also centred around improving the Linux Kernel development lifecycle. I knew very little about linux system and a lot of things in the project so it was really scary deciding to work on the project. I made the decision to contribute knowing I will either succeed or fail. And if eventually I failed I will have lessons to reflect on. 
 
Taking a task at a time instead of thinking of it as being something vast and complicated, helped me focus on things I needed at the moment to complete my task which made my journey really smooth 

## How did my mentor help me along the way?

I really appreciate the support and time that my mentor gave me in spite of his schedule, he took out time to answer my questions and guide me through my journey.
Thank you Nikolai for all the support 
Thank you for making me see the end of this amazing program

## An amazing thing happened 
I am really glad that I got to work on another project within KernelCI. I worked on creating a pipeline service to send revision data to KCIDB. It was awesome as I got a deeper understanding of the KernelCI project.  


## Next Steps ?
I am so excited to continue this journey with my community. I look forward to building great stuff in the open source community. 

I would love to offer any assistance to future interns and ready to provide any guide to the KernelCI project. Feel free to reach me if you have any questions about Outreachy.

It is never a goodbye to the Linux Kernel Community, I plan to keep contributing to improve the Linux Kernel development lifecycle. I cannot wait to see KernelCI achieve its aim of  standardising hardware testing for the Linux kernel.
Video Tutorial CapRover
Published: 2022-03-02 19:58:13

[Get $100 credits free to test Digital Ocean Services](https://m.do.co/c/c3019c7d99fe)

See also the full post talking about caprover:
{% embed https://dev.to/alexandrefreire/the-best-free-alternative-to-heroku-f60 %}

GitHub
{% embed https://github.com/caprover/caprover %}
Var, Let and Const Explained
Tags: javascript, beginners, webdev, programming
Published: 2022-03-02 19:55:24

Do you know the differences between var let and const ? If not, this article is made for you.


### Var
Variables declared with var will be available in the parent scope unless it is declared inside a function.

```javascript
var age = 15;
function getFirstName() {
  var firstName = "John";
}
getFirstName();
console.log(age); // Logs 15
console.log(firstName); // Logs "firstName is not defined"
```

They can also be re-declared.

```javascript
var color = "Blue";
var color = "Red";
console.log(color); // Logs "Red"
```

### Let
You can declare a variable and initialize it later :

```javascript
let firstName;
console.log(firstName); // Returns "undefined"
firstName = "John"; // Returns "John"
```

But you can't re-declare it.

```javascript
let firstName = "John";
let firstName = "David";
console.log(firstName); // Logs "Identifier 'firstName' has 
already been declared"
```

And they can only be accessed inside their scope.

```javascript
function getFirstName() {
  if (true) {
    let firstName = "John";
    console.log( firstName); // Logs "John"
    firstName = "David"; 
    console.log( firstName); // Logs "David"
  }
  console.log( firstName); // Logs "firstName is not defined"
}
getFirstName();
```

### Const
Const variables can't be updated, nor re-declared.

```javascript
const firstName = "John";
firstName = "David";
console.log(firstName); // Returns "Assignment to constant variable"
const color = "Blue";
const color = "Red";
console.log(color); // Logs "Identifier 'color' has already been declared"
```
This means you have to initialize them when declared, and you can't use the same name twice either.

```javascript
const firstName;
console.log(firstName); // Logs "Missing initializer in const declaration"
```
Just like let, const is block scoped.

```javascript
function getFirstName() {
  if (true) {
    const firstName = "John";
    console.log( firstName); // Logs "John"
  }
  console.log( firstName); // Logs "firstName is not defined"
}
getFirstName();
```
⚠️ Even if the variable can't be reassigned, this doesn't mean the value is immutable. If the value is an object or an array you can still change its content.

```javascript
const array = []
array.push(1);
console.log(array); // Returns [1]
const object = { firstName: "Red" };
object.firstName = "Blue";
console.log(object); // Returns { firstName: 'Blue' }
```

---

Photo by Pankaj Patel on Unsplash
Swapping Variables
Tags: javascript, beginners, tutorial
Published: 2022-03-02 19:35:23

So I am taking a Udemy Web Developer course. I am currently learning JavaScript right now and came across an exercise problem that may have stumped a lot of people including myself. Which is **swapping variables**. The goal is to swap variables using three lines of code(or less) **without changing the code**,**cannot add numbers**, and **you can't redeclare the variables**. Here's the problem:
                     `let a = 3;
                      let b = 8;`
a should equal 8 and b should equal 3.
**Solution 1** Using an array:
`[a, b] = [b, a];`


**Solution 2** declaring a new variable:
`let c = a;
     a = b;
     b = c;`
Tabnine and GitLab Partner Up!
Tags: webdev, programming, productivity, news
Published: 2022-03-02 19:31:38

We are incredibly excited to announce Tabnine’s partnership with GitLab. This new integration will give millions of Tabnine and GitLab users the ability to easily create private custom AI models trained on code from their GitLab repositories, coding conventions, and best practices. 

All development teams using gitlab.com can now benefit from a personalized Tabnine AI assistant trained on their GitLab repositories. 

For Tabnine, this is another big step in integrating its core technology with leading dev tools such as GitLab. We are committed to the global developer community and engineering teams of all sizes and stacks, and as such see this is a natural step forward in accommodating our solutions to everyone, anywhere.

The Tabnine partnership builds on GitLab’s already strong foundation of developer-centric integrations. GitLab has a well-deserved reputation for providing everything professional development teams need to deliver cutting-edge code. 

With the Tabnine-GitLab integration, you can use your team’s code repositories hosted on GitLab to train a private AI model that code, and benefit from AI assistance that’s tailored to your team’s code patterns and best practices.

How to get started:

1. As a Tabnine for Teams user login to AI Code Completions for Developers & Teams | Tabnine 
2. Navigate to the “Team AI” tab
3. Connect to your GitLab repositories
4. Tabnine will build, test, and upload your private team model
5. Enjoy your personalized Tabnine AI assistant


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

Tabnine is thrilled to provide a GitLab integration experience for all of our current developers and we look forward to helping the millions of GitLab users experiencing Tabnine’s AI assistant for the first time.
Is your Favorite Programming Language making Climate Change worse?
Tags: programming, computerscience, performance
Published: 2022-03-02 19:17:07

{% embed https://youtu.be/cy7qZ47-jpE %}

In this video I take a closer look at the research paper: Rui Pereira et. al. "Energy efficiency Across Programming Languages: How do Energy, Time, and Memory Relate?" and try to answer the question which is the most energy-efficient programming language?
WewoChro.news
Tags: codepen
Published: 2022-03-02 19:16:14

{% codepen https://codepen.io/J2A2K4E/pen/podZqrP %}
I want to add the shapeshifter to my webpage and develop it as I build my newspaper. I have my Header, clock and Dateline down. Next I start collumns, but I want to put the shapeshifter at the top of the first collumn. I tried 
`<div id="collumns">
<div id="collumn">
<div id="demo">
<canvas class="canvas"></canvas>
</div>
</div>
</div>`
but it's not working. Can you help me?
Democratize Single Sign-On for B2B SaaS Vendors
Tags: saas, b2b, sso, security
Published: 2022-03-02 19:15:23


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

If you’re a SaaS vendor, you want to make it easy for your enterprise customers to log into the system and access services. However, the rise of Single Sign-On (SSO) has introduced a new challenge to this.

Over the last few years, SSO has become a mainstay of enterprise IT’s approach to user access to applications. SSO reduces password fatigue, while enabling IT to easily manage and track user access to sensitive information to support security and compliance requirements.

Today, your customers and potential customers are implementing SSO via an identity solution such as Microsoft Azure AD, Okta, Amazon or Google, and it’s no surprise they want to leverage these solutions to log into your SaaS application.

If you have already attempted to connect your SaaS application to an identity management solution, you know how costly and time-consuming it can be. Doing this for multiple platforms is time and cost prohibitive.

[Read more...](https://www.datawiza.com/blog/industry/no-code-solution-to-democratize-single-sign-on-for-b2b-saas-vendors/)
Web 2.0 vs Web 3
Tags: web3, blockchain, webdev
Published: 2022-03-02 19:11:33

Web 2.0 and Web3 refer to how the internet, tools, and applications are built. The difference between the two ideologies are:

**What is Web 2.0?**
Web 2.0 refers to a centralized internet. Centralized web applications provide avenues for users to generate content, connect but they have control over the application and its content. A typical example of a web 2.0 application is Youtube where the data and content are owned and controlled by Youtube.

**What is Web 3?**
Web 3 refers to an ideology that the internet and information should be open, decentralized and data belongs in the hands of its creators/users. This ideology is enabled by blockchain technologies like Ethereum because there is no central authority over the blockchain. 

**References**
- [Blockgames](https://blockgames.gg/)
- [Nestcoin](https://nestcoin.com/)
- [Zuri Team](https://zuri.team/)
Pm2 Node Process Manager
Tags: node, javascript, beginners, programming
Published: 2022-03-02 19:03:00

Good day, developers!

Today, we'll look at the node process manager, its visually appealing interface, and its basic syntax. 

pm2 *is a production process manager for Node.js applications with a built-in load balancer. It allows you to **keep applications alive forever**, to reload them without downtime and to facilitate common system admin tasks.* [resources](https://www.npmjs.com/package/pm2).

I love the <mark>keep applications alive forever</mark> part because 
![imag](https://media.giphy.com/media/3orif2UtmT5tvnnWes/giphy.gif)

Because of its visual depiction, I might prefer this to _Nodemon_.
Let me know what you think in the comments area. Now that we've gotten that out of the way, let's get down to business. 

I'll be utilizing a node qr project that Olubisi Idris authored. [link here](https://blog.idrisolubisi.com/how-to-integrate-qr-code-for-authentication-across-web-and-mobile-applications-in-nodejs).

---
## Setup

🌳 Install the pm2 package
`npm i -g pm2`

🌳 To start your node server run this command.

<kbd>pm2 start [entry file]</kbd>. In my case `pm2 start app.js`



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhfdrlllervbff983y08.PNG)
 
🌳 A quick check to know if our server is running

Run: `pm2 logs`
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p8kx4wimki6sowu7sl0k.PNG)

🌳 Stop the pm2
`pm2 stop     <app_name|namespace|id|'all'|json_conf>`

This means you can use either the app name, id or  all

<kbd> pm2 stop 0</kbd>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/70z9my2nwk39y6fl2kp2.PNG)

🌳 To restart
<kbd>pm2 restart 0 </kbd>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6hobll18wsu49aykcgv6.PNG)
 
🌳 To see full description of application
 `pm2 describe 0`

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

## Discuss.
Why will you choose this over other node application `starters`.

## Resources
* [pm2](https://www.npmjs.com/package/pm2)
Wireframes.
Tags: wireframing, webdev, beginners, uiweekly
Published: 2022-03-02 19:02:28

The wireframe is a blueprint that helps you design the structure of the application or website that you are trying to build. They are also known as wires, mockups or mocks. Wireframes play a crucial role in building the software as they give you a brief idea about the design and positioning of the components in an application.

Advantages of Wireframes - 

- Helps you understand data flow.
    
    It is beneficial to have wireframes of the software before starting development as they not only give you an idea about structuring the application but also help you understand the data flow.
    
- Helps you communicate your idea in a better way.
    
    It becomes easy for you to communicate your idea when you have a blueprint of what you want to design. While designing a wireframe you can adjust the position of the components which would otherwise be a tedious process after the code is written.
    
- Makes adjusting components easier.
    
    Wireframing saves a lot of time and adjustment work. Once the design is finalized, you can start working on the implementation of the software.
    

Things to remember while wireframing -

- Keep it simple - A wireframe is just a layout of how your application should look, it should not have any technical content or technical details in it.
- Simplified flow of application - The main goal of wireframing is to understand the data flow across the application, and to understand the hierarchy of components in it. Make sure that the flow of data is simple and understandable.
- Mobile-first designing - Design software that is responsive on any type of device. So when you start wireframing, start designing for the smallest screens first.

Here are some of my go-to wireframing resources!

- Paper and pencil
    - You can get a rough sketch of how you want your website to look. You can get a basic representation of your webpage in no time.
- [https://balsamiq.com/](https://balsamiq.com/)
    - Balsamiq is one of the most beginner-friendly websites to design your first wireframe. It has a great user interface which would help design your website quickly
    - It has a 30-day free trial followed by a monthly subscription
- [Figma.com](http://figma.com/) (Personal Favorite!)
    - Figma provides beginner-friendly tools to design wireframes.
    - It is easier to adjust colors and position of components, it gives you detailed instructions on how to get started.
    - Figma designs are widely used in the Design community to share each other’s work.
    - It has a free tier pricing feature that would help you design unlimited personal files.

Wireframing is one of the most important parts of the life cycle of a software application. A dedicated amount of time should be spent while designing a wireframe as it would ease the process of development.
Golang: version your module
Tags: go
Published: 2022-03-02 18:49:11

Quote the "Learning Golang" book:

> Go supports two ways for creating the different import paths:
> * Create a subdirectory within your module named vN, where N is the major ver‐ sion of your module. For example, if you are creating version 2 of your module, call this directory v2. Copy your code into this subdirectory, including the README and LICENSE files.
> * Create a branch in your version control system. You can either put the old code on the branch or the new code. Name the branch vN if you are putting the new code on the branch, or vN-1 if you are putting the old code there. For example, if you are creating version 2 of your module and want to put version 1 code on the branch, name the branch v1.

Say you have a repo at `gitlab.com/yourname/gomath`, now you want to create a version 2, if you choose the 2nd method from above, then you need to do:
1, At your current repo, create a branch named `v1` then commit it:
```bash
$ git checkout -b v1
$ git push --set-upstream origin v1
```
2, Switch back to your main branch, make the v2 change to your package
```bash
$ git checkout main
# make some v2 change
```
3, Change the "module" path, append v2 to it in the `go.mod` file:
```bash
# before
module gitlab.com/yourname/gomath
# change it to
module gitlab.com/yourname/gomath/v2
```
4, Commit the change and push it.

Now you are able to use the new version:
```bash
$ go get gitlab.com/yourname/gomath/v2
```