Hacker News new | past | comments | ask | show | jobs | submit | bakhy's comments login

This looks too easy, the first solution. If there is no logged on user, which User object is fetchUser going to return? Which friends? At the top level, if I were to forget to check if someone is logged in, who knows what would happen here.

I've worked on codebases where people were so allergic to the "billion dollar mistake" of nulls, that they created empty objects to return instead of returning null. This bit us in the ass a couple of times, e.g., when caller code was mistakenly passing the wrong ID variable into a fetch method, and just happily continued working and writing garbage into the DB, because it did not realize that its fetch had actually failed. It took data from the empty result object and happily continued its computation with it.


> This looks too easy, the first solution. If there is no logged on user, which User object is fetchUser going to return? Which friends? At the top level, if I were to forget to check if someone is logged in, who knows what would happen here.

It feels like the most likely thing to happen is that the `getUser()` call would throw a Null Pointer Exception?

I think the author is avoiding the pitfall of the NullObject pattern applied incorrectly with solution #1 because they're not masking the 'null-ness' in the code further down, they're just assuming that `null` will never get passed as a value. If it is, code blows up & then gets patched.


I’ve had limited success with the null object pattern but there is one case that it worked really well for me. I worked on a feature that was highly dynamic and users could compose reports selecting data points from tangentially related models. Null objects were a really helpful pattern because it was hard to anticipate how models would be composed and if a developer made a mistake it was hard to notice there was no effect. Our null objects would raise exceptions in development and explain what you need to change but wouldn’t prevent execution in production.

You could easily argue we should have just presented this exception to the user in all cases but this is where we landed. It’s probably the only case this pattern was beneficial for me.


The same site has an article about all this from today: https://www.icelandreview.com/business/elon-musk-and-halli-s...


It's also available as an Android app, MaximaOnAndroid. I love having it on my phone, even though I rarely actually use it :)


> I love having it on my phone, even though I rarely actually use it

I understand.


This is quite easy to reproduce. Wow.

IMO they should just remove the password generator feature. It's barely usable, and with this behavior it's just dangerous.

Why barely usable? Some really simple features are missing. I miss the ability to specify password requirements - for annoying sites which specify length, require so and so many these and those types of characters, or even forbid some types. And another one is that it's not possible to manually generate a password, not even in the password storage UI, when manually adding a new entry. So, if a site did not correctly declare a password field, which happens, you must generate a password yourself somehow.


> This is quite easy to reproduce. Wow.

If you read the page you would see it is functioning by design and the bug was closed 3 years ago. Not saying that is the proper behavior, but that would explain why you can reproduce it.


I use the feature all the time, and I'm happy with it. Please don't remove it.


Why do you find the feature "barely usable"?


It is a hit or miss, as some password fields don't get this. However, I personally fund it useful and use it about 100/% of the time in new signups/resets when available.


I believe you can right click in any type=password field to bring it up with the heuristics didn’t detect it as a new password field.


Yeah that's the problem though: A lot of websites don't set the password field to "type=password" or they don't set the second (verify) password field like that. Why do they do this? Either the web developer didn't really know what they were doing or they were given some very unique requirements (e.g. need to work with a legacy framework).


Password is leaked. Firefox continues to suggest the same password, because there's no random generation.


Wrong. There's random generation, and each randomly generated password is pinned to the site where it was generated. When you navigate to a different site, Firefox will generate a new password. There's no cross-site leaking.


Password is leaked and you want to change it all in the same browser session/tab since you created it for the 1st time? I mean, technically you could be living with the same tab opened for months but...


I meant in addition to the issue being discussed.

> It's barely usable, and with this behavior it's just dangerous.


I can't see the square either. Firefox 99, Windows 10.


I do see a square, also on Firefox 99, Windows 10. I don't see a square in Chrome.


Just BTW on the Netflix subtitles issue - I live in Germany, but I'm not German and generally prefer original audio on everything, typically with English subtitles. And some movies and series on Netflix will really only offer German subtitles, or, even worse, only German audio. No option to choose original.

All movies that have such limited audio/subtitle options, when I play them, start with a title card of a German distributor, so I would believe Netflix on that one.


Not only resets, you cannot activate the old way in the Settings anymore. It is hidden in about:config (set browser.download.improvements_to_download_panel to false), but even if you switch back to it, there's still changes that break things.

