teleren/devto huggingface dataset:
Passing Objects to Methods
Tags: java, programming, learning, beginners
Published: 2024-06-03 19:27:52

Passing an object to a method is to pass the reference of the object. You can pass objects to methods. Like passing an array, passing an object is actually passing the reference of the object. The following code passes the **myCircle** object as an argument to the **printCircle** method:

```
  public class Test {
  public static void main(String[] args) {
  // CircleWithPrivateDataFields is defined in Listing 9.8
  CircleWithPrivateDataFields myCircle = new
  CircleWithPrivateDataFields(5.0);
  printCircle(myCircle);
  }
 
  public static void printCircle(CircleWithPrivateDataFields c) {
 System.out.println("The area of the circle of radius "
 + c.getRadius() + " is " + c.getArea());
 }
 }
```

Java uses exactly one mode of passing arguments: pass-by-value. In the preceding code, the value of **myCircle** is passed to the **printCircle** method. This value is a reference to a **Circle** object.
The program below demonstrates the difference between passing a primitive type value and passing a reference value.

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

`Radius    Area
1.0         3.141592653589793
2.0        12.566370614359172
3.0        29.274333882308138
4.0        50.26548245743669
5.0        79.53981633974483
Radius is 6.0
n is 5`

The **CircleWithPrivateDataFields** class is defined in the previous post. The program passes a **CircleWithPrivateDataFields** object **myCircle** and an integer value from **n** to invoke **printAreas(myCircle, n)** (line 11), which prints a table of areas for radii **1**, **2**, **3**, **4**, **5**, as shown in the sample output.

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

Figure above shows the call stack for executing the methods in the program. Note that the objects are stored in a heap.

When passing an argument of a primitive data type, the value of the argument is passed. In this case, the value of **n** (**5**) is passed to **times**. Inside the **printAreas** method, the content of **times** is changed; this does not affect the content of **n**.

When passing an argument of a reference type, the reference of the object is passed. In this case, **c** contains a reference for the object that is also referenced via **myCircle**. Therefore, changing the properties of the object through **c** inside the **printAreas** method has the same effect as doing so outside the method through the variable **myCircle**. Pass-by-value on references can be best described semantically as _pass-by-sharing_; that is, the object referenced in the method is the same as the object being passed.
Building PDF Open Source Services with Angular & GCP - Architecture Overview
Tags: angular, webdev, gcp, firebase
Published: 2024-06-03 19:20:37

Welcome to the first part of the journey in building open source PDF service using Angular (Analogjs), Firestore, Cloud Storage, and CloudRun. This project serves as a platform for sharing my knowledge, continually learning best practices, and simultaneously contributing to the community.

