teleren/devto huggingface dataset:
Terrible tips for a C++ developer
Tags: programming, cpp, beginners, books
Published: 2023-06-29 14:39:48

Let's talk about bugs and bad coding practices. There are many guides on this topic. I would like to recommend an interesting and non-standard compilation of terrible tips. Andrey Karpov, the author of fascinating articles about C++, has published a mini-book - "60 terrible tips for a C++ developer". This is a case when reading about programming is both useful and entertaining.

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


The book can come in handy not only for C++ developers, it has some general "tips" for all programmers. It is especially useful for beginners who want to know what is right and what is wrong.

Each terrible tip is brief and easy to understand. And the main thing is that everything is based on some real-life cases. It's not just a list of terrible tips, but a practical guide that helps developers avoid typical coding mistakes

Here are some fragments from the book that made me smile me:

**Terrible tip N6. Invisible characters.**
The author has a point that using them in your code makes things magical, and it's "cool." That sounds like fun. But seriously, such character sequences can cause the developer and the compiler to interpret the code differently.

**Terrible tip N21. Professionals do not make mistakes**
The point here is that there are experts who understand better than anyone else how to code and how to test. But in fact, they are subjected to a cognitive bias — "illusory superiority" — just like all of us, honestly. In general, all developers need to check their code.

**Terrible tip N51. For as long as possible, resist using the new C++ standard**
It is better and more efficient to switch to a new version of the language, but some developers may say that they stick to the old standard just in case. They say this is because someday their project may be in demand on platforms with outdated compilers. However, this may never happen. The tip may seem obvious, but it would be a good idea for developers to think about it again.


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



In addition to such tips, there are some points that show how to avoid typical bugs and create a clean and reliable code.

To summarize, I would describe this mini-book as informative, entertaining, and easy to understand. 

