Categories
Tech

What is a Regular Expression?

A regular expression, also known as “regex”, is a search pattern. Regex is useful when the search is more complicated than just needing to find a specific word.

For example, let’s say a computer program has made a big file that lists everything it has done, and each line starts with a date like “2019-04-01”. If we want search for lines that start with a certain date, we might want to use regex:

  • If we just need everything that happened in April, we can search for “2019-04”. We could do a plain, non-regex search for “2019-04”. But “2019-04” also happens to be a simple regular expression.
  • If we need to find any line from April or May, we can use the regular expression “2019-0(4|5)”. The “(4|5)” part just means that either or 4 or five is OK in that position.
  • If the computer program was inconsistent, and the format is “2019-04-01” some times and “2019_04_01” other times, we can use the regular expression “2019.04.01”. The periods are wild cards.

Regular expressions can get more complicated than that, but that’s the general idea.

There are multiple formats for regular expressions. So some times you’ll see slashes around the regular expressions, or a regular expression that works in one program won’t work in another.

Stephen Cole Kleene
Stephen Cole Kleene, who helped invent regular expressions in 1951.
Categories
Tech

Bear: a Markdown Note Editor

Do you need a markdown note editor? Bear can show you the markdown, and format it at the same time.

What Bear Is

Bear is a text editor, designed for note taking. It works on iPhone, iPad, and Mac. You can type using markdown notation, and see the formatted text as you type.

Bear markdown input
Bear real time formatting.

The real-time formatting is important to me. Markdown works well for me because it lets me keep my hands on the keyboard, instead of mousing to click on formatting buttons. But when I need to glance at a screen of notes and quickly find the section I need, actual formatting is important. I can see big, bold headers faster than I can see the line I typed a # next to.

Markdown Checklists

I rely on checklists every day. Bear has become my go-to for for these. It lets me format my checklists without fiddling with menus, and marking items done is easy.

Bear checklist
Bear is handy for checklists.

There are times when I need to switch between projects and manage checklists rapidly. It’s important to me to have good formatting so that I can quickly find what I am looking for.

Note Management

You can organize your notes in a couple of ways. If you type #phone-app in a note, then a “phone-app” folder will appear on he left side of the screen. Click on that folder and you will see all your #phone-app notes.

You can also do that the other way around: drag a note into the “react-dev” folder, and Bear will insert a #react-dev hash tag into that note.

Touch Bar Support

The developers of Bear made the extra effort to add context sensitive controls for Macs with touchbars. When I’m using the text editor, this shows in the touch bar:

Touch bar controls. Tapping the pen reveals a long list of options.

Markdown Learning Help

Need a reminder about markdown syntax? There’s a pen icon on the lower right of the text editor that reveals a markdown quick reference.

Cost

Bear is free, unless you choose to pay a small fee for syncing across devices. At the moment, that fee is only $1.49 per month.

My Review

I’ve been using Bear to keep track of my working notes for some months now, and am quite happy with it. It does a good job of keeping my notes organized, but has a much more responsive and lightweight feel than other note taking solutions I have tried lately (OneNote and Evernote.)

The ability to type in markdown is a big win for me. I prefer to keep my hands on the keyboard, and Bear lets me do that.

The only complaint I have about Bear is that it isn’t available for my Android phone. But that’s a minor complaint; when I’m doing the kind of work that requires note taking, I have my laptop open anyway. Also, since I’m only using it on my laptop, the free version is perfect for me.

For more info, see the Bear web site.

Categories
Tech

How to Switch Phone Providers

I have switched phone providers a few times. Here are some things I learned along the way.

The following is just what I have experienced. Your experience may be different.

Temporary Changes

If you are traveling with an unlocked phone, you can temporarily use a different phone provider. This can be handy if you go to a country where your usual provider would charge you a lot of roaming fees.

If the change is temporary, you just need to get a prepaid sim card and swap it for your usual sim card. Then you can swap back when you’re ready to go back to your usual carrier. There is more about that in the Three Ways To Avoid Roaming Fees post.

Permanent Changes

It takes multiple steps to permanently switch phone providers. If your new provider is a big company, you may be able to get this all done by walking into one of their stores and talking to the person at the counter. For smaller companies, you will have to do a lot of it on your own.

