« first day (3294 days earlier)      last day (1879 days later) » 
01:00 - 08:0008:00 - 00:00

08:00
Yes, I've inserted data into my SVG.
is that all? I expected more rooms :P
and an elevator!
It doesn't fit.
or two!
It clips off.
just draw it
08:00
It sizes it self for 300x150
When I have a bit more to show.
I haven't set any width/height.
Let me share the SVG code with you, maybe i'm doing a bad job at understanding/explaining
then you have defined the dimensions somewhere. The parent svg - if not limited in dimension - expands itself when you add content
use a jsbin or jsfiddle btw
Yup, jsfiddle.
Does the same here.
this isn't resizing the svg, but it defines your width and height to fit your content
08:04
Still cuts off
Oh.
So, I should calculate the sizes
width and height are whatever you define it to be
Oh, so it should be done after iterating through each thing.
13 mins ago, by Neil
6 mins ago, by Neil
focus on making the svg perfectly fit its content
08:05
Finding the maximum width and hieght of the SVG>
Right?
the svg's width and height is saying "everything you want to see will be contained from pixels 0 through width and 0 through height"
it clips the rest
ok that svg falls back to the default 300px
🤔
I must have used something to prevent that
// Loop through everything and find max width/height required.

        // Creating the root SVG Node on DOM.
        svgRootNode = this.createSvgNode("svg", {
            width: w, // max width from above
            height: h, // max width from above
        });
max height on second.
Is that what you mean?
hmm, you're the one generating the content, aren't you?
only you know the size of your generated image
it shouldn't be a parameter
Unfortunately, I can't.
we will be deving a GUI editor
for this
08:08
hmm, ok well that could work out in your favor
then yeah, make it a parameter
the parameter be calculated from all the buildings?
i mean rooms
if the json creates rooms outside your area, then it simply won't show
Oh, how do I make it show.
not until someone changes the width and height again
Ok, lets say.
Before I render anything,
I find the total width and height required
automatically
08:09
@HassanAlthaf ok, well you have to determine what is static here.. if the GUI editor is going to show you a fixed area, then the rooms being added must fit inside
and create the SVG node before populating it.
oops
Would taht work?
@HassanAlthaf my excuses.
I was wrong
@KarelG all good
08:10
if you're generating an image based on the data, then you can define the width/height to perfectly fit the content
Not generating an image unfortunately
Generating an HTML page.
apparently svg needs some aid to have a correct dimension :|
To do stuff like Click on one room and then click on another
and it would route you
must be interactive. not just a static image.
svg can't do that you know
you'll need javascript for that part
Yes.
Thats the point.
08:11
ok, just making sure you know
I'll be passing callback functions on-click.
That's why I'm doing HTML :D
so which is it? is the area fixed or is it "auto-fit"?
auto-fit
if you want a user to be able to draw rooms, then probably you want the area to be fixed though..
needs to fit on a mobile phone, tablet.
with zooming capability
08:13
auto-fit makes sense if your library is designed to take some data and generate a page for you
you may want to support both
but in the case of auto-fit, you need to calculate the proper width/height
If we have auto fit, there's no point of fixed area though.
Why'd anyone do fixed area if they have auto-fit :P
in fact it must be one or the other
you can't have auto-fit and not have content..
that wouldn't make sense
if the user is drawing rooms, then there must be already an area to draw on
They will have something like a canvas to draw on
Have a form to fill
08:15
if anything, maybe you could allow the user to zoom out to see more of the map to add more rooms later
auto-fit canvas
so the width and height are calculated on the basis of the content, and you have no content to start
so what do you show?
what width and height do you give it?
when there is no data to show, we don't call the map. we show them a message, add items to start.
they drag something on canvas
or probably press a button.
the canvas probably will be like a re-sizable page.
with a menu of the building blocks like elevator, etc.
it will only consider the JSON of the items added and send it to the server
08:18
how can they add items if you don't have an area to add it to?
not the canvas width itself.
canvas may be easier here honestly
i dont mean html canvas
I know, but I'm saying it may be easier to do this with canvas
I did try with canvas before
but google said otherwise. svg seemed easir
LOL
08:19
svg is better if it doesn't change
if you're having to generate svg for every change
So there is no way?
Its fine if the user has to zoom out
I created this website for my freelancing work sagarvd.me built with Angular, ssr is added and hosted on firebase. Any suggestions, feedback or queries on how to do x is welcome
@HassanAlthaf you can generate svg on the fly, sure
but canvas is made for this
the only tricky thing is mouse clicks and knowing which room is being clicked on
Each svg node could have an event handler on click?
yes, that's the easy part if you're using svg
08:26
Or does it not work?
Exactly. Thats why i usd svg
Thinking about it, zoom is what we really need
but say you wanted to create a room.. you'd have to draw a box using the GUI
are you going to draw and redraw that box using svg?
That only needs to be done in Java, and the program would generate the JSON
And store the json in db
oh you want to generate a json on the client?
Yes
Rendering will be done on the JS side
All hi
08:28
We can use the generated JSON on the current library to render
I need one help in exploring a fundemental architechture of nodejs which im directly not able to explore on google

