teleren/devto huggingface dataset:
Why Do Frameworks Suck?
Tags: programming, webdev, php
Published: 2020-12-16 14:04:04

I believe the answer is bias.

Another way to frame the question would be: _Why doesn't the framework feel half as elegant and easy-to-use in the real world compared to the quickstart tutorial and example projects?_

We gotta take into account the framework developer(s)'s original intention when developing the framework. What problem were they trying to solve? All frameworks are built to solve a problem. A framework to solve a general class of problems? Now that's difficult. Very difficult. As difficult as making a class that's "general". Which is why people just make interfaces. I think.

I remember when I first tried PHP. I was a kid. It was magic. I didn't understand jack except that `echo "Hello world";` gives me some output in the browser. And that's all that really mattered. Then I understood it a little better, and had also begun to think about abstract ideas like modularity. That muddied the water. It's been a long time since I felt that magic when I was a kid.

Yes modularity is good, I mean who here likes to go through hundreds of lines of copy-pasted code amirite? But it's bad if the modular code was never designed to solve your problem. Modularity in high level languages usually come in the form of files, classes, namespaces, etc. and they work great. You take it a step further and you get frameworks. The difference is the modularity is no longer general. Facebook was built with PHP. There are many PHP frameworks for building websites, like Laravel. It's not impossible but you'll feel lesser pain building Facebook without a framework than with one. Probably. Please leave comments. Thanks.

Frameworks have a place. They're amazing if every dev using one knows exactly what it was built for and why. Otherwise it's a lot of reading the docs, logs, stackoverflow, and cursing the screen. The beauty about the design of computer languages and their strictness is that they guide you in how to build a program. __"NO YOU CAN'T PUT A STRING THERE please use a string type thanks."__ Frameworks try to emulate that, at a higher level, but imo usually fails spectacularly.

These are just my thoughts. I didn't think everything through. Woke up maybe 2h ago.
DO Hackathon: Phase 1 - The Idea
Tags: dohackathon, digitalocean
Published: 2020-12-16 14:02:15

---
title: DO Hackathon: Phase 1 - The Idea
published: true
description: Researching the platform and brainstorming ideas
tags: #dohackathon #digitalocean
series: "DigitalOcean Hackathon"
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/hu0o38jl7633n7sj4vqz.jpg
---
## The Rush

I jumped over to DEV and noticed there is a new Hackathon going. Suddenly I get the rush and start floating away with all kinds of ideas. Once I come back to earth I start reading the rules and the T&Cs, after all it is a contest.

## DigitalOcean

I jump over to DigitalOcean and start reading about the [App Platform](https://www.digitalocean.com/products/app-platform/) to determine what can be built, limitations, frameworks, etc. Seems straight forward at this point especially since they have all kinds of documentation, guides, videos and community support.

## The What

This is usually the tricky part, so many ideas to choose from, but as any dev knows we have constraints.

Before I can choose a framework I have to narrow down the WHAT. As usual, I have difficult time narrowing down the WHAT. So what do I do? I take about a day to mull over the ideas and I talk to my wife about it.

Usually what happens is my wife comes up with a great idea, but she doesn't know about the technical details or limitations. In my opinion, these are the best type ideas since they're unconstrained. This was no exception, she handed me an awesome idea! :tada: :tada:

### The Idea :arrow_right: An image memory app


#### See you on the next post!

---
<span>Photo by <a href="https://unsplash.com/@frederickjmedina?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Frederick Medina</a> on <a href="https://unsplash.com/s/photos/idea?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>
uniform_int_distribution in C++
Tags: cpp, oop
Published: 2020-12-16 14:00:40

Uniform_int_distribution is a class template. uniform _int_distribution or you can say random number distribution, produces an integer value by using the uniform discrete distribution which is this function:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9fll9oame7p8chetnva4.png)
This distribution produces random integers in a range of a and b [a, b]. In other words it returns a new random number that follows the parameters. Since it is a class template, we have to call its member function operator to produce a random value. uniform_int_distribution is used for generating random numbers within a range and the range is in between a and b.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/z5tkk4qvlyfm5q4mxynh.png)

