HNHacker News
TopNewBestAskShowJobs

jlongster

7,555 karma · joined May 7, 2009

https://jlongster.com/ (contact me at longster gmail)
submissionscomments
jlongster··on Doing work locally minimizes problems with Electron apps
I agree with this too but this problem can be addressed by caring. I care. You can find a bunch of non-native interactions in my app but every time I work on it I make it better and implement more of a native feel (like disabling selecting text when you shouldn't be able to, etc).

It's a balance - personally I think apps that focus on a specific platform is exclusionary. So accepting some non-native feel means more people can use my app.

I agree that browsers make it hard though.

jlongster··on Doing work locally minimizes problems with Electron apps
That's a very cool project (I've used OCaml before) and I hope it takes off. I should try it, but I admit I'm a little skeptical because there are so many details to get right like focus management, accessibility, and more.

Unfortunately since I can't rewrite my project entirely, I'm going to need something that reduces bloat by using a local webview instead, so it's still web-based.

jlongster··on Doing work locally minimizes problems with Electron apps
Whatever it ends up being it has to be web-based. I'm definitely not going to rewrite the app.

However, if something were to come along that uses the user's local webview instead and provided a way to bundle a node server with it, I could absolutely switch to it.

In fact, I've played with the idea of providing an app that only sits in your menubar and runs the server, and opening the app just opens a tab in your browser. But most users don't care as much about all this as we think and would find that odd.

You're right though - if something is working well enough it probably will end up sticking. Slack just goes to show that it's probably Good Enough despite what we feel about it.

jlongster··on Doing work locally minimizes problems with Electron apps
I would easily forego the niceties explained in the article if it meant there were something better.

The main reason to use Electron is that I can have happy macOS, Windows, and Linux users. Apps that focus on a single platform are exclusionary.

jlongster··on Doing work locally minimizes problems with Electron apps
The 230MB (not 300MB) is from my real app Actual. The example project uses much less because it does nothing except start electron, which looks like it uses about 80MB baseline.
jlongster··on Doing work locally minimizes problems with Electron apps
I don't actively use typescript, the example is focused solely on the architecture for adding a background process. Typescript seems like a separate concern?
jlongster··on Doing work locally minimizes problems with Electron apps
Oh, yeah that's stupid. cmd+r or ctrl+r for refreshing doesn't even work in my electron app because it doesn't make sense for a desktop app.
jlongster··on Doing work locally minimizes problems with Electron apps
I don't get what you are saying. Using 230MB of memory for a very data-heavy app is already somewhat reasonable, and more advanced optimizations are going to require more advanced engineering.

It's the same thing with any app, as you go further along development you will want to optimize in more advanced ways.

I'm not arguing that Electron doesn't have bloat though: https://news.ycombinator.com/item?id=20274725

jlongster··on Doing work locally minimizes problems with Electron apps
My guess is Slack likes to keep pages around, and each workspace is a separate page that are individually pretty heavy. So if I'm logged into 4-5 workspaces that adds up quick.

Slack does not use the OS webview, it is Electron. I don't think it's a 3MB download - if it is it must just be an installer that installs the real thing? I haven't looked recently.

jlongster··on Doing work locally minimizes problems with Electron apps
I completely agree! Are you referring to the "ctrl-r" to reloading the server in the article? That's only for development - the user never has to refresh the app like that of course!
jlongster··on Doing work locally minimizes problems with Electron apps
I'm the author of the post and I should also say that I don't love Electron. It's a practical choice for getting an app of the ground, but I want something more lightweight eventually.

I see it as a stop-gap until I can invest more resources into something more lean. But I'm focused on the product right now, not rewriting the world and wasting time because of engineering ideals.

jlongster··on Doing work locally minimizes problems with Electron apps
Did you read the article? It says 230MB for starters, you're clearly trying to paint it negatively. And the first thing it says after that is "still not ideal". Looking around at other native apps and at rest they are consuming between 150-200MB.

