« first day (2596 days earlier)      last day (2344 days later) » 

12:10 AM
@towc yes
 
@KendallFrey 5
 
@towc !
 
you win
 
12:23 AM
happy thanksgiving everyone
hmmm I need something to work on tomorrow
I've been lazing off and learning a shitton of stuff without much practice for too long now
need to make another fullstack application
and maybe actually finish it this time
most attempts at contributing to OSS have ended with the communities not being active or me not having enough skills to contribute to the project, and the gap between what I'd have to know and what I actually know would be too great for me to feel motivated
knowing mostly that it's skills that I won't be using in other scenarios
 
12:41 AM
I'm cold, and there are wolves after me
 
12:52 AM
rimworld?
 
 
4 hours later…
4:55 AM
@towc have you seen Fawlty towers
 
 
 
2 hours later…
6:56 AM
why is it so quiet here today
 
7:19 AM
Because nobody is here
 
7:30 AM
then are you nobody? :o
 
Hoi
@Nobody it usually is at that time
 
7:49 AM
Hi. Is you site ready for black friday?
 
8:16 AM
hello
would this work for array of objects?
list = list.filter((x, i, a) => a.indexOf(x) == i)
my array is not [1, 2, 1, 3, 3, 4], it's {name: cow, value: 1}, {name: cow, value: 2}, {name: duck, value: 2}
 
@KamilSolecki Everyone gone for shopping today
 
thanks :)
 
@Traitor did you have checked the MDN doc?
 
@littlepootis Thank you!
 
8:27 AM
IIRC x = element, i = index and a is the array
 
so it would be, a.name
 
no, x.name to get eg cow
 
because i only want unique names
oh okay
 
but what are you trying to do?
ah
 
i tried x.name and it underlined red
 
8:30 AM
probably a mistake from your IDE
 
hi guys
i have this object
 
!!> let a = [{name: cow, value: 1}, {name: cow, value: 2}, {name: duck, value: 2}]; let s = ''; a.filter(x => s += x.name + ','); s
 
@KarelG "ReferenceError: cow is not defined"
 
data":{"HPH":[{"firstvalue":">= 0","secondvalue":"<=HCH"}],"HCE":[{"firstvalue":"> 0","secondvalue":null}],"HCH":[{"firstvalue":">= 0","secondvalue":"<=HPE"}]}
 
lol missed the quotes
 
8:31 AM
how can i access firstvalue and second value
this is not working for me
 
HPH is an array of objects. loop through it and for each object use eg .firstvalue to get first value
 
data[key]['firstvalue']
this is not working
 
> HPH is an array of objects.
 
:/
how can ii do it without looping
 
data['HPH'][0]['firstvalue'] should work
 
@KarelG tried it, didnt work
 
@MadaraUchiha Can you trigger azure to download them from https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/download?job=<‌​job_name>?
 
Not sure
 
hey
 
!!> let obj = {
"data":{"HPH":[{"firstvalue":"[I NEED THIS VALUE]>= 0","secondvalue":"<=HCH"}],"HCE":[{"firstvalue":"> 0","secondvalue":null}],"HCH":[{"firstvalue":">= 0","secondvalue":"<=HPE"}]}
}; obj.data['HPH'][0]['firstvalue'];
 
8:54 AM
@KarelG "SyntaxError: expected property name, got end of script"
 
guys, is it possible to .innerHTML = console.log?
 
i dont want to right click my browser every time to see the logs, i want to see the log in an html element
more convenient that way
@KarelG that's Josephs question
mine is the 'cow', 'cow', 'duck'
 
lol
sorry.
mixed you both. My bad
 
i'ts okay, thank you for taking the time to help
 
8:57 AM
you want unique names, but what about the values?
or is retrieving names enough for you?
 
0
Q: Horizontally scaling a Mongodb, Nodejs, Socket.io Chat Application

DragonBornI have an existing chat application using nodejs, socket.io and mongodb which is working fine. I am also using mongoose to manage the db. However with the increase in the number of users I have to horizontally scale my application on different servers and my existing application will fail. I r...

Can someone help me with this
 
@KarelG just the names along with their values
 
