Feeling ANSI about Windows console color codes

My first software “product” was a BBS fancy menu generator that utilized ANSI based colors and those funky shaded block characters, to generate a completely new and semi-randomized background pattern on every load. Written in pascal. It ran on a couple BBS’s. Yay.

Today I thought about those ANSI codes and whether they still work in Windows consoles today- found this article on the topic


Short answer – In modern Windows 10, Yes- but your app need to call some system api’s to enable it, and this is considered fragile. Apparently the safer way to do this, in .Net at least, is via the Console.SetforegroundColor and similar. It looks like Node.js has a built-in layer that decodes the ansi escape codes into these api calls as a sort of proxy, so maybe .Net could use something like this as well? Ok, back to real work.


Update folder modified date based on file contents

I’ve used this tool a few times with good result-


If you copy a bunch of folders + files to another drive, maybe as a makeshift backup, and restore them later- the folders will all get new timestamps on them. Not a huge deal, but if you’re looking for that project you were working on a couple years back, it’s helpful to sort by modified date and narrow down your search. Typically the files inside the folders will maintain their correct timestamps (created + modified dates), just the folders will lose this data.

This tool simply scans all folders/sub-folders and finds the newest modified date on the files contained inside, and then updated the folder modified date to match this. It won’t necessarily exactly match what the folder’s original stamps were, but.. it’s better than nothing.

Oh, and it’s free.

.Net C# code error that wasted a day of my life

Can you quickly spot the error in this code?

if (GetRandomNumber(1, 20) > 19); // upped this from 17)
        redirout = OtherURL;

You’ll likely think it’s something with a boundary state in the GetRandomNumber method, and sure that’s a good guess, but the actual mistake/error is visible right here, in this code.

If you can’t find it, here’s a hint- we noticed that redirout was being assigned OtherURL a lot.. way more than 1 in 20 times… in fact.. Every time!

The crappy part is it compiled but once your see it, it feels like maybe it shouldn’t compile. I also feel like I was warned about this back 20 years ago.. learning Turbo C. ;p

This actually hurt my business today. No fun, but glad to finally figure it out and get it repaired.

How to sign an agreement in a Word docx file

I realized today that I’m not sure what the “correct” way to fill out and sign a word document based agreement would be. My process usually involves typing info into the “fields”, but many documents just draw underlines in the space where you are supposed to enter data… So when you type here, you now have text *without* an underline, breaking the former underlined space into two parts that are now spread further apart than the should be, messing up the format of the rest of the document. So then I’ll select the text, click underline, and then click on the now-too-long blank underline and start hitting delete to get the length back down to near original. Except it never lines up exactly as previously so the fields all wind up slightly odd in length and are just plain ugly.

Whew. Ok then I’ll usually print the doc file to a pdf, open it in a pdf editor and sign it by adding my signature image… or sometimes sign it directly on the screen if I’m on a touch enabled device (such as my awesome surface studio pc).

Sometimes I’ll skip the first step and just print the whole thing to pdf, and then use the pdf editor to try to line up text boxes over each field and type into them. They usually don’t line up perfectly, so this looks kinda bad as well.

Am I missing something or is this just something we all put up with?

Image restore broken in Windows 10 1709 “Fall Creators Update” (and Hack Solution)

(I found a hack to get this image to restore- I added it at the bottom)

This bit me pretty bad this week- if you use the older version of windows backup and take an image snapshot of your windows 10 pc- the latest version of windows will make the image, but this image WILL NOT restore correctly. The restore operation will fail with a message about the volume shadow copy service- specifically:

The system image restore failed.

Error details: A Volume Shadow Copy Service component encountered an unexpected error. Check the Application event log for more information.

I attempted to make a system restore drive using an older version of windows 10 to see if that would allow it to restore my 1709 based image- but this *also* failed. So the problem appears to be with the image and not with the image restore process/sofware.

I’ve also read that this only affects UEFI based systems- if you run on MBR it should still be able to restore the drive.

This makes me wonder if the image would be able to restore if I had only taken an image of the main data drive and not included the EFI/boot partition(s) in the image? (Update below covers this)

I can link to the *many* discussions online about this but simply google 1709 image restore and you will see them. I also chatted with a tech at the microsoft store and he said they are well aware of the issue, and trying to escalate it to get it resolved, but no luck so far.

This really is about the worst thing you can have go wrong- as in my case, my system died and I tried to restore from an image I had taken some days prior. And when it failed… this means I will have to fully load up windows with all the ensuing updates (taking a big part of a day), and then try to remember what applications I had installed, reinstall all those, and then copy over all my individual user files from a backup drive. And hope nothing is missed or timestamps messed up in the copy, etc etc. a HUGE headache that is winding up costing me nearly a week of productivity, when this image restore would have just had me back up in running in a few hours instead. Pretty much the worst thing to have go wrong with an OS, and Microsoft doesn’t even seem to understand yet that it’s broken.

