HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
3D engine on MS Excel - without vba

c bel · Youtube · 106 HN points · 3 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention c bel's video "3D engine on MS Excel - without vba".
Youtube Summary
This demo is from my own work on Excel.

The game provide theses functionalities :
- infinite procedural generated maze map
- real time ray tracer rendering
- occlusion calculation
- basic illumination rendering
- illumination and compute shader
- natural displacement engine
- No macro at all used by the 3D engine,
* to enjoy the game using key press, some macro trigger the displacements, using just one simple copy instruction.

Details here : https://www.gamasutra.com/blogs/CBel/20180208/308549/3D_engine_entirely_made_of_MS_Excel_formulae__Enjoy_this_Doomxls_file_.php

You can freely download the file and test it by yourself :
http://public.cbel.free.fr/?file=Doom.xls-Buttons-v1.1.xlsm

HD version :
http://public.cbel.free.fr/?file=Doom-HD.xls-v1.1.xlsm

The music is Danse macabre, from Camille Saint-Saëns
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
I'm surprised it wasn't already Turing complete, considering someone made a first-person shooter (albeit a crappy one) in it.

https://youtu.be/iCeOEQVUWZ0

Jun 26, 2019 · 102 points, 7 comments · submitted by trueduke
bschne
For another completely insane but kind of fun way to abuse an office application, see "On The Turing Completeness of PowerPoint" [1].

(Gwern has a whole list of accidentally/surprisingly turing-complete things at [2])

1. https://www.youtube.com/watch?v=uNjxe8ShM-8

2. https://www.gwern.net/Turing-complete

ummwhat
This will make a nice addition to my office computing playlist

https://www.youtube.com/playlist?list=PLjIYRqpIFecpDSXqCOddU...

Mister_Snuggles
My favourite (ab)use of Excel, which is already on your list, is using it for HDR photography[0].

While I'd never use it for day-to-day anything, things like this are a really interesting way to show how things like HDR photography actually work. Excel can be very approachable for stuff like this.

[0] https://www.youtube.com/watch?v=bkQJdaGGVM8

duck2
This is a raycaster, which projects 2D space to 2D space, but still cool I guess.
Tetris1
Why...
darkpuma
If you have to ask a question like that, it's doubtful that you'll comprehend the answer: Fun.
gchadwick
Because the person who did it found it fun to do? I believe the site is called 'Hacker News' not 'Sensible and Useful Engineering News'
CamelCaseName
Wow! This is really neat.

Another project watchers might find interesting is the top post on r/Excel, where someone made a video player in Excel because his machine was completely locked down.

https://old.reddit.com/r/excel/comments/2jtd2f/worked_on_a_c...

wil421
If my employer tracked processes it would look like I was in Chrome 90% of the day and 10% Sublime Text. Even though my work in Chrome would be testing, configuring, and deploying to the app I support. With googling mixed in.
Apr 11, 2019 · peteforde on JQuery 3.4.0 Released
While I respect that this comment is an expression of your lived experience (after all, I used the word believe so this is fair game) I am compelled to point out that when you say "of what you would need with jQuery", what you really mean is "what I would need with jQuery".

You know how there's ~3 kinds of Excel users? You have your formatted rows and columns types, people like me that can use SUM(), call APIs and know what pivot tables are... and then there are those ninjas that can implement ray-traced dungeon renderers in a cell. https://www.youtube.com/watch?v=iCeOEQVUWZ0

I'm not exactly claiming Carmack-level jQuery proficiency, but comments like yours make me wonder (optimistically) whether you've forgotten all of the amazingly useful things that jQuery can do. Ajax, selectors and CSS transitions are the Nickelback of creative possibility.

As a final note, I am excited that things which once required jQuery are now being solved by the browser and the evolving EcmaScript standard. Ideally, jQuery continues to get smaller and smaller. However, it's intellectually dishonest to claim that all of the non-jQuery techniques are as ergonomic to implement as jQuery idioms. Proof:

http://youmightnotneedjquery.com/

I do really like fetch and async/await in general, and working in React has taught me lots of cool tricks to bring back to my real projects. I think everyone should try to build something real with React, just to understand how lucky they are to have the option not to use it.

revvx
> I'm not exactly claiming Carmack-level jQuery proficiency, but comments like yours make me wonder (optimistically) whether you've forgotten all of the amazingly useful things that jQuery can do. Ajax, selectors and CSS transitions are the Nickelback of creative possibility.

It's been several years since I last used jQuery, but what are those other useful things that are hard using Vanilla.js? (Legitimate question, not being sarcastic here)

holoduke
Dom regex selectors. jQuery has extremely powerful and smart ways of retrieving elements that way.
rajangdavis
I feel as though that if you need regex selectors, there is something wrong with the structure of your HTML.

Can you tell me which use case you would need to do this? I don't think there is anything wrong with this functionality, but it seems like if you needed it, that your HTML is needlessly complex.

DCoder
I'm not the parent poster, and I'm not sure if these are the regex selectors they had in mind, but nonetheless.

An example use case: the person writing the HTML ≠ the person writing the selectors. Browser extensions like Stylus, for example. If the HTML author did not bother to add a specific class you need, you have to resort to ugly methods.

In fact, this is a scenario I deal with regularly. I have a Chrome extension for video download sites that scans the current page for metadata (title, performers, release date, etc.) and decorates the download links with `download="…"` attributes, so that I can download a file with a properly formatted filename. I manually adapt this extension to every site I need, and quite often I need things like `a[href^=/model/]` † to distinguish links to performers from other links to get their text content. It's clearly not a situation the site authors worry about, and that's fine as long as I have a way to do this myself.

† This particular selector can be done without jQuery if you don't care about backcompat. In browser extensions, you usually don't. But it's still an answer to your question about when such selectors are needed.

---

Since I'm talking about this, that same browser extension can demonstrate some other complications brought on by React and CSS-in-JS:

1. CSS-in-JS turns class names into unreliable gobbledygook, so extracting metadata means more regex selectors and abominable DOM hierarchy selectors (`section>div>div:first-child>div` because nobody bothers with semantic <h2> or even .title anymore).

2. React makes DOM elements vanish and reappear instead of just hiding them, so that `download="…"` attribute I want to add has to go through a MutationObserver instead of just running once on page load.

asoo
`document.querySelectorAll('a[href*="model"]')`
peteforde
Your point #2 is one of the main reasons React is far-less creatively flexible than DOM manipulation. I'm surprised that this doesn't come up far more often.
peteforde
Great question! I hope that I can give a good answer. When I stopped to think about how to answer, I found myself challenged to compose my thoughts because I have to unpack specific features from the context I use them in; the context frequently informs the way I use various patterns and jQ functions together to achieve an end result.

However, there are some jQuery functions that I use all of the time:

$.closest() and less frequently, $.parentsUntil()

Not just $.siblings() and $.next()/$.prev(), but $.nextAll() and $.nextUntil()

$.getJSON()

$.toggleClass()

Deep extend via $.extend(true, {}, objA, objB)

jQuery's custom event triggering is A+

$.delay()

$.end()

Consider this a solid starting point for further exploration.

dccoolgai
Don't forget some of the higher-level utilities like $.Deferred (which imho is still easier to use than promises) and $.Callbacks . Those two were always criminally underrated and underused imho.
revvx
Great answer likewise! Some of those are really cool indeed!

Deep copy/deep extend is a must in every programming language ever. I have no idea why 90% of the environments I ever programmed with make it so damn hard to deep copy data. In javascript it is kind of comical. [1]

Traversal utilities like closest/parentsUntil/nextAll/nextUntil is something I miss in most standard libraries. No for DOM manipulation, but for traversing lists and such. Until/while idioms are par for course in imperative contexts but I miss them in functional programming contexts. Not that they're that hard to implement with a couple lines :)

Delay is further proof that the jQuery API design is nothing short of amazing. I wish more APIs were like that. The only thing that comes close to me, albeit in a completely different domain, is LINQ.

I had no idea about End. That's point-free programming black magic. [2] Love it.

[1]: https://stackoverflow.com/a/5344074

[2]: https://en.wikipedia.org/wiki/Tacit_programming

peteforde
Building on what you said, I would love to see more powerful node traversal functions make their way into every environment I work in. It's something worth making a push on. Moving around a tree can be a joy, and it unlocks many solution domains that might not cross your mind if you're not thinking about them.

One traversal mechanism I'd love to see but I've never seen implemented coherently is... given my relationship to ancestor X, iterate through all my antecedent peers under x. This would make processing some kinds of structured data far simpler.

End really is one of those hats-off bits of magic, and it's one of the first things that come to mind when any of the frothing haters pen statements that preclude anything good coming from method chaining. It'd be even better if ES supported Ruby-style send syntax eg. array.map(&:to_s). And yes, I put it last because I was going for clever.

You know what drives me even more crazy than ES' lack of deep copy/extend? How is it possible that ({k: 1} === {k: 1}) is false? I find this to be maddening. Thank goodness for lodash.

darepublic
Your object equality example is neither maddening nor unique to JavaScript imo
peteforde
$ irb2.4.1 :001 > ({k: 1} === {k: 1})

=> true

I don't get it. Why would you not want this? And when you're used to it working, how could missing so common and logical not be maddening? When does the maddening kick in... before or after I have to install lodash for comparing objects?

Are you busting me on semantics? Do I literally have to check into a mental health care facility after not being able to natively compare simple ES objects to satisfy you?

darepublic
I guess it's not maddening to me because I was used to this from C. Two pointers which resolve to the same value and type will still not be equal in an equality expression if they reference different addresses. But to me it's good that {k: 1} !== {k: 1}, because if this evaluated to true I would have no way of determining an object's true identity, which is often more relevant than the value it contains.
peteforde
You make a (several) good points. I primarily work in Ruby and it's true that comparing a potentially complex object like a hash based on whether it serializes identically essentially means that you're comparing by value instead of reference. Depending on what you're doing, that's either really convenient or a nightmare. Ruby seems well adjusted to tasks where accessing a hash as a value is a feature and not a bug.

And for those times where you're interested in comparing instances of a hash, every instance of an object has an object_id getter:

a = {k: 1}

b = {k: 1}

a == b # true

a.object_id == b.object_id # false

Of course, this is a lot of typing, so Matz also gave us:

a.equal? b # false

Ultimately, this is what I love about the diversity of a pluralist language ecosystem. The polyglots will always win.

revvx
> One traversal mechanism I'd love to see but I've never seen implemented coherently is... given my relationship to ancestor X, iterate through all my antecedent peers under x. This would make processing some kinds of structured data far simpler.

That sounds really simple to achieve with with a (lazy) function that returns a list containing all ancestors of a tree, and then a "until" or "up to" function that returns everything from that list until a certain condition is met.

Those are things that should be included alongside Map and Reduce :)

> How is it possible that ({k: 1} === {k: 1}) is false? I find this to be maddening. Thank goodness for lodash.

Oh, I strongly agree. And lodash should be the standard library of the language. Not only of Javascript, but most languages out there.

> End really is one of those hats-off bits of magic, and it's one of the first things that come to mind when any of the frothing haters pen statements that preclude anything good coming from method chaining.

About End (and point free style in general), I understand why people might dislike it, but then again, I think it comes down to familiarity. After ten years of exposure to LINQ, Haskell, underscore/lodash and FP in general I also find it super hard to follow code that uses for/do/while in overly clever ways (my own C code comes to mind).

I think I find it easier to see code as a "graph" rather than assigning something to a temporary variable, and that's what End allows me to.

ricardobeat
> http://youmightnotneedjquery.com/

The examples in the site already look quite outdated. We now have `fetch()`, `.attachEvent` is all but dead, plus all the ES6 features like arrow functions, destructuring, spread... and reactive UI means you'll rarely, if ever, need to call DOM tree modifying methods yourself.

The best part, "Reactive UI" being a paradigm, you have many other options besides React+JSX, for example https://github.com/jorgebucaran/hyperapp. At a fraction of the size of jQuery, which one is the 'monster'?

peteforde
I can't speak for the others, but when I talk about Reactive monsters, I am talking about needless complexity - both in setup and in usage.

I believe that the relative size of one library vs another (even outside of the reality of caching CDNs) is an unhelpful distraction from the bigger discussion around who should consider using which tools for which jobs, when.

The applications I'm working on are typically for people with usable broadband connections. If you build your site/app correctly, the pictures that are embedded in your content are often bigger than any of the libraries you could choose. However, it's the general responsiveness of your experience that people will judge your speed or "nativeness" by.

I do agree that the examples on the site are somewhat outdated, but the fact remains that there are a lot of nice things to say about that dang left column, with its predictable, intuitive and impressively terse invocations.

ricardobeat
I worked for ~8 years using jQuery. It was an immense step forward in the early years, but these days I find the complexity of imperative code and juggling state from multiple sources a lot worse than the ‘complexity’ of a 100-line diff & patch algorithm that lets me simply redraw the whole world from state. And in the event I need to manipulate the DOM, the native APIs are now good enough, a couple extra lines are worth not having an extra dependency - jQuery’s (and zepto and so on) utility is diminished.
rajangdavis
It might be the case that how I use javascript is Nickelback-level coding; however, it pays the bills and to be frank, I don't miss using jQuery. I don't need my day job to validate my creativity.

I don't use React/Vue/Flavor-of-the-month UI library for my day job; however I don't use jQuery either.

I am not trying to shit on what can be accomplished with it; however, I debug a lot of code that adds it in where ES6/vanilla javascript does the same thing. I guess I prefer verbose javascript over using jQuery... not trying to knock on it, but it might be worth looking at other tools for the long term.

Edit: To be clear, I am not advocating to rip out jQuery fron existing apps. In a lot of cases, jQuery and jQuery plugins are helpful, but most of the code that I am paid to debug ends up being rewritten in vanilla js because I feel comfortable using that. I stopped using jQuery a while back because I opted to use a UI library a while back and worked hard to avoid jQuery ever since even though I don't use UI libraries at my current job.

Use whatever tool floats your boat and doesn't piss off the rest of your team. It's possible to ship spaghetti code in any flavor you want. I happen to (currently) work on things where the level of complexity of the UI is simple enough to use vanilla JS and not need a UI framework.

peteforde
I don't understand why this comment was down-voted; this is a completely reasonable perspective. Plus, it reminds me that I'm lucky in the projects I typically get to work on, that they still allow for creative coding in many moments.

If coding is your day job and you work on corporate applications, it's likely that you're on a team big enough to start discussing how things like React might be necessary and valuable.

If you're building a linear CRUD application, you probably still don't need Reactive frameworks, but you're in the right ballpark to be talking about it. Otherwise, history will not be kind.

marvindanig
And what do you do about accessibility? Working with jQuery makes sure you have a baseline default that's always accessible. Also, jQuery is not backed by a terrible organization with a questionable record, even evil intent.

I love jQuery and will switch for vanilla JS only when it's okay to do so, like when support on old browsers isn't that much of a priority.

rajangdavis
I use vanilla js for WCAG compliance; however, I only need to focus on IE11+ for most work because TLS 1.2 support is mandatory for the sites I support.
porker
> Ajax, selectors and CSS transitions are the Nickelback of creative possibility.

And the jQuery Ajax methods are super-handy. POST with the fetch API is long-winded; while the jQuery promise-handling sucks, it was enough to make me use $.post() in the current project.

bmn__
> while the jQuery promise-handling sucks

You don't need to use that API. Deferred is compatible with Promise, you can just simply `await $.post()` etc.

See last section of http://api.jquery.com/jQuery.Deferred/

porker
Awesome thank you, I didn't know this!
EB66
youmightnotneedjquery.com is often held up as an example of why jQuery is obsolete, but if you look at the examples a bit more closely, you'll notice problems.

I spent all of five minutes glancing through the example list and noticed their `replaceWith` doesn't provide the functionality that jQuery offers -- it doesn't take into account event handlers bound to DOM elements. Also, their `extend` does a shallow merge, not a deep merge. Furthermore, the YMNNJ examples are often far more verbose and less expressive than the jQuery examples.

I don't particularly understand the rush to rip jQuery out of everything. It seems like a lot of people are doing it just because it's the trending thing to do. There are some things that jQuery does very well -- even in today's world where modern web dev is dominated by SPA components.

I'm the maintainer of https://github.com/elliotnb/observable-slim and https://github.com/elliotnb/nimbly -- the latter of which is an SPA component framework whose core requires jQuery. It uses jQuery to update DOM nodes with `replaceWith`, merge deeply nested objects with `extend`, among other things. Nimbly components are not required to use jQuery -- only the framework core uses it. Aside from the eliminating the extra 69KB footprint from adding jQuery slim min, I don't see any reason to rush to rip jQuery out of the Nimbly core. On the contrary, using jQuery helped us get the framework built faster and helped us keep the code expressive and easy-to-follow.

Bahamut
For reference, jQuery is bigger than AngularJS - let that sink in.
bauerd
Your users likely already have jQuery in their browser cache, given it's loaded from one of the public CDNs.
ndnxhs
This gets posted a lot but there are so many versions of jquery on so many different cdns that very rarely is it the case. I saw some research on it and it was in the single digit percentage of times.
austincheney
Which version and which CDN? Assuming the user's cache for a non-archival product sounds dubious.
GordonS
There are only a handful of major CDNs, and jQuery has been at the same version for a very long time.
vanderZwan
This is a bit disingenuous without actual numbers: jQuery minified is 83 KiB, 30 KiB transferred with gzip. The new slim version knocks that down to 70 and 24 KiB, respectively.

For almost any website that has actual use-cases for it, it's not going to be the data bottleneck. Plus most websites have way more severe bloat elsewhere to worry about

masklinn
> youmightnotneedjquery.com is often held up as an example of why jQuery is obsolete, but if you look at the examples a bit more closely, you'll notice problems.

Surely that's their entire point? They provide the link as evidence that

> it's intellectually dishonest to claim that all of the non-jQuery techniques are as ergonomic to implement as jQuery idioms

Not as evidence that you don't need jquery.

peteforde
You could be right... but you're definitely the first person I've seen suggest this. It would be a Sixth Sense twist, given the domain name.

youprobablystillwantjquery.com is still available at the time of this writing.

extra88
I took masklinn's comment to mean that your point in sharing the youmightnotneedjquery.com was to show evidence of problems using vanilla JS instead of jQuery, not that that's the point of the site existing.

The site has plenty of examples of vanilla requiring writing multiple lines compared to one jQuery line, which I took to be your point regarding "ergonomics." EB66 seems more focused on a subtler point regarding the site, that their vanilla examples don't do everything the jQuery version does.

peteforde
I like your reading better than my own. I've re-read a few times and it's still written in an ambiguous way, so I don't feel completely silly.
EB66
> Surely that's their entire point? They provide the link as evidence that.

I'm not following your point. The point of YMNNJ is that you can use their examples to quickly replace bits of jQuery code. I've identified that a few of their examples (possibly more) are not equivalent replacements -- demonstrating that jQuery is indeed needed.

Your second quote doesn't come from me. It's misleading the way you quoted it in response to my post.

masklinn
> I'm not following your point. The point of YMNNJ is that you can use their examples to quickly replace bits of jQuery code.

That doesn't mean that's how the person you responded to uses it.

> Your second quote doesn't come from me.

The second quote comes from the comment you responded to, I'm pointing out that its author specifically used YMNNJ to demonstrate that not using jquery can be significantly less convenient and ergonomic than using it.

EB66
> That doesn't mean that's how the person you responded to uses it.

Why is that relevant? I'm just making the point that some of the examples on YMNNJ are not equivalent and that you might actually need jQuery for those examples. That's all...

Feb 21, 2018 · 2 points, 0 comments · submitted by trueduke
Feb 16, 2018 · 2 points, 0 comments · submitted by willlll
HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.