Jonkman Microblogs Jonkman Microblogs
  • Login
» The Federation is upon us — ¶
⁂Lather ⁙Rinse ♻Repeat…
  • Public

    • Public
    • Groups
    • Recent tags
    • Popular
    • Directory

Conversation

Notices

  1. Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

    Tonight: Learn #Shell scripting pitfalls /w Tim Laurence & #JOSM editing of #OpenStreetMap /w @Andrew_S_Cant https://kwlug.org/node/1098

    Monday, 11-Sep-17 15:53:12 EDT from web
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Arrived at !KWLUG. Tim Laurence and @Andrew_S_Cant are arguing about who should present first.

      Monday, 11-Sep-17 19:03:21 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Announcements: Upcoming meetings https://kwlug.org/ Astronomy, clusters, Kubernetes, &c.

      Monday, 11-Sep-17 19:09:12 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Call For Presentations is closing 1 November for @KWLinuxfest

      Monday, 11-Sep-17 19:10:53 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Call For Presentations for @StarConUW is closing this Friday, 15 September 2017. Lightning talks, 1st time presenters encouraged

      Monday, 11-Sep-17 19:12:39 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence: "Wow, the #shell does a lot!"

      Monday, 11-Sep-17 19:13:06 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence explains how #shell parsing works: how to break up the commands into 'words'

      Monday, 11-Sep-17 19:14:03 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      In #shell parsing, @variables are substituted, and wildcards* are expanded

      Monday, 11-Sep-17 19:16:18 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      (of course, in the #shell a variable is expressed with a dollar sign, eg. $variable

      Monday, 11-Sep-17 19:16:53 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Now that we know how the #shell breaks down the command, we can find out how it can go wrong

      Monday, 11-Sep-17 19:22:13 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence uses some simple example scripts. Nothing's gone wrong yet.

      Monday, 11-Sep-17 19:23:24 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence in the wings; @Andrew_S_Cant makes announcements http://sn.jonkman.ca/attachment/68182

      Monday, 11-Sep-17 19:25:15 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence now explains inheritance and exporting variables, and return values

      Monday, 11-Sep-17 19:29:41 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence: Parameter expansion, eg. ${A:?message} (is it a "variable" or a "parameter"?)

      Monday, 11-Sep-17 19:32:01 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Q: What #shell does this work in? csh? ksh? sh? A: The examples are all built in the #bash world

      Monday, 11-Sep-17 19:37:19 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence shows that `A='a b c'; echo $A` will print `a b c`, collapsing whitespace. Use doublequotes or set $IFS to '\n\t'

      Monday, 11-Sep-17 19:42:48 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      #FacePalm. Typing the example here has also collapsed the whitespace. Well, this is a presentation on pitfalls and problems

      Monday, 11-Sep-17 19:44:04 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Next examples: Filenames with leading spaces, leading dashes, wildcard characters, embedded spaces

      Monday, 11-Sep-17 19:47:21 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      And now, "How To Fail A Test": A=0; but [ $A > 1 ] will be true. Why? It's a string comparator.

      Monday, 11-Sep-17 19:51:18 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Instead of [ $A > 1 ] use a numeric comparator: [ $A -gt 1 ]

      Monday, 11-Sep-17 19:52:26 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Rule of thumb: If comparing strings, use the comparator that looks like a number; if comparing numbers use the comparator made of chars

      Monday, 11-Sep-17 19:54:25 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Variables with spaces in the content will also have problems, eg. B='1 2'; [ $B == '1 2' ] is an error

      Monday, 11-Sep-17 20:00:26 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      And now, the misery of redirecting output to an input file, eg. cat /tmp/text | grep something > /tmp/text

      Monday, 11-Sep-17 20:02:57 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      And finally, redirecting STDERR to STDOUT, eg. `ls /missing 2>&1 > /tmp/output` vs `ls /missing > /tmp/output 2>&1`

      Monday, 11-Sep-17 20:07:52 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Also: use `set -ue` to abort script execution at any error, instead of executing the next command.

      Monday, 11-Sep-17 20:14:20 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      And `set -x` to show expansions as they occur, useful for debugging

      Monday, 11-Sep-17 20:15:53 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      There's a lint tool called "shellcheck" to find syntax errors and ambiguities

      Monday, 11-Sep-17 20:18:07 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence asks: "Raise your hand if you've written cron jobs. Leave them raised if they worked first try." Nooooobody!

      Monday, 11-Sep-17 20:19:52 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence uses `exec` to standardize environment for cron, other people's computers

      Monday, 11-Sep-17 20:23:21 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence says to copy the cron $PATH variable in your cron scripts, fixes many problems. Also, cron uses sh so test with sh, not bash

      Monday, 11-Sep-17 20:28:02 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence uses `trap` to provide error handling in scripts

      Monday, 11-Sep-17 20:30:58 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Q: Does `trap` require `set -e` to abort mid-script? A: Don't know, will test that later.

      Monday, 11-Sep-17 20:32:20 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Q: Have you used other shells? A: zsh had lots of eyecandy, zonch and economica are "pythonic". #bash is not the beall & endall

      Monday, 11-Sep-17 20:36:46 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Tim Laurence has nice things to say about PowerShell.

      Monday, 11-Sep-17 20:37:05 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      s/zonch/conch/ in http://sn.jonkman.ca/notice/1573846

      Monday, 11-Sep-17 20:37:56 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      20 min remaining, 5 min break... @Andrew_S_Cant may have to reprise another night if time runs out.

      Monday, 11-Sep-17 20:43:59 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      There's an #OpenStreetMap on the screen, @Andrew_S_Cant explains #StatsCan licensed #Canvec data

      Monday, 11-Sep-17 20:50:30 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      With #Canvec data adding streets is not so important, but adding points of interest and mailboxes

      Monday, 11-Sep-17 20:51:24 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      #JOSM gives a pretty good list of things to add, using the interface called #Potlatch

      Monday, 11-Sep-17 20:52:03 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Sorry, #Potlatch is the editor built into #OpenStreetMap

      Monday, 11-Sep-17 20:53:30 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      To limit the amount of data to download, @Andrew_S_Cant pick only a small section of downtown #Kitchener

      Monday, 11-Sep-17 20:54:20 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Going to a blank space on the map where @Andrew_S_Cant believes there are buildings to be added

      Monday, 11-Sep-17 20:55:13 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Use the existing aerial imagery built into #JOSM, eg. Bing; @Andrew_S_Cant say's they're properly licensed

      Monday, 11-Sep-17 20:56:33 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Using the Bing imagery as an overly, @Andrew_S_Cant can see where to create new building objects

      Monday, 11-Sep-17 20:57:25 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      The other reason for using #JOSM is to use plugins, making things like adding buildings much easier, @Andrew_S_Cant uses "building_tools"

      Monday, 11-Sep-17 20:58:34 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Using the #JOSM plugin "building_tools", @Andrew_S_Cant creates a new square where he sees a building.

      Monday, 11-Sep-17 20:59:40 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Now @Andrew_S_Cant adds tags to indicate what kind of building it is. Use the #OSM wiki to find out what keywords exist

      Monday, 11-Sep-17 21:00:23 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      https://wiki.openstreetmap.org/wiki/Key:building tells you what kind of things you can add to buildings

      Monday, 11-Sep-17 21:01:05 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group OpenStreetMap

      And now @Andrew_S_Cant can start adding street numbers for these buildings; !OSM will interpolate the numbers

      Monday, 11-Sep-17 21:02:55 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group OpenStreetMap

      With !OSM you can go into a crazy amount of detail, like num. of floors, bridges between buildings

      Monday, 11-Sep-17 21:03:58 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      But @Andrew_S_Cant says that's not necessary, just adding buildings is very useful

      Monday, 11-Sep-17 21:04:23 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group OpenStreetMap

      Q: How do you make sure it's correct? A: Many eyes make bugs shallow; the !OSM community will verify and revert if needed

      Monday, 11-Sep-17 21:05:40 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Q: Do you add building street address numbers even when interpolation lines exist? A: Not necessary, but when do you remove the interpolation line?

      Monday, 11-Sep-17 21:09:12 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      Audience reply: Keep the interpolation line always, because it gives a view of street numbers when zoomed out

      Monday, 11-Sep-17 21:09:45 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group OpenStreetMap

      Let @Andrew_S_Cant know if you know of other !OSM projects like mapping little libraries or gender-neutral washrooms, &c

      Monday, 11-Sep-17 21:10:36 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group

      That's it! Off to @Abe_Erb for a beverage!

      Monday, 11-Sep-17 21:11:20 EDT
    • Kitchener Waterloo Linux User Group Kitchener Waterloo Linux User Group podcasting , Kitchener Waterloo Linux User Group

      Audio: https://kwlug.org/node/1110 Video: https://www.youtube.com/watch?v=Jd_bcZRiMTU and https://www.youtube.com/watch?v=NTjjXpADpyI !KWLUG !Podcasting

      Thursday, 14-Sep-17 04:02:00 EDT

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

Jonkman Microblogs is a microblogging service brought to you by SOBAC Microcomputer Services. It runs the StatusNet microblogging software, version 1.1.0-release, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All Jonkman Microblogs content and data are available under the Creative Commons Attribution 3.0 license.