-
Two Approaches for Opening Multiple Electron Windows in a React/Electron Desktop Application
Recently I’ve had to figure out how to open multiple Electron windows for use in a React/Electron application. This turned out to be simpler and easier than I’d originally thought but finding the simple solution did take some searching around, since I didn’t see any good examples. In fact, many of the examples I came…
-
Joining Collections in MongoDB Queries using $lookup
Note: This only works in MongoDB 3.2 or later, be sure to update if you need this functionality! In situations where you have an ObjectID in a collection and you want it resolved by MongoDB during your query, you can accomplish this with aggregate and lookup. Let’s say we had two collections: insuranceClaim and insuranceProvider.…
-
Calculating a Modulo 256 Checksum in NodeJS for an Access 2 Laboratory Instrument
I’ve recently had to figure out how to send a checksum with my messages to an Access 2 instrument. I did not find very many good resources for doing so, so I’m going to share what I’ve got here. I got my first clues from the examples in the Access 2 LIS documentation. Unfortunately, it…
-
LINUX: Removing Files Older Than x Days
It can often be useful to remove files that are unnecessary, such as log files, backup files, etc, when it is not already done automatically. Fortunately there is a very simple command to do just that. Using the find command, it is possible to find the files in the folder you want to clean out…
-
Deleting Rows From a Table Referenced in the Query
If you do a fair amount of SQL, then every now and then, you’ll likely run into a situation where you need to delete something from a table; but need to also reference that table in the query as well. The trouble is MySQL won’t let you do this, in many circumstances. Fortunately, there is…
-
Automatically Check RSYNC and Restart if Stopped
I occasionally use RSYNC to synchronize large directories of files between servers. This is especially useful if you’re moving a client from one server to another and they have alot of static files that are always changing. You can copy the files and sync them up, all with RSYNC and if your connection gets cut…
-
Mounting CIFS Shares At the LINUX Command Line or in /etc/fstab
Linux makes it relatively easy to mount shared drives either manually, at the command line, or automatically, by configuring an entry in /etc/fstab. Here is the basic syntax of our mount command. [ccase@midas ~]$ sudo mount -t cifs -o username=,password=, /// Here is an example of mounting our CIFS share to a folder named myshare.…
-
Getting the Last Modification Timestamp of a File with Stat
If we want to get just the date modified, for a file, in a format of our choosing. This can be done with a utility called stat. The syntax is as follows: stat -f -t “” In this example, we are printing just the date created in the format YYYYMMDD_HHMMSS. stat -f “%Sm” -t “%Y%m%d_%H%M%S”…
-
Using the Linux Command Line to Find and Copy A Large Number of Files from a Large Archive, Preserving Metadata
One of my recent challenges is to go through an archive on a NAS and find all of the .xlsx files, then copy them; preserving as much of the file metadata (date created, folder tree, etc) as possible, to a specified folder. After this copy, they will be gone through with another script, to rename…
-
Explicitly Setting log4j Configuration File Location
I ran into an issue recently, where an existing log4j.xml configuration file was built into a jar file I was referencing and I was unable to get Java to recognize another file that I wanted it to use instead. Fortunately, the solution to this problem is fairly straightforward and simple. I was running a standalone…