Scala

[ follow ]
Alvinalexander
13 hours ago
Scala

ScalaTest: How to print debug output in tests (to STDOUT)

ScalaTest's info function can be used to print output for visibility within unit tests, unlike println or System.err.println. [ more ]
Alvinalexander
17 hours ago
Scala

An example of JSoup's OutputSettings class

I ended up not using this code, but if you wanted to see one way to use JSoup's OutputSettings (Document.OutputSettings) class to set some parameters before calling JSoup.clean, I hope this is helpful:
Alvinalexander
17 hours ago
Scala

How to convert HTML to plain text with Jsoup (Scala and Java)

Jsoup in Scala/Java can convert HTML to plain text, offering various methods for extraction. [ more ]
Medium
1 day ago
Scala

This week in #Scala (Apr 22, 2024)

Welcome to the new edition of #ThisWeekInScala!
...
"This week in #Scala (Apr 22, 2024)" is published by Petr Zapletal.
Medium
5 days ago
Scala

Demystifying the 'type mismatch; found : X required: Y' Error in Scala

Demystifying the 'type mismatch; found : X required: Y' error in Scala. [ more ]
programming-languages
Medium
3 days ago
Scala

Solving `type mismatch; found : X required: Y` Error in Scala

Understanding `type mismatch; found : X required: Y` error in Scala helps in fixing it by changing the type, casting, or altering function signatures. [ more ]
Artima
3 weeks ago
Scala

The Autoproxy Plugin - Part I

Code passes through various error detection techniques before production, leading to a difference in defect rates for fresh code and production code.
Defect rates seem consistent across programming languages, highlighting the importance of reducing the number of lines of code to decrease errors. [ more ]
Artima
3 weeks ago
Scala

A (Brief) History of Object-Functional Programming

Scala evolved from a risky, new language to a mature and widely-used option.
Programming languages evolve through a process of artificial selection and hybrid vigor. [ more ]
Medium
4 weeks ago
Scala

A quick overview of access modifiers in Scala

Scala access modifiers resemble Java's but have additional levels.
Scala defaults to public access, unlike Java's package private default. [ more ]
moreprogramming-languages
functional-programming
Alvinalexander
1 day ago
Scala

ZIO 2: How to read a file and write its output to the console

Reading files and processing output using ZIO 2 in Scala. [ more ]
Medium
3 weeks ago
Scala

Brief Introduction to Scala

Scala is a programming language created in 2003 to address challenges in developing complex software systems efficiently.
Scala is statically-typed, supports functional and object-oriented programming, and has a rich set of libraries for building scalable applications. [ more ]
Medium
3 weeks ago
Scala

Understanding Type Parameters with Upper Bounds and Context Bounds in Scala

Scala combines object-oriented and functional programming.
Type parameters in Scala can have upper bounds and context bounds for type restrictions. [ more ]
Medium
3 weeks ago
Scala

Use of Underscore(_) in Scala Language.

Underscore (_) in Scala has multiple uses like wildcard pattern, ignored variable, and anonymous function.
It is used for wildcard pattern to match any value, as an ignored variable when value is not needed, and in lambda expressions as a placeholder. [ more ]
Alvinalexander
3 weeks ago
Scala

Scala if then else syntax (and returning a value from an if statement)

Scala 2 and Scala 3 if/then/else syntax differences.
Scala allows if/then statements to return a value, eliminating the need for a ternary operator. [ more ]
morefunctional-programming
Alvinalexander
3 days ago
Scala

SBT/build.sbt: One percent symbol or multiple percent symbol for Java and Scala dependencies?

Use %% for Scala-specific libraries and % for other JVM dependencies in SBT build.sbt files for Scala projects. [ more ]
Medium
1 week ago
Scala

Simplifying SCALA 3 features

Scala 3 aka Dotty is a major release version of Scala programming language.
...
This version introduces the power features of Scala so far if we compare it with its version 2.
Medium
1 week ago
Scala

This week in #Scala (Apr 15, 2024)

Welcome to the new edition of #ThisWeekInScala!
This blog aims to keep you updated with the latest news from the world of Scala and Reactive programming.
Scalac - Software Development Company - Akka, Kafka, Spark, ZIO
5 days ago
Scala