Scenario :
There three request being made to the nodeJs server

1. Get User Data
2. Get data from a file (the file is very very huge suppose 1TB)
3. Get department data

What im trying to explore is, as request 2, reading file is very huge operation, and as nodeJs is single threaded, what will happen in this case.
Will the node block with the same operation till it return back all the chunks of data from file to user?
I thought every request uses one thread
If ur client does multi threading you could await-notify until the previous request is done and move to the next
I might be wrong
@SamSam I think node will initiate request 2 and then move to request 3.
@SamSam 1TB is too big to load in one chunk, so what the OS does is load the file, one chunk at a time, as you read through it
if you decide to stop half-way, you won't load the whole file and it will be faster than reading all of it
but yes, the request hangs until your request is handled
@Neil yes indeed, but what about the other request that keeps coming in
08:32
a new thread is allocated for the new request
node is single-threaded in that it is one thread per request
@Neil does the request block other requests on other urls too?
it isn't that nobody can request anything from the server until the current request is handled
also, if there is any possible way you can reasonably load information from that 1TB file and hold it in memory, do that
So he could solve it with something like a Runnable in Java and use await on launching the request right, and then when the response callback is called he could handle it and notify and continue execution to the second req right
obviously assuming you don't need most that information
@HassanAlthaf he's using nodejs
I mean his server is a nodejs api right
His client could be like Java right
Or the whole rhing is node?
08:35
hmm, client is likely a web browser
though it is still possible that it is a java client
Seems that you need .split and grab the last group ... Kinda a basic job that all developer should be capable to do at its own. — KarelG 11 secs ago
OP asks for solution which is just any bachelor student in IT should be able of
So im guessing
Zoom too is not possible for svg?
@KarelG yeah, but at least it's not as hard as fizz buzz
that's hard af
I love @Neil ad @KarelG
8
Q: SVG zoom with mouse wheel inside HTML document

VladI'm attempting to implement a functionality in an HTML document which allows users to drag and zoom in an embedded SVG 'box'... I found this, but soon enough realised that that script only works with plain SVG files... Keep in mind that I'm a programmer who has been working exclusively with ass...

