teleren/devto huggingface dataset:
RSpec: do not verify hash keys separately
Tags: rspec, ruby, testing
Published: 2021-03-02 10:03:42

Sometimes I come across three separate checks in specs to make sure the hash is OK: there are keys, there are values, values have the right type.

```ruby
RSpec.describe UserSerializer do
  describe "#as_json" do
    let(:user) do
      build(:user,
        first_name: "Bart",
        last_name: "Simpson",
        tel: "+777123")
    end
    let(:json) { described_class.new(user).as_json }

    it "has keys" do
      expect(json).to include(:first_name, :last_name, :tel)
    end

    it "has types" do
      expect(json[:first_name]).to be_kind_of(String)
      expect(json[:last_name]).to be_kind_of(String)
      expect(json[:tel]).to be_kind_of(String)
    end

    it "has values" do
      expect(json[:first_name]).to eq(user.first_name)
      expect(json[:last_name]).to eq(user.last_name)
      expect(json[:tel]).to eq(user.tel)
    end
  end
end
```

This spec is more confusing than helpful: when you change fields, you have to update three tests; it's hard to immediately understand what the serializer returns.

Better to use include matcher and skip type checks (it's not the responsibility of the test):

```ruby
RSpec.describe UserSerializer do
  describe "#as_json" do
    it "includes first name, last name and tel" do
      user = build(:user,
        first_name: "Bart",
        last_name: "Simpson",
        tel: "+777123")
      json = described_class.new(user).as_json

      expect(json).to include(
        first_name: "Bart",
        last_name: "Simpson",
        tel: "+777123"
      )
    end
  end
end
```
Python Project made in visual code
Tags: python, gamedev, vscode
Published: 2021-03-02 09:58:47

import random
import curses

s=curses.initscr()
curses.curs_set(0)
sh,sw=s.getmaxyx()
w=curses.newwin(sh,sw,0,0)
w.keypad(1)
w.timeout(100)
snk_x=sw//4
snk_y=sh//2

snake=[
    [snk_y,snk_x],
    [snk_y,snk_x-1],
    [snk_y,snk_x-2]
]

food=[sh//2,sw//2]
w.addch(food[0],food[1],curses.A_CHARTEXT)
key=curses.KEY_RIGHT
while True:
    next_key=w.getch()
    key=key if next_key==-1 else next_key 

    if snake[0][0] in [0,sh] or snake[0][1] in [0,sw] or snake[0] in snake[1: ]:
        curses.endwin()
        quit()  
    
   
    new_head= [snake[0][0],snake[0][1]]

    if key==curses.KEY_DOWN:
         new_head[0]+=1
    if key==curses.KEY_UP:
         new_head[0]-=1
    if key==curses.KEY_RIGHT:
         new_head[1]+=1
    if key==curses.KEY_LEFT:
         new_head[1]-=1

    snake.insert(0,new_head)        

    if snake[0]==food:
        food=None
        while food is None:
            nf=[
                random.randint(1,sh-1),
                random.randint(1,sw-1)
            ]
            if nf not in snake:
                food=nf
            else:
                food=None    
            w.addch(food[0],food[1],curses.A_CHARTEXT)
    else:
        tail=snake.pop()
        w.addch(tail[0],tail[1],' ')      
    w.addch(snake[0][0],snake[0][1],curses.A_DIM)
Update multiple lines in a YAML file with kubectl
Tags: kubernetes, yaml, kubectl, shortposts
Published: 2021-03-02 09:55:22

Whenever I need to update a YAML file, the first thing that comes to mind is to either use `sed` or `awk` or `perl` etc., But there's an in-house Kubectl `patch` option that simplifies the experience.

![Photo by Vidyasagar Machupalli](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6odvoobnl7a7ni15a10t.jpg)

For example, let's update the number of replicas in the `spec` below and also the Nginx container image version. Remember, it's multiline and using any other option can be bit clumsy. 

Source: https://kubernetes.io/docs/tasks/run-application/run-stateless-application-deployment/

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80
```
Let's apply the file 

```bash
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
```
Locally, let's create a file called `patch.yaml` with the below content

```yaml
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 3 # Update the number replicas from 2 to 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1
        ports:
        - containerPort: 80
```
and then patch the `deployment` with the below command

```bash
kubectl patch deployment/nginx-deployment --patch "$(cat patch.yaml)"
```
Once you see this message `deployment.apps/nginx-deployment patched`. Run the below commands

```bash
Kubectl get deployments 
# NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
#nginx-deployment      3/3     3            3           3h

kubectl get deployment nginx-deployment -o yaml
```
and look for to see the previous configuration that is replaced

```yaml
kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},"spec":{"replicas":2,"selector":{"matchLabels":{"app":"nginx"}},"template":{"metadata":{"labels":{"app":"nginx"}},"spec":{"containers":[{"image":"nginx:1.14.2","name":"nginx","ports":[{"containerPort":80}]}]}}}}
```
azure devops pipeline predefined variables
Tags: azuredevops
Published: 2021-03-02 09:53:26

Azure DevOps provides a number of [predefined variables](https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables).

Some of these are folders for your source files, artifacts, temp files, etc.
And some of these variables maps to the same value.

Here is a list of all the folder variables (on a window-2019 image):

```
Agent.BuildDirectory: D:\a\1
Agent.HomeDirectory: C:\agents\2.182.1
Agent.TempDirectory: D:\a\_temp
Agent.ToolsDirectory: C:\hostedtoolcache\windows
Agent.WorkFolder: D:\a
Build.ArtifactStagingDirectory: D:\a\1\a
Build.BinariesDirectory: D:\a\1\b
Build.Repository.LocalPath: D:\a\1\s
Build.SourcesDirectory: D:\a\1\s
Build.StagingDirectory: D:\a\1\a
Common.TestResultsDirectory: D:\a\1\TestResults
Pipeline.Workspace: D:\a\1
System.DefaultWorkingDirectory: D:\a\1\s
```
What are Classes and Objects What is their difference?
Published: 2021-03-02 09:51:27

__Class__

Classes are just blueprints. That's all.

They are a data type -user defined- just like String.

They have attributes (data) and they have methods (functions) 

They can hide data and methods which are only used internally in class.

__Objects__

If classes are blueprints, objects are the buildings that made from those blueprints.

They carry all the data and methods class has. So they are created from classes and they represent them.

They all can have a different identity for example Car is a class but Audi is an object.

__Class:__ Fruit __Object:__ Apple, Banana, Mango, Guava etc..

__Difference between Objects and Classes__

Classes are just defination of objects they are just templates or blueprints of objects whereas objects are instances of classes.

Classes is declared once but objects can be created multiple times.

Class is a logical entites but objects are physical entities.

Objects allocates memory when its created, on the contrary classes don't allocate memory when its created(memory is taken up for class definitions isn't on the stack nor heap. When you create an object of a class it will always go on either the stack or heap. Class declaration tells the compiler and runtime how much memory to allocate for each class instance, but only when requested.).
Wrecking car parts Brisbane | Car parts wreckers Brisbane

Tags: wrecking
Published: 2021-03-02 09:48:15

Avail top cash for your scrap and old cars with free removals from Brisbane Top Wreckers. We offer best car wrecking for all types of vehicles irrespective of it's brands, model and condition.We accept any make and model of cars even if it's wrecked, damaged, unwanted, old, scrap, and junk cars. As we are always looking for the best customer service and eco-friendly recycling service, most of the clients opt for our wrecking service. Acquire hassle-free removals from Brisbane Top Wreckers. We accept all brands including BMW, Audi, Mercedes Benz, Holden, Fiat, Ford, Mazda, Isuzu, Jeep, Volvo, Land Rover, Datsun, Daewoo, Kia, Jaguar, Subaru, Toyota, Lexus, Daihatsu, Volkswagon, Nissan, Renault, Mitsubishi, Peugeot, Porsche, Chrysler, Skoda, Hyundai, Suzuki, etc. We will wreck cars, buses, SUVs, Sedans, Hatchbacks, trucks, vans, aircraft, motorcycles, jeeps, 4*4. Contact at https://brisbanetopwreckers.com.au/
Top Reasons to Use React Native for Mobile App Development
Tags: reactnative, react, javascript, mobile
Published: 2021-03-02 09:36:07

Native apps have appealing interfaces and seamless functionality with user-friendly features. But then, native app development costs you a small fortune. Startups and even SMEs cannot afford to build customized native apps at times. Thankfully, technology has evolved to enable us to build almost the same quality of apps in less than half the time and money. We know it as cross-platform app development or hybrid app development.

These days, we have several types of [cross-platform app development](https://www.suriainternational.com/cross-platform-app-development-company/) platforms available to build feature-rich apps that have the best of both worlds at reasonable costs. Out of all these available platforms, React Native has started gaining fame since its initial release on March 26, 2015. Developed by Facebook, React Native is a robust mobile app development framework. A huge community of active React Native developers.

Brief Information on React Native

React Native is built upon the ReactJS library. A [React Native app development company](https://www.suriainternational.com/react-native-app-development-company/) can develop a customized cross-platform app from scratch using this framework. Simply put, almost all major OS including iOS and Android, and every device running on them can easily run React Native-based apps. This framework builds half Hybrid and half Native apps that can seamlessly run across any device right now and in the future, based on popular OS.

Facebook, Instagram, Tesla, and Skype are some of the well-known apps with the power of React Native. These days, many entrepreneurs prefer React Native app development because of its great benefits. More companies have started putting trust in React Native, and in this blog, we will see why React Native is the right choice.

Top Reasons Why You Should Opt for React Native App Development in 2021

    App Development Cost

Mobile app development cost is one of the biggest hurdles in adopting mobility. Many companies just keep the app development project on the back burner because of its high cost. For example, iOS app development requires cutting-edge tools and Swift or C# developers. It also takes a long time to develop, and as a result, you need to pay a hefty amount as development cost. In a way, native app development costs a lot of money, time, and effort.

Read More: https://www.suriainternational.com/reasons-to-use-react-native-for-mobile-app-development/
What is Object Oriented Programming?
Published: 2021-03-02 09:31:40

Object Oriented Programming is a basically abstraction method. It give us more modularized data.

For instance if we need to know whether a student registered a lesson, we could use procedural programming and we would create another function to check it. And I would perfectly work well but the thing is if somehow this logic changes it might affect the whole program provided we used that registering information in somewhere.

On the other hand if we used oop instead of procedural programming, we just had to create another function in the class. And we would achieve it with a precise change.

It gives us more reuseability, easy to maintain, easy to fix, easy to debug and easy to test.

Limitations

In little applications that won’t exist for long it is probably a better idea to use procedural programming since it oop makes program more larger in size and -since there is a lot in behind the scenes -, slower. But this is not particularly the case for C++ since it’s most efficient oop language out there.
Vue Vixens Japan は Front-End Foxes Japan へ
Tags: frontendfoxes, womenintech, community
Published: 2021-03-02 09:30:55

こんにちは！Vue Vixens Japan チャプターリーダーの後川 菜穂子です。

Vue Vixens Japan は Vue.js を学ぶ女性をサポートするため、グローバルコミュニティ Vue Vixens のローカルチャプターの一つとして 2019 年に立ち上がりました。
これまで「女性のための女性による運営」をモットーに、初心者向けのワークショップや勉強会を実施してきました。

**2019 年 10 月 初回イベントの様子**

![Vue Vixens Japan](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzrtdxwtvatuizva6bub.jpg)

2020年秋からイベント開催を一時休止していましたが、2021年3月より再開することとなりました。
このたび、より良いコミュニティを目指し、新たなスタートを切ることになりましたのでお知らせいたします。

## Front-End Foxes Japan へ

チャプター名を Vue Vixens Japan から Front-End Foxes Japan に変更し、フレームワークの垣根を越えてフロントエンドを学ぶ女性を広くサポートすることを目指します。
これまでは Vue のみをテーマにしてきましたが、今後は他のフレームワークや言語も含め、フロントエンドに関わること全てを対象に活動していきます。
[グローバル団体](https://www.frontendfoxes.org/)の方では既に方針変更を行っており、Japan チャプターは今回そちらに追随する形となります。
以前よりも広い範囲の題材を扱うことになりますが、コアメンバーにも Vue 好きのエンジニア・デザイナーが多く、参加者からももっと学びたいとご意見をいただいたため、今後も機会があれば Vue を中心としたイベントも開催したいと思っています。

## イベント形式の方針変更

今までは、学びをサポートするための最も直接的な方法として、少人数で会場に集まって丁寧に教える、といった内容のワークショップを中心にイベントを執り行ってきました。
しかし、昨今はオンサイトでのイベント開催が困難になり、オンラインでの活動に移行しています。
オンラインでのワークショップを何度か試みましたが、リモート環境で細やかにサポートするためには様々なイレギュラーに備えて体制を準備しておく必要があることを知りました。
これからはより多くの女性を継続的にサポートすることを目指すため、ワークショップのみに拘らず、ミートアップ・トークセッションや配信型のイベントも積極的に計画していきます。

---

なお、「女性のための女性による運営」という方針はこれからも変わりません。
女性が安心して自主的に学べる場を提供するため、今後も改善を重ねていきます。

興味のある方は、ぜひ[こちら](https://join.slack.com/t/frontendfoxes/shared_invite/zt-mo4w7fn7-oP4uE29Km5sO8eiQW3e2Yg)から Slack ワークスペースにご参加いただき、 `#chapter-frontendfoxes-jp` チャンネルに入ってみてください！

