Skip to main content

Posts

Adding a new line in a String - Using ReactJS

Let's suppose you get from an API a string like this: { "text" : "FEATURES\n•Contrary to popular belief, Lorem Ipsum is not simply random .\n•BC, making it over 2000 years old. Richard McClintock, a Latin .\n•There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form.\n•If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text." } and you want to print it like this: FEATURES •Contrary to popular belief, Lorem Ipsum is not simply random . •BC, making it over 2000 years old. Richard McClintock, a Latin . •There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form. •If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text . to do so it is quite easy,...

Gmail issue for apps

We've got sometimes troubles for sending emails using our backend APIS for sending emails and even if you've got the Less secure app access enabled  it just doesn't allow you to send any emails from your backend side so do this in that case: read this Google Help ( https://support.google.com/mail/answer/14257?p=client_login&rd=1 ) Open your web browser and sign in to Gmail at  http://mail.google.com/mail . If you see a word verification request, type the letters in the distorted picture and finish signing in. Close your browser and try accessing your messages in your email client again. If you're still having problems, visit  http://www.google.com/accounts/DisplayUnlockCaptcha  and sign in with your Gmail username and password. If necessary, enter the letters in the distorted picture. Click Continue. Restart your mail client and try accessing messages in your email client again.

How to enable remote access on MySQL under Linux Ubuntu

If you need for development purposes expose a database remotely, you can do it with the next steps: Edit the file  /etc/mysql/my.cnf , and change the binding address to  0.0.0.0 (EDIT: 2019-04-04, you may also update the file  /etc/mysql/conf.d/mysql.cnf , for a newer version of MySQL. Thanks for Dawood pointing out.) 1 bind-address = 0.0 .0 .0 then restart MySQL server 1 $ sudo /etc/i nit.d /mysql restart Create a new user for any host in MySQL CREATE USER 'foo'@'%' IDENTIFIED BY 'your-awesome-pass'; # grant privileges to table(s) GRANT ALL PRIVILEGES ON db_name.* TO 'foo'@'%' WITH GRANT OPTION; NOTE: bear in mind that  'foo'@'localhost'  &  'foo'@'%'  are considered as a different user, you may have 2 different passwords for each of them. Rember this procedure should be only used for development purposes not for production. to check it out, open a terminal and r...

Basics about ResponseEntity to maniputale HTTP Response

ResponseEntity   represents the whole HTTP response: status code, headers, and body . Because of it, we can use it to fully configure the HTTP response. If we want to use it, we have to return it from the endpoint; Spring takes care of the rest. ResponseEntity  is a generic type. As a result, we can use any type as the response body: 1 2 3 4 @GetMapping ( "/hello" ) ResponseEntity<String> hello() {      return new ResponseEntity<>( "Hello World!" , HttpStatus.OK); } Since we specify the response status programmatically, we can return with different status codes for different scenarios: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 @GetMapping ( "/age" ) ResponseEntity<String> age(    @RequestParam ( "yearOfBirth" ) int yearOfBirth) {          if (isInFuture(yearOfBirth)) {          return new ...