teleren/devto huggingface dataset:
Working with cursors with SQL commands in CrateDB
Tags: cratedb, database, sql, cursors
Published: 2023-01-18 11:53:34

As a distributed database system with support for the standard SQL query language, CrateDB is great to run aggregations server-side, working on huge datasets, and getting summarized results back; there are however cases where we may still want to retrieve lots of data from CrateDB.

Getting a large number of results in a single operation can put stress on the network and other resources, both client and server-side, so we need a mechanism to fetch results in manageable batches as we are ready to process them.

A common requirement is also what is called pagination, which is to present results to users with pages with a set number of results each, allowing them to move between these pages. In this case, it is common that many users will only look at the first few pages of results, so we want to implement that in the most efficient way possible.

This can be done using cursors, a cursor is like having a bookmark pointing to a specific record in the result set of a query.

In CrateDB we were already able to use cursors at the protocol level, but with version 5.1.1 we have introduced the ability to do it with standard SQL commands.

First we issue this command:

```sql
BEGIN;
```

This is a SQL command that would normally start a transaction, there are no transactions as such in CrateDB, but this will create a scope on which cursors can be created.

```sql
DECLARE observations_cursor NO SCROLL CURSOR FOR 
	SELECT ts,device,reading 
	FROM doc.observations 
	WHERE ts BETWEEN '2022-01-01 00:00' AND '2022-10-01 00:00';
```

This associates a cursor name with a query and determines the point in time at which data is “frozen”, this is because cursors in CrateDB are `INSENSITIVE`, meaning that the client can take all the time it needs to retrieve the results and the data will always reflect the status of the tables as it was at the time the cursor was declared, ignoring any records that are updated, deleted, or newly inserted.

```sql
FETCH 10 FROM observations_cursor;
```

This retrieves 10 rows from the query, and when issued again it will retrieve the next 10 rows and so on. We can retrieve different number of records each time and we know we have reached the end of the result set when `FETCH` returns zero rows.

Once the cursor is not needed anymore it can be closed with either `END`, `CLOSE`, or `COMMIT`.