---

Front-End Foxes Japan に関するご質問やご相談がありましたら [@nahokomatsui](https://twitter.com/nahokomatsui) にご連絡ください。
Scraping Job Listings with Python and BeautifulSoup
Published: 2021-03-02 09:10:27

Suppose you go to an interview for a developer who has to create web crawlers? suppose you show them how you learned about the job opening because you had made a web crawler to crawl jobs about web crawling? So meta! the job should be yours.

Today lets look at scraping Job listings data using Beautiful soup and the requests module in python.

Here is a simple script that does that. BeautifulSoup will help us extract information and we will retrieve crucial pieces of information.

To start with, this is the boilerplate code we need to get the indeed.com search results page and set up BeautifulSoup to help us use CSS selectors to query the page for meaningful data.
We are also p[assing the user agent headers to simulate a browser call so we dont get blocked.

Now let's analyze the Indeed pages search results. This is how it looks.
And when we inspect the page we find that each of the items HTML is encapsulated in a tag with the class jobsearch-SerpJobCard.


We could just use this to break the HTML document into these cards which contain individual item information like this:
On further inspection, you can see that the title of the job always has the class title. So let's try and retrieve that...
That will get us the titles..
Bingo!

Now let's get the other data pieces..
Produces all the info we need including company name, address, and summary of the job.

In more advanced implementations you will need to even rotate the User-Agent string so Indeed.com pages cant tell its the same browser!

If we get a little bit more advanced, you will realize that Indeed.com pages can simply block your IP ignoring all your other tricks. This is a bummer and this is where most web crawling projects fail.

Overcoming IP Blocks

Investing in a private rotating proxy service like Proxies API can most of the time make the difference between a successful and headache-free web scraping project which gets the job done consistently and one that never really works.

Plus with the 1000 free API calls running an offer, you have almost nothing to lose by using our rotating proxy and comparing notes. It only takes one line of integration to its hardly disruptive.

Our rotating proxy server Proxies API provides a simple API that can solve all IP Blocking problems instantly.

With millions of high speed rotating proxies located all over the world,
With our automatic IP rotation
With our automatic User-Agent-String rotation (which simulates requests from different, valid web browsers and web browser versions)
With our automatic CAPTCHA solving technology,
Hundreds of our customers have successfully solved the headache of IP blocks with a simple API.

The whole thing can be accessed by a simple API like below in any programming language.
React or React Native?
Published: 2021-03-02 09:00:45

#Hey 👽's

I started React-Native for two todays. Which is very easy since it has same ReactJs features.

But now I'm confused. Because the styles and codes are totally native codes. How Can I achieve the cross platform support feature i.e., Web.

Also the doc specifies about React-Native_web.

What's the Dealio?
Kubernets & Openshift Session by RedHat
Published: 2021-03-02 08:54:23

Hello Everyone,

I love to share that yesterday I have attended an expert session conducted by LinuxWorld India with Red Hat Experts for Industry Use Cases of **Kubernetes / Openshift**.

I'm amazed to see the how Organisations can use these technologies for maximise their Outputs.

Thanks to Red Hat Experts :
* Amel Mathai
* Daleep Singh Bais (RHCA Level VIII, RHCI, RHCVA, CKA).
* Abid Matoo.

*Students of Linux World are thankful to Mr.Vimal Sir & Preeti Ma'am for organising such an event*.

Summary or Points from the Session :
*Benefits and Challenges of using Kubernetes.
*Brief detail about Containers and Virtual Machines.
*Introduction to Open Shift.
*Features of Open Shift.
*Details of S2I and Service mesh.
*About PAAS(Platform as a Service).
*Introduction to Podman.
*Demo to deploy a web app by Open Shift.

Thanks,
keep learning & keep growing,
Sahil Kaushik  


#RedHat #vimaldaga #rightmentor #linuxworld #makingindiafutureready #righeducation #containersbylw #kubernetes #openshift #expertsession
Horizontal line is not able to span across the row.
Tags: html, outlook
Published: 2021-03-02 08:44:50

Horizontal line is not spaning across the row when adjusting window.However it is showing correct when we open complete mail and showing correct in chorme.I have used below code 
<!- <tr><td colspan='4'><hr style='width:575%;text-align:justify'></td></tr> ->
Day 11 of 365 Days of Code
Tags: graphql, javascript, react, babel
Published: 2021-03-02 08:29:42

_Learning the relationship between scalar and object types in a GraphQL query._
I have worked on sql databases and somehow I find the relationships in graphql analogous to the joins in sql. There's a lot more to learn. Will keep posting.!![Code Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypys8qopsehmb116ksif.png)
The problem with perpetual licensing
Tags: licensing, programming, software
Published: 2021-03-02 08:16:56

Unless you’ve been living under a rock, you know should know by now the perpetual licensing pattern: you buy a license to certain software, you receive updates for a year or two, depending on the license, then you stop receiving updates for the app and you can use that version forever.

The main problem with this type of license, from a user’s perspective, is consistency. I use quite a few software with this type of license BUT the main difference is that some are updated daily/weekly or at least monthly and some are less frequently updated.

Most applications receive tons of updates after the initial release and then they magically stop receiving updates or new features for a while. My question is: why buy another year of your software if in the past 5-6 months I received only a minor update? What will I miss if you do not update it? Well, for most applications, you won’t miss anything… except some euros in your pocket.

On the other hand, there’s software like TablePlus that is fully worth paying for it year by year because it is updated a lot and you would miss a lot of features if you are stuck on an old version.

Nevertheless, I have a problem with all subscriptions lately. You pay a subscription for everything, and now you are required to pay monthly for software too. It all piles up, and sure, developers make more money and they can afford 5$ here and 5$ there, but again, it all piles up and at the end of the month you end up giving a lot of money on licenses.

So… maybe a perpetual license is ok though and it all depends on the developer itself if clients would renew their license: keeping an updated app and adding new features would make a higher percentage of the clients renew their license for another year.

What do you say, what is the best license for you and your needs? How many perpetual licenses do you pay yearly?
Day 53,54:100DaysOfCode
Tags: 100daysofcode, flutter, programming, productivity
Published: 2021-03-02 07:58:45

gave cf(codeforces) global round13 solved 2 ques ,

still a newbie though,,
tried c ques after contest

implemented some of my flutter code to upload images on firebase storage ..
fixed some bugs with phone number login.

revised two-pointer approach 
started with basic probablity for cp.
just now got a mail qualified for second round of uberhacktag hackathon :)

EOD
You can Follow me->
https://github.com/singhtaran1005
https://www.linkedin.com/in/taranpreet-singh-chabbra-27517918a/
How to Find and Finalise Pest Control Companies Gold Coast?
Published: 2021-03-02 07:55:26

If you prefer to see your house neat and clean at all times, even the sight of cockroaches circling your premises can make your heart pound. You want to destroy them as fast as possible. Many homeowners don’t realise the seriousness of the pest infestation problem. Such people try different do-it-yourself methods.

Although very effective, these DIY methods only provide temporary relief. Sooner or later, you will have no choice but to call in a pest control specialist to solve the problem. In order to avoid poor service and regretful decisions, it's important to choose the best pest control company.

From all the <a href="https://www.tomspestcontrolbrisbane.com.au/pest-control-gold-coast/">pest control Gold Coast</a>, you need to select the one that offers top-quality services within your budget. You need to consider several factors before making any decision. First of these factors is the type of pests. There are various types of pests. There are ants, termites, fleas, fleas, cockroaches and rodents. Most pest control companies can remove all types and species of pests.

However, some companies specialize in eliminating only some types and species of pests. The second factor is certificates and insurance. This is the most important factor to consider when choosing a pest control company. In all countries, service providers must have a work permit, which is issued after their certificate is checked.

You need to make sure that the certificates and licenses of pest control companies are up to date. It is also in your best interest to choose an insured company. This covers any damage to your property that occurs during the process. It also reduces your responsibility to the technician if they get hurt while working within your premises.

The third factor is chemicals as these are used in the products which are applied in different areas of a property for controlling pests. Generally speaking, not every product is harmful to people, but some people can get affected. This includes people with respiratory problems such as asthma, people with allergies and sensitivities, children, and pets. You can ask a specialist if chemicals will be used or not.

Wrapping Up

With the help of the information mentioned in this article, you can select the right pest control company for fulfilling your needs.