Member functions

All the member functions given in the table are public member function.

 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/whsugyjung3ygf0txhda.png)

Distribution parameters

a -->	Lower range
b -->	Upper range
 

Return value

It returns a random integer value since it is generating a random number.

---
title: uniform_int_distribution in c++
tags: cpp, oop
canonical_url: https://kodlogs.com/blog/689/uniform_int_distribution-in-c
--- 

Examples
```
// uniform_int_distribution::operator()
#include <iostream>
#include <chrono>
#include <random>

int main()
{
  // construct a trivial random generator engine from a time-based seed:
  unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
  std::default_random_engine generator (seed);

  std::uniform_int_distribution<int> distribution(1,10);

  std::cout << "some random numbers between 1 and 10: ";
  for (int i=0; i<10; ++i)
    std::cout << distribution(generator) << " ";

  std::cout << std::endl;

  return 0;
}
``` 

Output
`
some random numbers between 1 and 10: 2 4 8 9 5 8 1 6 4 10
`
 
Second example
```
// uniform_int_distribution
#include <iostream>
#include <random>

int main()
{
  const int nrolls = 10000; // number of experiments
  const int nstars = 95;    // maximum number of stars to distribute

  std::default_random_engine generator;
  std::uniform_int_distribution<int> distribution(0,9);

  int p[10]={};

  for (int i=0; i<nrolls; ++i) {
    int number = distribution(generator);
    ++p[number];
  }

  std::cout << "uniform_int_distribution (0,9):" << std::endl;
  for (int i=0; i<10; ++i)
    std::cout << i << ": " << std::string(p[i]*nstars/nrolls,'*') << std::endl;

  return 0;
}
```
Output
`
uniform_int_distribution (0,9):
0: *********
1: *********
2: *********
3: *********
4: *********
5: *********
6: *********
7: *********
8: *********
9: *********
`
TOP VS CODE EXTENSION USED BY WEB DEVELOPER
Tags: vscode, html, css, webdev
Published: 2020-12-16 13:58:23

My VS Code Extension :


- Auto Rename Tag

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1608126575423/Hw4_i3sm1.png)



- JavaScript (ES6) code snippets


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1608126619913/NtDPphpcV.png)



- Live Server


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1608126652345/QJcDhNSML.png)


- Material Icon Theme

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1608126686324/wIOhKmizZ.png)



- Sublime Material Theme


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1608126734917/AF806bJjW.png)


Connect:

- 
Twitter

https://twitter.com/NewGenDeveloper
Memories #01
Tags: gamedev, csharp, beginners, codenewbie
Published: 2020-12-16 13:57:55

When organizing the old projects one thought came to my mind... Why do not put them on Github to share with everyone? So what's time to put my hands-on work, create a repository, a video, and upload all the files.

## The Beginning... is it?
**This project must be the first game-project done by me and developed for academic purposes in 2017**. 

### Curiosity
I think that everyone knows what is Github but if you don't basically Github is a place where people share projects and code (the named open-source).

