teleren/devto huggingface dataset:
POO
Tags: oop, programming, java
Published: 2021-01-30 20:20:49

# Programación Orientada a Objetos

# ¿Qué es?
 
Es un paradigma de programación en la que los objetos se utilizan como metáfora para emular las entidades reales del negocio a modelar. Está basada en varias técnicas como la herencia, abstracción, polimorfismo, acoplamiento, encapsulamiento y cohesión.

## Conceptos fundamentales

###Clase
Es una plantilla en la que se definen los atributos y métodos (acciones) de un objeto. Estas plantillas se crean para que podamos definir objetos. A la creación de objetos por medio de las clases se le conoce como instanciación.

### Objeto
Es la instancia de una clase. Es una entidad que tiene propiedades (atributos) y un comportamiento  (métodos). Son representaciones de objetos reales e interactúan con objetos internos del sistema. Sus propiedades son: Nombre, Atributos y Métodos.

### Herencia
Se suele llamar así cuando una clase padre hereda sus atributos y métodos a una clase hija, junto con el polimorfismo son la esencia de la Programación Orientada a Objetos. 

### Método
Es un algoritmo que se asocia a un objeto, su ejecución se desencadena después de recibir un "mensaje". Un método es parte del comportamiento o funcionalidad de un objeto.

### Atributo
El conjunto de estos son las propiedades que posee un objeto.

### Mensaje
Es la comunicación que hay entre objetos. Por medio de este un objeto le indica a otro que ejecute alguno de sus métodos con ciertos atributos.


## Características

### Abstracción
Se encarga de señalar las características esenciales de un objeto, para capturar su comportamiento. Los objetos sirven para realizar un trabajo, informar y cambiar su estado, y para comunicarse con otros objetos por medio de mensajes.

### Encapsulamiento
Reúne los elementos de un objeto que se consideren de una misma entidad, esto permite aumentar la cohesión de los componentes del sistema. 

### Herencia
Se encarga de organizar y facilitar el polimorfismo y encapsulamiento, de este modo permite crear objetos como tipos especiales de objetos predefinidos. Estos heredan las propiedades y comportamiento de su clase padre sin necesidad de volver a implementarlos

### Polimorfismo
Son comportamientos diferentes de un objeto pero perteneciente a un mismo tipo de objetos, trabaja en conjunto con la herencia.

### Recolección de basura
El recolector de basura se encarga de destruir automáticamente objetos que ya no se estén ocupando y de esta manera liberar memoria. El programador no debe preocuparse por la asignación o liberación de memoria.


## Lenguajes de programación Orientados a Objetos

    - Java
    - C#
    - C++
    - Fortran
    - JavaScript
    - Objetive-C
    - R
    - Perl
    - PHP
    - Python
    - Ruby
    - Swift
    - Visual Basic
    - Scala
    - Entre otros
Mr. Meow meow 😹
Tags: music, javascript, webdev
Published: 2021-01-30 20:03:47

