Regex: Back reference and Self reference in Regular Expressions

This is going to be a very short and niche post.

Sometimes I have to use regular expression or “regex” searches to parse a bunch of text, but I can’t remember how to use the search function to find a particular sequence of character and then reuse those found characters in the text I’m trying to replace it with.  In Notepad++, this would be done as follows:

  • Search string:   (7//*[0-9]*[0-9])\r\n
    • This will find all entries with “7/3” or “7/14” or similar digits with a line return afterwards
  • Replace string:  \1/2018;
    • This will replace those entries with “7/3/2018;” and “7/14/2018;”, respectively

The trick here is that the first set of search information is collected together within a set of parenthesis, which are then referenced back by the “\1”.  If you forget the parenthesis, the “\1” term won’t “know” what it’s supposed to be repeating.

Like I said, very niche.

[SOLVED] Google Pixel stuck in a boot loop after update and full storage

If your Google Pixel is stuck displaying the “G” and forever looping through a boot screen, Google’s support will tell you there is no hope and you’ll either have to do a complete factory reset and data wipe of your phone or send it in so they can do it for you.  However, if you are adventurous or have nothing to lose, there may still be hope.

I’m not saying this will work for you, or that you should even try what worked for me.  But, if you’re as desperate as I was, you would try absolutely anything to get your photos back.1

While out of town on vacation, away from WiFi and cell carrier internet access, I took a lot of photos and a few short videos.  My phone, a lowly Google Pixel with just 32GB2 of storage ran out of space.  It claimed it was at “100%” usage of storage with only a few dozen megabytes of space left.  I leaped into action, right there on the beach, deleting some large documents and ZIP files I had downloaded and then asked the Google Photos app to “Free Up Space.”  Pats on the back!  Job well done!

Except the Pixel had other ideas.  I reached into my pocket later to pull out the phone and take a picture to discover that it was on the white boot screen with the colorful Google “G” logo and a light gray “progress” bar undulating underneath it.  I thought this might be due to the phone overheat and put the phone away.  When I pulled it out later, I found the phone was still showing the same white boot screen.  I don’t know what caused this problem.  I don’t know if it was the Android system update from a few days ago, the storage being mostly full, possibly being too warm from being in my pocket, or what.

I tried everything I could think of and everything I could find to no avail:

  • I was unable to boot the phone into anything resembling active status, not even the last measure of “Safe Mode.”
  • I could boot the phone into “Recovery Mode” which looks like the Google Android robot lying on its back with a front panel open and some text underneath.  However, attempts to “Start”, “Reboot”, and use “Recovery Mode” were all unsuccessful.
  • I tried following the recommendations of the mysterious “Techno Bill” on the Pixel Google Groups to install ADB and Fastboot and then apply a Rescue OTA to the Pixel.
    • If nothing else, this one possibility gave me hope that I could still interact with my phone, somewhat.  I was careful to try out the specific OTA3 for my phone.  As you navigate the various menus in the Recovery screens for Android, you’ll need to take note of the version of Android you’ve got – so you can place the same version over it.
    • As best as I understand this fix, you’re basically overwriting a possibly damaged or corrupted operating system with a shiny new factory fresh version – and that doing so leaves your data intact.
  • The thing that gave me the most hope was this post by Mac_DG on Reddit.  Basically, they said, “If you can get there [the Google recovery screen], and it’s a software problem everything is fixable.”
  • I even spent 43 minutes4 chatting5 with Google’s Pixel support team member, Marlene.  She was sympathetic, but assured me in no uncertain terms that my data was lost forever.  My options were to send my phone to Google or take it to a repair facility for a diagnostic.

Finally, after much searching, I found this thread on Google’s product forum where someone named Jintoku described an identical problem to mine – and someone named Kara Alexander described an identical problem … and a solution suggested by Samuel Cooksey!  If you think you’ve got the same problem – nearly full storage, frozen or looping “G” screen, and unable to enter Safe Mode, it is absolutely worth your time scrolling through this thread to see if this solution may work for you.  It is also worthwhile reading through Jintoku’s conversation with Google’s representatives to see how hard they tried not to do a factory reset on the phone – and just how certain the Google representative was that this was the only possible solution short of outright replacement of the phone.

I will not duplicate the efforts of Techno Bill, Jintoku, Kara Alexander, Samuel Cooksey, and Mac_DG by repeating everything they’ve already said.  Rather, you may use any of the above links from my search to follow along and, hopefully, set you on the correct path.  If you would prefer a condensed guide, with links, I hope this will help:

  1. Follow Techno Bill’s guide on installing ADB and Fastboot.
    1. If you’re on Windows, you either need to follow Techno Bill’s guide on updating your computer’s “Path” or, if you’re a little more comfortable doing so, you can skip steps 1-8 and instead open the command prompt and type
      1. “SET PATH=%PATH%;c:\adb”
      2. The benefit of doing it this way is that you don’t have to permanently add this path to your operating system, it’s a lot faster and easier than Techno Bill’s method, and you don’t have to restart your computer
  2. Download the Developer Beta Preview OTA for your phone6 .
    1. It almost goes without saying that with words like “Developer”, “Beta”, and “Preview” in the title, this version of the Android operating system isn’t for the faint of heart.  If you don’t know what you’re doing or, like me, don’t have anything to lose, you shouldn’t be trying this.
  3. Follow Techno Bill’s guide to “sideload” the Rescue OTA to the Pixel.

If this blog post, that I write as my phone is running the Photos application right now to back up my vacation photos, saves even one person’s data, I will be an incredibly happy person.

  1. After all, what’s the worst damage I could do?  In a worst case scenario, the phone would still be unresponsive or bricked permanently []
  2. !!! []
  3. I believe this refers to an “over the air” operating system update []
  4. I was emailed the chat logs after the session ended []
  5. Since I had no phone, natch []
  6. Pixel, Pixel XL, Pixel 2, Pixel 2 XL []

Loudest 3D Printed Whistle – now with 100% more science

Extremely loud and compact emergency whistle v1

Extremely loud and compact emergency whistle v1

I ordered a decibel meter from Amazon the other day so I could drop some science on the claims from various 3D printed whistles on Thingiverse.  There are several that claim to be the loudest.  Well, today, I began my quest to put these claims to rest.

The closer the decibel meter is to a sound source, the higher it registers.  To eliminate some of these variables, I placed the decibel meter on a counter in front of me and a chair 24 inches in front of that.  For each of the whistles I was testing I stood just behind the chair and gave the whistle three hearty puffs.  The decibel meter, which was set to record and display the “max” reading, would then tell me the loudest reading for that set of three whistle toots.

Without further ado, I declare the “Extremely loud and compact emergency whistle” by Whistleblower on Thingiverse the clear winner at 121.1 decibels.  Both whistles by this designer took the top two scientifically determined spots.

NameThingiverse IDMass (grams)PricePrint Time (minutes)DecibelsSubjective Rank
Extremely loud and compact emergency whistle [v1]29330213.9$0.1222121.11
Extremely loud and compact emergency whistle [v2]29330213.7$0.1118111.53
v29 (Over 118 db!)117916013.9$0.4290110.44
2 chamber whistle (LOUD) [w5]26165128.1$0.2449109.52
Emergency Whistle with Solidworks 2014 source4951721.2$0.047101.85
Whistle Ring Modified [v2]20271151.6$0.05990.86

Just how loud is 121.1 decibels? 1  Well, for starters, it’s just above the pain threshold of 120 decibels.  It’s louder than:

  • Your iPod headphones at maximum volume
  • A baby crying, next to your ear
  • A full symphony orchestra
  • The subway
  • A sporting event
  • A chainsaw
  • A jetski
  • A marching band

It’s on par with:

  • Thunder
  • A shotgun
  • An ambulance siren
  • A rock concert

And, if you didn’t have earplugs, you would exceed the daily safe exposure limit for 121 decibels in 7 seconds.

There may be louder whistle on Thingiverse2 and, if so, please let me know.  I’ll print the model and test against the others in my arsenal.

Default Series Title
  1. This page has several charts to help explain. []
  2. Or some other online 3D design repository []

Loud 3D Printed Whistle Test, Take 2

Impatient for my decibel meter to arrive from Amazon and eager to get more feedback on the loudest 3D printed whistle, I brought the four loudest whistles to work and enlisted the help of two friends.  We performed the test much the same as the last time – only this time they were on one end of a large parking lot and I had driven to the far side to blow each whistle once, then repeated them each once.  Here’s the result on their subjective test:

NameThingiverse IDMass (grams)PricePrint Time (minutes)RankDecibels
Extremely loud and compact emergency whistle [v2]29330213.7$0.11181TBD
Extremely loud and compact emergency whistle [v1]29330213.9$0.12222TBD
2 chamber whistle (LOUD) [w5]26165128.1$0.24493TBD
v29 (Over 118 db!)117916013.9$0.42904TBD

Whether the1 loudest whistle is the v1 or v2 of the “Extremely loud and compact emergency whistle,” Thingiverse user whistleblower clearly designed an amazing, quick printing, low cost whistle.  It has a very high pitched piercing tone that can be downright painful to be near, let alone create. 2

As before there’s a number of different things that could be happening here.  Perhaps the particular tone of this whistle travels better through open spaces (such as a parking lot) rather than through a door and down a hall (such as inside my house).  I know there are some whistles that require a lot of blowing power to hit maximum volume and others which almost “choke” on too much pressure.

In two days my decibel meter will arrive and I’ll try all of these tests again and post a new table.  If you think you’ve got a contender or have seen a really loud whistle on Thingiverse, let me know in the comments so I can print and test it.

Default Series Title
  1. Subjectively []
  2. Again, I had my earplugs in for the test []

Loudest Whistle on Thingiverse… The Answer Might Surprise You!

You'll need a pair of these earplugs

You’ll need a pair of these

Whistles have been a staple on Thingiverse for years, probably because they’re such a small, simple, and impactful way to demonstrate the usefulness of a 3D printer. 1 I don’t know how many there are, but there are a LOT of whistles on Thingiverse.  I’ve been curious about which whistles on Thingiverse are the loudest and conducted a semi-scientific experiment to figure this out.

Six whistles

Six whistles

I say “semi-scientific” because I don’t have a decibel meter.2 My methodology was to have my family at one end of the house while I went to the other side, closed the door, put in my earplugs, and wailed away on six whistles as hard as I could.  In any case, here’s my findings:

NameThingiverse IDMass (grams)PricePrint Time (minutes)RankDecibels
Extremely loud and compact emergency whistle [v1]29330213.9$0.12221TBD
2 chamber whistle (LOUD) [w5]26165128.1$0.24492TBD
Extremely loud and compact emergency whistle [v2]29330213.7$0.11183TBD
v29 (Over 118 db!)117916013.9$0.42904TBD
Emergency Whistle with Solidworks 2014 source4951721.2$0.0475TBD
Whistle Ring Modified [v2]20271151.6$0.0596TBD

I added a few columns that may (or may not) be of interest to you.  I indicated the weight of each whistle, because sometimes I want to know how many whistles I could produce off a single spool of plastic.3  Sometimes I want to produce the loudest whistle for the time I have to produce a whistle.4  I showed the cost per model5 , because it brings me so much joy to know I can make my daughter’s classroom louder than a jet engine for less than the cost of a pack of gum.

I know there are a number of important variables are are simply not addressed in this test.  Different frequencies sound louder or might be easier to hear through the door.  I tried to blow each whistle the same amount, but some whistles are louder with less forceful or more forceful blows.  Once that decibel meter shows up, I’ll be sure to post another update.

Default Series Title
  1. Photo by mosambers []
  2. Yet.  At <$20 on Amazon, you can be sure I’ll be adding actual readings soon []
  3. With careful design, approximately 2,500 whistles per kilogram of plastic []
  4. The v2 of this whistle is the clear winner []
  5. Assuming a spool costs about $30, shipped []