### You want to check out?
If you want to check out the video or the code about the project here on the links below:
Youtube: [https://youtu.be/iodkJTezckY]
Twitter: [https://twitter.com/DavidCRicardo/status/1338923511209996288]

PS: The link for the code it's available on the descriptions. 
I could put it here but I am just testing some people.
Staying Fit Is Essential for Mental Health
Published: 2020-12-16 13:57:43

Due to COVID, I was forced to work remotely and what that means for a lot of people is, because they are working from home, they no longer have regular working hours and find it hard to close the laptop, go out and get some fresh air.

I was one of those people that had a hard time adjusting to remote work and my mental health was really suffering because I simply wouldn't go out and started getting regular migraines

What I realized was that when I had scheduled appointments I would have to finish work and run off to that appointment.

I had a regular personal trainer I would meet in the park and even though this was just once per week, you forget how much of an impact going from stationary to moving, inside to outside, and getting offline has on a person. It really does have such a huge impact on mental health.

Because of the impact that setting a regular training routine had on me, I recently started a free fitness app with a good friend of mine to try and solve the problem for others too. 

I encourage anyone who is working from home during the pandemic to focus on fitness every day and try and go outside regularly. It does wonderful things for the mind.
Extensions in Swift
Tags: basics, swift, beginners, apple
Published: 2020-12-16 13:56:05

# Brief Introduction About Swift

Swift is a language developed by Apple which is made using modern approach, include safety features and software design patterns. As the name suggests swift is fast, safe and easy to use. It is basically made a replacement for c-based family(C, C++ and Objective-C). It can be used to make apps and can be also used for cloud services and it is among the fastest growing languages.

# Extensions in Swift

**Extensions** add new functionality to an existing class, structure, enumeration, or protocol type. This includes the ability to extend types for which you do not have access to the original source code (known as retroactive modeling)”

Extensions in Swift can:

1. Add computed instance properties and computed type properties

2. Define instance methods and type methods

3. Provide new initializers

4. Define subscripts

5. Define and use new nested types

6. Make an existing type conform to a protocol

# Syntax for Extension

```swift

extension someType {
// functionality to add goes here
}
```
# Coding Example on Extensions

Let's say i want some inbuilt function for integers to increment and decrement by one. Let's make one

```swift

extension Int {
    func incrementByOne() -> Int  {
        return (self + 1)
    }
    func decrementByOne() -> Int {
        return (self - 1)
    }
}

let number : Int = 2
print(number.incrementByOne()) //3
print(number.decrementByOne()) //1
```

Here `self` refers to the value on which operation is done.

One more example to show you how you can use extensions in protocols

```swift
protocol Human {
    func walking()
    func sleeping()
}

class Men : Human {
    func walking() {
        print("Men is walking")
    }
    
    func sleeping() {
        print("Men is sleeping")
    }
    
}

extension Human {
    func eating(person : String) -> String {
        return ("\(person) is eating")
    }
}

let objMen = Men()
print(objMen.eating(person : "Men")) //Men is eating
```
Here as we can see that we didn't provide **eating** method in protocol but is still available for class conforming to that protocol.


Hope, it helps and if you would like to add to it. Comment Below.
🥷 Introducing Qui - A Vue.js Design System for Web
Tags: vue, javascript, css, design
Published: 2020-12-16 13:36:44

Hi, guys! We're ready to introduce Qui 🎉 - A Vue 2.x design system, we use for building great SPA apps for our customers!

Check [Storybook](https://qvant-lab.github.io/qui/) out!

What is it?

- 🔩 30+ Vue components
- 📦 icons pack
- 🏳️‍🌈 colors & grid
- 🥷 neumorphism styles
- 📚 storybook sandbox

[Qui](https://github.com/Qvant-lab/qui) is our first Open-source product, feel free to help and contribute!


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/r2v1iynesdhctu7h6lc7.jpg)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zk8j0ywcp9ob9mct5pvs.gif)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/o7f6oapf2kcufvl1rvcv.jpg)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/645uqy95hg757r21cjfx.gif)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7vv655m1rwddza0gz979.jpg)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/a28zoyoz2tmt3bjqzqx6.jpg)![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jjdlkmch6f4ow2v8h5de.jpg)
DO Hackathon - Middi - The Stack (Part 2)
Tags: dohackathon, react, node
Published: 2020-12-16 13:25:58

Now that we know what we're going to build from my [last post](https://dev.to/raucoustortoise/digitalocean-app-platform-hackathon-middi-1dh9), we can figure out how we're going to do it. This is the fun part where we can imagine all the cool tools we're going to use without actually having to dig into any documentation.

