How to Setup a CI/CD Pipeline for Storybook.js using Gitlab
I just spent a few hours setting up a Gitlab pipeline to deploy a Storybook.js site. Of course the end result ended up being much simpler than I made it out to be. Like everything else on my blog, I'm sharing in case anyone else can use the information to save time.
Just put this in your gitlab-ci.yml and it'll take care of caching the node modules and building your static version of Storybook to deploy.
How to Clear Archive & Read-only flags on Files in Windows in Bulk
I ran into an issue where I had to move files from one system to another and was running into issues because files had been set as read-only, had the archive flag set, or both. It was causing the system to skip files which wasn't acceptable. Normally you could just use Windows to clear it in bulk, but that could potentially mess up file permissions. I needed a way to automatically just clear all flags but respect permissions.
I did some searching and didn't find a utility that would do the job and most of the solutions I found required Powershell which wasn't available on the system I was on. I ended up writing a quick console application in C# to do the trick. I've made it free and open sourced it in case anyone wants to use it.
If you need just the app, you can find the release build here with instructions. The app also prompts for input to make things a bit easier to use. There's no install, no tracking or metrics, or anything else related to privacy concerns in this app. It's a simple throwaway utility to get the job done and move on.
https://github.com/gregvarghese/clearflags/releases/tag/1.0.0
If you want to see the source code, that is available here:
https://github.com/gregvarghese/clearflags/
Please note that I did this in about 10 minutes for my own use so error handling is pretty much non-existent. I mention this because I did run into one issue where Windows was somehow seeing a folder with files in it as a file and it couldn't be deleted or renamed and the utility couldn't get past it until it was resolved. I didn't spend much time debugging and just used my Mac to rename the folder and Windows was able to recognize it after the change, so the utility was able to continue processing.
How to execute SSH command with Bitbucket Pipelines
I inherited an old site that someone else setup that is just a basic static HTML, which was deployed using a git pull on the server. I wanted to automate the deployment, and instead of using rsync as the site will be re-built, I realized I could just configure the Bitbucket Pipeline to use SSH and run the pull command. This is probably a fringe case but here's the bitbucket-pipelines.yml in case anyone finds it useful.
Add the repository variables for $USER, $SERVER, and $FOLDER with the appropriate values and then you should be able to run the deployment.
How to Generate a Page for Each Day of Month in Microsoft Word using VBA
I briefly joined my wife at her practice to help her grow the business and figure out how to make things more efficient. One of the things I learned is that my wife created a sign-in sheet for the office in Microsoft Word. Every week she would open the file and manually enter the date for each day of the week and then print out the documents. I took over the responsibility for a month and it annoyed me due to how inefficient the process was and I decided to automate the entire thing. I couldn't find a solution to the problem online so I had to roll my own and am sharing the code in case someone else can benefit from it.
Why I’m switching from Namecheap to Cloudflare
Years ago, when the internet was young, I purchased my first domain from InterNIC for about $70 a year. When the alternatives finally popped up, I switched my domain to Godaddy. As prices dropped, I ended up buying more domains through them for ideas and projects I developed. Eventually, I got tired of Godaddy's shenanigans with pricing (increasing prices and having privacy as an add-on) and upselling everything, and after reviewing many technical forums, ended up switched everything to Namecheap where I even signed up for their shared hosting.
Things started well, but after a short while, the hosting ended up not being any better than Godaddy as all my sites became ridiculously slow as they oversold capacity. I finally made the jump to DigitalOcean, and the same site without any changes or optimizations jumped in performance about 60% based on the metrics reports I was running. No joke, people were pinging me asking what I changed to make my site run so much faster because they wanted to do the same.
I was annoyed that Namecheap refused to refund a partial credit on the hosting even though I wasn't using it anymore despite their bait and switch caused the performance issues by overselling capacity. In the end, I didn't fight, because it was cheap, I was beyond the credit card chargeback period, and I still had domains with them and didn't like any of the other registrars out there enough (nor were the prices better) to make the switch.
On the domain side, their control panel was pretty confusing at first. Godaddy's was more straight forward for managing DNS and records, so I had to constantly figure out what the Namecheap configuration equivalents were because it wasn't straight forward. They updated their control panel, and things got easier, but it still wasn't intuitive. I think a lot of my confusion came from them trying to default to their parking pages or their hosting.
I'd run into issues, and their support would always be good enough to help fix them. I then ran into an issue with setting up a txt record. The fix required them to manually enter the entry on their side due to a bug in their control panel that they still haven't fixed to date. The bug was serious enough that if I made any changes to any of the domain settings (like adding another A/CNAME/MX record), it would undo their change and I'd have to file another ticket for them to complete the change.
All changes would take hours to propagate. Many of the services that validate DNS changes would not see them for hours or even a day. It hadn't been a great experience, and now I've wanted to find a new registrar to replace Namecheap.
In 2018, CloudFlare announced their registrar service. I've patiently watched to see how reliable it is and finally ended up testing it last month with a domain for an existing project that's in development. To say I was blown away was an understatement. The experience hasn't been perfect, but the things that really matter are well executed.
I found Namecheap to be a bit deceptive in the transfer process. All other registrars I've used let you approve transfers instantly via a link in the notification email. Namecheap sent an email saying they received a request to transfer the domain and this is the text about approving/canceling:
Why the Drobopro-FS Pro sucks
A few years ago, I purchased a DroboPro-FS Pro 8 bay NAS system. After getting a demo from one of my vendors, I was sold on the ability to have different sized hard drives, hot swapping, and the self repairing file system. Another feature I liked was that it also monitors the health of my hard drives. If one starts developing issues or gets full, Drobo will warn me, and robotically shift my data to other drives until I can replace that drive. I did my research and at the time, it looked like a fantastic deal.
After a few years with it, I can readily admit I made a huge mistake in purchasing the product. I'm lucky in that the unit has not failed yet like it has for others but it's also a horrible choice for backups for a myriad of reasons.
How to Get Laravel Debugging to work with PHPStorm and MAMP Pro 5
This has been one of the more aggravating things I've had to deal with in setting up software for development. I've followed the official documentation from JetBrains, over 30 other blog tutorials, and literally failed in getting any of them to work.
I figured out an easy way to make the setup work so I'm sharing it in case someone else finds it useful and for self-reference since I'll probably forget how to do this again in 6 months when I start a new project.
How to Automate Sending Emails through Outlook interop using C#
I was tasked with a tricky issue in sending emails. Due to security concerns, the client's IT team was not willing to share SMTP information for their mail settings and was only willing to set up an account in Outlook directly on a dedicated machine without sharing the password with us to send the emails. The client's ask was to send emails through Outlook without letting users see the emails or Outlook itself.
How to Execute a Stored Procedure in Laravel 5.6
I've been stumped on this and tried everything I can think of but I can't get Laravel to execute a working mysql query to reorder an ordering column when deleting a row.
Here's a sample simplified query, which works directly in mysql:
Self-signed SSL certificates not working with MAMP and Chrome
I use MAMP Pro for most of my PHP development and Chrome has annoyingly been blocking the self-signed SSL certificates MAMP generates, saying the certificate is not valid and "Your connection is not private":