teleren/devto huggingface dataset:
The Order doesn't matter anymore
Tags: ruby, rails
Published: 2020-11-18 14:34:06

Have you ever been in a situation where you have to remember the order of the parameter while initializing an object? This a dependency, that can be easily overcome by using a hash. Enough talk, let's see the code
```
Before
  
class Employee

  def initialize(name, age, gender, department)
    @name = name
    @age =  age
    @gender = gender
    @department = department
  end
  
end
  
employee = Employee.new('Mat', 50, 'M', 'Dev')
=> #<Employee:0x00007fa700803d20 @name="Mat", @age=50, @gender="M", @department="Dev">


After
  
class Employee
  
  def initialize(args)
    @name = args[:name]
    @age =  args[:age]
    @gender = args[:gender]
    @department = args[:department]
  end
  
end
  	
employee = Employee.new(age: 50, department: 'Dev',name: 'Mat', gender: 'M')
=> #<Employee:0x00007fa6fc8ab060 @name="Mat", @age=50, @gender="M", @department="Dev">
  
      
```
As you can see above the order doesn't matter anymore. You don't to remember parameter order to create an employee object. What if while initializing an object you have to set a default value. For this it's better to use ruby's in build method called fetch for hash

```
class Employee
  
  def initialize(args)
    @name = args.fetch(:name)
    @age =  args.fetch(:age)
    @gender = args.fetch(:gender)
    @department = args.fetch(:department, "dev")
  end
  
end
  	
employee = Employee.new(name: 'Mat', age: 50, gender: 'M')
  
=> #<Employee:0x00007fa6fe8a1f18 @name="Mat", @age=50, @gender="M", @department="dev">
      
```

Hope this quick tip was helpful. Share your tips in comments. Let me know if you are interested in more such tips and best practices.
AzureFunBytes New Episode on Microsoft @LearnTV Reminder - 11/19/2020 - @Azure Security with @deanbryen
Tags: azure, security, beginners, tutorial
Published: 2020-11-18 14:16:58

New #AzureFunBytes - 11/18/2020 2 PM EST

