News for hackers. Stuff that matters.

dbkaplun

Re:Not invented here, revisited on Friday July 27, 2018 @08:58PM (#17630819)
For me, reusing widely used code that's heavily tested is preferable to the liability of handwritten code. If I'm given the opportunity, when possible, I'm going to choose the former.
React is a view library. It keeps the page to date with your data, much like Vue or Angular.

jQuery is a DOM manipulation library, so in a sense it is lower level than React. It abstracts the DOM implementations across browsers to provide a unified interface. It lets you do things like animations, and find element dimensions in a cross-browser way.

Today, developers are choosing React because it more closely aligns with the needs of modern webapps. Most browsers have become more standards-compliant so jQuery is not such a necessity anymore. React is a fast and readable library to keep your page up to date with your data.

Re:Fun with SQL: Window Functions in Postgres on Monday June 04, 2018 @05:02PM (#17232422)
There's a nice set of challenges for learning window functions and testing your window function knowledge: https://www.windowfunctions.com/
Re:Show HN: How to Tune a Guitar on Tuesday May 08, 2018 @03:47PM (#17024197)
> The big problem with trying to tune a guitar that way is that you're tuning a guitar so it's in tune when you don't press the strings, but then when you actually play it you do press down the strings.

When you press the strings, they will all press equally, playing a correct relative tune.

Re:Show HN: How to Tune a Guitar on Monday May 07, 2018 @08:02PM (#17017573)
> Any slack present in the string winding can cause the string to go out of tune easily if you loosen the string to the correct tension.

You can get around that by using harmonics. Because you play harmonics without pushing all the way down, you can achieve a more precise tune.

The strongest harmonic is achieved when you gently place your finger on the string directly over the metal fret. A harmonic can only be achieved when you do not press the string all the way down into the fret.

The harmonic on the 7th fret of one string is the same note as the harmonic on the 5th fret on the next higher string. This is true for all consecutive string pairs other than (G, B).

You can tune using these pairs of harmonics to tune more precisely than pressing all the way down.

You will need to tune the (G, B) pair without harmonics.

The article is short and cursory. It can be summarized with the following excerpt:

> Zcash uses zero-knowledge proofs to guarantee that transactions are valid despite the fact that information about the sender, the recipient, and the amount transacted all remain hidden. The power of the idea has major banks interested. JPMorgan Chase recently worked with Zcash to add zero-knowledge functionality to its own private Ethereum-based blockchain.

Re:The Great Theorem Prover Showdown on Thursday April 26, 2018 @08:59AM (#16931438)
> Fulcrum. Given a sequence of integers, returns the index i that minimizes |sum(seq[..i]) - sum(seq[i..])|. Does this in O(n) time and O(n) memory.

This is doable in O(n) time and O(1) memory. Sum the list once. Then start from the beginning, collecting a running total and subtracting from the sum for a running difference.

Perhaps China is advertising this to deter crime, as a potential criminal might worry about facial recognition before doing something illegal.
Re:RFC 7858: DNS over TLS (2016) on Tuesday April 10, 2018 @07:44AM (#16800599)
I found this guide (with slight modifications) helpful for setting up stubby as a localhost DNS resolver to proxy through 1.1.1.1 with DNS-over-TLS on macOS: https://medium.com/nlnetlabs/privacy-using-dns-over-tls-with...
Re:JavaScript 2017 Rising Stars on Saturday March 17, 2018 @11:35AM (#16607397)
jQuery's bread and butter is DOM manipulation. However, for even moderately small use cases (even an interactive form) it is useful to use React, Angular, or some data binding framework, as state changes in jQuery quickly become unmaintainable.
Re:Key Git Concepts Explained the Hard Way on Wednesday March 14, 2018 @09:43PM (#16589938)
GitUp[1] is an excellent alternative to gitx and ungit, for those unhappy with either.

[1]: https://github.com/git-up/GitUp

Re:Hashgraph: Fair, Fast, Secure Distributed Concensus on Thursday December 21, 2017 @10:01AM (#15979150)
Here's a link to the graphical explanation listed: http://www.swirlds.com/downloads/SWIRLDS-TR-2016-02.pdf
slap[0] (the terminal-based text editor) was designed to emulate Sublime's UX within the terminal. It has a shallower learning curve than other command line editors.

[0] https://github.com/slap-editor/slap

Re:Ask HN: What do you use in your New Tab window? on Wednesday May 17, 2017 @07:59PM (#14363874)
Along with New Tab iFrame[0], I use TabTerm[1] for a terminal in the new tab page.

[0] https://chrome.google.com/webstore/detail/new-tab-iframe/pjj...

[1] https://github.com/tabterm/tabterm

Re:Making a good diff algorithm on Wednesday March 29, 2017 @12:50PM (#13988136)
Another useful quality of a diff algorithm is being able to understand and detect moves. This is not commonly implemented but one real-world example is https://www.semanticmerge.com/.
Re:Ask HN: Is web programming a series of hacks on hacks? on Monday September 12, 2016 @01:55PM (#12481992)
- "test".match(/st$/)
Re:The Advantage of Abundant Thinking on Wednesday April 20, 2016 @02:53AM (#11532695)
The author clearly doesn't practice abundant thinking, as the title should be "The Advantages of Abundant Thinking".
You can use otool to see what libraries a program uses:

  $ otool -L /Applications/Utilities/Activity\ Monitor.app/Contents/MacOS/Activity\ Monitor
  /Applications/Utilities/Activity Monitor.app/Contents/MacOS/Activity Monitor:
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1153.20.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1348.13.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57031.30.5)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/PrivateFrameworks/GraphKit.framework/Versions/A/GraphKit (compatibility version 1.0.0, current version 25.0.0)
	/System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation (compatibility version 1.0.0, current version 55126.0.0)
	/System/Library/PrivateFrameworks/CrashReporterSupport.framework/Versions/A/CrashReporterSupport (compatibility version 1.0.0, current version 631.0.0)
	/usr/lib/libsysmon.dylib (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/PrivateFrameworks/NetworkStatistics.framework/Versions/A/NetworkStatistics (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1153.18.0)
	/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 600.0.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 62.0.0)
And for top:

  $ otool -L $(which top)
  /usr/bin/top:
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1151.14.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
	/usr/lib/libpanel.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
	/usr/lib/libutil.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)