Since my original post, I tried a bunch of things that would simply not work, but finally found something that did: Use Macrium Reflect to restore the data drive from the windows backup image. I initially tried restoring all the partitions from the windows restore using Macrium, but this never would work- I finally would up using a default windows install with all the updates, and then just replace the c drive partition with the one from the windows backup. Steps roughly are:

  1. Install windows and run all the updates
  2. Install macrium reflect- take a snapshot of this install for “just in case”
  3. Open Disk Management, and Action, Attach VHD
  4. Navigate to where the VHDX files from your windows image backup are. Select the one with the windows files- usually just the “biggest” vhdx file.
  5. Use Macrium to do a image backup of this partition, and save the MCIMG file as the new macrium version of the original vhdx backup file. Use an external drive.
  6. Create a system restore drive from macrium.
  7. Boot this restore disk, then locate the macrium image on external drive and use it as the source.
  8. *pay attention* – drag the main windows drive partition from the source to the same spot on the destination drive. We want to only overwrite the windows drive (c: usually) and none of the other partitions.

After this, I rebooted and it needed another reboot and finally showed the login screen. I won’t go over how many other iterations I tried of this before finding the right one, but let’s just say that’s a lot of ways to make this *not* work. Namely, don’t bother trying to restore all the partitions from the windows restore- I did this and it just didn’t work. Seems like it would, and maybe it would for you, but not here.

Galaxy S6 Wifi ‘authentication error occurred’ since firmware-update, high battery usage

After updating the firmware on my Samsung Galaxy S6 not long ago (early December 2017?) I immediately noticed my battery used became absolutely horrible. Like, dead in 90 minutes kinda bad. After doing the normal things like clearing the cache etc, and getting only marginal improvements, I finally noticed that the wifi connection on the phone was having continuous errors connecting to my ATT wireless router- with a message “authentication error occurred”. What? This definitely worked before so why not now? With this info, I did more googling and finally found out a lot of people are having this same problem.

The problem apparently is caused by the ATT router having a 2.4 mhz and a 5ghz radio that both use the same ssid and password- This is how ATT recommends running it so that intelligent wifi clients can automatically switch to whichever radio is giving the strongest signal at the moment.

Something with the new firmware on the S6 broke this capability- likely due to a security patch. SO: The solution, for now at least until Samsung gets around to re-fixing this, is to change the name of one of the radios so that it has a distinct ssid. Then on your phone, you’ll just need to pick which one to use.

I myself did a slightly different hack to get this working for now- I enabled the “guest” radio on the ATT wifi and it only uses a 2.4 ghz radio- so now my phone is connecting to this network instead. This will have to do for now. Battery life is much improved again, I’m curious what my data plan usage will look like for this month though.

Beerita recipe

A beerita is basically a margarita with some beer mixed in, usually a mexican beer to stay in theme. I often make a “cheatarita” (more on that later) as my go-to for drinking some tequila in a less dense/easier to make/lower calorie fashion, but sometimes I like to make my own version of a beerita as well.

Here is my weird version of a Beerita:

1 shot tequila (use your fave)
.5 shot triple sec
.5 shot lime juice, or can use some roses’s sweetened lime juice for all or partial
.5 can miller lite (just kidding! but not kidding) or your fave beer or lite beer
.5 can diet lime drink (7up/sprite etc)
1 tbsp orange juice concentrate, optional

Add enough ice to make it chill.
Don’t shake! beer and softdrinks are not fond of this.. stir slowly

drink carefully… it tastes like a lighter drink, but it actually packs the punch of both tequila *and* a beer.

IP firm that functions as a partner instead of a hired service

I’ve missed a good number of opportunities over the years for some intellectual property on some unique technologies that I *think* I invented (they may have already been) and which later showed up in the market, sometimes very successfully. In one case, a partner and I built an electronic device that later become a multi-billion dollar industry, but again we did not lock down any IP for it at the time. That would have been a nice one.

Although my companies have gone on to procure a number of patents in a couple industries over the years, some of the larger ideas I’ve had I chose not to pursue IP for due to several reasons, usually a combination of these:

– Not being my primary industry/business focus
– Not worth spending 5+ figures on to attempt to pursue, especially when not in primary area of focus- also 5 figures has been a lot to me in the past.
– Lack of a patent/IP firm that actually tries to help achieve success instead of simply trying to bill the max hours.

I haven’t researched this much yet, but I’m curious if there are firms that will partner with small businesses to handle all their IP in exchange for licensing revenue. And perhaps even some equity. I’m aware of the “Patent Your Idea” services out there, but they often are just services trying to collect a fee for some basic submission work and not legitimate partners.

Having said this, I currently have one “big” idea related to e-commerce, a couple others that would be big in a smaller sporting goods industry, and one niche in the VR space.

I’m posting this on quora as well – see here https://www.quora.com/Are-they-IP-firms-that-will-partner-on-your-IP-and-work-on-licensing-it-and-defending-it-as-a-partner-instead-of-just-a-paid-service

dism restorehealth error 0x800f081f fix

my pc was having some weird issues so I found instructions to do the sfc /scannow and dism commands that should check and repair the core system files.

The directions I found online had me run sfc /scannow first, followed by a few dism commands, and then the dism /Restorehealth command at the end. Everything worked until this last step, where it would error without being able to find the source. It’s supposed to pull the source files directly from windows update, so this was odd. digging deeper led me down a path of downloading an iso of windows 10, and extracting some install.esd and try to use it as a source. Same problem. Then tried converting the install.esd into an install.wim. Same problem again.

