« first day (3346 days earlier)      last day (1585 days later) » 

12:24 AM
Someone here to help me please :D
 
@CHARFEDDINEAmine 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.
 
if you have a problem with something, just state your problem, what you are aiming for, what you have tried and what parts you dont really understand
if someone is available and understands your problem, they will answer
 
i ask here ?
 
sure
that is what this room is for
 
ok perfect
Im new to vue js , i am trying to consume my API (that i created with laravel) with axios , i couldnt figure out how to retrieve the data from the response it always shows this error ==> TypeError: Cannot read property 'results' of undefined .
 
12:43 AM
@CHARFEDDINEAmine Please paste some code. That error in generic. Usually the object you are trying to access results on is not being filled properly.
||> const var_that_is_undefined = undefined; var_that_is_undefined.results
 
@JBis "ReferenceError: var_that_is_undefined is not defined" Logged: ``
@JBis "TypeError: Cannot read property 'results' of undefined" Logged: ``
 
^
 
1 message moved to Trash can
@CHARFEDDINEAmine Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it. For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
<script>
import axios from 'axios'

export default {
name: "Ideas",

data() {
return{
results:[]
}

},mounted() {
console.log("component mounted")
axios.post('http://127.0.0.1:8000/api/display')
.then(function (response) {
this.results = response.data.success;
})
.catch(function(error) {
console.log(error);
alert(error)
})

},
methods:{

}
}

</script>
Hit Ctrl + k before posting code :)
 
oh ok i didn't know that
 
12:47 AM
@CHARFEDDINEAmine what do you think this is referring to in this.results = response.data.success;?
 
my component
 
try:
.then( response => {
this.results = response.data.success;
})
did that work?
 
Omg
Yess
thank you sir
why ?
isnt that the same ?
 
@CHARFEDDINEAmine Theres is a slight difference
Using the function syntax creates a new context for this. An arrow function does not. So when you use the function syntax, this doesn't refer to the component
|| mdn Arrow function expression
 
An error occurred with the request.
 
12:58 AM
> An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this, arguments, super, or new.target keywords. Arrow function expressions are ill suited as methods, and they cannot be used as constructors.
@JamesBot damn it james
Make sense @CHARFEDDINEAmine?
 
the arrow is lambda expression ?
Yes seems logic
 
@CHARFEDDINEAmine Yes.
 
thank you again :D
 
np
|| mdn arrow functions
 
1:02 AM
there we go, google brought their crap out of beta
 
 
3 hours later…
3:37 AM
:( Gotta redesign my app for the 3rd time
 
 
2 hours later…
5:17 AM
|| afk sleeeeeeeeeeeeeeeeeepyy
 
@JBis bye JBis
 
 
1 hour later…
6:35 AM
Hello guys,
One of my colleague from backend engineering asks us to store response data in indexedDB and don't make calls to server if data is in DB and asks us to use LRU for implementation. is this a good practice? How often people do this?
 
@SrikanthChekuri 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.
 
@SrikanthChekuri depends entirely on the details of how its setup. In of itself there is nothing wrong with this approach. Pretty standard. Its glorified caching basically
 
@FrostyFire isn't it overkill? why use indexedDB when they could use disk caching?
I read indexedDB is helpful in offline apps and service workers.
 
@SrikanthChekuri indexdb would be on the client side right?
 
@FrostyFire yes server could set the cache-control headers right?
 
6:48 AM
@SrikanthChekuri Yes. A pro to indexdb is it has a far superior API and doesnt block the DOM. Its truly async. However, a downside is some browsers don't support it very well. There are of course polyfills to support all browsers but those impact performance
indexdb also has a higher datasize limit than other client side caching options
edge has some issues basically
actually I should clarify... indexdb can still block the DOM thread. But if implemented correctly it wont.
what are you caching? what kind of data? How many rows? etc
 
Idea is to store almost all the responses from the server.
 
7:06 AM
@SrikanthChekuri "what kind of data? How many rows? etc"
 
 
2 hours later…
9:34 AM
how do you detect a change from http://localhost/foo to http://localhost/baa

events locationchange and pushstate listeners dont work
 
 
5 hours later…
3:02 PM
Takes ~2m to fill - forms.gle/JhXwZQSyrs4dvEAK9 an experiment I am doing to validate a theory I have.
 
3:12 PM
Hi friends !
Shalom !
 
Need some orientation with something related to Symbol.iterator
let links = [
  {
    id: 'link-1',
    url: 'www.hlink1.com',
    description: 'A short description of hlink1'
  },
  {
    id: 'link-2',
    url: 'www.hlink2.com',
    description: 'A short description of hlink2'
  }
];
I have that array
I know I can do:
const iterator = links[Symbol.iterator]();
const first = iterator.next().value;
and get the first position, but ...
It is possible to use Symbol.Iterator with this syntax:
links[Symbol.iterator] = function () {
    // Do something with each item of links
}
?
 
|| mdn system.iterator
 
Hey guys, I need to put in an "opening_hours" field to each json file object in the json file. This is the rough format, though the words in bold may not always be "Monday - Thursday", "Friday", "Saturday and Sunday" for each of the objects I need to include the field for. Does anyone have a recommendation on what to put as the value of "opening_hours". I'm thinking of an array of Strings, each string representing something I will put in a line, but not sure how it will work out.
 
@robe007 Does the fourth codeblock here answer your question?
 
Yes
Thank you very much my friend =)
 
