## Review: Bodum Insulated Plastic Travel French Press Coffee and Tea Mug

July 29, 2014 Incoherent ramblings , , ,

This product is basically complete crap.  It appears to be made of non-heat resistant plastic, and will crack.

In the picture above, the cup is empty, but because of the cracks, coffee cream and sugar has crept into the interior, and is now a very suspicious looking soup of some sort of possibly virulent bacterial soup that can probably leak back out into my coffee if I was to continue using it.

I have had two of these Bodum traveller coffee presses.  The first I bought and it cracked first along the seam above the threads, so that the inside separated from the outside.  I crazy glued it back together, but it then proceeded to get spiderweb like cracks along the base, like so:

The second such mug I had was bought for me, since my other one had died.  I’d not have bought a replacement myself, and would recommend to anybody else to stay away from this product entirely.  This second cup never separated at the top, but also cracked along the base and up the sides like the original.

Note that Hudson’s Bay, where both of these products were purchased, no longer carries Bodum products.  Perhaps that was due to poor reviews?

## Some Unix command line one liners

Here’s a couple one-liner shell commands collected over the last couple months when it occurred to me to record them.  Each of these I thought were somewhat notable at the time I did so.

## Nested “backquotes”

I often have to run commands where it is convenient to have the parameters of the commands in a file.  A simple example is to edit all the files in a list of files, say:

vim cat c
# or:
vim $(cat c)  A useful variation of this is to do the same using the output of a command that also takes its input from a file. Here’s one to edit all the “ancestor” files in the version control system, assuming a command vcsancestor that produces such filenames vim vcsancestor$(cat c)
# or
vim $(vcsancestor$(cat c))


Observe how two different methods of embedding shell commands can be combined into one command. In the past I often used for loops for something like this, say:

for i in cat c ; do vcsancestor $i ; done > f vim cat f  (because backquotes can’t be nested). It only recently occurred to me that this isn’t a limitation if$() style subshells are used.

## Batching commands with xargs

When working in a version control system, it’s often useful to do a batch checkout of all the files that have compilation errors.  Suppose that you made changes that produced the following compilation error output:

## Unix to Windows path separator switching

Suppose we have some unix filenames

</pre>
$head -5 f /vbs/bin/AEDefines.pm /vbs/bin/AEMacro.pm /vbs/bin/bld_shared_lib_Darwin /vbs/bin/chglibpaths /vbs/bin/chglibpaths_Darwin  and want the Windows paths for the same </pre>$ head -5 f | tr / '\\'
bin\AEDefines.pm
bin\AEMacro.pm
bin\bld_shared_lib_Darwin
bin\chglibpaths
bin\chglibpaths_Darwin
<pre>

The tr command above looks a bit like ascii barf, and will translate forward slashes to backward slashes (perhaps for input that’s a list of files).

I didn’t understand the requirement to both single quote the backslash as well as escaping it, but Darin explained it for me:

Quotes allow the backslashes to go through the shell to tr.  And tr has its own backslash escape mechanism (so you can do things like transform \n into \r or something – where you’d then specify ‘\n’ or just \\n and ‘\r’ or \\r).

## Vim: replace search results with contents from a file

Probably related to merging conflicting changes, I wanted to completely replace the implementation of a particular function:

void foo() {
...
}


This was an easy way one liner method to do that replacement, deleting the implementation of foo, and replacing it with the one that was found in the file ‘foo’

:,/^}/ !cat foo


## file:line: delimited output for a single file

The grep -n command is very handy for producing file:line:content delimited output.  In particular, you can iterate over such output with vim -q.  When you want to do this for a single file, grep -n doesn’t include the filename, defeating a subsequent vim -q (since vim then doesn’t know what file to open).  Here’s an example

$cat my_file_to_search blah patternOfInterest hi foo goo patternOfInterest bye blah patternOfInterest hi blah patternOfInterest hi foo goo patternOfInterest bye foo goo patternOfInterest bye$ grep -n patternOfInterest my_file_to_search | tee v
1:blah patternOfInterest hi
3:patternOfInterest bye
4:blah patternOfInterest hi
5:blah patternOfInterest hi
7:patternOfInterest bye
9:patternOfInterest bye



To get vim -q’able output, just include a second non-existent dummy file in the search

grep -n patternOfInterest my_file_to_search a_file_that_doesnt_exist | tee v
vim -q v


I usually use a very-short filename for the “does not exist file”, say, .u (which presumes I also don’t create little hidden files .u in my day-to-day work).

