Why does CTRL+S freeze your PuTTY screen?

Why does CTRL+S freeze your PuTTY screen?

tl;dr – If you hit CTRL+S in PuTTY, your screen will freeze. Anything you type will still be sent to the server. Press CTRL+Q to unfreeze your screen.

Imagine you are an old laser printer. You have something like 128 KB of memory. You print a max of 8 pages per minute. Someone decides to print the man page for gcc.

You are doing the best you can, cranking out pages and pages of obscure options and arguments. Your 128 KB of memory is quickly filling up. What do you do? You use flow control to send an XOFF to the computer. This message tells the computer that, for whatever reason, you need it to stop sending data. You print a few pages, you free up some memory, so you send XON to the computer. This message tells the computer that you are ready for it to start sending data again. This cycle repeats itself until you’ve received the full document from the computer.

These XOFF and XON controls are built-in to PuTTY, too. And they can be super useful. Imagine you are tailing a log file, and you catch a glimpse of an error message. Hit CTRL+S to send XOFF and the screen will freeze for you. When you are done, hit CTRL+Q to send XON and the screen will unfreeze. Yay!

It is important to keep in mind that XOFF only stops transmissions coming FROM the server. If you hit CTRL+S and start bashing the keyboard, all those keystrokes are going to make it to the server.

Another caveat is that you’ll lose any screen updates between hitting CTRL+S and CTRL+Q. This isn’t a DVR. You can’t go forward and backward. Hitting CTRL+Q goes back to “live TV” so to speak.

If you don’t care for this feature, you can easily disable it. Simply add the following to ~/.bashrc:

stty ixany
stty ixoff -ixon

The first line will let any character restart output, just in case the server receives an XOFF somehow. The second line enables the sending of start and stop characters, but disables XON/XOFF flow control. Realistically stty -ixon should be good enough, but the other bits provide some extra safety against unexpected screen freezes.

Read More

Office upgrades

Office upgrades

My wife always struggles to know what to get me for my birthday. Well this year she finally figured it out: let me buy office upgrades! A new desk, monitor, graphics card, headphones, and wifi adapter.

Old desk:

old-office

New desk:

new-desk

My parents bought me my old desk for my birthday 13 years ago. It has served me well, but was getting a bit cramped. My new desk is an UPLIFT Plus standing desk. Each leg has a motor that makes it easy to go from a sitting desk to a standing desk and back again. I’m hoping to improve my posture by spending more time standing rather than sitting. The desk is huge: 80″ x 30″. I’ve been using it for a few days and love it.

My monitors are a little newer than my old desk (only 4.5 years old) and still look fine, but I’m not going to complain about a new 27″ IPS monitor with QHD resolution. I decided to keep both of my old monitors, so now I have a 27″ IPS flanked by 22″ LEDs. I’ve always wanted a tri-monitor setup!

I’ve been using onboard video for a few years. It has been fine for my needs but was limited to 2 monitors. This means…. new graphics card! YAY! I went with the Gigabyte GTX 750 Ti. It is nice and quiet, supports up to 4 monitors, and performs infinitely better than my onboard video. I’m not a gamer so this card should be more than adequate for my needs.

As a bonus, I got a set of Sennheiser RS 170 wireless headphones a few weeks ago. When the kids start getting too noisy while I’m working (or I’m getting too noisy while they are trying to sleep) then I slap on my headphones and everyone is happy. I opted for wireless so I can easily move around without yanking out a wire. They are a bit heavier than I’d like, but comfortable enough for a few hours of listening at a time.

The one downside to the wireless headphones is that they interfered with my 2.4 GHz wifi adapter. To fix this, I was going to run network cable. Unfortunately, our walls have firebreaks and I’m not prepared to go through them (either by putting extra holes in the wall which would be difficult to patch thanks to our textured walls, or by getting a fish bit which can be a bit difficult to use) so I just got a new dual band wifi adapter. It works great.

I’ve got a big blank wall that I’m planning on putting a whiteboard on. I’m going to try following the Google Ventures design sprint methodology, but not sure how well it will work with just me and my wife. Worth a try anyways.

Read More

Getting browserconfig.xml out of your error logs

Getting browserconfig.xml out of your error logs

