teleren/devto huggingface dataset:
3x essential tests in Symfony application
Published: 2022-07-24 09:33:34

---
title: 3x essential tests in Symfony application
published: true
description: You should be professional in these 3 types of testing in Symfony application
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---

You wanna be a good Symfony developer, so give the time to master the following three testing in Symfony application.


| Type              |                 TestCase (common used)                |                                                                                                                                              description |
| ----------------- | :--------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------: |
| Unit        |       `TestCase`        |        It ensures that individual units of source code (e.g. a single class or some specific method in some class) meet their design and behave as intended |
| Functional  |   `WebTestCase`   |                                                     It checks the integration of the different layers of an application (from the routing to the views). |
| Integration | `KernelTestCase` | It tests a larger part of source code as integrated components. It uses generally the Symfony Kernel to fetch a service from the dependency injection container. |

The simplest way to start any type of tests, is to use `maker bundle`:

```bash

# install the maker bundle
❯ symfony composer req --dev orm maker

# install the test bundle
❯ symfony composer req --dev symfony/test-pack
```

```bash
❯ symfony console make:test

# Which test type would you like?:
#  [TestCase       ] basic PHPUnit tests
#  [KernelTestCase ] basic tests that have access to Symfony services
#  [WebTestCase    ] to run browser-like scenarios, but that don't execute JavaScript code
# >
```
How to Fix Pg_ctl command not found
Published: 2022-07-24 08:59:37



Sometimes after a fresh PostgreSQL install if we want to start or stop from PostgreSQL rather than controlling the PostgreSQL instance start and stop from the root. And when we run the pg_ctl from the command prompt as a PostgreSQL Linux user we see the error bash: pg_ctl: command not found… 

In this article, lets learn how to fix it

As PostgreSQL check your pg base directory 

 

And now add this PostgreSQL to the Linux path so that it’s always available. I would recommand to create a postgresql env. file so that it more easy to handle rather than messing with other systems runing on linux operating system.

see detailed stpes:

https://thedbadmin.com/how-to-fix-pg_ctl-command-not-found/
Single Thread vs Multi Thread
Tags: webdev, programming, tutorial, beginners
Published: 2022-07-24 08:52:38

## Single Thread:

- In this type of programming only one thread runs at a time.
- The single-threaded model uses a polled process event loop.
- CPU time is wasted. Idle time is more.
- It results in less efficient programs.
- When a thread is paused, the system waits until that thread is resumed.

## Multi Thread:

- In this type of programming, multiple threads run concurrently.
- The multi-threaded model does not use a polled event loop.
- CPU time is never wasted. Idle time is minimal.
- It results in more efficient programs.
- When one thread is paused for some reason, other threads run normally.
Leetcode Solution....
Published: 2022-07-24 08:52:00

Hello readers, 
I hope you are enjoying your weekend,
I want to tell you that Thank you...so much for reading my posts regularly!



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aj1xkivyd1fqeamjshgb.jpg)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a6fgzwgb8v6m737zi793.jpg)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0j75c3bsdk6xpkefy55o.jpg)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j8h4wm2nalqgxgjpdd2c.jpg)



Now you can achieve your daily goals at Leetcode.
I created 6-7 rapositories of Leetcode solutions on Github.

please visit that list and don't forget to follow me on Github!


Here is the Link
https://github.com/stars/Chiki1601/lists/leetcode-solution
all( ) and any( ) in Python.
Tags: python, programming, tutorial, beginners
Published: 2022-07-24 08:45:14

Have you heard about the functions in the title before. If not this tutorial is for you. The `all( )` and `any( )` both are inbuilt functions in Python. 

## all( )

The `all( )` returns **true** if all values in the iterable are true or an empty iterable. If any of the values in the iterable is false it returns **false**.

## any( )

The `any( )` is vice versa to the `all( )` function. It returns **true** if any of the values in the iterable is true. In case of empty or all the values in the iterable are false. It returns **false**.



![Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qpewx347ik136r4xqcb2.png)
Maximum difference in an array
Published: 2022-07-24 08:42:08

Today lets look into the maximum difference in an array 
problem 