## The Frontend
One of our requirements is to make the user interface intuitive and fun to use. That means it needs to be responsive and fast. For this reason, I figured I'd be super original and go React - not sure if you've heard about it before.
I have past experience with React and know that I can get up and running quickly with create-react-app. 

I'm not a huge fan of CSS frameworks like Tailwind and prefer to build the UI from the ground up. For this reason, I chose SASS to handle styling.

At first glance there doesn't seem to be any need for a state management system at the scale of Redux, so I think we'll stick with React's useContext and useReducer to handle state management.


## The Backend
We already know we'll be using Digital Ocean's App Platform to host the application. For the API, I figured we'd keep things consistent end-to-end and use NodeJS and Express. 

Since we'll be serving a frontend, and also hosting an API we have two options: serve the frontend on a separate App Platform, or use the API to serve the React bundle.
I wanted to keep all the code in one repo to make it easier for one-click-deployments in the event anyone else wanted to try it out. For this reason I decided to use one server to both serve the bundle and host the API.

## The Database
Our requirements specify that a user should be able to sign up/log in and have their data persist between sessions. This means we'll need a database of some sorts. My intial thought was to use a MongoDB database because of how well it integrates with the rest of the stack we've discussed, but DO doesn't support Mongo in their database components for App Platform (although you can launch a Mongo droplet from the Marketplace). Instead, I decided to go with PostgreSQL. We can use Sequelize to create models and run migrations on our database from our backend.

Now that we've got a stack in mind, let's take a look at designing the user interface...
Tabnine vs Kite battle to the DEATH (video)
Published: 2020-12-16 13:21:43

In this video we compare two popular A.I autocompletion tools: Tabnine VS Kite in a battle to the death! Watch me as I test both tools side by side as they code in JavaScript.

Links in this video (via bitly so I can see the click through rate)
https://bit.ly/tabnine-tool
https://bit.ly/kite-tool

If you did like this video, please do Like and Subscribe so I know to keep creating awesome content for you!

{% youtube 10cO9UNsA3Y %}

Twitter: https://twitter.com/ania_kubow
YouTube: https://youtube.com/aniakubow
Instagram: https://instagram.com/aniakubow

#kite #tabnine #autocompletion
When YOU make Static Site (with SSG), what additional APIs do YOU eventually have to use and how? (third-party or self-made)
Tags: discuss, webdev, ssg, ssr
Published: 2020-12-16 13:11:05

So, static site generators are lies. I always at least crave for comment-engine and search-engine.

- My comment-engine is third party.
- My search-engine is a serverless function.
- It would be nice to have an Email and Subscribe function. Maybe I have to go to third-party, again???

So, I reach a conclusion - SSR might still a better way; but I am not ready for a full-blown HEADFUL CMS, yet.

## I have a question

If the API is self-made, and not on the same platform as the main thing. How do you manage the connection, and the security?
How Content Marketing Can Help You Achieve Your Business Goals?
Published: 2020-12-16 13:05:16

In today’s time where every other company is opting for digital marketing services if you are still stuck at your old strategies and methods of creating content and blogs; you are probably lacking behind your competitors. Getting new potential customers and not losing the old ones is the biggest challenge and if your content is premium and authentic you’ll surely win the game. Get in touch with a leading content marketing agency like Avenir digital stories an agency that has topped the list of 5 most prominent <a href="https://www.digitalstories.co.in/content-marketing">content marketing agency in Delhi</a>. 

The most common and important objectives of the best digital marketing agency are: 
-	To build a massive brand awareness
-	To generate qualified and loyal leads
-	To increase engagement and retention
-	To build a good rapport with the customers
-	To boost your sales

You must have heard that Content is the king and indeed it is the king. The type of content you get with Avenir Digital Stories and their services is undoubtedly effective and authentic. The best digital marketing agency in Delhi follows a few rules that help you in boosting your business and some of those are:

1: Know your customers: 

A great digital marketing agency in Delhi would invest some crucial hours to identify and study your customers in order to create targeted content for them. Your content must target and hit your potential customers at the right spot.  

