« first day (2678 days earlier)      last day (2271 days later) » 

8:00 AM
is it possible to declare an inline variable to host the left operand instead of doing it twice ?
if ( ...... && (c.getEventData() && c.getEventData().isValid)){}
(basically i want to ensure that getEventData() is not null
For not being an XY : this is the full code :
if( this.lstContentValidators.toArray().reduce((t,c)=>t&& (c.getEventData() && c.getEventData().isValid) ||false,true))
           {...}
 
@RoyiNamir When you reduce to boolean, you almost certainly want to use .some or .every, .every in your case since you're reducing with &&.
 
^nice catch
(will change to every)
btw is it possible to create a local command variable ?
 
@RoyiNamir What's a command variable?
 
function getEventData(){
  console.log(1)
  return {};
}

if ((getEventData() && getEventData().isValid))
{
  console.log(2)
}
I want to see 1 only one time
in other words, to catch the getEventData() result
 
The most readable way is to forgo the short arrow syntax and declare an actual variable.
 
8:07 AM
but it's part of a long reduce function
^ my code here is just simplification
if( this.lstContentValidators.toArray().reduce((t,c)=>t&& (c.getEventData() && c.getEventData().isValid) ||false,true))
           {...}
^ actual code
 
if (this.lstContentValidators.toArray().every(v => {
  const data = v.getEventData();
  return data && data.isValid;
})) {
  // ...
}
You want the null coalesce operator, ?. which we don't have yet, sadly.
if (this.lstContentValidators.toArray().every(v => v.getEventData()?.isValid)) {
  // ...
}
 
@MadaraUchiha How about this ?
function getEventData(){
  console.log(1)
  return {};
}

if ((h=getEventData(), h&& h.isValid))
{
  console.log(2)
}
 
@RoyiNamir That is far less readable than my alternative.
comma operator? assignment in an if statement? That's clever coding
Not to mention that in your example, h is now global.
 
yes
 
const h = getEventData();
if (h && h.isValid) {
  console.log(2);
}
What's wrong with this?
 
8:14 AM
@MadaraUchiha too simple
 
NOthing wrong. just wondering
 
Needs to be obfuscated and emoticons added
 
if (let 🖕=getEventData(),🖕&&🖕.is👍){
  // lol
}
How's that @Neil
 
@MadaraUchiha Better, but needs more jQuery
 
:-)
Nothing bad with exploring guys.....
 
8:17 AM
Just wrap it with €(() => {}), because $ is for the weak.
@RoyiNamir Never said there was.
 
sounds like it :-)
 
Nah, we're just having fun :D
 
(how did I forgot about every) ?
 
@RoyiNamir Because your eyes are tightly coupled to your brain.
Sometimes you need another pair of eyes (and brain) to see these supposedly obvious details you've missed.
const input = `(((())((())(()()))((())))((((())))))`;

function isBalanced(input) {
  const curlies = input.replace(/\(/g, '{').replace(/\)/g, '}');

  try {
    eval(curlies);
    return true;
  } catch (e) {
    return false;
  }
}

console.log(isBalanced(input));
 
No . it's becuase reduce is treated as the most helpful function ever
(web and articles....)
:-)
^ i've seen sql alike exmaple
 
8:20 AM
@MadaraUchiha Is that a Lisp parser?
 
@MadaraUchiha that is clever
 
@OliverSalzburg Nope, it's a function that returns a boolean on whether the parenthesis are balanced.
And I think it's an amazing solution.
 
Here it is : Sql serer, remove extra spaces :
select string = replace(replace(replace(' select   single       spaces',' ','<>'),'><',''),'<>',' ')
 
function isBalanced(input) {
    return browser.parseThisForMe(input);
}
 
hello!
 
8:31 AM
@SterlingArcher lol too much for me
@MadaraUchiha that's a little dramatic
 
evil();
 
it's clever but why do you need to do that when you can just use a conuter
 
because clever > coconuter
 
@Mosho To show your superiority to your peers
 
now you can tell the Scrum Master that he miscalculated
 
8:45 AM
@Mosho It's an answer to an interview question when we sought devs from India, he said something akin to "I know the classic solution is with counters/stacks, but I think the following is much more fun:" and gave me that.
 
indian devs are the best
3
 
even if it isn't faster, it's thinking outside the box
that's no small thing
it might even be faster actually.. It would need to be tested
 
@Mosho Counter won't show if it's balanced or not
 
is that so
 
