teleren/devto huggingface dataset:
Lissajous curve Java
Tags: java
Published: 2022-10-29 07:28:07

---
title: Lissajous curve Java
published: true
date: 2022-10-28 06:00:00 UTC
tags: java,java
canonical_url: https://jsedano.dev/java/2022/10/28/lissajous-curve-java.html
---

Just a Lissajous curve on Java displayed on a JFrame.

You can find the complete code for this here: [Lissajous.java](https://github.com/jsedano/examples/blob/main/java-snippets/Lissajous.java).

First of all, the code is a complete rip-off from [The Go Programming Language](https://www.gopl.io) book, specifically from this [code from chapter 1](https://github.com/adonovan/gopl.io/blob/master/ch1/lissajous/main.go).

I won’t even pretend to understand the maths on this one, so lets just dive into the code, first we initialize our window:

```
int size = 100;
JFrame frame = new JFrame("Lissajous");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
panel.setPreferredSize(new Dimension(2*size+1, 2*size+1));
frame.add(panel);
frame.pack();
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
```

With that we have a non resizable JFrame on the middle of the screen, that terminates the program when closed which contains a JPanel where we can draw, in order to do so we only need the Graphics from the JPanel:

```
Graphics g = panel.getGraphics();
```

Then we start shamelessly translating the Go code from the link above to Java:

```
double cycles = 5;
double angularResolution = 0.001;
long delay = 80;
int frames = 64;
for(;;){
    double frequency = Math.random() * 3.0;
    float phase = 0.0f;
    for( int i = 0; i < frames; i++) {
        g.setColor(Color.BLACK);
        g.fillRect(0,0, panel.getWidth(), panel.getHeight());
        g.setColor(Color.GREEN);
        for(double t = 0.0; t < cycles*2*Math.PI; t+= angularResolution){
            double x = Math.sin(t);
            double y = Math.sin(t * frequency + phase);
            g.drawRect( (size + (int)(x*size+0.5)), (size + (int)(y*size+0.5)),1,1);
        }
        phase += 0.1;
        Thread.sleep(delay);
    }
}
```

Since its a single file, if we have Java 11 or above we can run it without compiling with:

```
java Lissajous.java
```

And we should see this:

[![lissajous-curve-java](https://jsedano.dev/assets/images/lissajous-curve-java/lissajous-curve-java.gif)](/assets/images/lissajous-curve-java/lissajous-curve-java.gif)

Download the complete code for this here: [Lissajous.java](https://github.com/jsedano/examples/blob/main/java-snippets/Lissajous.java).
JSON.stringify can create Multi-line, formatted and filtered strings from JSON
Published: 2022-10-28 05:53:52

---
title: JSON.stringify can create Multi-line, formatted and filtered strings from JSON 
published: true
description: JSON.stringify has two optional parameters to create multi-line, formatted JSON and has a filtering option
tags: 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0naid9hbqh63887p4t4w.jpeg
# Use a ratio of 100:42 for best results.
# published_at: 2022-10-28 05:26 +0000
---

You can use `JSON.stringify()` to turn a JSON object into a string. 

```JavaScript
let obj = {"a": 1, "b": 3, "c": "boo!"};
console.log(JSON.stringify(obj))
```
This results in a single line string:

```JavaScript
{"a":1,"b":3,"c":"boo!"}
```
However, you can also set two optional parameters, a filtering array or callback method and an indentation parameter. Setting the indentation to four, for example, creates a multi line string with 4 spaces indentation:

```JavaScript
let obj = {"a": 1, "b": 3, "c": "boo!"};
console.log(JSON.stringify(obj, false, 4))
```

Output: 

```JavaScript
{
    "a": 1,
    "b": 3,
    "c": "boo!"
}
```

If instead of spaces you want tabs, you can also defined the indentation parameter as a string:

```JavaScript
let obj = {"a": 1, "b": 3, "c": "boo!"};
console.log(JSON.stringify(obj, false, "\t"))
```

Output: 

```JavaScript
{
	"a": 1,
	"b": 3,
	"c": "boo!"
}
```

Or any other string:

```JavaScript
let obj = {"a": 1, "b": 3, "c": "boo!"};
console.log(JSON.stringify(obj, false, "xxx"))
```
Output: 

```JavaScript
{
xxx"a": 1,
xxx"b": 3,
xxx"c": "boo!"
}
```

You can define an array of keys you want to show to filter the outcome:

```JavaScript
let obj = {"a": 1, "b": 3, "c": "boo!"};
console.log(JSON.stringify(obj, ['a','c'], 4))
```

Output:

```JavaScript
{
    "a": 1,
    "c": "boo!"
}
```

And you can write a filtering callback function that gets applied to the JSON object. For example, to only allow for numbers to show: 

```JavaScript
const onlyNumbers = (key,value) => { 
  return (typeof value === 'string')  ? undefined : value 
}
let obj = {"a": 1, "b": 3, "c": "boo!"};
console.log(JSON.stringify(obj, onlyNumbers, 4))
```

Output: 

```JavaScript
{
    "a": 1,
    "b": 3
}
```

You can see [more examples on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). 

Whilst I like these options, it always feels weird to me when a method allows for different values to determine what to do. Having the replacer either be an array or a callback and the spaces option be a number or a string feels confusing. What do you think?
Convert Metaplex mint site from Devnet to Mainnet
Tags: solana, metaplex, sugar, help
Published: 2022-10-28 05:45:50

This aligns with Solana but is also a reference to Metaplex. Hoping someone can answer as the information found online is slim to none.

I have a project ready to go. Using Metaplex Sugar CLI w/ Solana CLI. It's currently set on devnet with QuickNode as my RPC in my .env file. I want to convert this project to the Mainnet-beta and launch.

How do I do so?

Do I just edit my .env file with the mainnet RPC, add SOL to my Candy machine wallet and relaunch Sugar (Metaplex)?

What steps do I need to take my complete Devnet project and make it live on the mainnet?
Opportunity in Salesforce
Published: 2022-10-28 05:45:37

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


[Salesforce opportunities](https://arrify.com/ultimate-guide-on-opportunity-in-salesforce/) allow you to track and manage your potential deals. Opportunity records provide details about deals in progress, including the associated accounts, key players, and estimated value. If your Salesforce admin has set up leads in your Salesforce org, you can convert them to opportunities.

The recent changes in deal size and close date for the opportunity deal highlight the work that needs to be prioritized by the sales team. This will help the sales manager with their weekly coaching sessions by calling out these changes. In the opportunities list view and Kanban view, the text color will help identify these changes.
Universal Design
Tags: storybytes, uiux, transformation, universaldesign
Published: 2022-10-28 04:51:33


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


The evolution from a Designer to a Universal Designer is a vital changeover for many in the industry. You might cover the basic needs by loading up the product with the device-independent approach, content structure and choosing the right colour and contrast. But a design covering the need still doesn't solve the user's problem accessing your product. An inclusive design mentality aims to make the product more usable to users in general. Accessibility is not restricted to a group of users with different abilities, such as visual, motor, auditory, speech, or cognitive disabilities. It extends to anyone experiencing any permanent, temporary or situational disability, e.g., having only one arm is a permanent condition, having an injured arm is temporary, and holding a baby in one arm is situational. We at Web and App Studio do believe in building empathy, and installing an inclusive design mentality leads to a transformation to a Universal Designer.
Wordpress
Tags: storybytes, opensource, future, wordpress
Published: 2022-10-28 04:46:38


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

WordPress doesn't need an extensive introduction in the web world of CMS. By providing WordPress service, we at Web and App Studio thoroughly listen to the clients and understand their requirements. Any solutions are SEO friendly, lightweight, customizable, and within the scope. With custom WordPress development services, you can enhance the overall appearance of your website, improve the content to attract visitors and improve traffic towards your website. Every development is custom-made and carefully coded for longevity and maintenance, ensuring that the website is well equipped beforehand for future results.
49. Leetcode solution in python3
Tags: python, challenge, chiki1601
Published: 2022-10-28 04:15:51

```python
class Solution:
  def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
    dict = defaultdict(list)

    for str in strs:
      key = ''.join(sorted(str))
      dict[key].append(str)

    return dict.values()
```


#Leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/group-anagrams/
Extension that you should have in Visual studio code as a Developer - I
Tags: vscode, extensions
Published: 2022-10-28 04:14:24



## CodeSnap

📸 Take beautiful screenshots of your code in VS Code!

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

**Features**
- Quickly save screenshots of your code
- Copy screenshots to your clipboard
- Show line numbers
- Many other configuration options


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

Any suggestions ? please let me know. Thank you !
Yahoo backup is now organised and simple
Published: 2022-10-28 04:04:08

Now users don't have to endure the unorganised and time consuming methods to do something as regular as mail backup. When a complex and targeted activity like Yahoo email backup is divided into simple and straightforward steps, it becomes organised, follows a logical pattern, and becomes achievable even for novices. This is what Mail backup X by InventPure has achieved for all users. Whether it is Outlook, Yahoo Gmail, or most of the existing mail services, this is the most straightforward, fully organised, and simple to use tool for backup as well as recovery. The good thing is that Mac users as well as Windows users can have this tool to backup these services as it is designed with twin compatibility.
 

## Backup Yahoo email automatically to stay in tune and without any worry

Full backups are the answer for people when mailboxes have never been backed up before and these are also needed to save complete set of mail data in one place periodically. But it cannot be used for regular backups so that all changed and new files get backed up. Here incremental backups are needed and they organise as well as utilise the space in a much better manner. Automatic backup with the option to choose a frequency and timing gives users a great head-start. When creating archives for a specific purpose or for a particular client, selective backup is also a great option. Isn't it amazing that this tool offers all these backup patterns and easy set up in a few steps?

## This Yahoo backup tool also lets you sync and configure these storage spaces

When using this amazing software application, you get the feature of choose a space. Most people will associate it with selecting location on local drive to store backups. But here the options are more than just local storage. You can configure Cloud based storage depending upon the services you have subscribed to which can be Google Drive, Dropbox, PCloud, and One Drive. USB sync and USB snapshots give you another upper hand.

## Yahoo email backup and recovery have an accuracy which is never affected

Whether you have large mailboxes or you have Unicode content, you need to know that with this tool backup is complete and hundred percent accurate without any changes and without any exclusions. In fact, the hierarchy of files is maintained as well. Metadata is also retained with this application.
 

## This **[Yahoo backup tool](https://www.mailbackupx.com/yahoo-backup-tool)** scores heavy on usefulness

Team version will give some advances controls to admin like remote backups. Progress of the task can be tracked with live dashboard. But what is most outstanding is the inclusion of email migration option. Some say PDF archiving is also equally outstanding and it definitely is useful. Also, data compression and double encryption benefit almost all users. Data recovery is so quick that one does not feel any pressure at all. 

Try a demo and buy this software to get best results for mail backup and mail migration. **[https://www.mailbackupx.com/yahoo-backup-tool](https://www.mailbackupx.com/yahoo-backup-tool)**
Using overflow:scroll and flexbox to render a vertical list that takes all the available height based on a sibling element
Tags: css, tailwindcss, tutorial, overflowscroll
Published: 2022-10-28 03:29:54

tldr; Here is an implementation of a vertical scrollable list using flexbox that takes the available space set by a sibling element. Vanilla CSS and Tailwind versions.

[Code in Sandbox](https://codesandbox.io/s/clever-firefly-y97s87?file=/index.html) (*Contains Vanilla CSS version and Tailwind version*)

## Use case

We wanted to have a container with 2 columns where:

1. the left-hand side had a growable textarea and,
2. the right-hand side had a scrollable list on the y-axis that takes the full height

### Requirements

- The `textarea` can contain as much text as it wants
- The scrollable list should use the available height based on `textarea` and display as many items as possible or `overflow:scroll`

---

## Challenges

When using flexbox with `overflow:scroll` and rendered the list of items directly, it would increase the height instead of displaying as many as possible given the height from the left-hand side.

---

## Our solution for the scrollable list

1. We have a `flex` wrapper that has the `overflow: scroll;` property, let's call it *container*

2. We added an additional wrapper container around the overflowing list of items with a `max-height: 0;`, let's call it *list-container*

3. We rendered the list of items

**Note:** If we had rendered the items in *container* directly, they would have increased its height and not respect the height provided by `textarea` on the left-hand side.

*list-container* do not increase the height of *container* thanks to `max-height:0;` and as we do not define the overflow behaviour, it defaults to visible. However, as we set `overflow:scroll` at the *container* level, we still benefit from the scrolling we wanted.

## Final note
---

I hope you found the post interesting. If you have implemented a similar solution in a more elegant way, please let me know in comments 🙌 This is what **we** came up with and it's probably not perfect!

Take care everyone 👋
10 Isometric Illustrations for your next Dev Project
Tags: productivity, tech, webdev, beginners
Published: 2022-10-28 03:16:49

I made 10 free of any copyright Abstract illustration for your next dev project.

The Images have no background so they can merge with your own background.

## 1
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/1.png)
## 2
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/2.png)
## 3
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/3.png)
## 4
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/4.png)
## 5
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/5.png)
## 6
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/6.png)
## 7
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/7.png)
## 8
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/8.png)
## 9
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/9.png)
## 10
![Isometric shape](https://raw.githubusercontent.com/FredySandoval/illustrations/main/blender/isometric_illustration/10.png)

[Link to Download All](https://github.com/FredySandoval/illustrations/tree/main/blender/isometric_illustration)

### 👇 Follow me on Twitter

[![Twitter](https://img.shields.io/twitter/url.svg?label=Follow%20%40fsandovaldev&style=social&url=https%3A%2F%2Ftwitter.com%2Ffsandovaldev)](https://twitter.com/fsandovaldev)
How to Google Search from the terminal?
Tags: javascript, webdev, programming, productivity
Published: 2022-10-28 02:31:11

Originally Posted [Here](https://www.dhairyashah.dev/posts/how-to-google-search-from-the-terminal)

As developers, we spend the majority of our time working with the terminal. The terminal is excellent at saving time and increasing productivity, such as when creating a file or performing complex tasks.

Have you wondered about searching Google directly from the terminal?

In this article, I will be showing you an easy and simple way to Google Search directly from the terminal.

### Prerequisites

- [Node JS installed on the machine](https://nodejs.org/en/).

There isn't much on the prerequisites list :)

### Let’s Google Search Like A Developer

- Step: 1 Install an npm package
    
    ```bash
    $ npm i -g glook
    ```
    
- Step 2: All things have been setup
    
    ```bash
    $ glook SEARCH_TERM
    ```
    
Now, you can directly Google Search from the terminal.


{% embed https://youtu.be/rScOe4FxYss %}

For more information, visit [glook.dhairyashah.dev](https://glook.dhairyashah.dev/)
### Thanks for reading

Follow me on [Twitter](/Twitter)

Thanks for reading!
Custom Memory Allocation With C++ Objects
Published: 2023-01-10 19:25:10

---
title: Custom Memory Allocation  With C++ Objects
published: true
date: 2022-10-28 02:18:09 UTC
tags: 
canonical_url: 
---

So, recently as I have gotten more and more obsessed with creating a game engine I have been battling with myself over something. C or C++? Besides the fact that I hate OOP or object-oriented programming and the fact that modern C++ is complicated and scary, there was another HUGE reason I did not want to make my codebase C++ focused. Memory management of Classes/Objects! While creating my projects in C, I have always created a sort of memory subsystem that controls how I allocate memory. But whenever I venture into C++ I get stuck! How am I supposed to control memory allocation if my objects need to call their constructor with the "new" operator/keyword? Well, after doing more research and learning more about C++ I learned it is not so hard after all. All we need is everyone's favorite thing... Template Metaprogramming! If you can't tell, I am not a fan of templates. But maybe they do come in handy for a few things. Let's jump into some code:

```
template <typename T, typename... Args>
T* memcreate(Args... arg)
{
    void* memory = malloc(sizeof(T));
    T* mem = new(memory)T(arg...);
    return mem;
}

struct testing
    {
    public:
        testing(int num, const char* word) {x = num; name = (char*)word;}
        ~testing() = default;
        int x;
        char* name;
    };

//USAGE:
testing* test = memcreate<testing>(10, "charles");

```

And would you look at that! Now we can use malloc(or better yet a custom allocator) and instantiate C++ objects without the new keyword! If you look closely you will see that we still use the "new" keyword in the template function. This version of the keyword is called "placement new" and is used to "place" the memory we allocate from one object onto another while also "instantiating" the object and calling its constructor. I am sure there is a more technical way to explain it but that's what I am going with! Oh and if you are wondering our delete function would look like this:

```
template <typename T>
void memdelete(T* ptr)
{
    ptr->~T();
    free(ptr);
}

```

Very, very, simple. Next Post I will try to go into more detail about why this is useful and how I can track memory allocations, and use things like custom allocators to have more performant allocations! Thanks for reading! Go Code!
Blockchain Friday
Tags: beginners, blockchain, web3, news
Published: 2022-10-28 02:16:16

Hi 👋🏿 – These are excerpt taken from the [Blockchain Friday](https://www.getrevue.co/profile/_romeopeter) newsletter; a pragmatic guide for those interested in a ground knowledge of the technology and its applications.

## Who is this newsletter for?

The target audience for this newsletter is anyone who’s an enthusiast or has piqued an interest in blockchain technology. No prior knowledge is required to learn. This is intended to take anyone from ‘beginner’ to ‘knowledgable’.

## Stay tuned

For future release, [subscribe](https://www.getrevue.co/profile/_romeopeter) to the newsletter to receive each issues straight from your email inbox 📥
Week 1 Discoverings
Published: 2022-10-28 02:14:46

As someone who is new to coding i did not know where to begin. There is such a variety of coding languages out there. I was not sure which one was a right fit for me. However, after reading various articles there seems to be one thing in common. Everyone says python is a good language to learn if you are a beginner because it is simple and similar to English. I think this will be the first language I'm going to learn. Any tips ?
Añade un gradiente a tus imágenes con CSS.
Tags: webdev, css, html, programming
Published: 2022-10-28 01:28:57

Algunas veces necesitaremos agregar un gradiente a nuestras imágenes ya sea a modo de efecto (con un hover) o simplemente porque queremos añadir un texto encima de la imagen.

Agregar este efecto que comienza con un tono oscuro y que posteriormente se vaya degradando, nos ayudaría contrastar el texto.

Para lograr esto, primero tendremos que tener nuestra imagen dentro de un contenedor ya sea con una etiqueta `div` o ` figure` como se muestra a continuación:

HTML
```HTML
<div class="container-image">
      <img src="" alt=""/>
</div>
```

Para el código CSS, podemos hacer las modificaciones que queramos desde cambiar el color de fondo, la dirección del degradado o incluso agregar más colores.

CSS
```CSS
.container-image {
  width: 100%;
  position: relative;
}

.container-image img {
  width: 100%;
}

.container-image::after {
  content: "";
  width: 100%;
  height: 200px;
  position: absolute;
  left: 0;
  bottom: 0;
  background-image: linear-gradient(to top, #22577a, transparent);
}
```

Puedes ver el código en función en [Codesandbox](https://codesandbox.io/s/agregando-gradiente-a-una-imagen-con-css-qqs91b?file=/style.css) o en [Codepen](https://codepen.io/ramez-cesar/pen/oNyXLjW?editors=1100).

Si te gustó el post o tienes algún comentario, cuéntame en [Twitter](https://twitter.com/ramez_cesar). 😀