> find the maximum difference in the array array[j] - array[i],where j>i


we can solve this by using 

1. O(n<sup>2</sup>) 2 for loop method 
2. O(n) efficient solution


lets look into first one 


```
int maxDif(int[] arr) {
    int maxDif = Integer.MIN_VALUE;
    for (int i = 0; i < arr.length; i++) {
      for (int j = i + 1; j < arr.length; j++) {
        if (arr[j] - arr[i] > maxDif) {
          maxDif = arr[j] - arr[i];
        }
      }
    }
    return maxDif;
  }
```
we are going to create maxDif variable and initialise it with 
`Integer.MIN_VALUE`
next we are going to iterate the array using for loop (i loop)
inside that i loop we are going to iterate all the elements present at the right side only due to the condition j>i we are going to start the j loop with i+1, for each element we are going to find the difference and if the difference is greater than the maxDif we will assign that value to it 

> Time complexity:- O(n<sup>2</sup>)


lets look into another method 

```
int maxDifEfficient(int[] arr) {
    int max = Integer.MIN_VALUE;
    int min = Integer.MAX_VALUE;
    for (int i = 0; i < arr.length - 1; i++) {
      max = Math.max(max, arr[i + 1]); 
      min = Math.min(min, arr[i]);
    }
    return max - min;
  }
```
the logic behind this method is max difference is possible if we subtract between the largest number and the smallest number 
so we need to find the largest and smallest number in the array with j>i condition
here we are trying to solve the problem in O(n) for that we are using min and max variables with values `Integer.MAX_VALUE`, `Integer.MIN_VALUE` respectively 
we iterate the array find which is the max and min value 

we find max using Math.max(max,arr[i+1]); here j is i+1 since i+1 is greater than i we satisfy the j>i condition 

and we find the min using Math.min(min,arr[i])

once the loop is completed we will have the largest and smallest number in the array with respect to j>i condition and we can subtract that to find the maximum Difference.
 

> Time complexity:- O(n<sup>2</sup>)
Ghostfolio meets Internet Identity
Tags: finance, internetidentity, opensource, web3
Published: 2022-07-24 08:29:21