() , )( <--- same counter , different decision
unless I misunderstand your point
 
8:53 AM
@RoyiNamir If your counter ever drops below 0 it's not balanced.
 
oh you mean by scanning from left to right
I thought just counting
 
function isBalanced(input) {
  let i = 0;
  for (const c of input) {
    if (c === '(') { i++; }
    if (c === ')') { i--; }
    if (i < 0) { return false; }
  }
  return i === 0;
}
Something like that.
 
yes
 
The more interesting things come when you introduce different kinds of brackets.
 
stack push pop would be even simplier
example ?
@MadaraUchiha interesting ..
 
8:55 AM
([)] not considered balanced, ([]) is.
 
nice interview question
 
Not really.
 
Answer ?
 
It's one that if you've had a degree in CompSci you'd answer very quickly and easily, and if you haven't, you wouldn't.
@RoyiNamir You use a stack, and you push and pop tokens to it, and test them.
 
mmm . smelly
 
8:57 AM
aka shunting yard algo
 
might be needed another variable insted of pop just to test value
@MadaraUchiha I don't think it relates to a degree or not
it relates if you're a programmer
every programmer have heard about stack and queue
 
@RoyiNamir It's just something you explicitly learn during a degree.
That very specific problem.
 
@MadaraUchiha reduce?
 
And it's not something you normally encounter out there in the while when you're self taught.
@BenjaminGruenbaum Doesn't return early.
 
@MadaraUchiha not that specific
@MadaraUchiha .every :D?
 
9:00 AM
@BenjaminGruenbaum With side effects? Go away.
 
what's wrong with a loop
 
@Mosho You don't learn loops in CompSci :-) hahaha
jk
 
@MadaraUchiha unless one of your projects is a calc that parses functions :D
 
@Mosho IDK it looks very explicit
@MadaraUchiha what side effects?
(map to sum so far, every on "is positive and not last or zero and last")
 
@BenjaminGruenbaum That's O(n^2)
For no good reason.
 
9:08 AM
Technically it's true, but O is an upper bound
It's also O(n)
Although, so what?
 
Again, no good reason.
The loop is more readable.
And more performant for large inputs.
 
First thing first, do we agree it's not ϴ(n^2) (unless you literally sum every time)?
(rather than just do this number + last sum)
 
@BenjaminGruenbaum But then you need to remember the last sum, which breaks the contract of .map()
Now you have to set a variable outside, which beats the purpose.
 
@MadaraUchiha you can either .reduce it instead of sum, and I don't see a big problem with remembering the last item within a map if it doesn't escape the map - but I think the argument has pretty much extinguished itself at this point anyway
 
I don't see why you would volunteer to add O(n) space complexity over a loop
I like loops
 
9:13 AM
ϴ(n^2) is best case scenario? or average?
 
ugh. Where can I find WinSCP logs
 
maybe it was omega that was best case scenario, I can never remember
 
. 2018-02-14 10:17:01.349 User name: download (Password: ******** Key file: No, Passphrase: No)
yesss
finally found it
thank god I had this password saved here
 
@Mosho do eval :D
 
@KamilSolecki Was it "download"?
 
9:20 AM
I knew everything but the password
 
 
@Neil that joke is from the 90s
 
Wait, what year is this!?
 
hunter2
 
9:22 AM
@BenjaminGruenbaum But this makes it look like it happened on Facebook. So it's better
 
Actually it's quite new, 2004
 
which?
 
The bash one
There was an older one I remember, but it was 15 years ago so ¯\_(ツ)_/¯
 
9:35 AM
Wanna hear a crazy murder thing that is acting out in Poland right now?
It's like straight from a movie
a 17 yo girl was murdered few days ago. The day after, from her FB page, somebody started sending encoded (with morse) threats to different people that are going to be killed next
directly to them
 
Sounds like a bad joke rather than the killer
 
Morse encoding, holy shit
Maybe he is a hacker
Or a seafarer
Maybe a pirate even
 
well the person also had pictures from the first murder
so
 
Well, I assumed that's how he got her mobile
Or she!
 
@KamilSolecki Not a very smart killer then
Those kinds of things only work in the movies.. killer can't very well do anything with the police keeping watch 24/7
 
9:42 AM
0
Q: error: Invalid shorthand property initializer

evoqi don't really know what i did wrong in my code.. i would be very happy if someone could help me to handle this error so if i try to run this code.. const {MongoClient, ObjectID} = require('mongodb'); const chalk = require('chalk'); MongoClient.connect('mongodb://localhost:27017/TodoApp', (er...

someone hammer pls
cc @BenFortune
 
@KamilSolecki Almost literal example of "Why isn't this code working?"
 
fuck, spent half a minute trying to find this room in the list
wtf is "JavaScript Baylay"?
 
guys
12 hours ago, by Luggage
he does no know da Baylay
 
but wtf is a baylay
 
shame
 
9:48 AM
found it
 
@Neoares everyone knows da Baylay
 
I don't
show me
 
@Neoares If you don't know by now, you never will, man *shakes head*
 
that was the crispest slap I ever heard
 
10:03 AM
@KamilSolecki when I google this exact sentence, it gives me an "article" saying "four things that GOD DOES NOT KNOW"
I'm scared to go down the rabbit hole to be honest
 
1:08 :read with street fighter voice: MARVELOUUUSS!
 
@GNi33 there literally is no info on this anywhere on the internet
it all started with a weird SO question
 
yes, because god knows EVERYTHING
oh, that... :D
 
E V E R Y T H I N G
 
how to send inputfield value into javascript variable??this is my code below:
 
10:05 AM
i will not have these heathens talk down the one and only
 
1 message moved to Trash can
@hearthacker Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
ok @CapricaSix
  <input type="text" id="tez">
  <input type="submit" value="button">
  <script>
        var tesz = document.getElementById("tez").value;
        alert(tesz)
  </script>
how to send input field value into javascript variable?
 
if by "send" you mean "store", you already do
 
how to get value from input field based on button click
 
you can just google that
although you'll get jQuery ansers
 
10:09 AM
if i gives manually value="test" <input type="text" id="tez" value="test"> the alert displays test but i want to get the value from input field
 
.value
 
@hearthacker You need to listen to the click event on the button
what you're doing now is run immediately
 
yes
anyways thank you guys for your response...!
 
this for the value
jsfiddle trolled me lul
 
Thank you @Neoares but i want to get value from input field for example( different users can enter their name)so i need input field
Name:<input type="text" id="tez">
 
10:16 AM
oh
 
just get the input inside thur event handler
then input.value
 
Mornings
 
many of them
 
its awesome @Neoares
thank you
 
10:18 AM
don't get used to it, you can find this on google
 
ya sure
 
people really find this "12k stars" kind of funny?
 
13k, actually
 
it's like vanilla js
 
ah, the guy works for google, i see
 
10:21 AM
@GNi33 oic
now it makes sense
 
"I starred your unfunny repo and made an even unfunnier github issue. HIRE ME!"
 
this one got pretty high
 
that one is funny and useful though
 
> Works on my machine
> I tried to compress and it got larger
 
10:36 AM
Is there any way I can use .some on childNodes?
Oh nvm ^^" Searching with "map" works way better than with "some".
 
@geisterfurz007 Array.from
 
Is there any way to force Webpack to rebuild my node_modules after I modified a file from it? I know it's a bad practice, but I need to apply a quick fix.
 
just bundle it again
 
Well, I did "webpack", but the error/warning still persists, and I'm pretty sure I fixed it's source (the owner of that module already committed the fix that I copied but didn't publish it or smth)
 
@BenFortune Yeah I found a post and I am using Array.prototype.slice.call now because I am using ES5. Thanks for the answer tho!
 
10:49 AM
@geisterfurz007 or just parent.querySelector
 
querySelectorAll returns a NodeList as well tho :/
 
yeah but it's already filtered
didn't you want to filter them?
or that's what I understood with your .some
 
not quite. I just want to see whether there is an element with a certain property (given id match)
Oh!
 
parent.querySelectorAll(...).length > 0
 
Brain was a little slow there. Yeah I could indeed!
Good one! Thanks :)
 
10:51 AM
@Neoares all
 
thanks
or if you only want to check if it exists...
check for querySelector truthy
I guess it should work
> Returns null if no matches are found; otherwise, it returns the first matching element.
that's your choice
 
Yeah that is what I am going for now.
It is an id so if at all there would be one only anyway
 
then use document.getElementById
nah nvm use querySelector
so you can check for id AND other properties in one query
 
li#myId should work, right? I am not too familiar with querySelector
 
yes but
 
10:55 AM
@Atmaks see if your edit is in the bundle
 
if your ids are unique (they should) you just need #id
 
True, yeah. But then getElementById would work as well. meh, as long as it works, I won't bother too much :D
although I could imagine getElementById to be fast because the selector doesn't have to be parsed... No clue if that makes sense tho :D
 
that's an interesting username...
 
@geisterfurz007 I think querySelector has a check and it runs getElementById if an id is provided
but not 100% sure
 
@GNi33 do translate please
 
10:59 AM
"ghostfart" essentially @Kamil
 
it's "ghostfart"
 
but as I said, if you want to check if the element with that ID has a property, with getElementById you have to get the element and then check the property, which is fine
 
@Neoares 50% of this guy's contributions are tickets to nocode github.com/kelseyhightower/nocode/issues/1703
 
with querySelector you can get the element with ID AND that property
and if it returns null it means there's not
 
Aha. Thats beyond my knowledge of german :P
 
11:00 AM
@OliverSalzburg quality account
 
Oh! Now I get what you mean. The property I am checking is the id so that should be fine ^^
 
oh lol
then tihs is enough :)
no need to provide # to that function
 