Here is a high level overview of what’s involved. It’s just meant to give you an idea of what the process is like. If you need help with the specifics, your new phone provider should be able to work out the details with you. If they can’t, that’s a sign that their customer support is not going to be good enough.

Step 1: Pick Your New Provider

Pick your new provider and start a plan with them. My favorite provider right now is Ting, but I have had good experiences with Verizon. I had a bad experience with FreedomPop.

If you want to keep using your old phone number, ask your new provider if you can keep your old number. I have never been told I can not keep my old number, but I have heard that some numbers can not be ported.

Step 2: Use Your New Sim Card

To connect to the new phone provider, you will need to use the new provider’s sim card. A sim card is a little piece of electronics that fits inside your phone.

You will need a new sim card to switch phone providers.
You will need a new sim card to switch phone providers.

If you are buying a new phone, they will probably set it up with the new sim card, so there’s really nothing for you to do here.

On the other hand, if you already have an unlocked phone and you want to bring it to the new provider, you will need to buy the sim card from the new provider for anywhere between $0 and $10.

Replacing the sim card was an easy, no-tools procedure in all the phones I have used. If you aren’t able to do this with your phone, there is probably a shop in your area that can do it for you. If your new phone provider does not have physical stores, try a phone repair shop.

Step 3: Activate Your New Sim Card

You must activate your sim card before it will work. Some providers send their cards “pre-activated”, meaning they will work as soon as you put them in your phone. If the card is not pre-activated, you will have to follow some instructions from the new provider. For me, this involved logging into a web site and typing in the number printed on the sim card.

Step 4: Port Your Old Phone Number

When a new provider starts service on your phone, you get a new phone number. If you want to replace that new phone number with your old number, you can “port” your old number to the new provider.

The new provider will need some information from you. The exact information varies. For example, that may include your account number with the old provider, and a pin from the old provider. The new provider needs this so they can contact the old provider and work out the details.

It can take anywhere from an hour to several days to transfer a phone number. It takes the most time when the old provider is a VOIP provider, like FreedomPop.

Step 5: Cancel Your Old Plan

It is really important that you keep your old plan active while setting up the new plan. This is especially true when you are porting your old number to the new provider. If you cancel your old plan too soon, you might not be able to get your old number back.

Once your new plan is working like it should, make sure your old plan is cancelled so that they do not bill you again.

Categories
Tech World

Three Ways to Avoid Roaming Fees

Traveling with a phone does not have to involve roaming fees. Here are a few things I learned about saving money while traveling internationally.

What Roaming Fees Are

If you have a United States phone provider, and you take your phone to another country, you may get extra fees on your bill at the end of the month. Those are roaming fees.

If you continue to use your phone outside the United States, those fees can get ugly. The fees can also get ugly if you just have your phone turned on. Your phone may be doing things on its own like checking email and receiving text messages over the cell network.

The surest way to avoid roaming fees is to turn off your phone completely. Putting your phone in airplane mode and leaving it that way also works.

For three ways to use your phone while keeping fees down, read on!

Solution 1: Make A Deal With Your Provider

Your cell provider may make a deal with you, if you contact them ahead of time. Verizon, for example, offers a service called TravelPass. TravelPass is a flat daily fee you pay in order to avoid normal roaming fees. The service costs $5-$10 per day, depending on the country. I’ve had good luck using this service while traveling in Canada.

This is a very simple way to avoid surprises on your bill.

Solution 2: Using Wi-Fi, Not Cell

If you want to disconnect from the cell network, yet still get internet from Wi-Fi, your phone may allow it. The first time you do this, I recommend checking with your cell provider soon after to see if you’ve triggered any roaming fees.

On my phone, I enable airplane mode to disconnect from the cell network, then tap the Wi-Fi icon to enable Wi-Fi. I don’t know if it works the same way with all phones.

wifi enable icon
On my phone, the airplane icon lights up when I’m in airplane mode. If I tap the Wi-Fi icon, Wi-Fi gets enabled but leaves airplane mode on.

This works well for checking email during layovers. It also works well in cities with a lot of Wi-Fi. This worked for me while traveling in Spain. When I needed internet, I stopped by coffee shops and other places with free Wi-Fi.

What Wi-Fi Can’t Do

In most cases, you won’t be able to make phone calls or use text messages once you’re disconnected from the cell network.

