« first day (3336 days earlier)      last day (1595 days later) » 

12:03 AM
it is indeed a meme
 
||> 1 + 1 - 1
 
@JBis 1 Logged: ``
 
||> '1' + '1' - '1'
 
@JBis 10 Logged: ``
 
wonderful
 
12:42 AM
I have imported all the Cap's shortcuts
|| the
 
game
 
|| magic
 
(∩ ͡° ͜ʖ ͡°)⊃━☆゚. * ・ 。 ᵀᴴᴱ ᴳᴬᴹᴱ
 
hello
 
@SinghiJohn 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.
 
12:51 AM
good morning
 
morn o/
 
coffee please
 
|| coffee
 
alright then
 
12:56 AM
JamesBot is a robot online?
 
yes you can play with him here
 
s
she is so smart
 
 
3 hours later…
4:05 AM
I wonder why the activity in this room has significantly declined (even before I got here) while other rooms still seem to have a decent amount of activity. We aren't dead but we could be more active. And JS is still super popular on the main site.
sigh
well goodnight o/
 
4:20 AM
because the welcoming alienated the regulars from this room the most
 
more that it's just easier to use other platforms where we won't be flagged for stupid shit
 
4:54 AM
Hi All
 
i have a scenario where in i get the response from my repository
repo.getData(myRequest,(err, reponse){
if (response == null){
    return next(null, response) // here null object of response if passed
}

var myMapper = mapperClass.ModelMapping(response);
return next(null, myMapper)

})
the above is a code snippit of my scnearion
 
what im trying to do is
 let mappedResult: any;
        if (result == null) {
result.someData = "myData" // here myData will be generated using some operation. Basically i want to add a property to null object and send back the response
            return next(null, result);
}
 
 
5 hours later…
9:41 AM
Morning guys, any ideas how I can display all images inside a folder based on name ? example : image-1.jpg, image-2.jpg / test-1.jpg, test-2.jpg, test-3.jpg, test-4.jpg ?
 
with JavaScript?
and the folder is locally? Or on the server?
 
on the server...don't know if javascript is the way to go...decided to ask...the problem is...now we have to manually set the number of images for every single product...which is super annoying...instead I would like something more automated...if 5 images with he name X are loaded, display 5 by default...if that makes sense
 
that is not hard to do so. If the server delivers 5 files to be used as image, you can check its name
 
function($,exports) what does this mean
 
@HeetParkhiya 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.
 
9:51 AM
@KarelG @an
 
@HeetParkhiya idk because it is not a valid JavaScript statement if you ask me.
 
@KarelG mind pointing me to some examples ?
 
please add more context
perhaps it is in a method call (anonymous function) or part of a structure
 
@HeetParkhiya 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 like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
what does this function do can anyone
here its full code
 
9:59 AM
Defines and exports a VideoPlayer class with methods to create the DOM elements for the player.
 
this is for the facebook page but its not getting any effect
 
@HeetParkhiya ah, that is a structure, known as IIFE. Immediately Invoked Function Expression.
 
@HeetParkhiya looks like it defines a video player for the page
 
in short: (function(funcArgs) { funcBody }) (args)
 
yeah does it replace the video player if i apply the script to the webpage
 
10:02 AM
it just executes the anonymous function in it with arguments given as args directly when the end of the IIFE got reached by the interpreter
 
what is the args i don't know
 
hard to say.. it has a lot of definitions, and it defines behavior when you click certain items on the page
 
@HeetParkhiya for more reference: consult IIFE - MDN
 
jQuery and the module.exports object from common JS probably?
 
to know what it does, you sort of need the context of the page itself
 
10:03 AM
@HeetParkhiya you need to figure out what $ and exports should be
 
$ is most certainly jQuery
 
exports seems to be a module/class imo
exports.VideoPlayer vs exports.Article
 
