teleren/devto huggingface dataset:
Abstract Factory with builder
Tags: designpatterns, php, abstractfactory, builder
Published: 2020-12-05 22:18:07

Hello, i have a design patterns test, in that test i have to do abstract factory with builder in one program, i am confused because builder and abstract factory are so similar, we can choose bettwen them but i can't see where we can combine them
can someone tell me if i did anything wrong here in this code?

<?php


interface YoutubeFactory{
    public function createVideoLibrary();
    public function createMuiscLibrary();
}

class YoutubeFactoryForAdults implements YoutubeFactory {
    public function createVideoLibrary(){
        return new AdultVideoLibrary();
    }
     public function createMuiscLibrary(){
        return new AdultMusicLibrary();
    }
}

class YoutubeFactoryForChildren implements YoutubeFactory {
     public function createVideoLibrary(){
        return new ChiledVideoLibrary();
    }
     public function createMuiscLibrary(){
        return new ChiledMusicLibrary();
    }
}
interface ILibrary {
    public function render();
}
class AdultVideoLibrary implements ILibrary {
    public $link;
    public $author;
    public function render(){
        return 'render adult video';
    }
}
class AdultMusicLibrary implements ILibrary {
    public $link;
    public $author;
    
    public function render(){
        return 'render adult music';
    }
}


class ChiledVideoLibrary implements ILibrary {
    public $link;
    public $author;
    
    public function render(){
        return 'render chiled video';
    }
}
class ChiledMusicLibrary implements ILibrary {
       public $link;
       public $author;
    
    public function render(){
        return 'render chiled music';
    }
}



    //
    class YouTubeFactoryBuilder{
        public $factory;
        
        public function __construct($visitorAge){
            if($visitorAge>=18){
                $this->factory= new YoutubeFactoryForAdults();   
            }else{
                $this->factory= new YoutubeFactoryForChildren();   
            }
        }
        
        public function createNewFactory($factory_object){
             $this->factory = $factory_object;
            
        }
        
        public function getFactory(){
            return $this->factory;
        }
    }

///client code
    
    $bulder = new YouTubeFactoryBuilder(rand(0,100));
    $factory= $bulder->getFactory();
    $videoLibrary = $factory->createVideoLibrary();
    $musicLibrary = $factory->createMuiscLibrary();
    
     echo $videoLibrary->render()."\n";
     echo $musicLibrary->render();
How to organize flutter apps in android studio
Published: 2020-12-05 22:09:18

Hi amazing devs. i recently started learning Flutter in andorid studio. while learning i would like to have all my apps sit next to each other in left pane of andoid studio so i can open various apps and examine code without opening and closing projects. also it makes it easy to commit all my learning code in a single github repo. something like below which i did when learning java apps in android studio
https://github.com/maviharjit/AndroidCourse
in this case i had one project and every app was a new module. it worked beautifully for me

however, i can't seem to do the same with Flutter. The challenge that i am facing with flutter is that each app or module or package opens in its own "space" and hence i can only visually examine the code of a single app. i want to be able to see like 10-15 flutter app at the same time in the left pane of android studio. how can i do that? (hope my articulation makes sense)

Thanks in advance
¿Cuál es el papel de la informática en el desarrollo del sistema de salud en mi país?
Tags: discuss, spanish
Published: 2020-12-05 21:47:05

Nací y llevo los 26 años de mi vida como residente de un lindo país llamado Colombia, muchas personas han escuchado hablar del país por ser el segundo más biodiverso del mundo o tal vez por tener uno de los cafés más reconocidos, sin embargo, la mayoría han escuchado de nosotros por problemas de desigualdad, corrupción y violencia.

Una de las consecuencias que tiene esta realidad es el mal servicio que se prestan en las entidades de salud, se pueden ver demoras en tratamientos de hasta 9 meses, se pueden ver negaciones en procedimientos que solo son materializados después de resolverse en tribunales a través de tutelas, pero uno de los peores y que a la mayoría de los ciudadanos han padecido, aunque no presenten enfermedades crónicas es las largas esperas en las salas de urgencias.