I say, “in most cases,” because there are internet-based services that provide voice and / or text without using the cell network. For example, Skype is a way to do both using the internet. Facebook Messenger works for written messages. This approach will keep your costs down as long as they are accessing the internet through Wi-Fi, not the cell phone network.

If you plan to do the Wi-Fi only thing, it’s best to do a bit of pre-travel preparation. Figure out what apps you want to use, and try them out with people you may want to contact.

Solution 3: Using a Local Provider

If you really need cell phone service in another country, and you will be there for more than a few days, you can temporarily hook your phone up to a local phone provider.

To do this, buy a local sim card. A sim card is a little piece of electronics that fits inside your phone.

sim cards
Four sim cards. The other sides are just cardboard with logos and printed ID numbers.

Any phone I have used has a way to replace the sim card. It might involve a little drawer in the side of the phone, or popping the phone case open. If you Google “replace sim card” and your phone model, you will probably find instructions.

The sim card controls the identity of the phone. So once you replace your USA Verizon sim card with an Irish Vodaphone sim card, your phone will connect to the Vodaphone network, and you won’t be using your Verizon plan any more. Verizon won’t recognize your phone until you put the Verizon sim back in there. Your smart phone will still have all its apps.

Airport shops often sell sim cards for around $25. Some countries require identity verification before buying a sim (showing your passport may be enough.) In my experience, these cards are prepaid. Prepaid cards come with a certain amount of local voice and data. This has been enough to get me through a week, as long as I connected to Wi-Fi for any heavy internet use.

Local Provider Gotchas

I have had good experiences with local sim cards, but there are some things to watch out for:

  • Do not lose your original sim card! You’ll need to swap it back in when you get back home.
  • Read the small print on the local sim card. The service may only be good for a small area;  it may not allow you to phone or text home without extra fees.
  • Your phone number will change! Your original phone number is attached to your original sim card.
  • Applications on your phone may notice that the sim changed, and ask you to log in again (Gmail, for example.)
  • If there is anything that needs to reach you at your old phone number, changing your number may be a problem. For example, if there is a web site you log into that needs to send you a text message when you log in, that text message will go to your old phone number, and you won’t get it.
  • Your phone must be unlocked to take advantage of a local sim. If you don’t know whether your phone is unlocked, your phone provider should be able to tell you.
Categories
Tech

Verizon Phone Service – A Review

Verizon is a premium service, on a premium network, at a premium price. Verizon was the right choice for my family for several years, but we eventually moved on. Our experiences are summed up below.

Verizon Advantages

Easy Support

Verizon’s size allows them to provide more support than smaller providers. If you want to talk to them on the phone, their customer service number is available seven days a week. They answer the phone more than twelve hours a day, so it’s easy to find a convenient time to call.

They also have physical stores. The physical stores are great if you need to hand your phone to someone so they can fix it. They are also good when face-to-face is the best way to work out your billing questions.

The down side is that there can be a wait, if the store is busy. Wait time varies. Busy downtown locations can have a longish wait, but I’ve never waited more than twenty minutes. More remote locations are less busy, and I typically talk to an employee within five minutes at those places.

My experiences at the stores have been good. Any employee I’ve spoken with has been well-informed and got me what I needed efficiently. And the stores have been easy to find — any town I’ve lived in recently has multiple stores to pick from.

Verizon Store
Verizon stores can be found in a lot of cities.

Big Network

We switched to Verizon from AT&T after moving to a town where the AT&T coverage was spotty. Once we switched to Verizon, we had no complaints about coverage, wherever we went in the United States. For example, I remember camping in Yellowstone National Park, and noticing that Verizon phones worked in our camp ground, while AT&T phones had no reception.

I wouldn’t be surprised if there are places where some other carrier has better coverage than Verizon, but I didn’t find those places.

Predictable Pricing

We were charged what we expected to be charged. Our data needs changed over time, depending on travel and WiFi coverage wherever we were spending our days. But we could always log into Verizon’s web site and see how we were doing. When we needed to increase our plan size, it was easy to do so.

Verizon Disadvantages

Sticky Pricing

I was traveling enough that I was interested in trying a provider that catered more to international travel. However, Verizon was familiar and comfortable for us, so it made sense to leave my other family members on Verizon.

The catch was, taking just one person off the plan would increase our monthly costs, even if the other plan was cheaper. This is because the biggest expense with Verizon is the core plan, with unlimited minutes & texts. Adding more lines is cheap with Verizon, unless data usage also increases.

