kristofer / Working with Strings
0 likes
0 forks
1 files
Last active
Working with Strings
In both python and Java, samples of working with common string operations: split, capitalization, concatenation, replacing characters, working with sentences.
Key differences:
- Python: Has built-in title(), capitalize() methods; f-strings for formatting
- Java: More verbose; often requires manual implementation or StringBuilder
- Python: Strings are immutable but syntax is cleaner
kristofer / String Splitting
0 likes
0 forks
1 files
Last active
split a string in both Python and Java
Splitting a String
into a list or array of strings.
Key differences:
- Python returns a list directly
- Java returns an array (String[]), which you can convert to List if needed
- Python uses split() with no argument to split by any whitespace
- Java requires explicit delimiter - use split("\s+") for any whitespace
kristofer / Random Integers (Java & Python)
0 likes
0 forks
1 files
Last active
easy way to generate a random int from to max
If you need to generate a random integer, a number from say, 1 to 6, you can write a couple routines:
Java
import java.util.Random;
int min = 1;
int max = 6;
kristofer / Spark/Docker Troubleshooting Guide
0 likes
0 forks
1 files
Last active
Spark-Docker-SQL - Troubleshooting Guide
🚨 Quick Emergency Fixes
🔥 "Everything is Broken" - Nuclear Option
# Stop everything and restart fresh
docker-compose down -v --remove-orphans
docker system prune -f
docker volume prune -fkristofer / DTOs (java & python)
0 likes
0 forks
2 files
Last active
Data Transfer Objects (DTOs) Explained for Beginners (Java, then Python)
Data Transfer Objects (DTOs) via Java; Explained for Beginners
What Are DTOs?
A Data Transfer Object (DTO) is a simple container for data that travels between different parts of your application. Think of a DTO like an envelope specifically designed to carry exactly what's needed—no more, no less.
public class OrderDTO {
private Long id;
private String customerName;
Newer
Older