Reputation
2,749
Top tag
Next privilege 3,000 Rep.
Cast close & reopen votes
Badges
2 8 19
Newest
 Enthusiast
Impact
~83k people reached

Jun
29
comment If passwords are stored hashed, does that mean that theoretically there exists another password that could be used to log in?
@gnat The requirements for a collision resistant hash (e.g. SHA-2) and a password hash (e.g. PBKDF2, bcrypt, scrypt) are quite different. In particular the latter is slow, salted and only requires first pre-image resistance not collision resistance or second preimage resistance. So I'm not sure if it's appropriate to close a question about password hashes as a duplicate of a question about collision cryptographic/collision resistant hashes.
Jun
29
comment If passwords are stored hashed, does that mean that theoretically there exists another password that could be used to log in?
Password hashes are not necessarily collision resistant. In fact PBKDF2 and scrypt have certain trivial collisions (every password longer than one block has an equivalent, trivial to find password that has the same has.
Jun
28
reviewed Approve Do my “dal” and “fileHandler” interfaces overlap?
Jun
28
comment Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
Does the homework assignment explicitly require the deletion operation? If it does not, then I wouldn't implement it. My experience with homework assignments is that you should implement a solution that fulfills the stated requirements and nothing more.
Jun
28
comment Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
@Carcigenicate 1) Concerning the moving you must use the proper condition to figure out how many elements to use. All elements in the same buckets and elements of subsequent buckets displaced by it. 2) I suspect your non moving approach doesn't actually work. Since if you place a new value in that slot, with the new element coming from a higher bucket, this new element would disrupt the linear scan of the lower bucket extending beyond it. So implementing move-on-delete seems to be necessary with linear scan.
Jun
28
comment Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
Yes. AFAIK that's also the way F# implements discriminated unions, since it has to compile to the .NET type system, which is similar to java.
Jun
28
revised Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
added 272 characters in body
Jun
28
comment Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
@Carcigenicate Only the Occupied class would contains those fields, so you can't get an invalid state. If the base class were public, somebody might be able to create a contract violating derived class, but there are workarounds for that (like internal constructors, which would prevent instantiation of other derived classes). You can make these classes immutable if you want, only accepting values via the constructor and not having setters.
Jun
28
comment Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
@Carcigenicate This optimization can be used even with linear scanning. It corresponds to your second approach, but uses the same field to represent special values and something that's useful (the cached hash) if the slot contains an element. It's not a bad idea, but IMO an unnecessary complication for a homework problem.
Jun
28
revised Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
added 264 characters in body
Jun
28
revised Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
added 264 characters in body
Jun
28
answered Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
Jun
28
comment Reading file during write on linux
I think the big difference between Linux and Windows is that Linux treats the file as separate from its file system entry. So you can unlink a filename while its open. Windows on the other hand delays the deletion until it gets closed. Does Linux allow the modification of running executable files? Or does it just allow deletion+recreation with different content?
Jun
28
comment How is a state machine different from any other computer program?
Sounds like turing tarpit. Just because it is possible to express any program like that, this doesn't mean it's a good form to model it like that. We're not computers, we need to reason about out programs, which for some programs works well when they're expressed as a state machine.
Jun
28
comment What's special about “non-blocking” node.js?
It isn't really special. You can use the same IO and threading model in other languages as well. The most special thing is that everything in node.js has been written with that model in mind whereas in other languages you have to carefully choose which libraries you're using.
Jun
27
comment Reading file during write on linux
You can choose to not lock files on Windows as well. I play half downloaded videos all the time. Locking is only required for loaded executables.
Jun
25
comment maintain rate of animation with requestAnimationFrame
Many games multiply movements by the elapsed time. Something like x += v*deltaT
Jun
25
comment Create new object or reset every property?
Can't really be answered without context.
Jun
22
comment Why is naming a table's Primary Key column “Id” considered bad practice?
This is occasionally the case, but in my experience it's pretty uncommon to have a nice unique immutable key. But even in your example you have a meaningless unique number to identify countries, just one that's allocated by ISO not by your database.
Jun
21
reviewed Approve Does Apple own any rights to software you create with their developer tools?