[Ghostfolio](https://ghostfol.io), the web-based personal finance management software, supports passwordless authentication as of now thanks to the integration of [Internet Identity](https://identity.ic0.app). This blockchain authentication system enables you to sign in securely and anonymously to Ghostfolio. With this latest update, Ghostfolio is ready for Web3.

> Track your portfolio without being tracked

To avoid the security issues that arise with password authentication on the traditional web, the [Internet Computer](https://internetcomputer.org) blockchain by [dfinity](https://dfinity.org) has introduced a new cryptographic authentication system. It is called _Internet Identity_ and is as convenient to use as Web2 [OAuth](https://en.wikipedia.org/wiki/OAuth) ("Open Authorization") providers like _Google Sign-In_ or _Facebook Login_.

## How to use Internet Identity?

_Internet Identity_ is based on the [WebAuthn protocol](https://en.wikipedia.org/wiki/WebAuthn) and uses secure cryptographic authentication. It provides three options to authenticate yourself:

- The built-in biometric authentication methods of your smartphone or laptop (fingerprint sensor, _Face ID_, _Touch ID_)
- The password or pin to unlock your computer or mobile phone
- A security key plugged into the USB port of your computer

When you authenticate with _Internet Identity_, the service only gets a dedicated pseudonym rather than sensitive user data like the email address or phone number. This preserves your anonymity and prevents you being tracked on the Internet.

## The key benefits in a nutshell

- Authenticate yourself securely without the need of an email address, username, or a password: all you need is your device to log in.
- Built-in recovery mechanisms to ensure you are not locked out of any service that requires the _Internet Identity_.
- Log in to various Internet services without being tracked by big tech companies.

If you would like to provide feedback or get involved in further development of Ghostfolio, please get in touch on Twitter [@ghostfolio_](https://twitter.com/ghostfolio_).

I look forward to hearing from you.
Thomas from Ghostfolio
A Quick 10-Second Programming Joke For Today
Tags: jokes, dailydeveloperjokes
Published: 2022-07-24 08:00:01

---
title: "A Quick 10-Second Programming Joke For Today"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e125905d1ad3.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_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 programmers always mix up Halloween and Christmas?

___A:___ Because 31 OCT == 25 DEC
 -->
Universe will collapse before you need BIGINT for milliseconds in JavaScript
Tags: javascript, typescript, sql, postgres
Published: 2022-07-24 07:34:00

In SQL databases you can store whole numbers in primarily as `SMALLINT 2¹⁵-1`, `INTEGER 2³¹-1` and `BIGINT 2⁶³-1`, always wondered why not just `INT`🧐. `SMALLINT` is too small, `INTEGER` for milliseconds is just 49.7 days, so we're left with `BIGINT` and here come the tricky part - JavaScript numbers.

> The MAX_SAFE_INTEGER constant has a value of 9007199254740991 (9,007,199,254,740,991 or ~9 quadrillion). The reasoning behind that number is that JavaScript uses double-precision floating-point format numbers as specified in IEEE 754 and can only safely represent integers between -2⁵³+1 and 2⁵³–1.
> For larger integers, consider using BigInt.

Who likes bigint in JS? You have to transform numbers to bigints before you can operate with them, you can't just pass bigint to an API JSON response, they're tricky. Those are exact problems my teammate faced on the project recently. So what to do?

We can assume that we'll never surpass a 2⁵³ milliseconds in any foreseeable future. I was roughly calculating with him on the phone call and I was under impression it's going to be more than a lifespan of the universe, which is **~13.4 billion** years, but when I got to the keyboard I've found out that it's just **285 427 years**. This number it's that dramatic, but it's more than enough to let people of the future debug the code searching for why your service messes up dates on the webpage.

That is exactly why we created a configuration for bigints and bigserials in [DrizzleORM](https://www.npmjs.com/package/drizzle-orm) so you can automatically enjoy the numbers-land
```typescript
bigserial("will_be_number", maxBytes: "max_bytes_53");
bigserial("will_be_bigint", maxBytes: "max_bytes_64");
```

thanks!
My Portfolio created using React & GSAP
Tags: react, gsap, threejs, javascript
Published: 2022-07-24 07:19:00

hello guys, i'm building my portfolio website using - React, GSAP & ThreeJS - at the moment i'm about to include THREE.js in the modal that appears, to render project details on the various techs...
i need someone to scrutinize it, what should i change or what can i do better . here it is ::: 

[https:://www.andaeiii.co](https:://www.andaeiii.co)

---i'd be waiting for your comments section... #thanks.
ReactJS Replace
Tags: reactnative, react
Published: 2022-07-24 06:47:46

Hello,

I am new here and I have a question.

Is it possible in a string e.g. "Hello how are <b>you</b>?" make the text between the <b> bold? The text should be variable, so it's the only way. The text comes from a JSON file.

Is that possible? I can't find anything on the internet. Thanks!
What is UI/UX Design and why it matters.
Tags: uiweekly, ux, ui
Published: 2022-07-24 06:20:48

 Have you ever tried closing a pop-up ad but the button was too small ? Yes , unfortunately we've all been there. 

**User Experience Design** is a subject that most of us know little about but makes all the difference in our tastes and preferences in Products.

In this _3-minute blog-post_, we'll have a little chat about UI/UX Design. Although the words UI/UX are used commonly together UI or _**User Interface is how a product looks **_ while _**UX , User Experience is how a product feels and functions.**_ Both halves are at the core of any great product.

 A U_I Designer is responsible for designing visually and aesthetically pleasing designs_ that communicate the style and vibe of a product , it does not make sense to have a video-game website with a cooperate themed style, while a _UX Designer is responsible for the user's journey and experience in a Website or Mobile Application._ What happens when a button is pressed , what is the first thing a user should see when the Application loads.To explore a more comprehensive dive into the two fields check this [link](https://medium.com/beakerandflint/an-introduction-user-experience-design-2a7f8167bf03#cec0).

 In User Design , we have some _laws of design_ that are collections of best practices designers consider when building user interfaces.For instance Fitt's law describes the time to acquire a target is a function of the distance to and size of the target.

This translates to how fast users can access and identify important features in your Application like the Call to action Button based on its size and colors and explains why I can't seem to find the unsubscribe button in most Websites. Here is a link to more on the [Laws of UX Design](https://lawsofux.com/en/).

We've covered the basic understanding of UI/UX ,differences between UI and UX Designers and as well as the laws of UX design. I'll be writing a series on UI/UX Design ,getting into more in-depth topics in the future. Have a Wonderful Day.
ibus not working with Flatpak apps
Tags: telegram, ibus, flatpak
Published: 2022-07-24 06:17:00

# Quicknote

Set env variable correctly. 

Here is one example.

`flatpak run --env=GTK_IM_MODULE=ibus org.telegram.desktop`

Here is another example. This looks like a permanent fix to me.

`sudo flatpak override --system --env=GTK_IM_MODULE=ibus`

Other possible variables, Showing ~/.bashrc format just adapt like above example
```
#export GTK_IM_MODULE=$im 
#export QT_IM_MODULE=$im 
#export XMODIFIERS=@im=$im 
#export INPUT_METHOD=$im 
#export SDL_IM_MODULE=$im
```

## Credits
https://github.com/flatpak/flatpak/issues/1671#issuecomment-437288456
ibus not working on kde apps
Published: 2022-07-24 06:09:00

## Quick Note

-  Append following content in these files, ~/.bashrc or ~/.bash_profile or ~/.xprofile.

`export LANG="en_US.UTF-8"
export XMODIFIERS="@im=ibus"
export GTK_IM_MODULE="ibus"
export QT_IM_MODULE="ibus"`

Note:- You may need to logout and login again to this to work.

In some cases, reboot might be needed.
Build a Messenger Clone with MERN Stack (MongoDB, Express, React, Node JS) + Socket.io (Day 11)
Tags: react, javascript, webdev, beginners
Published: 2022-07-24 05:53:17

In this Facebook Messenger Clone Tutorial series, we will learn to build an Awesome Full Stack Facebook Messenger Project with realtime messaging functionality with socket.io . We have one on one chat as well as group chatting functionality in this app.

In this video,we will learn how to create Facebook  Register Page in react

{% youtube RDdhEmTXS2A %}
Worker threads made easy
Tags: javascript, npm, nodej, threads
Published: 2022-07-24 05:51:00

Create and execute tasks in real cpu threads other than the main one. (ES6 imports for now) Threadman doesn't use any dependencies. It's based on workers.


# Installation
```
npm i threadman
```


<br />

# Syntax

```js
new Thread(fn, args, options).run(callback)
// Or
new Thread(fn, args, options).run().then(callback)
```

<br />

# Basic usage

```js
import { Thread }     from 'threadman'

let number = 10

const fn = (number) => number + 20
const callback = (result) => number = result
const args = [number]

new Thread(fn, args).run(callback)

// Or a callback function can be passed as third argument like below
new Thread(fn, args).run().then(callback)

```
After you get the result you can access main scope again and reassign variables.

<br />
Hacking is dangerously easy.
Tags: discuss, security, beginners, todayilearned
Published: 2022-07-24 05:41:00

> _At no point did I use this program for malicious purposes, and so should you. Don't ever attempt to hack someone unless given permission to do so._

## So, yep.
I was browsing around this thing called the internet and thought: why don't I try exploiting stuff?
<br>
### And so...
I searched a YouTube video on stuff and I saw some "wifi hacking with python". What was I doing? I was wasting time. But what I found in that process was scary.
<br>
### We can't trust ourselves.
When hackers do hacker stuff, the main goal of it, and the biggest challenge, is to get access to your computer. As in, to be able to control it.
<br>
The thing about computers that it can TELL the user the info about itself. So all a hacker needs to do to know everything about you, is to pretend to be you using the computer.
<br>
So, if we know our commands well, we know that `ipconfig` gives us our IP address. But, we don't need it too much unless we are a developer. And, that IS the danger.
<br>
I had learnt how to get a wifi password from a local computer, and I realized something. Nobody can see it except me. To a certain extent. That is, if nobody plugs in a thumbdrive that contains an .exe file that has a three - liner python code. Yep. That short. It can then send emails and stuff to me which can then get me the wifi passwords of said human.
<br>
### Since I'm a good boy,
I did not use the script on malicious purposes (except for the time my friend dared me to hack into his wifi in which I tried to but failed as he did not have a python interpreter) and the script which I used did not pose any threat, I was fine. But, That was how EASY I could get someone's passwords. All because of our system which needs those passwords to support themselves.
<br>
### In conclusion?
Don't go plugging in thumbdrives, opening spam mail or NOT have an antivirus. These are especially dangerous as we developers know, that there is no limit to code. Anything is possible. So, stay safe everyone. Also, tell me if you've been hacked before 👻, mind sharing your experiences?
How freelance developers get new clients regularly?
Tags: freelance, career, help, discuss
Published: 2022-07-24 05:40:22

---
title: How freelance developers get new clients regularly?
published: true
description: want to know how yo get clients regularly 
tags: freelance, career, help, discussion 
cover_image: https://i.ibb.co/PQGZwrB/pexels-tranmautritam-251225.jpg
---

Hi freelance developers, can you share your experiences about 'how you get new clients regularly'?

I work on Upwork and Fiverr. So, they are handling the client management for me. And, for that freelancers are paying 20% of the work price. 

Without any platform, how do you get a client?
How to Write HTML Comments
Tags: html, webdev, beginners, tutorial
Published: 2022-07-24 05:32:00

## The HTML Comment Tag

A comment in HTML is text that is encased in the `<!╌` and `╌>` tags. By using this technique, you can inform a browser that some elements are comments and shouldn’t be displayed on the front end.

```html
<!-- Write your comments here -->
```

Comments in HTML start with `<!╌` and end with `╌>`. Notice that there is an exclamation point (!) in the start tag, but not in the end tag.

## When to Use HTML Comments

When creating source code, leaving comments is an excellent habit to get into. Comments allow you to communicate with yourself about your code and thought process. When you return to a project after a period of time without working on it, it also reminds you of what you were thinking or doing.

You can communicate with other developers who are working on the same project as you by leaving comments. They can understand your intentions for adding specific lines of code from your comments.

## How to Write Single-Line Comments in HTML

Only one line can contain a single-line comment. That line will not be displayed in the browser, as was already explained.

```html
<!-- You will not be able to see this text. -->
<p>You will be able to see this text.</p>
```

## How to Write Inline Comments in HTML

A sentence or line of code can also have comments added in the middle of it.

The text outside of the `<!-- -->` will remain unaffected, just the text inside of it will be commented out.

```html
<body>
    <p>I am <!-- going to be --> a frontend developer.</p>
</body>
```

## How to Write Multi-Line Comments in HTML

Although we have only seen single-line and inline comments up to this point, HTML also enables multi-line comments.

The comment beginning tag (`<!--`) and ending tag (`-->`) put before the first line and end of the last line, respectively, as demonstrated in the example given below, allow you to comment on several lines.

```html
<body>
    <!--
        This is a multiline comment and it can
        span through as many as lines you like.
    -->
    <p>Document content goes here...</p>
</body>
```

## Keyboard Shortcut for Adding HTML Comments

You can use shortcuts to quickly add comments, and you’ll probably find yourself doing so frequently. For Mac users, the shortcut is Command /; for Windows and Linux users, it is Control /.

Learn more about HTML by reading the following articles on my website:

[How to write “Hello World” in HTML](https://maxlockwood.dev/hello-world/)
[What is an HTML Document’s Basic Structure?](https://maxlockwood.dev/basic-html-document-structure/)
[What is an HTML Element? How do you create one?](https://maxlockwood.dev/what-are-html-elements/)

Want to learn more about the basics of HTML? then follow this link to MDN Web Docs – [HTML basics](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/HTML_basics)
Day 51-55 of coding complete
Tags: webdev, beginners, programming, 100daysofcode
Published: 2022-07-24 05:15:07

#100DaysOfCode #100daysofcodechallenge Day 51-55 complete. Posting an update now after a busy week. I was able to finished styling the technical documentation page better. There could always be improvements but I want to continue learning. 60% done!