In our case, we were paying $50 per month for the Verizon medium plan, and another $20 per month for each line. With three people, that meant $110 a month (plus various taxes and fees, but I’m keeping this simple for sake of illustration.)

That averages out to around $37 per person. I could find some phone providers that suited my needs well for $30 per month, but if I switched, our total monthly costs would grow to $120 per month.

Ultimately, we did switch, but the idea of our family costs going up so that I could try something less familiar did make us hesitate. The Verizon price setting team has my respect for that!

Premium Pricing

Picking a Verizon plan is very simple; “pick a number of gigabytes, and a number of phone lines.” But if one is willing to deal with more complex pricing, there can be cheaper options.

As I started to look at other providers to satisfy my travel needs, I learned that Verizon’s pricing model was pretty different from some of the alternatives. My family could be saving a significant amount of money by switching away from Verizon.

Summing Up

Verizon provides good service, and I would not fault anyone for using it. The simplicity of the pricing and availability of physical stores makes it great for people who want to keep their lives simple.

For us, though, we were willing to invest effort in reducing our monthly costs. After trying FreedomPop and Ting, we eventually settled on Ting. It looks like our family phone costs going forward will be $55 / month plus fees, compared to Verizon’s $110 plus fees. We’re happy to be saving $660 per year.

The pricing worked out this way because of my family’s phone use patterns (voice minutes, text messages, data, phone count.) The math may be different for your use case.

Categories
Tech

Ting Phone Service – A Review

I switched to Ting recently, and am very happy doing business with them. They have been reliable, they are easy to talk to, and the price is low.

What I Was Looking For

My family of three had used Verizon phone service for a long time. I got to wondering if there were cheaper options. There are.

Each of the people in my family has a different usage pattern. One uses more data, one uses more texts, and one uses more voice.

After some research, I tried FreedomPop and had an unsatisfactory experience. The other family members tried Ting and had a good experience. Now all of us have switched to Ting.

Simple Pricing

Ting’s web site gets right to the point:

Ting: use less? Pay less.

Ting’s big selling point is that you pay for what you use. There is no need to guess how many texts / minutes / bytes are needed per month. Ting will charge based on what you use.

This is very different from the traditional approach of phone plans. With other phone providers I have dealt with, there are packages that allow a certain amount of texts, minutes, and data. None of those plans exactly match what I need. I pick the plan so that there’s enough of whatever I use most, but I’m also paying for too much of whatever I don’t use so much.

With Ting, using more than expected just creates a small, temporary price bump. For example, I use a bit more data, I’ll just be charged a bit more for the data usage. I won’t have to upgrade to a whole different plan, where I am also paying for a bunch of unneeded texts and minutes.

The Ting web site has a nice price calculator so you can see what your prices would be. After being on Ting long enough to see my bill, I can attest that it is accurate.

On-Target Web Site

Ting’s web site does not mess around. It gets right to the point by telling me how their pricing works, and what I will get. It delivers that message in simple terms.

Compared to the competition, that is a relief. As seen below, the first thing Verizon’s web site shows is a big advertisement for the most expensive phone they sell. FreedomPop’s web site has simple text, but the text is misleading; one does not get unlimited service at the $10 / month tier, nor will it only cost $10 a month. Also, the name of the company one will be dealing with (FreedomPop) does not appear anywhere on the front page. I have written more about that elsewhere.

Ting’s frankness and clarity carried through to the rest of my experience doing business with them.

Support Experience

Ting’s customer support number is easily accessible from a link on their home page. After signing up, I called that number with some questions.

The representatives who answered (I made two calls over a couple days) were courteous and knowledgeable. They were well-spoken, and seemed to be answering directly, without reading from a script.

Being able to talk to a human, and get useful, frank answers, made me much more comfortable doing business with Ting.

Ting Phone App

Ting provides a phone app that provides real time usage reports, billing history, and other handy info. The app is easy to use.

My favorite feature is “current usage”, which shows clearly how much I’m paying for what, and how close I am to needing to pay a few more bucks.

Summing Up

Ting provides good phone service, low prices, and has good customer support. My family will be staying with Ting!

If you’re interested in trying Ting, click this link to get $25 off. Full disclosure: I get a discount on my bill if you follow that link when getting started.

Categories
Tech

FreedomPop Phone Service – A Review

