« first day (2142 days earlier)      last day (2789 days later) » 

12:05 AM
Dude did you got to an AngularJS meetup @MadaraUchiha ?
I'm pretty sure I see you in the pictures
wait, probably not, just someone who looks like you from that angle.
 
12:35 AM
Greetings.
Does anyone know of a way to remove stuff from a web page through a userscript, but stuff that is not in the page source, but that is somehow loaded later?
 
@Benj Has the video of the talk you give every year been posted online? :P
 
By the way, how can a web page load stuff that isn't in its source? Though a script?
 
yes
There are multiple ways
 
@Cerberus ajax?
 
Ah, is that also a kind of script?
 
12:38 AM
no, not really
 
Is there a way to remove some of those things through Javascript after they have been loaded?
Oh.
 
No, it's a way to request the server for data without page reload.
@Cerberus yes, checkout DOM.
 
I tried onload.
And something like DOMLoaded.
I forgot the exact name.
 
That's an event that waits for certain things to load.
 
I also tried a timer, but it couldn't remove the things even after they were visible on the page.
 
12:40 AM
DOMContentLoaded.
 
Ah, yes, that was probably it.
It didn't work.
But I probably didn't carry out the proper action upon the DOMContentLoaded trigger?
 
probably
 
The action I carry out is document.body.innerHTML= document.body.innerHTML.replace(regex, "");
That probably doesn't work, not even after DOMContentLoaded ?
 
Your code?
 
It works for the other parts of the page.
The goal is to remove all sports articles from the front page.
Everything works, except the "Trending" part, the last part.
I got the html for the "Trending" part by clicking "inspect this element" on the page.
But it isn't in the source of the page.
When I test the regex on the html code from "inspect", that works in Regexbuddy, so the regex isn't the problem.
 
12:50 AM
woah wait up are we trying to parse html with regex
 
Yup, I'm sorry.
I don't know how to code at all.
The only thing I understand is Regex.
The rest is copy-paste, cut up, and glue together.
 
What the hell are you trying to do
 
I'm trying to remove all sports articles from the front page of my newspaper's website.
 
And how are you identifying a sports article?
 
I have a list of titles or subtitles that the page uses to identify sports articles, like "Rio", and "Supercup".
I add them all by hand.
The list is in the script.
Did I mention that I don't know html?
So I really have to do it all by Regex.
The advantage is that it works on any page with a few adjustments, so I also use it on an auction site to remove spam.
And it works well, except that on this page it doesn't work on one block of articles on the side.
 
12:56 AM
I think you need to spend 20 minutes learning how the DOM works
It won't take long
 
I did look at it once, but it wasn't intuitive.
 
Keep looking at it then
 
But perhaps I should do so again sometime...
Haha.
@Meredith Is it because DOM thingies work even for content that isn't in the source of the page?
 
Regular expressions are finite state machines
HTML can have an infinite number of states
 
And what's a state?
Oh, it's probably all very basic...I should look at it sometime.
 
12:59 AM
Tbh I'm struggling to define state
Where are you from?
 
Heh.
Holland, why?
I know the general meaning of the word state...
 
Just wondering if english is your first language
I can give you an example of states
If you have a traffic light, either the green, red, or yellow light is on
So that's 3 states
 
Yes, but html is just a bunch of letters, right?
 
Imagine you're reading it one character at a time
Actually I take that back
One token at a time
Each token represents a state
 
What kind of states are there?
 
1:04 AM
You might have a state called HTMLOpeningTag, which would be followed by HTMLAttribute, then EqualSign, then HTMLAttributeValue, etc
 
Those are all states?
 
Yep
So if you want to know how regex works, here's an example
Say you're trying to validate a number
 
I think I know how Regex works...
 
You start at state 0 (S0), then you accept a - negative sign and move to S1, or you go to S1
i.e.
S0 -> -S1
S0 -> S1
Then you accept a digit [1-9] and go to S2
S1 -> [0-9]S2
Like that
Basically you're just transitioning to a different state based on the next character
 
Okay.
That is rather abstract...
 
