« first day (2047 days earlier)      last day (2895 days later) » 

12:23 AM
@Mathematics nope, everyone just copy-pastes from SO.
 
@Shane // eslint-disable-line no-undef
// eslint-disable-line for the line, then just add the rule you need
@Luggage probably throws an error about no undefined variables allowed
!!afk getting icecream with the kids because it's summer vaca
 
12:45 AM
Adults need summer vacation too :(
 
12:56 AM
whoo, my face is crispy
 
1:33 AM
lol
 
I need a vacation
 
I need an adult.
 
2:00 AM
I need an adult vacation
 
2:15 AM
Inactivity for 15 minutes!
 
@Loktar the sound of it sounds TMI
 
2:42 AM
I need a job, this vacation has gone on long enough.
 
user4196492
Gravity is truly impossible to be done by a single coder like me. I have looked everywhere for answers. I want to make a sun and an Earth. I want the earth to gravitate toward the Sun. From what I have found out, implementing space-time gravity physics takes the effort of weeks and weeks of code.

Is it really that hard to do this?? If you don't know what I mean by implementing gravity, here is an example site: https://phet.colorado.edu/sims/my-solar-system/my-solar-system_en.html
 
user4196492
Velocity Verlet Algorithm. That is what I need to try and use. I don't know how long it would take to implement.
 
0
Q: Have object revolve around vector point

John BobI am currently looking for a way to have an object orbit the vector coordinates 0,0,0. For instance if the object is located at X300,Y50,Z200 than I would like it to revolve around 0,0,0 but I don't want to adjust the Y axis. I'm not great with math and this is proving to be very difficult to gra...

google: javascript revolve
 
user4196492
2:57 AM
@Shea This is more complicated than making a circle
 
oh, well I don't know much about the math behind gravity. I assumed you did, and just wanted to animate it....
 
user4196492
@Shea I know nothing about gravity. The best math class that I took was Geometry. I didn't even finish Algebra II.
 
well I know you're going to need to at least know trigonometry, and probably even calculus.
 
You should probably just make a particle revolving animation with radius decreasing over time.
 
user4196492
I just want to learn different ways to implement math formulas into code in order to do cool stuff. I mastered the distance formula and how to make objects move at specific trajectories. That's it. Any easier projects than simulating gravity?
 
3:08 AM
I know this is completely off topic, however, does anyone here know anything about Mirantis and where I can learn more about how to use it (without having to pay a gazillion dollars to take their 101 course)?
 
little pootis was that meant for me?
 
No, pebble.
 
user4196492
@Floam pootis? you call me pootis?
 
i dont get it?
 
3:18 AM
Chat doesn't show name after space, little full username is "little pootis".
 
I hate vacations
 
but can anyone seriously recommend a costeffective solution to learning more about mirantis
besides the useless website
and the expensive courese
 
Mirantis is a company
 
their product utilzies openstack.
I wanted to learn more about how their Unlocked Product works and how to implement openstack. I couldn't find many good resources and I've been searching for a while.
 
Well, there's documentation
 
3:24 AM
Yes, however, if you are new to this type of tech, it's always helpful getting a book that walks you through it (in a friendlier manner).
 
thanks CSWL.
Appreciate it.
 
4:07 AM
anyone know how combine this 2 regex? foo.replace(/ ,00|Rp /g, '') & foo.replace(/\./g,'') ?
 
@Newbi that doesn't look like it needs combining, just run one and then the other
(you could combine them into one bigger regex, but with regex you can typically benefit from having as much simplicity as you can afford)
 
@doppelgreener yeach it's work if i use 1 by 1 , it's possible to combine (trying faster loading)?
 
if you're certain you want to combine them, there is an "any of these things" feature: (a|b|c)
 
for example : Rp 2.000,00, i try to replace to 2000
 
When I go to regex101.com and give it /(,00|Rp|\.)/g for a regex and "Rp 2.000,00" for a test string, it matches the "Rp" and the ",00" and the "."
 
4:18 AM
@doppelgreener wow idkw about this website, but thx a lot nice reference
 
it's pretty handy
 
user4196492
Quick random question. Is it possible to make AI that can function without trial and error? Like in a maze.
 
4:33 AM
Vive controller is already broken :/
I needed to get back to the Rift anyway I guess
 
@Newbi it describes the regex in pseudo-english at the top right. That can help you understand difficult regexes
 
@pebble225 a maze is an interesting choice there given they're usually solved with trial and error anyway, having no information to go on otherwise: "where's this path go? oh, not to the exit. let's try this one instead." If we're talking about an AI that doesn't learn, yes, video games are full of them.
 
@doppelgreener mazes require backtracking, which is not as easy as it seems for beginners
 
I guess an AI that tries to solve a maze by doing that "keep your left hand on the wall" solution wouldn't be using trial and error, actually
 
easy way is backtrack until last decision you made and make other/next choice, and when searching back, ignore decision points where tried==choices
I guess if you want html5 validation, you add novalidate and do it in script? lol
funny how validation ended up so unreliable
spellcheck is funny. the value(?!) default or the value false
they are joking right? those strings?
or do they mean x ? 'default' : false
 
4:51 AM
hello can someone help me?
 
s/help/clairvoyant help/
 
take a look at this view source code try it too amp.site88.net/maybe.php
 
ok, creates, drags, item disappears
what's the problem
 
what am i doing wrong? i want to curve the text but it disapears when i press enter how can i fix this
 
you want text to follow svg path?
ah, you want to canvas draw text along a path?
 
4:56 AM
yes
inside draggable
when you click on a text in any draggable you can edit individual draggables
 
if you want text along a curve, svg is a lot easier than that
 
can you guide me?
 
not sure I know what you want really
all I know is I can "edit individual draggables"
am I supposed to be able to drag something and it isn't or what
 
that is the idea i also want to curve individual draggables. its supposed to be dragged at any given point
 
then you probably want to add a point in a bezier curve and use that curve as the baseline for the text
let me see if I can show fiddle quickly/easily
example ripped from here
 
5:06 AM
thank you i can see what you are talking about thank you
 
one little gotcha with svg is, you have to use createElementNs to properly create svg elements programmatically. Once you handle that it is easy, though.
oh and if you ever try to set viewBox with jQuery, don't, jquery is case insentive.
it assumes everything is html
 
alright thank you
one last question
is it possible to create a button with pre made effects using circletype.labwire.ca/#fitText
 
sure, just inspect that demo page
right click a letter and inspect
they are just a bunch of transformed spans
the idea is to load that plugin and get it to do it on the fly
 
how would the code know which char to use
 
you hand it <h5>Hi! This is a big curve</h5> by invoking the plugin on it, it manipulates all the elements, done
the html is in the html
you just have a selector that selects the element(s) and run the plugin with desired options
the demo code is right there by the demo
 
5:20 AM
alright i get it
thank you
something like this? jsfiddle.net/stevenng/nyawqaab
 
where is little pootis?
it is so empty tonight
 
@fidel nice
 
this is what im thinking
please wait
$('#demo3').click(function(){
selectedDraggable.circleType();
});
<button id="demo3">Curve</button>
something like that
but it doesn't work :(
@doug65536 can you help me?
 
5:39 AM
selectedDraggable ?? does it mind read a value for that or does it set it somewhere
you might be able to use $(this).closest('something') there
 
please post code on gist.github.com or jsfiddle. don't flood
 
one moment
 
preferably runnable on jsfiddle
brb in half an hour or so
 
5:42 AM
  TypeError: selectedDraggable is undefined
Also in the fiddle you haven't added jQuery.
 
"runnable" means we can actually see the effects of your code. That is, include the DOM it's trying to manipulate as well as any necessary library references
fiddle please. I'm not clicking random links on the Internet.
 
/_([ehibnen]{1,8})_3/g - What does this regex do?
 
There are various regex explainers out there, just search.
 
what is the _ meant for?
 
_ means _
 
5:49 AM
@deostroll put it into regex101.com and take a look at the explanation
 
@littlepootis i don't understand who stole what from who?
bye
 
6:12 AM
Didnt Oculus lock down the games..
 
good morning
 
user3119231
morning o/
 
is it ok to have ids which are not required?
 
user3119231
it is ok but doesn't make sense
 
6:14 AM
<div id="d"><ul id=..><li id=""><li id="">...... like this so many
 
user3119231
@Mr_Green I don't know the new episodes
 
My senior is always insisting me to have id in all elements.
 
user3119231
I don't use a single id. I often use just classes.
 
I advise against id too
 
any reason why you dont go for id?
 
6:17 AM
they always swear there will be only one, until there isn't
 
I mean different ids
 
id creates globally scoped names polluting global namespace and weakening strict mode
 
user3119231
if you assign a class you can do a querySelector which makes a precise get of an element
 
and classes can be expected to work every time. if you have duplicate id, just silent breakage or selector lookups that fail when you see plainly the element (with dup id) is "right there"
 
user3119231
the main point is the css part. If you assign classes you don't have to assign the css for multiple elements
 
6:21 AM
elements with dup id, unfortunately don't jump up and down saying "look at me! I am a dup!", no they sit there waiting to screw up the ui only when an important client is watching
the idea of id is nice for trivial demos. creating insanely scoped symbols with names matching ids goes against what you need in large applications
 
2
Q: Function Typecasting JavaScript

techie_28Recently I had asked a question Extract & call JavaScript function defined in the onclick HTML attribute of an element(using jQuery attr/prop) I needed to programmatically access the onclick attrib of a button which had a function call along with param's in it then supply an extra param & make ...

 
onclick attribute lol. is it 1998?
 
user3119231
@doug65536 lol when did we stop to do a getElementBiyId ?
 
@Maurice magic, that I advise you don't use
it is cool for trivial demos, but gets unmaintainable when you have random names everywhere and you dont know where they came from
no trace of insanity object in my js right? not mentioned. just came from somewhere...
that is why you avoid it
 
user3119231
7
A: Why is document.getElementById not needed?

T.J. Crowder The following example works without using "document.getElementById('myId')". Why is that and is it OK to skip "document.getElementById('myId')"? Because browsers dump references to all elements with ids into the global namespace, using the id as the variable name. (Technically, as the proper...

 
6:31 AM
@techie_28 onclick is very obsolete. why?
 
user3119231
but a bit faster than mousedown
 
@doug65536 I had to work on an already coded thing & it is not possible to change it at this point.
It was not done by me earlier.
 
user3119231
you could easily replace it by mousedown, if necessary. :-)
 
I believe onclick has some advantages also like you do not need event delegation for them. :)
 