I tried FreedomPop. The phone service worked, but it fell short of the expectations FreedomPop had set. By the end of the first month, I was eager to do business with a different carrier. Here is my experience.

The Pitch

The Unreal Mobile web site advertised $10 per month for unlimited mobile, risk free. Sign me up!

I clicked the “bring your own phone” link at the top, started filling out forms, and got an error message about their system having trouble. The error message suggested calling their sales department.

FreedomPop error message
I got this error message after filling out the online form. Two months later, I tried again and saw the same error message.

Talking To Sales

The phone number took me to a computerized phone menu. I selected the option to bring my own phone. After a brief time on hold, a man answered. He seemed not to have gotten the message from the computerized system, and started walking me down the path of buying a phone from them.

I gently stopped him, clarified that I didn’t want to buy a new phone, and asked some questions. He gave useful answers, and I learned some things that were not clear from the web site.

  • FreedomPop provides the phone service. “Unreal Mobile” is just a brand they use in marketing.
  • The web site says “unlimited mobile”. Actually, data costs extra after the first gigabyte.
  • The $10 plan is only if you buy a phone from them. If you bring your own phone, it’s $23 / month.
  • I would not be able to start at the $23 level. I would have to start at a $25 tier (so that I get 2GB before I start to pay for more data.)
  • The plan required a sim card that would cost me $20. That sim card comes with a free month of service at the $25 tier. If I paid an extra $7, I could speed up shipping to get the card in a couple days.
  • Transferring my old phone number to FreedomPop would cost $10.

I had started the call thinking I would get $10 / month service. During the call, I learned I would pay $37 to get that first month of service. I signed up anyway, and accepted the offer of an extra sim card for one cent.

More Unpleasant Surprises

Once that $20 sim card arrived and I got my phone set up for FreedomPop service, there were more learnings:

  • FreedomPop phone service only works if you use their phone app. If I dialed a number with my own phone app, it would switch to the FreedomPop phone app.
  • Phone calls some times had a stuttering quality, and I got complaints that my voice sounded distorted. I don’t know if the app is to blame, or if it is something inherent to the VOIP service FreedomPop provides.
  • FreedomPop text messaging only works if you user their texting app. Having the freedom to pick my apps is one of the reasons I use Android, so this was disappointing.
  • Voice mail is free, in that people can leave messages. But you must pay an extra $2.49 a month to listen to the messages. A FreedomPop help document said that I could listen to my voice mail at a certain phone number without paying the extra fee. I called the number, and got a “this number has been disconnected” message.
  • Texting is free, but to be in group texts or send / receive images costs an extra $1.99 / month.

I had gone into this expecting $10 / month for unlimited service. Instead I would be paying $29.48 a month for 2GB / month.

Double Bills?

Toward the end of my first month, I got a series of emails telling me that my trial was almost over, and that FreedomPop would charge me when it was over. Strangely, I was getting two of each email.

I eventually realized that, even though I only got one order confirmation email when I agreed to do business with FreedomPop, they had quietly activated that extra one cent sim card. They would have charged me a total of more than $50 at the end of the month for the two accounts. But I clicked around on the FreedomPop web site until I found where to cancel the service I had not ordered on that one cent sim.

Later, I contacted support and explained that I did not know there would be a plan activated on that extra sim. Part of their response was:

To ensure that our customers are aware of the plan and cost a device may generate, all charges are disclosed prior to checkout and reiterated in a follow-up email

It’s nice to know that they have a policy of clear communication, but my own experience was not consistent with this policy. In practice, clear communication is not happening.

Fist full of dollars
What had started as $10 per month unlimited service was turning out to be $50 per month limited service. Photo by Burst on Pexels.com.

The Support Experience

It was clear to me by this point that FreedomPop is risky to do business with. They had not outright lied, but they had set expectations and then failed to meet them. I did not feel safe trusting FreedomPop with my credit card.

I picked a different carrier and went back to the FreedomPop web site to get my port out information. FreedomPop has a page for that…but my info was missing. From posts around the internet, it sounds like that page had been broken like this for a long time.

I created a support ticket. A day later I had no response. The ticket form had said that a response may take two days, but given the battering that my trust in FreedomPop had already taken, I started wondering if FreedomPop trying to “run out the clock” on me so that they’d have an excuse to charge me for another month of service.

