dannyman.toldme.com

This page features every post I write, and is dedicated to Andrew Ho.

January 16, 2017
Technical

A Complex Cron Entry Explained

Link: https://dannyman.toldme.com/2017/01/16/crontab-backtick-returncode-conditional-command/

A crontab entry I felt worth explanation, as it illustrates a few Unix concepts:

$ crontab -l
# m h dom mon dow command
*/5 8-18 * * mon-fri grep -q open /proc/acpi/button/lid/LID0/state && mkdir -p /home/djh/Dropbox/webcam/`date +%Y%m%d` && fswebcam -q -d /dev/video0 -r 1920x1080 /home/djh/Dropbox/webcam/%Y%m%d/%H%M.jpg ; file /home/djh/Dropbox/webcam/`date +%Y%m%d/%H%M`.jpg | grep -q 1920x1080 || fswebcam -q -d /dev/video1 -r 1920x1080 /home/djh/Dropbox/webcam/%Y%m%d/%H%M.jpg

That is a huge gob of text. Let me un-pack that into parts:

*/5 8-18 * * mon-fri

Run weekdays, 8AM to 6PM, every five minutes.

grep -q open /proc/acpi/button/lid/LID0/state &&
mkdir -p /home/djh/Dropbox/webcam/`date +%Y%m%d` &&
fswebcam -q -d /dev/video0 -r 1920x1080 /home/djh/Dropbox/webcam/%Y%m%d/%H%M.jpg

Check if the lid on the computer is open by looking for the word “open” in /proc/acpi/button/lid/LID0/state AND
(… if the lid is open) make a directory with today’s date AND
(… if the directory was made) take a timestamped snapshot from the web cam and put it in that folder.

Breaking it down a bit more:

grep -q means grep “quietly” … we don’t need to print that the lid is open, we care about the return code. Here is an illustration:

$ while true; do grep open /proc/acpi/button/lid/LID0/state ; echo $? ; sleep 1; done
state: open
0
state: open
0
# Lid gets shut
1
1
# Lid gets opened
state: open
0
state: open
0

The $? is the “return code” from the grep command. In shell, zero means true and non-zero means false, that allows us to conveniently construct conditional commands. Like so:

$ while true; do grep -q open /proc/acpi/button/lid/LID0/state && echo "open lid: take a picture" || echo "shut lid: take no picture" ; sleep 1; done
open lid: take a picture
open lid: take a picture
shut lid: take no picture
shut lid: take no picture
open lid: take a picture
open lid: take a picture

There is some juju in making the directory:

mkdir -p /home/djh/Dropbox/webcam/`date +%Y%m%d`

First is the -p flag. That would make every part of the path, if needed (Dropbox .. webcam ..) but it also makes mkdir chill if the directory already exist:

$ mkdir /tmp ; echo $?
mkdir: cannot create directory ‘/tmp’: File exists
1
$ mkdir -p /tmp ; echo $?
0

Then there is the backtick substitition. The date command can format output (read man date and man strftime …) You can use the backtick substitution to stuff the output of one command into the input of another command.

$ date +%A
Monday
$ echo "Today is `date +%A`"
Today is Monday

Once again, from the top:

grep -q open /proc/acpi/button/lid/LID0/state &&
mkdir -p /home/djh/Dropbox/webcam/`date +%Y%m%d` &&
fswebcam -q -d /dev/video0 -r 1920x1080 /home/djh/Dropbox/webcam/%Y%m%d/%H%M.jpg ;
file /home/djh/Dropbox/webcam/`date +%Y%m%d/%H%M`.jpg | grep -q 1920x1080 ||
fswebcam -q -d /dev/video1 -r 1920x1080 /home/djh/Dropbox/webcam/%Y%m%d/%H%M.jpg

Here is where it gets involved. There are two cameras on this mobile workstation. One is the internal camera, which can do 720 pixels, and there is an external camera, which can do 1080. I want to use the external camera, but there is no consistency for the device name. (The external device is video0 if it is present at boot, else it is video1.)

Originally, I wanted to do like so:

fswebcam -q -d /dev/video0 -r 1920x1080 || fswebcam -q -d /dev/video1 -r 1920x1080