It goes on to say that there's a memory-intensive piece that I haven't even optimized yet and will rewrite into Rust which should bring the memory down a lot more.

jlongster··on Mozilla is giving up on their IRC server
Spectrum is good for lightweight communities but it is nowhere near the capabilities of something like Discord, which something as big as the Mozilla project needs.
jlongster··on Notepad++ drops code signing for its releases
Yeah, I about an EV cert from digicert for ~$100/year. People pay >$600/year?? What? I never even saw those prices! Not sure how I landed on digicert but I think it was a Microsoft article listing where to get EV certs.
jlongster··on Show HN: Actual Budget, a finance app I built over the last two years
This is a basic architectural difference. I'm comparing apps that store your data locally to apps that store your data in the cloud. It's a well-understood difference that the former (with end-to-end encrypted syncing) absolutely provides better privacy than apps that store data in the cloud that the company can read.
jlongster··on Show HN: Actual Budget, a finance app I built over the last two years
Just a quick follow-up: I'm already working on migrating the data to DynamoDB which will automatically encrypt the data (https://docs.aws.amazon.com/amazondynamodb/latest/developerg...). This will go live soon. But the website will stay the same: I won't say I offer encryption until I have true end-to-end encryption.
jlongster··on Show HN: Actual Budget, a finance app I built over the last two years
Yes, you are right. First of all, we're not talking about things like banking passwords or even account numbers, only transactions that you've been charged. But most importantly: this is completely opt-in. If you don't trust me yet, you shouldn't use syncing until I encrypt everything end-to-end.

If you only use a single local app, all of your data is entirely local to your device.

All other apps that host your data in the cloud have access to it, whether it's encrypted internally or not. What encryption buys you is the case if a hacker happens to get some of your data, they might not be able to decrypt it. But considering that the backend of the app itself must be able to read the data, the backend must be able to decrypt it, so a hacker could probably end up decrypting the data anyway.

End-to-end encryption in Actual will be better than all other cloud apps: I, even as someone with full access to the server, will not be able to read your messages. Only your device can.

It sounds like what you're really worried about is storing banking passwords unencrypted. We don't do anything like that at all.

jlongster··on Stop Writing JavaScript Compilers. Make Macros Instead (2014)
It could rewrite it like that, yeah, but sweet renaming all collided variables, likely to make it clear that they collided. It doesn't try to keep the distinction between what a macro introduced and what was already in scope (not worth the complexity).

This was back in 2014 though and sweet has changed a ton since then, so the output is probably different

jlongster··on Stop Writing JavaScript Compilers. Make Macros Instead (2014)
Macros cannot reach back like that, no. The renaming of the variable is due to sweet's hygiene system that operates on the program as a whole - if two variables with the same name exist in the same scope it will rename them to ensure uniqueness.
jlongster··on Ask HN: Do you use budgeting software?
I'm the founder of Actual, a budget system that I want to be easy to pick up but also informative: https://www.producthunt.com/upcoming/actual

It's a completely local and free app. Sign up and I'll be sending the beta out in the next couple weeks.

It embraces the envelope-style of budgeting, and does it in a way that makes it easy. I think this style of budget makes it really easy to see what's going on with your money without much work.

In addition to that, reports are important and we'll provide the ability to write any custom reports to tailor the system to your lifestyle. Everybody's life is different so we all have different needs, so it's important to allow flexibility.

Let me know if you're interested, or have any questions!