@techie_28 totally an XY problem
 
6:32 AM
he is saying to do all the events on id
Id's are different for sure
for example
 
you fix that by not putting information into closures that you stick into insanely obsolete element properties, then expecting to get it back and change it, somehow
instead, make addEventListener call a function that does anything you please, which calls that thing you want to shim
 
<div id="id1" class ="click">
<div id="id2" class="click">
<div id="id3" class="click">
 
make the state required to decide what to do in the shim reachable from the callback
 
which can be easily achieved by $('.click')
 
@Maurice that means we should avoid assigning ID's on elements where something else can work?
 
6:36 AM
@techie_28 onclick is a huge waste of time because it is an utterly broken and wrong way to register event handlers
hence your current issue
 
user3119231
@SpringLearner you could do 3 event listeners or just one if you use the class
 
onclick black hole
 
@doug65536 I cant change it at this point I also usually use event handlers.
 
for (var i=0;i<3;i++){
$('#id+i).click()
 
user3119231
@techie_28 I only use id's for unique entries like rows in a table (to work with database)
 
user3119231
6:37 AM
but not for styling
 
@Maurice I want to add a colour to this div when its clicked
 
user3119231
@SpringLearner this is so broad
 
@Maurice ya we should choose them wisely that means & not just assign them freely. right?
@Maurice thanks for the good reference.
 
@Maurice ok I will give more info
 
@techie_28 can't or won't?
@SpringLearner never ever do that, dude my eyes!
 
6:38 AM
@SpringLearner div.innerHTML += 'colour';
 
user3119231
btw it is a loss of performance if you use a loop for a fucking event listener :D
 
@doug65536 I cant because it will be need lots of changes to do it via event handler at this point.I do understand your point though.
 
when I see $('#someprefix' + asinineSuffix) I want to reach into the screen and assault the dev that wrote it
use class
 
user3119231
addEventListener("click", function(e) => { if (e.target.id == "id1") e.target.innerHTML = color }); // one way
 
$('.those-things')
 
6:40 AM
@doug65536 always means that you're dealing with a pro. ;)
 
@doug65536 provided that $(.those-things) is only on 1 element/
 
@techie_28 no, it can be many. what makes you think only one?
 
@doug65536 I want to add a class clicked when atleast one div is clicked
 
what if we need to select a single element only?
 
go through each one? or select Nth one
 
6:41 AM
my question here was
`var funDef ='doSomething'; // this is the name of real function defined in the script
var funcName = new Function(funDef); //expected it to return reference of function doSomething,shows function anonymous() in console

var funcArgs = [5,7,10];
funcName.apply('',funcArgs);`
 
The problem is not the use of ids (at least not only), but that the id is composed
 
so i did
$('.click).click(function(){$(this).addClass('clicked')
but he is saying to use id's
so I have to use
for (var i=0;i<3;i++){
$('#id+i).click(function(){
$(this).addClass('clicked');
})
 
funcName.apply('',funcArgs); does not get called unless I use eval instead of new Function
 
@techie_28 $('.those-things').each(function() { var $el = $(this); }) or $('.those-things').eq(N)
 
why is that?
 
6:42 AM
If you're mapping fields like that, you should add a data-ref or something
 
or checkMoonPhaseWebService(this.value).then(function(isFull) { $('.those-things').filter(function() { ... })
 
user3119231
@SpringLearner this make my shit puke
 
should not var funcName = new Function(funDef); return a function reference if funDef has name of an actual function as a string?
 
user3119231
why don't you add an attribute to the div with the color? You wouldn't need an id. You could trigger an function which gets the attribute and assigns it
 
@techie_28 more pertinent question is why the heck would you need to parse a string to a function?
 
user3119231
6:45 AM
or do an object with divs which refers to colors
 
never use new Function(String). it is eval in disguise (unless the input is from a developer that you implicitly trust, like in a debugger console)
 
Metaprogramming ftw!
 
eval is basically useless except for when you make a debugger and the code puts its hands over its eyes and calls (eval)(consoleCommandInput)
 
@Maurice you mean data-attribute
 
@SpringLearner yeah. Save id of element referenced by it
 
6:49 AM
ideas anybody?
 
@SpringLearner $(document).on('click', '.things-with-a-class-geez', function(event) { $(event.target).closest('.things-with-a-class-geez').addClass('clicked'); });
 
Use id provided. No "composition" of ids
 
@Neil yes I know its not a usual thing to do but its the need of the hour for me.
 
@doug65536 this too, though it may not always make sense that way
 
@doug65536 the script does not have any external references its purely indigenous..
 
6:51 AM
@techie_28 then use it
Just know that it would be embarrassing if a colleague noticed
 
ok well it's a bit much to one-liner that as pure js, but only a couple of lines longer
 
which would be faster?If the events are done by id or by jquery child
 
@Neil ya but why it doesnt work when new Function(funDef) is used but it works when eval(funDef); is used..m little confused over this.
 
<div id="id1" class ="click">
<li id="li" >
</div>
<div id="id2" class ="click">
<li id="li1" >
</div>
<div id="id3" class ="click">
<li id="li2" >
</div>
 
Sometimes you gotta just plow through though
 
user3119231
6:52 AM
Friendly reminder: javascript is faster than jquery
 
$('#id1).click(function(){$('#li').addClass('hello')

or

$('#id1).click(function(){
$(this).children().addClass('hello')
 
@techie_28 used?
 
faster. lol. as if faster is the js
faster is the DOM manipulation. you can do it idiotically with all libraries or no library
 
@Neil yes I have used this
 
@Maurice vanilla
 
user3119231
6:53 AM
@littlepootis 4 life. only vanilla can judge me
 
@doug65536 sorry did not understand you
 
make your code faster by batching changes to the page, and never ever appending/manipulating page elements that are in the page already in a loop
 
@techie_28 they're both eval in a sense
 
every time you change an element it has to reflow
 
eval is for any code
 
user3119231
6:54 AM
@Neil ev(a|i)l - feel free to choose a letter
 
so if you idiotically append each element one by one, then it is slow because of that, not the library or lack of library
 
@Neil yes I have used this
 
the fast way is a document fragment, append them all to that, one append onto DOM. boom done. one reflow
 
0
Q: angular route fire before resolving an async service

underscoreI have a db service and it's contain a method called find like bellow. this.find = function(collection, find, callback){ MongoClient.connect(url, function(err, db) { assert.equal(null, err); db.collection(collection).find(find, function(err, cursor){ cursor.toArray(callback); ...

 
@Maurice I know, but he seems to want the fast and dirty solution
 
6:55 AM
@doug65536 so both the ways are same
 
@SpringLearner neither. mark the child element you're manipulating with a distinct class that identifies it as the kind of thing that gets manipulated. find that within a clicked click element. manipulate it.
 
@Neil yes but funcName.apply('',funcArgs) calls the function when eval is used & not the New Function(..); constructor
could be due to hoisting you think?
 
if you can't do that, instead of inferring IDs or repeating the same type of function over and over with numbers changed, use aria-controls to imply a control relationship and point to the controlled element's ID. it's what it was made for. have one function for all of them, have it grab the ID out of the aria-controls attribute for whatever is meant to get manipulated.
 
it's like a guy handing you dominos to insert into your project in the middle. would you go reposition them all for each one you inserted? no, obviously you would prepare a batch to insert, find the size of all the dominos you are inserting, move the existing ones ahead in one step, and insert all the new dominos at once
 
@techie_28 because that is not a function
@techie_28 you need to pass a string of a function, not just its body
 
6:58 AM
@Neil funcName is not expected to have the function reference? I expected use of eval or the function constructor would do it.
that function is already defined in the script i.e like function doSomething(){.....};
 
user3119231
20 hours ago, by Mathematics
I don't think anyone here knows JS
 
thanks to all
 

« first day (2047 days earlier)      last day (2895 days later) »