I said that?

Some things I wrote

Java - Environment Setup

July 20th, 2024

I have only ever heard negative things about Java from other developers. But when I look at the most in-demand languages in my area, Java was the undeniable top language to know. After some deliberation, I began learning the language to form my opinion. In this post, I will cover how to set up your environment so you can program using the Java language.

First, you will need to set up your coding environment. I use VS Code as my code editor, so my directions will cater to that IDE (Integrated Development Environment). I installed the Extension Pack for Java extension and the Adoptium JDK (Java Development Kit).

The first thing I found different about Java was that you can create a new class by right-clicking a folder in the interface, as pictured below. If you don't know what I mean by class, it is something that you would usually have to write out as needed after creating the file to write on. I will get more specific later on.

IDE showing the file explorer and right-click menu

Once you click on "Class...", a small input box will show up askin you to name the class. The naming convention for the piece of code that encompasses the project is to call it Main. so your new file should look like this:

IDE showing a file named Main.java with an empty class by the same name

Now, we can start coding!

#Java

Picking Colors for Colorblindness

July 16th, 2024

As I was developing my brand, I came across this short, resource-backed paper explaining how to choose colorblind-safe color palettes for design and development: Colorblind Safe Color Schemes. I wanted to read more about it, and ended up with a collection of knowledge and tools that I found illuminating and will employ in my efforts to maintain accessibility.

The most important thing to keep in mind is that color should not be the only way that you are sending a message across because some people won't perceive that color variation. This turned out to be a fascinating topic blending science, biology, and philosophy, as it makes me ponder how individualistic our perceptions can be from one another, even beyond the perception of color.

Knowledge

  1. Colorblind Safe Color Schemes
  2. Coloring for Colorblindness
  3. Web Content Accessibility Guidelines (WCAG)
  4. Color — My Journey Through the Spectrum

Tools

  1. Chroma.js Color Palette Helper
  2. Contrast Grid
  3. Coolors - Color Contrast Checker

Fun fact from Enchroma: Babies Are Born Color Blind. As babies grow, their color vision improves and is typically fully developed by the age of 6 months. Overall color discrimination capability reaches its peak by age 20, and then starts to decline again.

#design #accessibility #a11y

How to Rest

July 15th, 2024

It was a struggle to maintain a healthy work-life balance for a long time. The self-imposed demands of coding, networking, and learning, combined with the challenges of managing health symptoms, often left me overwhelmed and exhausted. But that is because I didn't know how to rest. In the past, idle time meant there was something I wasn't doing, and what I thought was rest equated to bed-rotting and doom-scrolling. I knew there was more to the problem, so I started researching different kinds of rest. I learned that rest isn't just a luxury, but a necessity, and it’s equally important to match up the recharge activity with the activity you are resting from. Over the course of this week, I will post more specifically about which activities would help mitigate burnout and brain fog.

#health

Fetch API

June 28th, 2024

The Fetch API is a more modern and powerful alternative to the XMLHttpRequest API for making HTTP requests in JavaScript. It provides a simpler and cleaner syntax, better error handling with Promises, and support for advanced features like Request and Response objects. However, the choice between the two APIs depends on the specific requirements of your project and the browsers you need to support. Here are some key differences between them.

  1. Promises vs Callbacks: One of the main differences is the way they handle asynchronous operations. The XMLHttpRequest API uses callbacks, which can sometimes lead to callback hell and make the code harder to read and maintain. On the other hand, the Fetch API uses Promises, which provide a more elegant and intuitive way to handle asynchronous operations. Promises allow for better error handling and chaining of multiple requests.
  2. Simplicity and Cleanliness:The Fetch API offers a simpler and cleaner API compared to the XMLHttpRequest API. It eliminates the need for complex methods like `open()` and `send()` and provides a more intuitive and declarative syntax. This makes the code easier to understand and reduces the amount of boilerplate code required.
  3. Support for Request and Response Objects:The Fetch API introduces the concepts of Request and Response objects, which provide more flexibility and control over the request and response. These objects can be easily manipulated and accessed, allowing for advanced features like caching, modifying requests and responses, and handling different types of data.
  4. Browser Support:The Fetch API is supported by most modern browsers, while the XMLHttpRequest API is supported by both modern and older browsers. However, if you need to support older browsers, you may need to use a polyfill or fallback to the XMLHttpRequest API.
#API

XMLHttpRequest API

June 27th, 2024

