Posts

Using routerLinkActive in Angular 17

Image
I'm re-writing an Angular app using Angular 17, which is a departure from the architecture of previous versions of Angular. If you found my page, than it's likely that you are trying to use routerLinkActive, and it's not working.  In Angular, routerLinkActive allows you to apply one or more CSS classes to an element if the element matches a route.  < a mat-button   routerLink = "/Home" routerLinkActive = "active" >< mat-icon > home </ mat-icon > Home </ a > In this example, when Angular route is set to "/Home", the <a> element will essentially be <a class="active"> So in your CSS file, which is in the same folder as your component, you need to define a class rule that tells the browser how to style the element.  In my case, my CSS file is top-nav.compenent.scss and I've added this rule: .active {   background-color : darken ( orange , 25% );   border-radius : 10px 10px 0 0 ;   color : b

My "GeekZebo", using Arduino(ish) to control neo-Pixel lights.

Image
  One of my favorite things to do in the summer is listen to music on my patio. We bought one of those "fancy" metal gazebos that they sell at the home improvement store and put it on our patio to save ourselves from the mosquitos that swarm Minnesota in the summertime, and to allow us to enjoy the outdoors even in some of the more inclement weather that shows up here from time-to-time. I noticed that there was a tiny "shelf" above the mosquito netting that looked like a great place to install strip lights, so I thought - why not geek up the place while I'm at it. So I installed some neo-Pixels. What are neo-Pixels? If you're not familiar with neo-Pixels, at their core they're LED strip lights. What makes them extra cool is that they expose a way to address either a single LED (for most 5V systems) or a group of 3 LEDs (in a 12v system), and you can turn them on and off, or set them to any color you can think of. Once you set them, they stay that color u

6 Reasons why you should use Visual Studio Code for Arduino.

Image
Did you know you could use a different IDE for Arduino? There is, of course, the Official Arduino IDE.   There's an Arduino Plugin for Eclipse . And if you haven't heard of it before, the very good Energia - that also works with many Texas Instruments Development Boards. There are also plug-ins for Visual Studio 2019 and other "full versions" of Visual Studio. But I use Microsoft's Arduino Extension with Visual Studio Code . I think you should too. Here's why:  1. It's free - as in beer. Zero dollars. Gratis. I know the other tools are also free, but the functionality of this plugin with Visual Studio Code only compares to other projects that you have to pay for - or endure nag screens. No nag screens here. It's also not limited. Some of the other solutions have limits on the size of either the files or the executable.    2. It's Open Source. Not just the extension, but Visual Studio Code is too. You can actually get the source for either right f

Using GIT with Arduino

Image
  What is GIT? The term GIT doesn't actually mean anything. It was made up. But what it is, is a "version control system". That sounds complicated, but really all it boils down to is that it saves versions of your files, and gives you a way to revert back to old versions - if necessary.  It also provides a way for multiple developers to work on the same project, and even to keep the same project 'in sync' between computers no matter where they are. Where do I get it?  In order to use GIT, you need to install it. Many IDE's come with it pre-installed, but unfortunately, the Arduino IDE does not. You can find downloads for Windows, Mac, or Linux here: https://git-scm.com/downloads I will note, however, that GIT is generally a Command-Line tool. There are GUI's also available on the same website. If you need a GUI, then you can get one there. You should first learn the basic commands for GIT before using a UI though.  Once you download and install it, you can

Programming Arduino with Regular Expressions

Image
Download Code Here:  What is a Regular Expression? A regular expression is a string that uses characters within the string to define a pattern and provides a function to test another string to find matches to that pattern. Probably the simplest regular expression is just a string with no special characters. You can use regular expressions with Arduino by adding a third party library to your sketch. You do that using Tools->Manage Libraries Then, search for RegEx in the Library Manager. Install Regexp by clicking the install button. This will download the required files and put them into the default library location defined by your IDE. You can find the location under File->Preferences if you changed the default, but the default on Windows is C:\Users\<your_user_name>\Documents\Arduino\Libraries  If you look in your library location, you'll find a folder called Regexp that contains the required header file for this library and some other folders with the source code and

Why your 1TB hard drive doesn't have 1TB space.

Image
 I was recently on the market for a new thumb drive to create a portable Linux machine. I was looking for the fastest available thumb drives, and one of the most recommended thumb drives for this type of application is the SanDisk Extreme Pro. The specs look pretty good for a portable Linux drive, since this is basically an SSD in a USB thumb drive. However, if you're anything like me, the first thing you do when you're thinking about buying anything is to go read the reviews and look for any common complaints that may indicate a common issue with whatever your buying.  The very top review for the SanDisk Extreme Pro right now reads: "I paid for 1 TERABYTE. I need to use 1 TERABYTE. Why on Earth does the drive only actually come wih (sic) 920 GB? And, WHY ARE CUSTOMERS NOT INFORMED? *Eighty gigabytes* is an enormous amount of storage to lose." Being around computers for as long as I can remember, I already know that a 1TB drive doesn't show up on my computer as 1T

Coding C++ with generic functions

Image
What is a generic function? Download Code Example Here A 'generic' in C++ terms is similar to an int, double, or String,  - except it means 'any type'.  They provide a way to write code that will work with any data type - even those that haven't been defined yet. This means you can write a function that doesn't know in advance what data type you'll be putting into it so you can give it ints, doubles, or even strings. It's up to you.  The way you declare this generic type is with the following syntax: template <class anyClass> So, a full function might look like this: template <class anyClass> void swapVals(anyClass &a,anyClass &b){   anyClass temp;   temp = a;   a=b;   b=temp; } In this example, you can pass any 2 variables of the same type, and no matter what type they are, their values will be swapped.  For instance, if you add this code to  template <class anyClass> void swapVals(anyClass &a,anyClass &b){   anyClass t