so for cow, you have {name: cow, values: [1,2]} ?
 
yea
{cow, duck}[1, 2]
let a = [{ name: "cow", value: 1 }, { name: "cow", value: 2 }, { name: "duck", value: 2 }];
    var unique = new Set(a.map(x => x.name));
    a.forEach(function (entry) {
        console.log(entry.name, entry.value);
    });
not working ^
 
Friendly reminder: dont use var
Use let/const
 
9:08 AM
ok
 
use a map or set. Lemme fiddle
 
He is
For Just logging, foreach makes more sense than map
 
im falling in love with foreach
i usually do for(var i = 0; i < x; i++){ }
^ cancer
 
forEach isn't that great either
 
what do you use?
 
9:10 AM
I have used a map: jsfiddle.net/wt3fgyL0
 
Learn to utilize .map() .filter() .some() .every() and .reduce()
 
(and .reduceRight())
 
^-- useful for flattening arrays
 
so if i used map instead of foreach, how do i console.log every item in array using map?
 
don't use javascript
use something better
@Traitor Don't use map for that.
map is used to transform an array. And it ideally shouldn't have any side-effects.
 
9:16 AM
@KarelG how do i sum the array of values of 'cow'?
@littlepootis ok
 
you are familiar with a for loop... You can use that. Or use the reduce trick
it won't help if I keep giving codes away. Try to understand why I have used a map there
 