1:09 AM
It is, but it's pretty much the foundation of computer science, so it helps to understand it
Anyway, suppose you want to validate something with infinitely nested parens
You'd have something like S0 -> (S1, S1 -> (S2, S1 -> )S3, S2 -> (S4, etc
The takeaway from that is, if you want infinite nesting, you need a way to count how many parens you've already encountered
 
You are talking about parsers now, aren't you?
 
Yeah
 
Oh, well, I can do that with Regex.
 
A parser is just a finite state machine with a stack
You need a stack if you have infinite nesting
 
A salad is just a steak minus the protein
 
1:13 AM
Regex doesn't have a stack
 
I may or may not be drunk
 
I'm sure using Regex is terribly inefficient, but it works perfectly!
Welcome, potential drunkard.
 
@ndugger Explain chicken salad
 
By using negative lookahead, you can parse html very well, at least if what you're trying to do is remove some unwanted elements.
 
You can't parse
What you're doing, by definition, isn't parsing
 
1:15 AM
Treat, then.
Go through.
 
This issue is well documented
 
Haha.
But have you seen what my Regex does?
 
no link to it please
 
It works perfectly.
Except on bits of html that are not in the source of the page.
Of course I understand that it's terribly inefficient and amateurish.
 
Regex can't really parse html your example is to simple
 
1:20 AM
Regex can't parse
 
I'm sure it can't.
But it can remove the elements that I need removed.
 
I don't want you to feel attacked or anything
 
Maybe on some hypothetical page it will fail and do something bad.
 
But you really would be so much better off taking the time to learn how to use the DOM
 
Don't worry, I understand.
 
1:21 AM
Rather than fiddling with regex
 
whatever works dude
 
But that's just not the problem I'm trying to solve right now.
 
Right now you're doing the equivalent of hammering in a nail with a saw
 
I know!
But it works!
 
just don't use this for the space shuttle
 
1:22 AM
Naturally not.
 
Why try matching HTML tags with regex?
 
Because Regex is all I know.
 
He doesn't know how to do anything else
 
And it works perfectly...except on parts of a page that aren't in the page source.
 
@Cerberus how did you manage to learn Regex first?
 
1:23 AM
Regex is intuitive.
 
that isn't the order people typically learn stuff like this
 
I usually learn what I need.
 
even in CS in college regex isn't an intro class
 
I've never learned to code.
Except in Autohotkey. I've written a few programmes in that language.
 
Heh
 
1:24 AM
But html, ai!
 
That was my first programming language
AHK
 
Yay!
 
autohotkey is awesome wish linux had something that works as well
 
You can just use node
 
1:25 AM
linux rarely works like I want it
 
@William it does
 
AHK_Iron was going to be a thing, works on Linux. But I think development has stopped.
 
My first programming language was C or PHP or JS.
Not sure which one of it is the first.
 
C seems difficult?
 
I got started by making bots for online games in ahk
 
1:26 AM
Haha.
 
C is a very difficult language
 
OK.
 
@Cerberus Because it was one of my first, I got used to it.
 
Cool.
 
Everything's an uphill battle with C
 
1:28 AM
So is the uptake of this that there is no way at all to use Regex on a bit of html that is loaded later?
 
I feel pretty comfortable writing C now. Because I've done every possible shit.
 
I.e. on html that isn't in the page source.
 
I'm just gonna say no
 
@Cerberus use DOM methods.
 
But I can't.
 
1:29 AM
um..
 
If there were a way to do it through Regex, my day would be saved.
Inefficient though it be, etc.
 
Sorry not saving your day
 
Haha.
Well, thanks for trying.
 
@littlepootis Haha, that was just posted here...
I am aware of the problem.
But that's not the problem I'm trying to solve.
If I can get at the html, I'm 100% sure I can deal with it.
I'm a poor person who's trying to mow the lawn with a chainsaw.
I'm asking the neighbours whether they have an extension cord, but instead they're telling me to buy a lawn mower.
 
1:36 AM
No we're lending you our lawnmower
Here you go
 
Aww.
I see a page with many terms I don't know and a thousand links...
 
I'm looking at that...
 
Different page
 
I know, I had already clicked on the "introduction" link.
 
1:41 AM
Then you are good to go
 
@Cerberus +KNAWLEDGE
 
Gnawledge?
 
Completely unrelated but tell me that poliwhirl isn't the cutest pokemon
 
That introduction seems to assume that you know the basics of html and Javascript.
I see a ton of unknown terms...
 
Just take your time
 
1:48 AM
I've read it.
I already understood the general concept.
 
Great
 
But this just isn't an absolute beginner.
There are 5 unknown terms in every sentence.
And unknown commands, code I don't know, etc.
 
So take your time reading it
 
I've read it.
But I'm the wrong audience.
 
Usually you have to read stuff multiple times
 
1:50 AM
I'd have to look up 5 words in every sentence.
 
And you'd learn 5 words per sentence
 
Like tag, element, className, HTMLFormElement , etc. etc.
 
Those are words you 100% need to become familiar with
 
HTMLXElement basically means <x>
 
But every page explaining one of those words will contain 1000 unknown terms.
 
1:52 AM
@littlepootis That's a tag not an element
 
@Meredith pls
 
:x
 
jQuery is easier to learn but overused unfortunately
 
jQuery is a masterpiece
 
My job is basically to rebuild an application that used way too much jquery
 
1:53 AM
just not something you'd use in 2016
 
Why too much?
 
Well technically it isn't cuz i do the backend part of that project
But still
 
@Meredith what language is the backend written in?
 
C#
New one is in node
 
that's basically what I'm doing now
PHP to Node
A part of the backend's written in Ruby, but it works, and is neatly written, so I don't want to bother rewriting it.
 
1:56 AM
Yeah that's a no brainer
 
I hate C# despite it making sense at times
 
The guy who works next to me helps maintain the old system
i.e. he hates C# now
 
 
1 hour later…
3:33 AM
 
4:24 AM
WTF my avatar still hasn't changed!!!!!
Somebody broke stackoverflow
 
 
2 hours later…
user4710450
6:26 AM
@Meredith Mostly PHP
 
user4710450
As its hosts are really cheap
 
user4710450
And it has a wide-range of libraries
 
6:44 AM
@Meredith yay that'd be really helpful!
 
 
3 hours later…
9:28 AM
hello guys
i want to create a launcher using electron
launcher = a program to synchronize user files from a server
i used jquery to get a json with all new files
and now i need to download them but i think that i can't using jquery
can i only with nodejs ?
 
10:06 AM
 
 
1 hour later…
11:08 AM
omg omgomg inactivity 0.o
no
phew
that was close
 
11:19 AM
why inactivity ?
 
Guys, I have 6 divs that are generated dynamically, Each div has a hidden child div that and a button, I made a JS script using jquery to the hidden div apear as a dialog when users click on a button of a given div .
 
@AnisSouames 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.
 
The problem is that when I run it, and I click on the button of the second div or the third,fourth,fifth or the sixth no div is popping up .
It popups only if I click on the button of the first div
Please help me out, it's driving me nuts
 
@towc nope.avi
 
alright
what's ya up to @littlepootis?
 
are you serious?
instead of arr[i], just do i + 1
 
what?
 
use a for loop
like in the frist answer
but instead of keeping arr, switch arr[i] to i+1
 
Should var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]; be var arr = 1
 
@towc you mean like $.each()?
 
11:53 AM
no
no, like a for loop
 
there are no for loops in jquery language
 
for( var i = 1; i < 10; ++i ){
  console.log( i )
}
@tereško, can't tell if you're joking or serious
jQuery is just a library in javascript
anything that works in javascript, will also work in "jQuery"
 
to do that you have to install jquery-javascipt-3.4 extension
 
ok, fucker :P
don't listen to him
 
can you post an answer to my question?
 
11:55 AM
Guys any help please ? This problem is making me mad : stackoverflow.com/questions/39180811/…
 
2 mins ago, by towc
@tereško, can't tell if you're joking or serious
Jun 10 '11 at 10:22, by teresko
hi everyone
 
Jun 10 '11 at 10:46, by teresko
wow ... you really dont know how internet works
 
done @TheCodesee
I'd never use that code myself, but that is the style you went for
 
@littlepootis I think I was working on some legacy Yii app which had moth prototype and mootools in frontend at that time
 
12:02 PM
@littlepootis stop pretending you're up to speed
 
think of the worst possible code base you can imagine ... and then add prototype.js to it
 