Mocking Libraries can be your doom

Unit tests are crucial for software quality and bug detection, with mocks being beneficial for isolating dependencies. [ more ]
Alvinalexander
6 days ago
Scala

Java: How to get the current date (and time) in Java 8, 11, 14, 17, etc.

To get the current date in Java, use LocalDate.now() with Java 8 and newer versions. [ more ]
Medium
1 week ago
Scala

Building a Scalable Producer-Consumer application and Deploying With Scala and Deploying on...

RabbitMQ is an open-source message broker facilitating asynchronous communication through AMQP protocol. [ more ]
Medium
1 week ago
Scala

how to fill null values and drop null values in pyspark,sql and scala

Handling null values involves filling specified values and dropping rows/columns with null values in PySpark, SQL, and Scala. [ more ]
Alvinalexander
1 week ago
Scala

Scala sequences: head, tail, init, last (visual, image)

I just saw this drawing on the Learn You a Haskell website, and I wish I had done something visual like it for the Scala Cookbook.
Alvinalexander
1 week ago
Scala

My free Scala and FP online video training courses

Ziverge sponsored and enabled free video training courses on Scala 3 without ads or paywalls. [ more ]
Alvinalexander
1 week ago
Scala

Scala/Java/Kotlin: How to replace left and right brackets in a String (replaceFirst, replaceAll)

Use \ before left bracket for string replacement in Scala/Java/Kotlin. [ more ]
Lightbend
1 week ago
Scala

Lightbend aims to democratize distributed systems for developers | @lightbend

Lightbend simplifies distributed systems with low latency and scalability.
Lightbend focuses on enabling developers to quickly build systems regardless of their skill set. [ more ]
Alvinalexander
1 week ago
Scala

Java Jar file: How to read a file from a Jar file

Java applications can read text files from their own JAR files using InputStream and BufferedReader.
Using getResourceAsStream method without a path before the filename reads files from the current directory within a JAR. [ more ]
Alvinalexander
1 week ago
Scala

vi/vim editor: How to show hidden/invisible characters

You can show hidden characters like tabs and end-of-line/newline characters in vi/vim using the set list command. [ more ]
Alvinalexander
1 week ago
Scala

Scala 3 Opaque Types: When to use, examples, benefits

Opaque types in Scala 3 offer encapsulation, type safety, abstraction, and semantic clarity.
They help create new data types with controlled access to representation, suitable for scenarios needing clear interfaces and meaningful names. [ more ]
Alvinalexander
1 week ago
Scala

Java socket timeout: How to set the timeout on a Java socket

Set Java socket timeout using socket.setSoTimeout method for a non-zero timeout period
The timeout must be greater than 0; zero means infinite timeout [ more ]
Medium
2 weeks ago
Scala

Solving `type mismatch; found : X required: Y` Error in Scala

Understanding 'type mismatch' error in Scala - mismatch between expected and actual data types.
Resolving 'type mismatch' by correcting data type or using type casting. [ more ]
Medium
2 weeks ago
Scala

Efficient Scala BiqQuery Data Retrieval: A Comprehensive Guide

You can use the spark-bigquery connector to read data from BigQuery tables directly into Spark DataFrames.
It is essential to set GCP credentials, specify the table path correctly, and include necessary dependencies to connect with BigQuery. [ more ]
Alvinalexander
2 weeks ago
Scala

ScalaJ-HTTP examples: GET, POST, handling redirects

ScalaJ-HTTP provides examples for handling redirect requests, making GET requests, setting timeout values, and performing POST requests.
Examples include handling redirect requests, following HTTP redirects, making GET requests, setting timeout values, and performing multipart POST requests. [ more ]
Medium
2 weeks ago
Scala

Solving the 'Palindrome Number' on LeetCode: Scala Solutions Walkthrough

Converting integer to string for palindrome check.
Optimization to reverse half of the number for palindrome check. [ more ]
Medium
2 weeks ago
Scala

Monads Everywhere - Simply get the advantage of Generics