The XMLHttpRequest API is a JavaScript API that allows web developers to send HTTP requests to a server and receive data in response without having to reload the entire page. It is commonly used in the development of dynamic web applications as a versatile tool because it allows you to interact with servers and fetch data from URLs in the background without having to do a full page refresh. With this method, the webpage can be updated without disrupting the user experience.

#API

host objects

June 26th, 2024

Host Objects

Host JavaScript objects vary because some that may be available in one environment may or may not be present in another, hence the name "host" objects. For example, most browsers offer window objects and navigator objects, but these objects are not in the server running node.js. Some objects, however, are available in both browsers and the node.js servers, like the console object. Therefore, we can say that the host objects are host-specific and may differ from one host (environment) to another.

Native Objects

  • String()
  • Array()
  • true / false

Host Objects

  • window
  • console
  • NodeList
#JavaScript

native objects

June 25th, 2024

Native Objects

Native JavaScript objects are objects original to the JavaScript language. These objects can be used regardless of the environment you are building in, and their behavior stays consistent across machines. They are also known as built-in objects, pre-defined objects, or global objects. Native objects can be constructors, which allow you to create new objects with the same underlying functionalities, and native objects can also be used as primitive values, which are not considered "objects" in the regular sense because they have no methods or properties and instead function as data.

Constructors

  • String()
  • Array()
  • Object()

Primitive Values

  • true / false
  • 8
  • "apple"
#JavaScript

Dequeue

June 24th, 2024

A dequeue is also known as a double-ended queue. It is a data structure where the collection of elements can be added or removed from both ends. The ends of the queue are refered to as the FRONT and the REAR.

One use case for a dequeue is a ticket purchasing line, where people can queue up for a ticket and continue with their purchase or decide to cancel before it is their turn in the queue.

visual diagram representing a dequeue #datastructures

JSONP

June 5th, 2024

JSONP can be unsafe and has some security implications. As JSONP is really JavaScript, it can do everything else JavaScript can do, so you need to trust the provider of the JSONP data. These days, CORS is the recommended approach and JSONP is seen as a hack.

#JavaScript

destructuring

June 4th, 2024

Destructuring is a way of extracting values of Objects or Arrays and placing them into distinct variables.


array destructuring


code example of destructuring an array

Object destructuring


code example of destructuring an object #JavaScript

Rendering Retina Graphics

May 31st, 2024

The word retina is just a marketing term to refer to high resolution screens with a pixel ratio bigger than 1. It means these displays are emulating a lower resolution screen in order to show elements with the same size. All mobile devices have retina-defacto displays. By default, browsers render DOM elements according to the device resolution, except for images. In order to have crisp, good-looking graphics that make the best of retina displays we need to use high resolution images whenever possible. However, using always the highest resolution images will have an impact on performance as more bytes will need to be sent over the wire. To overcome this problem, we can use responsive images, as specified in HTML5. Making available different resolution files of the same image to the browser will let it decide which image is best. To do this, we can use the html attribute srcset and optionally, sizes. For instance:

code example depicting use of srcset and sizes in an html document #HTML

Why use the arrow syntax for a method in a constructor?

May 30th, 2024

The value of this gets set at the time of the function creation and can't change after that. Because of that, when the constructor is used to create a new object, this will always refer to that object. In normal functions the value of this can be changed, but in arrow functions the context always stays the same. So you don't have to worry about the context changing, even if you use your arrow function in different parts of your application.

#JavaScript

What is the same-origin policy?

May 26th, 2024

The same-origin policy prevents JavaScript from making requests across domain boundaries. An origin is defined as a combination of URI scheme, hostname, and port number. This policy prevents a malicious script on one page from obtaining access to sensitive data on another web page through that page's DOM (Document Object M). To get around this, you should use CORS (Cross-origin resource sharing) to allow cross-origin access. CORS is a part of HTTP that lets servers specify any other hosts from which a browser should permit the loading of content.

table depicting different URLs, outcome, and reasons for each outcome. #JavaScript

What is the difference between let,var, and const

May 24th, 2024

Variables declared using the var keyword are scoped to the function in which they are created. If the variable is created outside of any function, it is scoped to the global object. let and const are block scoped, meaning they are only accessible within the nearest set of curly braces (function, if-else block, or for-loop). var allows variables to be hoisted, meaning they can be referenced in code before they are declared. let and const will not allow this, instead throwing an error. Re-declaring a variable with var will not throw an error, but let and const will. let and const differ in that let allows reassigning the variable's value while const does not.

#JavaScript

What is an event loop?

April 26th, 2024

