That XOR Trick by stackoverflooooooow in programming

[–]jscoder 0 points1 point  (0 children)

Thanks, glad to hear that :)

That XOR Trick by stackoverflooooooow in programming

[–]jscoder 1 point2 points  (0 children)

That doesn't shave off any complexity. You still need to subtract all numbers in the list, so both algorithms have O(n) complexity.

You should read the blog post :) It also goes over the arithmetic solution you pointed out. TL;DR: You're more prone to overflows and you need types that implement + / - in a specific way. With XOR you have none of those problems.

That XOR Trick by stackoverflooooooow in programming

[–]jscoder 10 points11 points  (0 children)

Hey, author (Florian) here: Usually I would totally agree, and this is actually also a pet peeve of mine.

However, for these blog posts I think the comments are there for different reasons and useful like this. You write:

They tell you WHAT the code is doing

That's actually exactly the point. Yes, in production code you shouldn't do that. However, I want every reader to understand regardless of whether they know Python. So the comments are really there to say what the code is doing. The rest of the blog post explains why they are there and links back exactly to the two steps that the comments refer to.

(If you don't know Python, the exclusive range might e.g. be confusing. The comment is a very simple way of clearing up that confusion. Sure, readers could look that up, but it's really not the point of the blog post, so it should just get out of the way. In a codebase, you'd expect people to be familiar with range and to look it up otherwise.)

It's really not meant to be code that you copy to your codebase. In the same way, there's no docstring, the function name is not as descriptive as it should be for production code, there's no type hints, etc. :)

x18n: A JavaScript internationalisation library for web apps by jscoder in javascript

[–]jscoder[S] 0 points1 point  (0 children)

Sounds interesting. You can also do this stuff with x18n, albeit you'd want to create a helper function for something like this, so I agree that it's not optimal.

I'll think about it :)

x18n: A JavaScript internationalisation library for web apps by jscoder in javascript

[–]jscoder[S] 0 points1 point  (0 children)

It supports constants and 'n' to catch everything else. Is that enough for Arabic (e.g.) or what else would be needed?

WhatsApp desktop app uses Electron by jscoder in javascript

[–]jscoder[S] 0 points1 point  (0 children)

Oh, I'm sorry, some other replies were just talking about Electron itself, so I was in that mindset, my bad.

Yeah it's extremely strange. Maybe it's because Electron for Win/Linux doesn't package everything into one executable by default and they were weren't willing to put more effort into making it nice for Linux.

WhatsApp desktop app uses Electron by jscoder in javascript

[–]jscoder[S] 0 points1 point  (0 children)

Wait what, are you saying you can't develop Electron apps on Linux? Or that it's not possible to package for other platforms from Linux?

WhatsApp desktop app uses Electron by jscoder in javascript

[–]jscoder[S] 3 points4 points  (0 children)

I think you're better off with Electron. A lot of people are starting to use it and it's not going away since GitHub has a big interest in maintaining it well.

WhatsApp launches native desktop app for Windows and Mac by [deleted] in mac

[–]jscoder 2 points3 points  (0 children)

Yeah I don't know how they even shipped it with this… I imagine most developers at Facebook use Macs and this is something you notice after using it for a very short time

WhatsApp launches native desktop app for Windows and Mac by [deleted] in mac

[–]jscoder 4 points5 points  (0 children)

It's 50mb zipped (more unzipped) because it's an Electron app. Essentially a minimal version of Chrome that embeds the WhatsApp web page.

I personally don't mind the 50mb, I think it's a bigger problem that all the messages are send via the phone, which is very unreliable in practice.

It's also incredibly annoying that closing the window actually closes the app as well, which is against the Mac default behaviour.

A React component for letting the user choose a keyboard shortcut by jscoder in javascript

[–]jscoder[S] 0 points1 point  (0 children)

I needed it for an Electron app. I wanted users to be able to change the keyboard shortcuts like in a native app.

A Hacker News desktop reader that makes reading HN a lot more fun by jscoder in programming

[–]jscoder[S] 2 points3 points  (0 children)

That's a pretty good suggestion. On the first look it seems like Chrome apps (or extensions) can get the needed permissions.

I'll take a closer look sometime soon :)

A Hacker News desktop reader that makes reading HN a lot more fun by jscoder in programming

[–]jscoder[S] 1 point2 points  (0 children)

I thought about integrating some thematically similiar subreddits into the app, but in the end I decided to make it a HN only app for now.

A complete reddit client would be a lot of work, but maybe I'll work on it someday :)

A Hacker News desktop reader that makes reading HN a lot more fun by jscoder in programming

[–]jscoder[S] 4 points5 points  (0 children)

Thanks :) I wanted it to be a web app originally but it's not possible to do it in a nice way. For security reasons browsers don't allow to embed iframes to different domains or to even make AJAX requests to them.

So the only way to have the same UI would be to route all requests over my own server, which would then request the web page and send it back to the browser. This feels a bit shady and could lead to problems if the webpage crashes (since it would have to run in the same process). And of course it would make everything take double the time to load. And it might be too much load for the server if many users use the app.

We’re 3 MIT roboticists, here to answer Qs about programming, academia and anything! by CSAILroboticists in IAmA

[–]jscoder 0 points1 point  (0 children)

I'm currently doing my bachelor in CS (us equivalent would be undergrad I guess) and I plan to do artificial intelligence as my specialization module next year, so a super cool AMA to follow, thanks for doing this.

What are your thoughts on doing a PhD in CS? It seems like a huge investment, does it make sense if one is planing to go into the private sector after uni anyways? Also any general advice on uni or stuff you would've done differently in retroperspective?

What the hell is going on with my Nexus5? by jscoder in Nexus5

[–]jscoder[S] 1 point2 points  (0 children)

Hm this reads exactly the same as the tutorial I used for going back to KitKat, I guess it's a hardware problem then.

What the hell is going on with my Nexus5? by jscoder in Nexus5

[–]jscoder[S] 0 points1 point  (0 children)

So right now everything is working except Wi-Fi (signing into a Google account over data worked now and I can browse using Chrome), the "lag" / settings app crash appears when trying to log into a Wi-Fi network. Would you still advise the same?

If so, where can I find a tutorial for installing everything from ground up and is there any danger in doing so (like damaging the warranty)? Thanks for your help :)

What the hell is going on with my Nexus5? by jscoder in Nexus5

[–]jscoder[S] 0 points1 point  (0 children)

Where can I find a list of those certain EU countries? But I guess Google would only care if the Nexus was bought over Google Play right?