Monads simplify creating thread-safe primitives for any type without boilerplate.
Type classes enable working with different types like Integer or String for thread-safe operations. [ more ]
Alvinalexander
2 weeks ago
Scala

A Java JOptionPane showMessageDialog with scrolling text

Using a JTextArea inside a JScrollPane to display a long text in a JOptionPane showMessageDialog.
Creating a scrolling text area in a JOptionPane showMessageDialog to handle large text messages effectively. [ more ]
Scalac - Software Development Company - Akka, Kafka, Spark, ZIO
2 weeks ago
Scala

Scala 3 Data Transformation Library: ducktape 0.2.0.

Ducktape is an automatic and customizable compile-time transformation tool for case classes and sealed traits/enums in Scala.
The name 'ducktape' signifies its potential to generate glue code, despite being originally intended as 'ducttape'. [ more ]
Alvinalexander
2 weeks ago
Scala

Creating a Thread (and Runnable) in Scala

Scala threads are created similarly to Java threads with slight syntax differences.
Java Runnable can be used in Scala to create threads by implementing the run method. [ more ]
Medium
2 weeks ago
Scala

Scala Jobs on AWS Glue: A Practical Guide to Development, Local Testing and Deployment

AWS Glue is highly scalable, cost-effective, and integrates well with other AWS services for orchestrating complex pipelines.
Performance issues exist in AWS Glue when dealing with large Python-based Pyspark jobs due to expensive data shuffling between JVM and Python processes. [ more ]
Medium
2 weeks ago
Scala

Time Series Feature Engineering in Apache Spark for Python with Scala

Feature engineering is crucial for unlocking insights from complex data sets.
Time series feature engineering requires specialized methods due to temporal dependencies. [ more ]
Medium
2 weeks ago
Scala

Improved pipeline processing of self-made virtual CPU Part 2

Executing one operation over multiple cycles is essential for simulating actual circuit behavior in Chisel.
Key steps include specifying cycles to complete, starting execution under specific conditions, and managing command flow between stages. [ more ]
Lightbend
2 weeks ago
Scala

Cloud architecture will fail you. Distributed app architecture will not. | @lightbend

Number of endpoints accessing applications doubled in 5 years
Cloud architecture ill-suited to handle increasing number of endpoints [ more ]
Alvinalexander
2 weeks ago
Scala

The Java 8 lambda Thread and Runnable syntax and examples

Java 8 introduced lambda syntax for Thread and Runnable
Lambda syntax simplifies Thread and Runnable creation in Java [ more ]
Alvinalexander
2 weeks ago
Scala

Java JFrame example: How to display a JFrame

Construct and display a JFrame using SwingUtilities.invokeLater method.
Proper way to display a JFrame is ensuring it's on the Event Dispatch Thread (EDT). [ more ]
Alvinalexander
2 weeks ago
Scala

Android: How to send a message from a Thread to a Handler

Using threads with a Handler in Android for asynchronous operations.
Updating UI elements like TextView with current date and time using a separate thread. [ more ]
Alvinalexander
2 weeks ago
Scala

Kotlin sortedWith syntax and lambda examples

The key to using sortedWith in Kotlin is understanding how to write a comparator with anonymous functions (lambda)
Kotlin sortedWith can be used to sort both integers and strings based on different criteria. [ more ]
Medium
3 weeks ago
Scala

From CSV to Parquet: A Journey Through File Formats in Apache Spark with Scala

SparkSession is used as the entry point to Spark SQL functionality.
Different file formats like CSV, Parquet, JSON, and Avro can be read into DataFrames in Spark. [ more ]
Medium
3 weeks ago
Scala

Scala Scripting: Powering Functional Programming and Big Data Solutions

Scala is a high-level language combining object-oriented and functional programming on JVM.
Scala scripting enables automation, data processing, and web applications with concise and scalable code. [ more ]
Medium
3 weeks ago
Scala

Download Now Developer-for-Apache-Spark-Scala Exam Questions Answers and Tips

Validation of skills in Apache Spark & Scala is crucial for professionals.
Exam covers Apache Spark & Scala concepts, hands-on coding, and real-world problem-solving. [ more ]
Alvinalexander
3 weeks ago
Scala