I’ve noticed a spike in 404s on several of my sites for browserconfig.xml. Turns out Windows 8.1 looks for this file automatically when a site is pinned to the start screen.

This file allows you to define several things, including graphics to use for various size tiles and also an RSS URL so you can update your readers when you have new content. Pretty neat. I doubt other browsers or OSs will pick up on it, but if you are noticing 404s for it in your logs, it may be worth the effort to throw a browserconfig.xml file together.

Microsoft conveniently provides a tool for doing this. It allows you to do the basics and will even resize your images for you. They also provide in-depth documentation on the file format in case you want to get more advanced.

I’m in the process of rolling this out to my sites, so no idea yet on whether the notifications will actually drive traffic, but it is so easy to set up that it is worth the initial effort.

Read More

A better CSS reset stylesheet

A better CSS reset stylesheet

If you aren’t a web developer then you may not know this, but browsers are a mess. Every browser picks and chooses how it wants to render the same HTML. For examples, some browsers don’t have any default margin on the body. Some do, but with varying amounts of margin. Internet Explorer is of course the worst offender, and there are many versions of Internet Explorer still widely used.

To get around these issues, web developers typically use what is commonly called a reset stylesheet. This CSS file resets all of the default styles for all the possible HTML elements, so that you have a blank slate to start with. They’re a bit of a pain to use because they require the web developer to then define what they want the styles to be for everything. For example, they typically wipe out padding and margins on all elements, so you have to set padding and margins on all elements if you don’t want them squished together.

Fortunately some smart people created something even better than a reset stylesheet: normalize.css. Instead of resetting all the default styles, normalize.css selectively sets reasonable styles only for the elements that need it. It keeps all the default styles that are already in use by the majority of browsers. You can get it for free here.

Read More

Flashlights for a 72 hour kit

Flashlights for a 72 hour kit

Flashlights are a basic item in any 72 hour kit. In an emergency you are going to need light: to set up a tent, to walk a trail, to find your stuff in a shelter, to read a map at night, etc etc. After doing a fair amount of research, I feel a kit needs three flashlights: a lightweight handheld battery powered flashlight, a battery powered headlight, and a crank or magnetic induction flashlight.

Lightweight handheld battery powered flashlight

I made the decision to power all my electronics with Energizer Ultra Lithium AA batteries. Using AA batteries really narrows which flashlights you can get. Big flashlights with D batteries are way too big and heavy for an emergency kit. Small flashlights with AAA batteries would require carrying AAA batteries and AA batteries. My solution was to buy whatever cheap flashlight I could find at Walmart that took AA batteries. For me it was a Black & Decker Cliplight. It is about 6 inches long, takes two AA batteries, and is reasonably bright at night. I plan on keeping two Ultra Lithium batteries in it, and packing two spare batteries in my bag.

Battery powered headlight

A headlight makes it easy to see while setting up a tent in the dark. It can also be handy if you are carrying a toddler while walking on a dark path. My choice of AA batteries again limited my options here. I ended up getting the Rayovac SE1WHLT-B Sportsman Xtreme on Amazon. It takes a single AA battery and claims to provide 45 lumens. It also has red LEDs so you can get a little light without ruining your night vision, and a low-power blue LED that allegedly makes it easy to see blood in the dark (designed for hunters), but I’ll probably just use it to save battery power.

The downside to this headlight is that it won’t last long on a single battery. With the main light, it will probably only last around 3 hours. Because of this I’ll be packing two spare batteries.

headlight

Crank or magnetic induction flashlight

It is vital to have light even if the batteries die and you run out of spares. This means you need something you can power on your own. The typical options for this are hand crank lights or magnetic induction lights (the kind you shake). I personally hate the shake lights, and my radio of choice comes with a crank and a flashlight, so I think I’m set.

Disposable flashlights

If I end up with a little extra room in my pack then I’ll probably pack several flashlights that I consider disposable. These are cheap (or more often free) LED flashlights from Harbor Freight. I consider them disposable because they tend to take button cells (like the common CR2032) and I’m committed to carrying only a single type of battery. The flashlights themselves are so inexpensive that it wouldn’t bother me to lose one (or two or three), trade them away, or to just toss them when the batteries die. If I end up putting these in my packs then I’ll probably use them up before draining the batteries on my primary lights.

Read More