@towc Thanks, it turns out that there is in fact no way to throw such errors, but that is a noteworthy workaround I will keep in mind. for now I will use the JS error system
stupid shits I shouldn't be doing #17253: I want to mobx.observer a class extends React.Component without using transpilation, hence without the decorator. I seem to be failling greatly, as I succeed on making the observer react on store changes (through a stateless component) if I directly hook the component's render function on store.whatever, but the observer fails to react on changes on that store.whatever passed through props
@JupiterAmy Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
Suppose I have a redux store which contains an array of items, and using that data I do the rendering. Now suppose I sort my array in the redux store....will react re render?
I never said it was a protocol thing. The way I imagined the whole thing was that actual users connecting to the server were clients, but people can also look at the logs online, which would come directly from the server, so for me that's still the server
hey i was wondering, if i assign numbers to alphabets in a UUID such that a =1, b=2, c=3, ... and sum the numbers then what is the probability that 2 or more UUID could yeild the same sum?
if you use 16 letters, with a UUID length of 30, there's 2e34 UUIDs with the same sum, which is just above 1% of all UUIDs
in fact, 48 sums contain ~50% of all UUIDS (out of 480 possible sums)
and what are you trying to do? Create a hash of a UUID for quick comparison (human)?
s/480/450
for a human-recognizable format (for debugging/admin, in a quick view) I recommend, I kid you not, emojis
there are >2800 emoji in unicode, currently
so you can pair every pair of letters to one of 676 (26²) emoji that you pick, halving the length of the UUID
or you can split to bits
each char requires slightly above 4.7 bits (log2(26)), while identifying an emoji requires just above 11.45 bits (log2(2800)), that means you can fit just above 2.43 chars in an emoji
so a 30-char UUID would end up having a 13-emoji representation (12 < 30/2.43 < 13)
you can mix in another bunch of recognizable characters, so you can increase the view alphabet you have
if you pick 8 very recognizable colors to use as backgrounds for each emoji, you can multiply your viewing alphabet by 8, so each viewing char could represent >14.45 bits, and now each view-char can represent >3 original chars (you only need 7 colors to achieve this)
but even with this, a 30-char UUID will end up having 10-emoji representation, which is only 3 emoji less than a background-less representation
the good news is that you don't lose any data, there's no collisions here
but if you're willing to lose some data, you can get this down to 2 emoji by some other uniform hashing algorithm, and still end up with just above 1% collision
3 emoji, and you have 0.1%, and so on
(Math.log2(2800*8)/(Math.log2(26)*30))**3
chances are there's something wrong in this calculation
if I have 100 emoji, you'd definitely not have any collisions, but it gives me a 1e-97% collision
suppose I have a variable called message. const message = ''
after this, I have a series of if statements that validate input fields, and update the message variable with one of three possible messages if any of the input validations fail.
the non functional way to do this is: let message = ''
if (age === false) message = 'please enter an age.'
if (name === '') message = 'please enter a name.'
if (location === '') message = 'please enter a location.'