## Some initial thoughts on a read of William Blum’s “Rogue State”

I have started reading the disgusting book “Rogue State, A Guide to the World’s Only Superpower” by William Blum.  It is disgusting not because it is poorly written, but because of the US government, CIA, and military atrocities it details.

It is also a discouraging book, and hard to stomach, and downright depressing.  It is, however, encyclopedic, thorough, and contains extensive references.  If you ever wanted a detailed list of US atrocities to counter arguments that governments, military, and intelligence agencies serve us positively, this book has everything on the shopping list.

There is a huge disparity between popular and media perception of the USA and what is presented in this book.  This disparity brings to mind the paradigm shift discussion of Kuhn’s “Structure of scientific revolutions”.  The perception of the USA (or its NATO and economic puppets like Canada) as freedom loving “democracy” is so indoctrinated into us that to accept the reality that exactly the opposite is true requires a complete paradigm shift.  It is too painful to realize that we have to totally discard our current world view, and be willing to accept the pain and discomfort associated with the mental revolution required to see the actual state of the world.  Kuhn also points out that such a revolution isn’t going to happen until people have a ready made alternative to the current paradigm.  The history of warfare and evil in our world is so pervasive, that I don’t think we have a ready made model of peaceful interaction available for this switch, and are therefore willing to overlook the errors of the current model.  I think that this book details enough of those errors that it puts the current world view on shaky ground.
I find this author to be is an extremely effective communicator.  A sample of his style can be found in this 2002 speech.

The speech above also contains a quote from the intro in “Rogue State” that I found particularly striking:

“If I were the president, I could stop terrorist attacks against the United States in a few days. Permanently. I would first apologize — very publicly and very sincerely — to all the widows and orphans, the tortured and impoverished, and all the many millions of other victims of American imperialism. Then I would announce that America’s global interventions have come to an end and inform Israel that it is no longer the 51st state of the union but -– oddly enough -– a foreign country. I would then reduce the military budget by at least 90% and use the savings to pay reparations to our victims and repair the damage from our bombings. There would be enough money. Do you know what one year’s military budget is equal to? One year. It’s equal to more than $20,000 per hour for every hour since Jesus Christ was born. That’s what I’d do on my first three days in the White House. On the fourth day, I’d be assassinated.” ## Markham bylaws for private property maintainance. July 16, 2014 Incoherent ramblings , , , Markham can fairly oppressive in its bylaw enforcement. For example, you aren’t allowed to park in front of your house overnight in the Cornell area, where there are cut-in parking spots off the main part of the roadway. Such a tragic violation of city rules gets you$50 ticket.  There are also maintenance  enforcement officers that will measure the length of your grass and probably ticket you if it is too long.

Because of this enforcement, I was somewhat wary of the idea of creating a front yard vegetable garden.  I know that some cities have cracked down on such a vile practice, so it did not seem implausible that Markham would follow such a police state model of oppressive regulations.

I wrote the following to a Markham representative  to find out what the rules were:

“The sidewalks in my area of Cornell run really close to the house, so that most of the front yard lies in the boulevard area (by which I mean the space between the sidewalk and the road and/or the parking indent).

Most people appear to have left this space with some combinations of weeds and/or grass, sometimes ringing trees or building raised garden boxes.

I see that we have by-law requirements for keeping our property tidy, but don’t know what rules there are for the boulevard area.  Is this considered my space or is it the city’s space, and are there any limits for allowable landscaping and gardening in these spaces? “

I was careful not to give away my intent.  Note that my front yard is one of those with a ‘combination of weeds and grass’.  If I was to pull the weeds, something I tried vainly a couple times, there would be not much left.  I’d love to make that silly grassy weedy space (i.e. the boulevard) into a vegetable garden.

For reference to anybody else who may want to do this, here is the answer I received from the Markham representative:

“Thank you for contacting the City of Markham.

Please follow this link to our Keep Markham Beautiful (Maintenance) By-lawTo regulate and prescribe standards for the maintenance of private property and municipal boulevards within the City of Markham.

Have a look at the by-law and if you have any questions outstanding, please let us know and we will have someone from our By-law staff contact you with more information.

If you find that there are residents in your neighbourhood that are not following the by-law, please let us know and we can start an investigation and educate them on proper maintenance.”

This city representative probably thought that I wanted to rat out some poor neighbour (and included additional information detailing for me how I could go about doing that).  I assume that “educate them” actually means fine them and/or require proof of corrective action.