ZIO, ZIO HTTP Server, and Scala-Cli

The article provides a simple ZIO HTTP server application example.
Instructions on setting up the ZIO dependencies and running the application were shared. [ more ]
Medium
3 weeks ago
Scala

Troubleshooting Scala Memory Leaks

Understanding the history and recent changes of a product can aid in troubleshooting memory leaks effectively.
Identifying memory leaks may require trying various approaches, as there is no universal solution. [ more ]
Medium
3 weeks ago
Scala

Understanding the Pattern Matching in Scala.

Pattern matching in Scala allows for matching data structures like case classes and lists.
Sealed types in Scala are used for exhaustive pattern matching and restricting subclasses. [ more ]
Alvinalexander
3 weeks ago
Scala

How to convert a Scala Array/List/Seq (sequence) to string with mkString

Using mkString method of Array class can convert Scala sequence (like Array, List, Seq) to a String.
mkString function can be customized with any separator string to format the output as desired. [ more ]
Artima
3 weeks ago
Scala

The Autoproxy Plugin - Part II

Scala REPL under MS Windows faced issues with JLine library.
Proposal for a swing-based REPL in Scala for improved functionality. [ more ]
Medium
3 weeks ago
Scala

2024 SKODA Scala Design Caracteristicas

SKODA Scala Design features modern and efficient TSI engines ranging from 70 kW to 110 kW.
The 2024 SKODA Scala Design prioritizes safety with a rigid body, advanced assistance systems, and the option for Matrix LED TOP headlights. [ more ]
Medium
3 weeks ago
Scala

Understanding the Currying function in Scala.

Currying in Scala transforms functions to take single arguments, enabling partial application.
Key benefits of currying include partial application, function composition, and improved type inference. [ more ]
Alvinalexander
3 weeks ago
Scala

Java stack and heap definitions

Java stack holds local variables and partial results, while Java heap is where memory for class instances and arrays is allocated. [ more ]
Medium
4 weeks ago
Scala

Why we bet on Scala at SwissBorg

Scala helped SwissBorg beat the average by leveraging its expressiveness and ecosystem.
Scala's scalability, coupled with partnerships with Scala-specialized companies, supported SwissBorg's growth. [ more ]
towardsdev.com
3 weeks ago
Scala

Exploring Type Constraints and Encoders in Scala

Context bound in Scala defines type requirements for subtype and implicit instance
Encoders in Apache Spark handle serialization and deserialization for Spark SQL [ more ]
Medium
3 weeks ago
Scala

Higher Order Functions in Scala.

Functions in Scala are first-class citizens, allowing assignment, passing as arguments, and return from functions.
First-class functions enable the creation of higher-order functions, enhancing code expressiveness. [ more ]
Medium
3 weeks ago
Scala

"Unlocking the Power of Apache Spark: Essential Techniques for Data Manipulation and Analysis"

Medium
4 weeks ago
Scala

Scala Higher-Order Functions

Functions in Scala are treated as first-class values, allowing functions to be used in a variety of contexts.
Higher-order functions in Scala can take functions as parameters, enabling functional programming concepts like function composition. [ more ]
Alvinalexander
3 weeks ago
Scala

Java: How to find the longest String in an array of Strings

Finding the longest string in a Java String array can be achieved by iterating through the array and comparing string lengths.
Knowing the length of the longest string in a Java String array can be useful for tasks like setting prototype values. [ more ]
Alvinalexander
3 weeks ago
Scala

Java String array examples (with Java 5 for loop syntax)

Declaring a Java String array with an initial size
Declare a Java String array with no initial size [ more ]
Medium
3 weeks ago
Scala

How to resolve "java.lang.IllegalAccessError"

Understanding Java Platform Module System is crucial for resolving 'java.lang.IllegalAccessError' errors.
Using --add-exports and --add-opens flags can help grant necessary access in Java 17 upgrade. [ more ]
Scala-lang
3 weeks ago
Scala

Announcing the Scala Ambassadors initiative