**Part 1: [Architecture Overview](https://dev.to/dalenguyen/building-pdf-open-source-services-with-angular-gcp-part-1-4pi3)**
Part 2: [Deploy services to Cloud Run](https://dev.to/dalenguyen/building-pdf-open-source-services-with-angular-gcp-deploy-services-to-cloud-run-56i)

Demo: https://pdfun.xyz 
GitHub: https://github.com/dalenguyen/pdfun

## The First Feature: Upload and Resize PDF Files (Unsecured - kind of)

Our first feature is all about simplicity and functionality. It allows you to upload and resize PDF files. This feature is designed with a user-friendly interface that makes it easy for anyone to use, regardless of their technical background.

![Resize PDF file UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1owro0exr6vt9bh62abb.png)

There is no security in place if you don't log in the application. Anyone know how Firebase works, can access the file that you uploaded. The only security measure for publicly is that all files will be deleted in 1 day.

## Technology Stack

The technology stack we've chosen for this project includes Angular (Analgojs), Firestore, Cloud Storage, and CloudRun. These technologies were chosen for their robustness, scalability, and ease of use. They work together seamlessly to provide a smooth user experience.

Here is the flow:

![PDF processing event flow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3b48s9wh9dmd8mhzu067.png)

- First, you upload their PDF file
- The UI will upload their file to Cloud Storage + a record in Firestore
- Created event from Firestore will trigger a service from Cloud Run
- Cloud Run retrieve data from Firestore & file from Cloud Storage
- Cloud Run start to resize the PDF, then upload it back to Cloud Storage and Firestore
- The updated record will reflect on the UI with link for users to download the resized file
- All PDF files / records will be delete after 1 day based on the TTL policy

## Try It Out

I encourage you to try out our service. You can support me by starring the GitHub repository or sponsoring the project. Your support helps the project continue to improve and add new features.

## Questions?

If you have any questions or run into any issues, please don't hesitate to [create an issue](https://github.com/dalenguyen/pdfun/issues) on our GitHub repository. Alternatively, you can chat with me. I'm here to help and would love to hear your feedback.

Stay tuned for **Part 2** where I will show you how to secure your uploaded files. Until then, happy coding!
Lifetime access for Limited Users!
Tags: webdev, beginners, javascript, productivity
Published: 2024-06-03 19:00:48


Lifetime access for Limited Users!

PortfolioBee
Home
Contact
Login
Sign up
Cart
1
1 item
Everything at a Glance
In today’s competitive job market, standing out is crucial. PortfolioBee lets you present all your skills, achievements, and projects in one visually appealing space. Transform your journey and make a greater impact.

Unified Presentation of Skills
Easily showcase your technical, creative, and soft skills. PortfolioBee's user-friendly design helps you organize and highlight your strengths, making it easy for potential employers to recognize your depth of knowledge.


Detailed Project Showcases
Demonstrate your skills and results with PortfolioBee. Upload images, videos, and links to live projects or code repositories, providing a detailed story of your work. Help employers understand your skills and creativity better.

Subscribe to our emails
for tips to Showcase Your Skills and Land Your Dream Projects

Email
Email
Privacy Policy Refund Policy Shipping Policy Terms of Service Contact Information About us
Facebook
Instagram
Payment methods
© 2024, PortfolioBee
Visibility Modifiers
Tags: java, programming, learning, beginners
Published: 2024-06-03 18:56:32

Visibility modifiers can be used to specify the visibility of a class and its members. You can use the **public** visibility modifier for classes, methods, and data fields to denote that they can be accessed from any other classes. If no visibility modifier is used, then by default the classes, methods, and data fields are accessible by any class in the same package. This is known as _package-private_ or _package-access_.

Packages can be used to organize classes. To do so, you need to add the following line as the first noncomment and nonblank statement in the program:

`package packageName;`

If a class is defined without the package statement, it is said to be placed in the _default package_. Java recommends that you place classes into packages rather than using a default package.

In addition to the **public** and default visibility modifiers, Java provides the **private** and **protected** modifiers for class members. This section introduces the **private** modifier.

The **private** modifier makes methods and data fields accessible only from within its own class. Figure below illustrates how a public, default, and private data field or method in class **C1** can be accessed from a class **C2** in the same package and from a class **C3** in a different package.

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

If a class is not defined as public, it can be accessed only within the same package. As shown below, **C1** can be accessed from **C2** but not from **C3**.

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

A visibility modifier specifies how data fields and methods in a class can be accessed from outside the class. There is no restriction on accessing data fields and methods from inside the class. As shown in Figure below (b), an object **c** of class **C** cannot access its private members, because **c** is in the **Test** class. As shown in Figure below (a), an object **c** of class **C** can access its private members, because **c** is defined inside its own class.

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

The **private** modifier applies only to the members of a class. The **public** modifier can apply to a class or members of a class. Using the modifiers **public** and **private** on local variables would cause a compile error.

In most cases, the constructor should be public. However, if you want to prohibit the user from creating an instance of a class, use a _private constructor_. For example, there is no reason to create an instance from the **Math** class, because all of its data fields and methods are static. To prevent the user from creating objects from the **Math** class, the constructor in **java.lang.Math** is defined as follows:

`private Math() {
}`
Returning HTML With fetch()
Tags: webdev, javascript, programming, tutorial
Published: 2024-06-03 18:55:36

You can use the hmpl-js package to load HTML from the server. It works on `fetch`, so it can help you avoid writing a bunch of code:

```html
<div id="wrapper"></div>
<script src="https://unpkg.com/hmpl-js"></script>
<script>
const templateFn = hmpl.compile(
  `<div>
    <button class="getHTML">Get HTML!</button>
    <request src="/api/test" after="click:.getHTML"></request>
  </div>`
);

const wrapper = document.getElementById("wrapper");

const elementObj = templateFn({
  credentials: "same-origin",
  get: (prop, value) => {
    if (prop === "response") {
      if (value) {
        wrapper.appendChild(value);
      }
    }
  },
});
</script>
```

or

```javascript
import { compile } from "hmpl-js";

const templateFn = compile(
  `<div>
    <button class="getHTML">Get HTML!</button>
    <request src="/api/test" after="click:.getHTML"></request>
  </div>`
);

const wrapper = document.getElementById("wrapper");

const elementObj = templateFn({
  credentials: "same-origin",
  get: (prop, value) => {
    if (prop === "response") {
      if (value) {
        wrapper.appendChild(value);
      }
    }
  },
});
```
The function will fire dynamically, depending on the update of properties in the object.
Understanding the differences between JavaScript, Node.js, and Express.js
Tags: javascript, node, express, web
Published: 2024-06-03 18:48:52

## What is JavaScript?

JavaScript is a popular programming language primarily used to make websites interactive. When you click a button and something happens on a webpage, it's likely thanks to JavaScript. It's like the magic behind the scenes that makes web pages dynamic and engaging.

- Where is it used? JavaScript runs in your web browser. It works with HTML and CSS to create and style web pages.
- What can it do? It can update content, control multimedia, animate images, and much more.

## What is Node.js?
Node.js is a powerful tool that lets JavaScript run outside of your web browser. Imagine you have a kitchen (your computer) where you can cook (run programs). Normally, you can only cook in the kitchen using a specific type of stove (the web browser). Node.js is like getting a new, versatile stove that allows you to cook anywhere in the kitchen (on your computer).

- Where is it used? Node.js is used on servers, which are like the kitchens that serve web content to users.
- What can it do? It can handle server-side tasks like reading files, connecting to databases, and managing multiple user requests at the same time.

## What is Express.js?
Express.js is a framework built on top of Node.js that helps developers build web applications easily. Think of it like a set of kitchen tools and recipes designed to make cooking specific dishes (web applications) faster and more efficient.

- Where is it used? Express.js is used in server-side development to build web applications and APIs (tools that let different software applications communicate with each other).
- What can it do? It simplifies the process of building web servers, managing routes (paths to different pages), and handling HTTP requests (the messages browsers send to servers).

Putting It All Together
**JavaScript:** The language used to make web pages interactive. It runs in the browser.

**Node.js:** A tool that allows JavaScript to run on servers, enabling it to handle backend tasks.

**Express.js:** A framework that sits on top of Node.js, making it easier to build web applications and APIs.

Example Scenario
Imagine you want to build a simple web application:

**Front End:** You use JavaScript to make your web pages interactive. Users can click buttons and see animations or updates without reloading the page.

**Back End:** You use Node.js to handle requests from the front end, interact with a database, and send back the needed information.

**Express.js:** You use Express.js to set up the server, define routes (like "/home" or "/profile"), and manage user requests efficiently.

By combining these tools, developers can create powerful, interactive web applications that are easy to maintain and scale.




I hope this article helps you❤️

Check out my other handles: richard.is-a.dev/about
🔥🔥🔥 NOTCOIN NEW LISTINGS🔥🔥🔥
Published: 2024-06-03 18:44:26


🚀Notcoin is a rapidly emerging cryptocurrency that has gained significant traction in recent months, propelled by social media interest. Its price surged over 300% in the past week alone, reaching a new all-time high. With a growing user base of over 30 million on Telegram, Notcoin is poised to continue its upward trajectory in the crypto market. 

The list of exchanges with NOT/USDT trading pair:

1️⃣ WhiteBIT
2️⃣ Huobi
3️⃣ OKX
4️⃣ Gate.io
5️⃣ KuCoin
6️⃣ Bitfinex
7️⃣ Binance
8️⃣ BitMart
9️⃣ Hotbit
🔟 CoinEx 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pe4f5654nl1aw2yvgea8.png)
Pure SVG color change animation
Tags: svg, animation, color, codepen
Published: 2024-06-03 18:41:57

A first SVG animation, using the animate tag to change between several different colors.

## 1. Create the SVG shape.
This one is just a square `<rect>` 100 pixels long, with a color fill of blue `#0000ff` and a stroke color black `#000000`.

```<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
  <rect x="0" y="0" height="100" width="100" fill="#0000ff" stroke="#000000">
  </rect>
</svg>```

## 2. Add the animate code

Add the `animate` tag inside the square's `<rect>`to flash between multiple colors using hex color codes held in `values` (#00ff00 green, #ff00ff purple, #ff0000 red) and the timings for each is held by `keyTimes`. The values in keyTimes must be between 0 and 1.


```<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">
  <rect x="0" y="0" height="100" width="100" fill="#0000ff" stroke="#000000">
  <animate
  attributeName="fill"
  attributeType="XML"
  keyTimes="0; 0.5; 1"
  begin="0s" dur="5s" values="#00ff00;#ff00ff;#ff0000"
  calcMode="discrete"
  repeatCount="indefinite"/>
  </rect>
</svg>```

## 3. Run it

You can also embed it within a HTML document, eg in the `<body>` tag or a `<div>`.

{%codepen  https://codepen.io/quiz-test/pen/bGyqJdo/ %}
3 ways to deal with architecture responsibilities in your team
Tags: architecture, learning
Published: 2024-06-03 18:26:05

When discussing software architecture, I've explored three primary ways to allocate responsibility within a team.


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

The first method involves appointing a dedicated architect. This approach centralizes decision-making and ensures consistency in architectural standards. However, it can sometimes lead to a bottleneck, as all architectural decisions funnel through one person, which can slow down the process and reduce team autonomy.

The second method distributes architectural responsibilities among the development team. Here, certain team members are assigned architecture-related tasks based on their expertise. This can enhance collaboration and leverage diverse perspectives, leading to more innovative solutions. However, it may also cause inconsistencies if team members have differing views on architecture principles and standards. Coordination becomes crucial to maintain alignment and coherence in architectural decisions.

![This org chart shows different architecture positions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bp6jdac0wuoqq3yprtr2.png)

The third approach treats architecture as a collective skill that every team member should possess. This method encourages a culture where everyone is involved in architectural discussions and decisions. It promotes a sense of ownership and shared responsibility, which can be motivating and empowering for the team. The challenge with this approach lies in ensuring that all team members have the necessary skills and understanding of architectural principles. It requires ongoing training and a strong commitment to knowledge sharing within the team.

Each approach has its pros and cons, and the best choice depends on the specific context of the organization and the nature of the projects being undertaken. A dedicated architect can provide clear guidance and maintain consistency, but may slow down decision-making. Distributing responsibilities can harness diverse ideas but requires strong coordination. Treating architecture as a shared skill fosters collaboration and ownership but demands continuous learning and alignment.

In my experience, finding the right balance is key. Often, a hybrid approach that combines elements of all three methods can be the most effective. This way, we can leverage the strengths of each approach while mitigating their weaknesses. Ultimately, the goal is to create a robust and flexible architecture that supports the organization's objectives and adapts to changing needs.

For more detailed insights, you can read the [full post in German] (https://www.raphaeldumhart.at/blog/3-arten-der-architektur-zustaendigkeit/).

Disclaimer: This post was partly created with AI for summary and translation.
Output Laravel SQL Query log
Published: 2024-06-03 18:19:33

You’ve likely encountered many query issues while developing software with Laravel. You might be wondering why your features are slow or how many queries your function is making to the database. You may not know if you’re experiencing N+1 problems or how to optimize your queries. This package is here to support you with those challenges.

**Install**
To install via Composer, run:

```
composer require bri4n0/sql-query-log
```
For version <= 11: Add to section providers of config/app.php:

```
// config/app.php
'providers' => [
    ...
    Bri4n0\SqlQueryLog\DataBaseQueryServiceProvider::class,
];
```
For version >= 11: Add to section providers of bootstrap/providers.php:

```
// bootstrap/providers.php
return [
    ...
    Bri4n0\SqlQueryLog\DataBaseQueryServiceProvider::class,
];
```
Set enable SQL query log, Add to .env:

```
ENABLE_SQL_LOG=true
```
**Others**
Custom logging channel:
open file config/logging.php add channel to section channels:
  

```
  'channels' => [
    ...,
     'sql-query-log' => [
            'driver'               => 'daily',
            'path'                 => storage_path('logs/queries.log'),
            'days'                 => env('LOG_DAILY_DAYS', 14),
            'replace_placeholders' => true,
        ],
    ]
```
enable using sql query log channel:

```
SQL_LOG_CHANNEL=sql-query-log
```
Custom logging channel level:

```
SQL_LOG_LEVEL=debug
```
show more: https://github.com/bri4n0/sql-query-log
How to Install MongoDB with OpenSSL 3 Support on Fedora 39
Tags: mongodb, fedora, linux
Published: 2024-06-03 18:14:52

If you're still having troubles running MongoDB + OpenSSL3 on Fedora, learn how to install it properly by checking my first article as a freeCodeCamp Publication Contributor: [How to Install MongoDB with OpenSSL 3 Support on Fedora 39](https://www.freecodecamp.org/news/how-to-install-mongodb-with-openssl-3-support-on-fedora-39/)
testing python code
Tags: programming, beginners, python, learning
Published: 2024-06-03 18:09:24

def test_user_names(first, last):
    """" a function that prompts for user names """

    full_name = first + " " + last
    return full_name.title()


guys above is my basic python code which is supposed to prompt for user input, first and last names.

note*.. i have written my file name containing the function above with a test_names.py, i have also done the same for the code below






below is the (unittest) code i am using to test if my code behaves correctly.

""" a class to test my test_names.py code"""

import unittest

from test_file_names import user_names


class test_nomencreture(unittest.TestCase):

    def test_namesakes(self):
        adder = user_names('john','pedro')
        self.assertEquals(adder, 'john pedro')





unittest.main()



....but for some reason am getting an error ,the test is failing ,the test is not running ,



----------------------------------------------------------------------
Ran 0 tests in 0.000s

NO TESTS RAN

Process finished with exit code 5

Empty suite


(i am a beginner forgive me if the error is too basic . i do not know what the empty suite means,your help will be much appreciated
My First Post!!!
Tags: mongodb, flutter, dart, socketio
Published: 2024-06-03 17:43:26

I am a CS Graduate Student at Illinois Tech. As I didn't land any internships for the summer, I have developed a hobby project.

I have developed a user-friendly chat application using my primary mobile applications development framework: Flutter. I have also utilized socket.io for bidirectional communication from my Flutter application to the MongoDB server for my backend.

My first post is to ask suggestions from fellow developers for suggestions on how to improve the efficiency of bidirectional communication and integrate rasa (chatbot) into my application.

Thank you for taking the time to read this post!