map.set(o.name, (a, b) => (a + b);
?
 
set at set 0 and add to that value when using get
 
hmm okay
 
<button class="edit">action</button>
$(document).on('click', '.edit', function(e) {
$('.editbtn').attr('data-action', 'update').html('Update').toggleClass('SubmitComment UpdateComment');
});

<button class="editbtn SubmitComment">insert</button>
$('.SubmitComment').click(function(){alert('Hmm');});
$(document).on('click', '.UpdateComment', function(e) {alert('Okay');});

Please do anyone know why when i click on edit it toggle the class for `UpdateComment`, but when i click the update it show alert for both `SubmitComment` and `UpdateComment`?
 
9:21 AM
@PhilipJems Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
@CapricaSix okay thanks for the information
 
9:33 AM
@KarelG not sure what u mean 'set at set 0'
 
when item does not exist, add name + 0
then add to map by .set with name, get by name + value
but this is a tad slower progress. Best to keep an array so that you can keep track of # cows duplicates (which is a length of array)
if you need sum of values, just accumulate it with .reduce
 
okay i see where i left out
map.get(o.name) + o.value
 
10:00 AM
!!tell Abhi sandbox
 
@Abhi Please go and play in the Sandbox
 
@Nobody why are you doing that? His last comment is from yesterday ...
 
um.. im Abhi. this is my other account. i didn't know how to go to sandbox link again. so..@KarelG
 
Having > 1 accounts is actually frowned upon. I hope that you aren't doing that to circumvent any bans set on Abhi
 
no.. i(Abhi) don't have any bans..
i mean im not banned
from anything
 
10:09 AM
There doesn't seem to be anything suspicious on his QA. IMO, having more than one account is OK if you're very serious about avoiding to exploit that (for example answering/starring/voting your other account)
 
10:22 AM
then you don't have to worry
 
OK..
 
@BenjaminGruenbaum I still did not have figured out how HN can shadowban your HN account by using a direct link. The referrer only shows the url. Ofc they can use the search tool. But even then, they still have to link my name here on SO to my name on HN, which are different :P
 
10:41 AM
hi everyone! how can convert object string as a integers and use this values for a sum:
{cost: " $200"}
{cost: " $100"} and want to do is: 200 + 100 = 300
 
parseInt(your_object.cost.split("$").slice(-1)[0])
 
Assuming you have an array you could do
var sum = arr.reduce(o -> +o.cost.match(/[\d.]+/), 0);
 
that's such a pro code, dude
 
yours does not need a polyfill
was going to use reduce too :P
 
a polyfill for reduce ?
 
10:46 AM
> SyntaxError: expected expression, got '>'
:/
 
-> should be =>...
 
It's =>
 
heh
 
sorry... java...
 
keh
 
10:47 AM
yeah
java uses -> for arrows
 
Anyone has experience with OpenLayers for a little complex problem?
 
oh reduce is supported widely
 
thank you!
 
!!> [{cost: " $200"}, {cost: " $100"}, {cost: "free!"}].reduce((s, o) => s+ +o.cost.match(/[\d.]+/), 0)
 
@DenysSéguret 300
 
10:48 AM
!!> arr = [{cost: "$200"}, {cost: "$300"}];var sum = arr.reduce(o => o.cost.match(/[\d.]+/), 0);
 
see fixes
 
@Neoares "TypeError: o.cost is undefined"
 
I need to re-memorize the compatibility list
 
@Neoares see fixes
 
saw them
 
10:48 AM
I typed the first one a little to fast...
 
by the way, wtf
> => s+ +o.
wtf is this
ES2020?
 
unary plus operator
 
ES2020 xD
 
shortcut for Number()
 
I'm still wtf'd
oh ok, the s+ is the unary thing
 
10:50 AM
no, the second +
 
and what does it do
oh
 
s + thing is just adding thing to s
 
It's the same as doing parseInt
Pretty much
 
Int ?
 
and +o is converting to number?
 
10:51 AM
why just int?
 
s + +o => s + (+o) => s + Number(o)
 
The unary operator I meant
 
it also work with null
 
and with floats
 
Ok, with Number object
My bad
 
10:52 AM
@DenysSéguret it works also with undefined, in some way
it converts it to NaN
 
@Neoares not the right way in this case
I wanted it to work with missing numbers, as you see in my example
 
if you add NaN to a value, you get NaN
 
then you just add || 0
 
using +o gives 0 which does't "destroy" the value
 
10:57 AM
.
 
,
 
@DenysSéguret It works Merci!
 
De rien
 
oooooooohhh... de rien de rieeeeeeen..... (8)
 
11:28 AM
@KarelG I was trying to guess what the output of that line would be, and was really confused :P
 
@towc just go to the console and execute it :D
violà
 
Alright guys, heres a challenger. I want to do this stackoverflow.com/questions/8794778/…
using display inline block
since everyone is preaching dont use floats
 
learn flexbox
 
and dont want to use flexbox as I dont know the browser support but suspect not all that great
 
and there are reasons for not using float, so maybe learn those too
 
11:33 AM
looks like someone wants a library to do their math problem
 
Yea... I need to learn that
too
 
@Stuart you're weighing all other devs down by not pushing the clients to not care about older browsers
 
@Stuart which browser are you planning to support ?
 
@towc I appreciate the comment but do what?
@SurajRao IE8 atleast
 
if you're working for a client, convince them that it's not worth supporting older browsers. You can find a good amount of articles telling you how
 
11:35 AM
@Stuart IE has partial support, but even then, it only does not support "advanced" flex features.
 
if you're working by yourself, you don't have to convince anyone
 
+1
I was going to add that its a one man band
 
Aren't we replacing the old flexbox model by the grids anyway?
 
i have been using flexbox for ages and it even works for clients that still uses IE11
 
convincing me is the hard part
 
11:36 AM
@DenysSéguret for 2 divs? I guess maintainability principles mandate we use grids anyway...
 
@KarelG caniuse.com/#search=flexbox says partial here
 
1 min ago, by KarelG
@Stuart IE has partial support, but even then, it only does not support "advanced" flex features.
 
@Stuart if you don't know the browser support just search it
 
Thats the beauty of my site. Accessibility for all
 
@Stuart we don't have to convince you. You either stop supporting them, or we'll be less likely to help you
 
11:36 AM
@SurajRao ^^--
 
@Stuart IE8 D:
good luck
 
@Stuart that's not what accessibility means
 
> IE has partial support
 
accessibility is use VR to control your webpage
 
@KarelG yeah.. hadnt seen that one
 
11:37 AM
for example
 
@Neoares you're joking, I hope
 
@Neoares Yea Ive done quite a bit of Googling this AM on browser support for other, simpler features such as width: fit-content which browser support SUCKS for. Glad I didnt follow that trail...
 
@towc well if you have no hands, it's a kind of accessibility, isn't it?
 
:facepalm: sure
 
it was just an unusual kind of accessibility
 
11:39 AM
and just by the sound of flexbox Im pretty sure thats not gonna have the greatest support. Somewhere less that jQ??
 
@Stuart read your tables
do your research
you're coming across as a vamp
 
Plz do elaborate on vamp
ire
How so? I come and ask questions
 
Helo frendos. Anyone able to maybe assist me with something? I'm wondering why I'm getting a response of <unavailable> when querying a website. Stack search is failing me and I can't find anything related. There is my code; jsfiddle.net/z244fth2
 
@WillParky93 Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
elicit thought etc...
 
11:41 AM
hello robot
 
> Hello frendos
 
hello fren
 
sup
 
@Stuart google it
 
I am getting value in console in your fiddle.. `Get success
show:59:4
{…}
buying: 0
buyingQuantity: 0
overall: 0
selling: 0
sellingQuantity: 0
__proto__: Object { … }
show:60:4
id is126`
 
11:43 AM
That is so weird
 
I'm firing a onkeyup event on an input box for JQ autocomplete
but it doesnt work for the first key
 
but im gonna do some more research @towc That's continual and forever. I was just seeing if anyone had a quick remedy to learning how to get out of floats and into display inline-block quickly so I could absorb it as I was converting
 
Get success
<unavailable>
id is126
is my return from that jquery
 
i press L and it doesnt work. if i press o after l, it works
 
@Stuart flex
 
11:44 AM
if I remove lo and type l again, it works
why does this happen?
 
I have a pretty good idea what vamp'ing is but dont see how it applies to me
Gonna look into flex
 
user6086034
so many people talking
 
It's mad to see people still doing this now...
0
Q: MySQL LIKE returning wrong results for special characters

BlackbamThe following PHP script with MySQL is basically working fine: global $wpdb; $keyword = $wpdb->_real_escape(strtolower($keyword)); $res = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE post_type='product' AND post_status='publish' AND ((LOWER(post_title) LIKE '%{$keyword}%') OR (LOWER(p...

 
real_escape_string
love it
 
I dont have the skills to answer questions here (now I feel worse) and dont want to remain silent in the closet
 
11:45 AM
@WillParky93 which browser/dev console tools?
 
kinda a catch 22
 
I'm in firefox latest version and I get that response in the fiddle and my site
 
@Stuart dw, nobody's asking you
 
I'll try chrome
 
anyone converted at c++ lib to typescript?
 
11:45 AM
just look into what you're given without disgarding it because you don't like the sound of it
 
@DenysSéguret partially a fault from wordpress itself
 
@WillParky93 weird I got the response in FF(developer edition)..
 
(uhm not sure if they did develop the DAO themselves)
 
@SurajRao weird, works well for me in chrome. Thanks anyway
 
Is there a canonical QA for this old problem?
1
Q: a.b.c.d type property access when undefined

Ashwini Kumar // option 1 let val = a.b.c.d || null; // this gives error if a.b.c is undefined or a.b is undefined etc. // option 2: alternate version let val2 = null; if (a.b && a.b.c && a.b.c.d) { val2 = a.b.c.d; } Is there an elegant way of writing th...

 
11:48 AM
+1 @towc Off to learn more about display: inline-block to replace what usta be float left and right here: your-adrenaline-fix.com/… (Side note: If you saw my site b4 and almost barfed at the 90's look of it, you'll dig what ive been up to. Incomparable difference
 
@Stuart I said flex, not inline-block
and no, it's still very 80s
 
Yea I know, First I have to exhaust everything there is to learn about display inline-block b4 I open up flex
 
there's not much to know about inline-block
 
but from G'ing how to achieve this, most results (on SO) start out with flex in the first breath\
 
you'll learn most of the oddities by actually doing things with it and then looking up why they are
 
11:51 AM
Good point
 
otherwise you'll have read a lot of stuff for no good reason, and maybe forgot most of it by the time you start doing it
@Stuart great. MDN flexbox and start from there
 
Youre exactly right. Ive done years worth of tutorials and am just now "learning" what a lot of that was about
but still have questions
I was hell on the auto mechanics instructors... Always had a question about something
but I know a shit load about that now. Now Im putting down the wrenches and picking up the keyboard (for a while)
 
enjoy
 
Wow I didnt know flex was MDN
 
What ? MDN is a documentation site. It has information on most things HTML/CSS/Javascript
 
11:55 AM
Hello
how to convert this to native javascript
$("#data").append("<p>" + evt.data + "</p>");
 
@mark333...333...333 read through this: youmightnotneedjquery.com
 
I kknow that is why I want to convert it to native javascript
 
the site tells you how
in a way that you can look for it yourself so you're not dependent on us telling you later on
 
At the worst it will tell you what native functions to look for
It is a good read in your case
 
yeah
so can you help me convert this code snippet?
$("#data").append("<p>" + evt.data + "</p>");
 
document.getElementById("data").append("<p>" + evt.data + "</p>"); this doesn't work properly
 
The first part is right
 
they're all different links to the relevant parts of the website
now, jQuery actually does something maybe a bit unintuitive, as .append works for both elements and strings
 
yes, in this case you'll have to create the element yourself and add it with appendChild
or choose the easy dirty way of using innerHTML
 
Thanks @towc
 
12:01 PM
you can either create a <p> first separately (recommended for security reasons along with other things) and then use the first link, or you can use the last link to manipulate the whole html string
@DenysSéguret shhh :P
now he has to read
 
@DenysSéguret when I use the append, it also show the <p></p>
document.getElementById("data").appendChild("<p>" + evt.data + "</p>");
 
@mark333...333...333 please read my messages
the alternative to which is not receiving any more help
 
@mark333...333...333 the MDN has great pages with examples on those methods. For example developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
 
12:25 PM
Very relevant to the discussion we had about summing two costs... i.redd.it/es50f6bj0wzz.jpg
 
0
Q: Get Id value from the each data function using mvc?

Ivin RajOn button click we are get the data from the database that data i need to display in the text field but it working fine for me. but i try to get Id value from the $.each(data, function (i, v1) i cannot get ID value: var GenID = jQuery('[id$=hdnGenericID]').val(v1.Value); $("#btnClick").click(fu...

 
@DenysSéguret clearly stuck in callback hell
 
i cannot get ID value: var GenID = jQuery('[id$=hdnGenericID]').val(v1.Value);
 
There was no callback hell in my reduce. In any cases, callback hell is a thing of the past. Now we just have weird untraceable bugs when forgetting what functions are async.
 
@towc thing is; people just adjust it without modifying the content/arguments
 
I have seen snippets trying to append a HTML string to a node as child
 
Microwave bacon rack?
 
why not?
 
that is not how you bake bacon
 
I tried cooking thin slices of bacon in the microwave, it works very well if you find the right duration and power.
 
12:32 PM
I don't eat bacon regularly, but every process that requires a fat collection tray is not something I would enjoy, I guess
 
I cooked bad bacon in the microwave once
 
I prefer to avoid fried bacon for health reason but if not I would use such an apparatus
 
it fused to the bowl and the smell almost made me throw up
 
@DenysSéguret In that case, glad I introduced you to this product :D
 
I need to wake up :|
got sql errors, but I was certain that it is correct
 
user6086034
12:36 PM
!! help
 
@boo Information on interacting with me can be found at this page
 
until now, I got a lunch and noticed WHERE T.YEAR(Start) ....
 
0GB! What a deal!
 
from the records, I can say that I ran the incorrect query 3 times in 33 minutes.
so wasted 30 mins
 
(what's a personal cloud ? a NAS ?)
 
12:45 PM
I think it's for backup.
 
speaking of: !!backup anyone?
 
for the bot. Has to be done by ROs
 
last one got issued Nov 13 :p
 
is that not too long ago ?
 
12:58 PM
I guess we can't !!s/.*/!!backup-trick her into it?
 
!!backup
 
@FlorianMargaine Donna Noble has left The Library. Donna Noble has been saved.
 

« first day (2596 days earlier)      last day (2344 days later) »