« first day (3345 days earlier)      last day (1586 days later) » 
00:00 - 22:0022:00 - 00:00

12:00 AM
@user400654 You may also like Android chat if you want to join. Its very active and they are fun(ny).
 
i dunno, i've experienced bad things from android devs
 
lol, they all hate android as much as anyone
 
or mobile devs in general
 
thats mobile-devist ;)
 
12:19 AM
I hadn't seen this before
-192
A: We’re removing “Hot Meta Posts” from Stack Overflow's sidebar for now; moderators now fully control [featured]

Sara ChippsI’d like to add some context to the “why” we are doing it. Tim, kindly, wanted to shield me from ire, however, in taking this job I signed up for this. I'd like to come here, own my decision, and deliver this feedback. Stack Overflow Employees have panic attacks and nightmares when they know th...

surprising
 
I wonder if the CEO of SE would step down if we all signed a petition
 
I don't think you'd get that many signatures
the CEO stepping down wouldn't fix the problem, it would probably exacerbate it
 
so then who's to blame?
 
company culture at SE
their mission diverged from ours entirely a while ago
 
someone is the boss making the decisions
 
12:31 AM
it's not any one person's fault, but I think Tim or Sara could probably fix the problem singlehandedly if they were persuaded to
 
Tim Post
I try not to say his name because it makes the hairs on the back of Madara's neck stand up
and then he comes here and scolds me
 
ah
not that it will make a difference but maybe i'll email them
and complain
 
outside channels have proven to be more effective than Meta so maybe that's not a terrible idea
 
their body overflows and its pissing me off
 
1:00 AM
how tf is my electron imessage app faster than apples native one?
it makes no sense, but ok
 
 
1 hour later…
2:29 AM
Hey is there a way to attach a shadow with content and have it closed?
 var sh = newDoc.attachShadow({mode: 'open'});
This is the only way to really "create" shadow dom
but if you add things, its still open
and you cant close it afterwards
so is there a way to "add items to and close the shadow dom"
 
any Eclipse users in here?
 
2:55 AM
Does anyone know how to create a json file to store a list of links to jpeg images
 
like, in notepad?
|| magic
 
(∩ ͡° ͜ʖ ͡°)⊃━☆゚. * ・ 。 ᵀᴴᴱ ᴳᴬᴹᴱ
 
The jpeg files are currently in my directory
 
right
like, you can use a server to make a json file,
if you have a server-side language, like php
 
Haha I have never learnt php before
can JS do it?
I guess I'll look into learning it for now then :/
 
3:09 AM
node.js can
but...
gotta learn that too
it's not just js
it is but it isn't
 
3:21 AM
@user400654 Is it correct to say the contents of the json file will contain the file paths to the images that are currently in its source directory?
Most tutorials keep linking them to images found on the web with http links
 
