« first day (2044 days earlier)      last day (2909 days later) » 

1:01 PM
Recently we've had a team-building activity in Moravia. A couple crates of wine are still en-route to Prague.
 
nice, sick company brah
Manager: Good morning all my employees. Now, in Agile we must do stand-up meetings. Since a lot of you are locked in Sprint and couldn't go home for last 80 hours, we will do push-up meetings to just wake you up little bit! haha!
 
1:15 PM
Is your manager Dr. Eng. Evil, by any chance?
 
yes that's right
 
@Abhishrek one and only user of florian's pastie site XD
 
Hi guys
 
1:23 PM
@JanDvorak * cannot read it because it's chinese for me *
 
> The burnout syndrome is a serious issue in our company
> And it's the most serious
> With people who aren't too hot for their jobs
 
@AwalGarg Not a bad pastie site
He could have preferred Comic Sans font
 
hi folks, if im checking from an XML response if a node is defined, (without a value)... surely if(a == null || a == undefined) should be sufficable?
 
Can someone dupehammer this question to that?
 
because my console log is coming up with cannot read property of nodeValue of undefined, which ive read that if a nodeValue contains nothing it undefines it
 
1:26 PM
by "read property", they mean the object.property thing. If object is null or undefined, it will shout at you.
 
yea thats what it's doing @jandvorak
but i obviously need to check this to throw an error with a promise, but obviously it can't due to it being undefined, is there anyway of doing that other than maybe using jquery?
 
The question is, why do you think said object is defined?
 
Best way to avoid drinking scotch or beer or any alcohol at work (2016)
Manager: "Hey! it's Friday let's drink! Do you want a cup, Sarah?"
Sarah: No, I'm on gluten free.
 
well thats the thing, said object should have a value (CountryName) but often a persons IP blocks this, so it will not show a value in there, which i need it to check.
But its undefining it obviously and therefore it cant run the rest of my code, so i thought the above if statement might check its status
 
More apostrophes, please ;-)
 
1:29 PM
oops, sorry :D
 
Does anybody have ever come in to situation where you got a call from boss on Saturday that you need to comr on sunday and provide support to client
 
Show us your actual code, please.
 
this hasnt got any childNodes btw, but innerText wasnt working :S
 
JSON would probably a better choice, BTW
 
<CountryName></CountryName> ok, i may need to look into the json route then
that is basically the node, and often it would contain for example United Kingdom, but often it could be empty and its obviously then undefined
 
1:31 PM
If c has no children, c.childNodes[0] is null or undefined
 
XML is for old school
 
i'm not very knowledgable on json neither, so i had the XML working,
 
it's a short word for Ex-Markup Language
 
I thought the X stood for ><
 
oh
cute face
 
1:32 PM
ok, but i tried the c = xmlDoc.getElementsByTagName("CountryCode").innerText and it really didnt like it for some reason, :S
 
it was only pulling the data when i used the childNode route :S
 
@KirstyMarks Maybe because HTML collections don't have an innerText?
 
well someone suggested innerText as a possible solution to get this data, for example
<IP>194.72.68.35</IP>
for me to get that data and console log, i had to use the childNode route, it really didnt like the innerText route from the XML
i may look at using the json route, this XML route is really not playing ball lol
 
What IPs do you want to block?
 
1:35 PM
There's a difference between getting the inner text of a node and of an HTML collection. getElementsBy... returns the latter.
 
oh right ok, i dont want to block IPs @EnglishMaster i'm looking to an IP API to check whether there is a value for Country Code and Town, then doing something after to a weather API, but i need to check these first. Hope this makes sense
so is , <IP>194.72.68.35</IP> classed as a HTML Collection then @jandvorak ?
 
Nope, that's a piece of XML representing a node.
but getElementsBy... returns a list of nodes.
 
ok,
maybe i need to read up on this, clearly what i'm doing is not working lol. Although as i said, i know it doesn't have a childNode, understand this, but it wasn't getting the data any other way when it did have a value.
 
you can literally console.log(document.getElementsByTag("something")); and see how it's constructed in Chrome dev console
 
oh ok, may try that
 
1:39 PM
It's simple
 
this is what i got.... Uncaught TypeError: xmlDoc.getElementsByTag is not a function
 
You grab the first element of an HTML collection and store its nodeValue somewhere. If there's no such node, this fails. you should check if the node is undefined, not if its nodeValue is.
 