Se estima que la mayoría de las salas de urgencias del país muestran una espera promedio entre 6 a 9 horas cuando los casos no se clasifican dentro del triage en las etapas I y II, y hay varias razones por las cuales se da este fenómeno, procedimientos poco claros, falta de estudio sobre los patrones de llegada de las urgencias y falta de comunicación entre los hospitales de las zonas.

Pienso que con la tecnología llegaremos a mejorar cada uno de estos problemas de fondo, ¿Cuán distinto seria si se estudiaran los patrones de cada hospital y se designaran turnos del personal y recursos dependiendo de esos patrones?, ¿Cuánto más efectivo seria que el personal no debiera gastar tiempo valioso manejando las programaciones de los exámenes y la gestión de las salidas, sino que fueran procesos automáticos? ¿Cuan distinto no seria todo si como paciente, pudieses ver la ocupación de las distintas salas y tomar la decisión de ir a la menos congestionada? ¿Cuánto más cómodo seria para el paciente saber en cuanto tiempo será atendido y por quién?

Llevo un semestre estudiando una maestria en ciencias de la información y durante el desarrollo de este semestre me he dado cuenta como todas estas son posibilidades que gracias a la informática tenemos, gracias a herramientas como la inteligencia de negocios, el BPM y la inteligencia artificial, podríamos tener una atención de urgencias de calidad, donde los recursos estuvieran bien utilizados y un modelo de completa transparencia buscando la excelencia en el cuidado.
TCL-13 Recap
Tags: collablab, webdev, juniordevelopers, earlycareerdevelopers
Published: 2020-12-05 21:35:19

---
title: TCL-13 Recap
published: true
description: 
tags: #collablab #webdev #juniordevelopers #earlycareerdevelopers
---
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/srs0q5z4gqghjs0blxpe.png)