Unfortunately, fswebcam is a real trooper: if it can not take a picture at 1920×1080, it will take what picture it can and output that. This is why the whole cron entry reads as:

Check if the lid on the computer is open AND
(… if the lid is open) make a directory with today’s date AND
(… if the directory was made) take a timestamped snapshot from web cam 0
Check if the timestamped snapshot is 1920×1080 ELSE
(… if the snapshot is not 1920×1080) take a timestamped snapshot from web cam 1

Sample output from webcam. Happy MLK Day.

Why am I taking these snapshots? I do not really know what I might do with them until I have them. Modern algorithms could analyze “time spent at workstation” and give feedback on posture, maybe identify “mood” and correlate that over time … we’ll see.

OR not.

Feedback Welcome

December 29, 2016
Technical, Technology

It Wasn’t That Bad

Link: https://dannyman.toldme.com/2016/12/29/it-wasnt-that-bad/

Friend: Dang it Apple my iPhone upgrade bricked the phone and I had to reinstall from scratch. This is a _really_ bad user experience.

Me: If you can re-install the software, the phone isn’t actually “bricked” …

Friend: I had to do a factory restore through iTunes.

Me: That’s not bricked that’s just extremely awful software.

(Someone else mentions Windows.)

Me: Never had this problem with an Android device. ;)

Friend: With Android phones you are constantly waiting on the carriers or handset makers for updates.

Me: That is why I buy my phones from Google.

Friend: Pixel looks enticing, I still like iPhone better. I am a firm believer that people stick with what they know, and you are unlikely to sway them if it works for them.

Me: Yeah just because you have to reinstall your whole phone from scratch doesn’t make it a bad experience.

Feedback Welcome

December 1, 2016
News and Reaction, Politics

US May Soon Allow High Speed Trains

Link: https://dannyman.toldme.com/2016/12/01/us-may-soon-allow-high-speed-trains/

Good news via Streetsblog: the United States FRA are nearly done revising safety regulations which would allow for operation of high-speed trains in the United States!

A fleet of TGV waiting to serve passengers in Marseille in 2002. These French trains have a top speed of 200 MPH.

A fleet of TGV waiting to serve passengers in Marseilles, France in 2002. These trains have a top speed of 200 MPH. Proposed US safety rules would permit lighter, faster trains that meet European safety standards to run at speeds of up to 220 MPH.

Current US regulations, from the 1800s and the 1930s, mandate heavier trains to survive crashes. Unfortunately, heavy trains cost more to build, operate, and maintain. Heavier trains are also harder to stop in an emergency.

European train safety regulations are comparable to modern cars: lighter trains are cheaper to build and operate, and they stop faster. They feature “crumple zones” to absorb damage in an accident.

Since the United States is a small market for passenger trains, divergent safety standards make it even more expensive to buy trains. Instead of purchasing inexpensive, reliable, “off-the-shelf” European-designed train sets, vendors need to make alternate, heavier, slower, more expensive designs for American railroads. The adoption of European safety standards will make it cheaper and easier for American railroads to provide modern, comfortable, faster passenger service.

In anticipation of these new rules, Amtrak in September announced the purchase of 28 Avelia Liberty trains from the French company Alstom. The trains will be manufactured in upstate New York and will be used for Acela service starting is 2021. These trains can be upgraded to run at 220 MPH, but this will only be allowed after right-of-way upgrades on the Northeast Corridor.

These rules coming at the end of the Obama administration, with promises of infrastructure spending under the Trump administration, could help American rail transport see more rapid improvements in short order.

Feedback Welcome

November 24, 2016
News and Reaction, Technology

Tool for Generating Isochrones: Mapzen Mobility Explorer

Link: https://dannyman.toldme.com/2016/11/24/tool-for-generating-isochrones-mapzen-mobility-explorer/

Via Steve Vance, Mapzen has a new tool, Mobility Explorer, which can generate isochrones for walking, biking, driving, and transit. I have previously used tools provided by Walk Score, but Mapzen seems more accurate, and the transit shed can be calculated based on a time-of-day.

Here is how far you can get on public transit from Sunnyvale at noon on a Wednesday in 15, 30, 45 and 60 minutes.

