3,325 karma · joined May 18, 2011
@RobertElderSoft
I actually prefer useless cat because when you're prototyping a pipeline it's very awkward to use non-useless cat. You'll probably start off with something like this to observe the content of the file:
cat something.txt
Using this doesn't work in bash: <something.txt
Then, continuing with useless cat to build on it you do cat something.txt | grep stuff
Which you can type easily from using 'up' in your terminal. But if you use non-useless cat you have to re-type the entire thing or move the cursor around: grep stuff < something.txt
With useless cat, you can keep adding things and check the result: cat something.txt | grep stuff | sed 's/"//g'
Or if you need to insert another filter before the last stage like this, you can just press "up" and insert it: cat something.txt | grep -v negmatch | grep stuff
I don't think there is any easily-typed equivalent workflow with non-useless cat.I think there are still a few improvements that could be done the the Myers algorithms. One specifically, is that I'm pretty sure it's tail recursive. You won't get any big O improvements off of that, but less stack space is still an improvement. Plus better cache locality. I'd work on some demos, but too many things to do these days...
Like someone else said, I think the key is that you're not getting the shortest edit script, you're just getting a edit script.
Interestingly, even git's implementation of diff (which uses a variant of the Myers Diff algorithm) doesn't actually find the shortest edit script by default. It has a hard-coded heuristic that just quits early if it finds a 'good enough' solution:
https://github.com/git/git/blob/master/xdiff/xdiffi.c#L143
Same this for unix diff (unless you specify the commandline flag to find shortest):
https://github.com/Distrotech/diffutils/blob/distrotech-diff...
Having said that, if you're still confident that you've made an improvement, you can port the function to python and try it out as a test case in my unit test file that I wrote when I developed my variant of the Myers Diff algorithm:
https://github.com/RobertElderSoftware/roberteldersoftwaredi...
On that topic, I'm pretty sure my variant of the Myers Diff algorithm is actually slightly faster/uses less memory than the original (I'd be happy to be proved wrong). At least, I've had my blog post up for a few years and no one has corrected me, but then again, I think the original paper has a few mistakes/obvious flaws and it still has hundreds of citations and no one has written much about improvements.
https://www.youtube.com/watch?v=1BB6wj6RyKo
It reminds me of the 'cinco' product line:
https://www.youtube.com/watch?v=TSwqnR327fk
I do have it already linked in the article, but I should point out that the work I did is based upon the work of (at least) several other key individuals:
A lot of the low-level sensor interaction code is found in:
https://github.com/Hermann-SW/fork-raspiraw
Also, check out his web site with lots of other high speed camera hacking stuff:
https://stamm-wilbrandt.de/en/Raspberry_camera.html
The original fork of raspiraw is (I think) found here:
https://github.com/6by9/raspiraw
And the code for converting RAW images into standard formats uses dcraw:
https://en.wikipedia.org/wiki/Dcraw
I didn't personally write much code to put this together. I would say that my contribution here was mainly to pull together some impressive work done by others that wasn't getting much attention and market it well. Hopefully some of you get ideas and push this even further.
[32] But I must explain to you how all this mistaken idea of denouncing of a pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?
[33] On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse.
https://www.patreon.com/RobertElderSoftware
If you've ever seen my blog posts show up here on hn and you'd like to see more of them, then this is one way to make that happen more often :)
Remote: Yes, but I can meet in person if you're in the Kitchener/Waterloo area.
Willing to relocate: No.
Technologies: HTML, CSS, Java, C++, C, Python, XML, JSON, apache, tomcat, Mysql, Postgres, Javascript, react.js, embedded systems, compilers, servers, OS dev, Linux, Unix, bash/shell, AWS, PHP, raspberry pi, arduino, ESP8266, git
Anti-Req Technologies (technologies that I don't do): Microsoft products, .NET, C#, node.js, npm, nosql, Mac OS, mobile apps.
Résumé/CV: http://blog.robertelder.org/
Email: robert@robertelder.org
I do contract-based consulting/software development for startups in the Kitchener/Waterloo area. I am looking for non-exclusive part-time engagements. I have previously taught courses in operating systems, algorithms, and web development part time at Conestoga College ~2015-2018. I frequently write blog posts and submit them to a neat site I found called 'Hacker News': https://news.ycombinator.com/from?site=robertelder.org
echo 'int my_func(int i, int arr[*]);' > main.c
gcc -c -std=c99 main.c
-- * observe that there are no errors * --
See 6.7.5.2 Array declarators for details
http://port70.net/~nsz/c/c99/n1256.htmlEdit: I can't figure out how to escapse an asterisk, so the above might not read correctly but I tried.
For example, the article states "In other words, all a lens system can do is make every line of sight end on the surface of a light source, which is equivalent to making the light source surround the target."
If you forget about optics for a second, imagine that the outer surface of the sun were wrapped around a point (think of the image shown in the article). If you consider conservation of energy for the energy flux from the surface of the sun being entirely directed to a single body of matter that absorbs this heat (assume it's a penny), the steady-state blackbody emission of the penny would have to equal the energy flux from the entire surface of the sun. I think this situation would end up making the 'temperature' of the penny much higher than the surface of the sun for the same reason that the center of the sun is hotter than the surface: There is energy expended, and it comes from the fusion of light elements inside the sun, so there is no violation of entropy as stated in the article: "you'd be making heat flow from a colder place to a hotter place without expending energy."
Geoff Hinton, The Next Generation of Neural Networks (2007): https://www.youtube.com/watch?v=AyzOUbkUf3M
I watched that talk probably 10 times after it first came out and wrote some visual basic stuff to try and replicate his results.