FreedomPop’s Facebook page support was much faster. I sent a direct message, and had a response in just over an hour. I got my port out information there, and started the porting process.

In the days that followed, I got a response to the support ticket (just a little over 2 days after submitting.) I also sent some more questions to the Facebook page, and got useful (and faster) responses there.

Porting Out

When I ported my number into FreedomPop, it transferred pretty quickly. I don’t recall the exact time, but I think it was a couple hours or less. FreedomPop took several days to port my number out. I’ve read that porting a number out of a VOIP provider like FreedomPop just takes longer than porting it out of a traditional phone provider.

Free Plan Is Not Free

While I was waiting for my number to port out, I thought I’d switch the account to the free plan, just in case the billing date arrived before the transfer was complete. The free plan allows a small amount of phone use per month.

I went to the FreedomPop web site and followed a link to switch to the free plan. The site showed me a notice that I had to pay $20 to do so. My understanding is that this would add $20 of credit to my account in case I used more minutes or data than the free plan allowed. But, since I had no intention to use that credit, I wasn’t interested in paying for the “free” service.

FreedomPop Was Not All Bad

I didn’t hate FreedomPop’s service. It was the string of unmet expectations that soured me on doing business with FreedomPop. Had the web site said “Phone service with 2GB data for $30 a month”, I would still have tried them out, and then been happy. I would probably still be doing business with them.

The support people at FreedomPop deserve respect. They did have useful answers for me. They are contending with customers that were set up for disappointment by the marketing & sales sides of FreedomPop. Support has a tough job there.

The texting app worked fine. It was attractive and functional. I also liked that I could access a lot of account information within the app.

Coverage was decent. I took the phone on a road trip through some pretty remote areas, and had phone service in the places I’d expect.

Categories
Tech

Unserialize Performance in PHP

Today I’m writing some PHP code that will frequently need to unserialize a short array of strings. I did some informal benchmarking to find out what serialization technique could be unpacked the fastest.

unserialize() vs. json_decode() vs. explode()

explode() was the winner here for small arrays, and that’s what I need. As arrays got bigger (100 – 10,000 items), unserialize() started to shine. When the array had 100,000 members, explode() was again the fastest. json_decode() tended to be slowest in all cases. I ran the script several times, and the results were consistent.

I peeked at memory use, too, but the three routines had pretty similar memory usage, so I did not look deeper into that. Plus, for today’s application,  speed is more important than memory.

The Data

Here’s the raw output of today’s script. The little hiccup in the data at array size 100 is interesting; explode() was slower than unserialize() at that array size every time I ran the script.

The Script

This script is intended to be run on the command line.

<?php

echo "tested on:\n";
passthru( 'php --version' );
echo "\n";
runTests( array( 10, 100, 1000, 10000, 100000 ) );

function runTests( $sizes ) {
	// Gather data
	$results = array(); // $results[routine][size]
	$routines = array( 'measureExplode', 'measureUnserialize', 'measureJsonDecode' );
	foreach ( $routines as $routine ) {
		$results[ $routine ] = array();
		foreach ( $sizes as $size ) {
			$input = array_fill( 0, $size, 'fooBarBaz' );
			$set = array();
			for ( $i=0 ; $i < 3 ; $i++) {
				$set[] = $routine( $input );
			}
			$results[ $routine ][ (string) $size ] = array_sum( $set ) / count( $set );
		}
	}

	// Display results
	$column_width = 20;

	// Header row
	echo str_pad( "array size", $column_width ) .
		str_pad( "explode", $column_width ) .
		str_pad( "unserialize", $column_width ) .
		str_pad( "json_decode", $column_width ) .
		"\n";

	// Table body
	foreach ( $sizes as $size ) {
		echo str_pad( $size, $column_width );
		foreach ( $routines as $routine ) {
			echo str_pad( number_format( $results[ $routine ][ $size ], 9 ), $column_width );
		}
		echo "\n";
	}
}

function measureExplode( $arr ) {
	$arr = implode( " ", $arr );
	$start = microtime( true );
	$arr = explode( " ", $arr );
	return microtime( true ) - $start;
}

function measureUnserialize( $arr ) {
	$arr = serialize( $arr );
	$start = microtime( true );
	$arr = unserialize( $arr );
	return microtime( true ) - $start;
}
	