The latest cohort at Collab Lab wrapped up this week. We ran four teams concurrently for the first time and I had privilege of mentoring TCL-13 along with [Indira Gutierrez](https://twitter.com/Indiragp_Dev), [Eddie Solar](https://twitter.com/esolar07) and [Andrew Hedges](https://dev.to/segdeha). TCL-13 consisted of [Audra Turuta](https://dev.to/gnarlyquinn22), [Rebecca Bompiani](https://twitter.com/sketchy_becs), [Shayne Sebro](https://twitter.com/Ihadurcaa), and [Rachel Fischoff](https://twitter.com/rachelfischoff).  Over the span of 8 weeks our developers worked together to create a [Smart Shopping List](https://tcl-13-smart-shopping-list.netlify.app/) that predicts when you'll need to purchase items again using React, Firebase & Netlify. 

From day one this group was sassy, supportive and cohesive. By our second weekly meeting it felt as though they had been working together as a group for much longer. They had a great cadence, scheduling pair programming and getting pull requests in early enough in the week for both peer and mentor reviews to take place. They scheduled extra meetings in addition to our weekly meeting when they had group decisions to make like choosing a design and a CSS framework. They were excellent at taking feedback about their project structure and implementing changes to make their coding experience in the future easier.

In addition to their programming skills, all of our participants brought their individual personalities and skills. Audra brought a great energy to the group. She was enthusiastic and created a space cohesive to collaboration. She is also skilled at taking a topic and breaking it down for explanation. Rachel put herself out there early in the project by giving a public [lightning talk](https://youtu.be/Xul4dWFMZm0?t=171) on caching. She asked great questions about different aspects of the project should or shouldn't be implemented in a certain way causing the team to do some great research before making decisions. Shayne gifted the group with his design skills and created beautiful design docs for the team to follow during the design portion of the project (shown below). He was positive, patient and thoughtful with his comments and questions. Rebecca dove into the documentation for each new library or framework the group used on the project and explained new concepts and ideas to the team. 

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

Each week the mentors were newly impressed as the team embodied the purpose of Collab Lab by improving their programming and collaboration skills. It is our humble opinion that you should hire them ASAP.
What is the Best Programming Language to Learn in 2021
Tags: programming, javascript, codenewbie
Published: 2020-12-05 21:27:37

Since starting my self-learning journey I have always asked and wondered what is the best programming language to learn or which should I start with. Many people wonder and ask which one guarantees a job. Which will get them into Google or any of the FAANG companies. 

I do not have a computer science degree so I did not know what programming was I just assumed I learned a programming language and I would be a programmer. But oh boy was I wrong. 

Programming languages are nothing but a tool. A programming language is to a programmer what a hammer is to a construction worker or a good knife is to a chef. Something that I have learned from other programmers that I follow, articles and books is that in order to be a good programmer one must be a problem solver. 

You do not need to know a specific programming language to be a great programmer. You need to know what programming language to use and when to use them depending on the problem that you have. 

We always hear programmers, developers, software engineers talk about bugs; and what are bugs? They are problems that they encounter in their code, their software, etc.  Knowing what language, framework, library to use to fix the bug is what people hire you to do. 

When you are working with a client and they ask for a website. They need a website for a reason. Maybe they are not getting enough clients, they are not making enough sales. These are problems that they have. As a programmer you need to think: “How can I fix these problems?” Once you know how to fix the problem and the steps you need to take (pseudo code) you can choose a programming language or framework that will help you fix the problem. 

### But where do you start? 

If you are interested in programming or coding in general I suggest you think about what type of problems you want to fix. Do you want to help people gain more clients by creating websites? Do you want to fix a problem in your community with a mobile app?  Do you like data and structure? There are many career paths within tech. 

Make a list of all the things you like doing or that you liked doing when you were younger. Look for similar roles within the tech industry then look up which programming language is typically used within that specific role. You will then have a starting point. The more you learn and progress the more you will discover and add to your “Need to learn” list.  

One last point to keep in mind is that a programmer is a life-long learner. You will always be learning new skills and tech stacks. Once you learn your 1st language, and get over that hurdle the rest will not be such a struggle. 

This post is episode 2 of my #SelfTaughtSaturday Series where I will be posting tips, tricks, resources, anything and everything that can hopefully help anyone out there interested in self-learning to code. 

If you are even a bit intrigued and are interested in learning to code [lets connect!](https://www.instagram.com/brendamichellle/) I would love to help in any way I can.

Photo by Windows on Unsplash
Functions - What are they?
Tags: javascript, beginners, webdev, codenewbie
Published: 2020-12-05 21:23:02

# What are Functions?

Functions are those building blocks of a programme which help you do repetitive work. They help save time. They reduce the amount of code. They help save our energy and they might increase the efficiency of our programme. 

# How do we declare a function?

There are different ways to declare a function. For e.g. -

1. Regular Binding -  `const square = function(x) {
     return x*x;
   };`

2. Declaration Notation - `function square(x) {return x*x; };`

3. Arrow Function - `const square = (x) => {return x*x; };`

We use one of the above ways according to our comfort and type of a programme.

# What is Call Stack?

Suppose you declared a function and then have to call back later in a programme. After getting a value from it we want to execute our code after the point where we called the function. For that we need to store the point where we called the code in a memory, this is our call stack. It's duty is to remember where in our programme we call a function. It should never fill whole of our memory otherwise it will stop the programme and ask to clear the memory or as it is called in the programme 'blow the stack'.

# What is Recursion?

A function that calls itself is called a recursive function. It is okay for a function to call itself as long as it is not overflowing the stack. It allows us to write a function in a different style.

It could be easy for a reader to understand the code written in a recursive format. But it might not always be the case when we talk about code efficiency. As many a times a function written in a loop might be more efficient than a function written in a recursive format. 

So it totally depends on the need of the programme whether to write a function in a normal format or a recursive format.


# Conclusion

This was the basics of function and we can see that functions are there to make the life of a programmer easy and to help reduce the time and workload of a programme and a programmer.
It is the building blocks of a programmer. Just like cells are a building blocks of lives to a tissue.

This is a blogging challenge from [#teamtanayejschallenge](https://ejs-challenge.netlify.app)

You can visit the website at: https://ejs-challenge.netlify.app
How We're Supporting Small Businesses
Tags: showdev, webdev, gatsby, news
Published: 2020-12-05 21:20:35

I've put together a website that lists small businesses you can shop from this holiday for all your gifts - not to mention, each order really makes a difference. Supporting small businesses means supporting the the individuals and teams that put their whole heart into their craft.

On this site, you can also submit your own small business to be included. For my devs, you can submit a PR directly to the GitHub repo. If you have a small business or want to support your favorite smalls businesses, share them [here](https://shop-small-businesses.netlify.app/)!
Hello World!
Tags: teklaapi
Published: 2020-12-05 20:51:19

Hello World!

This is a basic example of a Tekla Structures macro that displays a message box saying "Hello World!".

For a breakdown, refer to https://buff.ly/36HsHvi

![Hello World!](https://dev-to-uploads.s3.amazonaws.com/i/23c0plxn24lccbry4t78.png)
SQL Injection
Tags: datascience, sql, security
Published: 2020-12-05 20:17:17

<!--Introduction-->
SQL is an extremely useful language for anyone who want to work with data structures. Its simple formatting allows those with little coding experience to understand the simple syntax, while it's versatility allows experts to create complex programs. 

Unfortunately for introductory programmers, using SQL to connect your front end to your database leaves you vulnerable to certain malicious attacks. Hooking up a form on your web page that can be filled out to complete an SQL statement may be the simplest way to let users interact with your database, but it also the least secure. Below are some common SQL injections attacks and how you can defend your site from them.

<!--Attack 1-->
## Free Passwords!
One common SQL attack is a work around user security. If you throw user input in as a string to complete an SQL statement, it's like giving the user a blank check and hoping they follow rules. While, setting up a password entry might seem like a simple way to keep out unwanted agents, adding any true statement such as "OR 1=1" can bypass an improperly structured comparison statement. 

<!--Attack 2-->
## Slippery Tables
Similar to the previous attack, if you throw user input directly into an SQL, problems will ensue. For visualization purposes, imagine you write an SQL statement, but leave the last word for the user to finish: SELECT * FROM $input;. A particularly savvy individual might realize, there's nothing stopping them from adding another statement at the end of your line: SELECT * FROM (tableA; DROP TABLE tableB);.

<!--Attack 3 -->
## URL Form
Another problem with HTML forms is that the sent form, carries its information through it's URL. This allows users to what's being sent through the form and even manipulate that data, so if you're using that form to send information other than what the user should be able to change, you might come across some problems. For a quick example of this injection attack, check out the video below.

{% youtube cMJTvrKTFuY%}
There's More to it than Meets the Eye
Tags: psychology, quarantine, habits, motivation
Published: 2020-12-05 20:07:16

Picture this scene — four rotating chairs set up in a single row, all in front of a single long mirror. The attached dresser table, of the same length, is laden with an assortment of clippers with individual hairs all over them, dryers, bottles of powder in bright hues of green and pink, and frayed brushes that have seen better days.

We are in none other than Odyssey Salon in Mandaveli, the workplace of Sam, a strapping young twenty-four-year-old lad, and also an immigrant from a small village near Gangtok, Sikkim.

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

For the average Indian, the friendly neighborhood barber also doubles as a psychiatrist. We pour our hearts out to the barber, never mind the lack of privacy. It’s a classic two-for-one deal. While Covid-19 has multiplied conversations on digital platforms, it has also curbed face-to-face talk. And one of the people now silenced by the pandemic is the barber, as neither he nor his customer wants to risk infection through droplets that may escape the ever-so-present mask. And that’s a great loss for anyone interested in illuminating lectures from the professor emeritus at the University of Life on everything from politics and pandemics to the weather and whatnot.

Due to a lack of opportunities for work in Sam’s hometown, he was forced to move all the way down south to Chennai, where one of his uncles helped him find employment at the salon. Holding down his customer’s head as he prepares to trim the back of his head — a middle-aged man with a lush mop of hair — Sam carefully starts running the trimmer along the back as he talks to me. As he recounts to me the experiences he has had with customers, he says some people are positively saint-like, the people who think about others, that is. On the other hand, there are also those that turn out to be some of the rudest people he’s ever met. “Maybe they’re unhappy with something in their personal lives and decide to take it out on me. Most people who come here are friendly, but some are very fussy.”

![](https://miro.medium.com/max/700/1*cAG0iiEwHJ6cR7EI1KjLKQ.png)

“I manage to earn about Rs 10,000 a month. Apart from the Rs 2,500 rent, I have to send a large chunk of it to my parents who live back in the village,” he says. “Apart from the not-so-great pay, I quite enjoy this line of work, not because of the work I do, but because of the conversations that I get to have. You never know who’s going to occupy the chair in front of you next — every day brings a new surprise, a new experience.” When asked about future plans, he replies — “I plan on staying here for another 2–3 years, after which it’d be time for me to move back to my hometown — after all, there’s nothing like home, is there?”

~~ Written for Aspire India, as part of a series exploring the lives of blue-collar workers. Check out Aspire and the work they do on [LinkedIn](https://www.linkedin.com/company/31034745) and [Instagram](https://www.instagram.com/aspireindia.official/).
Functions in JS
Tags: teamtanayejschallenge, javascript, eloquentjs
Published: 2020-12-05 19:45:13

A function definition is a regular binding where the value of the binding is a function.For example,

`const square = function(x) {
return x * x;
};`

* Each function will have both a definition and declaration.
   * Declaration is basically you simply telling JS to make a particular function, and witholding the info on how the function will process your arguments.

`function declare();`

   * Definition on the other hand, will tell JS exactly what your function will do with the input arguments.

`function declare(){
     console.log("Hi, I am Param");
}`

* __Scope__ : Each variable will have a scope, usually global or local. 
     * Global scope indicates that the variable can be used by any function or block of code in our program. 
     * Local scope means that the variable is valid only within our code block, for example, inside a function. No code segment outside our function(_in the above example_) will be able to access a local variable.
     * Note : Nesting of functions is possible, i.e., you can declare functions within functions, code blocks within other code blocks. This means that we can have a lot of local variables and global variable pairs too.

####The arrow notation : 
   * Quoting from EloquentJS, _"There’s a notation for functions, which looks very different from the others. Instead of the function keyword, it uses an arrow (=>) ."_
   * Its syntax goes like : 
     
      `const power = (base, exponent) => {
          let result = 1;
          for (let count = 0; count < exponent; count++) {
             result *= base;
          }
          return result;
          };`

    * The arrow comes after all the function arguments, and is followed by the normal function body, as in the usual syntax that we have seen above.


####Optional arguments
* A function can be given additional arguments, in the sense you can provide 3 arguments to it, when it has only one argument. This is perfectly fine, and JS will ignore you and do your work.
* Also, you can make define a function as 

`const bio = (name, age = 25) =>{ //age is an optional argument
    console.log("Name :" + name + " Age :" + age);
}
//call 1
bio("param");
//call 2
bio("param",19);
//output 1 : Name :param Age : 25
//output 2 : Name :param Age : 19`

    In the above function, both calls are perfectly valid. 

####Recursion
As stated above, you can have functions calling other functions, and even itself within the function. This way of calling a function within itself is known as recursion.

For recursion, the function will have 2 main things : 
    * A base condition, on which it will exit the recursive call
    * The call to function itself
    * Optional : Any other logic/programming, if required


`function power(base, exponent) {
if (exponent == 0) {
return 1;
} else {
return base * power(base, exponent - 1);
}
}
console.log(power(2, 3));
// → 8`


#####Review
I would love your feedback on this guys, and feel free to revert back to me with any recommendations that you have for me. You can also mail me at __padb19122000@gmail.com__ .
Mac backup taking long to backup. MB to GB, getting slow on MB before even getting to 1 GB
Tags: macbook, apple, ssd, help
Published: 2020-12-05 19:41:11

I have a LaCie that I have a MacBook backed up to, then I used it with my MBP 16in, it backed up once fine.... but now it’s taking longer to get past one 1gb then the time it is to charge from 50%, what causes it to get slow?