Toilet paper isn’t scarce. The raw material for toilet paper literally grows on trees. To MAKE it scarce takes layers of stupidity, each with its own nuances.
Archives
All posts by Justin A. Parr
Not sure who all needs this, but here it is:
In the event that you run out of toilet paper…
Go to your local hardware store, and buy one of these:
This is a 1 gallon “garden lawn sprayer” that you can buy online for about $12, or it should be in your local big-box hardware store for about $16.
Note the angled wand…
After you buy a new one (DO NOT use the one from your garage), wash it out thoroughly.
When you go to the bathroom:
- Fill with warm water from the sink
- Close the lid, air-tight
- Pressurize by pumping the handle a few times
- Instant, portable bidet
This is cheaper than modifying your plumbing, and warmer than buying a bidet kit that connects to your toilet’s water supply.
Reduce PDF Size of a Scanned Document
I recently had to e-mail a multi-page document – e-mail is that awesome 1990’s technology for submitting documents when the recipient doesn’t have a secure file transfer server – only to find that the attachment size was too large.
I scanned in three separate multi-page documents and then used pdfSAM to combine them all in to a single, 9-page PDF document.
Are you with me so far?
The final file size was over 80 meg!
I didn’t think anything of it, until my e-mail server complained about the attachment size.
After a little bit of thinking…
- I had used xsane, a GUI front-end for SANE.
- Where Windows has TWAIN, Linux has SANE.
Connecting a scanner to a PC pre-TWAIN used to be a kludge, and TWAIN was the answer: a manufacturer-independent hardware interface and driver standard that provides a scanner user interface, and also allows third-party programs to access any TWAIN-compliant scanner via a standard Application Programming Interface (API).
SANE works like TWAIN, but separated in to two pieces: front-end and back-end. The back-end drivers allow the OS to talk to the scanner hardware, and provides generic access to other applications (like the TWAIN API). This allows any of several SANE front-end user interfaces to access any SANE back-end, even across a network. Very cool stuff, and there is even a SANE shim for Windows that provides TWAIN services, while using SANE on the back-end. - As my print server is a Raspberry Pi (Linux) and my main PC is Linux, it made the most sense to set the Pi up as a SANE back-end server.
- I scanned all three multi-page documents using xsane, as mentioned, which allows you to scan a multi-page document and then save it as a single file.
- While poking around a bit, I noticed that the intermediate format for xsane’s multipage applet is TIFF.
- Like most other computing standards from the 1980’s, TIFF just isn’t very good, especially compared to modern file formats that use much better compression algorithms.
Unfortunately, TIFF was developed as a standard file format for scanners, which means that any time you’re dealing with scanners (or, oh lord, fax machines), be prepared to deal with TIFF, despite the fact that it’s a completely obsolete standard. I mean, while we’re at it, let’s just fire up the 1200 baud modem and a copy of Telix, and we can XMODEM some TIFF files, shall we??
So it became clear that xsane / sane was just saving a bunch of TIFF files, and then copying them straight in to the PDF.
It turns out that Linux has a built-in command to split a PDF apart:
pdftoppm file.pdf imagefilename -png
This will create an image file for each page of the PDF, stored in PNG format. For example, if file.pdf is 5 pages, you will get:
imagefile-1.png imagefile-2.png ... imagefile-5.png
These can then be recombined using ImageMagick’s convert:
convert imagefile-*.png newfile.pdf
As predicted, the resulting file was around 20 meg – 25% of the original file size.
Internally, PDF probably stores the images as TIFF, but in either case, the round trip through the PNG format is what affected the compression.
PNG performs “filtering” or normalization of the image before it’s compressed, and thus, the resulting image is “more compressible”, and the artifact of this process is that going back to TIFF (or any other format) makes the older compression algorithms perform more efficiently with the normalized image data, resulting in a much smaller file size.
Moral of the story:
If you have a huge PDF (or any kind of source image), try converting to PNG and then back again, which might make the original compression more efficient.
Other options:
- Subsample the document down to a lower resolution. I scanned at 300 DPI, but my next option if that didn’t work was going to be to subsample the document down to 150 DPI, which would result in a 4x file size reduction.
- Go from color to grayscale or black-and-white. Going grayscale from color usually results in about a 4x reduction in file size, and black and white from color might result in readability issues, but can save 16x or greater from the file size.
Frankenbolt (verb):
To assemble two or more completely dissimilar and poorly integrated components in to one unit, as in the patchwork manner of Frankenstein’s Monster.
Examples
- “Reporting was an afterthought. The developers obviously licensed a third-party component and simply Frankenbolted it in place at the last minute.”
- “Every application should stick to its core mission. Without a core mission, scope creep always results in an application with modules Frankenbolted all over it, like some bizarre freak-show attraction.”
Anyone familiar with IT infrastructure operations will know the mantra of “the 3 things you must monitor for every server“. However, database engines use memory a little bit differently than other applications, and therefore what looks “bad” at first glance is simply functioning as designed.
That One Time I Expensed a Gun Case
Setting the Scene…
Back in the early-2000’s, WiFi was far from ubiquitous.
- Most laptops and other mobile devices didn’t even support WiFi unless you added a PC Card.
- WiFi really sucked back then. Typical distances were maybe 50 feet through walls, or even up to 100 feet with a clear line of sight. If the signal was blocked by anything brick or metal, simply forget it.
- Back then, an access point and a “router” (firewall) were two different devices, making WiFi a little bit more difficult to configure, and much harder to secure.
At the time, the company I worked for sold software and consulting services for financial institutions, and it was normal for our company to have a booth at one of several technical or trade shows throughout the year.
One of the guys who worked some of those trade shows came to us and said “Normally, we get a single ethernet connection for internet access, and if we bring a router [firewall], we can at least share a single connection, but all these cables make it prohibitive to do anything productive. Can you guys think of a way that we could plug something in that would allow us to all use WiFi instead?”
One of my guys came up with the idea to get a router, an access point, some cables, a power strip, and some WiFi PC Cards, put all of it in a box, and pre-configure everything so that all you needed was power and ethernet.
We even had an extra-long uplink cable so that the box could be located almost anywhere, allowing you to be able to optimize the position of the AP to get the greatest coverage.
The only thing left was to figure out how to ship this thing across the country, repeatedly, without having to package it each time.
At the time, you could get a padded, hard-sided camera case for about $200, which was not going to fly, since IT was paying for it, and we had virtually no budget.
So we went to Wal-Mart to see if we could improvise.
After looking through almost the entire store with no luck, we happened to be in the sporting goods section, and what do you know? There’s a hard-sided, padded pistol case, with briefcase-style combination locks for about $20.
And that’s how I came to expense a gun case.
Of course, the poor fellow in Accounting who processed my expense report saw the receipt, which clearly stated “gun case” and was rather alarmed.
After a quick explanation, we showed him a picture of the case with the equipment inside, and everything was fine.
He did say that this was one of the most unusual expense reports he’s ever processed, but not THE most unusual, and you really have to wonder about that.
Because it looked like something that might contain nuclear launch codes, we called it the “Wireless Football“.
After a few faithful years of service, all the cables and PC Cards were looted by another department. By that time, it was kind of unnecessary, because most venues were starting to offer free WiFi and most devices had built-in WiFi cards.
We ended up re-purposing the router and AP to build a home VPN lab. The case sat around for quite some time, and I think we even used it a couple of times to ship equipment. Eventually it disappeared – either “appropriated” by another department, or thrown away during one of the many equipment purges.
[Edit 2/15/2020]
Thanks to Aaron for the pictures!
“CSI” Show Lacks Evidence about how Bombs Work
As I’ve previously written about Bomb Myths in movies, I felt that this example needed to be called out as particularly egregious…
The television show “CSI: Crime Scene Investigation“, also known as “CSI: Las Vegas” featured a team of forensic technicians who used science to uncover evidence in order to solve criminal cases.
In season 9, Lawrence Fishburne joined the cast, playing the character Dr. Raymond Langston.
S09:E11, “The Grave Shift”, depicts “Ray” Langston having a challenging first day on the job as a CSI Level I.
On his second crime scene, the victim is found after an explosion, burned but also embedded with glass shards that also have a yellow substance, later determined to be corn meal.
The gas explosion must have been an accident – but… what about the glass and the corn meal?
In a brief montage, we see Dr. Ray looking through a library of books, which includes a couple of books that appear to be army field manuals, including one on improvised munitions.
Inside, he finds this:
In the montage, we see Dr. Ray building the device.
Afterward, he and Hodgins (lab tech) set up a test, where they feed natural gas…
…in to a bag containing the apparatus, and use a generator to power the electrical connection.
In a CGI sequence, we see the cornmeal inside the jar absorb water and begin to expand…
Eventually, the metal disc inside rises up to meet the two wires, which completes a circuit…
And… BOOM!
The jar explodes, throwing corn meal and glass shrapnel everywhere, followed by a huge fireball:
We see Greg, Hodgins, and Dr. Ray watching the aftermath of the “natural gas” explosion.
Amazing! Dr. Ray solved the mystery, and at the same time, proved that the natural gas explosion was actually a murder!
Except…
There are a few problems.
Problems
- Jars filled with corn meal and water don’t explode. Even if some of the natural gas seeped in through the holes in the lid, the jar wouldn’t burst from the inside because corn meal isn’t explosive, especially when mixed with water.
- Not enough oxygen. The stoichiometric air-to-fuel ratio for natural gas is nearly 10 to 1, meaning, you need 10 parts of air (at 20% oxygen) to 1 part of natural gas by volume in order to have complete combustion – that’s about 18% oxygen by volume to about 9% natural gas (2:1).
As the ratio of air to fuel decreases, the amount of oxygen decreases, resulting in incomplete combustion, and three things happen: Less heat, smaller explosion, more residue.
We see natural gas being pumped in to the bag containing the apparatus, but no air, so if the bag only contains natural gas, it wouldn’t even burn, much less explode. - Not enough fuel. A small bag full of natural gas (assuming the ideal 10 to 1 air-to-fuel ratio), when ignited, will go “bang” and produce a small fireball. It will not produce the huge fireball and burning debris field that you see depicted.
Oh, and…
4. It wouldn’t work.
The Disc Would Not be On Top
As we see Dr. Ray construct the device, he drops the metal disc in to the jar filled with water and corn meal.
In theory, the disc resides at the top of the cornmeal sludge, and as the cornmeal absorbs water, the disc rises with it, eventually contacting the wires, triggering the device.
However, in reality, as the disc sinks, it creates a cloud of cornmeal particles, which now reside above the metal disc.
As the temporarily-suspended cornmeal particles settle, they will settle on top of the disc, forming a layer of cornmeal… on TOP of the disc. As the disc rises, so does the upper cornmeal layer, and the wires would be insulated from the disc.
Even in the video, as Dr. Ray drops the disc in to the jar, we see the water form a cloudy suspension.
The reason this happens, is that the opening in a mason jar is narrower than its sides, and therefore, any disc you cut to fit inside the mason jar must be narrower than the opening, and much narrower than the sides. As the disc sinks, turbulent water pulls corn meal particles past the disc.
If you used a soup can with straight sides instead of a mason jar…
And, maybe you should insert the disc before adding water…
Nothing About this Would Explode
As mentioned, unless the laws of physics have changed, mixing cornmeal with water yields not an explosive. It would be great for making corn tortillas or cornbread, but it won’t explode.
Maybe the gas inside the jar is explosive? Nope.
- There is very little gas inside the jar – much less than would be required to burst open the mason jar.
- When the lid was placed on the jar, there was no natural gas (or other combustible gas) inside the jar – there is only regular air inside the jar. Even if some natural gas seeps in through the holes in the lid, around the electrical wires, it would not be a suitable ratio of air-to-fuel in order to burn, much less explode.
- Again, due to the relative seal between the wires and the holes in the lid, IF there was a spark inside the jar at the moment of contact, it would not have any way to ignite the gas outside the jar.
Spark (Arc) Not Guaranteed
In the scene from the show, we see a spark followed by a big explosion, but there is no way to guaranty that the wires will arc. They might arc, but they might not arc. No arc = no explosion.
The wires are almost guaranteed NOT to touch the disc at exactly the same time. The first wire that comes in contact with the disc will energize the disc (negative or positive doesn’t matter).
The second wire that approaches the disc will eventually come close enough to either arc, or complete the circuit without arcing.
- If the second wire arcs, some of the metal will evaporate. This will repeat until either the metal is burned through, or comes in to complete contact with the other wire (might arc, might not arc).
- If the second wire does NOT arc, the circuit will be complete, but there is no spark.
Requires a Detonator
After some digging, I found the actual document referenced in the CSI episode:
Was this actually published by the “Department of the Army Headquarters”?
Unlikely.
In 1969, soldiers were running around the jungles of Vietnam. I have no idea where you’re going to find a mason jar in the jungles of Vietnam.
However, this document contains the following:
Hmmm… this looks awfully familiar…
However, the diagram in the book is completely different from the apparatus depicted in the CSI episode:
Here, you can clearly see some discrepancies:
- The “seed timer” is a trigger (initiator), not a detonator.
- This rig requires a separate detonator – in case you missed my Bomb Myths article, a bomb requires a small explosive charge called a detonator. In the diagram above, the detonator is a blasting cap. In the CSI episode, there is no detonator nor igniter.
- Assuming that the generator takes the place of a battery, there is no direct connection between the power source and the jar (initiator) and the explosive (natural gas). When the trigger closes the circuit, it doesn’t do anything.
- Seeds are much larger (and therefore more practical) than cornmeal particles.
- The field manual version uses screws instead of bare wire – this helps ensure that the disc touches both terminals at nearly the same time, and ensures that the wires won’t just simply slip out. However, this practically makes the jar air-tight, further ensuring that a spark inside the jar would be completely insulated and incapable of igniting gas outside the jar.
More Practical Timers
If you’re going to blow someone up and make it look like an accident, there are more practical ways that would leave less forensic evidence.
Also, you would have to know in advance the coefficient of expansion of the seeds or cornmeal or whatever substance will be expanding in water, or else you won’t know how much time you have.
Candle Timer
Simple.
Put a scented candle at the far end of the room before you release the natural gas. You have about 15 minutes to leave the scene, and the best part is that the gas will almost always ignite at the proper stoichiometric ratio.
The remains of the candle will be found, of course, but burning a scented candle would seem like an unfortunate accident.
Water Timer
A see-saw is used as the trigger. On the “trigger” end, a weight is affixed. On the other end, a cup or can full of water is affixed. A small hole in the receptacle allows a few drops of water to escape. Over time, the water drains out, and the weight triggers the see-saw, triggering the bomb.
The nice thing about this timer is that if you use a plastic cup, it melts, and the water either evaporates or gets lost in the firefighting efforts, leaving very little evidence.
Egg Timer
…and a couple of wires. Electric, mechanical, or hourglass.
Sandbag Timer
Similar to a water timer, you put dirt or sand in a cloth bag, tied to a rope and pulley. On the other end is a weight. Poke a hole in the bag, and when enough sand falls out of the bag, the weight will drop, triggering the bomb.
Cigarette Timer
A cigarette or small candle is basically a slow-burning fuse.
There are many ways to use this as a time-delay device.
For example, if you light a cigarette and wrap it in foil, then poke a hole in the foil, it will pull air in through the hole.
It will detonate when the stoichiometric ratio inside the foil is suitable for ignition.
Ignition Sources
For any electrically-triggered explosion, as we’ve seen, the trigger itself can’t be guaranteed to make a spark, which means that you still need a separate ignition source.
- Lamp + Broken bulb. Today, light bulbs are florescent or LED and won’t generate a spark. However, there are still many incandescent bulbs floating around out there, especially in older homes. In an incandescent bulb, electricity heats a metallic filament inside the vacuum of a glass bulb.
If you unplug the lamp, then break the glass of the lightbulb, leaving the filament in tact, you have a great electrical ignition source. Set up your timer / trigger using the lamp cord, set it across the room, and plug it in. When the timer completes the circuit, the bare filament will glow red hot, instantly igniting the gas. - Bare wire. Unplug and cut the cord off of a lamp, then strip back about 3 inches of the insulation from both wires, leaving the frayed ends overlapping slightly. Build the timer / trigger, and plug the lamp cord in. When the trigger completes the circuit, the frayed ends will touch each other, generating a large electrical arc as the small metal fibers vaporize.
- Match head igniter. Like the bare wire igniter, interlace the frayed metal strands around the match heads inside a matchbook. When the frayed ends arc, they will also ignite the matches, producing a more sustained flame.
A simple, compact electrical igniter can be made using a single metal strand from a lamp cord, wrapped around a single match head. This type of igniter can also be set off using a car battery – any electrical source capable of heating or melting the wire will ignite the match head.
Conclusion
If the writers had consulted an expert, the show would have been much more believable:
- A practical timer actuates the trigger.
- An initiator (trigger) causes the igniter to fire.
- The igniter causes the natural gas to explode rather than burn, ideally at an air-to-fuel volumetric ratio of 10 to 1.
In 1984, the battle for the future was fought in the present. Which of course is now in the past. In the movie, “The Terminator”, we saw the T-800 model 101 take round after round, and survive fire, crashes, and explosions as it carried out its mission to kill Sarah Connor.
In “Terminator 2: Judgement Day”, Sarah tells John that “these things are really hard to kill”, having narrowly been able to kill one at the end of “The Terminator”.
So that begs the question: If a Terminator (T-800) came after you… right now… in the NOW present… how would you kill it first?
We see competition shows all the time, such as “Top Chef”, “Next Iron Chef”, “Chopped”, all of the baking competition shows, and even shows such as “Forged in Fire” and “Next Mythbuster”, where the loser of each round gets eliminated.
The goal of the show is to find “the best” out of a group of competitors, but this is not the likely outcome.
Let’s look at why, and how to fix it.
Or, why floating point operations are slow, and how to avoid them.