Take a look at this short animation showing an example of how this works: {% embed https://twitter.com/mfussenegger/status/1572256514798424066 %}

We hope you find this useful, and we will be happy to hear about your experience in the [Community](https://community.crate.io/).
c++ da <> belgilari
Published: 2023-01-18 11:49:15

```cpp
< bu belgi kichik belgisi > bunisi katta belgisis 
&& bu belgi yoki belgisis bolib bunda bita taraf tori bolsa bita taraf notori bolsa hato chiqadi
|| va belgisi bita taraf tori chiqsa ikinchi taraf tori chiqadi 
 ```
@dawroun
Building a simple web server with Go👨‍💻
Published: 2023-01-18 11:48:52

#Daily Go👨‍💻

It is absolutely important to write and build simple basic programs when learning programming.
I am working with Go and we will be building a simple web server.

###Let's begin
First, a web server is a program that listens for incoming requests from web clients (such as browsers) and sends back the appropriate response.

Be sure to have go installed to run this program.
Here's a [link][1] to install go.
[1]:https://go.dev/dl/

Building a simple web server with Go is a relatively straightforward task that can be accomplished in just a few lines of code. In this post, we will walk through the process of building a simple web server using the Go programming language.

####Step 1: Import the necessary packages
The first step in building a web server with Go is to import the necessary packages. We will be using the "net/http" package, which provides the necessary functions for building a web server in Go. Here is the code for importing the necessary packages:

```
import (
	"fmt"
	"net/http"
)

```
###Step 2: Define the handler function

The next step is to define the handler function, which will be responsible for handling incoming requests. This function will take an http.ResponseWriter and an http.Request as its arguments. The http.ResponseWriter is used to write the response to the client, and the http.Request contains information about the incoming request.

Here is an example of a simple handler function that will write "Hello, World!" to the response:

```
func handler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "Hello, World!")
}

```
###Step 3: Register the handler function

Now that we have defined our handler function, we need to register it with the http package so that it can be called when a request is received. We do this using the http.HandleFunc() function.

Here is an example of how to register the handler function:

```
http.HandleFunc("/", handler)
```
###Step 4: Start the server

Finally, we are ready to start our web server. We do this using the http.ListenAndServe() function. This function takes two arguments: the first is the address to bind to, and the second is the handler to use.

Here is an example of how to start the server:

```
http.ListenAndServe(":8080", nil)

```
Note that in the above example, we are binding to port 8080. You can change it to any other port you like.

The complete code for our simple web server looks like this:

```
package main

import (
	"fmt"
	"net/http"
)

func handler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprint(w, "Hello, World!")
}

func main() {
	http.HandleFunc("/", handler)
	http.ListenAndServe(":8080", nil)
}

```
To run the above code you can use the following command:

```
go run main.go

```
This is a very basic example of how to build a web server with Go, but it should give you a good starting point for building more complex applications. With a little more work, you can add routing, template rendering, and other features to your web server.

Till next time.
⚡codeDaily
I used ChatGPT to do my job for me!
Tags: chatgpt, vue, tailwindcss, webdev
Published: 2023-01-18 11:34:54

So I'm sure you already know about ChatGPT by now and what it can do, I've heard a lot about it myself and have played around which it's capabilities, so I though hey let's see if it can do my job for me?!

As an experiment I went onto UpWork and found a random job where a developer would be tasked with designing a user-friendly fencing calculator that could quickly and accurately calculate the materials needed for a fencing project. The calculator needed to take into account the length of the fence, the height of the fence, and the type of fencing material. They also wanted the calculator to be user-friendly and easy to understand, with clear instructions.

I started by telling ChatGPT what I wanted from it, this helps with priming the AI so it knows what to look for:

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

I then copied and pasted the provided brief of the project into ChatGPT and asked for an estimated approach, timings:

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

To my surprise, ChatGPT was able to provide me with an estimated approach, which included using modern web technologies such as HTML, CSS, and JavaScript, and making the calculator compatible with most web browsers and mobile devices. It also provided me with an estimated timeline of 4-6 weeks for the project (although I think this was maybe too much).

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

I then asked ChatGPT to provide the code in VueJS for the calculator, which it did with minimal errors:

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

After the code was generated it did state that the materialTypes object was missing and needed to be added plus a few other small things.

I then copied out the code and made a few small changes, after this I pasted the newer code back into the chat and asked it to add TailwindCSS classes to the elements, which it did quickly.

All in all this process took about 10-15 minutes to complete, I was left with a clean looking calculator which worked and could easily be used as a prototype. If I was to actually have made a proposal for the job I could have stated that I would supply a prototype within 24 hours which I'm sure would be very appealing to clients.

Obviously I didn't actually get ChatGPT to "do my job for me" but it does go to show that it can be used (even though didn't get everything perfect but it was 99% there) to get a very quick module, built to the spec which was provided and gave me time to sit back and have a beer.

Here's the code which was built by ChatGPT:
[https://codepen.io/ScottWindon/pen/eYjGaXw](https://codepen.io/ScottWindon/pen/eYjGaXw)
The Easiest Way to Embed PDFs on a Website
Tags: webdev, html, tutorial, beginners
Published: 2023-01-18 11:30:45

Let's have a look at the **easiest** way to embed PDFs onto your website.

The simplicity of this solution comes from the fact that we're using the web browser's **built-in** (native) PDF viewer using `<iframe>`.

## Video Tutorial
If you prefer, you can see how to embed PDFs in video form 👇

{% youtube Ll7PA0dtpW0 %}

## How to Embed PDFs

All you need to do is specify an `<iframe>`, and set the `src` attribute to the path of your PDF file. We can also remove the frame border using `frameborder="0"`.

For example:

```html
<iframe src="documents/file.pdf" frameborder="0"></iframe>
```

When running the above code in your browser, you should see a small area where your PDF file is being generated. If you wish to resize it, you can do so using CSS.

### Resize Using CSS

Let's begin by adding an `id` to the `<iframe>`, then, apply some styles in CSS:

```html
<iframe id="myPDF" src="documents/file.pdf" frameborder="0"></iframe>
```

```css
#myPDF {
    width: 85%;
    height: 975px;
}
```

Feel free to experiment with the CSS styles to suit your liking 🙂

## [Enrol Now 👉 JavaScript DOM Crash Course](https://www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1)
You can find a complete course on the JavaScript DOM which goes over some of the topics covered in this post at the link below 👇

[https://www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1](https://www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1)

![Course Thumbnail](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/svof0kxvtm28c5ki4ios.jpg)

Happy coding 😎
Monitoring backlinks with Linkcheck.io
Tags: backlinks, monitoring, links
Published: 2023-01-18 11:25:14

With the help of our service, you will be able to follow all the links that you put on your site. Our service will show you not only the indexing of the page of the donor site, but also the presence of 301 redirects, noindex tags and much more. With linkcheck.io link building is much simpler and more transparent.
[https://linkcheck.io/](https://linkcheck.io/)
Best Chat Sdk To Use
Tags: webdev, career, news
Published: 2023-01-18 11:23:58

One of the few best chat Sdk app to use 2023 is Robin, Robin supercharges any platform with incredible features that helps communities thrive — Instantly build a reliable & functional chat experience, notifications, and real time collaboration into any product in just 5mins. Saving you years of product development. 

- It creates a messaging solution that can scale with your existing infrastructure without breaking the bank and within the shortest timeline? 

- it creates manage, and analyze in-app notifications across web and mobile with 100% customization

you can visit https://robinapp.co/ to learn more
How to work with different browser profiles
Tags: aws, sessions, profiles
Published: 2023-01-18 11:20:04

[Finicky](https://github.com/johnste/finicky) will help you when you use different browsers, and/or different profiles. As a consultant I often use browser profiles to split my clients. I have a "Binx.io" profile for all Binx related work. For each client I have corresponding profiles. Let's call them "Client A" and "Client B".


![Example of the client profiles in Chrome](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3cah99j0m238qtlnhp04.png)

Browser profiles let you manage bookmarks per profile. So you can keep all your related bookmarks together making them easier to find. The biggest advantage that I love is that the sessions are also separated. This means you can login with different users into the [AWS Console](https://console.aws.amazon.com/). Allowing you to use 2 console sessions at the same time.

## How does it work?

First you need to install [Finicky](https://github.com/johnste/finicky). Then you configure your default browser to Finicky.


![Example of your default browser configuration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qvnur6phe8sd309vak9y.png)

The last thing you need to do is to configure some logic. For this you need to create a `~/.finicky.js` file. This file contains the logic when to select what browser and profile.

```json
module.exports = {
  defaultBrowser: "Safari",
  handlers: [
    {
      match: /(binx.io|xebia.com)/,
      browser: {
        name: "Google Chrome",
        profile: "Profile 1"
     }
    },
    {
      match: /(clientA.com)/,
      browser: {
        name: "Google Chrome",
        profile: "Profile 2"
     }
    },
    {
      match: /(clientB.com)/,
      browser: {
        name: "Google Chrome",
        profile: "Profile 3"
     }
    }
  ]
};
```

If you look at the code snippet. You will notice that the default browser is set to Safari.

When I click on a link or I open a webpage on my machine. This logic kicks in. If the url matches [binx.io](https://binx.io) or [xebia.com](https://xebia.com/) it will use Chrome and `Profile 1`. If the url contains `clientA.com` it will use Chrome and `Profile 2`.

The profiles mentioned earlier `Client A` and `Client B` are the names. Unfortunately, Finicky only works with numbered profiles. So you need to do some testing what profile number is what profile name. But when you figured it out you are good to go!

## Conclusion

Finicky gives you the flexibility to choice your browser and profile. All based on logic that you control.

And that combination is really powerful.

Photo by [Exelsius Adam](https://www.pexels.com/photo/portrait-of-a-woman-with-her-hands-on-her-head-9305436/)
Top 12 Code Review Tools
Published: 2023-01-18 09:37:32

Code review is an essential part of the software development process, it helps to improve the quality of code and detect errors early on. It’s a process where developers review each other’s code, looking for bugs, inconsistencies, and potential improvements.

There are many code review tools available today, each with their own unique features and capabilities. In this article, we will take a look at the top 12 code review tools that are currently available in the market:

1. GitHub
GitHub: One of the most popular code review tools, GitHub is a web-based platform that allows developers to host, review, and collaborate on code. It offers a variety of features such as pull requests, code review, and issue tracking.

2. Gerrit
Gerrit: Gerrit is an open-source code review tool that is designed for use with the Git version control system. It offers a web-based interface and advanced features such as code review, change management, and integration with other development tools.

3. GitLab
GitLab: GitLab is a web-based platform that offers code review, issue tracking, and project management capabilities. It also offers a built-in continuous integration/continuous delivery (CI/CD) pipeline, making it a popular choice for DevOps teams.

4. Crucible
Crucible: Crucible is a code review tool from Atlassian that offers a web-based interface and advanced features such as code review, discussion, and reporting. It also integrates with other Atlassian tools such as JIRA and Confluence.

5. Phabricator
Phabricator: Phabricator is an open-source code review tool that offers a web-based interface and advanced features such as code review, task management, and integration with other development tools.

6. Review Board
Review Board: Review Board is an open-source code review tool that offers a web-based interface and advanced features such as code review, change management, and integration with other development tools.

[Read More](https://mahiuddin.me/blogs/code-review-tools/)
DevOps Services and Solutions Company 
Tags: devops, webdev
Published: 2023-01-18 10:50:30

We are a specialised provider of DevOps services and solutions, and our group of qualified and experienced DevOps specialists work with you to plan an efficient DevOps implementation strategy. With proven assumptions, lowered risks, and enhanced procedures, we enable you to create exceptional, innovative, and distinctive products that meet your company's needs and result in a highly effective product development life cycle. Make the most of [DevOps consulting services](https://binmile.com/services/devops-consulting-services/) to wisely spot and resolve issues with collaboration across the operations, development, and testing teams. Your product's time to market is accelerated by our thorough consultations and help on DevOps evaluation, automation, and management.
How does school software impact school work and education?
Tags: software, beginners, computerscience
Published: 2023-01-18 10:45:44

School management software is becoming increasingly popular in India, as more and more schools are recognizing the benefits that these software programs can provide. These software programs can help schools to streamline their administrative processes, such as managing student records, tracking attendance, and generating reports. They can also improve communication between teachers, parents, and students, which can foster a sense of community and engagement within the school.

**There are various school management software available in India, Some of the popular ones are:**

-Fedena

-Sams

-SchoolPad

-Smart School

-EduSys

-CampusCare

-MySchool

-Vidyalaya

[-Warals](https://blogs.warals.com/features-of-warals-school-management-system/)

-SchoolMaster

These software vary in their features , pricing and user interface and schools can choose one that best suits their needs and budget.
Game Aether SX2 - The Next Generation of Open-World Exploration
Tags: news, cpp, javascript, programming
Published: 2023-01-18 10:22:58

Overview
Aether SX2 is an open-world exploration game developed by Studio Aether. The game takes place in a vast, open world filled with various biomes, from dense forests to snowy mountains. Players take on the role of a character who has crash-landed on the planet and must explore and survive in order to find a way back home.

Gameplay
The gameplay of Aether SX2 is centered around exploration and survival. Players can explore the game's vast open world, discovering new locations and uncovering the secrets of the planet. Along the way, they will encounter a variety of different creatures and enemies, which they must either avoid or fight in order to survive.

Players must also manage their character's needs, such as hunger and thirst, in order to survive. They can gather resources from the environment and craft items to help them on their journey.

Graphics and Sound
Aether SX2 features stunning graphics and immersive sound design. The game's open world is filled with lush landscapes and detailed environments, which are brought to life by the game's advanced graphics engine. The sound design immerses players in the game world, with realistic ambient sounds and an original soundtrack.

Conclusion
Aether SX2 is an exciting and immersive open-world exploration game that offers players the opportunity to discover and survive in a vast, mysterious planet. With stunning graphics and immersive sound design, the game immerses players in the game world and offers a truly unique gaming experience.

Source : [shelatitude](https://www.shelatitude.com)
AI generated the 90% of this post
Tags: webdev, typescript, machinelearning, career
Published: 2023-01-18 10:07:14

<small>The heading image has been generated with Dall·E 2</small>

In the previous post 
{% embed https://dev.to/joelbonetr/js-functional-concepts-pipe-and-compose-1mho %}

I explained these concepts in a way that I felt "enough understandable" for a wide range of people, though I can be wrong because it's my point of view at the end, so I've decided to try and make Chat GPT to explain what it does.

The conversation went like that:

**Me:**
can you explain me the following function
```ts
export const pipeAsync: any =
  (...fns: Promise<Function>[]) =>
  (input: any) =>
    fns.reduce((chain: Promise<Function>, func: Function | Promise<Function> | any) => chain.then(func), Promise.resolve(input));
```

**Chat GPT:**

This function is creating a utility function called "pipeAsync", which allows chaining multiple asynchronous functions together in a pipeline.

It takes a list of functions as input, passed as rest parameter, which are all wrapped inside a promise.

It returns a new function that takes an input value as an argument. This returned function uses the Array.prototype.reduce method to iterate over the array of functions, and calls each function in sequence, passing the result of the previous function call as input to the next function.

The reduce function starts with an initial value of Promise.resolve(input), which is the input passed to the returned function. This is the starting point of the pipeline.

The reduce function then calls the next function in the pipeline with the result of the previous function call, and this process continues for each function in the pipeline.

The result of the reduce function is a new promise that resolves with the final result of the pipeline.

The "pipeAsync" function allows you to chain together multiple asynchronous functions in a way that makes the code more readable and maintainable. It is similar to the "pipe" function from functional programming, but it's adapted to work with async/await.

<hr />

While it is 100% accurate, the language and language resources it uses may require a bit of focus to understand in my opinion.

**What do you think?** Is it better explained by GPT or by flesh and bones people? Let me know in the comments!
讓 Firefox 用新分頁開啟網址列輸入的網址或搜尋結果
Tags: firefox
Published: 2023-01-18 10:04:45

我自己慣用新分頁開啟新的網頁, 之前常用的 [tab mix plus](https://tabmixplus.org/support/troubleshooting/data/legacy-tabmix.html) 似乎變成了 [tab mix link](https://addons.mozilla.org/zh-TW/firefox/addon/tab-mix-plus-webextension/?utm_source=addons.mozilla.org&utm_medium=referral&utm_content=search), 只能控制在新分頁開啟網頁上的連結, 但是在網址列輸入網址或是搜尋文字時, 還是會開在同一個分頁。還好在 Mozilla Questions 上有人[問了一樣的問題](https://support.mozilla.org/en-US/questions/1308485), 只要進入 [about:config](about:config), 將以下兩個項目都設爲 True 即可：

- browser.search.openintab
- browser.urlbar.openintab