The event loop is a single-threaded loop that monitors the call stack of a project as the code is read and checks if there is any work to be done in the task queue. On each cycle of the event loop, it takes on whatever is on the top of the call stack, and whatever is next on the task queue gets pushed into the event loop in order to execute.

#Node

What is a linear data type?

April 23rd, 2024

As the name suggests, data types using a linear structure arrange a collection of elements in a line, where individual elements can be accessed based on where they are in comparison to the rest of the elements. Think of a book, where the page number is the index, and the content of the page doesn't necessarily have to correspond to the next, but they are still organized in a sequence.

#data structures

Vulnerable

April 22nd, 2024

If you are experiencing neurotic patterns as a result of an emotionally deprived and traumatic childhood, you should understand that it's not your fault. They're survival strategies you developed to cope with difficult situations. It's important to be kind to yourself and recognize that many others have been through similar struggles.

You're not alone in this, and you're definitely not flawed or unworthy because of it. It's all about understanding where these patterns come from and giving yourself the support you need to heal. Consider seeking professional help or talking to someone you trust about what you're going through. Healing takes time, but with self-reflection, support, and nurturing relationships, you can overcome these challenges and emerge stronger than ever. You've got this!

#health

Crumbs

April 21st, 2024

You led me on a dance, a waltz of false affection,
Each step we took together, fueled my deep connection.
But behind your words lay an avoidant's reflection.

Your breadcrumbs led me on a journey of delusion,
A maze of false hope, a twisted, cruel illusion.

I watered those seeds with tears of devotion,
But you, like a drought, withheld your emotion.
Your avoidance a shield, protecting your heart's core,
Leaving me stranded, longing for more.

I built castles in the air, with bricks of expectation,
Dreaming of a future, built on our foundation.
But you were a ghost, haunting my desires,
Leaving me stranded amidst my burning fires.

I'm tired of your games, your manipulative art,
Of being the puppet, dancing to your heart.

So now I stand here, weary and worn,
A heart once tender, now battered and torn.
I release the thought of you, and set you free to roam,
I deserve a love that’s real, a love that calls me home.
No longer entangled in your web of deceit,
I walk away, whole again, in my own beat.
And though you may linger, in the shadows, still,
I have found my light, my strength, my will.

#art

Feeling Down? Have you...

April 20th, 2024

  • Exercised
  • Gone outside
  • Talked to someone
  • Eaten well
  • Limited your scrolling time
  • Gotten enough sleep
  • Drank enough water
#health

What is a stack?

April 19th, 2024

A stack is a collection of elements that can only be accessed from the beginning or end of the collection. Picture a stack of pancakes, where you can either add a pancake (push), or take a pancake (pop). This method of accessing elements is called LIFO, and stands for Last In, First Out.

diagram visualizing the concept of LIFO, adding and removing elements from a stack.

A stack is an abstract and linear data type. Abstract data type (ADT) means you don't need to know how the data type keeps track of the elements. In these cases, the inner workings are abstracted from your knowledge. This is the same across different languages when it comes to ADT. Whether you use arrays in JavaScript or lists in C#, they both store elements and have methods that you can use to access them.

A stack can perform three fundamental operations:

PUSH:
The push action inserts a new element into the stack. First, verify if TOP=MAX–1 to check if the stack is filled and no more insertions are possible. An OVERFLOW message is printed if an attempt is made to put a value into an existing stack.
POP:
The pop operation is performed to remove the stack's topmost element. First verify if TOP=NULLto check if the stack is empty and no further deletions are permitted. An UNDERFLOW notice is produced if an attempt is made to erase a value from a stack that is already empty.
PEEK:
peek action returns the value of the stack's topmost element without removing it from the stack. It first checks if the stack is empty, i.e., if TOP = NULL, then an appropriate message is written. Otherwise, a value is returned.
#datastructures

Lyrid Meteor Shower

April 18th, 2024

Named for the nearby constellation Lyra, the Lyrid meteor shower is composed of pieces of debris from the Comet C/1861 G1 Thatcher. A.E. Thatcher was an amateur astronomer living in New York when he discovered the comet in 1861. The meteor shower itself has been observed for 2,700 years ever since the first recorded sighting was made by the Chinese in 687 BC.

This year, the peak of this meteor shower falls on April 21-22. If you are in the northern hemisphere and want to catch it, head away from the city lights and find a section of dark skies. The best visibility will be after moonset and before dawn. Lie flat on your back with your feet facing East and looking up. Wait for your eyes to adjust to the dark (30 minutes) and you should begin to see meteors.

#astronomy