function measureJsonDecode( $arr ) {
	$arr = json_encode( $arr );
	$start = microtime( true );
	$arr = json_decode( $arr );
	return microtime( true ) - $start;
}
Categories
Tech

Incredible Shrinking Computer Shelf

Patterns in Tech Change

Personal tech evolves fast. Today’s newest gadget will be second best in six months, and in a few years it won’t be able to keep up. At least, that’s how it seems when you’re looking at advertisements for the latest thing.

There are larger patterns that happen so slowly that they are hard to notice. One of those patterns jumped out at me while walking into a Best Buy the other day.

Hacking

My son is a hacker, in the “can jury-rig tech to keep it ticking” sense. This comes from him being an avid video game player, and me not buying computers for him frequently. I do often inherit computers. This happens when a machine is broken enough that the former owners decide replace it. Such broken machines are often donated to me. I guess people find the look of glee on my face satisfying. Plus they know I make sure their personal / financial info is properly wiped from their old machine.

This led to me having a large Computer Graveyard (as my wife called it.) My son learned that when something broke, or when his computer just wasn’t fast enough to keep up with the latest games, he could often dive into the Graveyard, exhume some parts (Igor style) and solve the issue. It wasn’t as easy (and rarely as successful) as buying a whole new rig, but he learned a lot about how computers work, and how to keep them working.

The resulting contraptions often had strange quirks that he needed to work around, but that was part of the fun. My favorite example was a situation where he found that his computer could work with a particularly nifty video card, but only if he reached into the computer and reseated the video card’s power connection at just the right moment in the boot process. It would have been pretty hard for anyone else to have gotten the timing just right on that one.

The Incredible Shrinking PC Shelf

We moved recently, and the Computer Graveyard didn’t come with us. Okay, I did smuggle a few things into boxes, but most of it went to the e-waste center. Thus when my son needed to add a hard drive and some RAM, we headed to the nearest Best Buy to pick some up.

Once upon a time, there was a big computer section at such stores. There’d be a whole aisle of internal hard drives, plus another aisle of RAM. Now most of the store is cell phones and tablets, with a sizeable chunk of floor space for video game consoles. The computers — both Apple and Windows — are relegated to a shrinking island way over to the side near the back. There were only a handful of internal disks to pick from, and we were lucky to find the variety of RAM we needed.

That’s when it struck me. This had happened before, maybe a quarter century ago.

The Incredible Shrinking Apple Shelf

Apple IIcWhen I was a teen, I had an Apple IIc. Computer stores always had a software section, split into “Apple” and “PC”. There was a time when it was a pretty even split, but the Apple section shrank over time as IBM-compatible machines became more popular. Eventually, the Apple Section became the Apple Shelf. Back then, before the internet made it easy to connect with retailers outside my city, it felt like I was trapped on the wrong side of technological history.

Not Dead Yet

There’s a temptation to use hyperbole to describe things, which is why we frequently read and hear about “the death of the PC” or “the death of rock and roll” or whatever. It makes the speaker’s / writer’s message sound more exciting. Similar to injecting profanity into a sentence. But in the age of the internet, technologies never really die. They may get to the point where only a “few” use them.  Worldwide, “few” can mean a thousand people, or a million people. Now all those people can find each other and communicate, regardless of geography. Their individual experiences won’t be “my local store doesn’t carry it any more, so I can’t get it.” Desktop computers might get to that point some day, but it will be a slow process.

Categories
Tech

Zip Disk Data Recovery: How To Do It

I had a collection of zip disks that contained data from the 1990’s. Now it’s 2016, and after some trial and error, most of the data has been recovered. The background on why I was doing this, and what didn’t work for me, is documented in a previous post. This post explains what did work for me.

A friendly warning to the reader: I’m a tinkerer, and a maniacally obsessive part of me enjoys devoting whole days to coming up with solutions to strange technical problems. For most people, if you have obsolete media lying around, it’s probably best to hire a pro (more on that here). Or if you’re lucky enough to be on good terms with a maniacal tinkerer, ask them nicely to help you out. If they say yes, it’s going to cost them time and maybe money, so make sure to bribe them with wine, or horchata, or whatever they’re into.

For fellow maniacs who are nutty enough spend time on this sort of thing, the following may be helpful.

USB To The Rescue