That does indeed work! Thank you very much :)
 
11:24 AM
Our dude Irvin Raj has moved from spamming questions here to doing that in C#
@BenFortune he is unstoppable lol
 
@KamilSolecki that's an improvement
did he change language?
 
No he always did asp net
 
doesn't uuid stand for "unique user ID?"
oh no, googled it
universal unique ID
 
universal unique identifier
 
it's universal for real?
 
11:34 AM
@Neoares Yes
 
I guess it depends on the algorithm but...
@OliverSalzburg how @_@
 
Contrary to a GUID, which is only globally unique
 
depends on the milisecond and mahcine's MAC?
 
@Neoares A UUIDv4 is required to include factors like the time, yes
 
lol
642
Q: Is there any difference between a GUID and a UUID?

Jon TackaburyI see these 2 acronyms thrown around, and I was wondering if there are any differences between a GUID and a UUID?

 
Read the Wikipedia page if you care :P
 
look at question's comments
 
UUIDs are unique universally (universe-scope) while GUIDs are only unique globally (globe-scope). Neither are unique multiversally, i.e. they are not MUIDs. It means that in principle you shouldn't use GUIDs interplanetarily. Other than that, they are pretty much interchangeable. — rsp Apr 24 '17 at 12:32
lol
 
lol I also thought about multiverse
am I autist?
 
