teleren/devto huggingface dataset:
How to Debug and Solve an App Sandbox Related Issue Within the Xcode IDE
Tags: macos, sandbox, swift, xcode
Published: 2024-04-06 18:41:38

_I just wanted to start out by saying that this is an abridged version of my [original published version from May 19, 2021 that you can find on my website here](https://www.simplykyra.com/how-to-debug-and-solve-an-app-sandbox-related-issue-within-the-xcode-ide/) and was originally written when I was using Xcode version 12.5 (12E262)_

---

Back when I first attempted to work with `SSH` through my Apple MacOS application I came to the realization that my application was incapable of using the network because of Apple’s App Sandbox.

The [full version of just what sandboxing is, steps I took to discover this, and how I solved it can be found in my original post](https://www.simplykyra.com/how-to-debug-and-solve-an-app-sandbox-related-issue-within-the-xcode-ide/). I'll cut to the chase and just say it came down to a single checkmark that I found by clicking my target and going under `App Sandbox`, `Network`, and checking off (placing a check mark on the) `Outgoing Connections (Client)`. In Xcode version 12.5 (12E262) this looked like:

![The value is checked off here](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l419bjmfakkhuzvsymc0.png)

With that checked off my application was easily able to make outgoing connections through the glory of SSH connections... using [Citadel](https://github.com/orlandos-nl/Citadel).

---

I show that and the entire process of discovery and _how to_ at my SimplyKyra website where [this original and longer published version from May 19, 2021 lives](https://www.simplykyra.com/how-to-debug-and-solve-an-app-sandbox-related-issue-within-the-xcode-ide/).

Have a great day!
Unicode string length can mean different things in different languages
Tags: unicode, java, go, rust
Published: 2024-04-06 18:22:44

I was working on a text processing example across several different programming languages, including C++, Java, Rust, and Scala, and noticed some discrepancies in the results.

It turned out that these are due to Unicode string length meaning different things in different languages:

- In Java, Scala, etc., the `length()` method returns the number of abstract, high-level characters (glyphs) from a human reader's point of view.

- By contrast, in C++, Go, and Rust, the equivalent functions and methods return a result based on the number of bytes required to store those characters.

```java
jshell> "résumé".length()
$1 ==> 6
```

```rust
❯ evcxr
Welcome to evcxr. For help, type :help
>> "résumé".len()
8
>> "résumé".chars().count()
6
```

```go
len([]rune("résumé")) // returns 6
```

Apparently it's a bit more complicated in C++.
Oculus Web Launch Bookmarklet
Tags: quest, webxr
Published: 2024-04-06 18:14:24

I want a convenient way to send links from your desktop browser to the Meta Quest Oculus Browser. Initially, I couldn't find a better solution than sending links to myself via WhatsApp and then opening them on the headset. This process could be improved.

Luckily, there is a better way for Meta Quest headsets, called the 
[Web Launch](https://developer.oculus.com/documentation/web/web-launch/) feature. This feature lets you directly open or bookmark a link on your Quest. To use it, you must be logged in to your Oculus account on both devices, and the links need to be https.

While Meta suggests a unique button for every app, a generic send-to-headset button for any website would be better. A bookmarklet is an ideal use case for this feature. For those unfamiliar, bookmarklets are like bookmarks that allow JavaScript execution on the current page instead of redirecting to another page. They're like lightweight browser extensions.

Drag the button from [this page](https://www.tiborudvari.com/blog/oculus-web-launch-bookmarklet) to use it.

Here is the code that it contains, passed through [Bookmarklet Maker](https://caiorss.github.io/bookmarklet-maker/).

```js
function sendLinkToQuest (linkUrl) {
  let sendToQuestUrl = new URL("https://oculus.com/open_url/");
  sendToQuestUrl.searchParams.set("url", linkUrl);
  if (window.location.protocol !== "https:"){
    alert("Must be an https page");
  }
  window.open(sendToQuestUrl, "_blank");
}

sendLinkToQuest(window.location.href);
```
Easy JavaScript with Arrow Functions!
Tags: javascript, webdev, beginners, programming
Published: 2024-04-06 18:01:55

Do you want to make your JavaScript code more concise? Look no further than arrow functions! Arrow functions are a modern feature in JavaScript that allows you to write functions in a simpler and more streamlined way. Let's dive in and see how they work.

An arrow function looks like this:

```
const add = (a, b) => {
  return a + b;
};
```
In this example, `add `is a function that takes two parameters, `a` and `b`, and returns their sum. The `=>` symbol is what makes this an arrow function. It's like saying "take these parameters and do this operation".

Arrow functions are especially useful for shortening code when passing functions as arguments to other functions. For example, suppose you have an array of numbers and you want to double each number. You could use the `map` function along with an arrow function like this:

```
const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map(num => num * 2);
```
In this code, `map` takes each element of the `numbers` array and applies the arrow function to it, doubling each number. The result is stored in the `doubled` array.

Another benefit of arrow functions is that they have a shorter syntax for certain cases. If the function body consists of only a single expression, you can omit the curly braces and the `return` keyword. For example, the `add` function from earlier can be written even more concisely like this:

```
const add = (a, b) => a + b;
```
This is particularly handy when writing small, simple functions.

So there you have it! Arrow functions are a powerful tool in modern JavaScript for writing cleaner, more readable code. Give them a try in your next project and see how they can simplify your code!
Six Stunning Web Developer Portfolios Showcasing Three.js Mastery
Tags: threejs, webdev, javascript, programming
Published: 2024-04-06 18:00:42

Here are six examples of impressive portfolios utilizing Three.js:

## 1. [Mars 2020 Entry Descent Landing](https://eyes.nasa.gov/apps/mars2020/)

This is a real-time 3d simulation of the Perseverance rover that landed at the Jezero crater on Mars on February 18th, 2021. 


![Perseverance rover](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4swqeyf2ondmx0uevpn.png)


## 2. [Kenta Toshikura](https://kentatoshikura.com/about)

Kenta Toshikura is the lead web designer and front-end developer at Garden eight. His portfolio showcases various interactive 3D projects and visualizations. 


![Kenta Toshikura](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pyt2t9po2tx3x0uno83t.png)

## 3. [Aidan Nelson](https://www.aidanjnelson.com/)

Aidan Nelson is a creative developer based in NYC. His portfolio is a blend of artistic expression and technical prowess. The portfolio design is clean and allows users to explore and interact with them seamlessly.

![Aidan Nelson](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s0r4azdh2347ffusz75w.png)

## 4. [Renaud Rohlinger](https://renaudrohlinger.com/)

Renaud Rohlinger is a french creative developer based in Japan. His portfolio is elegantly designed, providing an engaging showcase of his work.

![Renaud Rohlinger](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4nzef88n03s4303dfua4.png)

## 5. [Bruno Simon ](https://bruno-simon.com/)

Bruno Simon's portfolio showcases his creativity and technical skill. Using Three.js, he crafts captivating 3D scenes and animations that leave a lasting impression on users.

![Bruno Simon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k8gd1nb8pzoprcoou7qs.png)

## 6. [Tao Tajima ](http://taotajima.jp/) 

Tao Tajima is a director and filmmaker based in Japan. His portfolio showcases his mastery of three-js, WebGL, and story-telling, which invites exploration and leaves a lasting impression on users.

![taotajima](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7varb3arca748c7w7b2u.png)



These websites serve as inspiration for developers looking to showcase their skills in Three.js. By combining creativity with technical expertise, these developers have created engaging experiences that leave a lasting impression on users.

Please let me know if I have missed any stunning portfolios or if you believe that you have your own developer portfolio that should be listed here.
Create a re-useable Mailing Code in Laravel
Tags: laravel, php
Published: 2024-04-06 17:54:28

Hi there! In today's posting, I would like to share with you guys how to create a `Laravel Mailing` reusable code.

What I mean here is not the `php artisan make:mail`. But the `Mail::to` Syntax.

I'm building one mechanism in my application to send the reminder email to all of our targeted users. There are two ways to send to them. One is done manually (by clicking a button and then sending the email), second is done automatically (by using Laravel Scheduler)

The problem I faced was a lot of `Mail::to` syntax logic that I needed to code. The full code is like this,

```
Mail::to($user->email)
->send(new SendFirstReminder($user->name, $user->email));
```

It took me nearly 20 seconds to code it (I'm a slow typer)!

And there are a few places where I need to put the code. Such as Controller, and Console.

That's when I started to think. `what if I need to use that mail code again`?

So I need to spend another 20 seconds again? Of course, I don't want to do that again.

So what happened is, that I created a custom `Services Class`. I named it as `EmailReminder`. In this class where I gather all the reminder emails. Everything is in one place.

Then I use the `static method` to make it more readable.

As you can see in this image, after I created the `EmailReminder` services, I can call it wherever I want without spending 20 seconds to code it. It can be reused in all places.

I just need to call it statically and then it will work like usual. But it is shortened and more readable (at least from my point of view)



![sulaiman-mail-code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qgqo130j08g0eoqwxjtk.png)

Later I will create another post on how I created a reusable Local Scope logic for my application.

If you have other suggestions, comment below. I'd love to hear about your code strategy.
Princípios FIRST e Test Smells 🚀
Tags: testing, javascript, softwaredevelopment, software
Published: 2024-04-06 17:53:36

Quando se fala em escrever testes de unidade de boa qualidade, há alguns princípios básicos, agrupados na sigla **FIRST**, que podem ajudar bastante.

## Fast ⚡
 
Os testes de unidade devem sempre ser rápidos. A ideia é que você consiga rodá-los o tempo todo, sem ficar esperando. Se você precisa de um café enquanto seus testes rodam, provavelmente eles não são rápidos o suficiente.

## Independent 🧍‍♂️

Cada teste de unidade deve ser capaz de se virar sozinho. Não importa a ordem que você decide rodá-los; eles não devem depender uns dos outros.

## Repeatable 🔁 

Se você rodar o mesmo teste várias vezes, o resultado deveria ser sempre o mesmo: ou o teste sempre passa, ou sempre falha. Testes que às vezes passam e às vezes falham sem motivo aparente são chamados de "flaky" ou erráticos.

## Self-checking ✅
Uma vez finalizada a execução dos testes, o resultado deve ser auto-explicativo (passou/falhou). Desta forma, o resultado pode ser ligeiramente verificado e interpretado.

## Timely 🕰️
É uma boa ideia escrever os testes de unidade o quanto antes no seu processo de desenvolvimento. Muita gente até prefere escrever os testes antes do código que eles vão testar, isso ajuda a garantir que o seu código vai fazer exatamente o que você espera desde o começo.

---

## Test Smells 🐟👃

Alguns sinais no seu código de teste podem indicar que algo pode melhorar. Esses sinais são chamados de "Test Smells":

## Teste Obscuro 🌫️🤔

No código, um "Teste Obscuro" é assim: complicado, longo e difícil de entender. Testes devem ser **simples e diretos**, para que qualquer pessoa possa entender o que está sendo testado e por quê. É importante ter uma lógica clara e de fácil entendimento.

## Teste com Lógica Condicional ➰❓

Um teste com muitos "se" e "senão" torna difícil de entender exatamente o que está sendo testado e em que condições. O ideal é que os testes de unidades sejam lineares, lógica condicional em testes prejudica o entendimento.

## Duplicação de Código em Testes 📄🚫

Se você tem código repetido em vários testes, talvez haja uma maneira mais eficiente de organizar isso.

Test Smells são como um sinal de que talvez você possa simplificar ou organizar melhor seus testes. Não é que você nunca possa ter um "se" num teste ou um teste um pouco mais longo, mas é um lembrete para parar e pensar: *"Tem um jeito mais simples de fazer isso?”*

---

A maior parte desse conteúdo veio do livro "Engenharia de Software Moderna", escrito por Marco Tulio Valente. Esse livro é um tesouro cheio de dicas sobre como criar testes do jeito certo, usando o que tem de mais novo e eficiente no mundo da programação. Entretanto, a única diferença, é que o livro é em Java e aqui eu adaptei para utilizar Javascript.

---
JSON Essentials: A Beginner's guide
Tags: json, javascript, web, webdev
Published: 2024-04-06 17:41:27

JSON stands for Javascript object notation. It is a lightweight text format for storing and transporting data.
It is easy for humans to read and write. It is easy for machines to parse and generate. 

```json
{
  "squadName": "Super hero squad",
  "formed": 2016,
  "active": true,
  "members": [
    {
      "name": "Molecule Man",
      "age": 29,
      "powers": ["Radiation resistance", "Turning tiny", "Radiation blast"]
    },
  ]
}
```

## History of JSON
Douglas Crockford originally specified the JSON format in the early 2000s. He and Chip Morningstar sent the first JSON message in April 2001.

## Before JSON
Before JSON was introduced, data is transported in XML format. Above JSON can be written in XML as

```xml
<superHeroSquad>
  <squadName>Super hero squad</squadName>
  <formed>2016</formed>
  <active>true</active>
  <members>
    <member>
      <name>Molecule Man</name>
      <age>29</age>
      <powers>
        <power>Radiation resistance</power>
        <power>Turning tiny</power>
        <power>Radiation blast</power>
      </powers>
    </member>
  </members>
</superHeroSquad>
```

## JSON
JSON is a data representation format based on the subset of the Javascript Programming Language Standard ECMA-262 3rd Edition. 

When sending JSON data over a network, it is serialized into a string format, which can then be transmitted using various protocols such as HTTP, WebSocket, or others. Upon receiving the JSON string, the recipient can deserialize it back into a data object in their programming language of choice for processing. JSON filenames use the extension `.json`. 

## JSON structure

- **A collection of name/value pairs**: 
In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
- **An ordered list of values**: 
In most languages, this is realized as an array, vector, list, or sequence


## JSON Syntax Rules
- Data is in name/value pairs
- Data is separated by commas
- Curly braces hold objects
- Square brackets hold arrays

## Arrays as JSON
We can also convert arrays to/from JSON. Below is also valid JSON, for example:
```json
[
  {
    "name": "Molecule Man",
    "age": 29,
    "powers": ["Radiation resistance", "Turning tiny", "Radiation blast"]
  },
]
```

## Advantage of JSON
- self describing and easy to understand
- programming language independent
- Its syntax is very small, easy, and light-weighted that’s the reason it executes and responds in a faster way.
- It has a wide range for browser support compatibility with the operating systems. It doesn’t require much effort to make it all browser compatible.

## Disadvantages of JSON
-  There is no error handling in JSON. If there was a slight mistake in the script then you will not get the structured data.
- It has limited supported tools that we can use during the development.
🚀 My Cloudflare AI Challenge Submission: Story and Image Generator
Tags: cloudflarechallenge, devchallenge, ai
Published: 2024-04-06 17:19:30

Hey there, fellow developers!

🌟 I'm happy to present my submission for the [Cloudflare AI Challenge](https://dev.to/devteam/join-us-for-the-cloudflare-ai-challenge-3000-in-prizes-5f99): the Story and Image Generator!

## What I Built

📚 I created an interactive Story and Image Generator using Cloudflare Workers and AI models. Now, users can use this to generate fun stories paired with captivating images simply by providing a prompt.

## Demo

🎉 Check out the live demo of the Story and Image Generator: [Story and Image Generator Demo](https://story-tell-api.bobbyiliev.workers.dev/)

![Story and Image Generator Demo](https://imgur.com/Ax7c9fZ.gif)

## My Code

👨‍💻 [Story and Image Generator Repository](https://github.com/bobbyiliev/cloudflare-ai-worker-demo)

## Journey

🚀 During this journey, I explored the Cloudflare Workers and AI models. I've used Cloudflare workers in the past for other projects, but it was fun see how easy it is to integrate their AI models as well!

Integrating two AI models — one for story generation and another for image creation — was very straightforward thanks to the great documentation. This really will allow developers to take full advantage of well-trained models easily through the Cloudflare Workers integration.

🎨 I learned a lot and I am very impressed with the models and the ease of integration that Cloudflare offers! The real-time content generation using event streaming added some extra layer of excitement to the project. 

🔮 In the future, I plan to add Text to Speech once that model is available!

**Multiple Models and/or Triple Task Types**

✨ My project utilized two AI models—one for story generation and another for image creation. Therefore, it qualifies for the "Multiple Models" category in the Cloudflare AI Challenge.

<!-- Thanks for participating! -->
Understanding How Java Code Runs Behind the Scenes
Tags: java, learning
Published: 2024-04-06 16:57:48

Java, known for its platform independence, relies on the Java Virtual Machine (JVM) to execute code. Whether you’re using Windows, Linux, or Mac, as long as you have the JVM installed, you can run Java applications. Let’s delve into the intricacies of how Java works behind the scenes.

#1. Compilation and Bytecode
You create the source code—a composition of classes, methods, and variables. The JVM isn’t ready for your code yet.

**Source Code Composition:**
You create the source code—a composition of classes, methods, and variables.
The JVM isn’t ready for your code yet.
**The Java Compiler’s Role:**
The Java compiler (Java C) translates your human-readable code into **bytecode**.
Bytecode is an enigmatic form—the sheet music for the JVM.
**The JVM Takes Over:**
The JVM steps onto the stage. It reads the bytecode, interprets it, and orchestrates execution. The JVM is platform-specific, like a maestro trained for a particular concert hall (operating system).
**The Main Method:**
Every Java file needs a special protagonist—the main method. This method serves as the entry point when the curtains rise.
**The Class Ensemble:**
Java is object-oriented; a class is essential. Without a class, the JVM refuses to play the overture.
**Code Execution:**
After compilation, the code becomes bytecode. When you run it with the java command, specifying the class name, the JVM executes it.

#2. Object-Oriented Ballet
Java pirouettes in the realm of objects. To create, you must define a class—a choreography for your objects. Objects twirl, encapsulating data and behavior, while inheritance and polymorphism waltz gracefully.

#3. JDK and JRE
**JDK (Java Development Kit):**
Developers use the JDK during development. It includes the JVM, libraries, and additional resources.
**JRE (Java Runtime Environment):**
When running Java applications on other machines, only JRE is needed. It consists of the JVM and essential libraries.

#4. “Write Once, Run Anywhere"
Java’s allure lies in its promise: “Write once, run anywhere.” But how does it achieve this magic?
**The JVM’s Sorcery:**
Unlike C++, which compiles directly into machine code (tied to a specific environment), Java’s JVM bridges worlds.
Bytecode, our universal notation, can be interpreted into machine code on any device.
The JVM whispers to each processor, translating our poetic bytecode into tangible instructions.

#5. The Final Note
Next time you compose a Java masterpiece, remember the unseen orchestra—the JVM, the bytecode, and the class harmonies. Beneath the surface, they weave a tapestry of universality, echoing across platforms. So, fellow composer, let your code sing, and may your JVM conduct symphonies in every corner of the digital concert hall 🎵🌟.
Learning AWS Day by Day — Day 29 — S3 Hands-On — Part 3
Tags: aws, cloud, cloudcomputing, beginners
Published: 2024-04-06 16:53:41

Exploring AWS !!

**Day 29:**

**S3 Hands-On: Part 2**

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



**Task**:

1. Enable versioning for the bucket created in task 1
2. Now upload the same 2 objects and verify if the versioning works

**Solution**:

1. Go to S3 bucket created previously and open it

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



2. Go to Properties tab and click Edit under Bucket Versioning

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



3. Click Enable to enable the Versioning

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



4. Bucket Versioning will be enabled

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



5. Upload the same files again to check if Versioning is working

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



6. The files are uploaded

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



7. The previous files will be replaced by latest one

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