Wouldnt this work
08:41
@HassanAlthaf you get to a point in your programming career where you no longer try to determine if you can or can't do it a certain way. There exists only ways you'd prefer and ways you wouldn't
if you want to try using svg, be my guest. I wouldn't choose that though
it may be that you're able to do it. I honestly can't say. Never tried what you're doing :)
But like you said, canvas would turn out to be a challenge for clifks
Hi all
@HassanAlthaf in some ways it's easier
in some ways it's harder
where svg helps, it is easy handling click events
but if you know where all the rooms are because you drew them, then knowing when you've clicked a particular room isn't that difficult either
09:02
I have an ajax call to abc.php and their I have written windows.location.href='www.google.com'; which is used to redirect to google.com domain. But when ajax executed it just fetch google.com html content in the ajax and do not redirect.
How?
@Exception well what are you doing with the ajax call results?
if you're putting it into a window then executing that script will just load google.com
@Exception you don't redirect with ajax ... that is not its purpose.
@KarelG Ohh this is what I thought.. write redirect code in ajax php file and in response it will redirect to mentioned page
you can send the user to google in javascript without asking the server
or you cna use the server to give you a redirect url. Then you just lead the user to it
ohh okay..
now I got it.
09:10
@Neil
@Neil Found a way to do panning/zooming. Using transformation matrix, and calculating the SVG width/height before creating the root node.
With that I can define a center and a default zoom, and that should work fine.
But the challenge would be to point to the exact room
ok, well you have to also be able to allow a user to create new rooms via svg
That's not a problem. We get the JSON data, calculate the maximum X and Y before rendering.
Right?
no I mean suppose I want to create a new office layout
what's my first step? How would I create room of arbitrary size?
you would have a blank canvas lets say 720x720
lets say the user starts building at x:20 y:20 isntead of x:0 y:0 and theres nothing there, we trim that area
and only submit the JSON for buildings
09:31
ok so you would use canvas?
you trim the 20, 20 at the top left corner, right? would you also trim the bottom right?
the canvas becomes a single room. now say you wanted to add a hallway
By canvas I meant like a page
that the user sees
The user uses the UI, the data is translated into JSON, and showed on the screen
I will be a blank page.
10:01
Basically thinking of a form to build the JS
what the fuck
did I just walk into?
Are you trying to clone Google / Apple Maps?
For an office o_O ?
they practically stream data for you
and game engines have been rendeirng only hte view port since DooM
I don't understand why is JSON here?
might aswell be CBOR or protobuf vOv
10:20
Hi
I have this grunt task that minifies and uglifies angular directives
Now I want to use the same grunt task to uglify an es6 web component (class extends HTMLElement)
Is there a grunt task that exists or pollyfill to convert the es6 code to es5 before the uglify step...otherwise uglify will fail
9me
9me
You can try babel to convert es6 to es5
@9me 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.
@ShrekOverflow wait till you learn that he's using svg for his view 😀
10:36
@9me yeah so a pretty much register a babel task than runs before uglify task?
Not too familiar with grunt syntax yet but think I get the gist
9me
9me
@BrianJ Yes you are right.
hey all, in package.json is there a way i can run a node command on all 'run.js' files within all sub directories? I thought something like this would work, but doesnt seem to: rm -rf ./build && tsc && node ./build/dist/**/run.js
10:54
Hi guys, is this the right chat for talking about custom html emails ? I'm having a couple of issues, I've found some similar questions here on SO but they seem not be working anymore.
@MadaraUchiha yeah with some adjustments
@KarelG mother of sweet jesus
does he hate chrome users?
@MadaraUchiha ok, I'll take a look. There are a couple libraries that say they are isolated, not sure the difference.
@JBis I don't know them all, but isolate-vm which I have linked is developed (and used) by Screeps, which is a game whose entire purpose is to run thousands of user-inputted scripts.
incase anyone needs to know i found a solution using find: rm -rf ./build && tsc && find build/dist -name run.js -exec node {} \\;
11:18
hello! quick and raw question: if i have a promise that takes too long in the Ajax Done function, am i preventing the ajax call to finish?
@RicardoDias Morais 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.
from finishing*
@RicardoDiasMorais the ajax "done" function is being called after the response
since you are using promises, you should use Fetch API tho
thank you @KarelG, and thank you for the suggestion, have a nice day everyone
@MadaraUchiha ok that's reassuring
11:36
@RicardoDiasMorais it's finished on the "backend" side of things
if you have to do something in addition to what you're already doing in the .done() function, then you can just fix that by doing setTimeout(someFunc, 0);
9me
9me
Hi guys can anybody tell me what is equivalent of java isAssignableFrom in Typescript ?
why are you doing that?
@9me
B.prototype instanceof A
that java method does more JBis ...
|| mdn isPrototypeOf()
@KarelG Yeah, Idk java so I just did a quick search
what happened to Caprica
just a stupid reflection method that apparently has an use case
Cap disappeared along with her owner, rlemon. James is her temporary replacement (or permanent if she doesn't come back)
what happened to rlemon?
 
2 hours later…
13:33
@KarelG It was just a client
keh, I saw that but went past it ...
<.<
13:54
hey guys, I was wondering if someone can help me figure out what this error means?

```Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ title: string; thumbnail: string; id: string; url: string; adminhelpcard: never[]; itemsCountPerPage: number; activePage: number; error: null; response: {}; isEditProduct: boolean; isAddProduct: boolean; whichRadioSelected: string; videos: never[]; manuals: never[]; }'.
No index signature with a parameter of type 'string' was found on type '{ title: string; thumbnail: string; id: string; url: string; ad
I've made an interface singleAdminHelpCard {} that has a property that is "type: "videos | "manuals";

and then in my state I have videos: [],
manuals: []
but when I hover over my error on "this.state[type] from the line

this.setState({ [type]: this.state[type].filter((adminhelpcard: Manual) => adminhelpcard.id !== id) } as any);

it says that videos and manuals have type never
All Hi,
Is there anyway in which i want to make the next .then call even if there is a exception in the previous response.
Hey guys - anyone can help me with my question - how to add key values onto a dynamic object key name? stackoverflow.com/q/58524664/3312364
 
1 hour later…
15:06
Hi all, I've got question regarding CSS ::selection.
Anyone knows, what is the reason of such behaviour of few different browsers, when highlighting the text with cursor:
- in IE, the tint of a selection has by default kind of "bottom padding", so there's surplus of highlight under the font, of about 15px
- in Chrome and Firefox such "bottom padding" or surplus is also present, but is about 2x smaller.

Is it possible to change this selection somehow, I mean decrease this surplus in IE?
16:05
hi i have got an question for react can anybody help?
16:21
|| welcome @Atulkumar
@Atulkumar 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.
@JohnDoenym Not sure but IE has weird abnormal inconsistent behaviors. It's consistently inconsistent.
you can try overriding the bottom padding
@JBis thanks, but probably, it's the case of used font - named "Lato" from google fonts - has such padding-bottom builtin.
Hey guys anyone good at react?
I need help with this question stackoverflow.com/questions/58526503/…
If I have to create a bunch of forms would it better to create them using html and then pass in the default values using javascript? or to do everything use javascript to create element?
16:35
it depends how fast you can write loops. if they are similar you could write a loop and pass variables to the differences like the placeholders and attributes
17:10
I tried doing it using create element and that takes forever
I think I'm going to write the html out assign it as a template string then pass in the placeholders then use document.write() to inject the html
19
Q: best way to inject html using javascript

Mike RifginI'm hoping that this isn't too subjective. I feel there is a definitive answer so here goes. I want to create this html on the fly using JS (no libraries): <a href="#" id="playButton">Play</a> <a href="javascript: void(0)" id="muteUnmute">Mute</a> <div id="progressBarOuter"> <div id="bytesLo...

Well ya look at that someone had my exact same question
some good answers there
 
2 hours later…
19:33
 
3 hours later…
22:04
@JohnDoenym Ah, you are talking about line height. Use this:
|| mdn line-height
 
2 hours later…
23:57
In react native / expo is it possible to explore elements as one can do in a browser's dev tools?
01:00 - 08:0008:00 - 00:00

« first day (3294 days earlier)      last day (1879 days later) »