kristofer / ArrayList class
Last active
Java ArrayLists: A Dynamic Alternative to Arrays
While Java arrays are powerful, they have a significant complication: their size is fixed once created. Enter ArrayLists - a more flexible, dynamic alternative that automatically grows and shrinks as needed. ArrayLists are part of Java's Collections Framework and offer enhanced functionality for managing groups of objects.
What Is an ArrayList?
An ArrayList is a resizable array implementation of the List interface. Unlike regular arrays, ArrayLists can dynamically change in size during program execution. They store objects rather than primitive types, though Java's autoboxing feature allows them to work seamlessly with primitives too.
ArrayList vs. Array
kristofer / IntroJavaArrays
Last active
Java Arrays: An Introduction for Beginners
Arrays are one of the most fundamental data structures in Java programming. They allow you to store multiple values of the same type under a single variable name, making your code more organized and efficient. This introduction will help you understand what arrays are, how they work, and how to use them effectively in your Java programs.
What Is an Array?
An array is a container that holds a fixed number of values of a single type. Think of an array as a row of boxes, where each box can store one item. All items in an array must be of the same data type - whether that's integers, floating-point numbers, characters, or even objects.
Why Use Arrays?
kristofer / Simple Text Edit Python
Last active
Python simple text edit using Tkinter
1 | import tkinter as tk |
2 | from tkinter.filedialog import askopenfilename, asksaveasfilename |
3 | |
4 | def open_file(): |
5 | """Open a file for editing.""" |
6 | filepath = askopenfilename( |
7 | filetypes=[("Text Files", "*.txt"), ("All Files", "*.*")] |
8 | ) |
9 | if not filepath: |
10 | return |
kristofer / Digital Clock Py GUI
Last active
1 | from tkinter import Label, Tk |
2 | import time |
3 | |
4 | # need to `brew install python-tk` |
5 | # to setup a mac for tkinter |
6 | # |
7 | |
8 | app_window = Tk() |
9 | app_window.title("Digital Clock") |
10 | app_window.geometry("420x150") |
kristofer / qrcodepy.md
Last active
pip install pyqrcode
How to create a QR Code with Python:
import pyqrcode
from pyqrcode import QRCode
# String (URL) to make into QR code
s = "https://zipcodewilmington.com"
kristofer / Python Alarm
Last active
1 | from datetime import datetime |
2 | from playsound import playsound |
3 | alarm_time = input("Enter the time of alarm to be set:HH:MM:SS\n") |
4 | alarm_hour=alarm_time[0:2] |
5 | alarm_minute=alarm_time[3:5] |
6 | alarm_seconds=alarm_time[6:8] |
7 | alarm_period = alarm_time[9:11].upper() |
8 | print("Setting up alarm..") |
9 | while True: |
10 | now = datetime.now() |
kristofer / Acronym Python
Last active
user_input = str(input("Enter a Phrase: "))
text = user_input.split()
a = " "
for i in text:
a = a+str(i[0]).upper()
print(a)
kristofer / Acronym Python
Last active
user_input = str(input("Enter a Phrase: "))
text = user_input.split()
a = " "
for i in text:
a = a+str(i[0]).upper()
print(a)
kristofer / Linear Search Java
Last active
public class LinearSearch {
// Method that performs linear search
public static int linearSearch(int[] array, int target) {
// Iterate through each element in the array
for (int i = 0; i < array.length; i++) {
// If current element matches target, return its index
if (array[i] == target) {
return i;
}