**You can find the full version of the book** [here](https://pvs-studio.com/en/blog/posts/cpp/1053/)
How to use Firebase Emulator suite for Flutter
Tags: flutter, firebase, dart
Published: 2023-06-29 14:38:25

---
title: How to use Firebase Emulator suite for Flutter
published: true
description: 
tags: #flutter #firebase #dart
---

The Firebase provides an emulator suite for the local dev environment. The suite allows us to run the Firebase on the local machine. So, we can locally use Cloud Firestore, Realtime Database, Cloud Storage for Firebase, Authentication, Firebase Hosting, Cloud Functions (beta), Pub/Sub (beta), and Firebase Extensions (beta) for the app we are working on.

More detail can be found at https://firebase.google.com/docs/emulator-suite

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

## Pre-Requisite

The Flutter project is initialized for the Firebase: https://firebase.google.com/docs/flutter/setup

## Install the Emulator Suite

Setup the Emulator Suite with this command under the project directory:
```bash
firebase init emulators
```

## Start the Emulator Suite
```bash
firebase emulators:start
```

## Run the Flutter app using the Emulators

Add this lines of code in the `main()` in `main.dart`
```dart
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // Initialize Firebase
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  // Use Firebase Emulators
  if (kDebugMode) { // Only for debug mode.
    try {
      final emulatorHost = defaultTargetPlatform == TargetPlatform.android
          ? "10.0.2.2"
          : "localhost";
      FirebaseStorage.instance.useStorageEmulator(emulatorHost, 9199);
      FirebaseFirestore.instance.useFirestoreEmulator(emulatorHost, 8080);
    } catch (e) {
      // ignore: avoid_print
      print(e);
    }
  }
  // Start Flutter Application
  runApp(const MyApp());
}
```

The code example makes the app use FireStorage and Firestore Emulators in debug mode. It also provides Web UI(http://localhost:4000) for easy inspection.
Server Side Pagination with Nodejs and MongoDB
Published: 2023-06-29 14:37:53

While developing web application there may be situation where we have millions of data and we need to show the data with limited data at once. So for handling such situation we use serverside pagination, So now we are going to discuss the same while using nodejs and monodb at backend.

So let's have a look on our code **(server.js)**,

``````let express = require('express'),
    mongoose = require('mongoose');
let Coin = require('./coins');
       mongoose.connect('mongodb://localhost:27017/myapp_live', function(err, db) {
           if(err) throw err;
           console.log('database connected successfully');
       });
       var app = express();
       app.get('/', function(req, res) {
           res.send('<h3>welcome to server side pagination demo</h3><br><h3>Enter any url containing <b>/coins/page_no/per_page</b></h3>');
       });
       app.get('/coins/:page/:perPage', function(req, res) {
           console.log('page number : ' + req.params.page); 
           console.log('per page : ' + req.params.perPage);
           var pageNo = req.params.page ; // parseInt(req.query.pageNo)
           var size = req.params.perPage;
           var query = {}
           if (pageNo < 0 || pageNo === 0) {
               response = { "error": true, "message": "invalid page number, should start with 1" };
               return res.json(response)
           }
           query.skip = size * (pageNo - 1)
           query.limit = parseInt(size)
           // Find some documents
           Coin.find({}, {}, query, function (err, data) {
               // Mongo command to fetch all data from collection.
               if (err) {
                   response = { "error": true, "message": "Error fetching data" };
               } else {
                   response = { "error": false, "message": data };
               }
               res.json(response);
           });
       });
       app.listen(3000, function(req, res) {
           console.log('server started on port : 3000');
       });``````
 
In the above code we have created app with **express** and then created connection with data using mongoose. After that we have fetched the current page of data so that data for the page can be fetched accordingly. And after finding the current page and size of the record we passed that data into mongoose model so that data can be fetched accordingly. 


After installing all the dependencies of the app, start the application with **node server.js** and type **http://localhost:3000/coins/1/20. 
**
We will get data on the page like below


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

Pretty cool! Finally, our task completes here.

That’s all for now. Thank you for reading and I hope this post will be very helpful.

Let me know your thoughts over the email **demo.jsonworld@gmail.com. **I would love to hear them and If you like this article, share with your friends.

This article is originally posted over [jsonworld](jsonworld.com)
Ruby Method of the Day: String#=~
Tags: ruby, regularexpression, string, rubymethodoftheday
Published: 2023-06-29 14:32:25

---
title: Ruby Method of the Day:  String#=~
published: true
description: 
tags: ruby, regularexpression, string, rubymethodoftheday
---

Method [String#=~](https://docs.ruby-lang.org/en/master/String.html#method-i-3D~) searches string `self`, looking for the given argument (Regexp or other object).

When the argument is a regexp, the method returns the integer index of the first substring that matches the regexp, or `nil` if no match.

But that's only the beginning.  The method also sets a number of global variables that give more details:

- `$~`: Returns a [MatchData](https://docs.ruby-lang.org/en/master/MatchData.html) object, or nil.
- `$&`: Returns the matched part of the string, or nil.
- <tt>$`</tt>: Returns the part of the string to the left of the match, or nil.
- `$'`: Returns the part of the string to the right of the match, or nil.
- `$+`: Returns the last group matched, or nil.
- `$1`, `$2`, etc.: Returns the first, second, etc., matched group, or nil. Note that `$0` is quite different; it returns the name of the currently executing program.

See examples at [Regexp Global Variables](https://docs.ruby-lang.org/en/master/Regexp.html#class-Regexp-label-Global+Variables).

[Yes, I've copied shamelessly from the official documentation for regexp global variables.  But I don't feel bad;  I _wrote_ that documentation (as well as the documentation for `String#=~`).]

More methods at [#rubymethodoftheday](https://dev.to/t/rubymethodoftheday).
A Free and Promising Alternative to Midjourney AI ? Generate Stunning Images with AI 🔥 🚀
Tags: ai, design, productivity, beginners
Published: 2023-06-29 14:28:10

In the rapidly advancing world of artificial intelligence (AI), image generators have carved a niche for themselves by transforming simple text prompts into visually stunning images. Among these AI-powered tools, Midjourney and Leonardo AI have garnered considerable attention for their impressive capabilities. This article will delve into the features of Leonardo AI, a free alternative to the well-known Midjourney, and discuss how it compares with its counterpart.

## Introduction to Leonardo AI
[Leonardo AI](https://leonardo.ai/) is a relatively new entrant in the AI image generators scene, but it has quickly gained popularity due to its robust models that generate high-quality images, rivalling those produced by Midjourney. Developed primarily for generating game assets, Leonardo AI provides multiple artistic tools to quickly create production-ready visual assets

**YES!, the blog image is generated with Leonardo AI**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7qps6y1z6pa2y3jdzx3t.png)


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



## Leonardo AI VS Midjourney
Midjourney has been a major player in the AI image generators market for a while, known for its high-quality image output. It operates on the Discord chat app, making it easy to use without requiring any additional hardware or software. Contrarily, Leonardo AI offers a more user-friendly approach with its own dedicated website. 

While Midjourney excels in creating images with incredible detail and overall cohesiveness, Leonardo AI stands out with its additional tools like object removal, changing backgrounds, and enhancing images.

Despite being a newcomer, Leonardo AI has a few distinct advantages over Midjourney. Firstly, it is free Up to 150 (768x768) generations per day to experiment with the tool. Secondly, it offers a more user-friendly interface where even a novice can easily navigate and generate images. 

Choosing between Leonardo AI and Midjourney largely depends on individual requirements. While Midjourney has its strengths, Leonardo AI is a compelling free alternative with a host of valuable features. With its easy-to-use interface, personalization options, and a wide array of tools, Leonardo AI is a promising contender in the AI image generators market.
Start Prolog with Docker
Tags: prolog, docker, programming, tutorial
Published: 2023-06-29 14:12:39

Prolog is a programming language that was born in 1972 and known as a logic programming language.

To run Prolog programs on your computer, using docker is the easiest way. It helps you set up and manage the environment.

Assuming that you already have docker installed, pull the SWI-Prolog Docker image by running the following command:
```
docker pull swipl
```
and run a container
```
docker run --name swipl -it swipl /bin/bash
```
After that in a docker container you started, create a Prolog code. For example:
```prolog
likes(sam, lisa).
likes(sam, james).
likes(jiro, james).
```
and save it as `main.pl`

And then load your Prolog code by running
```
swipl main.pl
```

In the terminal, you will see a prompt like below

```
root@4d1dad014ee6:~# swipl main.pl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.10)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- 
```

You can now type Prolog queries at the prompt and receive answers. For example, try:

```
?- likes(X, lisa).
```
The Prolog interpreter will provide the answer:
```
X = sam.
```

Enjoy exploring Prolog!
Rumour: Bazaars BZR to Launch on Tier 1 and Tier 2 Exchanges
Tags: cryptocurrency, bazaars, bzr, nasdaq
Published: 2023-06-29 14:10:05

There is a rumour circulating that Bazaars BZR, a decentralized marketplace built on the Ethereum blockchain, is planning to launch on tier 1  and tier 2 exchanges. Tier 1 exchanges are the largest and most well-known cryptocurrency exchanges in the world. If Bazaars BZR is able to list on these exchanges, it would be a major milestone for the project and could significantly increase its user base and trading volume.
The rumour was started by a post on the Bazaars BZR subreddit. The post claimed that a source within the Bazaars BZR team had confirmed that the project was planning to list on tier 1 and tier 2 exchanges in the coming weeks. The post also claimed that the exchanges were Bitmart, MEXC, Kucoin and Binance.
Bazaars BZR has not yet made any official announcement about listing on any exchanges. However, the project has been growing in popularity in recent months. In April, Bazaars BZR was listed on CoinMarketCap and its price has ranged between $1.28 - $1.12.
If Bazaars BZR is able to list on tier 1 exchanges, it would be a major milestone for the project. It would increase the project's visibility and accessibility to a wider audience. It would also increase the project's liquidity and trading volume. This would be beneficial for both buyers and sellers on the Bazaars BZR platform.
Of course, there is no guarantee that Bazaars BZR will be able to list on tier 1 exchanges. The exchanges have their own criteria for listing projects, and Bazaars BZR may not meet their requirements. However, the rumour is a positive sign for the project and suggests that it is making progress towards its goal of becoming a major player in the decentralized finance (DeFi) space.
Here are some additional details about the rumor:
The source of the rumor is anonymous.
There is no official confirmation from Bazaars BZR that the rumor is true.
The rumor could be false or it could be based on inaccurate information.
It is important to note that the rumor is just that - a rumor. There is no guarantee that it is true. However, the rumor is a sign that there is interest in Bazaars BZR and that the project is on the right track.
Convert SVG into PNG in the browser using Resvg
Tags: webdev, javascript, beginners, programming
Published: 2023-06-29 14:05:09

To convert SVG into PNG in the browser, you can use the [Resvg-js](https://github.com/yisibl/resvg-js) wasm module.

## Setting up the project

1. Create an `index.html` file and fetch `resvg-wasm` module.
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img id="output">
    <script src="https://unpkg.com/@resvg/resvg-wasm"></script>
</body>
</html>
```
2. Create an `index.js` file and link it to the `index.html` file.
```html
<script type="module" src="./index.js"></script>
```

## Working with Resvg-wasm

Inside the `index.js` file, I am using an [IFEE function](https://developer.mozilla.org/en-US/docs/Glossary/IIFE) expression. You can also add some event handlers to invoke javascript functions. But for simplicity, the code inside `index.js` will run immediately when the page loads.

1. First, initialize the `resvg-wasm` module using the `initWasm` method.

```js
await resvg.initWasm(
    fetch("https://unpkg.com/@resvg/resvg-wasm/index_bg.wasm")
  );
```
2. Now defining some options. You can check out for more options in the documentation.
```js
const opts = {
    fitTo: {
      mode: "width", // If you need to change the size
      value: 800,
    },
  };
```
3. This is the final part. Convert an SVG image into a PNG image using `resvg-wasm`
```js
const svg ='<svg>...</svg>'; // Input SVG, String or Uint8Array
  const resvgJS = new resvg.Resvg(svg, opts);
  const pngData = resvgJS.render(svg, opts); // Output PNG data, Uint8Array
  const pngBuffer = pngData.asPng();
  const pngURL = URL.createObjectURL(
    new Blob([pngBuffer], { type: "image/png" })
  );
  document.getElementById("output").src = pngURL;
```
4. Wrap the code inside an IFEE to invoke immediately on page load.
```js
(async function () {
	await resvg.initWasm(
    fetch("https://unpkg.com/@resvg/resvg-wasm/index_bg.wasm")
  );

	const opts = {
    fitTo: {
      mode: "width", // If you need to change the size
      value: 800,
    },
  };

	const svg ='<svg>...</svg>'; // Input SVG, String or Uint8Array
  const resvgJS = new resvg.Resvg(svg, opts);
  const pngData = resvgJS.render(svg, opts); // Output PNG data, Uint8Array
  const pngBuffer = pngData.asPng();
  const pngURL = URL.createObjectURL(
    new Blob([pngBuffer], { type: "image/png" })
  );
  document.getElementById("output").src = pngURL;
})();
```
**Further read:**
- [Generate images from HTML markup using Satori](https://hrishikeshpathak.com/tips/generate-image-from-html-satori/)
- [Convert SVG into PNG in Cloudflare worker](https://hrishikeshpathak.com/tips/convert-svg-to-png-cloudflare-worker/)
Dealing with self-imposed boundaries in tech
Tags: beginners, discuss, codenewbie, community
Published: 2023-06-29 13:59:31

I want to talk about **self-imposed boundaries and how transitioning into tech can be scary**. I remember hiding in a bathroom stall, frozen with fear from a crowded hackathon room. I recall finding an excuse to not car-pool with co-workers from being terrified of being enclosed in a space with others. This created a self-imposed boundary of avoidance and silence to deter anxiety that resulted in being alone. 


Last year, I did something that scared me. I attended a tech conference, [Magnolia.js](https://www.magnoliajs.com/). Guess what, it was wonderful. Literally the sun was shining and I saw butterflies outside the venue. I learned a lot, saw many of my tech heroes, and was inspired to dream bigger. Even more, I crossed a boundary and the world didn’t crash or those preconceived demons didn’t flare up. 


Someone recently inspired me to explore **my self imposed limits**. To consider that as we get older, how we deal with those boundaries should change. An older aunt explained to me how she combats anxieties with prayer, courage to “Do it Afraid '', and understanding that whatever she is afraid of more than likely will not happen. 


We have to reason with our fear and question why “we can’t” (because we can). Examples of self-impose limits:

#### ◼ I’m not smart enough.
First, you are smart enough. Second, transitioning into the tech industry isn’t about smarts but passion, dedication, and resilience. 

#### ◼ This isn’t for people that look like me or come from my neighborhood.
People from every shape, color, creed, disability, and whatnot are in tech breaking barriers. If they can, then you can. 

#### ◼ I didn’t go to college.
College is not required for every opportunity. The only real requirement is showing the value you can deliver. 

#### ◼ My experience isn’t in the tech industry, it’s not transferable.
Domain knowledge is an asset. Tech isn’t about code. It’s about problem solving which if you have work anywhere you have it. 

#### ◼ I’m too old.
Let’s turn this around, you have tons of wisdom (aka more value)


My question to you, _what is a self imposed boundary or limit that you want to conquer or have conquered?_ Share it in the comments so others can either benefit or realize “We aren’t alone”.


This was written to the background song of Blackway & Black Caviar - "What's Up Danger" (Spider-Man: Into the Spider-Verse)
Hero Section Design Using Figma Step by Step
Published: 2023-06-29 13:51:03

{% youtube F0TJw1pNa9s %}
Hi guys, today we want to show Business Landing Page Design Using Figma Step by Step | Figma Tutorial Please, if you love it, support us with Like & Subscribe.🙏🙏❤️❤️
In today's fast-paced digital world, financial technology, or fintech, has become an essential part of our lives. From online banking to mobile payments, fintech solutions have revolutionized the way we manage our finances. And when it comes to promoting your fintech solutions, having a well-designed fintech landing page is crucial.
A fintech landing page is a standalone web page designed to promote a specific financial technology product or service. It's the first point of contact between your business and potential customers, and as such, it needs to be optimized for search engines to attract organic traffic.
To create an effective fintech landing page, you need to start with a clear and compelling value proposition. What sets your fintech solution apart from your competitors? Highlight the benefits of using your product or service, such as convenience, security, and ease of use.

Next, make sure your fintech landing page is visually appealing and easy to navigate. Use high-quality images and videos to showcase your product or service, and use clear and concise messaging to explain how it works. Make sure your call-to-action buttons are prominently displayed, and use A/B testing to optimize their placement and wording. When it comes to optimizing your fintech landing page for search engines, focus on using relevant keywords, such as "fintech landing page," throughout your content. Use heading tags to structure your content, and make sure your page loads quickly and is mobile-friendly.
Finally, track your fintech landing page's performance using analytics tools such as Google Analytics. Measure metrics such as bounce rate, time on page, and conversion rate, and use this data to continuously optimize your landing page's performance. In conclusion, a well-designed fintech landing page is essential for promoting your financial technology solutions. By focusing on clear messaging, visual appeal, and search engine optimization, you can attract and convert potential customers into loyal users of your fintech product or service.
Let's be friends and connect
📩 Subscribe:https://shorturl.at/BCTV8
📷 Instagram: https://www.instagram.com/soudemy/
📱 Behance: https://www.behance.net/soudemy
🐦 Twitter: https://twitter.com/SoudemyAcademy
In the comments, you can say what design you want so that we can prepare the video for you.
#figma #figmadesign #figmatutorial #tutorial #figmatips
Seeking feedback on a developer tool
Tags: java, feedback, startup
Published: 2023-06-29 13:43:03

I am a software developer, developing a developer tool called [Seagence](www.seagence.com). Seagence is a defect monitoring platform for Java applications which detects functional defects including root cause in real-time. I am seeking feedback on Seagence. Any Java developer wants to try and help?