Posts

React, MUI, and Keyframes

One day at work I needed to animate a button so that it shook horizontally when the user clicked it if it was disabled. We rarely do animations, so we generally implement these animations in CSS rather than using a library to accomplish it. That said, we do use React and MUI. However, MUI doesn't have a shake animation, so, I had to implement it myself. To do so, I used react state, keyframes, and the  sx  prop in MUI. Let's look at an example starting place. type MyButtonProps = {     disabled ?: boolean ; }; const sxStyles = {     button : {         marginTop : 1 ,         padding : 1 ,     } }; export const MyButton = ({ disabled } : MyButtonProps ) => {     const handleClick = () => console . log ( "You did it!" );     return (         < Button             disabled = { disabled }             onClick = { handleClick }             sx = { sxStyles . button } >             Click it!         </ Button >     ); }; Here we have a s

Maze Generation in JavaScript

Image
This article will outline the algorithm for random maze generation with backtracking and show code examples of the steps of the process. This algorithm is obviously useful for random maze generation, but the concepts can also be applied to other areas where random input or path generation is needed. The basics of this algorithm are as follows Initialize an object to track nodes that are visited Generate the nodes in the maze. Generally you'll want to track the node's edges. You may also want to give the node an ID of some sort. If you want to cut down on recursive calls, you'll also want to track its possible edges (aka all its neighbors). You'll also want to store this as an object instead of an array as it speeds up lookup times. Choose a starting point in the maze Mark the node as visited while there are potential neighbors to visit Randomly select a possible edge to visit Add that node to the edges for the current node Add the current node as an edge on the selected

Python AWS CDK: Creating a Trail in CloudTrail

CloudTrail is a very useful tool in AWS especially for more sensitive environments where logging is essential. AWS CDK is a great tool that lets you create your stack by writing actual code instead of writing YAML or JSON files. What happens when you combined the two? Well, right now CDK's CloudTrail support is in developer preview so accomplishing some of the things you might want gets a little tricky. Let's run through a few things and see what CDK supports and where you have to fall back to the Cfn* functions. aws_cdk.aws_cloudtrail.Trail The basic construct for creating a Trail in CloudTrail is using the Trail construct. This has some basic support for creating a trail. Here is an example of creating a basic Trail using CDK: from aws_cdk import core, aws_cloudtrail ...     trail = aws_cloudtrail.Trail(       self,  "MyTrail",       management_events=aws_cloudtrail.ReadWriteType.ALL     ) In the above example, we let CDK do a lot of the m

Is AWS CDK Ready?

Image
Short answer: no Not quite as short answer: you can make it work especially for simple use cases Long answer: well... Buckle up... I've recently had the opportunity to use AWS CDK quite a bit at work to help support parts of our data pipeline. This has afforded me the opportunity to use many parts of AWS CDK. While I haven't used all of it and I cannot claim to be an expert with it, I think my experience with it could shed some light on the tool and help you know more about it before diving in yourself. AWS CDK AWS Cloud Development Kit, or CDK, is a toolkit developers can use to define their AWS stack using actual code. Instead of being a YAML file developer, you can be a stack developer in one of the languages they support (as of writing that's JavaScript, TypeScript, Python, Java, and C#). For some, that may be reason enough to switch to CDK, but CDK isn't all rainbows and butterflies. Let's dive in and talk about the good and the bad as it currently

What You Can Do

Image
Do you have any idea how much you're capable of? Wait, me?! Nah, no way man. I can't do that! Do you have any idea what your coworkers are capable of? Wait, you mean HIM?! That's almost laughable. He'd never be able to do that! But really. Do you really know how much you're capable of? Do you ever look around you and consider just how amazingly capable your coworkers are or can be? Growing up, my dad always told me that I could be whatever I wanted to be in life. While I never became the doctor, lawyer, revolutionary scientist, or astronaut my boyhood mind might have imagined at one point or another, the lesson has stuck with me throughout  my life. Through various experiences in my life, I've come to learn that you really can do whatever you put you mind to. You are in-charge of your own destiny. I like what the above quote from Ralph Waldo Emerson teaches. That is that you can learn, you can improve, and you can change. While human

Confluent Kafka: Clustered Deployment on Docker for Windows

I've recently had the opportunity to tinker with Kafka. What a great tool it is! There's such potential there and I'm only getting started with it. I can't wait to see how we use it at work! One issue that I'm running into with the documentation and tutorials I'm following is that they're often written for a Unix system but the company I work for is a Windows shop. Fortunately we have Docker, but many of the commands in the tutorials are written assuming a shell like Bash and not Powershell. This has led me to some frustration and some head scratching mainly because I'm much more comfortable with Bash than I am with Powershell. I bounced around to a few tutorials and different ways of implementing Kafka before landing on Confluent's platform. I don't know if I'll use this one long-term, but I wanted to share the adaptations I needed to make to the tutorial I followed. The tutorial I followed is called " Clustered Deployment on Docke

Choosing OMSCS

Image
It was a bright, Spring day early in May. The tree-lined college campus was bustling with family and friends of the students. The excitement on that day was palpable. The families of hundreds of students had traveled there to celebrate the graduation of their loved one. The students' excitement was met almost equally with a sense of nervousness both for the future and for the last few grades that were yet to trickle in. So much lay ahead of each pupil, but the cost of their accomplishment was still fresh in their minds. As I sat with my peers on the stage during our college's graduation ceremony, the news came: I'd passed. There was one final grade that was yet to be recorded that would determine if I actually was done with my bachelor's degree or not. To my great relief, I'd passed Advanced Algorithms. The class was tough, but the final exam was a complete surprise. The instructor had allowed the use of one, single-page note sheet during the test. Unfortunatel