Batch editing files with ed - <AUTHOR> https://jvns.ca/blog/2018/05/11/batch-editing-files-with-ed/ <comment><USER17> Awk really is the tool of choice for this sort of thing:

      $ awk '{print}/baz/ {sub("baz", "elephant"); print}' jvns.txt
      foo:
        - <USER11>
        - <USER12>
        - <USER16>
        - <USER14>

Since the script is single quoted you can also lay it out legibly:

      $awk '
      {print}
      /baz/ {
          sub ("baz", "elephant")
          print
      }
      '

which is nice for more complex "one liners". Awk is also standard on all posix environments and in the mawk flavor is extremely fast (relevant if you are processing huge files).

There is superb book, _The AWK Programming Language_ , which teaches a lot about programming in addition to the awk language. Good discussion and link to pdf here: [0]

[0] [https://news.ycombinator.com/item?id=13451454](https://news.ycombinator.com/item?id=13451454)

<comment><USER18> The AWK Programming Language is the best programming book ever because it lets you learn the language through interesting problems (like writing a very small assembler).

<comment><USER19> It's available online. Thanks for the tip.

[https://ia802309.us.archive.org/25/items/pdfy- MgN0H1joIoDVoI...](https://ia802309.us.archive.org/25/items/pdfy- MgN0H1joIoDVoIC7/The_AWK_Programming_Language.pdf)

<comment><USER20> Come on, don't promote piracy of the book! It's worth buying! Mods, please take down this link.

<comment><USER20> Hmm, someone downvoted me. Can the downvoter explain what was wrong in what I said?

<comment><USER19> I believe the book's been out of print for sometime. I've no idea if that's why you were downvoted. I wouldn't post a link to a pirated anything. That pdf is linked from a ton of sites and the site I found it on seemed like a reputable site, though I don't remember which it was at the moment.

<comment><USER20> > I believe the book's been out of print for sometime.

Hmm, I did not know that (I have a print copy of that book).

> I wouldn't post a link to a pirated anything.

OK. But just in case, someone still wants a physical book, they can get it used from Amazon (can talk about Amazon in US) for ~$3.

</comment></comment></comment></comment></comment></comment></comment><comment><USER21> Pretty much this whole thread is people coming up with better ways of solving the problem. I love Hacker News! :) But I think the point of the blog (for me) is showing what 'ed' is and where can you use it for (the problem at hand is secondary). And it did exactly that for me, I knew about 'ed' but never really understood what made it special or where/how you could use it. Thanks Julia for enlightening me!

<comment><USER22> > I knew about 'ed' but never really understood what made it special or > where/how you could use it.

ed script is one of the formats supported by diff and patch (with their -e or --ed command line switch). (diff generates the script by itself, but patch just pipes it to ed.)

ed scripts are used at Apple to maintain their patches for Python: see e.g. [https://opensource.apple.com/source/python/python-97.50.7/2....](https://opensource.apple.com/source/python/python-97.50.7/2.7/fix/posixmodule.c.ed.auto.html) and others in [https://opensource.apple.com/source/python/python-97.50.7/2....](https://opensource.apple.com/source/python/python-97.50.7/2.7/fix/)

<comment><USER23> fun side note: `patch` runs ed and ed allows you to run arbitary commands resulting in a security issue:

[https://rachelbythebay.com/w/2018/04/05/bangpatch/](https://rachelbythebay.com/w/2018/04/05/bangpatch/)

This was used for the [https://holeybeep.ninja/](https://holeybeep.ninja/) April fool joke release.

</comment></comment></comment><comment><USER22> This problem is easily solved with a regexp that processes the input as a whole, rather than working on it line by line. I had this need often enough that I exported Go regexp engine as a command line tool regrep, which can insert "elephant" after "baz" with:

      go get github.com/orivej/unix/regrep
      regrep s '(\n( *-) baz\n)' $'$1$2 elephant\n' < input.yaml

It only processes standard input, and can not by itself replace the contents of an input file with its output; but another tool, inplace, helps:

      go get github.com/orivej/unix/inplace
      find . -name '*.yaml' -exec inplace {} regrep s '(\n( *-) baz\n)' $'$1$2 elephant\n' \;

<comment><USER24> It's close to the idea of structural regular expressions [0]. I'm still waiting for the awk from the paper.

[0] [http://doc.cat-v.org/bell_labs/structural_regexps/](http://doc.cat-v.org/bell_labs/structural_regexps/)

</comment></comment><comment><USER25> In practice I often use Vim instead.

        :args file1.txt file2.txt file3.txt
        :set autowrite
        :argdo norm /- baz/<CR>yypwCelephants

The commands set the argument list to a list of three files (by default, it is set to the filenames you passed to vim on the command-line). Then, autowrite is enabled which automatically saves each buffer after editing it. Finally, argdo runs a command on each argument file.

<comment><USER26> Thanks for that tip. I've used ex for similar things when editing hundreds of files.

This example searches each HTML file in a directory for a line with a string and then deletes a number of lines:

        $ echo "g/search string/ .,+20 d\nx" >> exscript
        $ for f in *.html
          do
              ex - $f < exscript
          done

<comment><USER27> Why write the 'ex' commands to a file? Why not just do the echo inline, like this

       for f in *.html; do
           echo -e "g/search string/ .,+20 d\nx" | ex - "$f"
        done

?

(I also added quotes to the $f dereference in case of file names containing white space, and the -e flag to echo to expand \n to newline. In case of a Bourne shell without support for -e in echo, I would probably use "{ echo "g/..."; echo "x"; } | ex - ..." instead of using \n.)

Also, in a production script I would probably have used "find . -maxdepth 1 -name "*.html" -print0 | xargs --null --no-run-if-empty | while read f; do ...; done" instead of a 'for' loop from a pathname expansion, in order to guard against there being _no_ html files, in which case a 'for' loop from a pathname expansion otherwise would be passing the literal string "*.html" as the file name argument to 'ex'.

<comment><USER26> Thanks for the tips. I put them in a file, because I saw someone using ed last year in a script and started looking at ex from there.

        diff -e file1 file2 > ed_script

Using echo (along with your other suggestions) is probably better for that example.

<comment><USER27> Note: I forgot the "--max-args=1" option to xargs.

</comment></comment></comment></comment></comment><comment><USER28> I've recently used EDLIN from an 80s version of MS-DOS.

After spending 5 minutes with the manual, I realized it was the best line editor I've ever used.

ed is very similar, but it doesn't come with a nice manual. The info page is chaotic and doesn't start from the beginning. You can cover typical usage in 5 lines, but no, you have to read through 25 pages of stuff just to figure out a sensible command. I just use vim or nano.

<comment><USER29> My understanding is that man/info is meant more as a reference and less like a first time users guide.

<comment><USER30> Good man pages can be great first time user guides.

</comment></comment></comment><comment><USER31> I'm much more familiar with sed than ed, so here's how I would to this:

      sed '/baz/{s/.*/&\n&/;s/baz/elephant/2}' input.txt

or, slightly more readable

      sed '/baz/ {
               s/.*/&\n&/
               s/baz/elephant/2
           }' input.txt

The first substitution appends a copy of the line to the pattern space, the second substitution replaces the second occurrence of "baz" with "elephant".

This being said, I went ahead and bought the book mentioned in the article [0] - a neat little read.

[0]: [https://www.michaelwlucas.com/tools/ed](https://www.michaelwlucas.com/tools/ed)

<comment><USER32> To use this solution with a version of sed that does not accept newlines in patterns (i.e. to make it portable), one has to put the commands in a sed commands file and run it with sed -f.

How to make the one-liner portable without using a sed commands file?

Maybe something like:

      sed 's/baz/elephant/;/^ \{2\}- elephant/{h;G;};/^ \{4\}- elephant/{h;G;};s/elephant/baz/' foo|sed -a wfoo

      1. s/baz/elephant/
      2. duplicate that line if two or four space indent
      3. s/elephant/baz/
      4. save

N.B. no temp file used to save changes

cf. jvns.ca blog:

      1. search for baz
      2. copy that line and paste it
      3. s/baz/elephant/
      4. save and quit

N.B. temp file in $TMPDIR used to save changes

</comment></comment><comment><USER33> When I first encountered the command-line in college my Prof introduced me to VI and the basic bash commands, but I wasn't familiar with any other scripting languages, (or even, if memory serves, the concept of a 'scripting language'). As a result, I ended up creating a pretty dizzying array of ed scripts until someone introduced me to sed and the fact you can use bash as a scripting language.

</comment><comment><USER34> Ed is the standard text editor [https://www.gnu.org/fun/jokes/ed- msg.html](https://www.gnu.org/fun/jokes/ed-msg.html)

</comment><comment><USER35> Nice article, good to hear ed is not dead. =)

You could also just add the text after the matching line. A little simpler and more straight forward.

        $ cat > /tmp/ed-script
        /baz
        a
          - <USER13>
        .
        w
        q
        $ cat /tmp/2
        foo:
          - <USER11>
          - <USER12>
          - <USER14>
        $ cat /tmp/ed-script | ed /tmp/2
        33
          - <USER12>
        47
        $ cat /tmp/2
        foo:
          - <USER11>
          - <USER12>
          - <USER13>
          - <USER14>
        $·

<comment><USER36> I don't think matches the spec that the new line has the same number of leading spaces as the surrounding lines

<comment><USER36> Weird, after rereading the article, it seems like I may have imagined that part.

<comment><USER37> An older version of the article contained the following:

> I had one extra weird requirement which was that some of the lines were > indented with 2 spaces, and some with 4 spaces. The - elephant line needed > to have the same indentation as the previous line.

<comment><USER35> Well! That explains the .t. Thanks! :)

</comment></comment></comment></comment></comment><comment><USER38> Chapter 20 of O'Reilly's "Unix Power Tools, 3rd Edition" is all about batch editing and covers ed/ex as well.

Maybe there's an old copy of "Unix Power Tools" over in your server room or an abandoned cubicle in the office... the content has not changed much in the ensuing decades!

</comment><comment><USER39> Ed is pretty complete, to the point it was a little too powerful when it was part of a security problem with FreeBSD's patch. [https://securitytracker.com/id/1033188](https://securitytracker.com/id/1033188)

</comment><comment><USER32>
       echo -e '/-baz\n+1\ni\n-elephant\n.\nw\nq\n'|ed foo

but ed requires a temp file in $TMPDIR to save changes

for speed, put $TMPDIR on memory file system

sed requires no temp file

       1.sed:
       /-baz/a\
       -elephant

       sed -f 1.sed foo|sed -a wfoo

works with all versions of sed, e.g., not all versions support "\n" in patterns nor so-called "edit-in-place" automatic temp file creation and removal

<comment><USER31> The sed command doesn't get the indentation right, though, as the article says it could be indented by two or four spaces.

<comment><USER32>
       1.sed:
       s/- baz/- elephant/;
       /^  - elephant/{h;G;}
       /^    - elephant/{h;G;}
       s/- elephant/- baz/;

       sed -f 1.sed foo|sed -a wfoo

or

       1.sed:
       /^  - baz/a\
         - <USER16>

       /^    - baz/a\
           - <USER16>

       sed -f 1.sed foo|sed -a wfoo

</comment></comment></comment><comment><USER40>
      sed s/baz/baz\\nelephants/

<comment><USER41> You are missing the dash that the line starts with

<comment><USER40>
      sed -i.bak s/baz/"baz\\n  - elephants"/ *.txt

<comment><USER31> The article says that the indentation can be _two or four_ spaces, though.

</comment></comment></comment></comment><comment><USER27> I do this fairly regularly in various shell scripts, but less now than previously ever since "sed" introduced the --in-place option, making it more useful for my purposes most of the time.

</comment><comment><USER42> It's worth noting that the "enter a single . on a line to signal the end of an input" convention found its way into mail/mailx and SMTP too. The good thing is that it means you don't need to insert special characters like Esc (Ctrl+[, 27, 0x1B, whatever you want to call it) into your script; the bad thing is when you _do_ want to add a line containing a single "."... whereby ed and SMTP have diverged with different "escaping" conventions.

</comment><comment><USER43> Good to know about ed! Since noone else has mentioned this, emacs' keyboard macros seem much easier to me especially since more than the basic editing stuff off awk/ed/sed i can leverage all the editor extensions and modifications i have accumulated over the years. That is unless its tens of thousands of files and the edit is exceptionally simple. I would write a script in that case too.

<comment><USER44> Since discovering them, I use Emacs keyboard macros all the time.

Let's say I have:

      key   value
      salt  pepper
      fish  chips
      vodka orange
      rum   cola

and I want the second column in uppercase.

<F3> to start recording a macro. Alt →, → to position the cursor at "v" (or just →→→→→→ if this is a fixed width column), then Alt U to uppercase the next word. → to move the cursor one forward, to the start of the next line. <F4> to finish recording the macro.

Then press <F4> five times to run the macro five times.

(Explanation intended for users who've never used Emacs before. Of course, there are optimizations.)

<comment><USER45> The equivalent in vim is:

• qq to start recording a macro in register q,

• w to jump to the second word,

• gUaw to "go uppercase a word",

• j to move to next line (↓ works as well),

• q to stop recording,

• 5@q to apply macro in register q five times.

But in this example I would have probably used ex command:

        :%normal wgUaw

(for every line do as if I had typed wgUaw) or visualy selected the second column as a block and just pressed U.

I'm genuinely interested in someone showing how to do this kind of trasformation in popular modern editors such as Atom and VSCode. Is there such a flexible way as in the classic editors?

<comment><USER46> You can do it using multiple cursors. On Sublime, you place the cursor on beginning of "value", then press Ctrl+Shift+Down until the end - there will be a cursor on every line. Then you press Ctrl+Right to select all values on the second column. Then press Ctrl+P and choose "Convert to Upper Case", or just Ctrl+KU.

</comment></comment></comment></comment><comment><USER32> There is another program I use for editing that is older than ed. It is written in asm. I think it may actually be faster than sed (and sed is faster than AWK, Lua, Perl, Python, etc.)

      1.spt:

      ; x = "  - baz"
      ; y = "  - elephant"
      ;a a = input :f(end)
      ;  output = a
      ;  a ? x :s(d)f(a)
      ;d output = y
      ; :(a)
      ;end

      spitbol 1.spt < foo

<comment><USER17> >sed is faster than AWK

Depends on the awk implementation and the task. However even gnu awk (gawk) is very fast and mawk is astonishing.

Here is a simple example: count the lines, words, and characters in a 65MB text file (10 copies of a novel stuck together).

Testing on Ubuntu GNU/linux 16.10 reporting middle of three tries:

      export LANG=ASCII    # avoid differences due to unicode
      $ time -p wc big10.txt
       1284570 10956950 64886660 big10.txt
      real 0.29
      user 0.28
      sys 0.01
      $ time -p gawk '{l+=1; w+=NF; c+=length($0)+1} END {print l, w, c}' big10.txt
       1284570 10956950 64886660
      real 0.55
      user 0.53
      sys 0.01

Not bad, gawk is less than twice as slow as wc which is the standard tool for this.

      $ time -p mawk '{l+=1; w+=NF; c+=length($0)+1} END {print l, w, c}' big10.txt
       1284570 10956950 64886660
      real 0.35
      user 0.33
      sys 0.01

But mawk is only 20% slower than wc. For a script!

Just for a check, even python is not terrible at this:

      #!/usr/bin/python
      import sys
      l, w, c = 0, 0, 0
      for line in file(sys.argv[1], "rb"):
          l += 1
          w += len(line.split())
          c += len(line)
      print l, w, c

      $ time -p ./wc.py big10.txt
      1284570 10956950 64886660
      real 0.87
      user 0.86
      sys 0.01

About 3 times slower than wc and mawk.

<comment><USER32> On a much slower computer...

      time -p wc big10.txt
      1284570 10956950 64886660 big10.txt

      real         2.76
      user         2.68
      sys          0.08

Trying this as novice with k3.

Because novice, 2 out of 3 counts are incorrect and probably not the fastest solution used.

Total "words" in the example was simply AWK's NF. But looking at big10.txt there anomalies such as words separated by "\--" instead of space.

Here I used non-space character followed by space. Far from accurate but not too far.

      1.k:
      w:0:"big10.txt";v:,/$w
      m:v _ss "[^ ] " / "word": char followed by space
      #w   / lines
      1+#m / words
      #v   / characters

      time -p k 1

      1284570
      10019630
      63602090

      real         2.70
      user         2.40
      sys          0.28

Counting lines with sed

      time -p wc -l big10.txt
      1284570 big10.txt

      real         0.13
      user         0.06
      sys          0.07

      sed -n '$!d;=' big10.txt
      1284570

      real         0.29
      user         0.19
      sys          0.09

<comment><USER17> That is a slow computer, mine is a pre-haswell i3.

      $ time -p sed -n '$!d;=' big10.txt
      1284570
      real 0.07
      user 0.06
      sys 0.00

      time -p mawk 'END {print NR}' big10.txt
      1284570
      real 0.04
      user 0.03
      sys 0.00

      $ time -p gawk 'END {print NR}' big10.txt
      1284570
      real 0.14
      user 0.13
      sys 0.00

      $ time -p wc -l big10.txt
      1284570 big10.txt
      real 0.02
      user 0.02
      sys 0.00

<comment><USER32> Revised 1.k.

      w:0:"big10.txt";v:{" ",x}'w;u:{#v[x] _ss " [^ ]"}'!#v;t:{#w[x]}'!#w

      #w / lines
      +/u / words
      +/t / chars

Counts for words and chars are closer but still short due to inexperience using k.

But it _appears_ the script is now _faster than wc_.

      time -p wc big10.txt

      1284570 10956950 64886660 big10.txt
      real         2.78
      user         2.66
      sys          0.12

      time -p k 1

      1284570
      10956830
      63602090

      real         2.57
      user         2.42
      sys          0.14

</comment></comment></comment></comment></comment><comment><USER47> There is also ex, which is sort of cousin of ed, but also closer to nowdays more familiar vi(m).

<comment><USER48> It's closer because vi was built on top of ex -- vi's ":" commands are just ex commands. In fact, on my Linux box, /bin/ex is just a symbolic link to /bin/vi:

        $ ls -l /bin/ex
        lrwxrwxrwx 1 root root 2 Oct  2  2017 /bin/ex -> vi

_The original code for vi was written by Bill Joy in 1976, as the visual mode for a line editor called ex that Joy had written with Chuck Haley. Bill Joy 's ex 1.1 was released as part of the first BSD Unix release in March 1978._[1]

(Bill Joy went on to become a co-founder of Sun Microsystems.)

"ex" stood for the _ex_ tended version of ed.

[1] [https://en.wikipedia.org/wiki/Vi](https://en.wikipedia.org/wiki/Vi)

</comment></comment><comment><USER41> Good article. It has everything - a problem and a good solution to this problem.

</comment><comment><USER49> ?

</comment><comment><USER50> sed combined with iTerm's abilities to type in multiple panes lets me edit 100s of config files across multiple servers at the same time.

</comment><comment><USER32> (Novice k user.)

        1.k:

        /k3
        v:"- baz";u:"  - elephant";t:"foo";s:"\n"
        w:_ssr[,/$0:t;v;v,u]
        w[1_ {x-2}'(&w="-")]:s
        t 0:_ssr[w;s;s," "],s

        k 1

</comment><comment><USER51> Php -> one line</comment>


The Thinnest Paper in the World - <AUTHOR> https://www.nytimes.com/2020/05/05/science/the-thinnest-paper-in-the-world.html <comment><USER2> Doctor Yueh put an object on the table between them - black, oblong, no larger than the end of Paul's thumb.

"It is a very old Orange Catholic Bible made for space travelers. Not a filmbook, but actually printed on filament paper. It has its own magnifier and electrostatic charge system." He picked it up, demonstrated. "The book is held closed by the charge, which forces against spring-locked covers. You press the edge - thus, and the pages you've selected repel each other and the book opens."

<comment><USER3> There are many thinner _materials_ : 10-micron aluminum foil is commonplace in households, and disposable plastic shopping bags are usually about the same thickness, while this paper is 20 microns. Any of these could fit Yueh's 1800-page book into the thickness of Paul's thumb, 18-36 mm. But typical gold leaf is 0.1 nanometers thick, a hundred times thinner.

What's notable about this paper is that it's _paper_ that thin.

<comment><USER4> I'd like a _wafer_ that thin.

<comment><USER5> You would still explode ofc.

<comment><USER3> Even if it's not mint?

</comment></comment></comment></comment></comment><comment><USER6> Here's the company Hidaka Washi mentioned in the article:

[https://www.hidakawashi.com/jp/paper- TENGU/index.html](https://www.hidakawashi.com/jp/paper-TENGU/index.html)

They make "tengu jo-shi" (典具帖紙), the world's thinnest paper, also called "the wings of a Mayfly". Around the beginning of the 20th century they achieved a thickness/thinness of 0.03 millimeters.

The paper became popular for typewriter paper, as well as napkins, wrappers for precious stones, coffee filter, lens polishing, calligraphy, pressing flowers, fish printing.

Some paper varieties: [https://www.hidakawashi.com/jp/items/index.html](https://www.hidakawashi.com/jp/items/index.html)

After World War II, its popularity waned with the decline of typewriters.

However, in recent years it was discovered that the papar was suitable for restoration of paintings, sculptures, and historical documents. It's been used to restore murals of Michelangelo, and works in the Louvre.

<comment><USER7> while we're on thin and japan companies, youtube taught me about Disco, the wafer slicing disc company. Such a "trivial" problem in definition yet very impressive when you think about it.

<comment><USER8> What I love most about these small engineering companies making high tech niche products is their no thrills, stuck in the 90's websites.

Huge contrast to dark pattern based websites dedicated to selling stuff to consumers.

I guess they just don't bother since it'll make no difference to their bottom line. They're well known in their niche and probably as the only go-to solution for this kind of problem, I imagine the likes of Intel and TSMC have them on speed dial so their products sell without marketing or fancy websites.

<comment><USER7> I like that too. I naturally dislike marketing tricks, and enjoy seemingly old or bland but technically worthy things.

<comment><USER9> Have I got the channel for you! Technology Connections: [https://www.youtube.com/channel/UCy0tKL1T7wFoYcxCe0xjN6Q](https://www.youtube.com/channel/UCy0tKL1T7wFoYcxCe0xjN6Q) . My introduction was his rice-cooker video: [https://www.youtube.com/watch?v=RSTNhvDGbYI](https://www.youtube.com/watch?v=RSTNhvDGbYI) .

<comment><USER7> I binged his videos quite a lot already. Very nice right ?

</comment></comment></comment></comment></comment></comment><comment><USER10> Mirror: [http://archive.is/Pq1XY](http://archive.is/Pq1XY)

</comment><comment><USER11> I find it interesting that they use mulberry trees, seeing as silkworms famously feed on mulberry trees as well and the end products are somewhat similar.

</comment><comment><USER12> Reminds me of Tomoe River Paper [0]. They originally made paper for industrial purposes but now sell it to fountain pen users. It's made in japan as well, and unlike any paper I've seen produced elsewhere.

[0] [https://unsharpen.com/company/tomoe- river/](https://unsharpen.com/company/tomoe-river/)

</comment><comment><USER13> So... How many times can you fold it?

</comment><comment><USER14> Reminds me of the Japanese _Kezuroukai_ \- Thin Shaving Competition (Wood Planing)

[https://www.youtube.com/watch?v=6Ubv3kS9fhs](https://www.youtube.com/watch?v=6Ubv3kS9fhs)

</comment><comment><USER15> > ... with an ethanol-activated adhesive brushed onto one side ...

I wonder what they use.

And how they know that it's long-term stable.

Searching "tengujo ethanol adhesive" just gives me TFA and derivatives.

<comment><USER16> Probably some Lascaux acrylic adhesive. It becomes stickier when ethanol is applied to it.

</comment></comment><comment><USER17> They're making toilet paper thinner everydays ...

</comment><comment><USER18> I found this thing: Hamada Washi, a 150-year tradition of Japanese paper making, 28 Feb 2020, [https://www.youtube.com/watch?v=tYNDNS8eTC4](https://www.youtube.com/watch?v=tYNDNS8eTC4) I think it was too short, but for the moment it lasted, it fulfilled my life.

</comment><comment><USER19> If you would like to buy some in the US, Hiromi paper carries this paper.

</comment><comment><USER20> I knew without clicking that it had to be Japanese… fascinating product…</comment>


The Science Of Smiles, Real And Fake - <AUTHOR> https://www.npr.org/sections/health-shots/2019/07/01/735822187/the-science-of-smiles-real-and-fake <comment><USER2> The value of an attractive smile is incalculable.

If you've always had good teeth, be very grateful. It's one of the greatest natural gifts.

</comment><comment><USER3> In my experience it makes a big difference. I have heard smiling referred to as "face yoga." The more I smile, the happier I feel, and the better my interactions are with others.

</comment><comment><USER4> what about cumulative, like if someone was forced to do it every two hours for 14 days</comment>


GCC 7 Release Series – Changes, New Features, and Fixes - <AUTHOR> https://gcc.gnu.org/gcc-7/changes.html <comment><USER2> _On mainstream native platforms, Ada programs no longer require the stack to be made executable in order to run properly._

What does that even mean? I'm dabbling with Ada as of recently.

Also, woo!

 _Support for the RISC-V instruction set has been added._

On topic, I'm using GCC5 and 6 as well as experimenting with 7, and I also have Clang - all available to me via switch/simple shell functions. I always tend to have my junk work on all of those, so am in a kind of a simplistic position to compare each. From a daily user perspective, there's not much difference at all (clang and newer gcc). Clang's pretty warnings are almost in GCC now as well, speed is still on GCC's side (for me at least) and all is good in GCC and LLVM land. I'm leaning more towards GCC since I've been using it since it became united in late 90s. I believed in it, even though people thought of it, at the time, to be slow and shit. Look at it now! I'm using it on MacOS (yes), Windows and Linux. I'm sure more heavyweight users will find a lot of things GCC can improve upon though.

I know it might not be strictly in the scope of GCC's domain, but I would like to see some static analysis and linters (like MISRA, etc.) included out of the box with it. That would be swell.

<comment><USER3> >What does that even mean?

I know nothing about Ada but there is a feature called called 'executable bit' in pretty much all desktop processors since 1-2 decades. What this bit does is it marks certain regions of memory as not executable, i.e. you're not allowed to put the instruction pointer onto that region and let the CPU run the instructions. This is a hardware-level feature and can be disabled in BIOS/UEFI. Usually the stack is marked as not executable as a security feature, so buffer overruns can't just write code on the stack and then it is executed.

Why Ada needed this disabled is beyond me. Does it execute things on the stack?

<comment><USER4> >Why Ada needed this disabled is beyond me. Does it execute things on the stack?

I believe this is due to nested function support. There is some explanation here: [https://stackoverflow.com/questions/34982151/executable- ada-...](https://stackoverflow.com/questions/34982151/executable-ada-code-on- the-stack)

</comment></comment></comment><comment><USER5> If you compare (gcc7 and latest clang), how much in pair is gcc with clang in terms of compilation warnings? (One of the most valuable tool of a compiler). I'm really happy they are moving in the same direction; I've been worried about gcc.

<comment><USER6> Where clang now clearly leads is in terms of runtime security and debugging features. Both share asan (address sanitizer), ubsan (undefined behavior) and tsan (threads). But msan (memory sanitizer, finds uninitialized memory use) is only available in clang.

In terms of exploit mitigation clang now has control flow integrity and safestack, as far as I'm aware nothing like this is available in gcc.

msan may not be such a big deal, because you could use clang for testing and gcc for production. But I hope more people adopt stronger exploit mitigations like CFI, and if gcc doesn't deliver them clang will win - at least for security sensitive areas.

<comment><USER7> My understanding (and empirical anecdote) is that Clang produces inferior debuginfo (eliding some locals' contents, even when their values are not actually lost) that makes it more difficult to debug than binaries produced by GCC.

asan, ubsan, tsan, and msan are important debugging features, but for my every day use in core analysis, local variables in gdb are very important.

</comment></comment></comment><comment><USER8> GCC 7 also removed some boost-specific traits, some of which may impact some libs, like was the case for TBB[1].

[1] - [https://github.com/01org/tbb/issues/12](https://github.com/01org/tbb/issues/12)

</comment><comment><USER9> Some of those new warnings look very useful.

<comment><USER10> Clang really pushed this area forward. Good to see.

</comment></comment><comment><USER11>
      It attempts to move evaluation of expressions executed on all paths to the function *exit* as early as possible, which helps primarily for code size, but can be useful for speed of generated code as well. [Emphasis added.]

Typo? PRE hoists upwards, so it would make sense to move closer to entry, not exit.

<comment><USER12> No, it's correct. It's saying "if they are always computed, we move them up".

IE

      if (a)
        foo = a + b
      else b
        foo = a + b
      ->
      foo = a+b
      if (a)
      else (b)

<comment><USER11> How do you move up towards exit?

<comment><USER13> I think you have to read it like "executed on >all paths to the function exit< as early as possible". As in, if you have an expression that is always executed regardless which path you take before returning. It's useful to move that expression upwards instead of having copies on the different paths to the function exit.

</comment></comment></comment></comment><comment><USER14> Sad to see gcj getting the final shot, but the project hasn't changed much since 2009 anyway.

</comment><comment><USER15> Sigh, looks like one of my common idioms:

       if (int_value) { ... }

Will now be warned/failed.

<comment><USER16> Hmm, I wonder if that's actually true. I don't have GCC 7 anywhere to actually test it, but the documentation[1] states:

      -Wint-in-bool-context

Warn for suspicious use of integer values where boolean values are expected, such as conditional expressions (?:) using non-boolean integer constants in boolean context, like

      if (a <= b ? 2 : 3)

Or left shifting of signed integers in boolean context, like

      for (a = 0; 1 << a; a++);

Likewise for all kinds of multiplications regardless of the data type. This warning is enabled by `-Wall`.

[1]: [https://gcc.gnu.org/onlinedocs/gcc/Warning- Options.html](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html)

<comment><USER15> I'm guessing (again I can't really test it yet) that it will warn on it and suggest

       if (int_value != 0) { ... }

To be clear about what I mean.

<comment><USER17> I've just tested against GCC master and can confirm that -Wint-in-bool-context does not trigger on this very, very standard case.

Per the examples in the documentation, it _does_ trigger when you do something silly like "if (i < 3 ? 7 : 0)".

In fact if you read the documentation and the warning messages more closely, it's looking for suspicious use of integer _constants_ , not integer variables.

<comment><USER15> Awesome, and I missed the bit about constants.

</comment></comment></comment></comment></comment><comment><USER18> Great news on the gccgo front:

> Escape analysis is available for experimental use via the -fgo-optimize- > allocs option.

</comment><comment><USER19> It's only a matter of time before llvm/clang overshadows gcc in every aspect, if it hasn't already. clang probably has 10x more full-time developers than gcc does.

<comment><USER20> It's a similar story as with Firefox and Chrome, and you're sadly right.

The free software community is more than ever before at risk of being replaced by a monopoly culture controlled by large corporations.

<comment><USER21> That's what you get when you prefer programs that are merely open source to free software.

<comment><USER22> Exactly. It's like when evaluating things people just completely forget about the implications of the license they use, in both specific and broad contexts. I use and support GPL products as much as possible, even when a BSDesque product may actually have a few advantages. I'm not 100% on that either, but I try hard to slowly adapt and use truly foss software and get used to the ecosystem mentality changes they require.

I wish people, particularly devs, thought more about licenses and their long term impact on freedom of the user & dev. I get tired of hearing about how "but copyleft is less free because it restricts me", but to me that's like saying "individual liberty under the rule of law is less free because it prevents me from punching that dude in the face". It's some strange form of anarchism argumentation that fails to respect the rights of others.

With all the security issues cropping up lately, I think it should be obvious to big picture thinkers that, while not _the_ solution in itself, any real forward thinking solutions for cyber-security must focus on keeping black boxes out of the picture. BSD style licenses are dangerous to me because they allow hard working peoples code to be abused and used for abuse of others.

To be fair to this particular argument though, LLVM does fall under the LSCA license which is gpl compatible, it simple isn't copyleft, so my above rant is more a general comment than on the topic of clang.

<comment><USER23> I'd argue the opposite, that GPL style licenses make it easier to hide things in black boxes these days. LLVM and Clang are under BSD style licenses, and even Sony has said that being an active contributor keeps things moving along [1] even when they don't have to contribute back. Plus, most BSD-style code doesn't require things like copyright assignment, which can be a big brake against people from contributing back.

Additionally, a lot of GPL software, like MySQL and BerkeleyDB, create a more closed community because that company has a lot more ability to create their own black box projects through dual licensing as closed source works. Postgres, in comparison, is BSD licensed, making it much harder for a company like Oracle to buy out pieces of the community and run away with the source and make deals others can't. The GPL has a lot less community power to counter those sorts of situations.

[1] [http://llvm.org/devmtg/2013-11/slides/Robinson- PS4Toolchain....](http://llvm.org/devmtg/2013-11/slides/Robinson- PS4Toolchain.pdf)

<comment><USER24> GPL doesn't require copyright assignment (the two issues are completely separate). And if the original author isn't the only copyright holder, they can't make GPL'd code proprietary either. Which is why going GPL is a benefit for everyone -- nobody can effectively make the software proprietary unless there is only a single copyright holder.

With BSD-style licenses, everyone is also on an equal footing, except that now users have no guarantees that the software they use will be maintained as free software. At any point, a treacherous developer or company could scoop up the talent from the community and make a maintained fork of the project proprietary. The original project dies because of lack of talent and now free software has helped expand the reach of proprietary software.

Note that even with copyright assignments, there are some good ones. The FSFs ( _optional_ for projects) copyright assignment has specific wording that guarantees they will always keep the code free (and even go further to state that it will always be copyleft and in keeping with their well-documented philosophy). If I had a single foundation I had to pick to assign my copyright to, it would be the FSF.

<comment><USER23> That same treacherous developer can scoop up talent from a GPLed project too, such as the examples I gave. Sourceforge used to have a GPLed, but was brought closed, and the free version mouldered from disuse. Free software helped expand the reach of proprietary software. The GPL is no guarantee that a free version will always remain the most used branch either.

Going GPL also has drawbacks. Look at how Apache 2 and GPL 2 weren't compatible because of the Apache license's patent clause. That lock-in effect of the GPL means that your software package can't be used by the larger free software community. Which if you're satisfied with it, fine, but some people don't want to encumber their software as such. There's no such thing as a universal benefit.

<comment><USER24> > That same treacherous developer can scoop up talent from a GPLed project > too, such as the examples I gave.

I don't understand what this sentence means? Do you mean they take the developers and stop them from working on the original GPL version? In this context I'm referring to the most common case which is a GPL project that has more than one copyright holder.

In _that_ context is is not possible for a developer to take the existing work of the developers, make a proprietary fork, and convince the developers (in a moment of weakness) to switch and start working on the proprietary code. They can create a new project, but that's always true and not possible to restrict (nor would anyone want to).

> That lock-in effect of the GPL means that your software package can't be > used by the larger free software community.

And this is the whole point of the "or any later version" clause. Every complaint you're bringing up has already been resolved by how the GPL is used and has worked for >20 years. Of course the GPL does have its downsides (the whole MPLv1/CDDL thing is a real shame) but "lock-in" is not one of them (unless you explicitly decide to lock yourself in, which is your own fault).

<comment><USER23> It's absolutely possible in such a for the developer to make a fork. People can agree to change licenses, portions can and have been rewritten. Nothing keeps a license in stone.

I'm referring to the GPL's "no other restrictions" clauses that keeps things from interoperating with the Eclipse public license for IBM wanting to maintain choice of venue, the MPL, CDDL, 4-clause BSD, etc. Each of which the FSF says, "well, if they just used our license." The GPL is absolutely a barrier to cooperation.</comment></comment></comment></comment></comment></comment></comment></comment></comment>


Plug-In Hybrids Aren't Coming — They're Here  - <AUTHOR> http://blog.wired.com/cars/2008/10/plug-ins-arent.html <comment><USER2> _"..the plug-ins burn less gas and emit a whole lot less CO2 — even when drawing their juice from coal-fired powerplants — than cars running on dino juice,.."_

How much less? Comparing MPG for a hybrid vs a plugin is not a good comparison. (Unless what you are worried about is oil imports.)

</comment><comment><USER3> That picture reminds me of South Park. Her eyes almost look closed. Smug alert!</comment>


Delicious Creator Quietly Launches Threaded Twitter Conversations - <AUTHOR> http://www.techcrunch.com/2009/08/11/delicious-creator-quietly-launches-threaded-twitter-conversations/ <comment><AUTHOR> I am the OP - Just found this HN thread discussing the same - <http://news.ycombinator.com/item?id=754906>

</comment><comment><USER2> see: <http://news.ycombinator.com/item?id=754906></comment>


IFixit Thinks a New iPhone Is a Waste of Money - <AUTHOR> https://www.inc.com/magazine/201704/david-whitford/ifixit-repair-men.html?cid=hmhero <comment><USER2> >> You gotta fight for your right to repair

Depends. My iPhones worked very well for 3-4 years with top performances. I would fight to remove from the market the not-so-durable phones rather than fight against a good product like an iPhone.</comment>


Ask HN: How to monetize a game and not make a pay to win? - <AUTHOR> Dear HN, I'm making a game, a mmo based on fast paced fight. I'm looking for ideas to how to not make a pay 2 win but monetize the game in an interesting way. For now there is only fighting between knights.<p>Cheers <comment><USER2> Follow the strategy of games like Fortnite and League of Legends. They offer extra cosmetics in exchange for money.

If you haven't played these; things like "skins", or armor packs, in game dances, etc. Are offered for purchase. They are explicitly for cosmetic enhancements and not game advantages (IE: changing your characters color won't make you have a higher attack damage)

If you go large scale you could also do what battlefield did and rent out private servers, where people got to host private games with their customized settings.

Lastly, this one I don't agree with as much, but you could offer quicker lobby times/higher priority in queue.

Ps: You can also do DLC's with extra maps or something.

<comment><AUTHOR> I really like the priority stuff and dislike the cosmetic, I explain why.

Cosmetics are expensive for mobile hardware as they create a tons of new assets to show to players. GPU can only hold a 4096*4096 spritesheet which correspond basically to 6 different characters with 5 animations each for a 2d game. It's not a lot... Spritesheet swaping is expensive in CPU time as it makes a new draw call. So the optimization part of displaying many different assets is an important task I don't want to focus on right now. Additionally I have to design the new assets. It seems to be a late solution when the game is already profitable and monetized... Or when you have 10s of thousands in investment.

Paying for beeing served in priority is quite fair. In our society, time is money and you can pay for bypass queues. It not makes the game a pay to win but a pay to play/not wait. It's fair for everyone.

I don't really like when games make players paying without offering them a significative advantage.

Additionally, for games only based on gameplay it could work. But for game with economy it doesn't click as if you don't have a white market, you will see a black market appear.

<comment><USER2> TIL.

Glad I was able to give you an idea, thanks for explaining. It's cool to learn a little crash course on this.

Good luck!</comment></comment></comment>


Immersive Linear Algebra (2016) - <AUTHOR> http://immersivemath.com/ila/index.html <comment><USER3> Without having looked at the text in depth, I applaud the idea here - I'm convinced the web browser can help us improve upon maths textbooks printed on paper, but there aren't many 'hypertextbooks' like this in existence (partly, I think, because most people positioned to author a maths textbook want to use latex; and most people who are able to develop a web app aren't positioned to author a maths textbook).

I'm interested to know how the authors funded this, and if they have any data about the impact it has had.

<comment><USER4> For my Linear Algebra ([http://joshua.smcvt.edu/linearalgebra/](http://joshua.smcvt.edu/linearalgebra/)), the thing that has held me back has been that the tech changes every few years. I can't keep revising something that I give away for free. In contrast, the LaTeX in which I wrote the book is 98% unchanged since the early 90's.

Perhaps the tech is settling down, I'm not sure.

<comment><USER3> Perhaps this is a reason why there are some nicely designed apps with not-so- great content, and lots of books with legendary content: the whole ecosystem around app development isn't very friendly to the long-term process of writing a classic text.

It's also hard to focus on design, coding and content solo, and writing great, cohesive content tends to be a private endeavour. I'm not surprised to see immersivemath.com is written by a team.

I know (through fond memory!) your texts have some interactivity in hyperlinking to solutions and I found that very useful, but making it work must have taken time and been a bit of a headache. Extrapolate that to writing a webapp and it's easy to imagine you would never finish.

And yes, the words 'legendary' and 'classic' are direct compliments to you: your Lin Alg sits next to Spivak's Calculus on my bookshelf. They are both immortal.

<comment><USER4> Thank you, I appreciate it.

</comment></comment></comment></comment><comment><USER5> For another great source of open source textbooks I highly recommend OpenStax ([https://openstax.org/](https://openstax.org/)). I am currently re-learning calculus and their Calculus text is great. As an aside, I'm currently working through mathematics I wish I had taken in college (I was a biology major), starting with Calculus, and would love to connect with anyone else on a similar mathematical journey!

And for even more open source textbooks: [https://open.umn.edu/opentextbooks/](https://open.umn.edu/opentextbooks/)

<comment><USER6> I've been doing Khan academy most days (like, 28 of 30) for the last year. It's been super friendly and I've moved through the algebra, geometry, trig, precalc, and differential material... I'm currently working through some integral calc stuff. I'm planning on doing the stats and linear parts of kahn before trying to take some of the online college-level courses; Sal Kahn is super great as a teacher but I am starting to feel like I can now benefit from some more difficult to digest material.

My hope is to generally increase my math abilities so I can do some electronics design classes and some study about how to start applying ML/ AI tools.

But I've found studying math to be quite fun and useful in its own right. It's fun and I feel like it's helped my general intellectual abilities.

<comment><USER7> I too would like to work my way up to calculus and beyond.

What sequence of courses do I take on the site to get to calculus, starting from the beginning with the basics?

<comment><USER8> I had a humbling experience last year when I browsed the available courses until I found one that only contained math I'm already familiar with and I had to go all the way back to fourth year elementary school. :/

<comment><USER7> How were you able to determine what level you were at?

<comment><USER8> I started at precalculus and worked my way back until I found a video that didn't assume I already knew something I don't already know.

<comment><USER9> Could be that you know a lot of maths at a higher level than that, but your education just has a lot of holes in it.

<comment><USER8> If only that were true. :) I only know cross multiplication and basic arithmetic, excepting long division.

<comment><USER5> We all start somewhere! One of the beauties of math is it's hierarchical structure. Once you figure out where you're at, it's just a matter of progressing further up the hierarchy of abstraction (spoken by someone who has only made it to Calculus in the hierarchy)

<comment><USER10> I really want to make a site that expresses this like a skill tree you'd find in an RPG or in Civilisation.

<comment><USER3> Duolingo has something like this. I rather like it.

</comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER11> This seems like one of the best uses of computers for educational media, one of the ways digital instruction can really shine through compared to physical text which can often require supplemental videos or help from a teacher to elucidate a concept.

Feels very reminiscent to me of 3B1B videos [1] on topics that use visuals to elucidate math topics more clearly as well.

[1] = [https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw](https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw)

<comment><USER12> 3Blue1Brown's Essence of linear algebra series is the go to place for learning this material. I've included the link to the series below so people don't get lost in all his other wonderful videos along the way.

[https://www.youtube.com/watch?v=fNk_zzaMoSs&list=PLZHQObOWTQ...](https://www.youtube.com/watch?v=fNk_zzaMoSs&list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab)

<comment><USER13> No offense to 3b1b, the production quality is impressive and the content is effectively insightful.

However, it is ultimately a very limited linear format covering the topic only lightly.

<comment><USER14> I see you used a throwaway because there are so many fans. I might not be as harsh but while I enjoyed the pretty animations they didn't actually help me learn linear algebra. They're still full of jargon written for people who already know the topic.

</comment></comment></comment></comment><comment><USER15> Upvoting this because I think it's really important that we start getting more open source textbooks which specialize in exposition[1]. That being said, I'd make a different arrangement of the material.

Here are a few thoughts:

1\. This book embraces the modern take on a rigorous course in linear algebra, which I disagree with. That is to say, it covers vector spaces front and center in the first chapter. Conversely, systems of linear equations (Gaussian elimination) and corresponding notions like row reduction of coefficient/augmented matrices are pushed back several chapters. You see this in popular "flagship" textbooks like Axler's _Linear Algebra Done Right_ because they're prioritizing the underlying theory. I think Gaussian elimination should be covered first because it motivates the material - you're never going to cover Linear Algebra in a way that makes all the pieces fall together in a purely straightforward dependency.

But if you first cover systems of linear equations, you actually motivate the purpose of vector spaces. Moreover, many (most?) proof-based problems in linear algebra reduce to solving a system of linear equations (and therefore reducing a matrix) which is modeled after the thing you're trying to prove. What's the basis of a null space of this linear transformation? You can solve it with row reduction. Is this spanning set a basis of this vector space? Solvable through row reduction. You get a lot of equipment for solving vector space problems if you build up the row reduction scaffolding to a minimal level before vector space coverage. This does not have to temper the theoretical rigor of later, abstract material; if anything it grounds and augments it.

This is why I'm a huge fan of the way that Hoffman & Kunze cover this material. That is a _heavily_ theoretical book, which easily surpasses undergrad-level linear algebra in later chapters. A couple of decades ago it had the spotlight as the really good linear algebra book (it displaced Halmos' _Finite Dimensional Vector Spaces_ , and was itself displaced by Friedberg or Axler). But it motivates a very rigorous coverage of vector spaces by starting with Gaussian elimination, matrix representation of systems of linear equations and (reduced) row echelon forms. If you don't cover this first, you have to either assume the student knows it already or you resign yourself to wading through several chapters of potentially unmotivated abstraction.

2\. In my opinion, linear maps should be covered directly after vector spaces. They're a logical succession of the same concept - after you've taught linear combinations, linear (in)dependence, spanning sets, bases, subspaces, and related theorems, it's very easy to jump right into functions _between_ vector spaces. It's just an expansion on all of these things. I would therefore rather see chapter 9 immediately following chapter 2. And much like my prior point, linear maps are an abstraction that empowers a lot of the other ideas; this is mainly because so many things are representable as a linear transformation (much like they're representable as a matrix).

3\. The rank is a very important concept, but I would argue it should be subsumed into the chapter on matrices. You can cover anything that doesn't fit cleanly in the matrices chapter in the chapter on linear maps, since you'll need to do that anyway before you cover the dimension theorem. That might be a good argument for simply covering matrix multiplication and addition in prerequisite material and subsuming all of matrices under Gaussian elimination and/or linear maps too...

4\. I'm a big fan of the prerequisite material covering basic trigonometry. Trigonometric functions are a good source of exercises for vector spaces. I would like to see an expansion which does minimal coverage of naive set theory (sets, subsets, unions/intersections, etc), functions (injection, surjection, bijection) and polynomials. If you cover the basic definition and arithmetic of polynomials here, you save yourself some space when you cover Lagrange interpolation and factorization later on. It's probably a lot to ask for, but some coverage of differentiation of polynomials would also be useful because the theory of vector spaces gets a lot richer when you incorporate exercises which use a bit of calculus/analysis. In particular, using vector spaces of functions and linear maps of differentiation give you a lot of leeway to show how abstract vector spaces can be without going nuts on the moon math.

5\. I've received pushback on this before, but I think it's really important to cover fields as their own subject before covering vector spaces. If you're going to cover vector spaces rigorously, you really need to cover the field axioms. Scalar multiplication doesn't make sense without first defining a field (you can handwave it, but it's easy to make subtle mistakes - <USER2> missing that the set of all integer $n$-tuples _cannot_ comprise a vector space). Likewise you ordinarily need your linear map to agree on a field to be well-defined. This coverage would ideally also establish the basic facts of the real and complex fields, which are almost entirely the fields you work with in undergrad linear algebra.

6\. I don't see any exercises. A good math textbook challenges its reader to internalize each chapter's material by substantially using it to prove further material. By not including exercises, this text becomes more of an illustrated monograph. That's totally fine if it's what they're going for, but I think there's a huge opportunity to tailor it even further with targeted exercises that expand on the theorems in each chapter.

Note that I'm mostly nitpicking here, even if I think my critiques have merit. The exposition of material is much more important than the arrangement of material, as long as things are building on each other rigorously. I'm not trying to say the textbook is bad; this is just a stream of consciousness about my opinions on arranging linear algebra for maximal pedagogy. You generally have to supplement textbooks in order to get a rich understanding of the subject matter anyway.

On the plus side, I'm a huge fan of the way they present vectors geometrically. That's a huge win for illustration/animation purposes. I do think there's a missed opportunity to make a sexy illustration of transforming a system of linear equations into coefficient, unknown and constant matrices; then from there illustrating the transformation of the augmented matrix into its reduced row echelon form.

__________________________________

1\. For pretty good open source, undergrad-level textbooks in Abstract and Linear Algebra respectively, see [http://abstract.ups.edu/aata/](http://abstract.ups.edu/aata/) and [http://linear.pugetsound.edu/html/fcla.html](http://linear.pugetsound.edu/html/fcla.html) respectively.

<comment><USER16> I think the problem is a tension between what's valuable to us in learning and what's valuable to us after learning.

So when I was tutoring, I noticed that my "standard approach" failed: a kid would have a homework problem, I would say, "Here's how you want to think about that problem, it's (say) a conservation of energy problem, calculate the energy before and after..." and it fostered no real learning! I thought the problem was that I was subsidizing laziness—stepped back a bit but gave lessons after some struggling—and that didn't hurt much but it didn't help much either. They were motivated, just the didactic structure was not working for them. I started to ask questions, and that was a bit more helpful, but found that I myself was somewhat unguided about how to accomplish "Socratic teaching" so that they could benefit from it—if you can believe it, my default approach was to try to introduce the same theory ideas as questions from the start, "would conservation of energy apply here?"—so no wonder I only got mixed results: it was basically the same thing.

But questions gave me a way to get off that map, because I started to ask tutees to give me _expectations_ and _examples_ , and somehow those worked well. "What can we expect that this system does, within a few orders of magnitude? Can you give me some examples of similar systems and how they work?"

I think that in order to learn abstract things, we need to first have a bunch of examples in our heads, things that all kind of fit together but do not make sense. The abstraction unifies the examples, helps us remember them and fit them together. We can use each example to test the abstraction for fit, to massage our cognitive ability from one context into another.

When we build a building, we need frameworks and scaffolds to build it. When the building is freestanding, all of that effort of building the scaffolds can be undone, the scaffolding comes down, it's no longer necessary. We go back to a textbook and we want a picture-book: show me the building, and just the building, and nothing but the building. Let me feel lushly indulged by its architecture, by photographs that go into detail in the really rich areas—I want indulgent artistic experience, because that's what the building is!

We have a constant tension in textbooks between the how-to-manual—spartan, practical, containing all of these scaffolding steps and nitty-gritty–and the coffeetable book—rich, whimsical, pop-simplified.

Griffiths' _Introduction to Quantum Mechanics_ begins with a prologue to this effect, though I thought it was just a quantum quirk at the time I think it's actually much more general now. He says [these will not be exact quotes] that, "This book will teach you to _do_ quantum mechanics because I strongly believe that this has to come before any sort of strange discussions about what quantum mechanics _is_." It's one step between Feynman's "don't even try to understand quantum mechanics, just shut up and calculate" and Searle's response "I'm sorry, I am a philosopher and literally the only thing anyone pays me for is to try and understand things like quantum mechanics."

And I think that is where I want to focus my teaching efforts, that every textbook should kind of have the appendix coffee-table section, I'd even like to carve out a new name for it and call it an "abridgement" or so, at the end. The book _Mazes for Programmers_ has an appendix like this of "let me summarize all of these maze generation algorithms and their essential properties and their essential approaches" that I _really_ loved, it makes it an absolute joy to keep this thing on the bookshelf and come back to it time and time again. The main text has the "Here's how to _do_ it" information, the appendix has the polite overview of what was just built that is great for returning to.

<comment><USER17> Incoming tech seems about to change the texts-and-tutoring constraint and opportunity space. I wonder if it's time to start thinking and exploring ahead?

Consider an art project, where you sit in a booth, and watch an interesting video drama. But why is it interesting? The video is a graph of segments, like an old "choose your own adventure" story. And there's an eye tracker watching you. So if you're interested in characters A and B, the story mutates to emphasize them.

Consider a one-on-one tutor on a good day. Noticing a student engaged and enthused, they might reorder content on the fly to leverage that. Might emphasize different aspects, and alter presentation, based on observed interests and weaknesses. Or consider working with a young child, watching them read word by word, noticing their where they hesitate and frown, probing for their thoughts, adjusting difficulty, providing a path of development.

What if that was math content rather than a drama or children's book? What if we could do this at scale? Eye tracking is just one tech coming in on the coattails of VR/AR. A setting for personalization AI is another.

What if saying "the best way to organize and present this topic in a textbook", becomes like saying "the Capital mandates, that every teacher of this grade, will today all teach the following lesson, by saying the following words, regardless of local context"? While not on a national level, that is a real thing.

What might it take to start encoding an adventure graph for linear algebra? The "oh, if you like this perspective on this topic, you might like this similar perspective on this other topic"?

Or if we don't have the tooling for that yet, can we start thinking about the tooling? Or fruitfully do something else now, in preparation for opportunity? Perhaps Kahn academy problems in more flavors, in a richer graph? ML-based textbook aggregation, synthesis and retheming? Perhaps it's all not ripe yet. But something else, maybe?

<comment><USER18> I feel a bit bad for saying this, but I don't think the interactive visualizations here really contribute very much. Yes, you can move the vectors, but the point is already made by the static picture.

Similarly, you can already traverse, not only a single math book in a non- linear order, but any number of different books and other sources concurrently, and this is how everyone I know of already learns. Many textbooks already have a dependency graph in the beginning showing how you can read the chapters! So every person is already traversing their own personalized "adventure graph" for linear algebra and will be throughout their entire education. It is rather the idea of a totalizing tech solution that will be perfect for everyone that smacks of central planning.

<comment><USER17> Hmm, I hope the "centralized planning" story wasn't distasteful. I was thinking of the stark contrast between say my writing a learning progression for category theory, versus say pointing out to a toddler that their observation about a game piece on a path, generalizes to any finite loop, including time of day, or a simple parking lot.

So let's see, possible contributions from interactive visualization to teaching linear algebra? Very not my field. And it's been decades for me. And my exposure to math education research is limited. So I don't recall what challenges, misconceptions, and failure modes are faced there. So, all I can offer is a handwave: perhaps a hands-on version of some 3Blue1Brown video?

Apropos "this is how everyone I know of already learns", at least for science education, this describes very very few K-13 students. Even among freshmen at a first-tier university. I'd be surprised if math was significantly different. Surprised but very interested.

Apropos "Many textbooks already have", yes... progress is often not something startlingly novel, but doing something we've already recognized as desirable, but doing it faster, better, more thoroughly, more cheaply, more consistently, for more people, etc.

Perhaps it might be more useful to think of tutoring others, rather than learning oneself? Dropping on someone a pile of texts, and telling them "find the corresponding sections yourself, work past the differences of notation, when you you think you might have a misconception, try googling the math education research primary literature to find how to deal with it, ...", well, hmm. What are the learning experiences we would ideally wish for each student, and can we use incoming tech to deploy less ghastly approximations of that.

</comment></comment></comment></comment></comment><comment><USER19> I thought matrices were pretty cool when I took Linear Algebra in college. However, I hated doing the computations by hand; it makes one really appreciate computers.

</comment><comment><USER20> I recently released my own review notes which try to provide a brief overview of some of the main linear algebra topics in an intuitive / geometric manner in case anyone is interested: [https://github.com/photonlines/Intuitive- Overview-of-Linear-...](https://github.com/photonlines/Intuitive-Overview-of- Linear-Algebra-Fundamentals)

</comment><comment><USER21> I've been working on this for the last two years, I've just started writing content for it :)

[http://treena.org](http://treena.org)

<comment><USER22> The website looks a but weird on mobile [0]. It's still readable but probably removing the left image would help already.

[0] [https://imgur.com/dzidyuV](https://imgur.com/dzidyuV)

</comment></comment><comment><USER23> This reminds me of the mobile game Euclidea, which is a puzzle game where one must build geometric figures with as few operations/tools as possible: [https://www.euclidea.xyz/](https://www.euclidea.xyz/)

It's really well designed, give it a try !

</comment><comment><USER24> There is a similar interactive linear algebra book from Georgia tech : [https://textbooks.math.gatech.edu/ila/](https://textbooks.math.gatech.edu/ila/)

Highly recommended.

</comment><comment><USER25> Another interactive math textbook: [https://mathigon.org/](https://mathigon.org/)

<comment><USER3> Wow. That is an amazing piece of work.

</comment></comment><comment><USER26> This is fantastic! I'm planning on taking linear algebra in the fall and a glance over this makes me think it will save me tons of time searching youtube and etc for explanations of trickier concepts.

<comment><USER27> 3Blue1Brown's youtube channel is great too for visuals and theory. I taught myself linear algebra pretty easily combined with this book.

</comment></comment><comment><USER28> Reminds me of [http://setosa.io/ev/eigenvectors-and- eigenvalues/](http://setosa.io/ev/eigenvectors-and-eigenvalues/)

</comment><comment><USER29> 20 years ago, when web browsing was still newish, I would have expected HUNDREDS of interactive-learning sites like this to have been set up by now. I am very glad to see this!

</comment><comment><USER30> Thank you so much to ease my life.

Do anyone know any such type interactive books which is related to ML, i don't mind purchasing.

</comment><comment><USER31> Thanks for the link. I have been meaning to brush up my Linear Algebra for some time now, I'll give this a serious try.

Side note: anyone else notice that if you scroll up or down really fast (in mobile) the spinning logo starts to go faster & faster. Cool Easter egg!

</comment><comment><USER32> I really like the concept...but where do people pronounce algebra that way? It sounds like a computer trying to sound normal (to my ear. I'm more of a Al-Ja- bra kind of guy, not Al-Ga-bra)

</comment><comment><USER33> I need a resource like this for group theory.

<comment><USER15> Try [http://abstract.ups.edu/aata/](http://abstract.ups.edu/aata/). I have no affiliation with the authors, but I think it's really quite good. Symmetries in particular have a lot of illustration.

<comment><USER33> Thank you! I'll check it out.

</comment></comment></comment><comment><USER34> I want interactive proofs to learn linear algebra. I'm trying to build something, it's daunting.

<comment><USER35> Interactive proofs?

<comment><USER34> Yes. Unfortunately that term is taken by some cryptography thing. A proof assistant or interactive theorem prover to be more precise.

</comment></comment></comment><comment><USER36> Great idea.

Learners can interact with book.

</comment><comment><USER37> Is there anything similar available for Tensors?

</comment><comment><USER38> Ouch, their Forum is full of spam.

</comment><comment><USER39> yes! interactivity is where it is!

</comment><comment><USER40> Is this still being worked on?

</comment><comment><USER41> test</comment>


Ask HN: What do you use to test Frontend code? - <AUTHOR>

At our startup, we are trying to sort out the best way to handle testing against our supported Browser matrix. We want something that is repeatable and automated. We've looked into QUnit and Selenium but have this nagging feeling that we are doing it wrong.
Our application is primarily one page and uses a lot of jQuery to both animate things on screen and to work with the backend via AJAX.
Any hard won tips out there? <comment><USER2> I always feel frustration at this question, I can't believe that sauce labs hasn't taken off. Use capybara as the driver layer, and a proper test framework that separates the different layers, and sauce labs to hit _any_ browser matrix you want. Tie it into a CI system and never worry about this again - it's a solved problem, and it was solved by Sauce Labs.

disclaimer: I used to work there, and put my blood, sweat, and tears into building it out just for situations like this.

</comment><comment><USER3> If you're in the Ruby world, Capybara is a great addon to Cucumber and RSpec. It solves the animation problem by adding a timeout to wait for elements in the DOM. A step like this:

When I click the link that does a 4000ms animation I should see "#mydiv"

Capybara will wait for #mydiv to appear for some timeout period (30 seconds). If it appears before then, it keeps going.

This way you can have complex animation and still assert final state of the page. Capybara allows Selenium, headless WebKit, and other JS drivers. It's one line to swap.

If you aren't in the Ruby world, you might at least steal some ideas from that lib to make your Selenium tests better.

Also, you might drop the folks at Pivotal Tracker an email. They have a fat one-page JS-heavy product, and I bet you anything they automatically test it. They might have cool stuff to share.

<comment><USER4> Capybara works pretty well for any web based front end. I'm using it to do some basic automation of websites (scheduling tasks and the like). You write the tests in ruby but honestly it is really simple: <http://pastie.org/2476405> is my script for logging in to google voice and sending a text message. If I recall it was simply gem install capybara, a gem install selenium-webdriver and that was it.

<comment><USER3> Good point, I forgot that you could just use it standalone!

</comment></comment></comment><comment><USER5> I'm not using full on unit tests for my current project. I just break the code into a few independently functioning layers, and make a single html file to test the code in each layer. I run the corresponding html file manually as I develop code in a given layer. It may be heresy to say this, but I've found that automated unit tests are more trouble than they're worth in a lot of cases.

The second thing I do is use my tool every day. I use the unstable branch on the unstable server whenever possible. Problems usually become obvious very quickly. I don't push to production until I've used the unstable server for 24 hours without incident. I find this combined with the testing practices described above to be the best compromise between reliability and getting- stuff-done-ability.

</comment><comment><USER6> We use SauceLabs with Selenium, Jellyfish (very fast), Capybara (very flexible), and Jasmine. Yes, Selenium may feel hard to work with at times yet the payoff is enormous when you aim to support many browser for many years.

Edit: I have a great outsourcing team that builds Selenium for me, and runs in SauceLabs. PM me if you want details.

</comment><comment><USER7> We use jsTestDriver at Picklive to test our game, alongside Sinon.js for a mock implementation of our game server. It's very easy to test simultaneously on multiple browsers, run tests on the command line, and we run it headless for continuous integration.

In comparison with Selenium, I've found unit and integration tests using this setup fast and resilient.

</comment><comment><USER8> I use qUnit all the time because I wrote lots of jQuery plugins for everything that we do at my small startup. Then we have a QA team in India that are always clicking through the site and finding new bugs (they also have extensive selenium scripts that go through the whole site every night, but oddly enough none that run the unit tests... grr).

</comment><comment><USER9> Admittedly, Selenium's standard interface leaves a lot to be desired; however, I've had great time using it in combination with a Python wrapper, where you write Selenium test cases as Python unit tests.

<comment><USER10> This. Just write the Selenium base code in the Firefox addon, and then click, export as python :D

</comment></comment><comment><USER11> I guess Selenium is fine, out of curiosity, why do you think using Selenium isn't the right choice for you?

<comment><AUTHOR> I'm not sure that it isn't. I'm worried about the maintenance costs of keeping it up to date - but maybe that is the price you pay.

<comment><USER12> If you're worried about keeping it up to date, why not outsource the test runner to something like saucelabs?

<comment><USER13> I believe outside1234 is referring to the maintenance cost of keeping _the tests_ up to date.

<comment><USER14> I'm using Selenium on a major project, and from the start refactored out common tasks. I record new tests using the Selenium IDE formerly, now the Sauce Builder plugin, then export to code and replace quite a lot with calls to our own much-simplified API (often cutting out huge sections of test code & replacing with one call).

Updating the tests even when we make significant changes to the website is must easier because of this approach.

One issue we ran into quickly... tests need to verify _just one thing_ as much as possible, not long strings of actions that wander through the whole site. The problem is that there's considerable setup before testing that one thing -- creating users and getting them to the appropriate state, especially (worst of all when test cases require 3+ users to interact).

To address this I've set up some helper requests Selenium can make -- actions that aren't included in our production build -- to create/destroy test users of different types & in different states directly. I'm also thinking of adding a page that'll simply return a full dump of info on a given test user, so we can test that the end result of actions in the UI have resulted in the expected data.

It's all very much work in progress, but I'm convinced that with a little extra elbow grease added as pain points show up, we can keep a full suite of Selenium tests alive and useful.

</comment></comment></comment></comment></comment><comment><USER15> For Javascript testing, I really like JSTestDriver for automation and Sinon for mocking/stubbing.

I found bulky solutions like Selenium to be somewhat hit-or-miss and overkill for most tasks. It's very rare that with proper unit testing I really need a whole additional layer just to click around the site and make sure stuff is working as expected. Maybe some basic sanity checking, but it's really not my preferred way to think about testing--which of course is just a personal preference.

<comment><USER16> Same, I feel that if there is a good coverage from unit testing, then you should only need sanity checking. Furthermore, if you are using jquery (which itself is well testing on all the browsers), then you should have more confidence that your javascript will work (providing you're not using non- cross-browser javascript on top of jquery)

<comment><USER16> For reference, the list of tools and framework mentioned on this page can be found at <http://www.romku.com/list/343858/web-testing-framework>. Feel free to rate them and add any missing information.

</comment></comment></comment><comment><USER17> Having dealt with the Selenium and its frustrations in the past, I tend to outsource this sort of testing if at all possible. Some things can only be truly tested with eyeballs.

One tip I do have is to disable jQ animations during your test runs so you aren't having to jump through hoops in your test suite just to wait through animations -

jQuery.fx.off = true will do that.

<comment><USER18> This! Also, try to mock any setTimeouts and setIntervals so that they execute callbacks synchronously (i.e, timeout = 0).

</comment></comment><comment><USER19> Could try watir (<http://watir.com/>)

<comment><USER20> Watir is what Facebook use I think, it has plugin support for most of the major browsers and tests are fairly easy to write.

</comment></comment><comment><USER21> I use a custom selenium test runner that runs them in parallel (php). I plan on neatening it up and releasing it at some point if theres interest.

It also has a 'live mode' which is useful for writing up new tests. It basically follows a file and whenever there is a change it begins running the commands from that line onwards again. If it hits an exception it'll pause there and wait for you to fix the broken test/site before resuming.

<comment><USER14> I'd be interested as well.

I wrote a custom test runner as well, though not addressing the same issues; mine is specifically for _non_ automated testing. It's a Java GUI that lets you choose from all our existing tests, tinker with parameters, and run the test live in your own browser against our test server with a few extras (like stepping through the test, go/pause, run all tests in sequence, etc.).

It's partly to let our CEO really interact with our testing -- i.e, see what's being tested, and rapidly explore the site as a whole -- but also is pretty useful as a robot; i.e., when I want to register three new users to try something out, I don't have to do it manually.

</comment></comment><comment><USER22> Some things require manual testing. Animations and a lot of visual stuff needs to be analyzed holistically; there are sometimes visual quirks that are near impossible to write tests for but can easily be detected from someone quickly viewing the site.

Have different environments set up. After every big push, run through a simple user flow to make sure what the user will actually see is what you intended.

<comment><USER23> _After every big push..._

One way that I minimize my front-end testing liability is to do as few "big" pushes as I can. The safest change to make is the smallest change possible.

</comment></comment><comment><USER24> Check out Ghostbuster (<https://github.com/joshbuddy/ghostbuster>).

</comment><comment><USER25> Hmmm, I'm using Splinter (<http://splinter.cobrateam.info/>) to do tests. It lets you automate browser actions and much more, like execute javascript, find elements returned via AJAX, interact with forms, links and more... it has drivers for chrome, firefox... You shold to test it :)

</comment><comment><USER26> You could try with Jasmine, although it's not for this specific purpose...

And I agree with simplegeek, selenium should be fine in your case. Although can't imagine how you could test animations... :)

<comment><USER27> Jasmine isn't what you're asking for, but you should use it in addition to what you're asking for.

</comment></comment><comment><USER28> on a side note, do you people test graphics? I mean, it's kind of easy to say "I get a div #foo". But how do you check if it has the right shade of $color and a rounded corner and the text content is not overflowing the containing box?

I live in constant worry of changing css and totally screwing up a completely unrelated bit of the web app, and the usual thing I get told is "well, it's very fast to check if it still works", which reminds me of me not understanding why unit testing is useful.

<comment><USER29> Asking a computer to check aesthetics is start of your descent into madness. Use Selenium to check that links do what you expect, elements are loaded etc. Don't use it to check if a button graphic has the right icon loaded.

Computers are great at functional testing but you still a Mk1 eyeball to check aesthetics. Luckily, functionality is what your customers will really care about. No one will shout at you if an element is misaligned for a while before you catch it with manual testing

<comment><USER14> Side note -- I definitely agree about not using Selenium to check for alignment, images loading, etc..

But... it's pretty cool to have a single Selenium test that does nothing but zip through your site and show all of the unique views at rapid fire speed, so as soon as the page is loaded it has already filled in any relevant form and is loading the next page.

Make sure someone with good concentration sits and watches that test run once in a while; anything seriously wrong will pop out, and they can watch it zip along while taking a coffee break.

</comment></comment></comment><comment><USER30> For algorithms or application logic, even rather simple cases, unit tests are an absolute must.

For user interfaces, it's a lot more effort for a lot less return. YMMV

</comment><comment><USER31> Take a look at JsTestDriver, for hooking in to your CI system.

</comment><comment><USER32> you might want to check out SIKULI (<http://sikuli.org/>) - it's like python on top of a computer vision stack, so you can write code like click([part of a screenshot]).

</comment><comment><USER33> Selenium works fine for me.

</comment><comment><USER34> zombiejs?</comment>


Command-Line Tip: Put Down the Pipe - <AUTHOR> https://www.linuxjournal.com/content/put-down-pipe <comment><USER2> The `find ... | echo` and `find ... | rm` counter-examples are not right; neither `echo` nor `rm` read their arguments from stdin.</comment>


U.S. spies buy stake in Twitter, blog-monitoring firm - <AUTHOR> http://www.wired.com/dangerroom/2009/10/exclusive-us-spies-buy-stake-in-twitter-blog-monitoring-firm/

<comment><USER2> The headline at Wired...

 _U.S. Spies Buy Stake in Firm That Monitors Blogs, Tweets_

...is better. The version here ("U.S. spies buy stake in Twitter, blog- monitoring firm") makes it sound like In-Q-Tel invested in Twitter itself.

<comment><USER3> Yeah, this headline needs another hyphen: "Twitter-, blog-monitoring"

</comment></comment><comment><USER4> We're in this field as well and the number of people who have suggested we sell/licence our tech to government and police agencies is pretty surprising. I'm not down with that, ethically, but there's definitely a need for people who are.</comment>


Neovim: last day, U$ 1.000 to go for refactoring Vim into a library - <AUTHOR> https://www.bountysource.com/fundraisers/539-neovim-first-iteration?lastDay

<comment><USER2> Looks like it reached the $30k stretch goal. I look forward to seeing a vim library.</comment>


Diagrams: A brand new diagram editor for Mac - <AUTHOR> https://diagrams.app <comment><USER2> So as a long time OmniGraffle user this looks really nice, clean and simple. I've fallen out of love with OmniGraffle because I spend more time fighting it then I do working with it.

This also looks great because it's not a subscription. But it also doesn't have many features, which is why the price is so great.

What the site doesn't show is how much customization I can create. I might be showing my age, but I miss shareware, the ability to try a software out before I buy it. Of course I think I still have Q-Crack floating around somewhere so...

</comment><comment><USER3> The comparison to existing tools doesn't mention any of the other tools in this category, just tools in other categories.

<comment><AUTHOR> Hi, the developer of Diagrams here. I think your point is very valid and we'll consider adding this information. We can think of online tools like LucidChart and draw.io. What desktop Mac apps would you include in this category?

<comment><USER4> OmniGraffle [https://www.omnigroup.com/omnigraffle](https://www.omnigroup.com/omnigraffle)

</comment></comment></comment><comment><USER5> I really like the simplicity and the easy to use interface. My new way of creating value adding flowcharts.

</comment><comment><USER6> Fantastic! I've been waiting for this day since years.

I used the alpha and beta versions almost every day and love how professional the app got in 1.0

Bought it instantly. :-)

</comment><comment><USER7> lovely!</comment>


RailwayJS MVC Framework for Node.js - <AUTHOR> http://railwayjs.com/# <comment><USER2> I have written a few apps in ExpressJS and one of the things that I found annoying at first was how minimal and unstructured it was. I found a way of doing things in an organized manner that I like, so it has become easy to get things in my own structure. Perhaps that is the charm of Express, it gives you freedom to structure (or not) in the way you desire.

RailwayJS seems to provide a common structure to be used with Express. It does provide a lot, and a part of me feels that it provides too much. But you can always choose which parts to make use in your application.

I'm on the fence about if I would recommend it to a new Express user or not though.

<comment><USER3> There certainly is no shortage of other options:

[https://github.com/joyent/node/wiki/modules#wiki-web- framewo...](https://github.com/joyent/node/wiki/modules#wiki-web-frameworks- full)

<comment><USER2> It's like that with almost everything in node.js now...

<comment><USER4> Yeah and the problem is that you have to sort through tons of them to find the higher quality modules.

</comment></comment></comment></comment><comment><USER5> Why does everything else on the page say RailwayJS except the headline, which says "RightwayJS"?

<comment><USER6> Marketing mishap I'd guess. The tag line threw me off as well, "create NodeJS web apps faster with more energy, using RailwayJS". I don't like the idea of having to exert more energy. Or maybe they mean my app will have more energy.

<comment><USER7> It just remake of "Drink coffee, do stupid things faster with more energy". Actually major point is "faster", you shouldn't have exert more energy :)

</comment></comment></comment><comment><USER8> The big missing piece in Node is decent data mapping. Juggling looks like a good start and I'm glad the developer's separated it from the Rails project.

<comment><USER9> That and decent documentation. Just providing one or two super-specific, inconsistent examples[0], with bugger all explanation, and leaving the rest in an API doc that's _impossible_ to get any decent use of[1] isn't really enough. And Jade deserves a special mention for its pointless front page [2].

[0] <https://github.com/SpeCT/node-c2dm> [1] <http://mongoosejs.com/docs/api.html> [2] <http://jade-lang.com/>

</comment></comment><comment><USER10> Use express</comment>


The Case for Clojure - <AUTHOR> http://codetojoy.blogspot.com/2009/05/case-for-clojure.html

<comment><USER2> 'At NFJS shows, a common question is "I only have time to learn one new language on the JVM: which should I pick?".

The easy answer is true: it doesn't matter. Just pick one already!'

So what is the 75% answer to "which other JVM language should I learn?"

I figure it's either Clojure or Scala, but not sure which one. I prefer Clojure and it seems to get a lot of buzz on HN and proggit, but Scala might be a more straightforward "upgrade" path from Java, and might have more users.

<comment><USER3> I'd say Clojure. Clojure is very small (Scala seems quite complex).

The concurrency support is fantastic. I've never really had the patience to understand programming for multiple processors in other languages because of the complexity of locks. Clojure has lockless concurrency (via STM)- writing applications which take advantage of multiple processors is trivial!

The following shows easy it is to split work between two cores (if you have them). This code counts to 250,000,000 but does so on two separate threads. It takes half the time of performing the operation on a single core.

(def agentA (agent 0)) (def agentB (agent 0))

(defn my-inc2 [v] (loop [x 0 result v] (if (= x 125000000) result (recur (inc x) (inc result)))))

(defn split-my-inc2 [] (send agentA my-inc2) (send agentB my-inc2) (await agentA agentB) (+ @agentA @agentB))</comment></comment>


Hospitals Give Tech Giants Access to Detailed Medical Records - <AUTHOR> https://www.wsj.com/articles/hospitals-give-tech-giants-access-to-detailed-medical-records-11579516200 <comment><USER2> [http://archive.is/aBOBl](http://archive.is/aBOBl)</comment>


Verizon Droid Quick Review Plus Comparison with iPhone - <AUTHOR> http://www.danielfischer.com/2009/11/07/verizon-droid-quick-review-plus-comparison-with-iphone/ <comment><USER2> The main competitive advantage of the iPhone is not the features. It's the overall polish and UI.

<comment><USER3> Agreed. I haven't held the Droid, but most video reviews of the interface reveal a need to re-click items and a delay in scrolling/reacting to touch commands. That's my impression anyway. This doesn't happen with regularity on the iPhone.

I'm not saying this is a show-stopper; Android will get there. What's amazing, however, is that we're almost 3 years past Steve Jobs' first demo of the iPhone at Macworld, January 2007. I still can't believe how well they nailed it, first time.

I own an iPhone, but I love the open nature of Android. Whatever the Droid may lack in fit and finish it is going to be more than made up for by the degree of control it places in the owner's hands.

<comment><USER4> > _What's amazing, however, is that we're almost 3 years past Steve Jobs' > first demo of the iPhone at Macworld, January 2007. I still can't believe > how well they nailed it, first time._

Let's not forgot that many features were missing from the initial iPhone release, and that there were rumors of the iPhone for years (i.e. how long were they working on it pre-release?). I imagine that the internals could have been a mess too; there was no SDK for that initial release other than "Use AJAX and Safari to make _Web Apps_ for the iPhone! Yay!".

<comment><USER5> Well it's obvious that in the balance between look & feel and features, Apple went with the look & feel with the goal of features later.

That turned out to be a good choice.

</comment></comment></comment></comment><comment><USER6> I was surprised by this conclusion: "I'd say [the Droid] is definitely the second best phone on the market..." It seemed to me that his points added up to it being better. The only one that was a solid win for the iPhone was the camera.

<comment><USER4> I read another review that put the browser performance as better on the iPhone.

</comment></comment><comment><USER7> Having written apps for both iPhone and Android I rate iPhone over Android - around 10x better - both as a user and as a developer.

<comment><USER8> Could you expand a bit on that statement with regard to development?

</comment></comment><comment><USER9> Woah... I'm surprised one of my posts is on hacker news. WTF? That makes the geek inside of me want to throw a party. I'll clear up some questions that were asked here...

 _I was really shocked to see "danielfischer.com" when I loaded up news.ycombinator.com as per my daily schedule..._

</comment><comment><USER10> I'm not sure what he's complaining about with the Droid camera. It looks like it's just using a different white-balance setting than the iPhone.

<comment><USER11> I don't think he was complaining about the quality (although for a 3+ MP advantage I wouldn't be proud of those shots).

 _To my eyes… they're roughly the same quality once taken. And if I'm not mistaken the 1st gen iphone is a 2.0 megapixel camera and the droid is 5 megapixels. Yeesh that's embarrassing._

Reports have complained that the Droids camera takes ages to open, shoot, and process. I'll bet that's what he meant when he said it really sucks. That would make sense, given that the device must process a lot more to take in all 5MP. Hopefully they'll refine this process in the future for faster shots.

<comment><USER12> Is there any hope that someday people will stop to think that more Mpx is more quality? It's just bigger size, that's all. And if more Mpx are crammed on the sensor of the same size, that usually means more noise too.

<comment><USER13> Right but you get better quality in two scenarios:

1) take two pictures of the same size yields a better result with more megapixels

2) taking a larger sized picture on a camera with more megapixels and scaling it down yields a better result than taking a picture at the scaled down dimensions with a lower megapixel camera

<comment><USER14> I don't think so. A high noise shot scaled down still will have a bunch of noise in it. Double the pixel sensor size and you get a much better picture, in my experience.

For example: HD video cameras. They look like crap in the dark, even at YouTube dimentions. My Flip video SD beats them hands down.

</comment></comment></comment></comment></comment><comment><USER15> there's a bug in the droid camera focus software (so should be fixable OTA).

<comment><USER16> Its a very simple bug, and _will_ be fixed via an update not sure when that will be though.

</comment></comment><comment><USER17> wait, so verizon is actually allowing the google maps gps app for free?

<comment><USER18> Yep, works well (got me from the VZW store to my house without trouble ;) )

</comment></comment><comment><USER19> Dan Fischer's still around! Small Internet: I used to be a moderator on a forum he owned.

<comment><USER9> Ha hey! Which mod were you? :)

<comment><USER19> Hey! Geez, you've been here longer than I've been.

I was on Writer's Beat. I think David/TGO introduced me to it? I just went on and checked how it today, out of curiosity: I was ronoxq.

<comment><USER9> Oh, hey! I remember you.

I sold WB a lil' while ago... what are you up to these days?</comment></comment></comment></comment>


A network of homes for Nomads - <AUTHOR> Http://www.nomadnest.org <comment><USER2> This project looks awesome. I´m a digital nomad from Canary Island, and I really like it. What I like is to go to cities and have everything ready to start with the good and important things from the city.

</comment><comment><USER3> Cool and inspiring project. I feel so jealous about have such a wonderful experience!

</comment><comment><USER4> Kudos for all the team for such a great idea!

</comment><comment><USER5> Awesome!

</comment><comment><USER6> This is a wonderful idea!</comment>