2: Relevancy and versatility: 

In the fit of earning more customers, people start posting irrelevant and dull content but with Avenir digital stories you will get the type of content that is absolutely versatile and relevant to the readers, as no one likes repetitive or boring content, 

3: Identity formation:
 
By delivering the right content you can instantly earn a good and impressive identity in the eyes of readers and audience. You mustn’t miss the chance of building a great identity on your audience, get in touch with the best digital marketing agency in Delhi today. 


Apart from these certain objectives and strategies the leading digital marketing agency in Delhi, Avenir digital stories follow the marketing tactics on social media as well that helps you in growing your reach and generate potential sales to your brand. have you hired a digital marketing agency to strategize your content yet?

https://www.digitalstories.co.in/content-marketing
Daily Developer Jokes - Wednesday, Dec 16, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-12-16 13:00:27

---
title: "Daily Developer Jokes - Wednesday, Dec 16, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Wednesday%2C%20Dec%2016%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258a3e5534.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ Why did the developer ground their kid?

___A:___ They weren't telling the truthy
 -->
Understanding CSS Units
Tags: css, 100daysofcode
Published: 2020-12-16 13:00:00

As a coding newbie, my first encounter with CSS units was not very pleasant. There are enough of them to confuse someone who has just started their coding journey. So, if you are using `rem` all the time because you are clueless about what `em`,`vh`,`vw` and others are, here's an explainer for you.

CSS units can be divided into two types -  Absolute Units and Relative Units


**Absolute units**: These are straight forward units with fixed size. One centimetre is one centimetre irrespective of the size of the screen. Hence, these are suitable for environment where output screen size is fixed and known. Given below are the absolute units we can use in CSS-
>
* `px`: One device pixel of the display
* `mm`: One millimetre
* `cm`: One centimetre
* `in`: One inch
* `pt`: One point (which is 1/72 of an inch).
* `pc`: One pica (which is 12 points).





**Relative Units**: As the name suggests, these are relative to something, say, font-size. This ensures the scalability of the webpage across screen-sizes. Given below are the relative units in CSS- 

* `rem` and `em`: These units are relative to the font sizes. `rem` corresponds to the font-size of root element and `em` corresponds to the font size of parent element.
```
div {
font-size: 10px;
}
div h2 {
font-size: 3em;
}
```
Here `font-size` of h2 will be 30px
```
body {
font-size: 10px;
}
div h2 {
font-size: 2rem;
}
```
Here `font-size` of h2 will be 20px 

* `vh` and `vw`: While making a design responsive, percentage isn't the best solution all the time and this is where `vh` and `vw` come to our rescue. `vh` equals 1/100 of the height of the viewport (visible area of a web page). So, if the viewport height is 500px, 1vh equals 5px. Thus, unlike percentage, `vh` `vw` allow sizing based on viewport size. 
```
div {
height: 100vh;
}
```
_This will fill the entire height of the viewport._
Similarly, `vw` corresponds to width of the viewport i.e. if the viewport width is 700px, 1vw equals 7px.

* `vmin` and `vmax`: These units correspond to minimum and maximum values of `vh` and `vw`. 
Eg. Let's say, the viewport has a height of 900px and width of 500px. Here, `vmin` will be 5px and `vmax` will be 9px. Thus, `vmin` is related to minimum of viewport's height and width and `vmax` is related to maximum of viewport's height and width.

* `ex` and `ch`: To understand these units, think of rem/em and add `font-family` to the relation. These units consider the `font-family` as they rely on dimensions of different fonts. `ch` corresponds to width of character 0 in the particular font. `ex` is defined by height of lower case x in the given font, which for many fonts is equal to 0.5em.



As we can see, the absolute units (`cm`, `mm`, `in`, `pt` and `pc`) will have fixed size irrespective of the output environment. Since screen sizes vary too much, these units are not recommended. For this reason, the relative units are best suited for the web developers.