Gregory Varghese
  • About Me
  • Labs
  • GitHub
  • My Work Setup
  • My Photography Blog
  • Contact Me
  • About Me
  • Labs
  • GitHub
  • My Work Setup
  • My Photography Blog
  • Contact Me
  • Categories
  • All
  • Administration
  • Solutions
  • Troubleshooting
  • Tips and Tricks
  • Development
8th April 2020
AdministrationApplicationsc#C#DevelopmentOpen SourceProgrammingSoftwareSolutionsTips and TricksToolsTroubleshootingUtilitiesWindowsWindows 10Windows 7Windows 8Windows ServerWindows Server 2008Windows Server 2012

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.

Continue Reading
0
487
2nd February 2020
AdministrationBitbucketDevelopmentPipelinesTips and TricksTools

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.

Continue Reading
0
310
10th September 2019
AdministrationDevelopmentMicrosoft WordProgrammingSolutionsTips and TricksVBAWord

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.

The script will calculate the first day and last day of the month and then do a loop to append the date in the "Day, Month day, Year" format (i.e. Thursday July 17, 2019) to a text field.

There are a few important steps involved to get the script working as is:

Open up Word, then open up VBA, and copy and paste this snippet into a module. When you run the function, it'll create a copy for every day of the month. I also created a function to start at a specific date in case you run it in the middle of the month.

Continue Reading
0
380
22nd August 2019
AdministrationCloudflareNamecheapReview

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:

I wanted to expedite the transfer only because I wanted to get the control panel cleared out to find out what's left and what's worth keeping and what domains I should let go. I reached out to their chat and learned that they implemented a dark pattern. I never clicked the link because I didn't want to accidentally cancel an approved transfer as I had assumed it was a direct link to cancel.

It turns out that their support person confirmed the text is deceptive and the link opens a page lets you approve or cancel it:

Not cool Namecheap, but I digress. So let's look at the pro's and con's of CloudFlare which elaborate why I'm switching to them.

Pros

Cons

Not bad for a cons list, so I migrated most of my domains over to Cloudflare, and it's a win all the way around. They sell domains at cost, offer a ridiculously easy to use control panel where everything works. Even better are how quickly changes take effect, and third party services can validate the changes.

Continue Reading
6
355
8th August 2019
AdministrationDroboHardwareProductsReviews

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.

I purchased a Synology DS1918+ 8-Bay Drive and the differences are pretty stark. I've actually been moving important files from my Drobo over to it as a safeguard.

Continue Reading
0
276
6th August 2019
DevelopmentLaravelMacMAMPPHPPHPStormPHPStormSolutionsTips and TricksTroubleshooting

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.

Happy debugging!

Continue Reading
2
348
9th July 2019
ApplicationsC#c#DevelopmentOutlookProgrammingSoftwareWindows

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.

Sending emails through Outlook can be done usingย Microsoft.Office.Interop.Outlook but the documentation is really lacking. If you need to do the same, I hope this will save you the hours of time it took me to figure outย what ends up not being complex code.

Create a new desktop application project in Visual Studio. Install the Microsoft Office Interop for Outlook. I used the NuGet package manager to install it since it wasn't present on my system:

I created a static class to send the email through Outlook. Note that my error handling code was replaced with Debug.Writeline. Remember to modify it to handle errors or implement logging so it doesn't fail silently.

Email.cs:

Example on how to call the class:

email.html:

Continue Reading
5
351
11th June 2019
AWSDevelopmentLaravelLaravelPHPPHPProgrammingRekognition

How to Extract Text from image using Laravel and Amazon Rekognition API

I'm currently working on a project that requires extracting text from images of variable quality. I'm doing quick prototypes using PHP and Laravel, but I've found the documentation for accomplishing this a bit lacking. After working on it for a bit, I figured out a really simple solution and am sharing in case it helps anyone else.

This sample will send the image to the API as a blob instead of using a URL. I had tried Base64 encoding it without any luck. I discovered that using Imagick was the easiest way to make this work so the sample relies on that.

Fire up terminal and add a requirement for aws/aws-sdk-php:

Add keys for your AWS access keys and region to your .ENV file:

Create a controller, add the snippet below, and create a route to the controller. Check the URL and you should have a dump showing the array returned from AWS with all the text, bounding boxes, and information.

Continue Reading
0
310
28th May 2019
DevelopmentLaravelLaravelmySQLPHPPHPProgrammingSQLSQLWeb Development

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:

Laravel code that doesn't update the database but throws no errors:

Other things I've tried which throw errors including saying there's an error in the query:

I've also tried splitting it the statements with no luck:

I tried a few other things which I didn't log in Git but I had no luck getting any of it to work. I asked for help on the forums and people told me to use Laravel's Eloquent model to update rows one by one which is pretty inefficient. You get extra trips over the network (especially important when the code is not on the same server as the database server since you can get dropped calls), extra connections to the server, the extra overhead of processing the query on the server and in the database, etc instead of just having mysql make the update.

The recommended solution may not seem like a big deal but I've run into issues where client connections have been dropped mid-update and left a table partially renumbered.

As a last resort and workaround, I opted to use a stored procedure to accomplish my goal. That presented its own can of worms as searching for examples on how to execute stored procedures in Laravel 5.x was also not easy. There's nothing in the documentation and all the examples I found didn't work.

Here's what worked for me with Laravel 5.6, with mySQL 5.6.38:

Continue Reading
2
283
21st May 2019
AdministrationDevelopmentMacMacMAMPSoftwareSolutionsSSLTroubleshootingWeb Development

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": 