@EnglishMaster but... you said ByTag
 
ok as in response, that is my first one...
thats what i thought i had done?
var c = xmlDoc.getElementsByTagName("CountryName")[0]
 
1:43 PM
That gets the countryName node. You assume it exists. But you also assume that it always has children (which it doesn't).
 
ok, that makes sense
but then again it becomes undefined if it doesnt exist right?
ie, it doesn't have a value
 
Which means you can't touch its nodeValue
 
ok, makes sense
this is the full XML freegeoip.net/xml
do i then get the response, and store it, then check if tag name CountryName is defined?
 
Isn't it always?
 
no, if it hasnt got a value, it is undefined in the console.
but surely i would be checking that with an if statement anyways
 
1:46 PM
Useful reading, btw: theoatmeal.com/comics/apostrophe
 
Morning guys
Have some questions
My client wants a virtual whiteboard where students will be able to attend lectures
 
OK. My question is: Did you just elide a subject?
 
along with the voice
The teacher will draw things on the whiteboard
 
There's a Slack plugin for that.
 
1:51 PM
!!s/Slack/jQuery/
 
@AwalGarg There's a jQuery plugin for that. (source)
 
function locationIP (xml){
    xmlDoc = xml.responseXML;
    response = xmlDoc.getElementsByTagName("Response")[0];
    e = response.childNodes[0];
    f = e.nodeValue;
    console.log(f);
}
@jandvorak.... didnt quite work lol
 
The changes should immediately catch up !
My only question is, how can i update drawings on every page ?
 
If you want to roll your own (have fun), you could stream mouse events and then dump them onto everyone's canvas.
 
@ZahidSaeed That is technically impossible. Even your eyes can't see changes in an object's position right in front of you immediately.
 
1:53 PM
@JanDvorak How can I stream ?
 
Websockets
 
or... google "togetherjs"
 
let me see guys
 
But yes, you're always bound by the speed of participants' network connections and neural pathways.
 
Is that difficult ?
 
1:56 PM
Kinda. I hate it when I try to catch something, but before the signal from my eyes gets processed by the brain, said something has already reached the floor.
 
You can try some yoga/meditation centers etc. to lower your response time and sharpen your decisions making skills. Or so they say.
 
@KirstyMarks it's best to check if the response isn't null before doing [0] on it
 
Togetherjs has drawing example
 
@karelG, ok, thanks
 
@JanDvorak Is websocket some kinda JS code or php or something else ?
 
1:59 PM
@KarelG can childNodes even be undefined?
@ZahidSaeed look it up
 
That is what is happening @jandvorak
 
@JanDvorak Tutorials are using it with Node.js :/
 
when there is no value in CountryName it is undefining it
 
@JanDvorak no. It returns with a list of live nodes. If there is no child elements in the document, then the list is empty. It would be strange to get undefined from it
 
@ZahidSaeed Yes. Trying to get websockets to interact with my C# server is on my todo list yet.
 
2:01 PM
@JanDvorak Can I use it without Node.js ?
 
Yes an no.
 
Just to keep things simple
 
@karelG, this is what is happening..:S
 
didn't have follewed the whole conversation. Where do you get "undefined" ?
 
freegeoip.net/xml for example when i am looking to city @karelG and attempting to check if this has a value, or is undefined it is saying, cannot read property of nodeValue of undefined
 
2:03 PM
.childNodes[0] is legit. .childNodes[0].nodeValue can fail.
 
hmmm, i got this off here :s
@janDvorak jsfiddle.net/d6qbs38x/6 see this is returning this is cool, that it is defined, yet its not :S
 
if node has no children, node.childNodes[0] is undefined, not node.
 
i haven't used that, i stripped this out
i thought if checked the first response has childNodes (which CountryName would be) then to proceed to check the CountryName is then defined?
 
childNodes can be an empty HTML collection. Empty collections aren't undefined, their elements are.
 
but surely then i should be able to check if something is defined by that then? which i thought my code would check ? :S
 
2:13 PM
Your code doesn't show such a check
 
  response = xmlDoc.getElementsByTagName("Response");
  if (xmlDoc.getElementsByTagName("Reponse") === null || xmlDoc.getElementsByTagName("Response") === undefined) {
    console.log("Crap");
  }
 
responsecheck1 = xmlDoc.getElementsByTagName("CountryCode");
     if(responsecheck1 == undefined || responsecheck1 == null)
 
the repeatment of xmlDoc.getElementsByTagName in the if condition isn't required. You can use response instead
 
That checks if the CountryCode node exists, not if it has children
 
but i had the lines above to first check the response one?
 
2:15 PM
3 mins ago, by Jan Dvorak
childNodes can be an empty HTML collection. Empty collections aren't undefined, their elements are.
 
oh right ok @KarelG
 
same for getElementsBy...
 
i tried getElementsBy and it said it wasn't a function @janDvorak
 
...
 
sorry am i missing something here?
i must be 0_o
 
2:16 PM
Note the ... in getElementsBy...
 
yep,
ok,.... so this returned cannot read property of [0] of undefined...
 
What exactly did you try?
 
but i'm not sure what you want. The IP ?
or just the whole xml ?
 
i wanted to check that it 1. Contains United Kingdom in 1 node, and 2. Contains a town value.....
 
2:28 PM
ah
 
because i need it obviously to be in the UK, and also to check that we have a town populated. This is going into another API to get the local weather you see ;)
it's so frustrating as this is the only part of my code that isn't working, everything else is XD....
 