Security is always the primary concern for those deploying applications into the cloud.  This week on AzureFunBytes we dive into the different ways to improve your security posture in the cloud.  Cloud Advocate and security wiz, [Dean Bryen](https://twitter.com/deanbryen), joins me to discuss the many features and services in Azure that are built to keep your applications and customers secure.

Learn about Azure fundamentals with me! [Microsoft LearnTV!](https://docs.microsoft.com/learn/tv/?WT.mc_id=devops-10835-jagord) The most interactive way to join the show!

{% youtube SIDl72tSooc %}

Live stream is available on Twitch at 2 pm EST Thursday. You can also find the recordings here as well:

https://twitch.tv/azurefunbytes
https://twitter.com/azurefunbytes
https://aka.ms/jaygordonontwitter

Join me, ask questions, and learn about Azure!

[Microsoft Learn: Azure Fundamentals](https://docs.microsoft.com/en-us/learn/paths/azure-fundamentals/?WT.mc_id=blog-devto-jagord)
[Microsoft Azure: $200 Free Credit](https://azure.microsoft.com/en-us/free/?WT.mc_id=devto-blog-jagord)
[Strengthen your security posture with Azure](https://azure.microsoft.com/overview/security/?WT.mc_id=devops-10835-jagord)
[Cloud Security on Azure](https://azure.microsoft.com/product-categories/security/?WT.mc_id=devops-10835-jagord)
Microsoft Learn: [Secure your cloud data](https://docs.microsoft.com/learn/paths/secure-your-cloud-data/?WT.mc_id=devops-10835-jagord)
Microsoft Learn: [Security, responsibility, and trust in Azure](https://docs.microsoft.com/learn/modules/intro-to-security-in-azure/?WT.mc_id=devops-10835-jagord)
apt update-fix not found packages! or guide to update successfully your Ubuntu  
Tags: linux, ubuntu, discuss, bash
Published: 2020-11-18 14:06:48

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/w9ba3if8709tk0pda48j.png)
this picture is about <b>nodejs</b> but ill tell you how you can handle this type of issue for any module or packages.

when you mistakenly edit your source.list or you are having any error on updating your distro with ` sudo apt-get update` 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9ok267yi31l7cr3zzt4o.png)

#### reason:- 
this is maybe your ubuntu mirror{your local region distribution for ubuntu} have some issues or you messed up with it. 
my region is India you can see in the image below it has `in.` ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4a9zj8egbav5fc0nvzuh.png)
you can check yours by `sudo nano /etc/apt/sources.list
`
when you open your sources.list  by the above command you just make a copy of this file for backup if something bad happens after pasting these URLs into sources.list 
```
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiv>

deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe mu>
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted univers>

deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe m>
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted univer>

deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe >
deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted unive>

deb http://archive.canonical.com/ubuntu focal partner
deb-src http://archive.canonical.com/ubuntu focal partner


```
this will help you!
now save it and try to update by
`sudo apt-get update`
and Voila!

if you are still facing issues then let me know
I want to enhance the performance of my cold mails
Tags: marketing, engagement, customers
Published: 2020-11-18 14:03:04

---
title: I want to enhance the performance of my cold mails

published: true
description: Cold emails are effective - about 40 times of Facebook and Twitter combined, in terms of customer acquisition.Getting the basics right will help you make the most of a high-performing channel.
tags: marketing, engagement, customers
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/cow6qf6v5ojbknxgv5a8.png
---

Cold emails are 40x more effective in getting new customers than Facebook & Twitter combined. However, it's over usage and poor execution results in its poor performance. Getting the basics right will help you make the most of this high-performing channel.

So, today let us uncover the [lost art of cold emails](https://2.flexiple.com/no-vc-reports/i-want-to-enhance-the-performance-of-my-cold-mails)

###**How to convert leads through cold emails?**

 We break the process into three steps:

1. **Addressing email deliverability:** If your mail lands in the spam folder and not the inbox, you have already lost the game. You can follow simple steps to ensure a safe inbox landing.

2. **Relevant personalisation:** The bane of today's outreach is the one-size-fits-all approach to it. So, start the personalisation from the subject line, then move to the first line of the mail and finally, the mail content.

3. **Appropriate follow-ups:** A single try isn't enough. Have from 3 to a maximum of 7 touchpoints with your potential customers. Not just that - also modify the content in each of these mails.

### **What's the exact implementation like?**

I tackle exactly that in today's report. From discussing the nuances of writing content to using tools like Hunter, Vocus, Outreach, etc., I share the steps to turbocharge your cold outreach!

And yes, I haven't breached 5 mins in this report either. Enjoy this report by clicking [here](https://2.flexiple.com/no-vc-reports/i-want-to-enhance-the-performance-of-my-cold-mails).

To save more time for you, I have made it shorter on Twitter: Tweet Link!

{% twitter 1329048934564577280 %}
Validate state transition easily without any gem
Tags: rails, ruby
Published: 2020-11-18 13:54:42

Say, you have a model with status field: 

```ruby
class Order < ApplicationRecord
  enum status: [
    :cart,     
    :requested,
    :confirmed,
    :complete, 
    :canceled 
  ], _prefix: true
```

In some case, you want to put some constraints on status changes. It can change from `cart` to `requested`, but can't change from `requested` to `cart`, for example.

You can use state machine gems, such as [aasm](https://github.com/aasm/aasm) to write validation.  
But the gem introduces new DSL to write state transition. It's too much just for validation.


## Solution
It can be written with basic ActiveRecord validation this way:

```ruby
validates :status,
  inclusion: { in: %w[requested canceled] },
  if: -> { status_changed? && status_was == 'cart' }
```

If you like to write `from -> to` direction, just use hash:

```ruby
class Order < ApplicationRecord
  # ...

  {
    'cart' => %w[requested canceled],
    'requested' => %w[confirmed complete canceled],
    'confirmed' => %w[complete canceled],
    'complete' => %w[],
  }.each do |status_from, status_to|
    validates :status,
      inclusion: {
        in: status_to,
        message: " cannot change from '#{status_from}' to '%{value}'"
      },
      if: -> { persisted? && status_changed? && status_was == status_from }
  end
```

A few notes:

- Use `if: -> { persisted? ...` to avoid validation when creating a model instance in tests
- Set customized message because default ones are not friendly
How I Edit Photos for Social Media in Python (includes code)
Tags: python, programming, beginners, webdev
Published: 2020-11-18 13:42:48

<i>Learn how to create and manipulate digital images using Python</i>

We are living in an age of social media. A place where we want our photos on Instagram and Facebook to look impressive than our real personalities. We want our timelines to look fabulous, filled with beautiful pictures. To achieve this goal, we often end up downloading software and apps that we don’t require at all in the first place. To top it off, some of these apps are so complex and difficult to understand and learn that we end up uninstalling them after 2 minutes of use.

In this article, I will show you how I edit my photos for social media platforms like Fb, Twitter, and Instagram using the python pillow library and how you can do the same. This article is also for developers who want to learn about the python image processing library. For each question, we will walk through a possible solution code in the python programming language. So without wasting any more seconds, let us get started.


<a href="https://levelup.gitconnected.com/how-i-edit-photos-for-social-media-in-python-includes-code-a022deeb7935"><button>Click To View Full Post</button></a>

<hr/>

If you like the post and want to connect, you could do that by reaching out to me on Twitter. I would love to have a good Dev conversation or a DevJoke ( whatever you prefer ). I bet we could learn a lot from each other.


<a href="https://twitter.com/IamKaranJagota"><button>Twitter Profile</button></a>
Jazz and Ufone internet packages
Published: 2020-11-18 13:39:59

Jazz internet packages and Ufone internet packages keep you update about the latest package plans. Just connect with us for all package plans detail that is announced by telecom companies. 
https://www.mobilepackages.co/p/jazz-internet-packages.html
https://www.mobilepackages.co/p/ufone-internet-packages.html
Gravitee.io the Hybrid Way
Published: 2020-11-18 13:30:02

Nowadays, more and more people are looking to deploy their infrastructure both in the cloud and on-premise.

The reasons for this are clear - getting the best of both worlds and an amazing mix between security, data compliance, and performance.

Another good reason for this kind of deployment is regarding the reality of on-premise deployments - all the services and data don’t need to be exposed publicly.

The purpose of this post is to show you how simply you can deploy Gravitee.io API Management using a hybrid architecture. In this case we will achieve everything using Kubernetes and our Helm charts. Read More:

https://www.gravitee.io/article/blog-gravitee-io-the-hybrid-way
Improving Login With Facebook User Experience With Native Login
Tags: facebook, login, ux
Published: 2020-11-18 13:07:07

Auth0 now supports native login for Facebook, which improves UX and complies with newly-tightened Facebook and Apple policies.
[Read more...](https://auth0.com/blog/improving-login-with-facebook-user-experience-with-native-login/?utm_source=content_synd&utm_medium=sc&utm_campaign=native_login)
Don't Procrastinate on your personal projects
Tags: sideprojects, productivity, career
Published: 2020-11-18 13:04:27

We all have the habit of delaying our work and passing it on to the next day. But most importantly programmers delay one thing the most: **their Side-projects**. Everybody is guilty of procrastination, and nobody is a stranger to it, but while procrastinating our work can not be the best option, procrastinating our own personal projects is. Here are 3 reasons why we should not procrastinate and do our projects in free time:

##Future Assets

Delaying projects makes you lose on a lot of opportunities coming your way. When the habit of delaying things always surrounds you, you do not realize the precious opportunities and forget to make use of them. Any new opportunity that comes your way gets missed. Remember, most opportunities come around only once. You don't even know that your personal idea might become the next tech giant in the future, like [GitHub](https://tom.preston-werner.com/2008/10/18/how-i-turned-down-300k.html) or **accidentally, you solved a problem that some people face**. At least, you can sell this project to a suitable buyer.

##You lower your self-esteem

Procrastination and self-esteem are one of those vicious circles you can never get out of. You tend to procrastinate because of low self-esteem, and procrastination then further lowers your self-esteem. **With low self-esteem, you hold yourself back to improve your work and productivity.** What happens is our side projects make us face new challenges since we mostly do the same work in our jobs. When we face new challenges, we improve our skills and it helps make us feel more proud of our coding brain. But the lack of perseverance, which is one of the main [causes of procrastination](https://awesomecoffee.com/blogs/productivity/causes-of-procrastination). The worst part about procrastination is that you lose out on your precious time without even realizing it. Procrastination and the habit of delaying your pending work prevent you from completing your goals and destroy your chances of becoming better in life. 

##Ruin Career

With low self-esteem and fewer goal fulfillment, you seem to miss out on your deadlines and targets. You lose excitement to our main job and now, you don't enjoy the moments once you thought will be your best. Side projects help us learn new things which help in our job. We also are more excited when a new task comes into our job and finds it an immense opportunity.  Your lack of interest in coding will result in something bad for the future. **You might miss out on appraisals, incentives, and promotions, and eventually ruin your career.** This leads to an adverse consequence on your career growth. Moreover, it is very frustrating to lose out on time and career because of these silly things like lethargy, boredom, etc. 

So Get Up on Weekends and Work on your personal projects. Btw, here are some [DEV.TO community](https://dev.to/pungiish/programmers-who-only-code-at-work-bhp) thoughts on this.
Daily Developer Jokes - Wednesday, Nov 18, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-11-18 13:00:15

---
title: "Daily Developer Jokes - Wednesday, Nov 18, 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%20Nov%2018%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/5e1259a186412.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 do developers use mechanical keyboards?

___A___: To strongly type their code.
 -->
Advent Of Code 2020
Tags: programming, watercooler, challenge, news
Published: 2020-11-18 12:38:48

A couple of days ago the [Advent of Code website](https://adventofcode.com/) switched from the 2019 edition to the **2020 edition**. Finally 🎉


## What is Advent of Code?

Every day from December 1st to December 25th a new coding challenge is released. Solve it ASAP to help the Elves save Christmas. [Here](https://adventofcode.com/2019/day/1) is the challenge from 1st December 2019 to give you a better idea about the challenges. Usually they get more difficult with each day. What I like about AoC is that the challenges only rarely rely on math IMHO. Instead you are required to demonstrate an open mindset, debugging skills, some logic and a lot of googling to solve the problem.

## Why should I join?

Advent of code is a great way to challenge your collogues and improve your coding skills.

## What programming language should I use?

That's completely up to you. I personally use C#. Here is my GitHub repo of last years event:


{% github klyse/AdventOfCode2019 %}

## Do I need to solve each days challenge?

Nope you don't. You solve as many challenges as you can / want. Be warned, some of them are really difficult! Don't give up if you find no solution for one day, the next day might be completely different and more accessible for you.

## Private Leaderboard

Don't forget to create your private leaderboard. This way you can challenge your friends and compare the coding results.

There is only one last thing to say:
Code humans, Code!
# 🎄🎄🎄🎄🎄🎄🎄🎄🎄🎄
The Power of Data Structures
Tags: algorithms, productivity
Published: 2020-11-18 12:38:38

A trip down memory lane avid reader. Let's take a walk through the core of it all: data structures. What are they and why are they so important? A 'hello' to a reader that might have missed our talk on [Memory management](https://thegreencodes.com/memory-management-deep-and-shallow-copying), where we delved into what happens to our code in variable assignment. Do take a look, even if it's a refresher you're looking for.


Alright then. What is a data structure?

It's a way of organizing data. Say we have a couple of friends coming over for our fortnightly game night( ah...the things on our to-do list). We need snacks, a number of people expected to be there, a list of activities to partake. I can go on and on. So how do we organize this in say a program we want to implement to fix the hustle of planning? How do we store the things to be done or the items to be purchased? It's all data in the end. We need structure. We need data structures. The how of getting our data and manipulating it from these structures are our algorithms.

Right back to our game, who will do what? 


![adeolu-eletu-DqWEAOHsAvc-unsplash.jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1604914703881/MPT41cxif.jpeg)

How do we decide what comes before what in terms of structuring this data? Does our simple program make it easy to retrieve this information? Is it fast enough? What about efficiency?

Whatever kind of application we are talking about, we need a data structure(s) that will allow traversing, insertion, searching, deletion( in case the last casserole was outright nasty), sorting, or merging of bits of data. Call it CRUD with extra steps.

As from the Memory management article, we got data, then collections of data. It's all data. While memory allocation might not be something we think of with javascript of even Python, it holds water when doing **C** or **C++**. So keep this in mind. 

Broadly speaking, we group data structures, much like data types in itself, as:

a) Primitive

b) Non-primitive

Primitive structures would hold primitive data types; that is the *chars*, the *int* the *float*. Basically, data types that hold a single value.

Non-primitive structures, on the other hand, break down to **linear** (which holds data in a sequence) and of course **non-linear**. Hold your breath in case you lost it a moment there. We'll go into the details soon enough.

As of now, you have a general idea, a scope if you may, of what structures involve.
They are quite a number.


Over the course of the next couple of weeks, we'll be covering some of these structures. Unraveling them to bits and pieces. Finding what makes them tick as so and getting why many a time, developers new and old alike, have challenges addressing them. Stick a while, I cannot wait for our next piece in this!
Tự học Dart - 004, Function
Published: 2020-11-18 12:37:05

# Functions

Khai báo thông thường
```dart
main() {
  // Không khai báo kiểu trả về
  isEvenNumber(int num) {
    return num%2 == 0;
  }
  print("10 là số chẵn: ${isEvenNumber(10)}");
  
  //Có khai báo kiểu trả về
  int addTwoInt(a, b){
    return a + b;
  }
  print("10 là số chẵn: ${addTwoInt(10, 20)}");
}
```

Mở rộng
```dart
// Khai báo hàm với kiểu trả về là `int`
int add(int x, int y) {
  return x + y;
}

// Khai báo hàm ko kiểu trả về
addNoTypes(x, y) {
  return x + y;
}

// Arrow Function
String sayHi(String name) => "Xin chào $name";

// Tham số mở rộng đặt trong dấu `[]`
String sayHello(String name, [moreName]) {
  if(moreName != null) return "Hello $name and $moreName";
  else return "Hello $name";
}


main() {
  print(add(1, 2)); //3
  
  print(addNoTypes(1, 2)); //3
  print(addNoTypes("a", "b")); //ab
  
  print(sayHi("Son Tran")); //Xin chào Son Tran
  
  print(sayHello("Son"));
  
  // Anonymus Function - Hàm ko tên
  // Có thể dùng arrow function ở vd này
  var fruits = ['apples', 'bananas', 'oranges'];
  fruits.forEach((item) {
    print('${fruits.indexOf(item)}: $item');
  });
}
```
Analogy between Running a Race and Learning to Code
Tags: watercooler, beginners, motivation, codenewbie
Published: 2020-11-18 12:14:33

I want to share an analogy between running a race and successfully learning to code. Radio host Steve Harvey stated that a runner in a race is not disqualified if they trip or fall. That success in racing is tied to finishing the race, not on perfection. While learning to code, we are allowed to make mistakes. **Similar to racing, we need to get back up whenever we stumble or fall down.** We can't just sit on our hands and think because we stop for a second it's over. You can't give up on your dreams.

We are in race to learn and to get paid for our skills. **Each person's finish line or version of success is different.** Therefore, we can't stop running because others are ahead of us. Success can be a thousand different outcomes like starting a startup, working for a corporation, or developing a personal project to solve a personal problem. Your success is determined by focusing on your journey and your goals.


Finally, Steve Harvey spoke about running a race through the forest called life without a map. No matter how fast you run, you are at a disadvantage and have a possibility of never arriving at your destination. You have to have goals. In tech there are an avalanche of skills to learn and millions of distractions between us and our goals. **Success is determined by knowing what to focus on while running and what the finish line looks like for you.**

####Summary:

1. We need to get back up whenever we stumble or fall down.
2. Each person's finish line or version of success is different. Focus on your journey!
3. Success is determined by knowing what to focus on while running. Avoid distractions!