Thankfully, I found an easy solve to fix this. These steps assume you've created a host in MAMP. You'll need to go to the SSL tab of the host you are trying to fix and

Go back to Chrome, and reload the page and the certificate should work now:

Continue Reading
0
309
Page 3 of 10
Newer Posts
  • 1
  • 2
  • 3
  • 4
  • …
  • 10
Older Posts

Tags

.NET (4) Administration (24) AI (3) Applications (13) ASP.NET (8) ASP.NET MVC (2) C# (6) Caution (4) Debug (6) Development (23) digital ocean (2) Errors (9) ESET (3) Excel (2) Fix (23) High CPU Usage (2) IIS (3) Javascript (5) jQuery (4) laravel (7) linux (6) Mac (17) MAMP (3) Microsoft (5) NTFS (2) Open Source (3) Outlook (2) Outlook 2011 (4) Photography (2) php (4) Programming (9) review (2) Sitecore (2) Software (7) Solutions (44) SQL (4) SSL (3) Tips (36) Tools (5) Troubleshooting (27) Useful (23) Utilties (8) Windows (14) Windows 7 (4) Windows Server (2)

Categories

  • Administration 67
    • Caution 3
    • Cloud 8
      • Cloudflare 1
      • Digital Ocean 6
        • Droplet 5
      • Namecheap 1
    • Hardware 4
      • Drobo 3
    • IIS 2
    • Linux 9
      • Apache 1
      • SSH 7
        • Terminal 4
      • Ubuntu 16.04 1
    • Mac 14
      • Software 5
        • Alfred 1
        • MacFusion 1
        • MAMP 3
        • pCloud 1
        • PHPStorm 1
      • Terminal 9
        • bun.sh 1
    • Review 1
    • Security 6
      • ESET 4
      • Firewall 1
    • SQL 3
      • 2008 1
      • DTSX 1
      • mySQL 1
    • Stupid Tales 2
    • Windows 47
      • Applications 16
      • Malware 2
      • NTFS 2
      • PowerShell 2
      • Software 21
        • Excel 3
        • Outlook 1
        • Peerblock 1
        • Remote Desktop 1
          • RDC 1
        • SourceTree 1
        • Steam 1
        • Synergy 1
        • Visio 1
        • Visual Studio 2013 1
        • Word 1
        • Wordpress 2
          • Hack 2
      • Tips and Tricks 35
      • Tools 24
      • Utilities 20
      • Windows 10 2
      • Windows 7 9
      • Windows 8 4
      • Windows Server 3
        • Windows Server 2008 2
        • Windows Server 2012 2
  • Body Hacking 1
    • Diet 1
    • Soylent 1
  • Development 36
    • AI 3
    • Bitbucket 3
      • Pipelines 3
    • c# 2
    • CouchDB 1
    • Github 3
    • Gitlab 2
    • Open Source 4
    • ORM 1
      • Dapper 1
    • PHP 8
      • Laravel 8
        • Jigsaw 1
    • PHPStorm 2
    • Python 1
    • Sitecore 2
    • SourceTree 1
    • Syncfusion 1
  • Mac 13
    • iCloud 1
    • Outlook 2011 2
    • Safari 1
  • Photography 3
    • Food 1
    • Rockstars 1
    • Uproar Festival 2012 1
    • Wolves 1
  • Products 3
    • Backblaze B2 1
    • Reviews 2
  • Programming 32
    • ASP.NET 7
      • MVC 1
    • AWS 1
      • Rekognition 1
    • C# 3
    • Gatsby 1
    • Javascript 2
    • jQuery 3
      • Fancybox 1
    • MonoTouch 1
    • PHP 7
      • Laravel 7
        • Tinker 1
    • Regex 1
    • Sitecore 2
    • SQL 1
    • SSL 2
    • VBA 2
      • Microsoft Word 1
    • Web Development 10
      • JavaScript 2
    • WinForms 2
  • Raspberry Pi 1
  • Recipe 1
  • Self Experimentation 1
  • Troubleshooting 46
    • Solutions 45
  • Uncategorized 11

Archives

  • August 20251
  • May 20251
  • August 20241
  • July 20243
  • March 20241
  • January 20241
  • September 20232
  • March 20232
  • January 20231
  • November 20221
  • August 20221
  • January 20221
  • October 20211
  • January 20211
  • July 20201
  • May 20201
  • April 20201
  • February 20201
  • September 20191
  • August 20193
  • July 20191
  • June 20191
  • May 20194
  • October 20181
  • July 20181
  • May 20181
  • April 20182
  • November 20171
  • October 20171
  • June 20171
  • May 20171
  • November 20161
  • October 20162
  • September 20161
  • June 20162
  • May 20164
  • February 20161
  • January 20161
  • October 20151
  • September 20151
  • July 20151
  • June 20151
  • May 20153
  • April 20151
  • March 20151
  • February 20151
  • July 20141
  • June 20141
  • May 20141
  • December 20132
  • September 20131
  • July 20131
  • May 20132
  • March 20132
  • February 20131
  • September 20121
  • August 20124
  • July 20121
  • March 20121
  • November 20111
  • September 20114
  • July 20113
  • June 20112
  • February 20111
  • August 20101
  • May 20101
  • October 20071

Continue Reading

Recent Posts

  • Introducing AnonymizeReviewer: Remove Author Metadata from Word Docs Without Losing Edits
  • How to Extract SSL Certificates from a PFX File on macOS
  • Supercharge Your Laravel Development and Get AI to Understand Your Models
  • How to Take Ownership of Files and Folders Using PowerShell
  • How to add case insensitive where in Laravel

© Gregory Varghese 2026 • All rights reserved.

Published with WordPress.