teleren/devto huggingface dataset:
Implementing Landscape Mode for Smartphones: iPhone Pro Max Compatibility Without Affecting PC Displays
Tags: css
Published: 2023-08-09 07:17:28


---
title: "Implementing Landscape Mode for Smartphones: iPhone Pro Max Compatibility Without Affecting PC Displays"
published: true
description: "Learn how to implement landscape mode specifically for smartphones, including iPhone Pro Max, without affecting PC screens."
tags: css,  
---



I recently had to make a project compatible with smartphones in landscape mode. Since I've never done proper landscape support before, I struggled a bit. So I'm sharing this as a reference for myself and others.

## Table of Contents
1. [Basics of landscape](#basic-landscape)
2. [Why does it affect PCs?](#why-pc-affected)
3. [iPhone Pro Max landscape settings](#iphone-pro-max-landscape)
4. [An example](#example)
5. [Conclusion](#conclusion)


### <a name="basic-landscape"></a>1. Basics of landscape
The basic landscape setting is as follows:

```css
@media (orientation: landscape) {
  /* Write styles to be applied to devices in landscape orientation here */
}
```

### <a name="why-pc-affected"></a>2. Why does it affect PCs?
The landscape orientation is applied when the device's display area is wider than it is tall. As many PC displays fall under this definition, it also affects PCs.

### <a name="iphone-pro-max-landscape"></a>3. iPhone Pro Max landscape settings
Since the width of the iPhone Pro Max is 428 pixels, we will set the `max-height` to `450px` for compatibility.

```css
@media (orientation: landscape) and (max-height: 450px) {
  /* Write styles to be applied to devices in landscape orientation here */
}
```

### <a name="example"></a>4. An example
Below is a sample using this method, which only applies to smartphones in landscape orientation.

```css
@media (orientation: landscape) and (max-height: 450px) {
  body {
    background-color: #f0f0f0;
  }

  .landscape-text {
    font-size: 20px;
  }
}
```

### <a name="conclusion"></a>5. Conclusion
When you need to support landscape mode on smartphones, don't forget to set `max-height: 450px`. This will allow you to use landscape without affecting PC screens. Try implementing landscape support effectively with this method!

---

If you found this article helpful, please like and share!
Hosting a Static Website in Github: 2023 edition
Tags: jamstack, githubactions, learning
Published: 2023-08-09 07:12:03

During the years of self managing VPS servers and hosting Wordpress I got allergic to all that trouble and struggle. There has been many good options for hosting websites, being that Wordpress or not, but webhotels were always kinda sluggish and free versions especially unreliable and with limited features.

For my hobby projects I liked using Heroku for a good amount of time. It was easy, cheap to free, pure joy. But as we all know that's ruined now.

At work I don't mind using AWS or Azure, maybe even GCP if someone pays enough. On the spare time I don't have the patience for having and using multiple platforms for all my projects. I like it easy, without magic, everything in the same place and if possible for free.

Wordpress, Drupal and many other nightmares made me fall in love with static site generators. I do like Jekyll and Gatsby, but because of the tech stack used at work I prefer NextJS. However, for writing this blog I decided to try something else, something new, something fresh - Eleventy or 11ty.

## Github Pages

Github pages has been a good way to host a static website for a long time, but the need to build the site and commit to another branch was always a struggle for me, it felt like I'm doing something wrong, and often I did, because it didn't work as expected. Not to mention always forgetting to put `.nojekyll` file in the repo.

Okay, it's not ideal but manageable. I just would write my blog or website content locally, build locally and push to Github, then it will update the site from the branch dedicated for the github pages. Still with me? Okay good, let's dive deeper.

## Github Actions

Nowadays you can use Github Actions to build and deploy your Github Page. Yes, you read correctly. No need to have dedicated branch for the built version of the static website, no need to build the site locally, no more.

In GH Actions you just need to install your depencies if any, run the build command, build the artifact and deploy to Github Pages, and voilá!

## Example Usage

Let's say you have a blog hosted in Github. You need to write a new post and publish it. Now you can just create new file to your project in the Github UI, write your content, commit and Github action will do the rest and boom! Blog updated!

## How to get started

I have build and shared a github template, the same as I'm using for this blog, so you are able to get fast start with launching your next blog in github - grab it from here: [11ty-gh-actions-template](https://github.com/lehtu/11ty-gh-actions-template/)
Finding Your Coding Habitat: Where Do You Thrive Best?
Tags: codenewbie, beginners, discuss, career
Published: 2023-08-09 07:00:00

_Welcome to "Discover Your Code," guided by our official DEV moderator, Sloan the Sloth 🦥. This series is designed to help aspiring coders and students explore the coding universe, ignite their passion, and find their ideal career paths._

Today's question is:

> Consider your work environment preferences, from collaborative offices to remote coding adventures. Where do you thrive?

Responses from newbies and experienced devs alike are encouraged in order to broaden our horizons and showcase different POVs.

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*
Did Remote Work Uproot Your Routine?
Tags: discuss, carreer
Published: 2023-08-09 07:00:00

_This week we're chatting all things remote work, and we want to hear from you about your experiences, pros, cons, and advice for those transitioning or considering remote work options._

Let's dive into today's topic of conversation... 

> Share your experience transitioning to remote work and how it affected your daily routine. What challenges did you face in adapting to the new work environment, and how did you overcome them?

Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
What is Closure in Python?
Tags: python
Published: 2023-08-09 06:43:33

In Python, a closure refers to a function object that retains the values of variables from the enclosing scope, even after the scope has finished executing. This means that the function "closes over" the variables, preserving their values for future use, even when the enclosing scope is no longer active. 

Closures are a powerful and advanced feature of Python's function system, allowing for more flexible and functional programming patterns.

Closures are often used in scenarios where you want to create functions that encapsulate certain behaviors or configurations. They can be particularly useful when you need to create functions with customizable behavior or when you want to maintain state across multiple calls to a function. Apart from it by obtaining [Python Master Course](https://www.edureka.co/masters-program/python-developer-training), you can advance your career as a Python. With this course, you can demonstrate your expertise in the basics of to Data Science, Machine Learning, Deep Learning, Natural Language Processing, many more fundamental concepts.

A common use case for closures is in creating factory functions. These functions generate and return other functions with specific behavior based on the parameters passed during their creation. The enclosed variables capture the state of the factory function at the time of creation, allowing the generated functions to access and utilize that state even when they're called in a different scope.

**Here's a simplified example of a closure in Python:**

```python
def make_multiplier(factor):
    def multiplier(number):
        return number * factor
    return multiplier

double = make_multiplier(2)
triple = make_multiplier(3)

print(double(5))  # Output: 10
print(triple(5))  # Output: 15
```

In this example, the `make_multiplier` function is a closure factory. When you call `make_multiplier(2)`, it returns a new function `multiplier` that captures the value of `factor` (which is 2) from the enclosing scope. When you call `double(5)`, it uses the captured value to multiply 5 by 2.

Closures are a powerful tool for creating more dynamic and versatile functions in Python. They allow for the creation of functions that can remember and utilize the context in which they were created, leading to more expressive and efficient code.
To infinity and beyond 🚀
Tags: intro, beginners
Published: 2023-08-09 06:39:55

> ## Why am I writing?

I enjoy writing in general.

If there's something I did well in 2023, it's receiving decent grades at BCIT, getting the opportunity to do a Co-op, and the proudest achievement is consistently keeping a diary. Usually, when the new year arrives, buying a new diary has been a sort of tradition after becoming an adult.

While reflecting on past diaries, I took the time to read through the chaotic diary of 2020, and while setting a dream for 2021, I was able to engage in my own form of studying. 

Anyway, as I reflected on the writings composed of tangled sentences, it naturally guided me towards how to live from the standpoint of 2023.

This blog also came about with the thought of creating not just a record or study notes but a compass for my future self.

Having a dream and following that path, these writings become an affectionate compass.

It's as if this could be the README.md file of the project named JasperLife?

*Really want to make a branch of my life with...*
`git branch test_life`


> ## How should I make it?

First, I'll use it primarily to record what I've learned. 

Based on, STAR framework
`S - situation
T - task
A - Action
R - Result`
I'll document various situations that arise, set goals to improve them, and record the actions I took to achieve these results.

Starting from past projects and continuing through reflections, I believe I can document what I've felt, learned, and how my thoughts process have evolved over time.


> ## Conclusion?
Studying various topics related to programming and seeing the connections I've made along the way has brought me immense joy in my learning journey. And now, I realize that it's important to solidify what I've learned as I organize and document my studies up to the present.

Continuing to write this blog consistently, I hope to accurately delineate my areas of interest and contribute to significant growth in the future.

*And Ofcourse, I want to get lots of feedback from dev users🙂*
list of free faucets for various Public TestNets
Tags: web3, blockchain, token
Published: 2023-08-09 06:36:36

Finding a working faucet to acquire test tokens can be quite time-consuming ⌛, which is why we've compiled a list of free faucets for various Public TestNets 🚰: 

🔗 Check out the list here: https://buildbear.io/faucet 

Make sure to bookmark the site for your convenience!📌
NAME DP OR REGULAR DP
Published: 2023-08-09 06:27:50

DIFFERENCE BETWEEN A NAME DP OR REGULAR DP
Have you ever wondered what the A name DP is? Well, The A Name DP,    known as the Aesthetic Name Display Picture, is a trend that has gained significant popularity on social media platforms. It refers to using a generic or random image as your display picture on social media platforms instead of a personal photo. This trend has become increasingly popular as people seek to maintain their privacy and protect their identities in the digital age. By adopting an anonymous name DP, individuals can engage in online communities without revealing too much about themselves or attracting unwanted attention.
[Visit](https://storycriclecs.blogspot.com/name-dp-or-regular-dp
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y8a43h9ea4fq3vko3s2t.jpg))
POPULAR AND RELIABLE ONLINE NOTEPAD
Published: 2023-08-09 06:26:20

ARE THERE ANY POPULAR AND RELIABLE ONLINE NOTEPAD OPTIONS AVAILABLE?
In today's fast-paced digital world, online notepads have become essential for many individuals. With the increasing need for organization and easy access to notes and ideas, finding a reliable online notepad option is crucial. One popular choice is Google Keep, which offers a user-friendly interface and synchronizes seamlessly across multiple devices. It makes it convenient for users who switch between their computers, tablets, and smartphones throughout the day. Nowadays, you don't need to store your text or words on your laptops or computers. 
[Here](https://storycriclecs.blogspot.com/popular-and-reliable-online-notepad)
SHAHRUKH KHAN UPDATED HIS INSTAGRAM BIO
Published: 2023-08-09 06:25:07

Shah Rukh Khan, the renowned Bollywood actor and global icon, recently caught the attention of his millions of fans and followers by updating his Instagram status. Shah Rukh Khan created a significant buzz across social media platforms with a single change in his Instagram bio. As an individual with immense influence and popularity, every move he makes garners substantial interest, and this simple yet impactful alteration was no exception.
[Click](https://storycriclecs.blogspot.com/shahrukh-khan-updated-his-instagram-bio)
Power of Promises in JavaScript - Asynchronous Magic 🔥
Tags: javascript, frontend, programming, tutorial
Published: 2023-08-09 06:23:51

**Promise** is a good way to handle **asynchronous operations**.

It's used to find out if the asynchronous operation is successfully completed or not.

A promise may have one of three states

- Pending - process is not complete

- Fulfilled - operation is successful

- Rejected - an error occurs

## Create a Promise
To create a promise object, we can use the **Promise()** constructor

```javascript
let promise= new Promise(function(resolve,reject){
   //do something
})
```

If the promise returns successfully, the **resolve()** function is called. And, if an error occurs, the **reject()** function is called.

### Example
Let's suppose that the program below is an asynchronous program.

```javascript
const count=true;
let countValue= new Promise(function(resolve,reject){
 if(count)
   {
     resolve("There is a count value");
   } else {
        reject("There is no count value");
   }
});
```
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u7t7c5micfkr4m1oe5rg.jpg)

## Promise Chaining
Promises are useful when you have to handle more than one asynchronous task, one after another.
For that, we use promise chaining.
You can perform an operation after a promise is resolved using methods then(), catch() and finally().

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

## then() Method
The then() method is used with the callback when the promise is successfully fulfilled or resolved.

```javascript
promiseObject.then(onfulfilled,onRejected);
```
You can chain multiple then() methods with the promise.

```javascript
//returns a promise
let countValue = new Promise(function(resolve,reject)
 {
  resolve("Promise resolved");
 })

// execute when promise is resolved successfully.
countValue.then(function successValue(result){
     console.log("result");
}).then(function successValue1(){
     console.log("You can call  multiple functions this way.");
});

// Promise resolved
// You can call multiple functions this way
```

## catch() Method
The catch() method is used with the callback when the promise is rejected or if an error occurs.

```javascript
//returns a promise
let countValue = new Promise(function(resolve,reject){
   reject("Promise rejected");
})

// execute when promise is resolved successfully.
countValue.then(function successValue(result){
    console.log("result");
}).catch(function errorValue(result){
    console.log("result");
});

// Promise rejected

```

## Promises Vs Callback
<table>
<tr>
<th>JavaScript Promise</td>
<th>JavaScript Callback</td>
</tr>
<tr>
<td>The syntax is user-friendly and easy to read</td>
<td>The syntax is difficult to understand</td>
</tr>
<tr>
<td>Error handling is easier to manage</td>
<td>Error handling may be hard to manage</td>
</tr>
<tr>
</table>
Clean UI Guide: 15 White Space Design Tips 🚀💡
Published: 2023-08-09 05:17:03

White space, also known as negative space, is the blank area around the design elements of a user interface (UI). It plays an important role in creating a visually appealing and easy-to-use UI. Here are 15 white space design tips to help you create a clean UI:

1. Use white space to **create a clear hierarchy of information**. More white space can be used to separate important elements from less important ones.

2. Use white space to **make important elements stand out**. It can help to draw the eye to a call to action or other important feature.

3. Use ample white space between lines of text to **improve readability**. This makes it easier for users to read and understand the content on your website or app.

4. Use generous padding around buttons and other **interactive elements**. This makes them easier to click on, which is important for improving usability.

5. **Use consistent spacing throughout your UI**. This helps to create a sense of order and balance.
 
6. Use white space to **create a sense of breathing room**. This makes your UI feel less cluttered and overwhelming.
 
7. Use white space to **create a focal point**. This can be achieved by increasing the amount of white space around a particular element.

8. Use white space to **group related elements together**. This can help to create a visual hierarchy and make it easier for users to understand the content on your site or app.

9. Use white space to **create a sense of elegance and sophistication**. By using white space effectively, you can create a design that looks clean, modern, and stylish.
 
10. Use white space to **create contrast**. This can help to make important elements stand out from the background.

11. Use white space to **create a sense of movement**. This can be achieved by using white space to guide the eye from one element to the next.

12. Use white space to **create a sense of order**. By using white space effectively, you can create a design that looks organized and well thought out.
 
13. Use white space to **create a sense of simplicity**. A design with ample white space can look clean and simple, which can be very effective in certain contexts.

14. Use white space to **create a sense of professionalism**. A design that makes good use of white space can look polished and professional, which can be very important for certain types of websites and apps.

15. Use white space to **create a sense of balance**. By using white space effectively, you can create a design that looks balanced and harmonious, which can be very appealing to users.



Hope you like it.

That’s it — thanks.

To read my other articles [click here](https://dev.to/margishpatel).

---

👋Hey there, Let’s connect on:

Linkdin: [Margish Patel](https://www.linkedin.com/in/margish-patel-63843b1b5)
Twitter: [@margish96patel](https://twitter.com/margish96patel?t=ruk_O0DrnioOU_yQmHcWbw&s=09)
Email: [babariyamargish97@gmail.com](babariyamargish97@gmail.com)
Spring - H2, JPA starter ->
Published: 2023-08-09 05:09:54

### 1. Add H2, JPA dependencies

In case you are using gradle you can add the following to your `build.gradle`

```java
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'

```

### 2. H2 jpa configration
set the jpa and H2 configs in 

`application.properties`
```java
spring.h2.console.enabled=true
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driverClassName=org.h2.Driver

spring.datasource.url=jdbc:h2:file:./data/dcbappA
spring.datasource.username=user
spring.datasource.password=

```

### 3. Creating Entity 
This entity will be added as a new table in the database.

`model > Customer.java`

```java
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
public class Customer {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    private String name;
    private String Address;
    private Long phone;

}
```

### 4. Creating repository
Repository extendss the JPA to provide prebuild queries.

`repository > CustomerRepository`

```java
@Repository
public interface CustomerRepository  extends JpaRepository<Customer,Long> {

}
```
🔥 Introducing Zogo: A Powerful Custom Validation Library for Go
Tags: go, backend, developer, webserver
Published: 2023-08-09 04:50:34


## Introduction:
Hey fellow developers! 🚀 Are you tired of writing repetitive validation code for your Go projects? Look no further! Allow me to introduce you to **Zogo**, a blazing-fast custom validation library that will simplify your life and help you maintain cleaner and more organized code.

## What is Zogo?
**Zogo** is a comprehensive validation library crafted specifically for Go developers. With Zogo, you can effortlessly validate various data fields in your applications using a collection of pre-built validation rules. Whether you're validating strings, numbers, emails, booleans, or any other type of data, Zogo has got your back!

## Key Features:
- ✅ **Ease of Use:** Zogo provides a user-friendly API that makes adding validation rules a breeze.
- ⚡ **Customizable:** Tailor validation rules to your specific project requirements.
- 📋 **Available Validation Rules:** Min/Max Length, Min/Max Value, String Not Empty, Email, Boolean, and more!
- 🚀 **High Performance:** Zogo is designed for speed, ensuring minimal impact on your application's performance.
- 🧪 **Tested and Reliable:** Rigorously tested to ensure stability and reliability.
- 📚 **Detailed Documentation:** Comprehensive documentation to guide you through usage.

## Example: Validating Age with Zogo
Let's say you want to validate a person's age, ensuring it's represented as a string of at least 2 characters and not less than 18. With Zogo, achieving this is a breeze:

```go
validator := zogo.NewFormValidator()

validator.AddRule("age", zogo.MinLengthValidator(2)) // Minimum of 2 characters


data := map[string]interface{}{
	"age": "20", // Age as a string
	// ... other fields
}

if err := validator.Validate(data); err != nil {
	fmt.Println("Validation Error:", err)
} else {
	fmt.Println("Data is valid.")
}
```

## Get Started with Zogo:
Getting started with Zogo is super easy! Just install it via:

```bash
go get github.com/frantchessico/zogo

```

You can find detailed usage instructions, examples, and more in the [Zogo GitHub repository](https://github.com/frantchessico/zogo).

## Conclusion:
Say goodbye to writing repetitive validation code and embrace the power of Zogo! Experience efficient, customizable, and high-performance validation in your Go projects. Give Zogo a try and unlock a new level of development productivity today. Happy coding! 💻🚀

---

Feel free to tweak the content to suit your preferences and needs. Make sure to replace "yourusername" and "yourproject" with the actual GitHub username and project name before posting on dev.to. Good luck with your post!