You're very welcome :)
 
That was exactly what I need
 
[
  {
    day_string: 'Monday - Thursday',
    opening_hours: [
      "8.30AM - 12.30PM",
      "2.00PM - 4.30PM",
      "6.30PM - 9.00PM"
     ]
  },
  //...
]
Would be my first attempt, yeah
You could also use objects like {start, end} with either strings or number values.
 
3:31 PM
@geisterfurz007Stopthischaos Hmm I don't know if I can adopt this structure because now it's 4 headers for 1 location("Monday - Thursday", "Friday", "Saturday and Sunday", "Public Holiday"), but for another object it might have 2 headers "Monday - Friday", "Saturday, Sunday and Public Holidays"
Wont a dictionary structure force me to make the keys for every object to be the same, even though the headers, which will be the keys, are not identical?
 
It's an array of entries. You can have an entry for each header with the day string and the array of opening hours
 
oh
ah, I think I get it, it's not a dictionary of day_string mapping to opening hours
 
Nope. I mean you could do that too and loop over the keys but I think by definition they don't have to be ordered
 
But won't it look weird if Friday comes before Monday-Thursday as a user?
 
Yeah, that's why you should use an array instead of that :D
 
3:38 PM
Haha ok, I mean assuming the data has identical headers, I could just iterate a list of keys, and use the key_string to access its corresponding value pair
but nvm, too many problems with that assumptionn
Is there like some automatic way of generating the json other than manual entry?
 
JSON.parse(`{${someKey}: ${someValue}}`);
I mean for something this small it doesn't make sense but for bigger stuff it might (also given that you can do newlines)
 
4:27 PM
get out of here with that name @PHPFan
;)
welcome :)
 
5:17 PM
I'm starting to understand why people like typescript (or typed languages in general).
 
5:29 PM
One quick questions guys please , just started to learn angular online . One thing doesnt get to my head - If I can create lets say something.html and also add angular in <script> tags (src) it works fine. But on like 95% of tutorials people use npm to create "whole" angular app with many packages etc (so confusing for me as a starter) . What is the need for it? In my eyes it looks complex af . Thx in advance :)
 
@adrijan971 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.
 
user8729657
6:03 PM
Who offers cheap ssl service?
 
LetsEncrypt its free
 
user8729657
@JBis, i paid godaddy 60 for an ssl 2 months ago :(
 
7:08 PM
i have a question about loggers
debug vs log4js
specifically I like that debug can call the log level upon the node execution script
i.e. debug redis or debug everything...
can log4js do this as well?
 
7:30 PM
@Wietlol are you familiar with log4js and do you have an opinion
lol i trust your opinion
 
I dont use JS tho...
no clue about log4js
 
quick question, im getting 504 error in node js during an request, but i get 200 in the browser and postman. how can i fix this?
im using the get method of the https module
 
you dont' use JS?
lol what do you mean
 
7:52 PM
Fixed it, had to the user agent to a known browser
 
does anybody here use a logger?
 
8:13 PM
how do I make a script that asks for a file upload and then passes that file to a windows batch script which runs a program that converts the file, then that file is passed back to the web page for download
 
@TechnicTechnician 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.
 
kinda dumb how you have to download studio (stud.io) to convert any file with the extention .io to .ldr
so I wanna make an online tool
maybe its not even worth it. gotta buy a domain, I dont have a server etc
I could share the converted file but its not really my work so is kinda sketchy sharing it
the file will change often anyhwo
 
 
2 hours later…
user8729657
10:30 PM
@JBis, you're a god thanks for ssl :D
 
11:42 PM
np
 

« first day (3346 days earlier)      last day (1585 days later) »