the json can contain whatever you want it to contain (as long as it's text)
 
@user400654 Hmm, but if I store the file paths to jpeg images in my json file, doesn't that mean I need to use some kind of Node API like reading a file, which might not work on the client side?
 
correct
something has to "serve" the json to the client
if you create the jsonfile manually in notepad, all you need is something like apache, nginx, or iis
if you want the json to be "generated" by server-side logic, you'll need a language
 
@user400654 By "manually", do you mean making a json file with all the information(like the file path to the jpeg images) directly before putting it in the web application?
Some links suggested I convert to DataURI format, but the byte code doesn't look nice in the file. Is that even practical?
 
4:07 AM
@PrashinJeevaganth Do the files names or locations ever change?
 
4:23 AM
@JBis No
 
How many files is it?
 
Do you have node.js installed?
 
Not really, I kinda jumped straight to ReactJS but I think I can install it now if the solution works
 
What type of computer is the server? Linux?
 
4:27 AM
Actually I'm working on a mac
It has NodeJS already, just checked
 
What are you going to use to host the app (and the json file)? Node? Apache?
 
For now I'm currently on Heroku for hosting, but changing it soon once my colleague gets back
 
Ok, I was gonna suggest writing bash script but lets just use node since its installed.
 
I don't really know what you meant by hosting the json file. I always push the entire repository to the herokuapp when I'm done with changes
 
Are the image files on the Heroku instance?
 
4:30 AM
Not yet, they're still in the directory, which is in the repo
 
Alright, I suspect this is an XY problem. What are you trying to do big picture?
 
Big picture = Big brain : D
 
https://morning-dusk-53803.herokuapp.com/

This is an app with mainly clinic locator features that will filter out nearby clinics based on postal code, and upon clicking on a clinic tab, you can see text elements such as Clinic Name and Addresses.

Now my client is interested in adding the feature such that for specific clinic tabs, there are also image elements to it.
 
|| mdn img
 
4:37 AM
I’m thinking of implementing a button to the old dialog that pops out, to redirect users to the image element when the clinic they click falls into the list of clinics that are provided with this additional data
 
^^ look at that html element and the src attribute. I suspect you don't really need a JSON list necessarily.
If its not dynamic than you can probably just hardcode the clinic images
 
Do you mean like
42 classes, 1 for each jpeg file?
 
I mean it depends on how you want to do it. If you are sure they aren't going to change than you can simply generate (or do it manually) css backgrounds or html img elements.
Paths to the images in a json file aren't going to help because they will refer to the path on the actual instance not the web path (url).
/Users/example/Desktop/image.png vs example.com/images/image.png
|| afk sleepy
 
@JBis bye JBis
 
@JBis Alright I will look into it, thanks
 
4:47 AM
@PrashinJeevaganth JBis is afk: sleepy
 
@JBis nice bot
 
 
2 hours later…
7:04 AM
hi javascript
 
@prasanth Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
7:48 AM
could anyone help on how to know if a nested call back returns error or success?
i have something like this
const output = ()=>{
return new Error('show error');
}
and the below makes use of it
 
you have an Error instance when calling output()
 
const final=(output)=>{
return output;
 
you need to call it.
 
i want to know if output returns error and if it does, i want to return null and stop execution
 
8:06 AM
you can use instanceof to check the type of the object
eg
 
i did but didnt work
i failed a test because of this
so i wanted to know the right answer for future refrence
 
if (output instanceof Error) {
  return null;
}
else {
  // ?
}
 
let me try this
 
but it depends if you are passing on output value (there is a huge difference between const o1 = output and const o2 = output()
o1 is a function object here, whereas o2 is the Error object
(if you returned it)
 
i used o1, maybe thats the reason
 
8:10 AM
||> function output() { return new Error('hey'); } [output, output()].map(obj => [obj instanceof Error, typeof obj]);
 
@KarelG [[false,"function"],[true,"object"]] Logged: ``
 
see the difference?
 
thanks alot @KarelG
 
8:44 AM
RIP UK
 
9:01 AM
Independence voters went to Conservatives.
(they lost all of their seats heh)
@BenFortune are you going to stay in UK?
 
I don't think most people understand what no deal brexit means
I hope the Tory win doesn't also imply a no deal brexit
 
@Neil He tried to push it before, and I have no doubts that he will try again
@KarelG Well, yeah
The privatization of the NHS is the scary one
 
that NHS thing was a ... strange news
 
9:16 AM
Corbyn ruined labour, he refused to acknowledge that the election was pretty much only about Brexit, and he kept a neutral stance on it
 
privatizing public health is the most stupid thing to do. If there are debt problems, investigate why it occurred.
 
@BenFortune it probably cost him the election
 
could be
 
everyone wanted to know how brexit would be handled, and the Labour Party didn't really address it
All they had to do was say they wanted to see it resolved as quickly as possible, and they'd have gotten at least 10% more of the general public votes
 
> Here's some free broadband and a minimum wage increase
 
9:21 AM
Can't wait for the new Jonathan Pie video...
 
The Tory smear campaign obviously worked
@geisterfurz007Stopthischaos haha he's going to have a field day
Becuase nobody will be able to tell the satirical from the real
 
I cannot tell the difference between satire and real rant of him in any of the videos :D
His last video ("Decade of Tories" or something like that) felt like it was not really satire at all anymore especially
 
just "eh"?
 
9:55 AM
does anyone use the html <input type="date"/> stuff?
taking a closer look at it, it is only really supported in chrome
or tablets/smartphones
the edge and firefox support for it is horrific
 
@Wietlol yes; but with a js datepicker on top of it
so that when other browsers are doing it better, you simply remove it from the datepicker "must pick" list
 
js datepicker?
 
although for consistency, you can use a datepicker
 
do you have an example
 
lightPick.js if you are using moment.js
or flatpickr
oh lightpick got unmaintained
use one of the forks: github.com/wakirin/Lightpick
or look for something else that suits your taste
 
10:07 AM
how would you hide the js datepicker on mobile?
 
check the useragent or something
or screen dimensions
 
10:23 AM
https://paste.ofcode.org/35WW79n9erMh8Pjf8Bdj9QC

Does anyone know how to fix the error by Line 113? It gives "expected assignment or function call: no-unused-expressions ReactJS". I know that it has something to do with putting return statements in arrow notations, but I can't seem to get rid of it because I want the button to redirect only if my boolean condition is true
I tried to abstract the logic inside the arrow notation by making another method, but it seems like the Link cannot be separated from the Button
 
55
A: expected assignment or function call: no-unused-expressions ReactJS

Andrey MedvedevThis happens because you put bracket of return on the next line. That might be a common mistake if you write js without semicolons and use a style where you put opened braces on the next line. Interpreter thinks that you return undefined and doesn't check your next line. That's the return operat...

 
@BenFortune I didn't open any braces after my return statement so idk how is related to me
 
parens around the <Link>...</Link> ?
 
@Wietlol Do you mean putting an else-clause? else {<Link> ...</Link>}?
 
10:41 AM
I mean (<Link>...</Link>)
similar to how your render method does return (<div>...</div>);
not sure if it works tho... but that'd be my guess
 
@Wietlol Nah, not working, I don't think <Link>...</Link> is a return value, but high chance I could be wrong, idk
 
it is not what you return, but you do directly mix the html and js, not sure how it distinguishes between the two
js in html needs to be surrounded with {}
but html in js... iDunno how it makes that distinction
 
@Wietlol Do you perhaps know of a way to abstract the logic better, I was forced to write it like this because the <Link> cannot exist in another method on its own without <Button>
Maybe that could dodge the error, idk
 
is anyone familiar with the youtube API? trying to work out how to find the onBehalfOfContentOwner id i should use when creating a playlist?
 
11:04 AM
im not familiar with react in js tho..., not sure how you can refactor that
 
 
1 hour later…
12:06 PM
Hey guys, if a button doesn't redirect to another page as expected in React, what is the first thing you suspect that has gone wrong?
 
@SamuelLiew thanks!
 
hi there
tslint eslint prettier scsslint husky in angular project?
I am a bit lost here..
 
scsslint, eslint, tslint are code quality checking tools
husky is scripting with git i think
prettier is just formatting
 
12:21 PM
https://paste.ofcode.org/b4RUKRtMndfRVihcCFi3SX

Is there anything wrong with returning a <Link>? I did that to stop the compilation error , but now the routing link doesn't seem like its working. Don't know where else there could be problems
 
hi there
 
@Fateh Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
welcome!
 
12:38 PM
Hi there,
Find HCF and LCM possibility length pairs from any single number
Example:

If you pass 4 its output should be like
{0, 1}, {1, 0}, {1, 1}, {1, 2}, {2, 1}, {2, 3}, {1, 4}
Find out length of pairs.
any idea on how to do it
in javascript
 
@MohitSahu what is HCF and LCM?
 
highest common factor and least common muliplier
 
ok, there's still a little confusion here
how would you get {0, 1} from 4 for instance?
 
that's the logic I am looking for . is it an interview question. but I am not sure how this output is coming
 
that's a good question
it sure has stumped me at least :)
 
12:51 PM
don't you need at least 2 numbers?
 
https://paste.ofcode.org/cL3knXqHQxzPf3DYzHRypT

Does anyone have any idea why this page's output is a white screen?
 
Completed my first full on API out of legitimate code, and actual good practice... github.com/Team-Functional-Workflow/ShadowGate-API
like finally
I know how to use classses now, so life is like ten times easier
 
@JamesBot Thanks well do that
 
Its a bot
No need to talk to it
:P
@JamesBot Help
Or.. not anymore?
|| t
 
Invalid command! Did you mean: 3, d, ^? Try help for a list of available commands..‍.‍.‍
 
12:57 PM
There we go
Hey guys I gotta go do a math test
wish me luck
sigh... highschool exams
 
1:12 PM
heh
but it is good that you have used the class syntax
 
2:09 PM
$('[data-search]').on('keyup', function() {
                //console.table("get into the first function")
                var searchVal = $(this).val();
                var filter = searchVal.toUpperCase();
                //console.table(this)
                //console.table(searchVal)
                var filterItems = $('span.chevron__text').parent('span').parent('h4').parent('div').parent('div');
                for (let i = 0; i < filterItems.length; i++) {
                    var a = filterItems[i].getElementsByTagName("span")[0];
 
If you have multiple conditions and you have a different process for each combination, is there anything better than
`if(x){`
` if(y){...}else{...}`
`}else{`
` if(y){...}else{...}`
`}`
well shit, I thought that would work
 
guys I need a help with this code, because it set everything to hidden
 
@Hypersapien don't use backticks for multi-line code. Use ctrl+k instead. Backticks are for code within text, like this code here.
 
if (a)
    if (b) ab()
    else an()
else
    if (b) nb()
    else nn()
this is quite a common pattern actually
a common solution is to build a map of the compound keys to the action value
so, the key here would be based on 2 booleans
 
@KarelG Isn't ctrl+k for when you want the entire post to be formatted?
 
2:15 PM
you cant have half formatted tho
welcome to SO-chat
 
Write code in notepad++. Make unformatted post. Paste code into chat and hit ctrl-k.
I guess
Also, they make the text entry box resizable, but they don't make the footer bar resize with it.
 
if (x && y)
else if (x)
else if (y)
else
here you go
 
switch(true){
    case x && y:...
    case x && !y:...
    case !x && y:...
    case !x && !y:...
}
 
hmm missed a branch 🤨
 
@KarelG you didn't really. There's four blocks to execute there.
 
2:23 PM
exhausted atm :P
 
the switch is far more confusing to me though
 
9:30 am here. But I only have to work six hours today.
 
I don't normally think of switches as running multiple code blocks
 
I meant Karel's
I thought that's what Karel was talking about
I finagled my hours this pay period to get off at 3:00 today for a D&D game. Found out this morning it was cancelled because people are sick.
 
well enjoy your time off at least
 
2:27 PM
Yeah. My girlfriend and I will do something.
 
@KarelG adds z
 
also, I have to think the other members of your D&D game don't have actual jobbs
 
@Wietlol that would require a pattern (there is one 🙂)
but for those 2 booleans? nah
I'm off for weekend. Bb
 
The DM is a psychiatrist and the game is actually in his office. The other players are his two daughters, one of which is 14. The other is 21 but has non-regular work hours. And my girlfriend who works 7:30 to 3:30.
But is off today anyway
I just joined this campaign and haven't been to an actual session yet.
Just as well because HeroForge mailed out my mini yesterday
 
2:45 PM
I'm pretty sure I'm in an infinite loop somewhere. I keep getting "Maximum call stack size exceeded" errors but when I try to track where it's coming from, the whole page breaks.
 
yep, sounds about right
 
@Hypersapien do you have the stack overflow exception?
 
I got it. This is in Vue and I should have had that array in data:{} and have it just generated once when I download the information for it instead of having it in computed:{}.
 
3:19 PM
Is there any way to have fetch receive updates to an upload?
 
Not that I’m aware of
 
Bleh. I'll have to forgo that then
 
 
2 hours later…
5:06 PM
apple's dumb ass design is pissing me off
 
I refuse to own any Apple products
 
5:36 PM
been waiting for id verification from their dev shit for a week now
 
hi I've got a javascript function which onclick should make a div visible while the div is always visible in the aspx page can anyone tell em why?
 
6:13 PM
@Riccardo can you post your code?
 
actually I've almost made it thank you anyway
 
Does anyone know which API does all the document.getElementsByTagName() and other document methods belong to? Is it specific to JS?
 
yes it is it's pure javascript
 
6:34 PM
If I am generating HTML in js, is it still bad practice to use inline javascript event handlers? From my understanding the main reason that it is difficult to manage is because its difficult to manage and logic should be separate. However, this isn't an issue when the logic is generating the view, right?
 
6:48 PM
eh
i still wouldn't do it on principle.
 
Can I ask how do you "fetch" data from a HTML file you already have in your repository?
 
the html file would have to be in a location where you could access it directly with a web browser
then you would just use fetch
|| mdn fetch
 
An error occurred with the request.
 
I see tutorials, most people manipulate HTML elements, from inside the html file by including the JS code under the <script> tag
Is it not possible to do it without fetching and also with a react component?
 
6:57 PM
if you fetch an html tag using ajax (aka fetch or xmlhttprequest) you'll get it as just text
you can use string manipulation to get what you want out of said text
and then stick that into the state for your component to render
 
James is having issues with google search I gotta look into it. I think Google is beta'ing something so the class changes messing up the request on some searches.
 
@user400654 What is the difference between fetching, which you have just mentioned, and the document Web API like document.getElementsByTagName(), which we commonly see in HTML code?
 
fetch performs an http request.
it's a function
fetch is part of the Web API
 
Oh yea, I kinda forgot that if you wanna access something from your own repository like a HTML file, you gotta import it right?
 
i mean
import is something else
and is an option... if you're using something like webpack and a plugin to make it work
 
7:05 PM
@PrashinJeevaganth For purposes of this convo, require nor import is available on the front end
user400654 is correct about webpack etc. but for you are doing, you don't need or want it.
 
I'm still rather confused with this front end, server and client concept. Initially the application I'm working on already uses json files and png files in its repository, and by import statements, the application is able to use these resources which are constant and unaffected by the user's actions
Is this what is meant by "available in the front end"?
 
what do you mean by repository?
 
A directory with all the files I'm working on and packages etc
Basically, what you can see if I put up my stuff on github
 
what is hosting it?
 
@PrashinJeevaganth You make a request to example.com. example.com has a server that responds with content. You are the client in this scenario, example.com is the server.
 
7:10 PM
or, how are you accessing the html file in your browser?
 
@user400654 I'm hosting on herokuapps for now
 
kk
in that case, that's your webserver. the "server"
your browser is the client
the client can only communicate with the server over HTTP
 
You need to make code for both the backend (the server) and the front end (the client). Both are located on the server because the server will deliver the front end code to the client so they can access your site.
 
(or a few other protocols, but lets not get into that)
 
Is the code for both backend and front end in JS?
 
7:16 PM
It can be. However you can also use PHP (but don't) or Java or ruby on rails or many more for the backend.
js or php is probably going to be the easiest for what you need to do
 
can document.getElementsByTagName() be used outside of a HTML file, like maybe inside a ReactController?
 
it can be, because you're not really outside of the html file. but you generally don't want to use those methods with react, except for the first few lines where you're attaching react to the dom.
 
What's Dom?
 
the document
 
Oh gosh
I got the “You may need an appropriate loader to handle this file type” error trying to use the document API inside the React Component, then I just realise I don't even have a webpack.config.js file
 
7:33 PM
?
 
i don't understand how those things are related, that error comes from importing something.. but you don't need to import anything to use the document api, it's global.
 
I mean when I tried to do import PictureHTML from "../images/Pictures.html"
It told me “You may need an appropriate loader to handle this file type”
And it pointed to the <html> tag in my html file
 
yeah, you can't just import html files in javascript, you'd have to tell your build process how to handle that for you so that it can convert it into something that can be done in javascript.
 
Hmm so you can only import json and png files?
 
7:39 PM
you can't import either of those in javascript on a web browser
webpack uses those instructions to convert it into something that does work on a browser
 
Haha I dont see a web pack file in my project, but the import json/png file statements are not giving errors
strange
 
well
you migh tnot be using webpack
it's not the only bundler
 
7:57 PM
\o
 
8:20 PM
How can I replace all the occurrences of string from a given string?
 
the replace method might be a good place to start
 
I am using variable for find and replace.. like
replace_str = new_html.replace(/\s+/g, " ")
var find = String('fi_other'+(num));
var replace = String('fi_other'+(+num+ +1));
 
what are those second two variables for?
 
first is the variable which we need to find in the string (variable replace_str)
 
> 'fi_other'+(+num+ +1)
wat?
 
8:23 PM
second is the one new string
'fi_other'+(+num+ +1)

is the dynamic string where num may be 1 or 2 or 3
 
right
so, use the replace method with them
 
like this-
replace_str = new_html.replace(/find/,replace);
alert(replace_str);
 
/find/ doesn't use your find variable
 
?
correct
 
you can't just inject a variable into a regexp like that
use the variable instead
 
8:25 PM
How?
 
find,replace
 
 
1 hour later…
9:40 PM
Hi guys, could cookie be set at front-end? As I tried to modify document.cookie, it doesn't change. It only works when I set up set-cookie header at backend
 
@orocsy Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
yes
 
@orocsy Document.cookie is a PIA to work with. You may want to use this answer to help:
743
A: Set cookie and get cookie with JavaScript

Mandeep JanjuaI find the following code to be much simpler than anything else: function setCookie(name,value,days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days*24*60*60*1000)); expires = "; expires=" + date.toUTCString(); } ...

 
Ok will look into that, thanks a lot
 
Fun Fact: that answer was used without attribution on Hillary Clinton's 2016 campaign site
 
9:46 PM
i mean, the answer stole it too
 
fair
 
00:00 - 22:0022:00 - 00:00

« first day (3345 days earlier)      last day (1586 days later) »