so, get prototype.js, then add prototype.js to it?
 
I think it had only one version of prototype .. but I am not entirely sure
 
@towc what is new Array(9) for?
 
@TheCodesee creates an array of empty elements that you can map
!!> new Array(9)
 
12:05 PM
@towc ["undefined","undefined","undefined","undefined","undefined","undefined","undef‌​ined","undefined","undefined"]
 
@towc That's not really what I want though because I could of just done var arr = new Array(9);
 
yeah, but now you don't even need the arr variable
and notice how I'm not using item, but i + 1 instead
 
I want $i = 0 and just add 1 everytime
 
using the index of the array
 
rather than creating the empty elements
 
12:07 PM
yup, that's what's happening
try it
 
What about new Array(100000000) for example?
The browser wouldn't be able to handle that
 
then you'd loop from i = 0 to i = 99999999
a for loop wouldn't be able to handle that either
 
what would handle that?
If i needed the url parameter to increase to 100000000
 
splitting it, making better logic
 
The only way possible is to just add 1 each time
 
12:09 PM
trust me, you can't simply do that
 
Why can't I do something like var arr = 1 and then data: {n:item++}?
 
it will take thousands of years and all of your computer's memory
you can
but not in your $.map setup
 
Is there any encoding format's that don't use the '=' sign but can be encoded and decoded simply? I was planning on using something like Base64 but I need something without the '=' sign.
 
So what's the fastest way to do what I want?
 
@TheCodesee waiting a few decades until they make faster computers
what number are you actually trying to reach?
 
12:11 PM
100000000
 
@RowanHarley window.encodeURIComponent
@TheCodesee that's not going to happen. Think of another way
 
So if I had new Array(1000) would the second request be 1000 + 1?
 
@TheCodesee if you need that, you should reconsider your life choices.
 
@TheCodesee no, it would be 2
 
how would i choose a number to start from?
 
12:13 PM
the index
starts from 0
always
in a .map
 
@towc why not?
 
@littlepootis not realistically/practically
 
So.. what's he trying to do?
 
you're not getting a user to perform that many requests to load a single page
@littlepootis I have no clue
1
Q: Automatically add 1 until reach a certain number rather than listing whole set of numbers in an array

The CodeseeI have a list of numbers in an array. One by one with each number in the array, a request is made to an external website (with the number being a url variable) and the contents of the webpage is displayed. Rather than listing all the numbers (1, 2, 3, 4, 5, 6, 7, 8 ,9) in the array, how can I ad...

 
makes no sense
translate to english pls
 
12:15 PM
possibly display forum posts?
 
I can explain it?
 
@towc Will I be able to encode an ip without problems? I see some reserved character's like '.'
 
@RowanHarley try and see ;)
but .s should be escaped
 
Will do!
 
!!> encodeURIComponent( '192.168.0.1' )
 
12:16 PM
@towc "192.168.0.1"
 
well, that means without problems after all :P
 
I'm guessing it didn't work because it doesn't look encoded
What about Base16?
 
what more specifically are you trying to do?
 
I'm helping a developer with a game. I'm trying to encode the ip for the server then show it on screen so that the player's friends can join. At the same time though, I don't want to give away the ip directly
 
12:19 PM
oh, so you're encrypting rather than encoding
 
I guess. I keep thinking they're the same thing
 
well, remember how IPs are just 4 sets of numbers between 0 and 2^8?
 
base16 is not what you're looking for
 
do some basic maths with that
rather than using the string
 
are you suggesting he implement his own encryption algorithm?
 
12:21 PM
send the numbers xored with a random shared key
that's good enough for basic encryption
like, truly basic
 
Ok I'll try that. Thanks!
 
bruh
bruh
 
ip = [ 192, 168, 0, 1 ]; key = [ a, b, c, d ]; send [ ip[0] ^ key[0], ip[1] ^ key[1] ]...
well, in the end you just can't do client side encryption
@littlepootis was just doing it to wind you up. Did I manage?
oh no I just lost my 404 rep 0.o
 
12:43 PM
if anyone could answer this angularjs question, it would be awesome stackoverflow.com/questions/39168256/…
 

« first day (2142 days earlier)      last day (2789 days later) »