* With the about:config setting off, tabs that had PDF files from the internet open in them will now, when first loaded, suddenly show the popup. If you choose "Open in Firefox" there, the file gets downloaded to a temp folder, opened in a new tab for some reason, and the new tab's address is the temp file. So, after restarting the browser again, it's broken, because the temp file has been deleted.

* In the new mode (I switched back because of the above...), I have set ZIP files to "Ask me", and even if I pick "Open with ..." in the popup, it still downloads the file into the default downloads folder, instead of the temp folder. So now I have to clean that folder up regularly, I guess.

* Lots of people on connect.mozilla.org are complaining that the little Download Manager, the popup you get when clicking on the Downloads icon in the toolbar, now annoyingly always opens whenever you download any file.

The FAQ (https://support.mozilla.org/en-US/kb/manage-downloads-prefer...) about this also sounds kinda condescending:

> I want to approve each download before it happens, is there still a way to do this? Firefox no longer shows the dialog because downloads are usually intentional. Having to click a second time for a download to start is usually unnecessary.

This is really irritating, I'm for the first time in a long while considering switching to Chrome.


There's a contradiction in the conclusion. Foucault was an academic philosopher, got a degree in philosophy, was awarded a doctorate, and is respected by many people who also got a lot of education in philosophy. So, how is more philosophy education supposed to have stopped him?


I suspect they are saying more analytic philosophy education a la departments in Britain and America would have lead to more critical thinking.


Publishing books on analytical philosophy, logical philosophy, and philosophy of language generally doesn't get you a bestseller that makes you rich and famous.


Theory of Justice?


I mean Logicomix could have done worse ;)


I think you're mistaken about the ability of 2 proposers to move to phase 2 - once an acceptor has agreed to a proposal with a certain seq number, it cannot just agree to another one with the same seq number. And that means only one of the two proposers can obtain the required majority of votes to start sending Accept messages, and thus only one of the two values can be accepted by any acceptor.

Maybe read the papers on Paxos, like the "Paxos Made Simple" one, it's not too big (though it's not all that simple either, at least to me...).


Here is what the paper says:

Phase 1.

(a) A proposer selects a proposal number n and sends a prepare request with number n to a majority of acceptors.

(b) If an acceptor receives a prepare request with number n greater than that of any prepare request to which it has already responded, then it responds to the request with a promise not to accept any more proposals numbered less than n and with the highest-numbered proposal (if any) that it has accepted.

Important part of the statement is

  ...with a promise not to accept any more proposals numbered less than n...
So, Phase-1 promise is not on the proposer-identity, but on the proposal-number.


You're right, my mistake!

But it still should not be an issue, since according to what you quoted an acceptor will not reply to a second proposal that bears the same number ("If an acceptor receives... number n greater than...), which means only one of the two proposers can gather the required majority of promises to move to the next phase, and thus only one of the values can end up being accepted. After the crash you describe, there will be only one accepted value the Proposer-C will receive.


Such assumptions break network request retries and/or relies on proposer-identity, etc.


I do not want spend more time on this, so I will let you explore.

Algorithm is not tied to the proposer identity (uuid or fqdn or ip, etc.) The promise in Phase-1 response is not to the proposer, but to the proposal-number.

In your model, proposer cannot change his identity, between Phase-1 and Phase-2 which is not a constraint imposed by the algorithm.


I've had lots of ideas like that, things I'd like to do which I never get around to. The one I did go through with and still keep working on it on and off is the one that had a connection to my job.

I worked on a very concurrent system and thought maybe STM would be a nice fit for it. I found the concept of STMs very interesting. And I noticed that, although there were many implementations for .NET, all were one-off projects, not maintained, and in my opinion not very nice to use. So I ended up writing one myself.

I guess that sweet spot for me was having a problem that I dealt with on a daily basis, which gave me the drive and a clear picture of what I'm trying to achieve, and the fact that it was a fun challenge to implement and a learning experience related to a concept that intrigued me. The other ideas I had would mostly have just that second part - they're fun, challenging, but not really solving something I deal with too often.

So, I don't have much experience, I don't have many side projects, but for what it's worth, my advice is to try to find something in your day-to-day which bugs you, and for which you have some interesting idea that you'd like to experiment with.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: