teleren/devto huggingface dataset:
while loop
Tags: python, beginners
Published: 2020-03-04 16:02:00

## Python While Loops

You can use the Python programming to create loops. The most common loops in programming are the *for loop*, *do while loops* and the *while loop*.

So one of those loops is the <a href="https://pythonprogramminglanguage.com/while-loop/">while</a> statement for executing a program loop. Under certain conditions, the same task is repeated.

The basic form:

```python
    while judgment conditions:
        Execute the statement ......
```

Execute statement may be a single statement or a block. The condition can be any expression. If the determination condition is false, the cycle ends.

If you are new to Python, you may like this <a href="https://gumroad.com/l/dcsp">Python course</a>

Performing the following flow chart:

![while loop](https://dev-to-uploads.s3.amazonaws.com/i/a8odm2nvafyc0ucfhxyq.jpg)

Example:

```python
count = 0
while (count <9): 
    print('The count is:', count)
    count = count + 1 
print("Good bye!")
```

Above the output code execution:

```
    The count is: 0
    The count is: 1
    The count is: 2
    The count is: 3
    The count is: 4
    The count is: 5
    The count is: 6
    The count is: 7
    The count is: 8
    Good bye!
```

There are two important statements that can be used in loops:

* `break` is used to exit the loop
* `continue` to *skip this cycle*, 

```python
# Continue and break usage
    
i = 1
while i <10: 
    i += 1 
    if i%2 > 0:
       continue
       print(i) # 2,4,6,8,10 output bis

i = 1
while 1: # 1 cycling conditions must be established
    print(i)
    i += 1
    if i > 10: # 10 out of the loop when i is greater than
        break
```

## Infinite loop

If the conditional statement is always true, infinite loop will execute it, the following example:

```python
var = 1
while var == 1: # This condition is always true, an infinite loop will execute down
    num = input( "Enter a number:")
    print("You entered:", num)

print("Good bye!")
```
Examples of the above output:

```python
    Enter a number: 20
    You entered: 20
    Enter a number: 29
    You entered: 29
    Enter a number: 3
    You entered: 3
    Enter a number between: Traceback (most recent call last):
      File "test.py", line 5, in <module>
        num = input ( "Enter a number:")
    KeyboardInterrupt
```

That's because you enter `num`, but `var` stays the same each cycle.

**Note: The above** infinite loop you can use CTRL + C to interrupt the cycle.

## recycled else statement

In python, you can use `while ... else`, as the example below:

```python
count = 0
while count <5:
    print(count, "is less than 5")
    count = count + 1
else:
    print(count, "is not less than 5")
```

Examples of the above output is:

```
0 is less than 5
1 is less than 5
2 is less than 5
3 is less than 5
4 is less than 5
5 is not less than 5
```

More reading:
* <a href="https://wiki.python.org/moin/WhileLoop">While loops in python docs</a>
* <a href="https://pythonbasics.org/">Learn Python</a>
OpenNMS Horizon 25.2.1 (Gyōza) Released
Tags: news, horizon, release
Published: 2020-04-20 21:02:41

---
title: OpenNMS Horizon 25.2.1 (Gyōza) Released
published: true
date: 2020-03-04 15:53:32 UTC
tags: News,Horizon,Release
canonical_url: https://www.opennms.com/en/blog/2020-03-04-opennms-horizon-25-2-1-gyoza-released/
cover_image: https://i.imgur.com/74fmzvG.png
---

Release 25.2.1 is the sixth release in the Horizon 25 series.

It contains a number of small improvements as well as a few bug fixes and a security  
fix for an HQL injection bug. Hat tip to Johannes Moritz for the security report.

The codename for 25.2.1 is _[Gyōza](https://en.wikipedia.org/wiki/Jiaozi#Gy%C5%8Dza)_.

##### Bug

- [NMS-12473](https://issues.opennms.org/browse/NMS-12473) - Cannot process SNMPv3 Informs due to random Engine ID associated with users
- [NMS-12505](https://issues.opennms.org/browse/NMS-12505) - api/v2/ifservices endpoint does not expose ID and IpInterface in JSON results
- [NMS-12520](https://issues.opennms.org/browse/NMS-12520) - Downtime model change was not updated in the docs
- [NMS-12531](https://issues.opennms.org/browse/NMS-12531) - Topology Map does not show Geocoordinates anymore
- [NMS-12572](https://issues.opennms.org/browse/NMS-12572) - HQL Injection

##### Enhancement

- [NMS-12279](https://issues.opennms.org/browse/NMS-12279) - Cleanup Interfaces Tagged for Flows
- [NMS-12422](https://issues.opennms.org/browse/NMS-12422) - Allow multiple IP rules for discontinuous IP ranges for flow classification
- [NMS-12557](https://issues.opennms.org/browse/NMS-12557) - Support signing code in CircleCI
When you feel like you can't do it...
Tags: wecoded, womenintech, career
Published: 2020-03-04 15:48:16

✨Hey ladies and non-binary friends!✨

What do you do when today is just one of those days? If you're the only software engineer around who's not a cis man, you might get times where you feel like you're not as good as the lads; like you have a mountain to climb in order to prove that they hired the right person; like you can't do it.

I have a huge learning curve ahead of me so I sometimes find myself feeling like that. Today that's not been helped by one of my colleagues standing up and declaring, for the second time, that a mate of his in Brecon shat in a bag the other day and had to take it home with him. This hilarious story was so impressive that he had to tell it twice. Watch out Jimmy Carr, someone's coming for your comedy crown! :crown:

Sometimes I can't help but wonder 'How is is possible that this berk gets paid more than me?'. No amount of eye rolling can help you when it's just one of those days. Luckily for you, I have some practical nuggets that I find help assuage the negativity!

- Go for a wander (outside is best, but simply walking and stretching in the office does me a world of good too)
- Book a meeting room and meditate/do yoga/do pushups
- Make a soothing cuppa
- Ring a loved one
- Write down on a piece of paper what's worrying you and logically evaluate whether there is sufficient evidence to merit worrying about it. Usually there is  not! :smile:

So be kind to yourself. YOU CAN DO IT :rocket:  Are there any practical nuggets you have that can help too?
Easiest Chat-as-a-Service
Tags: discuss, devops, database, security
Published: 2020-03-04 15:41:55

# Use case
I am interested to build a marketplace PWA (progressive web app). I want to use chat as a service.

## Tech stack
- Devops: AWS
- Backend: Django
- Database: PostgreSQL
- Frontend: Undecided, but keeping it as basic as possible

## Top features 
I am looking for in chat as a service:
- Security
  - Only the root user has access to unencrypted messages
  - Service provider shouldn't be able to read them
- Data ownership
  - As a data-driven guy, I will like to own the data, and not the service provider
- Ease of usage
  - Write feature-packed chat with as little code as possible
- Ease of integration
  - SSO (Single Sign on); Able to authenticate and authorize users
- Independent of programming framework / language
  - Since I might change my backend depending on needs

Not sure if there's any software in the market that does it all.

What I have in mind: a code snippet like Google Analytics, where all I need to do is to paste it in my PWA.

## Possible software
- [SendBird](https://sendbird.com/)

:heavy_check_mark: 1st Google result
:heavy_check_mark: Seems easy to use

- [Twilio Programmable Chat](https://www.twilio.com/chat)

:heavy_check_mark: Seems like a very good option as I might need other Twilio services

- [AWS AppSync](https://aws.amazon.com/appsync/)

:heavy_check_mark: I will assume AWS can scale indefinitely and cheaper than the rest for the services provided
:heavy_check_mark: Integrates well with other AWS services
:x: Seems like lots of coding is required

- [Stream](https://getstream.io/)

~~:x: Limited SDK; Only React, iOS & Java~~

See below: https://dev.to/tschellenbach/comment/mm04

I have not tested any of them and wish to hear your experience. Thanks!
python merge string
Tags: python, beginners
Published: 2020-03-04 15:36:37

In <a href="https://python.org">Python</a> you can use <a href="https://pythonbasics.org/variables/">variables</a>. A variable lets you store some data in your program. A most basic variable would be

```python
>>> a = 1
>>> b = 2
```

Variables can have types, the type above is a whole number (integer). One of the other variable types is the <a href="https://pythonbasics.org/strings/">string</a>, these contain character data. Either a character, a word or a phrase. 

```python
>>> s = "Hello"
```

If you want to merge strings, at first thought, of course, you can use + or + = connecting two strings

```python
>>> a = 'a'
>>> b = 'b'
>>> c = a + b
>>> c
'ab'
>>>
```

If the entire program requires only two strings, that is no problem

However, if there exist a large number of strings, or even you need to loop stitching, this time there will be a performance problem

Therefore, I recommend using the `.join` method. If it is not the beginning of some string in place, you can use the temporary list, then join

E.g:

```python
>>> a = 'a'
>>> b = 'b'
>>> c = a.join(b)
>>> c
'b'
>>>
```

To join two strings:

```python
>>> x = " ".join((a,b))
>>> x
'a b'
>>> 
```

To have no space use

```python
>>> x = "".join((a,b))
>>> x
'ab'
>>> 
```
Behind the scenes of Flare (or How to structure big Laravel applications)
Tags: laravel, php
Published: 2020-03-04 15:28:26

At Laracon AU, I gave a talk on how you can structure a big Laravel application. The codebases of both [Flare](https://flareapp.io) and [Oh Dear](https://ohdear.app) served as examples.

By watching this talk you'll gain some valuable insights that could be applicable to your projects as well. Enjoy!

{% youtube A7JEfsUeey0 %}

Here are some of the resources mentioned in the video:

- [Laravel beyond CRUD](https://stitcher.io/blog/laravel-beyond-crud-01-domain-oriented-laravel
)
- [How to handle front-end authorization using Laravel, Inertia and TypeScript](https://freek.dev/1391-how-to-handle-front-end-authorization-using-laravel-inertia-and-typescript)
- [Refactoring to actions](https://freek.dev/1371-refactoring-to-actions)
- [Supercharging common controllers](https://freek.dev/1433-supercharging-common-controllers)
- [Inertia](https://inertiajs.com)
- [How much JavaScript do we really need](https://sebastiandedeyne.com/how-much-javascript-do-we-really-need/)
How to use a MySQL database on GitHub Actions
Tags: testing, laravel, github
Published: 2020-03-04 15:27:20

Recently we started using [GitHub Actions](https://github.com/features/actions) to test [all our packages](https://spatie.be/open-source/packages). You can read more about our general setup in [this blog post](https://freek.dev/1546-using-github-actions-to-run-the-tests-of-laravel-projects-and-packages). 

For most of the packages, this works great. However, some of our packages, such as Laravel Tags, use JSON functions that are not available in SQLite. Luckily it's straightforward to use a database like MySQL in GitHub Actions.

In your test workflow, you need to add `MySQL` to the `services`.


```yml
services:
    mysql:
        image: mysql:5.7
        env:
            MYSQL_ALLOW_EMPTY_PASSWORD: yes
            MYSQL_DATABASE: laravel_tags
        ports:
            - 3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
```

In the step that executes the test, you should add an env variable `DB_PORT`. Laravel uses that environment variable to set up the connection to the database.

```yml
- name: Execute tests
  run: vendor/bin/phpunit
  env:
      DB_PORT: ${{ job.services.mysql.ports[3306] }}
```

In `phpunit.xml.dist` you should add this section.

```xml
<php>
    <env name="DB_CONNECTION" value="mysql"/>
    <env name="DB_USERNAME" value="root"/>
    <env name="DB_DATABASE" value="laravel_tags"/>
    <env name="DB_HOST" value="127.0.0.1" />
    <env name="DB_PORT" value="3306" />
</php>
```

That `DB_PORT` there is used for local tests. On GitHub Actions, it will be overwritten by the port set in the workflow.

And that is all there is to it. Take a look at [the entire GitHub Actions workflow](https://github.com/spatie/laravel-tags/blob/975347a4b03dd7ced4c64000a6210e67e8dd4e41/.github/workflows/run-tests.yml#L28-L36) and [phpunit config file](https://github.com/spatie/laravel-tags/blob/975347a4b03dd7ced4c64000a6210e67e8dd4e41/phpunit.xml.dist#L22-L28), to get a little bit more context where you need to use the code snippets above.
Daily Challenge #201 - Complete the Pattern
Tags: challenge
Published: 2020-03-04 15:18:27

---
title: Daily Challenge #201 - Complete the Pattern
published: true
series: Daily Challenge
description: You have to write a function which returns the following pattern
tags: challenge
---
Implement a function `pattern`, which returns the following pattern for up to `n` number of rows. If n < 1 then it should return `" "` i.e. empty string. There are no whitespaces in the pattern.

Pattern:
1
22
333
....
.....
nnnnnn

###Examples
<pre>
pattern(5):
1
22
333
4444
55555

pattern(11):
1
22
333
4444
55555
666666
7777777
88888888
999999999
10101010101010101010
1111111111111111111111
</pre>

###Tests
`pattern(4)`
`pattern(8)`
`pattern(0.5)`

Good luck!

***
_This [challenge](https://www.codewars.com/kata/5572f7c346eb58ae9c000047) comes from curious_db97 on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Serverless API with AWS SAM, DynamoDB and Buddy
Tags: aws, serverless, devops, javascript
Published: 2020-03-04 15:18:00

Building a scalable application has never been easier. Thanks to AWS Lambda technology, you can run your code in a cloud without the need to maintain servers. In theory, this allows developers to build a serverless API using nothing more than the AWS console.



Thanks to Buddy and its AWS integration, you can enhance this experience even more by applying the CI/CD loop into your process, automating all the deployment commands with a slick and simple pipeline.



[Check out](https://medium.com/better-programming/how-to-build-your-first-serverless-api-with-awss-serverless-application-module-and-ci-cd-8ac67cbd8862) this excellent tutorial by Andrew Bestbier on building a simple serverless API using AWS SAM, DynamoDB, and Buddy.
Seeking Beta Mobile App Feedback for Grocery Shopping
Tags: ios, android
Published: 2020-03-04 15:12:52

Looking for some feedback on a newly developed mobile app.

In a nutshell: Save Recipes, Create Grocery List, Buy From Retailers in-app. App data is shared with household users in near real-time (shared users must be invited).

We welcome any feedback from UI design to Functionality.
In particular, we're looking to sort out any bugs / design flaws.

free to download: www.recipetotableapp.com

Ordering groceries ahead and getting pickup or delivery may prevent you from grocery store aisle rage (why is the tp always gone?).
Joining the Friends of Redgate program 🎉
Tags: sql, redgate
Published: 2020-03-10 00:50:11

---
title: Joining the Friends of Redgate program 🎉
published: true
date: 2020-03-04 15:03:42 UTC
tags: sql, Redgate
canonical_url: https://am2.co/2020/03/friends-of-redgate/
---

I’m super excited to announce that today I was notified that I will be joining the [Friends of Redgate](https://www.red-gate.com/hub/events/friends-of-rg) program! 🎉💃🎊

![](http://am2.co/wp-content/uploads/FORG-2020-red-225x300.png)


### “What’s the Friends of Redgate?” you ask?

Well, the Friends of Redgate is a program for SQL Server Community members who blog/speak/etc within the community. Redgate helps their Friends by providing collaboration opportunities for community activities, and also some VIP insider access to development teams. As a former Product Manager, I know how important it is to allow development teams direct connection to users of the product, to help provide context and feedback to the way the software gets used in the real world–especially since real world use can be different from what the development team or Product Manager _intended_ the product use to be.

> The Friends of Redgate program is a group of influential and active community members, such as popular blog writers, speakers, consultants, as well as Microsoft Data Platform MVPs.

I’m honored that Redgate has welcomed me into the program as a collaborator, and as a Friend. Keep an eye out–I’m hoping I’ll pop up on a Redgate webinare sometime soon!

The post [Joining the Friends of Redgate program 🎉](https://am2.co/2020/03/friends-of-redgate/) appeared first on [Andy M Mallon - AM²](https://am2.co).
Engineering Mathematics Gate Questions
Published: 2020-03-04 14:53:21

https://academyera.com/engineering-mathematics-gate-question

Engineering Mathematics is common and compulsory subject  for all branches in Gate exam  it’s have very high Weightage around 15 marks you will get from this subject. without core subject knowledge by using Engineering Mathematics and Aptitude you can easily qualify in Gate and Engineering Mathematics is very easy to get marks in gate because it is wide subject you already covered this subject in your engineering semesters  so just mug up with basics and start practicing the problems and if you not understand any problem or explanation of the problem you can discuss in discussion form and well get answer for you question Immediately  in discussion forum   and notes also we are providing you can mail us we will send you the notes with previous year questions with explanations our mail id academyera.com@gmail.com and In this Post we are going to provide Engineering Mathematics Gate Questions from all branches include Gate CSE, Gate ECE, Gate Mech, Gate EEE, Gate Civil below are Engineering Mathematics Gate and Isro and other PSU’s Questions arranged in Topic Wise just click the below link corresponding Quiz will be open so Aspirant kindly Practice all this Questions it will help in your gate exam preparation

 

Engineering Mathematics Gate Question  https://academyera.com/engineering-mathematics-gate-question
Matrix Algebra Gate Questions  
Differential Equations Gate Questions  
Complex Analysis Gate Questions
Probability and Statics Gate Questions  
Conditional Probability Gate Questions
Solution of Linear Equations Gate Questions
Integral Calculations Gate Questions
Statistics Gate Questions  
Eigen Values and Eigen Vectors Gate Questions 
Engineering Mathematics and Numerical Analysis Gate Questions
Vector Space Gate Questions 
Limits and Continuity Gate Questions 
Integral Calculus Gate Questions 
Vector Calculus Gate Questions 
Probability Distribution Functions Gate Questions
Conditional Probability Gate Questions
Numerical Methods Gate Questions 
Multivariable Calculus Gate Questions  
Probability Distributions Gate Questions 
Limits & Continuity Gate Questions
 https://academyera.com/engineering-mathematics-gate-question
Seven Day SaaS Challenge
Tags: saas
Published: 2020-03-04 14:25:52

Hey all,

I'm a full-stack developer / entrepreneur, and I just started a community around the idea of building a SaaS MVP in a limited amount of time.

It's called [Seven Day SaaS](https://sevendaysaas.com), and the premise is simple: us developers spend way too much time coding, and not enough time finding product/market fit + launching. So, what if we just compressed the time we spent building into a game-jam-like thing, and then were freed up to spend the rest of our time working on the harder stuff?

This is what I'm trying to do, and I thought it might be a lot more interesting to do it with some likeminded people. If this appeals to you, take a look and please let me know what you think!

https://sevendaysaas.com
Introduce AWS Systems Manager and IAM authentication of RDS
Tags: aws, ssm, rds
Published: 2020-03-04 13:37:48

A last year, I introduced AWS resource to co-workers. 
Then I made a document about the resources and uploaded it to slideshare.
If you would like, you can see that😉

{% slideshare xJXscP1iJWFcyM %}
Dribbble Challenge 01: Keyboard Button
Tags: codepen, css, scss, transform3d
Published: 2020-03-04 13:23:09

<p>So, this is inspired from this: <a href="https://twitter.com/pwign/status/1233002317185576961" target="_blank">https://twitter.com/pwign/status/1233002317185576961</a>.</p>

{% codepen https://codepen.io/shhdharmen/pen/YzXxMLK %}
Daily Developer Jokes - Wednesday, Mar 4, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-03-04 13:00:22

---
title: "Daily Developer Jokes - Wednesday, Mar 4, 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%20Mar%204%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/5e1259d7cf335.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:
I went to a street where the houses were numbered 8k, 16k, 32k, 64k, 128k, 256k and 512k. 

It was a trip down Memory Lane.
 -->