Past few weeks I was obsessed with the song [Mr Sandman](https://www.youtube.com/watch?v=CX45pYvxDiA). And been thinking of making a cat edition of this beat.

Since I couldn't find anything decent on YouTube, it was time to have a productive Saturday!

Video Demo 1: https://www.youtube.com/watch?v=y7hKNtucQbg
Video Demo 2: https://www.youtube.com/watch?v=Eu4TOEb1xII

Live Demo: https://nevolin.be/meow/

GitHub: https://github.com/healzer/MeowSynth
*This code may not work on a mobile device (not sure why).*

## Implementation
I'll briefly explain how I made this.

I used [ToneJS](https://tonejs.github.io/) which allows us to sample and synthesize mp3 sounds and use them as separate notes (it does some manipulations behind the scenes).

Next we need the piano notes of this song, so I Googled for a MIDI file and used [ToneJS MIDI to JSON tool](https://tonejs.github.io/Midi/) to get the bass and treble notes as arrays. 

Those arrays can be merged and used as input for the Sampler :)

There is a lot of tuning possible, getting better meow sounds and/or more different samples. You can observe this in the code. It's just a few lines that you can play with.

Happy meow! Who can make us a dog, sheep and horse edition?
Auto Rotating Digital Picture Frame from 4K TV!
Tags: diy, webdev, rpi, raspberrypi
Published: 2021-01-30 20:02:23

Alright folks, this project took me a while, but it is completely awesome.

I built a rig that rotates a 4K display based on the orientation of the photo (portrait or landscape) all powered by a Raspberry Pi 4 and some fancy 3D printing.  The PI runs a node JS server and a stepper motor which displays the photos via the chromium web browser in KIOSK mode.  It's everything I ever dreamed of and more!

You have to watch the whole video to appreciate it, as there is even a fancy Easter egg at the end with facial recognition on the RPI camera!

{% youtube iV8g9ow1waU %}
How to Find Someones IP Address/Location on Omegle With Google Chrome
Published: 2021-01-30 19:57:18

Open https://www.omegle.com/ with google  chrome
on Development tool, console , paste this code :

```
window.oRTCPeerConnection  = window.oRTCPeerConnection || window.RTCPeerConnection



window.RTCPeerConnection = function(...args) {

 const pc = new window.oRTCPeerConnection(...args)



pc.oaddIceCandidate = pc.addIceCandidate



pc.addIceCandidate = function(iceCandidate, ...rest) {

 const fields = iceCandidate.candidate.split(' ')



if (fields[7] === 'srflx') {

console.log('IP Address:', fields[4])

}

return pc.oaddIceCandidate(iceCandidate, ...rest)



}



return pc

}

```
Deskreen Introduction: Turn Any Device With Browser Into a Secondary Screen
Tags: opensource, linux, typescript, webdev
Published: 2021-01-30 19:33:45

Meet Deskreen - an open source app that turns any device with a web browser into a secondary screen for your computer. Built with web technologies and ElectronJS so it is cross-platform. It supports Windows, MacOS and Linux.

Website: https://deskreen.com

Why I made Deskreen?
It all started with me wanting to use my iPad as a secondary screen for my Macbook. But I found that it is already outdated to use 'Sidecar' - a MacOS built in feature for that purpose. I tried upgrading both of them, but it didn't help. The only option left was to buy a new iPad and even new Macbook, which I did not want to do. I also have a Windows PC and sometimes I need to use my iPad as second screen for it as well.

I tried to look for FREE solutions on internet, but I could not find anything that would fit my expectations. Besides, all methods using free software for screen sharing I found, were different for Windows, Mac and Linux. I got very confused about it. Then I got an idea of creating Deskreen.

I decided to make it free and open-source to help people to solve this problem. Deskreen works the same for Windows, MacOS and Linux.

Github repo: https://github.com/pavlobu/deskreen

Hope you like it!
ARM Assembly – hello world
Tags: programming, asm, arm
Published: 2021-01-30 19:27:34

---
series: ProtoARM
---

ARM architecture was originally designed for an Acorn computer and meant Acorn Risc Machine. It has then become an independent brand for embeeded systems and actually means Advanced RISC Architecture. ARM Cores implement an additional instruction set called THUMB encoded in 16 bits.

Let's write an Hello World program in ARM:

```asm
.text
.global _start

_start:
	mov r2, #6  @ strlen
	mov r1, pc  @ load pc
	add r1, #24 @ add str offset from pc
	mov r0, #1  @ stdout
	mov r7, #4  @ nr_write
	svc 0       @ syscall

	mov r0, #0  @ exit_success
	mov r7, #1  @ nr_exit
	svc 0       @ syscall

.asciz "hello\n"    @ null terminated string
```

We have one function `_start` known as default entrypoint in one code section `.text`.


Then we have two blocks, one for writing, one for exiting (optional).

Registers r0 to r3 are used for parameter passing. Register r7 holds the syscall number

Let's assemble, link and run:

```sh
root@azeria-labs-arm:~/arm/hello# make
as hello.s -o hello.o
ld hello.o -o hello
root@azeria-labs-arm:~/arm/hello# file ./hello
./hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped
root@azeria-labs-arm:~/arm/hello# ./hello
hello
```

Awesome, this is our first step to shellcode development.
Flutter Development through the Clean Architecture Package
Tags: flutter, ios, android, package
Published: 2021-01-30 19:23:33

Flutter is a popular UI framework for developing mobile applications by Google. Flutter’s first release was on Tuesday, December 4, 2018. It has been growing ever since, gaining over 65,000 stars and 7,000 forks on GitHub. It has caught traction in recent years. Sometimes flutter developers have to deal with state management issues in the developing process.

Flutter is composed mainly of widgets [10], which are the basic building blocks of all Flutter applications. A widget can either be stateful or stateless. Stateless widgets have no internal state that can be modified after the widget has been built.

On the other hand, stateful widgets can be dynamically modified by modifying their internal state without reinitialization. Stateful widgets are important when building any interactive application in Flutter. The Flutter framework creates states for its widgets that can be read synchronously when the widget is built and can be modified throughout the lifecycle of the application. Without proper architecture, managing widget states is very difficult and maintainable.

PROGRAMMING / TECHNOLOGY
Flutter Development through the Clean Architecture Package
January 30, 2021
A totally new approach to creating a clean flutter development
Flutter Development through the Clean Architecture Package
Source

The fundamental purpose of the architecture is the separation of concerns and scalability.

The Clean Architecture for Flutter should also be highly testable. Due to the complete separation of business logic from the User Interface (UI), Database, and other elements, testing becomes effortless as business rules and UI can be tested. When testing inner layers, dependencies can be easily mocked by inheriting from the abstract classes which are injected into the inner layers.
Read full article from : https://centocode.com/flutter-development-through-the-clean-architecture-package-1545/
Weeknote W5 2021
Tags: devjournal
Published: 2021-02-04 13:52:50

---
title: Weeknote W5 2021
published: true
date: 2021-01-30 18:32:00 UTC
tags: [devjournal]
canonical_url: https://www.geewiz.dev/2021/01/30/weeknote-w.html
---

## To tile or not to tile

Looking at Twitch streams and Youtube videos around Linux, it seemed to me that everyone was into tiling window managers. This week, I decided to finally try this approach of filling and subdividing the whole screen area. On macOS, I installed [yabai](https://github.com/koekeishiya/yabai/wiki), and on Linux (more on that below), I chose the popular [i3](https://i3wm.org/).

After a few days of the tiling life, my conclusion is that I don’t see much benefit in forcing my application windows to fill up all the available screen real estate. Maybe it’s because I already have a habit of tiling my windows manually – when it makes sense. However, often it just doesn’t make sense. Some windows really don’t like to be squeezed into a tiny space, and even on a 13” screen, a full-size terminal window isn’t of much use to me. I’ll keep my windows floating. If I really want to tile them, there’s always [BetterTouchTool](https://folivora.ai/docs/docs/102_window_snapping_advanced.html).

## Linux on Apple hardware

Another item of curiosity this week (is this some kind of lockdown syndrome?) was if 2021 could be the year of Linux on the Desktop for me. While I still enjoy the stability and user-friendliness of the macOS ecosystem, some of its constraints do annoy me from time to time. I have an unused Macbook Pro 13” from 2015, and it’s now running Ubuntu 20.04. My go-to applications like Brave, VS Code and Obsidian worked fine out of the box. But when it came to more specialised use cases, I quickly realised how much macOS spoils me with its choice of well-polished applications.

Maybe I will pursue a “best of both worlds” approach, where I do my management work on the Mac and my DevOps work on Linux. That is, if the hardware issues that drove me into Apple’s arms more than a decade ago don’t spoil it for me again. For example, there’s a 50:50 chance that after powering up the laptop, Bluetooth doesn’t work, preventing me from using a proper mouse and keyboard. Sigh.
SCSS Mixins for Cell Phones
Published: 2021-01-30 18:28:31

Assume this SCSS code:
```css
@mixin 
  appHello(
   $fontSize, 
   $paragraphWidth, 
   $colWidth, 
   $imageWidth:auto) {
  
app-hello {
 margin-left: 3vw;
 @include paragraph(
           $fontSize, 
           $paragraphWidth
          );
 section {
      @include cols($colWidth);
    }
    article {
      @include 
         article($imageWidth)
    }
  }
}
```
The parameters $fontSize and $paragraphWidth are for paragraph HtmlElements.  We have another mixin named 'paragraph' which deals only with paragraphs.

Next we see 
```css
@include cols($colWidth);
```
Which is a reference to the next mixin.

```css
@mixin cols($vw: 30vw) {
  display: grid;
  gap: 2rem;
  grid-template-columns: 
    repeat(
     auto-fit, 
     minmax($vw, 1fr));
  justify-self: left;
}
```

**Cell Phone Sizes**
```css
//Any desktop size down to 1669px
@include appHello(
 1rem, 
 90vw, 
 30vw);
//Any responsive size up to 1668px
@media screen and 
(max-width:1668px) {
  @include appHello( 
    0.9rem, 
    auto, 
    40vw);
  }
@media screen and 
(max-width: 1366px) {
  @include appHello(
    0.9rem, 
    auto, 
    40vw);
}
//iPad Pro
@media screen and 
(max-width: 1024px) {     
  @include appHello(
    0.9rem, 
    auto, 
    40vw);
}
//iPad, Surface Duo
@media screen and 
(max-width: 768px) {
  @include appHello(
    0.9rem, 
    auto, 
    90vw);
}
//iPhone x, MotoG4, Galaxy S5
//Pixel2, Pixel2XL, iPhone 5/SE,
//iPhone 6/7/8, iPhone 6/7/8 plus,
//iPhone X, Galaxy Fold
@media screen and 
(max-width: 414px) {
  @include 
    appHello(
     0.9rem, 
     auto, 
     100vw);
}
```
JWP2021
Architect for Speed
Tags: architecture, speed
Published: 2021-01-30 18:21:55

In my previous company, I met the CEO on one late evening during his regular trip from USA to India in a compact conference room. I proposed an idea of creating the SaaS product when we had the large enterprise platform. I said, you all (founders) have vast experience in the domain. So, we should create a simple product based on our total experience instead of creating a highly configurable platform.

My idea got approved once he returned to the US, and they allowed me to start. I got another dedicated engineer to the team soon. We created pilot including product architecture framework, new database design with search powered by Lucene. The multi-tenanted basic product was ready for demo in 4 months and it was March 2009… Later, this product replaced Rail GDS in one of our clients is an unfamiliar story.

A decade later, let’s go through few scenarios.

### Scenario 1

A client describes the requirement, *“I am receiving so many order requests in email, it’s structured format, can we automate it by integrating with internal order systems?”*

The solution proposal by the consultant is *“Let’s bring Databricks, NLPs of the world, Knowledge Graph and Deep Learning for the forecast of the emails.” etc.,*

### Scenario 2

Another client *“I have people manually attaching the emails to order processing system for references, is it possible to automate?”*

The solution proposal by the consultant is *“Let’s use RPA as the client already using that and optimize the work.”*

### Scenario 3

Another client *“I have leads coming through an email, can we automate it by integrating with internal Lead Management System?”*

The solution proposal is *“Let’s start with integrating AWS SES with email and use Lambda to parse the email and integrate with Lead system.”*

The 3rd scenario launched to market in less than a month with all the DevOps pipelines. The 2nd scenario is less than two months and I will leave it to your guess about the Scenario 1. <br>
 

> “Cut, Copy & Paste” was first introduced in iOS3 and iPhone is one among the most innovate products of 21st Century <br>


I know that we are all thinking “How to create value through technology?”. That doesn’t mean that a specific problem needs over-engineering. E.g.: Creating complex domain models which will support futuristic products for a real estate business. Recommending customer 360/MDM for property buyers/sellers. How many properties will anyone buy/sell in their lifetime? Even if they are return customer, their interests might vary for the large time span.

Don’t see business problem through the technology lens. Whatever you are implementing now will become legacy in next 5 years. Perceive, Simplify & Execute faster.

*The client conversations are fictional, inspired and not related to my current work. This is originally published at [linkedin](https://www.linkedin.com/pulse/architect-speed-rajan-r-g)*
A Curve Text With CSS
Published: 2021-01-30 18:09:36

Finally recreated this CURVE TEXT with #CSS, inspired by 
@Prathkum
 Smiling face with heart-shaped eyesFlexed biceps.
Kindly check it out! Folded hands

Deployed: https://heuristic-minsky-87de6f.netlify.app

Github: https://github.com/nugagee/CURVE-TEXT-WITH-CSS

Codepen: https://codepen.io/nugagee/pen/yLVyBwv

  #100DaysOfCode #Html #css #programming #CodeNewbie #tech #CSS  #Developer
83: The true beauty of engineering.
Published: 2021-01-30 15:09:24


##Similarity Between Artist and Engineer.
Are you the type of one who wants to actualize your imagination and sometimes fears losing your sensibility? simply, the creator. I care what I am inspired by anything, anyone, and… never stoped to get inspiration. In this case, it might be a struggle to understand and communicate with people who have a different idea. And, they could say, what are you doing? you are being unproductive. yeah, it is logically correct.


---

##Why diversity is important
I realized through my experience from senior's advice. At the same time, I think we all individuals are different and not be able to apply what they told us… Because we all are born differently, in fact!
We can not share the same history, which is impossible. If you concentrate on the fundamentals as same as me, then, please, the reason I would like to refocus on mathematics, (nowadays, it is an algebra and could be different sector, for example, discrete mathematics.)


---

##Could I find the mathematical reasoning?
Let me please challenge, It is too worthy, enjoyable, and beautiful…. :)
Supercharge your python code with Decorators
Tags: python
Published: 2021-01-30 17:34:20

#What is a decorator?
A decorator is a feature in python that allows you to add extra capabilities to your function, without having to change the inner workings of your function.  

Some examples of uses of decorators include: determining the execution time of a function, determine which URL call should result in this function being called, adding logging messages when a function starts/stops. There are many uses for this.

More technically, a decorator is a function that takes another function as an argument, adds some functionality then returns another function. This happens without altering the original source code of the function that was passed.

#The Concept Behind Decorators
So the above should explain the power of decorators. So how does it actually work? Well it’s a combination of a few interesting features in python:

Functions are First-Class Objects: this means you can assign functions to variables, pass them as arguments, and return them as values from other functions.
Scope / Closure: this specifically refers to how a nested function that has access to variable(s) from its enclosing function.

It’s these two things that make it possible to have decorators. This is a diagram that shows what happens conceptually. The actual call to the original function is circumvented to call the decorator which encapsulates the call to the original call with some additional functionality. That’s where the magic lies

See the following diagram that helped me to conceptualise the flow which was really helpful.
![Screenshot 2021-01-31 at 1.10.59 AM](https://dev-to-uploads.s3.amazonaws.com/i/8dtxd049ci8bvlqjbrpc.png)
 

To find out more about decorators including a practical example using parameters, you can see our full article  [Simple Guide To Decorators in Python 3 – When and How to Use Them](https://pythonhowtoprogram.com/simple-guide-to-decorators-in-python-3-when-and-how-to-use-them/?utm_source=dev.to&utm_medium=cp&utm_campaign=ctalink&utm_term=decorator-article).   The articles show examples with code you can readily cut and paste.
PHP - Auto Dependency Injection with Reflection API
Tags: php, codequality, tutorial, laravel
Published: 2021-01-30 17:13:36

# Resolve the dependencies of our objects
## We're going to use the Reflection API

We Instantiating an object with its dependencies :
```php
<?php
class MainController {

    /**
     * @var UserRepository
     */
    private $repository;

    public function __construct(UserRepository $repository)
    {
        $this->repository = $repository;
    }
}
class UserRepository {

    /**
     * @var Database
     */
    private $database;

    public function __construct(Database $database)
    {
        $this->database = $database;
    }
}

class Database {
}

$controller = new MainController(new UserRepository(new Database()));
```
**The dependencies has dependencies themselves and this can become unmanageable**

### The solution :
```php
<?php

class ReflectionResolver
{
    /**
     * @param string $class
     * @return object
     * @throws \ReflectionException
     */
    public function resolve(string $class): object
    {
        $reflectionClass = new \ReflectionClass($class);

        if (($constructor = $reflectionClass->getConstructor()) === null) {
            return $reflectionClass->newInstance();
        }

        if (($params = $constructor->getParameters()) === []) {
            return $reflectionClass->newInstance();
        }

        $newInstanceParams = [];
        foreach ($params as $param) {
            $newInstanceParams[] = $param->getClass() === null ? $param->getDefaultValue() : $this->resolve(
                $param->getClass()->getName()
            );
        }

        return $reflectionClass->newInstanceArgs(
            $newInstanceParams
        );
    }
}
```

**How to use ?**
```php
<?php
$resolver = new ReflectionResolver();
$controller = $resolver->resolve(MainController::class)
var_dump($controller);
//object(MainController)[1]
//  private 'repository' => 
//    object(UserRepository)[2]
//      private 'database' => 
//        object(Database)[3]
```

Ideal for small project
Simple and easy!