However, note that the attached document does not appear to prohibit a front yard vegetable garden, even in the boulevard area.  That is at least my interpretation.  I am moving and won’t end up enacting my original idea.  However, I thought that it was worthwhile to share the city response and the bylaw document in case others are thinking of doing something like this (especially in the Cornell area, where back yard space is tiny and all too easy to consume with a very small scale herb and vegetable garden).

## Sum of digits of small powers of nine.

In a previous post I wondered how to prove that for integer $$d \in [1,N]$$

\label{eqn:numberGame:20}
((N-1) d) \text{mod} N + ((N-1) d) \text{div} N = N-1.

Here’s a proof in two steps. First for $$N = 10$$, and then by search and replace for arbitrary $$N$$.

## $$N = 10$$

Let

\label{eqn:numberGame:40}
x = 9 d = 10 a + b,

where $$1 \le a, b < 9$$, and let $$\label{eqn:numberGame:180} y = a + b,$$ the sum of the digits in a base $$10$$ numeral system. We wish to solve the following integer system of equations \label{eqn:numberGame:60} \begin{aligned} 9 d &= 10 a + b \\ y &= a + b \\ \end{aligned}. Scaling and subtracting we have $$\label{eqn:numberGame:80} 10 y - 9 d = 9 b,$$ or $$\label{eqn:numberGame:100} y = \frac{9}{10} \lr{ b + d }.$$ Because $$y$$ is an integer, we have to conclude that $$b + d$$ is a power of $$10$$, and $$b + d \ge 10$$. Because we have a constraint on the maximum value of this sum $$\label{eqn:numberGame:120} b + d \le 2 ( 9 ),$$ we can only conclude that $$\label{eqn:numberGame:140} b + d = 10.$$ or $$\label{eqn:numberGame:160} \boxed{ b = 10 - d. }$$ Back substitution into \ref{eqn:numberGame:40} we have \label{eqn:numberGame:200} \begin{aligned} 10 a &= 9 d - b \\ &= 9 d - 10 + d \\ &= 10 d - 10 \\ &= 10 \lr{ d - 1 }, \end{aligned} or $$\label{eqn:numberGame:220} \boxed{ a = d - 1. }$$ Summing \ref{eqn:numberGame:220} and \ref{eqn:numberGame:160}, the sum of digits is $$\label{eqn:numberGame:240} a + b = d - 1 + 10 - d = 9.$$

## For arbitrary $$N$$

There was really nothing special about $$9, 10$$ in the above proof, so generalizing requires nothing more than some search and replace. I used the following vim commands for this “proof generalization”

:,/For arb/-1 y
:+/For arb/+1
:p
:,$s/\<9\>/(N-1)/cg :,$ s/\<10\>/N/cg
:,\$ s/numberGame:/&2:/g


Let

\label{eqn:numberGame:2:40}
x = (N-1) d = N a + b,

where $$1 \le a, b < N-1$$, and let $$\label{eqn:numberGame:2:180} y = a + b,$$ the sum of the digits in a base $$N$$ numeral system. We wish to solve the following integer system of equations \label{eqn:numberGame:2:60} \begin{aligned} (N-1) d &= N a + b \\ y &= a + b \\ \end{aligned}. Scaling and subtracting we have $$\label{eqn:numberGame:2:80} N y - (N-1) d = (N-1) b,$$ or $$\label{eqn:numberGame:2:100} y = \frac{N-1}{N} \lr{ b + d }.$$ Because $$y$$ is an integer, we have to conclude that $$b + d$$ is a power of $$N$$, and $$b + d \ge N$$. Because we have a constraint on the maximum value of this sum $$\label{eqn:numberGame:2:120} b + d \le 2 ( N-1 ),$$ we can only conclude that $$\label{eqn:numberGame:2:140} b + d = N.$$ or $$\label{eqn:numberGame:2:160} \boxed{ b = N - d. }$$ Back substitution into \ref{eqn:numberGame:2:40} we have \label{eqn:numberGame:2:200} \begin{aligned} N a &= (N-1) d - b \\ &= (N-1) d - N + d \\ &= N d - N \\ &= N \lr{ d - 1 }, \end{aligned} or $$\label{eqn:numberGame:2:220} \boxed{ a = d - 1. }$$ Summing \ref{eqn:numberGame:2:220} and \ref{eqn:numberGame:2:160}, the sum of digits is $$\label{eqn:numberGame:2:260} a + b = d - 1 + N - d = N-1.$$ This completes the proof of \ref{eqn:numberGame:20}.