Posts

Learning Flutter

 I've been learning Flutter in order to help my team out with a new project we are taking on. At first I was skeptical, since cross-platform frameworks usually end up sacrificing something to run on so many different platforms. However, I was really impressed with Flutter, especially when I saw our teams app running in the web, on Windows and on an Android phone, and it looked good on every device! I started out with the Flutter Development Bootcamp by Dr. Angela Yu on Udemy, where I quickly learned the basics of getting an app set up, changing the app logo, and the core structure of a Flutter application. I wasn't sure about the everything-is-a-widget structure at first, but it ended up making so much sense! I always felt like building something that looks amazing was within reach, and the auto-format always made my code look great. It reminded me of components in React, although I think I prefer widgets. I ended up building several simple applications while following with th...

Using WebRTC to build a videophone in React and TypeScript

 Recently I had the opportunity to spend more time learning React, as well as Redux and a bit about WebRTC. I was prototyping a website that allows you to make video calls to other users, and I thought it was really cool how out-of-the-box WebRTC is. I also used TypeScript, even though I had some trouble in the past with React-TypeScript applications, and it went pretty well. There was some finicky things and it required me to learn the types of objects I had never used before, but overall I think it went pretty well.   The server is built with express, and uses socket.io to emit the web-rtc requests. There is no authentication or authorization, I was mainly focused on showing that I could make a video call.It uses Redux to handle state management, which was a bit tricky in TypeScript and felt like I was writing a lot of repeat code, but it got the job done better than it would have without it. Ultimately this project ended up being put on the backburner as my team turned...

Pyhton Algorithm for Tourist Route Optimization

 I wrote an algorithm for optimizing a route a tourist could take through a city to see different tourist attractions. It's an implementation of the algorithm proposed in this paper , by Cristina Maria Pacurar, Ruxandra-Gabriela Albu and Victor-Dan Pacurar in April of 2021. You can see the full code with tests on my GitHub here, but I'd included a snippet of the code as well.

Clean Code in a Python Algorithm

 The practice of writing clean code is one that exists no matter the language, framework or tool you use. When you write code that will be read or altered by any other developer, you will want that code to be easily readable and understandable, and easy to edit. Recently I've been working on some algorithms for an assignment at school, but I wanted to show off some of the things I might try to do to write clean code. The algorithm is in Python, which I have found can be easy to write cluttered code, but not difficult to write clean code either. I'll cover a couple of the things I chose to do to keep my code clean. The first thing I do here that is worth mentioning is the Python Typing library. It allows you to describe the types for a variable. It doesn't make your code immutable but it makes your code more readable. By specifying the type of data the function expects, a reader doesn't need to go searching through the code to understand what to give the function. Typing...

Catching Unhandled Errors in .NET/C++

Most developers are familiar with the pain that comes from an application crashing in production, and not offering any helpful information why it crashed. I recently was tasked with trying to catch some mystery errors, and I learned a lot about how .NET has some built in tools to catch errors in C++. The SetUnhandledExceptionFilter function supersedes the top-level exception handler in a thread, so if you hit an error the function will catch and allow you to do something before everything goes up in flames. This is a great time to do things like creating logs that will give some insight about what went wrong. It'll allow you to get a better idea of why a program crashes in production. Keep in mind, this only works outside of the debugger, so even in Visual Studio you'll need to run without debugging to test this. This code snippet is probably the simplest proof of concept for this tool that I could come up with. Essentially we are going to set the function that will handle our...

Reviewing WPF and MVVM

Image
 I've been working in WPF (Windows Presentation Foundation) a lot lately. WPF is a great way to build a Windows desktop application, it's been around for many years and is very mature compared to UWP (Universal Windows Platform) which is a similar tool for creating desktop applications. It's not the newest, shiniest tool but it is definitely a great tool to be aware of. A while back I built a simple WPF program that worked with a .NET function library that did very simple distance calculations, and I decided to review that before really getting into more advanced concepts. When the program runs, it looks like this:   It's nothing too fancy, but it will show travel time, rate of travel and distance traveled over time. It also allows an excel spreadsheet to be inputted and it will run many calculations and then update the spreadsheet. The layout here is primarily built using the XAML grid, a staple of any WPF application. The grid specifies how many rows and columns the g...

Blazor Edit Form and Validation

Image
      For a class project I'm working on in a secure coding class I wanted to find a way to safely validate form data as to not send malicious values to our API or our database. I was working out how to do this in Blazor, and found the handy EditForm component. It allows you to enter a type of model you'd like the form to build, and in that model we can specify if the form is required and what type of data is allowed in.       In this example we have a couple required fields and we don't allow any special characters into our fields. We also only allow a certain length of string as our input, and simple error messages are displayed when invalid data is passed. When proper or improper data is passed to our form, it looks like this: