HNHacker News
TopNewBestAskShowJobs

mambodog

4,836 karma · joined February 6, 2010

submissionscomments
mambodog··on Early Macintosh Emulation Comes to the Archive
Interesting. What browser are you using?
mambodog··on Early Macintosh Emulation Comes to the Archive
I did the initial work of porting this emulator to the browser (most credit should go to the original emulator author however: http://hampa.ch/pce).

I wrote up the process and hacks that went in to making this possible here: https://jamesfriend.com.au/porting-pce-emulator-browser

The most gross/fun part was how I made the Mac OS mouse position align with your real mouse cursor: by writing its position directly to the emulated computer's memory. Classic Mac OS held the mouse position in a few fixed global memory locations. I realised I could just write to those memory locations every few CPU cycles. I could have instead written a driver which ran inside the emulated OS to communicate with the emulator program, but this was simpler!

mambodog··on TypeScript at Slack
One thing I like about Flow for small projects is that you can use the Flow 'comment syntax' so that you can start using Flow and leaning on the typechecker without adding any transpilation setup at all. Flow's inference means many type annotations can safely be omitted, too. Example: https://github.com/jsdf/they-live/blob/master/handler.js#L11...

I find this especially useful for node projects, where there is less of a case for using Babel etc (node 7 supports all the JS features I want).

mambodog··on TypeScript at Slack
Coming from Javascript, Typescript and Flow have huge benefits which a much smaller learning curve than going straight to Elm. I recommend people who don't have experience with static types start with one of those two.
mambodog··on Ask HN: How was this ad targeted to me?
Rather than speculating, you can find out why you're seeing a particular ad on fb. There's a drop down on each ad which includes a menu item which explains the targeting method used: https://www.google.com/amp/www.business2community.com/facebo...
mambodog··on React v15.5.0
I mean if you really want to be loose with the type of your component's state, you can just declare its type as Object, eg.

    class MyComponent extends React.Component {
      state: Object;

      constructor(props) {
        super(props);

        
        this.state = {
          foo: 1, // no type error
        };
      };
    }
Providing a more explicit type for the component's state is a great way to catch bugs, however. It also forces you to more clearly think through which combinations of state properties are valid. Jared Forsyth gave a good talk about this at React Conf: https://www.youtube.com/watch?v=V1po0BT7kac
mambodog··on Apple's Touch Bar Could Be a Flop
Twitter polls are only useful as a tool for demonstrating how polls with self-selected participation are utterly useless.
mambodog··on Facial recognition database used by FBI is out of control
If it was created by humans then that would constitute a racist act. This system was created by humans.
mambodog··on Facial recognition database used by FBI is out of control
Even if it was no-one's intent that the system is racially biased, allowing such a system to continue operate after learning of such a bias is a racist act.
mambodog··on Modern JavaScript for Ancient Web Developers
That's fine. When you want to learn what's in the black box you can dig into it. The key is unblocking people on their path to their initial goal (eg. learn React) so they don't give up after getting stuck on a prerequisite (learn to configure webpack, learn to configure babel).
mambodog··on Andy Weir’s Best Seller ‘The Martian’ Gets a Classroom-Friendly Makeover
Australia certainly doesn't have this problem, but that's probably not a surprise.

As an example, here is some colourful language in a novel was a pretty standard text for English Literature classes in my state: https://books.google.com/books?id=BRwwAAAAQBAJ&q=fuck#v=snip...

mambodog··on Ask HN: What’s it like working at Facebook as a Software Engineer?
You can create one that you only use for work, but having an account (even if it's just a blank one) is kind of necessary. Edit: I don't know if you need one to apply, just to work
mambodog··on Show HN: Target almost all platforms at once with react native
React is a view-centric component system. It's primarily used for view-related stuff, but the component abstraction is pretty powerful, so they can be useful in lightweight cases for application structure too (YMMV here).

React Native is a system of bindings of native APIs to Javascript. This includes bindings which allow you to use native UI elements just like you would use divs, inputs etc. for React on the web, but it also includes bindings for common mobile OS APIs like geolocation, camera, maps, etc.

mambodog··on The Cost of Native Mobile App Development Is Too Damn High
React Native's ListView culls offscreen views: https://facebook.github.io/react-native/docs/performance.htm...
mambodog··on Why we chose Vue.js over React
In answer to your first question, yes. See the documentation for `render`: https://facebook.github.io/react/docs/react-dom.html#render

In answer to your second question, yes, React currently only does anything as a consequence of calling `render`, or `.setState()`/`.forceUpdate()` in the case of a component class (not relevant if you're not using component classes).

In future, the (currently experimental) 'fiber' render will allow some rendering to be deferred until after the current call stack has finished (to avoid blocking the UI), but there should be away to tell React to do all rendering synchronously if you desire (which is necessary for eg. rendering on the server). There's no reason why the current behavior couldn't be supported on top of the new experimental renderer though.

mambodog··on Why we chose Vue.js over React
You seem to be mistaken. You don't need to create components if you just want to render some divs. You can just do

    const {render} = require('react-dom');
    const {DOM} = require('react');

    render(
      DOM.div({className="something"},
        DOM.div({className="something-else"},
          'some text',
        ),
      ),
      document.getElementById('root'),
    );
Components become useful pretty quickly as your views grow in size, but even then, function components require very little extra code to use.
mambodog··on Jest – Painless JavaScript Testing
Automocking is off by default now, and a lot of work has been done to improve the developer experience in recent times.
mambodog··on Rust: 128 bit integers preparing to be released
can be handy for a really big space for ids, especially if you don't want to use strings. also bigger bitsets
mambodog··on InfernoJS – A JavaScript library for building powerful user interfaces
> Start thinking there's something wrong with my app, that's "just" about to launch, and is "just" using plain old Redux

Why would you think this? What problem are you having? What is your app supposed to be delivering that your current technology choice is preventing?

mambodog··on Svelte – A UI framework that compiles into tiny standalone JavaScript modules
"Used correctly" to me sounds like: "with much knowledge, experience, care, and luck" ie. a footgun, especially for beginners.

Similar things have been said about memory allocation in 'do whatever you want' languages like C++.

mambodog··on Svelte – A UI framework that compiles into tiny standalone JavaScript modules
TodoMVC is a useless benchmark for the problem that this claims to be addressing. The limits we're hitting with our applications now are with BIG applications, with many routes, many views, and lots of client side logic. We're talking hundreds of files (in some cases, thousands). Of course a framework, with it's fixed overhead, is going have a bigger payload for a tiny demo app like TodoMVC, than something like this which compiles to some amount of overhead which grows seemingly linearly with application size.

That said, I'm not criticizing the framework here, and I welcome new ideas, but a better choice of benchmark is sorely needed to be persuasive here.

mambodog··on Introducing Custom Elements
Where's the part of React which allows me to return a new copy of what I want the HTML to look like, while only updating the changed elements of my view instead of totally blowing away the existing elements (the virtual DOM + reconcilitation part of React)? Also, where's the declarative event binding part?

I'd also point out that the state tree (setState) is a part of React, and plenty of apps are just fine being built using only setState for state management (no redux/flux/mobx).

mambodog··on Using Rust for 'Scripting'
> Add the dependencies...

Nope. The beauty of a decent systems scripting language is that it includes everything you need (and ideally is already installed everywhere).

mambodog··on Is Model-View-Controller dead on the front end?
> How is React+Redux any different from this?

You could say Redux is a more constrained subtype of the 'single data flow MVC' you describe, which in turn is a subtype of 'all definitions of MVC which have existed'. In Redux actions are serializable, which opens up a bunch of other possibilities. Not to say Redux invented that idea by any means (it's the FP principle of separating data and behavior, also the OO command pattern), but it's useful to have a name specific name when talking about a more specific combination of ideas/constraints, especially if those constraints make different things possible (undo/redo, replay, logging/analytics for free).

mambodog··on Elm is Wrong

   Elm has inspired ... the development of ReactJS
I don't think that's true. React is a descendant of XHP, and predates Elm. Perhaps you were thinking of Redux?
mambodog··on Benefits of using tmux – streamlining your development environment
If you want to get a taste of the benefits of tmux without having to learn anything new, I recommend using iTerm and setting up an alias for

  'ssh [your server] -t "tmux -CC attach || tmux -CC"'
Just running that command will connect to your server and attach to an existing tmux session, or create a new one if needed, and make use of iTerm's tmux integration, so you can use the standard macOS keyboard commands (or the UI) to do things like switch tabs, make new tabs, close them, make new windows, etc. all using tmux and a single ssh connection. You can press 'esc' in the command window to detach from your session and when you return (just using that alias) all your work is just as you left it.
mambodog··on Step-by-step tutorial to build a modern JavaScript stack from scratch
I don't think 'bad performance' is a fair characterisation of Immutable.js. If you're calling .toJS() all over the place it will be doing a lot of redundant work. However there should be no need to do that, if you just pass the data structures around and access their fields directly.

That's not to say that you should necessarily use Immutable.js; if you don't understand the use case where structural sharing in persistent immutable data structures is useful and require it for your application then you should probably just leave this tool on the shelf.

However, if, for example, you are maintaining maps containing many items which are updated frequently, then you may benefit from the time and space complexity of structurally shared maps (Immutable.js) rather than creating a full copy on each mutation (plain JS objects).

mambodog··on Ask HN: Why is everything in JavaScript changing so fast?
A lot of comments here seem to suggest it's just because of people creating projects to get attention. I think this reason is massively overstated, and appeals to the unfortunate HN meme of disparaging other people's work to signal that the commenter is smarter than the herd.

However, I would suggest that we are now building applications at a level of complexity which has not previously existed on the web before (unless you include non-standard tech like Flash/Flex or Java Applets, which both had their shortcomings).

If you accept that some of the things which are being built actually unlock new possiblities in terms of user interface fidelity, and therefore has at least some purpose, then I would point out that the level of churn can be explained by the following:

1. JS has become very widely used very quickly, which means that there have been lots of hastily built things, which have been replaced by better things (and for every 'better thing' there are many alternatives which fell by the wayside), and a larger pool of people to build them.

2. It's easier than ever to build new tools (or any kind of app, for that matter), because the npm ecosystem makes it trivial to combine existing smaller pieces of code into new combinations.

mambodog··on Why we chose Vue.js
People keep saying you 'have to use redux' but I think that's hugely misleading to a large section of potential React users who don't need the highly complex state management that redux facilitates, and could get by just fine with setState+props.

I'd hope that people who are being exposed to this idea at least also get the chance to read 'You Might Not Need Redux': https://medium.com/@dan_abramov/you-might-not-need-redux-be4...

mambodog··on Yarn – A new package manager for JavaScript
Whoops, my mistake. I don't know enough about the history of Flow to comment further.
← PreviousPage 3 of 23Next →