Here is how far you can get on public transit from Sunnyvale at noon on a Wednesday in 15, 30, 45 and 60 minutes.

The colors on the web site color scheme are not that great. On Steve’s blog you can see he’s generated his own map via an API call.

Feedback Welcome

November 20, 2016
About Me, Sunnyvale, Testimonials

Valley of Broad Shoulders

Link: https://dannyman.toldme.com/2016/11/20/valley-of-broad-shoulders/

I was in Chicago this week. There was a death in the family, so it was good to be among my kinfolk with our adorable, loving child.

Chicago is famously corrupt and moribund and the State of Illinois is mired in perpetual scandal. It is a magnet for immigrants but it is also a city from which many of us Californians are originally from. I’ve gotten used to the California way and I generally prefer it but what I noticed this week in Chicago was all the construction.

For a city that is corrupt and moribund, there was an awful lot of demolition and rebuilding going on. On the way to the L in the evening we stopped and stared over a fence as a variety of heavy machines worked under brilliant stadium lights. The star of the show was a yellow machine with a huge claw on the end of a boom arm reaching several stories up, to the top of a building, it was tearing down from the top, girder by girder, as another machine sprayed down the dust with a water hose. The claw was at the very end of its reach, it felt the machine was on tippy toes, as it tugged away, girder after girder, waiting for torrents of debris to fall, pulling the pieces out and dropping them into piles to be dragged into more discrete piles by lesser enormous machines. It was like watching dinosaurs go about their business. Father, Son, and Grandmother: none of us could take our eyes off the marvel. “They should sell beer and peanuts,” said I.

The neighbors of this derelict house in Sunnyvale are terrified at the prospect of it being replaced with housing for families.

The neighbors of this derelict house in Sunnyvale are terrified at the prospect of it being replaced with housing for families.

We don’t get this in Suburban California. What little “history” we have is viciously guarded and any attempt to replace the old with newer and better is often met with resistance and exaggerated speculation as to the intentions and end results of new development. You don’t see that so much in the old country–In Chicago, and in any place with some history under its belt, everyone knows that they are surrounded by at least a century of continuity–Everyone is merely links in a great chain. The city is inherited and bequeathed and the hope is to leave it in a little better shape: Urbs in Horto.

In Dublin, I saw them building a light rail line, right down an ancient street. It made the Northern Californian in me jealous.

In Dublin, I saw them building a light rail line, right down an ancient street. It made the Northern Californian in me jealous.

They say that University Politics is the most vicious because the stakes are so low. I get a sense of that observing some of the political rhetoric in Sunnyvale. Out here the city is so new and raw that the idea of changing it implies that those who built the city and have lived in it until now are being completely rejected by the hordes of newcomers flooding the city from the Midwest and the Far East. But in the ancient lands where the immigrants come from, there is no such sentiment: the cities are naturally timeworn, and the idea of redevelopment is an intuitive component of the cycle of death and rebirth.

Fierce as a dog with tongue lapping for action, cunning as a savage pitted against the wilderness,
Bareheaded,
Shoveling,
Wrecking,
Planning,
Building, breaking, rebuilding,
Under the smoke, dust all over his mouth, laughing with white teeth,
Under the terrible burden of destiny laughing as a young man laughs,
Laughing even as an ignorant fighter laughs who has never lost a battle

The land in which I live would be enriched if it embraced a bit of the poetry of the land in which I was born.

Feedback Welcome

November 13, 2016
About Me, Letters to The Man, News and Reaction, Politics

America 1956

Link: https://dannyman.toldme.com/2016/11/13/america-1956/

https://youtu.be/cJq2DUyzSdg

Feedback Welcome

November 13, 2016
About Me, Letters to The Man, News and Reaction, Politics

America 2016

Link: https://dannyman.toldme.com/2016/11/13/america/

Feedback Welcome

November 9, 2016
About Me, News and Reaction, Politics

Head Full of Doubts

Link: https://dannyman.toldme.com/2016/11/09/head-full-of-doubts/

There’s a darkness upon me that’s flooded in light
In the fine print they tell me what’s wrong and what’s right
And it comes in black and it comes in white
And I’m frightened by those that don’t see it