After banging my head on this and spending more time than I should, I ran across one small post online about running the commands in a certain order to make it work. It was so simple I assumed it wouldn’t work, but why not… tried everything else.

So this is what I ran to FINALLY get my RestoreHealth dism operation to work- from an admin elevated command prompt run these three commands in this order:

dism.exe /online /Cleanup-Image /StartComponentCleanup

sfc /scannow

dism.exe /online /Cleanup-Image /RestoreHealth

At least for me, this was the magical order. I’m logging it here in case I need it again someday.


PHP on Windows, IIS, FastCGI results in MySql Sleeping Connections and Too Many Connections error

Not long ago we moved a wordpress based website from an ovh account to a windows server we already had running other things. (Nothing against OVH, just no point in having another server when we have excess already). We’ve run a number of wordpress installs on IIS and Windows, and the FastCGI implementation seems to work really well.
We started having occasional outages with the site after about a week or so, the error being “too many database connections open”. I initially thought this was being caused by an API call the site makes to a service, and that the api might be experiencing slowdowns causing the site to sit too long with open db connections and causing this issue. But eventually this was ruled out.

Mysql was showing a lot of “sleeping” connections to the database, so it looked like something was opening a lot of connections but not closing them. This is usually not an issue with Mysql and php because the connections are auto-closed at the end of each request.

BUT- when you run FastCGI on windows and IIS, part of the “fast” portion is that the service doesn’t actually end the whole process after every request- the service keeps running and waiting for the next page request to process. As a result apparently FastCGI will keep open any database connections that are now explicitly closed, until they time out some time later. So if you only have a few connections being made, your server will probably be able to keep creating them and they will expire in time for the server to not run out of resources, but in instances where it cannot keep up, your site will go down and start showing the dreaded “too many database connections” error page.

Note that the wordpress site itself doesn’t have this issue- the problem I only ran into with some custom php code that have been added onto a wordpress site. If this code were to use the correct wordpress database access methods instead of the hard coded ones, it would have operated fine as well.

Lesson- explicitly close your mysql connections in custom php code, or use the wordpress database access classes instead of your own. It might not be a problem usually, but this will cause server crashes in instances where the code is installed on Windows, IIS, and FastCGI.

Home Raising in Houston, after Harvey

Update- this link should have some options for raising your house or home in Houston- Houston Home Raising

Raising your home further above the ground is something I just heard of in the aftermath of Hurricane Harvey in Houston Texas. It’s not inexpensive, but apparently there are actual options for this, including raising a house that is on a slab (pier and beam can obviously be raised without nearly as much effort). I’m researching this more and will be adding more info on Home Raising in Houston once I find more info.

I’m also curious if future home builders in the region will be considering using a “stilt home” design to raise the house much further above ground level. These designs are popular in truly coastal towns such as Galveston, where storm surge can easily raise water well into where the first story of the house would normally be. This design would be a bit extreme (and odd looking) to use much further inland, but a hybrid of the design might make sense- especially in 2 and 3 story houses, perhaps the first floor can be water hardened in such a way that flooding has minimal impact on the house and it can be back in action quickly. Researching this as well.

Crashplan Home replacements and alternatives

Crashplan, my favorite backup software, recently announced they would be discontinuing the consumer or “home” product from their lineup and will just focus on business customers instead. This sucks as I had settled on using their product for all my backups some time ago, and have it running on a number of machines. The good for me/bad for them feature that I really liked is the p2p backup options- I have a number of friends I use crashplan with to back up each others’ data to each other. Good for me because I don’t have to pay for cloud storage. Bad for crashplan, because they don’t make any rev off of me… so maybe I’m part of the reason they’re discontinuing?

I’d love to see a p2p focused product like crashplan replace it, but I’d really love to see it as an open project. (This guy kinda read my mind on the topic – https://m4rc.us/2017/09/06/the-ultimate-p2p-backup-software-or-the-definition-of-insanity/

Crashplan, if you read this, are you interested in selling off the consumer part of your service? I see you are currently referring these customers to another service that I won’t name here.. hate to see that happen as well. Give me a call guys. brady dot moritz at gee mail dot com. (as if bots can’t figure that email out nowdays…)

Anyway- I’ll be researching and updating here for what alternatives are out there. Comment if you have any input.

Update: This isn’t a replacement, but this page goes into detail about recovering your data *after* crashplan does shut down- this could be a headache for users who need to restore their data after crashplan officially shuts things down and effectively (in theory?) will block you out of your own data:  https://github.com/OurDataNotYours/PlanC

Sedis Kickstarter by Nefer Games

Nefer Games is running a kickstarter for their first gaming system called Sedis- think of a six sided dominos, add a pile of math, and you get the new Sedis tile system. It’s claimed to be only the 4th generic gaming system in the world, behind dominos, dice, and cards. Go check out the kickstarter and make a pledge to get this project cranking!  https://www.kickstarter.com/projects/nealmurthy/sedis-make-your-own-rules