That's good
 
11:36 AM
if you say so.. xD
 
I'll try to push MUIDs from now on
 
Do you favor the Copenhagen interpretation?
 
and accepted answer is
> GUID is Microsoft's implementation of the UUID standard.
it's like
initially there was only UUIDs. Microsoft tried to implement them, they couldn't. They created GUIDs as if it was a new standard
 
It's not like that actually
 
I guessed so
 
11:39 AM
RXJS : is it possible to declare a callback so that it will run it when data arrives , But without subscribing it ?
For example :
I want to run a function when data arrives :
 public get<T>(url: string, params: HttpParams): Observable<T>
    {
        return this.http.get<T>(urlJoin(this.actionUrl, url), {params});
    }
inside the function ^. not in get.subscribe(...)
 
> also known as GUIDs
 
I really hate how shrodingers example has caused 90% of people to misunderstand the Copenhagen interpretation
All the memes are just fueling the incorrectness
 
btw next year is the 50th anniversary of Saturn V moon landing
@KamilSolecki what memes
 
All the ones based on shrodingers cat
 
and why are they wrong
 
user1928251
11:43 AM
hello anyone can help me
 
user1928251
?
 
Everybody assumes that superposition is a singular state
 
user1928251
i need help with something
 
I don't think everybody does
like, not everybody knows what a singular state is
 
user1928251
hello
 
11:45 AM
While superposition describes any possible Indeterminate state
 
user1928251
hey guys
 
user1928251
can i post a jsfiddle with my code?
 
yes
 
@AndreiClaudiu assuming you can type the link and/or have the keys ctrl, c, and v at your disposal
 
user1928251
 
user1928251
11:52 AM
what im i doing wrong?
 
using javascript
grabs popcorn
 
what are you trying to do?
/kick geisterfurz007
 
user1928251
im trying to get a frame from a video with the respective id
 
> src="../../videos/video.mp4"
check your source
 
user1928251
and return that frame as an image poster for that video
 
user1928251
11:57 AM
yea man i will find a video somewhere and i will come back stand by please
 
user1928251
 
user1928251
there it is
 

« first day (2678 days earlier)      last day (2271 days later) »