And exports looks like common JS (if that's what it was called with module.exports and require)
 
and $ is as geister said, a jQuery object
 
I assume that the code in question is hammered together by webpack (or some other javascript packager) which uses IIFE to generate the classes and link them (at least that is what it looks like).
 
10:06 AM
no luck on my question ?
 
what i am trying to acheive is this lh3.googleusercontent.com/…
the friendly assistant div
i have more js but which is the base one
 
Anyone know what causes this typescript error?
(TypeScript error: All files must be modules when the '--isolatedModules' flag is provided. TS1208 )
 
@zadders You don't import or export anything in the file that is marked with that error?
 
I have this

import { Component } from "react";
import React from "react";
import "./style.scss";
because I'm trying to make a component
 
one more but you should get some help
 
10:11 AM
Yeah, Heet that is not going to happen.
 
What is this @geisterfurz007Stopthischaos
 
@geisterfurz007Stopthischaos any reason why my error is thrown?
even if the module is empty, it does it
 
@zadders Do you export stuff as well?
 
yeah, i export my default class
 
@AnotherUser31 I would suggest to re-design it a bit :)
 
10:13 AM
what do u mean ? my question ?
@KarelG I need a simple example to test it...
 
ahh nevermind geistur, I deleted the file and recreated it and the error stopped throwing
thank you anyway!
 
let the server respond that there are 4 images with test-#.jpg
 
@KarelG I don't have access to the server settings...I just want to show to the guys, what do I have in my mind...so I need an example...
 
how do you know that there are 4 test-# images?
the server should just deliver all image paths to you
it is not the client task to guess which images are there, by product
 
again, right now, I'm editing 4 images, i load 4 images, I know I have to flag it for 4 images...
but that is super annoying...and sometimes human errors are happening
I found this example...but I need to load images by name...or something...
 
10:21 AM
@AnotherUser31 you'd query the server, and the server would say, "here is an array of image URLs that you need to load for this product"
and for each image URL, you create an image on the page to load and show for it
that's how you'd do it dynamically
you wouldn't care what the names are.. providing information on the name of a file is a bad idea
 
@Neil I need a small working example that I can show them...if I don't ask too much
 
Rather than directly set the innertext on the page, you'd do JSON.parse() on it
and it would give you literally any structure you would want them to have
 
again...I have folder /image/image-1.jpg, image-2.jpg, test-1.jpg, test-2.jpg, test-3.jpg...I'm expecting to see on the webpage 2 images of filename image and 3 images o f filename test
 
Imagine it is an array of image URLs, and for each, create a new dom img element and add it to the page
@AnotherUser31 There is no folder to the client
client-side, you only have a list of image URLs..
 
10:26 AM
and really, all you need to make it work are image URLs.. they could conceivably be images on other websites if you wanted
the server deals with folders.. if you pass product named "product123", then if I were you, I'd create a special folder called /products/product123 and I'd dump all photos pertaining to product product123 in it
then, when you receive an ajax request on the server for product123, the server checks if there's a folder by that name, and if so, returns URLs for each and every image contained within
 
@Neil ohhh we would end up with a tons of folder....that we don't really want :(((
 
for example..
you could also call a cloud image hosting service instead..
it's not that important how it gets implemented..
 
damn...I thought it would be easier...
 
the client says, "give me all images for product X" and server gives a json response containing all URLs. Period.
 
like what I said :3
 
10:29 AM
Can you not send a request that is like "Gib images that match wildcard filename test-*.jpg" and the server gives you that?
 
it may sound complex, but it is fairly standard
 
Then you'd have your folders in the filename, essentially.
 
the XY syndrome might surface a bit atm
 
@KarelG @Neil you rock...but i still need a simple working example to show them...or at least to explain them
 
@KarelG yes, yes indeed ^^
 
10:30 AM
fetch('url/product/id/images', {...put required header conf here...})
  .then(response => response.json())
  .then(json => handleImages(json.imageUrls));

function handleImages(imageUrls) {
  // imageUrls is an array of image src you can use
  make img element and put it to DOM
}
 
make your server return something like this
they don't have to know the details of the client.. all they have to know is that you need a rest service that when requested for product1234, will give a list of urls
 
then you can
 
How do I format code in this chat btw? want to send a small bit
 
use ctrl+k for multi line
 
@zadders paste code (only code) and do ctrl + k
 
10:34 AM
backticks for single line
// ctd
imageUrls.map(imgUrl => turnIntoElement(imgUrl))
  .forEach(img => element.appendChild(img));

function turnIntoElement(imgUrl) {
  const img = document.createElement('img');
  img.src = imgUrl;
  // assign other attributes
  return img;
}
ect ect
there is a handy object.assign for those properties but that is something for the reader
 
Also, this site is pretty neat mockable.io
let me create RESTful mock service
 
not bad
 
actually this might be easier, I'm using the w3schools accordion on my tsx project
(https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_accordion_symbol)

But the for loop in the <script> section at the bottom throws this error
"Parsing error: Unexpected token"

for the semi colon after acc.length

for (i = 0; i < acc.length; i++)
 
@Neil @KarelG I owe you guys !!! Thank you so much ! greetings from cold gray Germany
 
yet you deserve a ✋ for that imageURLS
 
10:36 AM
@AnotherUser31 good luck to ya! :)
@KarelG typo ಠ_ಠ
 
@zadders seems ok from my end
 
yeah idk why it seems to throw that error
 
I advise to stop using w3schools because it is not so good site to learn programming
 
if you're lucky, w3schools examples are just out-of-date
 
@zadders the link you gave is a correct js code.
(the page is also functional tmk)
 
10:38 AM
I'm just trying to learn how to make an accordion component for my react project,
but i'm finding it a bit hard
 
or does it not explain it very well?
 
i mean it doesn't teach how to specifically make an accordion
 
why re-create if you just can use that API? ._.
(if your env is React.js ofc)
one of the things in IT world is "don't re-invent the wheel unless really truly necessary"
 
hmm
would I be able to just re-use that specific component ? rather than have to use all of bootstrap?
 
yes
just add bootstrap as dependency and import accordion only
 
10:44 AM
you're right, pointless of me to overcomplicate stuff just to say I can make my own accordion ahaha
may as well use theirs
 
it is also available on cdn (just checked)
you only have to load the bootstrapper in your page
|| afk migration test databases
 
@KarelG \o
 
what's CDN ?
 
@zadders host for static files
e.g. Google has CDN for jQuery
It's super fast and reliable, used if you want to save bandwidth on your own site.
 
most of those javascript files get cached anyway, so it's not that unreasonable to rely on CDN
 
10:50 AM
is there a specific cdn link i should use if im using typescript react?
 
unpkg.com appears to be OK.
(didn't check it myself, it was on Google results)
 
wait what's unpkg?
 
@zadders literally on the link just provided for unpkg, it's written:
> unpkg is a fast, global content delivery network for everything on npm. Use it to quickly and easily load any file from any package using a URL like:

unpkg.com/:package@:version/:file
 
oh so I'd use that to unpackage the bootstrap cdn?
 
11:10 AM
just another question, I've loaded in the accordion component through bootstrap,
can I change it's styling?
like could I overwrite it's styling with my own?
 
yes, just add your class at the end
 
ahh ok
final question, is there a way for me to set a verticle scroll within the div of the collapsable tab?
like can I just set a max-height for these and put a scroll bar?
 
I don't see why not
just add an inner div with some height and an overflow-y: scroll
 
11:25 AM
Hi there, can I ask RXJS related questions here?
 
11:46 AM
Hi ALL
 
@LuXxenatorX I think you can sure :)
I don't know if you'll get an answer though
 
i have created a new from nodejs project and executed npm init.
Now i have added the below code in server.js

app.get("/url", function (req, res, next) {
    res.json(["Tony", "Lisa", "Michael", "Ginger", "Food"]);
});

but what i want to do is, i want to redirect to a controller file when the user lands on /url.
Im not sure how i can do that
 
@SamSam import a controller, and pass the req, res, next to it
what gets returned you send to res.json
probably don't even need to pass the response to the controller unless you have special headers or something
 
@SamSam express.js? you can use res.redirect to the path where the controller is located at
but if the controller is already on that path, then it is obsolete as Neil says
 
you should probably use redirect then
it's been a while since I've used express
 
11:57 AM
yes, express but my code is in javascript.
so the controller also that i will design will be in js
 

« first day (3336 days earlier)      last day (1595 days later) »