« first day (2756 days earlier)      last day (2206 days later) » 

12:00 AM
It only will send to other users
 
im gonna try that 1 sec
 
Connect twice and use broadcast and you'll receive the message back or store it directly. That's why it's set up that way
 
@RachelDockter next thing I'd check is the receiving end, maybe you're discarding the first message somehow. Does it appear in the frames section of the websocket connection when you look in the chrome inspector?
 
yes it sends twice if i include it 3 times
i know its defo nothing with the recieving end
this only started coming about when i included this stupid if statement above it
if (user.in('/').adapter.rooms[room])
	{
		var x = user.in('/').adapter.rooms[room].length;
	}
if i take this out, it sends just like normal again
i thought maybe its changing a property of user so its not sending to them or something but idk
 
I think you might be creating multiple connections
 
12:04 AM
really? that code just checks how many people are in the same room as the client
its not assigning anything or even doing anything with the x
 
When you add to a room, the client that triggers on will not receive the emit back
 
what do you mean sorry
 
Grilled bread
 
Canned corn?
 
At least that is how I experienced it, but it may be to do with the broadcast option I use. Try putting logging every connection event on the server side and if it prints "client connected" or whatever you put n-1 times the emits, it's exactly what I thought
 
12:10 AM
sorry im super confused now
i think you are right though. I took it out and just put let x = user.in('/'); and its messing everything up
 
Have the server trigger the event without a request from the client and see if that helps
 
its triggering lots of events from other clients
just not this one
 
Yep. Only emit it from the server and not a hook from a call from the client.
 
I only know about this because I hated my life this morning
Assigning dynamic rooms is a real treat...
 
12:14 AM
my server only emits messages when called by the client
i think i should just try another way to find the rooms length
that would solve all my problems
 
You want up to update all the time, correct?
 
i want to update my client with the amount of people in a room all the time sure
but i only emit that to the client when someone leaves or joins
 
Just set an interval when you create or assign the room to send the length every so often with an emit to the room
 
how do i get the length though, thats the problem
 
Oh, well then you should be good. Just send a broadcast and implement a counter client side
 
12:20 AM
@DavidKamer I think you're misunderstanding her problem
 
yeh ive done all that, but i dont know how to get the amount of clients in a room
the code i used above was the only way that worked
and that caused a whole other issues so i cant use that
 
Oh crude, I think I read this earlier. I think you have to check the server object, not the socket
 
yeh, i think ive set my server up weird
 
27
Q: getting how many people are in a chat room in socket.io

re1manI have this code right now that sets the nick and room: io.sockets.on('connection', function(client){ var Room = ""; client.on("setNickAndRoom", function(nick, fn){ client.join(nick.room); Room = nick.room; client.broadcast.to(Room).emit('count', "Connected:" + " ...

Second answer
It looks like what you are trying?
 
socket.io fun
 
12:26 AM
thats what im trying yes, but beleive me ive looked through all of SO answers
its the way ive set my server up
 
Do you have arrow/lambda functions in place or functions that have state?
 
i cant just call io.socket
no i dont know what that is haha
i think im onto to something though
 
Replace all of your function(){ with ()=>{
 
hold on ive almost got it
 
Then replace io with whatever you named your top server object
You have to tell me what it was lol.
 
12:31 AM
Grilled shrimp
 
ok ive done it
first i had to make a global variable on my server 'this.rooms = []';
then when websockets initalise, i do 'this.rooms = this.socket.sockets.rooms;'
 
Oh good lol
 
then when i want to access it, i have to bind the async function .bind(this); which allows me to get it
holy moly
 
I think, emphasis on think, that arrow functions would have fixed it without creating a bound, extra, variable by moving access to the variable calling the method to create the server
Like make the arrow function share scope with the implementanig file
 
i only understand about 10% of that
haha
 
12:39 AM
Sorry lol. I almost hate bind honestly. I probably would have trouble writing it you way without throwing my computer out the window lol
Think me shouting "this is complete be. Only idiots would force me to do this. Oh God why, why. How did we break computers this horribly. Why oh God, why."
 
ha thats crossed my mind a few times
 
But to be fair, I started with Java and c++
 
@david might be getting closer with this correct
 
So, I come from a world where a bunch of people BELIEVE computers should work one certain way and every other way is inferior. This is wrong and I'm trying to change lol
 
The jQuery .html() method basically gives you .innerHTML, which already unescapes HTML entities... so /"/ won't match anything. You need to access the .textContent2 here; compare

document.body.innerHTML = '"' // will render "
document.body.textContent = '"' // will render "
Also note that replacing the entire DOM like that is not a good idea anyway as it will void all element references and event listeners etc... I think the best you could do would be to recursively walk the DOM tree and only replace the .textContent of text nodes:
sorry
is there a way to assign a number in that code
 
12:56 AM
@FredMcgiff just a heads up there's a handy link on formatting code up in the chat description
 
is there a class for number instead of text .textContextNumber
 
@FredMcgiff what do u mean, assign a number to what specificly?
 
still trying to remove just a match case of a zip code on 8,000 pages catalog for printing
to correct zip
 
could do what in 3 minuites?
 
but i halfway there via blog.lateral.io/2016/04/… this way
because then it loads on every page..
 
1:01 AM
I was being snarky. That's just how I would solve @FredMcgiff's problem. I could be wrong be I think he's trying to scrape based on an element and then print.
 
for example i add this in the chrome extension to run but i lost one what best way to just target zip code and fax number
var html = '<div>test</div><p>test</p><span class="removedata">X</span><span>test</span><span class="removedata">X</span>';
var newHtml = html.replace(/<span class="removedata">X<\/span>/g, '');

console.log(newHtml); // "<div>test</div><p>test</p><span>test</span>"
2
Q: Javascript String Replace span element by empty string

Ankit ShahI have HTML string in JS where I would like to remove the span element from it. var HTML= '<div>test</div><p>test</p><span class="removedata">X</span><span>test</span><span class="removedata">X</span>'; After removing Span, it should be look like: HTML= '<div>test</div><p>test</p><span>test</...

its amazing here are some good examples but nothing for numbers css-tricks.com/forums/topic/jquery-removing-one-word-of-text if i reg ex it i fail each time to get it right
 
I’m not a fish
 
u think i found it guys but again i brain fart it during last stages
TheDoc
# SEPTEMBER 9, 2013 AT 8:50 AM
@paulie_d – I don’t think that’s semantic at all since it’s a single sentence.

Really, it’d be <p><a href="#">Username</a> posted on <span class="date">Date</a></p>.

This is certainly not pretty, but if it has to be done via JS you could do this with jQuery:
from that site link in css tricks
 
@ndugger I am one of the reptilian from Dr Who lol
 
1 message moved to Trash can
@FredMcgiff Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
1:08 AM
i did format it on edit
sorry
@CapricaSix ok can you show me example or do i just use crtl K
@CapricaSix thanks for links awesome stuff
 
ahahaha
i used to talk to caprica six too before i realised
 
can't tell from disccussion they resloved this css-tricks.com/forums/topic/jquery-removing-one-word-of-text and is there jquery remove for number string
but for example this works but it breaks and how to just assing to numbers
 
1 message moved to Trash can
@FredMcgiff Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
24 mins ago, by Sterling Archer
@FredMcgiff just a heads up there's a handy link on formatting code up in the chat description
 
@CapricaSix how will it look when i post it
im confused
i thought use crl- k
 
1:22 AM
make sure your code is indented when you copy it, then when you paste it, press the "fixed font" button
@FredMcgiff
 
How to
 
it is possible to ignore users in chat, people
 
is it ndugger? haha
 
click on Fred Mcgiff's icon, and then click the "ignore this user" link, and you won't have to see their unformatted code or smelly feet anymore
 
@RachelDockter this is a start correct
 
1:28 AM
what is a start correct
 
@cᴏʟᴅsᴘᴇᴇᴅ That's a bot that's moving his code, not a user
 
just need to figure out how assing to only zip code and phone number github.com/ericwbailey/millennials-to-snake-people/blob/master/…
    starts like this
    function walk(rootNode)
{
    // Find all the text nodes in rootNode
    var walker = document.createTreeWalker(
        rootNode,
        NodeFilter.SHOW_TEXT,
        null,
        false
    ),
    node;
 
@david I gathered, but what I said still applies
 
Was there a flag or something?
 
@cᴏʟᴅsᴘᴇᴇᴅ wait i did this time is the above formated
 
1:30 AM
Not really, but I imagine their constant slew of commentary and code would seem unpalatable to some
 
Eh, it happens. Most users figure out how to format their code fairly quick.
 
@cᴏʟᴅsᴘᴇᴇᴅ I'll give you the benefit of the doubt, but please don't add commentary like "or smelly feet anymore"
Be patient, or just ignore them. No need to call it out like that when they're trying
Or help
 
Eh, what. There's dirty feet in their profile picture
 
@SterlingArcher i understand i been an active user, contributes to voting for years never gave problems, i just up against the clock srry about formats
 
"smelly feet" was in lieu of that, not a personal attack on them or their person, you did not need to read that much into what I said ;/
 
1:38 AM
@cᴏʟᴅsᴘᴇᴇᴅ sorry, we've been through a lot lately
 
heheh no worries, it's all good :)
I can imagine everyone's on tenter hooks what with Meta being a dumpster fire lately
 
@SterlingArcher chat user since 2013-01-25
 
@FredMcgiff you're good man
@cᴏʟᴅsᴘᴇᴇᴅ yahp. We're exhausted trying to basically change everything to avoid the room being shut down or harsh suspensions
 
very warm night
 
I've been meta-ing for like 3 days.. how can people do it for years?
 
1:40 AM
@FredMcgiff you've voted 17 times to date and have a handful of posts in the 5 years you've been a member
@SterlingArcher Is it that bad here? (sorry, I don't visit much)
 
There are like 60 comments on meta.stackexchange.com/questions/309645/… now... I really really want to post a comment telling them all to take it to chat. Kinda like shog did on meta.stackoverflow.com/questions/342440/time-to-take-a-stand
@cᴏʟᴅsᴘᴇᴇᴅ we were kinda singled out a bit by a twitter user
 
@cᴏʟᴅsᴘᴇᴇᴅ I won't get much into it. Some people feel attacked, some are taking breaks from SO. They feel unappreciated
 
@cᴏʟᴅsᴘᴇᴇᴅ i vote lol .. not much to say .. i stink at sentence strugger and grammar ass you can tell
 
as a fellow sewer worker, I understand and appreciate what you all do. Keep it up, proud of you.
 
@cᴏʟᴅsᴘᴇᴇᴅ you may be interested to know that I had a great discussion with Tim Post this morning. Unfortunately there are big things he cannot tell us, but things will happen.
It's exhausting but we gotta have faith
 
1:46 AM
wait u guys work in a sewer?
i thought u guys all had programming jobs
 
@RachelDockter Yes. We even have our own website. Check it out: stackoverflow.com/questions
 
@RachelDockter it's a euphemism for the main site and review queues
 
@SterlingArcher will this format it before i post
 
closing questions, edits, triage, etc
 
ohhhhhh
ahaha
u guys actually work for SO? or just volenteer?
 
1:47 AM
@FredMcgiff check out the sandbox chatroom and play around with posting code
 
function replaceText(v) {
    // Fix some misspellings
    v = v.replace(/\b(M|m)illienial(s)?\b/g, "$1illennial$2");
    v = v.replace(/\b(M|m)illenial(s)?\b/g, "$1illennial$2");
    v = v.replace(/\b(M|m)ilennial(s)?\b/g, "$1illennial$2");
    v = v.replace(/\b(M|m)ilenial(s)?\b/g, "$1illennial$2");
 
It's unpaid work :P
 
@SterlingArcher In private? I imagine they have a lot on their plate: teams; channels; etc etc
 
@RachelDockter volunteer. I work greensmithenergy.com here
 
and they're just making it harder for themselves
 
1:48 AM
ah
 
is that i t
formated
 
@FredMcgiff can you please take a break for some time
 
You guys used arduinos before?
 
New Archer in 12 minutes
 
Fucking pin reads both 1 and 0.
#WTF
 
1:50 AM
what do add to format so i ask question about what i posted
thought it was crl k
 
when u post code a new button will appear next to the send button
called fixed font
click that and it will format your code @FredMcgiff
 
interesting i only seeing fixed font
i need brackets and closing brackets thats it ok
 
if ('this_is'==/an_example/){of_beautifier();}else{var a=b?(c%d):e[f];}
 
1 message moved to Trash can
@FredMcgiff Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
@FredMcgiff did you read the link I told you to read?
 
1:56 AM
lol i trying to figure where the quotes are its where maybe mod disabled it cause not seeing the little quotes when i click the drop down
ok there ya go
thats formated right
 
I shouldn't be laughing at this but I am
 
cant format code but manages to format normal text lol
 
i feel like im a bulll in a china closet
 
in case you haven't realised, that user is a troll
 
1:58 AM
ahahaha
 
Your posts are starting to clutter the room and the question is divulged.
 
troll with no one chatting thats cold man
 
we figured that out very quick and kicked them out, so I'm surprised you've tolerated them this long
 
@cᴏʟᴅsᴘᴇᴇᴅ There is a very good chance that he isn't. We get some very odd people coming into this room
 
if you read what they posted in the python room, you'd agree
 
1:59 AM
javascript has a low barrier to entry, very low...
 
anyway, it's your room
 
I'm not an RO, so I'm happy to let him be him. We're being inclusive afterall
 
well i been asking been posting a lot and don't want to come off as fix my homework so i thought i really needed to fix the format or be kicked out .
 
@SterlingArcher ...divulged?
 
I don't know I'm tired
 
2:00 AM
@FredMcgiff is enlish your second language?
 
na just have very bad habits when i rush .. I do have grammarly as my home page u know the ai of spell check
 
@FredMcgiff just take care to listen when people ask you something
 
trolls will be trolls...
 
Can someone tell me if node.js can function as well as a commercial-ready server, and maybe what technologies it would be paired with to make that possible? I'm having a hard time finding the answer online.
 
@cᴏʟᴅsᴘᴇᴇᴅ You seem to have followed him here and are only posting messages about him, to me that is more troll-like behaviour
 
2:04 AM
@person27 Have you googled "node js scalability"? That will probably tell you 90% of what you need to know
 
I googled a lot of things, but sure I'll try that one too
 
@person27 our node servers handle the same load as our java server at 10% of the CPU usage
 
@person27 Node is pretty widely used commercially. There are many things that you need to do, but they're mostly the same for any language/server. You can start by looking into something like PM2 to manage the processes
 
And they work I believe on google cloud clustering
 
it's hard not to respond to someone who's always posting. I actually first dropped in here because of a flag on an offensive post earlier
 
2:05 AM
i think uber uses node js
 
so to try to wrap up my what looking to accomplish in phone number and zip code this looks promising don;t you think github.com/jimkang/hail-ants-bot/blob/master/snake-people/…
 
Okay thanks everyone.
 
@cᴏʟᴅsᴘᴇᴇᴅ just be careful. Last week I would have kicked you by now -- you're not helping the situation but stirring it up by calling him a troll
 
that didn't do what i was expecting it to
 
Adding noise to a situation got the room frozen a few weeks ago, so if you see a RO trying to help, leave the topic be and move on
 
2:07 AM
 {
    regex: /\bthe generation of €700\b/gi,
    replacement: 'ophion'
  },
  {
    regex: /\b€700 generation\b/gi,
    replacement: 'ophion'
  },
i failed again prob
 
5 hours ago, by cᴏʟᴅsᴘᴇᴇᴅ
@Traitor I'm not sure about the culture of this room but I would advise that you refrain from posting questionable content, especially in lieu of the most recent post on meta
 
anyhow see this there numbers there
 
if you're quick maybe the bot didn't notice it
 
@FredMcgiff I don't think anybody was able to keep up with the context of your question. I have no idea what you're trying to ask
 
@cᴏʟᴅsᴘᴇᴇᴅ It's not suddenly your job to go around and citizen police the chat just because someone wrote a blog post
 
2:08 AM
@ndugger noise. I got this
 
@FredMcgiff Have you posted a question on the main site? This seems so involved that you really should get a central place to collate it all
 
let str = "San Diego, CA 92115";

// if the pincode is the only digit
console.log(str.replace(/\d+/, ''));

// if the pincode is only 5 digit always
console.log(str.replace(/\d{5}/, ''));
 
@ndugger sterling sterling he's our man if he can't do it no-one can
 
I get it, I'll back down :)
 
@FredMcgiff I can't ask it because I have no idea what the problem is
 
2:10 AM
stackoverflow.com/questions/46202144/… would this work for that js scripit
 
@FredMcgiff I have to agree with david. Your question has so many moving parts I think having them all in one spot on the Main site will get the help you're looking for
 
@FredMcgiff u could remove the pincode and then just use regular expression to see if the remaining string has digits
if thats what your asking
 
@ndugger Sorry, that wasn't my intention. It so happened that I saw the flag and I didn't like the content that that the flag was raised on.
Anyway, I'll leave you guys to it.
Have a good day, and good luck!
 
here my question started with this
https://blog.lateral.io/2016/04/create-chrome-extension-modify-websites-html-css/
thats done but if need u check it out
Meet of my problem is below but instead of text i need to replace a zip code group of numbers .
https://stackoverflow.com/questions/5797661/replace-text-in-website-with-chrome-content-script-extension/38181099#38181099
the last code snippet is bug free but been having trouble on what i would need to replace there to find and replace exact match of group of numbers the zip code with the correct zip code ..
this would run all the time because its just catalog of products but total number is 8000 which they only use to print .
 
So is your problem just trying to target zip codes and not all numbers? and you want a regex for that?
 
2:19 AM
so fixes an issue where no server issue thats not my concern i was tasked this
@david yes yes
and it does have a span class or xpath would that be better option
 
Can anyone tell me why I can access a function within global scope in IE, but not while in Chrome?
 
no matter how good you make the regex it's always going to target other numbers that look like zip codes :S
 
just i brain fart on where i would add that or what i need to do with reg ex causes it selects more then just zip often
 
@Kramb possible strict scoping, need more info
 
so i should go with xpath
 
2:22 AM
@FredMcgiff have you read through this developer.mozilla.org/en-US/docs/Web/JavaScript/… ?
 
but how would i replace it it would i just convert to text
im at the stage where what line would this go the zip to traget
    matchText(document.body, new RegExp("(?:(?:\\+|0{0,2})91(\\s*[\\- ]\\s*)?|[0 ]?)?[789]\\d{9}|(\\d[ -]?){10}\\d", "g"), function(node, match, offset) {
    var newAnchor = document.createElement("a");
    newAnchor.className = "search-term";
    //newAnchor.textContent = match;
    newAnchor.href = "tel:" + match.replace( /(\s|-)/g, "");
    newAnchor.innerHTML = '<img src =' + chrome.extension.getURL("call_icon_10x10.png")+'> ' + match;
    return newAnchor;
});
this example in question
https://stackoverflow.com/questions/5797661/replace-text-in-website-with-chrome-content-script-extension/38181099#38181099
 
@SterlingArcher I have a script that houses all of my global functions. This is called in the head of the document. Each view has its own script to accompany it and it may or may not use functions in the global scope. All of the scripts attached to the views are contained within IIFEs. Is the IIFE what's throwing it off?
 
try prepending* window. to one of the functions, see if that helps
fixed. window, not this.
 
@Luggage this for me or Kranb
 
How are you assigning the globals?
 
2:28 AM
me
 
Kramb.
 
oh ok
 
Simply by creating them outside of the views
 
window.someGlobal = 42;
or just someGlobal = 42
 
the latter
 
2:29 AM
When your pizza rolls are done
 
I think I've spotted the issue, and tonight is not the night to resolve it...Chrome is rendering my partial views before they are supposed to be rendered. All at once as opposed to on demand
 
The first time I used localStorage felt like the final stage of enlightenment lol
!!urban enlightenment
 
@DavidKamer enlightenment Name tag for the state in which the conceptual process separating experience into different bodies is extinguished. Viewpoint in which the usual plural differentiation between such things as here and there and self and other and mind and body and observer and observed has ceased to exist. State called oneness which is such that, for example, the sense organ which hears and that which is he(snip)
 
Where are the real urban dictionary answers?
 
Perform a global, case-insensitive replacement:
var str = "Mr Blue has a blue house and a blue car";
var res = str.replace(/blue/gi, "red");
how would i search for zip code instead of red
str.replace(regexp|substr, newSubstr|function)
@david still having issue with numbers
or apply this not to text but num 9045 confusing searching everywhere must of skip right over it
 
2:44 AM
instead of /blue/gi use /\d{5}/gi or whatever that regex was you got from the zipcode question
 
@FredMcgiff regexr.com
 
the reg x to target just the number or it would take ot all numbers is my issue so could i apply path in replace( and then place text via css
 
Select only numbers 5 digits long
 
if you want to use xpath you probably want to use a different solution
 
caause what i find wiht reg x it targets .. could i make the reg x target only this 5 digit number starting with 8 ends whit 7 or still at risk of replace numbers on site
 
2:48 AM
You would need to use developer.mozilla.org/en-US/docs/Web/JavaScript/… as your starting point
it's unlikely you'd be able to find a stackoverflow answer that does it for you
 
@david but i need to us xpath to locate the span class/ xpath remove that replace with new zip but found it hard to replace xpath
 
what do you need to replace it with?
 
should be able to just locate 5 digit number and nothing but that number in reg ex corect
@david the correct zip code on 8,000 page catalog so a simple chrome extension run it the package . only use is to print parts number and service repair
 
Isn't it just like \d\d\d\d\d
Or \d. And then check the length.
 
@DavidKamer That's not his problem. He can't use a regex
 
2:53 AM
@DavidKamer but that would only trigger that other numbers or only hit my zip code
so i would add reg ex somewhere here
var str = "Mr Blue has a blue house and a blue car";
var res = str.replace(/blue/gi, "red");
 
@david Sorry. I understand that he's trying to use a regex? Or not?
@FredMcgiff you're testing for a specific zip code?
 

« first day (2756 days earlier)      last day (2206 days later) »