Zip drives with a modern USB plug are still available. It has been two decades since these were the newest thing, but media has a way of sticking around. Wikipedia has a writeup on why people still use these things — ranging from “it’s the best way to move data between really old computers” to an aviation company that still uses zips to distribute navigation databases.

I’m not sure what I’d think if I boarded an airliner and saw the captain using a zip disk. Given that some of the planes we fly around in today were designed around the same time as the zip disk, maybe it makes sense sense.

At the moment, USB zip drives cost anywhere from $60 to $200, depending on if it’s new and whether it’s the 100MB, 200MB, or 750MB variety. I got lucky and got a used one on Amazon for around $60.

Trusty Mac Mini

Tucked into a box of gear that “may be useful some day” was a mac mini. Its name is Awesomebot7000. I inherited it when a friend’s company went out of business. It worked well with the zip drive, unlike other rigs I had tried with the same drive.

The Good, The Bad, The Unrecoverable

I was able to recover a little over half the files. A few of the disks would not even mount (show up.) Many of the disks that remained had at least one file that was at least partially unreadable. Copying the files to Awesomebot7000’s disk by dragging rarely worked; it seems OS X would start copying the files, and as soon as it ran into a single bit it could not read, it would give up without saving any of the data it could read. Which seems like a silly way to write a copying routine. Manually dragging individual files would have been impractical because of the number of files involved.

What worked for me was:

rsync -r -v /Volumes/Zip\ Disk/Desktop DF/ ~/Desktop/recovered/

This worked best for me (compared to cp and scp) because it would give problem files a few tries before giving up. Some trial and error showed that files that had problems would consistently have problems, whether I was using rsync, cp, or scp. There were cases where one of the files would be partially copied by one of those methods, while other methods could copy none of a problem file. I failed to take notes on which got the partial copies of bad files, but those partial copies were rarely useful anyway.

Because of the retries involved, copying a 100MB zip disk to the local HD could take quite a while, especially on badly degraded disks. “Quite a while” meaning “longer than my attention span”, because I’d generally go find something else to do while rsync did its thing. It felt like anywhere from 5 minutes per disk to most of an hour.

Click of Death

Legend has it that zip drives are subject to a sort of hardware virus called “The Click of Death”. These tales say that if an infected disk is inserted into a zip drive, the zip drive will make a clicking noise, and from thence forth the drive will be infected. Once the drive is infected, any disks inserted into that drive will be infected…spreading the problem without limit. These stories also say that the Click of Death instantly and totally obliterates all data on infected disks.

There was quite a hubbub about this, with Iomega saying it was a myth, and irate customers filing a class action lawsuit against Iomega in 1998. There are still people today who believe that zip disks and their manufacturers are bad and evil, respectively.

Back in the 90s, I used zip disks extensively and never experienced the rumored hardware virus. Reading these old disks in 2016, I would hear a click noise when the drive was having trouble reading a disk. That got me worried; was this new USB zip drive erasing / infecting all my disks?

As an experiment, after letting the drive click a bunch of times trying to read an unreadable disk, I put in a series of “good” disks that had been read previously. I’d then copy the files from the good disks…and the good disks never became unreadable. The files that had been readable before remained readable. If I put the unreadable disk back in, the drive would click like before. I could even isolate it to specific files; try to read a single unreadable file, and the drive would do the clicking thing. But try to read a “good” file on the same disk, and it could be read repeatedly.

The drive is semi transparent, so I was able to watch the mechanism during this process. I’m pretty sure that click is just the drive resetting to try again. There are parts that “click back” into a default position.

So if you hear your zip drive clicking, don’t freak out. It might just be trying again. Or it might be that Click of Death thing…but probably not. See the Wikipedia writeup if you want the nitty-gritty on the Click of Death. There is some good theory there to explain what some people experienced. I had an experience with SyQuest cartridges once that suggests a different way that a whole stack of magnetic media can be rendered useless, without the drive being at fault.

Victory

So I got most of my files back. Turns out I had duplicated many of the files over multiple disks, so there was some sorting to be done. Now they’re backed up in the cloud. I’ll probably never use most of these files again (Marathon game saves, for example.) But there was novelty in seeing some things I had not thought about in a long time, like a web site I made in 1998, and collection of illustrations for print ads.

I’m happy to have accomplished this, and am now comfortable sending the zip disks to the recycling center. The drive will go to a friend who who has a similar project to do. And I’ll have one less box of baggage to keep track of.