are you sure that it's not the only part which isn't working? :P
 
hahaa, that is a valid point XD....
 
i'm not even going to tempt fate yet,............
 
2:35 PM
 
So, let's try something else. Have you used the debugger yet?
It's a viable alternative to just guessing what went wrong.
 
the dev console is a powerful tool for front-end devs. Don't try javascript if you're afraid of using the dev console. It can be accessed by F12
 
She has seen the console.
The debugger is one of the other tabs in the dev tools
 
then the debugger is the next step
not sure if it's enabled by default
 
In firefox you have to click the tab before "break on exceptions" starts taking effect, then it lasts for the whole session.
 
2:38 PM
oh does it? didnt know that. @karelG, ty for this.
 
> Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
Why does your profile say hypnotic @KirstyMarks ?
 
because i'm a trained hypnotherapist :)
 
How does that even work?
 
How is debugging twice as hard specially in imperative code with current tooling and in functional code with possible tooling?
 
@KirstyMarks freegeoip.net/json it has a JSON API
just use that
 
2:41 PM
yea i need to then parse it, its something 've yet to read up on... tbf both of the ways are somewhat hurting my head @benjamingruenbaum
 
@AwalGarg because you have to figure out what the code does which is almost never as clear as someone telling you what to do since there is a mismatch between how you do something and what that something is.
@KirstyMarks JSON is trivial in JavaScript. You just JSON.parse the response and that spits out a JavaScript object.
Using modern APIs (polyfill for older browsers):
fetch("http://freegeoip.net/json/").then(x => x.json()).then(o => {
    console.log(o.country_code); // UK for you
});
 
@BenjaminGruenbaum that assumes someone else wrote the code and he wrote it un-idiomatically and he didn't add comments where needed and that the code is complex enough that there exists the said mismatch in way that it matters.
 
@AwalGarg that someone else is you from 2 months ago - doesn't have to be a different person.
Some rules are easy to reason about - some problems have real business requirements that can't be expressed clearly.
Also, of course it's not accurate
 
@BenjaminGruenbaum yeah so that's just that "problems" are hard and not "debugging" is hard.
 
@AwalGarg debugging in particular is hard.
 
2:44 PM
@KirstyMarks json parsing is very easy. It's just one function. And the keys (not tags) can be searched per level by hasOwnProperty( <keyname> )
 
XML parsing is pretty easy too - you just need to find a good tutorial that explains it :)
 
the XML doesn't provide that. You have to do that from the parent's level, or check each level manually
 
It's not the sort of thing we'll teach you from scratch in the room really
 
oh right, ... yes @BenjaminGruenbaum finding a good tutorial is HARD,
one for dummies anyways
 
I agree. Basically, parsing XML and searching it is similar to using the other DOM APIs.
 
2:46 PM
(new DOMParser).parseFromString(xmlString, 'text/xml') // good tutorial /s
 
I don't think there is any tutorial I'd recommend in all honesty.
@AwalGarg great, and how do you use it?
 
i completely understand, and appreciate feedback, tbf i've learnt more JS in this past 3 weeks than i have in my whole coding life,
 