When nothing is owed or deserved or expected
And your life doesn’t change by the man that’s elected
If you’re loved by someone, you’re never rejected
Decide what to be and go be it

–Avett Brothers

Feedback Welcome

November 8, 2016
News and Reaction, Sunnyvale

Planning Mistake: Dividing Lawrence Station Neighborhood with an Onramp

Link: https://dannyman.toldme.com/2016/11/08/planning-mistake-dividing-lawrence-station-neighborhood-with-an-onramp/

I am proud to have grown up in Chicago. It is a great city. But us Chicago fans have to admit to its numerous mistakes and sins. One of those sins was repeated over and over again in the mid-twentieth century, when neighborhood after neighborhood was torn apart to make way for highways. Working class neighborhoods, homes to people of color and immigrants … the fabric of community life was torn away. Neighborhoods were divided and conquered and made into ghettos.

One would hope for Silicon Valley in the twenty-first century not to repeat the mistakes of twentieth-century Chicago.

On Wednesday, the Santa Clara Planning Commission will review the Environmental Impact Report for the Lawrence Station Area Plan. The Lawrence Station Area Plan is an ambitious project to redevelop a low-rise industrial area into a modern urban neighborhood, providing 3,500 housing units, office space, and parks, directly adjacent to commuter rail services.

The Lawrence Station Area as it exists today: mainly ugly, low-rise Industrial.

The Lawrence Station Area as it exists today: mainly low-rise industrial.

Plans for 3,500 residential units, 104,000 square feet of office, and six acres of parks.

Plans for 3,500 residential units, 104,000 square feet of office, and six acres of parks.

Among the current recommendations is to cut off the Northwest block of housing from the rest of the neighborhood because it serves as a connector ramp between Lawrence and Central Expressways. Instead of crosswalks for people to walk across their community, pedestrians will need to walk up and over a ramp so as not to slow down the cars … on a two-lane road.

It is hard to find pictures of pedestrian bridges spanning two-lane roads, but picture something like this, but everyone gets to walk up and down long long long wheelchair ramps to cross the street.

It is hard to find pictures of pedestrian bridges spanning two-lane roads. Picture something like this, with elevators on each side.

This is another case where we err on the side of inconveniencing people and dividing neighborhoods for the sake of keeping cars moving along as fast as possible. A crosswalk would allow people to cross the street in their new neighborhood and be better connected to their neighbors, at the cost of possibly adding an occasional minute or two to someone’s commute. Does that sound so unreasonable?

Perhaps instead of right-left-right through a neighborhood, we could drive a gentle arc around the neighborhood?

Perhaps instead of right-left-right through a neighborhood, we could drive a gentle arc around the neighborhood. The path is still there.

We might explore some alternatives. One thing I notice is that the right-of-way still exists to restore the old on-ramp from Lawrence Northbound to Central Eastbound. Instead of making a right-left-right through a residential neighborhood, drivers just coast on up a gentle right-hand curve and merge on to Central. From there, the existing two-way on-ramp might be adapted to a two-lane one-way street. The two-lane street allows more cars to queue at a crosswalk while pedestrians cross, reducing potential congestion.

Alternatively, traffic off of Central Eastbound could simply take alternate routes from Oakmead/Corwin.

The Santa Clara Planning Commission is in a place to recommend smarter planning that better addresses the concerns of pedestrians, neighborhood vitality, and motorists. The Commission will review the Specific Plan this Wednesday at 7:00pm. I hope to drop by and share my concerns. You should show up too, if you are interested. You can also write a letter to the Planning Commission: PlanningCommission@santaclaraca.gov and CC planner John Davidson: JDavidson@santaclaraca.gov.

Many thanks to Green Caltrain for the tip.

Feedback Welcome

November 6, 2016
Politics

Evaluating California Ballot Propositions

Link: https://dannyman.toldme.com/2016/11/06/evaluating-california-ballot-propositions/

A few rules of thumb I use in evaluating California ballot propositions:

1) Is it a REVENUE BOND? — Likely YES
2) Is it a CONSTITUTIONAL AMENDMENT? — Default NO
3) Endorsed by Jerry Brown? — Likely YES
4) Argument in favor/opposition use LOTS OF CAPITALIZED WORDS AND PHRASES — Those arguments are nutters
5) Wait, why shouldn’t the legislature, &c. be figuring this out?! — Likely NO

This time around I figure condoms, ammunition, and plastic bags are issues Cal/OSHA and the legislature need to figure out.

Feedback Welcome

October 21, 2016
News and Reaction, Sunnyvale

Notes: Bishop School Construction Update

Link: https://dannyman.toldme.com/2016/10/21/notes-bishop-school-construction-update/

Earlier this month I attended a meeting at Bishop School in which Rob Smiley, COO of Sunnyvale School District, brought us up to speed on the current construction plans. I took noted and shared on Nextdoor.com, and I’m sharing them here for better community access.

Construction Update

Maps viewable in school office, and online at: http://www.sesd.org/Page/3722

… re-bidding is not yet complete …

Renderings of new campus and a site plan.

Renderings of new campus and a site plan.

October — Temp Classrooms to be installed on blacktop (note: these were installed last week)
December — Fencing / Construction begins (North Side)
August 2017 — move into new rooms
August 2018 — project complete

Roughly:
North Side construction thru Aug 2017
South Side construction thru Aug 2018

Construction Expectations:
– Reduced on-street parking (25 parking spaces removed)
– Increased traffic
– Reduced play area
– “Hard Hat Cafe” (during kitchen construction, from June 2017)
– Noise (no loud construction during testing)
– Demolition (.. asbestos .. “abatement” ..)

Q: When does Maude Ave bike lane (remove parking) happen?
A: Do not know

Feedback Welcome

October 20, 2016
News and Reaction, Politics, Sunnyvale

Housing in the Silicon Valley: Sunnyvale Planning Commission and 838 Azure

Link: https://dannyman.toldme.com/2016/10/20/housing-in-the-silicon-valley-sunnyvale-planning-commission-and-838-azure/

On October 10, 2016, file 16-0548 was heard by the Sunnyvale Planning Commission. The item was to down-zone a condominium development per the General Plan, and to up-zone a one third acre parcel from Residential Low Density to Residential Low-Medium Density. By up-zoning the site at 838 Azure St, the property owner would be able to build four homes on the property instead of a maximum of two.

The Planning Commission passed the down-zoning proposal but denied the up-zoning at 838 Azure St. I do not believe the decision with regard to 838 Azure was consistent with the public interest of Sunnyvale residents. At a time of housing crisis, we should err on the side of providing more affordable homes for more families, and the location at 838 Azure is well suited to providing housing with minimal impact on congestion.

Current Status and Options

The property presently hosts two dilapidated structures which had recently housed squatters. There are dying trees and contaminated soil from Sunnyvale’s orchard days.

Proposed zoning for 838 Azure St

Proposed zoning for 838 Azure St

Present zoning is R0: 7 homes per acre, or 2 per 1/3 acre
Two lots of 7,200 square feet, homes up to 3,240 square feet

Requested zoning is R2: 12 homes per acre, or 4 per 1/3 acre
Four lots of 3,600 square feet, homes up to 1,620 square feet

Affordability

Status Quo Change Zoning
House Type Single Family Townhome
House Size 3200 sq ft / 5 bed / 3.5 bath 1600 sq ft / 3 bed / 2.5 bath
Home Price $2,400,000 $1,000,000
Monthly Cost $12,000 $5,000
Household Income $436,000 $182,000
Families Housed 2 4

The lot in question is about 14,400 square feet, and present zoning allows for up to two houses. At 45% FAR one can build two homes of 3,200 square feet. Comparable homes in the area are typically 5 bedroom, 3.5 baths at $2,400,000. With a 20% down payment of $480,000, a 30 year fixed mortgage at 3.875% with taxes and insurance runs nearly $12,000/mo.

On the other hand, a 1,600 square foot townhouse or condo in this area is typically 3 bedroom, 2.5 bath at $1,000,000. With a 20% down payment, a 30 year fixed mortgage, taxes, insurance runs nearly $5,000/mo.