jlongster··on Stripe Atlas for LLCs
Does this support converting an existing LLC into one that Atlas would set up?
jlongster··on Better-sqlite3: A faster Sqlite library for Node.js
Node doesn't have "web workers", so I'm not sure what you mean. Node doesn't come with threading support as far as I know; it's single-threaded by design, but there may be libraries that try to implement it.
jlongster··on Better-sqlite3: A faster Sqlite library for Node.js
The fear is justified that somebody would naively use this library on a network-heavy app and block the event loop. The readme should probably do a better job describing how this should be used. It's not too hard to run it in a separate process and create a "db service" that you query async. For many small apps or certain use cases the sync api shouldn't be a problem.
jlongster··on Better-sqlite3: A faster Sqlite library for Node.js
Thanks for pointing that out. I was not aware libuv provides facilities for running code in separate threads, since I haven't seen it actually used in any of the of native addons I've looked at yet. It's too bad that node-sqlite doesn't use it.

I retract my comment about "no matter what", but it still just boils down to running sqlite on a separate thread. In my opinion it's probably a lot easier to run sqlite in a separate thread (or process) yourself at the app-level. The code for writing async native bindings in node is very complicated (not even considering the thread pool), and you probably don't need every single operation to be async. That just adds a lot of overhead, when you probably just need a higher-level layer that says "execute these queries on the sqlite process and give me the results".

jlongster··on Better-sqlite3: A faster Sqlite library for Node.js
It's mentioned in other comments but I'm going to repeat it as a top-level comment because it still doesn't seem clear enough to most people: sqlite's C API is synchronous and doesn't use threading, and thus it will always block the node process no matter what. Throwing an async API on top of it is useless - all your doing is making it slower by deferring the computation by a few ticks but when it does run, it's still going to block everything!

It's definitely a good example of buying into the "hype" of async without really understanding what's going on. Async is helpful when you need to wait on something in the future (like new packets come in from a socket) but don't want to block the whole process while waiting. It doesn't make sense at all for CPU work that's going to block it regardless.

I've lightly contributed to both better-sqlite3 and node-sqlite3 and the latter's async implementation makes it much more confusing and difficult to work with. And it slows things down considerably.

I switched node-sqlite3 with better-sqlite3 in my Electron app and found non-trivial performance gains. Make sure to run it in a separate process - never run sqlite in the main thread or the same renderer process as your app. If you run it in the main thread, it still blocks the renderer process. I wrote an article about this: https://medium.com/actualbudget/the-horror-of-blocking-elect...

I'm glad somebody finally made a robust synchronous API to sqlite.

jlongster··on Maintaining code quality when nobody cares
You need to tell your manager that it's simply impossible to both clean all that up and also make progress on the project. You need to stop the erosion in order to fix it; fixing will require fundamental changes that will absolutely block progress. If aren't able to freeze the project, your cleanup progress will be constantly thwarted by new ugly hacks.

There's just no way around it. If your managers won't freeze the project until you make meaningful progress, you're going to be stuck working with this ugly code for a long time. Try to convince them that in the long-term a cleanup will pay dividends. Without their support though, you won't get anywhere.

If you're able to freeze the code for a bit, it sounds like it might just be quicker to rewrite some parts like the CSS. Don't take on the whole project at once - find pieces that can be rewritten individually, even if it's a large part like all the styling.

jlongster··on Balancing Product and Technology
Not yet, RSS isn't in big demand these days but I might add one. Was going to see if several people asked for it.
jlongster··on Messenger.com Now 50% Converted to Reason
That's not readable. But you're not supposed to write that kind of code normally. You only need that when you need to interop with anything in native JS land, and most of that interop is already done for you so you can just use existing bindings.

I think you'll find that any code that deals with foreign function interfaces and interop with the host environment is ugly in any language.

jlongster··on Not Lisp again (2009)
That's not really the same thing at all. What's missing is the ability to close over values, which is a key part of first-class functions. You could not re-create the original example in C, which is to return a new function. You'd have to return some sort of object that keeps a reference to the function pointer, and provides a special mechanism for calling it, i.e. a poor man's closure.
jlongster··on Not Lisp again (2009)
This was back in 1983 where most (all?) other languages did not have first-class procedures. If you can imagine programming without them and then being exposed to that, it would be a big deal. We take them for granted today.
← PreviousPage 3 of 21Next →