The Scala Ambassadors initiative aims to strengthen the community, promote Scala positively, and support active members.
Ambassadors in the initiative are key Scala figures who aim to assist newcomers, improve communication, and support each other's efforts. [ more ]
Scalac - Software Development Company - Akka, Kafka, Spark, ZIO
3 weeks ago
Scala

Scalendar April 2024

Diverse range of Scala conferences in April 2024
Opportunities for learning and networking in Frontend Development and Software Architecture [ more ]
Alvinalexander
3 weeks ago
Scala

Java SimpleDateFormat example: How to convert a Date to a formatted String

The SimpleDateFormat class in Java allows easy conversion between Date and String formats.
Using SimpleDateFormat with Java is demonstrated with a custom date formatting approach. [ more ]
Alvinalexander
3 weeks ago
Scala

Java: JOptionPane showMessageDialog examples (part 1)

JOptionPane showMessageDialog can display simple text messages.
Using a JFrame reference centers the dialog on the JFrame, while using null centers it on the user's screen. [ more ]
Alvinalexander
3 weeks ago
Scala

Scala money and currency: The BigDecimal class and libraries

Scala developers commonly handle currency using the BigDecimal class.
Joda Money is a promising currency library for Scala development. [ more ]
Alvinalexander
3 weeks ago
Scala

Scala/Mill: Step 5, Specifying a Main Class in the REPL

Start the Mill REPL in the root directory of a Scala project by using the mill command. Choose a specific main method to run interactively within the REPL by specifying the class and package names. [ more ]
Alvinalexander
3 weeks ago
Scala

A Scala shell script example (and discussion)

To run a Scala script as a Unix/Linux shell script, use a special syntax in the script file.
The 'exec' command in the shell script uses $0 to refer to the script file and $@ to refer to positional parameters. [ more ]
Alvinalexander
3 weeks ago
Scala

My free "Advanced Scala 3" video training course

Free online video course "Advanced Scala 3" released
Ziverge sponsored the course creation [ more ]
Alvinalexander
3 weeks ago
Scala

How to populate a static List (ArrayList, LinkedList) in Java (syntax)

Use List.of() in Java 9 for initializing a static List efficiently.
Static List initialization pre-Java 9 can be efficiently done using Arrays.asList() with ArrayList. [ more ]
alvinalexander.com
3 weeks ago
Scala

Dart/Flutter: A simple delta-time performance debugging technique

A manual approach to measure performance in Dart/Flutter code by calculating delta time between two statements.
Using DateTime.now() and debugPrint() for simple performance debugging in Dart/Flutter applications. [ more ]
Alvinalexander
3 weeks ago
Scala

Java: How to round a double (or float) to two decimal places? (formatting output)

Use DecimalFormat or String.format to round double and float values to two decimal places.
Remember precision loss with float values due to fewer bits than double. [ more ]
Alvinalexander
3 weeks ago
Scala

The Vim page up and page down keystrokes

Vim page up keystroke is [Control][b]
Vim page down keystroke is [Control][f] [ more ]
DevOps.com
3 weeks ago
Scala

Oracle Looks to Increase Pace of Java Innovation - DevOps.com

Java 22 designed for faster innovation in Java-based applications
New Java capabilities like Project Amber, Loom, Panama aim to improve Java development [ more ]
Always a great way to keep up with the Scala community
Medium
1 month ago
Scala

This week in #Scala (Mar 18, 2024)

https://miro.medium.com/v2/resize:fit:1200/1*bPQnM2r6SYEzTbFe70vl8w.jpeg
Welcome to the new edition of #ThisWeekInScala!
...
"This week in #Scala (Mar 18, 2024)" is published by Petr Zapletal.
Alvinalexander
1 month ago
Scala

Scala: How to use startsWith tests in match/case expression

You can use the startsWith method on a String to match multiple patterns in a Scala match expression.
The example provided demonstrates how to use startsWith in a Scala match expression to generate different outputs based on the starting patterns of the input. [ more ]
Alvinalexander
1 month ago
Scala

Scala varargs syntax (and examples)

Scala varargs syntax allows defining functions with a variable number of arguments using * symbol after parameter type declaration.
Scala varargs array is created within the function when using the varargs syntax. [ more ]
[ Load more ]