Posts

O(n) notation.

When writing programs, it's often useful to judge your algorithms by how many operations they will take to act on any given input. Big O notation (written as O ( n ) and also called "Big O") can be used to convey how many operations your algorithm might take, or how much memory it might occupy. Normally, you use 'worse case' to determine this, since many algorithms number of operations and memory occupied will vary based on the input. O ( 1 ) - Constant Time and Space Consider this algorithm: int getFirstElement ( int [] a) { return a[ 0 ]; } No matter what size array you pass into this function, it will just return the first element, which means it always takes the exact same amount of time to run, which makes it O ( 1 ) time . It also makes no additional variables or requires any extra storage to operate which makes it O ( 1 ) space . O ( n ) - Linear Time Now consider this algorithm: int findMax ( int [] a, int length) { int max = 0 ; for...

Free LAN Canaries to monitor your home network.

Image
What is a canary?  A canary is a warning device that alerts you when something bad is about to happen. The reason it's called a canary is kind of macabre. In the past, people who worked in mines would often accidently stumble into areas of the mine that were toxic and die. Some of them started bringing literal canaries with them into the mine, since they were much smaller and sensitive to the gasses that might be present, if the canary died, that indicated the presence of a dangerous gas - the miners would then rush out of the mine.  Today, the meaning has shifted to anything that could give you an early alert that something has gone wrong. If you're wondering if someone may have breached your local network, these canaries will give you an alert, hopefully before the really bad stuff happens.  The Solution? While there are any number of paid solutions, one very popular one is from a company called Thinkst . They sell a drop in device that can emulate all sorts of things, ...

Setting up MongoDB in Docker on Synology NAS

Image
 First, you need to install Docker Container Manager, do this by searching for "docker" or "container manager in the Synology Package center.  Once that's installed, open it and click on "Registry", which will allow you to find Docker images.  An "image" is basically the recipe to create the Docker app, not the app itself. There are many different versions of mongo available. The process to use them all will be similar, but they may not be exactly the same. I'm using mongodb/mongodb-community-server.  Double click it, then choose the version you want, and click "Download".  I'm using "latest" which is just whatever the last released version is, but there are other versions available, should you need them. Now, you will need to create a "Container", which is the actual running app on your system.  Click Container->create to start creating the new container.  Choose the image that you downloaded, give it a na...

Writing and Testing in C# in Linux with Visual Studio Code.

Image
  Visual Studio Code is an open source IDE useful for developing in many different languages on nearly any platform. If you've ever used Eclipse, you'll find it similar.  There are many extensions you can add to it to allow you to debug, run, and test using nearly any tool you can think of. Since I'm focusing on C#, one of the first things you'll need is dotnet.  Using the Extension Manager, I've installed: .NET Extension Pack (from Microsoft) .NET Install Tool (from Microsoft) C# (from Microsoft) C# Dev Kit (from Microsoft) With those installed, you can now open the command pallet (cntrl+shift+p) and do things like create new projects.  However, to get access to some of the useful "Visual Studio Explorer" style menu items, you'll need to install that separately from Microsoft. It's available here: https://code.visualstudio.com/docs/?dv=linux64_deb What this extension allows you to do, is right click on a project and "add a reference" to ...

Limiting a Wacom Stylus to one screen in Ubuntu 24.04

Image
 I've been trying to switch from Windows to Linux, because Windows 10 is going out of support soon and they refuse to let me keep using my older, but perfectly functional PC. Much of my day-to-day development can be done on Linux with no problem. However, some of my tools need to change.   To that end, I have a Wacom stylus tablet that I like to use for writing notes. In order to use it properly, it needs to be limited to one screen. I have 5, and I'm using an NVidia driver, so many of the online solutions to make this work, did not work for me.  This did.  To find the active Wacom devices, make sure you either plug your Wacom device in, or configure it with a bluetooth adapter.  Then, open a terminal and type xsetwacom --list devices This will give you a list like this.  Yours will look different.  Next, you might want to see a list of your monitors.  To do that, you us xrandr --l...

Resolving "cmdline-tools component is missing" in Ubuntu 24.04 with VisualStudio for Flutter Development

Image
 I've recently been trying to switch from working mainly in Windows to working mainly in Linux, mostly because I'm currently running Windows 10, and would have to completely rebuild my PC in order to upgrade to Windows 11. My PC works just fine, and runs Ubuntu great.  That being said, I've ran into a few snags getting Flutter working on Ubuntu. Following the generic tutorials from the Flutter Docs  (here)  got me most of the way there.  The problem I ran into stems from (I think) the fact that Ubuntu switched from .deb packages to these things called SNAPS, which are self-contained apps. When searching for resolutions for specific problems, most of the online source has information that's now outdated.  That brings me to my issue. When I ran Flutter Doctor, I got an error complaining that the android "cmdline-tools component is missing" After much googling without luck, mostly showing me those "type this nonsense into your terminal", I found the ans...

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...