me neither :p
 
I wished that i wouldn't be set a task to do something which i know hardly anything about :S
 
@KirstyMarks Don't worry. I dabble into C# in my place despite having been hired as a front-end guy :-D
 
2:47 PM
I don't use XML. case closed
 
you can see it from this perspective: you have learned something new. And maybe useful for future tasks. Something that broadens your abilities.
@AwalGarg doesn't work if the end tag got forgotten
 
@jandvorak, see this is what i mean. Im front end, give me HTML 5 and CSS3 anyday!
 
@KirstyMarks Javascript is front-end
 
i would even prefer Wordpress coding!... at least i have some form of understanding,...
 
@KirstyMarks I recommend freecodecamp and the non JS parts will take you seconds - but that's a big undertaking.
 
2:48 PM
oh ok, i think i did sign up to that tbh
 
@KirstyMarks well, if you know some JS then "JavaScript: The Good Parts" is decent and really short. Eloquent JavaScript is also nice and so is "Understanding ES6" after one of the former.
 
i'm using codeAcademy atm,
 
I have learned scss on day -1 of having been sat in front of it
 
@KirstyMarks wordpress relies on js :o
 
The problem is non of those teach you how to work with XML
 
2:49 PM
but i feel more confident using Wordpress because i've learnt it that way,
 
@JanDvorak it gets significantly easier to learn a new API the hundredth time
 
@JanDvorak is that a typo for "day-1" or you learned it before seeing it?
 
The key knowledge of front-end development: don't touch w3schools
 
yea, alot in here ive said that
i've been using Code Academy for basics
 
@JanDvorak YOU HAVE MENTIONED THAT. * SLAPS *
 
2:50 PM
use/mention distinction
 
oh also hastebin is opensource. TIL
 
yea i have mentioned W3 in the past :S
 
w3what?
 
i didn't know it was that bad at all. We use it all the time at work
W3 Schools
 
fail
 
2:51 PM
sorry missed the schools bit.
 
One of our guys at work likes w3schools. He also thought var made a variable global.
 
ok, even i know that isn't correct
 
w3schools is bad because it has the "schools" part in its name and schools are bad.
 
just read an article titled as " Leonardo DiCaprio used a private jet to receive a ... environment price ". Ha
 
hahaa!
 
2:52 PM
@AwalGarg how about w3resources then?
 
@JanDvorak I don't know what that is
 
i just shared a meme to do with Harvey Price using the word c*%t on live TV, with David Cameron in the UK... this did make me chuckle
 
@AwalGarg It literally is w3schools rebranded
 
@JanDvorak rebranded schools are still schools, which is bad
 
did not know about that w3resources. * checks *
 
2:53 PM
Even if you don't actually learn anything there?
 
@AwalGarg be cool. stay in school
 
@JanDvorak well if you don't learn anything from something which is meant to make people learn, then that something is useless. useless things are also baaaad.
 
@Neil Nah, I prefer my day job
@AwalGarg #destroyAllVideogames
 
@JanDvorak he doesn't know what videogames are
 
wth, that "w3resource" is more worse than w3schools
too much garbage between the content
 
2:56 PM
OK.. rebranded, reskinned and with broken links
 
I think w3schools aren't that bad now, they used to be awful but now they're just really mediocre
 
i even would suggest w3schools over that
 
@JanDvorak and this world too
 
@BenjaminGruenbaum they still use w3schools indentation style
 
wait w3schools has a different indentation style? hwat
 
2:57 PM
meh
 
do they use | as indentation character? -_-
 
They use OTBS with 0 spaces indentation
 
!!urban otbs
 
@AwalGarg otb Not neccesary someone that is "off the boat" but acts like he/she is. They only communicate and make friends with other Russians and will always prefer to talk in Russian rather than English. They love wearing AX, Diesel and other expensive European clothing choosing the most gayest looking clothes of the group (shirts with rips in the middle of them, green jeans, i.e.) They all either drive Mercedes, BMWs, Ac(snip)
 
The OTBS part is good. The 0 spaces part isn't.
One True Brace Style
 
3:01 PM
well @karelg your code has thrown me. I'm going to look at it later as clearly i can't put it into context XD...
 
you only have to use the 1st function
(is it not commented enough ? :P)
 
yea i thought so , but when i changed it, it went EH! lol
 
Are you actually laughing out loud?
 
