teleren/devto huggingface dataset:
Excluding Dependencies: Bundling for Node and the Browser
Tags: node, webdev, javascript, vite
Published: 2024-05-24 11:00:00

I stumbled upon this feature just yesterday, and it's one of those things that I'd like to never forget again. When sharing code between the client (running in the browser) and the server (running in Node.js), I usually place these shared functions in an internal package (internal means I don't publish it to npm), which I install in both the client and server projects.

For example, I needed to parse an HTML string into a DOM `Document`. The browser already supports the [`DOMParser`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser?retiredLocale=de) class, which is, unfortunately, not available in Node.js. Here, I have to fall back on [`JSDOM`](https://github.com/jsdom/jsdom), which also exposes this class.

So, a simple conditional check on `window` should be all we need:

```ts
import jsdom from 'jsdom';

let document: Document;

if (typeof window === 'undefined') {
  // we're running in Node.js
  const dom = new jsdom.JSDOM();
  const parser = new dom.window.DOMParser();
  document = parser.parseFromString(html, 'text/html');
} else {
  // we're running in the browser
  const parser = new DOMParser();
  document = parser.parseFromString(html, 'text/html');
}
```

Unfortunately, when bundling the client app (in my case with Vite), it will pull in all dependencies, including JSDOM. However, JSDOM uses Node.js internal packages like `vm`, which are not available in the browser, and therefore, the bundler will warn or even error on bundling.

Fortunately, as I learned yesterday, there is a `browser` field you can add to your `package.json` that lets you exclude or replace certain dependencies from the browser bundle:

```json
"browser": {
    "jsdom": false
}
```

When Vite (or rather esbuild) bundles the client app, it will not pull in the `jsdom` dependency into the browser bundle. Great!

There's one caveat to be aware of: the `jsdom` dependency is not available in the browser bundle, but the import statement is still in our code. During runtime in the browser, I assume the import statement will resolve to `undefined`. That means we cannot use a named import for `jsdom` because it will result in an error in the browser. We should use a default import and access the component when we are sure we're running in Node.js:

```ts
// Named imports like this will cause an error in the browser because jsdom is undefined.
import { JSDOM } from 'jsdom';

// Use a default import and access only when running in Node.js.
import jsdom from 'jsdom';

if (typeof window === 'undefined') {
  const dom = new jsdom.JSDOM();
}
```

The `browser` field is an official `package.json` field, but its structure is not documented by npm. I found the following unofficial spec on GitHub: [`browser` field specification](https://github.com/defunctzombie/package-browser-field-spec). Furthermore, esbuild also mentions this field in their docs for [bundling for Node](https://esbuild.github.io/getting-started/#bundling-for-node).
The Ultimate Guide to Choosing the Perfect Resort for Your Andaman Island Vacation
Published: 2024-05-24 10:58:04

An Andaman Island vacation is a journey into paradisiacal beauty, and choosing the right resort is paramount to ensuring an unforgettable experience. Amidst the myriad of options, De Foret Resort stands out as a beacon of luxury, tranquillity, and unparalleled hospitality. Join us on this ultimate guide as we unveil the charms of De Foret Resort, helping you make an informed decision for a truly [remarkable Andaman ](https://www.deforetresorts.com/blog/guide-to-choosing-perfect-resort-for-your-andaman-island-vacation)getaway.
Location, Location, Location:
The first consideration for any perfect resort is its location. De Foret Resort is strategically situated on Havelock Island, offering guests a front-row seat to the breathtaking beauty of the Andaman archipelago. With its proximity to pristine beaches and lush greenery, this resort is a haven for those seeking an idyllic tropical escape.
Accommodations that Exceed Expectations:
De Foret Resort takes pride in providing accommodations that seamlessly blend luxury and comfort. From spacious rooms with panoramic views to private villas nestled in the midst of nature, the resort caters to a variety of preferences. Immerse yourself in elegance and serenity, setting the stage for an unparalleled stay.
A Gastronomic Journey:
Culinary experiences play a pivotal role in any vacation, and De Foret Resort takes this aspect to new heights. Indulge in a gastronomic journey with a diverse range of dining options. From authentic local flavors to international cuisines, the resort's restaurants offer a feast for the senses, ensuring every meal is a memorable experience.
Unrivaled Amenities and Activities:
De Foret Resort is not just a place to stay; it's a destination in itself. The resort boasts a plethora of amenities, including a rejuvenating spa, a well-equipped fitness center, and a sparkling swimming pool. Adventure enthusiasts can partake in a variety of water sports, while families can enjoy quality time at the dedicated kids' club.
Warmth in Hospitality:
What truly sets De Foret Resort apart is its commitment to warm, personalized hospitality. The attentive staff goes above and beyond to ensure every guest feels not just welcomed, but truly cared for. From arrival to departure, the hospitality at De Foret Resort becomes an integral part of your Andaman Island experience.
Conclusion:
Choosing the perfect resort for your Andaman Island vacation is a decision that can shape the entire course of your journey. With its breathtaking location, luxurious accommodations, delectable dining, and unrivaled hospitality, De Foret Resort emerges as a top contender. Allow yourself to be captivated by the allure of this haven, where every moment is designed to elevate your Andaman experience to new heights. Your dream vacation awaits at De Foret Resort – a sanctuary of serenity, luxury, and boundless natural beauty.
Understanding printer and types of printer cartridges
Tags: replica
Published: 2024-05-24 10:56:48

Introduction:
In the digital age, printers remain a staple in both homes and offices. Whether you’re printing documents, photographs, or artwork, understanding printers and the cartridges they use is essential for efficient and cost-effective printing. One of the most common printing technologies used today is replica xerography, which forms the basis of many modern printers. Let’s delve into the intricacies of printers and explore the different types of [printer cartridge t](uhttps://replicaindia.com/understanding-printer-and-types-of-printer-cartridges/rl)hey employ.

Understanding Printers:
Printers come in various types, ranging from inkjet to laser printers. Inkjet printers work by spraying tiny droplets of ink onto paper, making them suitable for printing high-quality images and graphics. On the other hand, laser printers utilize replica xerography, a process that involves static electricity, toner, and heat to transfer images onto paper with exceptional speed and precision.

Types of Printer Cartridge:
1. Ink Cartridges:
  Used in inkjet printers.
  Contains liquid ink stored in reservoirs.
  Available in individual color cartridges or combined color cartridges.
  Ideal for vibrant color printing and photo printing.
2. Toner Cartridges:
  Utilized in laser printers.
  Contains powdered toner, a fine plastic material mixed with pigment.
  Come in separate cartridges for different colors (cyan, magenta, yellow, and black).
  Suitable for high-volume printing and text documents.
3. Drum Units:
  Integral part of laser printers.
  Holds an electrostatic charge and transfers toner onto paper.
  Needs replacement after a certain number of print cycles.
  Critical for maintaining print quality and sharpness.
Conclusion:
In conclusion, printers and cartridges play a vital role in our daily lives, enabling us to produce physical copies of digital content with ease. Understanding the differences between inkjet and laser printers, as well as the various types of cartridges they use, can help you make informed decisions when purchasing printing equipment and supplies. Replica xerography, the technology behind many modern laser printers, continues to revolutionize the printing industry with its efficiency and reliability. Whether you’re a casual user or a business professional, having a basic understanding of printers and cartridges empowers you to optimize your printing experience.
In-place Serverless Querying AWS S3 Data
Tags: s3, query, serverless, datalake
Published: 2024-05-24 10:49:55

We often have a need to directly query unstructured data stored in S3 Buckets in various data formats such as CSV, JSON, AVRO, ORC, PARQUET for ad-hoc querying or may be as a part of building a comprehensive data solution. 

Below are some AWS Serverless services that you can use to directly query your S3 data.

**1. Amazon Athena** 
Suitable for ad-hoc data discovery and SQL querying. In this service you are charged based on the amount of data scanned.



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

**2. Amazon Redshift Spectrum**
Suitable if you have to use more complex queries and also if you need to support a large user base.



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

**Redshift spectrum is recommended due to below reasons.**

- 
Uses Redshift Data warehouse SQL syntax which can spans Redshift Tables and S3 Data Lakes.

- 
Provides sophisticated query optimization.

- 
Distributes queries across multiple nodes for parallel processing.

- 
Can be used with already existing BI tools.


_Thank you for your time..._
Difference between `this` and `e.target` upon a event listener in JS (using jquery)
Tags: webdev, javascript
Published: 2024-05-24 10:49:28

Whilst developing in JS I had this case:
```
<a href="target" class="btn-toggle-form"><i class="fa fa-pencil"></i></a>
```

And I made an event listener for it using jquery:

```
 $(".btn-toggle-form").on('click',function (e){
        e.preventDefault();
        const target = e.target;
        console.log(target)
 });
```

But I noticed in my console that the `target` is the:

```
<i class="fa fa-pencil"></i>
```

Instead of the link!? But using this piece of code:

```
$(".btn-toggle-form").on('click',function (e){
        e.preventDefault();
        const target = e.target;
        console.log(this)
 });
```

Logs into `a` instead.

# The reason why it happens

The reason why it did happen is because the `i` element has triggered the event. This event has been propagated till the `btn-toggle-form` receives it. A easy to remember diagram is:


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

## Creative analogy

If it still confuses you, treat the link as a catgirl's ear and the event target as her sempai. The click event is the sempai pinching the catgirls' ear. The `this` points to the catgirl, because is the final receipient of the pinching (clicking) event `e`. The `e.target` is the sempai because is the one pinched the catgirl's ear.


(Hm,don't get the wring idea. I didn't wrote this article just to mention catgirl. baka)
How To Get A Home Loan In India: Easy Steps Explained 2024
Tags: home, loan, pune, india
Published: 2024-05-24 10:49:00

Buying a home is a significant milestone, and for most Indians, securing a home loan is a crucial step in this journey. Understanding the process and requirements can make it easier and less daunting. This guide will walk you through everything you need to know about how to get a home loan in India.



How to Get a Home Loan in India: Tips & Steps
A home loan is a secured loan offered by banks and financial institutions to help individuals purchase or construct a house. The property itself serves as collateral until the loan is fully repaid. Home loans typically come with attractive interest rates and long repayment tenures, making home ownership accessible to a broader audience. Knowing how to get a home loan can make the process smoother.



Steps to Get a Home Loan in India
1. Assess Your Financial Health
Before you start the process of understanding how to get a home loan, it’s essential to evaluate your financial situation. Check your savings, monthly income, existing liabilities, and credit score. A good credit score (typically above 750) can significantly enhance your chances of getting a home loan at favorable terms.



2. Determine Your Loan Eligibility
Banks and financial institutions assess your eligibility based on various factors, including your income, age, job stability, and credit history. Use online eligibility calculators provided by banks to get an estimate of how to get a home loan and how much loan amount you might qualify for. This step helps you set a realistic budget for your home purchase.

visit - [https://mortbuzz.in/](https://mortbuzz.in/)
"Efficiency in Motion: Exploring the Excellence of Move On Removals Melbourne"
Published: 2024-05-24 10:43:20

Move On Removals Melbourne is a prominent moving company serving the bustling city of Melbourne, Australia. Renowned for its reliability, efficiency, and professionalism, Move On Removals has established itself as a trusted name in the industry.

With a focus on customer satisfaction, [Move On Removals](https://moveonremovals.com.au/) offers a comprehensive range of moving services tailored to meet the diverse needs of its clients. Whether it's residential or commercial relocation, local or interstate moves, they have the expertise and resources to handle any job with precision and care.

One of the key factors contributing to Move On Removals' success is its team of highly skilled and experienced professionals. From the initial planning stages to the final delivery, their dedicated staff ensures a seamless and stress-free moving experience for their customers. They handle each item with the utmost care, using industry-standard packing materials and techniques to safeguard belongings during transit.

In addition to their exceptional service, Move On Removals is also known for its competitive pricing and transparent approach. They provide upfront quotes with no hidden fees, allowing customers to budget effectively and avoid any surprises on moving day.

Moreover, Move On Removals understands the importance of punctuality, respecting their clients' time constraints and deadlines. Their punctual arrival and efficient work ethic have earned them a reputation for reliability and dependability.

Beyond their core moving services, Move On Removals also offers additional amenities such as packing and unpacking assistance, furniture assembly and disassembly, and storage solutions. This comprehensive approach ensures that customers can tailor their moving experience to suit their specific needs and preferences.

Overall, Move On Removals Melbourne stands out as a top choice for anyone seeking a smooth and hassle-free moving experience in the vibrant city of Melbourne. With their commitment to excellence, professionalism, and customer satisfaction, they continue to set the standard for moving companies in the region.
Customs Clearance with iCustoms' Data Extraction
Tags: dataextraction, ai, career, learning
Published: 2024-05-24 10:36:03

Navigating the complexities of customs clearance is a significant challenge for businesses engaged in global trade. The process involves meticulous attention to detail, ensuring compliance with a myriad of regulations and documentation requirements. iCustoms offers a solution by utilizing advanced data extraction techniques to streamline customs clearance, making it faster and more efficient.

## Advanced Data Extraction with Optical Character Recognition (OCR)

One of the core technologies employed by [iCustoms](https://www.icustoms.ai/) is Optical Character Recognition (OCR). This technology automates the extraction of text from scanned documents and images, converting printed or handwritten text into digital, machine-readable data. The OCR process involves capturing images of documents, which are then preprocessed to enhance quality. This includes deskewing, despeckling, and binarisation to ensure clarity and accuracy in text extraction.

OCR technology drastically reduces the time required for data entry and minimizes human errors, ensuring that customs documentation is processed quickly and accurately. By [automating data extractio](https://www.icustoms.ai/intelligent-document-processing/)n of critical data from various documents, businesses can expedite the customs clearance process, ensuring timely delivery of goods.

## Enhancing Precision with Natural Language Processing (NLP)

iCustoms also leverages Natural Language Processing (NLP) to handle the complexities of customs documentation. NLP enables the system to understand and interpret human language, making it possible to extract key information from complex documents such as invoices and shipping manifests. NLP can identify product descriptions, quantities, and Harmonized System (HS) codes, and even classify documents based on their content.

This capability not only increases data accuracy but also reduces the need for manual intervention, allowing businesses to focus on other critical aspects of their operations. NLP's ability to learn and improve over time ensures that the system becomes more efficient, adapting to new requirements and evolving regulations.

## The iCustoms Advantage

By integrating OCR and NLP technologies, iCustoms provides a comprehensive solution for streamlining customs clearance. Businesses that adopt iCustoms' advanced data extraction tools benefit from increased efficiency, reduced operational costs, and enhanced competitiveness in the global market.

To learn more about how iCustoms' innovative data extraction techniques can transform your customs operations, read our detailed article on top [data extraction tools and techniques](https://www.icustoms.ai/blogs/accelerate-customs-clearance-with-data-extraction-techniques/) provided by iCustoms.
Streamline Your Quality Management System with Qualistery
Published: 2024-05-24 10:35:40

Unlock the full potential of your business with Qualistery's comprehensive [QMS development services](https://qualistery.com/gxp-consultancy-services/qms-development/). Our expert team specializes in creating tailored Quality Management Systems that enhance efficiency, ensure compliance, and drive continuous improvement. Whether you're a startup or an established enterprise, Qualistery provides robust solutions designed to meet your specific needs. Transform your quality processes, reduce risks, and boost customer satisfaction with our state-of-the-art QMS development. Partner with Qualistery today and take the first step towards operational excellence and sustainable success. Discover the difference that a well-crafted QMS can make for your organization. Visit our website to learn more and get started!
[DAY 12-14] I Built A Piano, City Skyline, Magazine, & More Using HTML & CSS
Tags: beginners, learning, html, css
Published: 2024-05-24 10:35:37

Hi everyone! Welcome back to my blog where I document the things I learned while studying to code. I also do this because it helps retain the information and concepts as it is a sort of active recall.

During days 12-14, I built various projects to practice my CSS skills:

- a balance sheet to utilize CSS pseudo-selectors.

- a cat painting to familiarize intermediate CSS techniques.

- a piano to grasp the fundamentals of responsive web design.

- a technical documentation page to complete part 4 of the responsive web design certification project.

- a city skyline to familiarize CSS variables.

- a magazine layout to practice CSS grid (in which I still don’t fully grasp).

- a product landing page to complete the requirements of the responsive web design certification project and earn my first web development certification :)

From these projects, I was able to:

- expand my knowledge of CSS pseudo-selectors, including first-of-type, last-of-type, nth-of-type, hover, and active.

- center the elements vertically and horizontally using CSS positioning techniques.

- explore absolute positioning for proper element placement.

- utilized the z-index property to control stacking order.

- experiment with the transform property to rotate and scale elements.

- learn to define variables within the :root selector and apply them using the var() function.

- implement social media buttons using anchor elements combined with HTML class attributes.

- be introduced to the `display: grid` property, although I'm still in the process of fully grasping its uses within webpage layouts.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2e3nzetizlzb9oigy9ig.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zlt4u6za4rf86zk8lsh9.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pljgjydlow7lctgc01hw.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d61qbo5m6j2oufja8e33.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bx9d1nctzewlt89l68qw.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0fv8v2cugt7jnsvpwr19.PNG)

These projects have not only expanded my HTML and CSS skills, but also provided me with practical experience that will be invaluable in the future.

Thank you for reading. Until then, see you next blog!