If we assume that housing is “affordable” at 33% of Gross Income, then the big houses are affordable to a family with $436,000 annual income, and the smaller homes are affordable at $182,000.

See Also: Redfin
See Also: Residential Zoning Standards – City of Sunnyvale

Location: Pedestrian and Transit Quality vs Congestion

Much of Sunnyvale is poorly suited to walking or public transportation. Housing in such areas encourages automobile trips and results in congestion. If you want to increase housing while avoiding congestion, you want to place the housing in areas where walking and public transit are viable options: when people have the option not to drive they are less likely to add congestion.

The average Walk Score in Sunnyvale is 55. For 838 Azure the walk score is 78. The site is well within Sunnyvale’s walkable downtown core, a very close walk to multiple groceries, restaurants, and Murphy St. This pedestrian accessibility does not encourage automobile trips, thus it mitigates congestion.

Sunnyvale's walkable core: 838 Azure is at the Y of Mathilda and Sunnyvale in the lower right.

To avoid congestion, put housing in Sunnyvale’s walkable core: 838 Azure is at the Y of Mathilda and Sunnyvale in the lower right. Source: Sunnyvale Walk Score

The site is very near VTA’s premier bus route: the 22/522 El Camino Real, as well as the 55 and 54 routes for North-South mobility. Within an hour, public transit can get residents across Sunnyvale, including the offices on the North Side, as well as much of Cupertino and Santa Clara. The downtown areas of San Jose, Mountain View, and Palo Alto are accessible. At just over a mile to Sunnyvale Station, the site is not a convenient walk to Caltrain: residents may prefer to bicycle.

Via Walk Score: where you can get from 838 Azure via public transit

Via Walk Score: where you can get from 838 Azure via public transit.

Public Comment and Planning Board

Two neighbors spoke against the zoning change. A neighbor who lived in an adjacent townhouse was concerned that the development of townhouses on the neighboring property would not meet his aesthetic standards. A neighbor to the south was concerned that his dogs might get out if the property was developed, and that if the driveway were moved from Sunnyvale-Saratoga to Azure then there would be less street parking available on Azure.

Per the minutes:

Commissioner Melton noted that the benefits of the GPA and Rezone of the Azure site are the PD designation and an increase in housing density, and that the negatives include parking, neighborhood incompatibility and inappropriate density.

Commissioner Simons said he does not like the potential spot zoning of 838 Azure.

MOTION: Commissioner Melton moved and Commissioner Simons seconded the motion to recommend that City Council deny the General Plan Amendment and Rezone for 838 Azure Street.

Vice Chair Rheaume said he is not supporting this motion and supports increasing the density of this lot.

The motion carried by the following vote:

Yes: 4 – Commissioner Melton
Commissioner Olevson
Commissioner Simons
Commissioner Weiss

No: 1 – Vice Chair Rheaume

Absent: 1 – Chair Harrison

Next Steps

This item should come before the City Council on November 1. Anyone who might wish to speak up on behalf of the virtue of increased housing in Sunnyvale can contact the City Council or make a public comment of up to three minutes at the upcoming council meeting. I am hoping to attend and speak November 1. If you think you might also be interested, or would like to be notified of any updates, please drop me a line: dannyman@toldme.com.

Postscript

This item was considered by the Sunnyvale City Council on November 1, 2016. City Council heard testimony from City Staff and the Property Owner. City Council candidate John Cordes and I made public comments in favor of the change. A few neighbors made public comments against the change.

The City Council enacted an ordinance to change the zoning at 838 Azure from R0 to R2-PD. The vote was 6-1, with Council Member Pat Meyering in dissent. Council made it clear that they were only approving the zoning change, in order to provide more housing in an area well-suited to pedestrian, bicycle and public transit. Council was generally most concerned with how the development would transition from the adjacent R2 zones to the rest of the neighborhood, which is among the several considerations which will be addressed subsequently in the planning process.

The Property Owner is now at liberty to submit plans for development, which will be subject to review by the Zoning Administrator, with community feedback, and potentially by the Planning Commission and the City Council.

Feedback Welcome

« Newer Stuff . . . Older Stuff »
Site Archive