roflolmao
 
yep, i may as well or i would go grey
@karelG jsfiddle.net/d6qbs38x/10 I did this
 
3:04 PM
you have to call contains(xmlDoc, 'CountryName', 'Belgium') and keep the function?
just replace the 2nd arg for the tag that you want (IP, CountryName, ect) and the third tag for content of that tag
 
i think i been looking at it all day, .... well thats the thing, when i check the town, for example which i need to check, i need to check thats not empty, rather than it contains a value :S
 
ah, remove that condition then
 
that returns unexpected string on the xmlDoc in the first part
ok...
 
you have two functions with same names. That confuses me
 
that seems to work, its saying its broke, which it is, as CountryName does not contain "United Kingdom"
 
3:12 PM
Hey guys. Been struggling with this for some time..
https://gist.github.com/anonymous/6be149c91b2cc45edf586290b367fa3d
I cant get the <a to be appended. Do you have any idea?
 
@KirstyMarks well, the XML string doesn't have UK in it
 
yea it had nothing in it
 
your fiddle is a mixed content between what i wrote and what you have added
 
reason being as i thought reason why it wasnt working as it wasn't calling locationIP which is the xmlresponse (which i havent posted)
 
there are two locationIP btw, the last one will be used
 
3:16 PM
yes, reason being when i don't use it it said it isn't defined :S....
maybe i should just nuke this project as clearly i'm lacking in understanding as this is a mixture of things i've found on here and other resources (the rest of my code that is)
 
@KirstyMarks Your weather API is using json and you want to access it by XML
do you know about "generic" functions
 
a little, ... tbf both the apis im using can be accessed via xml and json
i can happily write a basic function
 
i still would recommend to use json since it's easier to walk through
Give me the two api urls and i will put a small fiddle example
 
ok i will look at the json call, i have the ajax detail somewhere,
 
maybe you can work further on that
 
(err, about retrieving the json: do you want to use xmlHTTPrequest or fetch ?
 
fetch will be ok i think
basically the promise is working as it should, i mean u can see what im doing if this makes sense
thats my whole code, i dont expect anyone to write it for me, i want to know where im going wrong to learn,...
basically i was checking the first API to see 1. It is the United Kingdom, and 2. There is a town available. .... I was then using the data of town to construct a URL to pass into the 2nd API to check the local weather, if that makes sense
 
i'm only going to build some components that you can use
 
thats fine, i appreciate it. I need to find out where i am going wrong eventually with this XML, JSON is not something i looked into, imho
i found this,
 
1 message moved to Trash can
@KirstyMarks Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
3:30 PM
Wow didn't know I could do `debugger;` in node :P
 
fml!!! ARGH!
 
1 message moved to Trash can
@KirstyMarks Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
caprica doesn't have mercy
 
Caprica six needs no mercy
 
no lie! It's like i delete it and bam its on my butt
ok, so i found the ajax call, great its printing the object to the console.... i just need to find out how to access it's values lol... as i said JSON route i didn't look down
this is the things i do whilst waiting for the wife to get out of bed after work.... :S
whats the difference between a fetch json request and using ajax?
 
3:39 PM
it's a new interface that helps you to fetch resources. It's more flexible than xmlHTTPRequest
 
oh right ok,
interesting
 
davidwalsh.name/fetch this seems to explain it well
 
see because the object is already in the console, do i still need to parse it?4
i tried this, and it didn't work
console.log(obj.country_name);
 
is the obj a result of json.parse(response) ?
 
 $.ajax({
     url: 'http://freegeoip.net/json/',
     dataType: 'jsonp',
     success: function (data) {
     console.log(data);
     }
     });
result of this
but it is as an object in the console. log
but someone said that this type of request is already parsed?
 
3:43 PM
Holy christ
I just doomed my windows system with a mad log
 
oops
 
dataType: 'jsonp' -> json
 
oh right ok, this was copied from a question in here :)
well its printing to the log, but i don't have a clue how to access this, i will have to have a read
 
console.log(response) should show you the content in dev console. just click it
 
yea it does
 
3:52 PM
Anyone have a clue of what to do?
 
its passing the data as an object in the console log
 
you can check it by clicking onit
 
Has anybody created a better buffer class for node that is good for rapid expansion
 
MORNIN ALL
 

« first day (2044 days earlier)      last day (2909 days later) »