« first day (2841 days earlier)      last day (2330 days later) » 

00:17
It looks like you've left @Vap0r but the above was for you
00:39
morn
 
2 hours later…
02:09
@rlemon have you ever done a map generator (like island ocean that kind?)
cc anyone else who writes canvas stuff)
02:26
map generators are really neat starting points for procedural generation cos they're quite easy to do
just get a 2d noise function and apply a colour gradient
if you want to start dividing it up into zones you can grab a voronoi library (i use one by gorhill i think)
and that opens a bunch of options like inverting it to get links between zones for connectivity
i could dump some links on you if you'd like
I know
@oboecat is learning to code and I suggested her to do that @david her first attempt imgur.com/a/kJAeGS5 and please forward the links to her 😃
ooh fancy, you've even got animated water :D
@david Simplex Noise in 3D with third dimension as t/1000 iirc
what does she want to do next? stick with the noise map or try voronoi?
right now she is trying to build a more predictable map with noise
but your suggestion on voronoi sounds fun
02:33
This link is the voronoi one i'm thinking of: www-cs-students.stanford.edu/~amitp/game-programming/…
wait that's just the final result
anyone got experience with AWS Lambda?
I'm pretty sure its a ubiquitos yes.
that is true
someone...somewhere does
maybe even more than one!
david thanks for the article 😃
i won't post more yet because that one has a lot in it
i would point out that the part where he moves the dots apart with the 'Lloyd relaxation' is just one way of making the points spread out
I like to use this 'Poisson-disc sampling' thing
There is a section on it here: bost.ocks.org/mike/algorithms
specifically the "Bridson’s algorithm for Poisson-disc sampling" is the cool one
03:08
@oboecat ^
04:03
Wow, that's a really cool link! Thanks @david :D
^ my progress so far
shoot
didn't want to do that
I added a boundary filter so the islands don't cross the edges
:facepalm:
04:08
lol
@oboecat looks very cool!
Thanks!
how many octaves of the noise function are you using?
and have you tried combining it with other gradient maps?
I am using 6 octaves (which I tweaked randomly) and other than the boundary I haven't added any other gradient maps.
one thing you can try is making 2 noise functions and then multiplying them together
maybe scaling them to [-1, 1] first if they're not already
iirc that makes cool snakey islands
04:23
Oh
I haven't tried that
like this factorio map gen uses that:
there is one noise function for the large islands
and then 2 multplied together for the snakey land bridges between them
you can do a lot of cool things
Ohh I get how that works now
her current approach is mutating the probability with a sane function (say map seed) and then have items randomly generate with noise multiplying it with the probability.
items?
Looks kind of like contours from intersecting surfaces.
04:28
IIRC she is trying to do Archapalegos
spellcheck recommended
is the code in a jsfiddle or something i can mess with?
@david Thinking about it, inverting the product [-1, 1] would give you pretty sick shallow waters.
Not atm, it's in typescript. I'll put it on codepen later
04:48
@oboecat you got me interested
here's some island chains i made: jsfiddle.net/ctrlfrk/j5326v4f/12
i have destroyed the gradients though so they're pretty flat
05:01
@david Those look cool! I am actually trying to generate something which could be used as a map for a ship-based game. So currently trying to figure out how to make it more game-y. :P
if you start using the voronoi system then you get a whole world of graph traversal stuff to play with
so you can do things like removing any islands that have fewer than 3 cells, so they're all a decent size
or picking cells on the 'shore' to place coastal ports
and then pathfinding between the ports by following the cells in the ocean
Yeah, the voronoi looked really good to me. I'll probably use it as a base and add noise for prettification.
05:17
this was meant to be a city/road map generator that i made years ago: static.zk.io/zk/zkio/graphtests/main.xhtml
it uses some of the stuff in the urls i linked to you
Tweaked it a bit, I think this is a good land/water proportion now. Also this is just a height map, green is just a height and not actual vegetation
yeah that's looking really neat. The shallows is cool
@david Looks cool! What are the circles/blobs for?
the blue circles were meant to be towns, brown were roads
the initial green circles were meant to block off sections so it's not just uniform
Ah, makes sense
05:48
anyway i like this kinda shit so keep posting your progress!
@david seems like a regular pathfinding algo? :P
06:09
Thank Talos it's Fredas!
YESSS
06:36
Why is (1/i+1-1-1/i)==0 only true when i is a power of 2?
weird
I just saw this weird behaviour on this page:
https://developers.google.com/web/updates/2018/04/devtools

if you open any new page (say reddit.com) in the same tab, and click Back, that new page is removed from history! AFAIK, this was not possible!
@AbhishekJain You can make a redirect page "not be memorized" by your history
So it isn't really erasing browsing history so much as not remembering certain pages
Also, pretty sure you can simulate a page change when it's not actually happening (aka using ajax)
so that wouldn't be included in the page history either
@JennaSloan it is valid for power p where p = (for all n element of all natural numbers; 2 + 4n)
@Neil Can you elaborate a bit more. It's not very clear to me, what you said. So, in the example above, the developers.google.com page would have written code for their page to facilitate this, or what? :/
06:43
yes
it does not remove it from the browser history though
just only that window.
@AbhishekJain Doing window.location.replace("http://...") won't cause an update to the browser history
that is done via History API
for instance
Hello All,

I need one suggestion.
Is that possible to open a specific path from client system when user click on file input from browser ?

Please help me and guide with reference or keyword if its possible.
@VishalTarkar 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.
06:45
@VishalTarkar no. Reason: security.
drop that idea. just provide a file input and let the user navigate himself
@VishalTarkar a page isn't allowed to make any assumptions on the computer running the browser which opened the page
@Neil So, if I am moving from A to B and I do window.location.replace on B, I will end up with a history stack of [A, A], correct?
except whatever little data is allowed such as browser version and whatnot
@KarelG : Thanks for reply.
But is there any way around to do that. ? to pass the security ?
@KarelG What do you mean?
06:47
@AbhishekJain I assume you'd just have A, honestly, not [A, A]
but it's an easy enough thing to check....
@VishalTarkar that is like asking me to bypass the airport security to drop a malicious package somewhere on a terminal or inside a plane
@Neil But the code for that has to be written in Page B, yes? Since, A is already unloaded.
My advise is to drop the idea.
@KarelG haha!!
@KarelG
Thanks for Help and Time.
@AbhishekJain You're on page A, and then you call window.location.replace..
New page B doesn't get added to the history
just use page B normally..
06:50
@JennaSloan that your math equalization is valid for all powers p = 2, p = 6, p = 10, p = 14, p=18 ...
@DenysSéguret: close-vote non-english posts as "Unclear what you're asking", please ;-)
@Cerbrus why?
been a "procedure"
Is there a policy regarding posts not in English ?
Because they told me so in the SOCVR. It's the agreed upon close-vote
06:52
ok
thanks
And technically, it's correct
Yes, but I think that's somewhat disregarded on certain sites
@JennaSloan I was reading your thing as 1/i^p + 1 - 1 -1/i^p
blame the coffee machine that needs to be booted up
@Cerbrus what is SOCVR?

SO Close Vote Reviewers

This room is for support and discussion about reviewing and co...
They streamline the closure of bad questions :D
06:56
ola
How to generate the 2-bit codes in node js?
00
@Neil but then on clicking Back on page B, you won't go back to A.
00
01
10
11
@Gowri There ya go
@Cerbrus: yes How to generate in node js?
1
Q: Can I answer for my own query, if I found answer myself?

VikkiDoes stackoverflow provides or allows answering my own question if I find answer myself?

wut
06:58
What do you need it for?
hello any one provide me good tutorials link for node JS..
@AravinthanM 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.
@KarelG Yay, gold hammer :D
@KarelG what do you mean?
@Cerbrus: I want print the strings as you posted above exactly
07:00
that code generates, it doesn't do any pathfinding
@Gowri So, are you trying to convert numbers to binary? Or do you just want to generate the strings? What kind of output format is expected?
@AbhishekJain That was the idea, wasn't it?
If you wanted to go back to A, you wouldn't take measures to prevent A from being memorized, would you?
@david well, finding a path to go around those circles when laying out your road network
just similar behavior tbh
you only did not do some pruning and other optimization techniques
@Neil so in my OP, I observed moving from developers.google.com/web/updates/2018/04/devtools to reddit.com, and then clicking back, DISABLES the browser Forward button.
@Cerbrus: I want print the strings as you posted above exactly 00
01
10
11
07:02
So I have setInterval(function(){sql.query.update()},1000/100); If the execution time takes longer than 100ms i do not want to start running multiple sql.query.update(). Is there a way I can just make it skip if the query didn't complete?
@KarelG no you're misunderstanding. It's not trying to find paths, it's generating connected points
@Gowri See:
for(let i = 0; i < 4; i++){
  console.log(i.toString(2));
}
You might want to account for missing left padding.
@AbhishekJain How about them apples?
@JennaSloan That's a neat trick. It'll be because the non powers of 2 cannot be perfectly stored as floating point numbers
@Neil How is this happening? Clicking Back on the second page, replaces that page with the previous page. So the history stack goes from [A, B] to [A, A].
07:07
@Cerbrus: Thanks I was excepting some in-build function, can't find anyway
@AbhishekJain page A is a redirect.. all it does is forward you to B
You wouldn't call a replace on page B
@Gowri Well, .toString(2) is already pretty special.
@Neil so the page A devs must have written special code for it, correct?
A theoretical question here! Someone said to me one can do "match", "validate" or "parse" using regexes, now my question is specially about the difference between "validate" and "match". (I'm confused because in most languages there's a "match" function used for something which is very much like validation to me! b/c returns 1 or 0, true or false, etc.) I also wonder "search" comes under which of these three categories? (match?!?)
@AbhishekJain Yes, what I mentioned earlier
Or maybe calling HistoryAPI as @KarelG mentioned
07:16
they might have disabled forward by using pushstate and popstate events
@Neil so How can I replicate this behaviour? If I own Page A, and I want that on opening any external page B (by entering its URL in the browser, not via a hyperlink from A), and then clicking back button, B should be replaced by A, what *exactly* should I do?
0
Q: Node.js prevent stacking of async functions within setInterval

MoonEater916I have a set interval running a SQL query quickly. The query on average take .0003 seconds to complete. However there is the possibility that in rare circumstances the query results could exceed 100ms. setInterval(function(){ Data = sql.Query(SqlData); },1000/30); I want to ensure that we have...

07:36
@MoonEater916 isn't the comment clear enough ?
@DenysSéguret No :(
I have never used the setTimeout but reading it, it sounds like it will cause a halt to the set Interval.
@AbhishekJain open eg reddit. Then open stackoverflow. Then use the back button to reddit. Check the navigation arrows. You see that you can go forward. Now, open the console and do window.history.pushState({},'', ''). Check now what happens with the arrows
@MoonEater916 For example this:
;(function step(){
	callYourDB(query, function callback(err, data){
		if (err) die();
		use(data);
		setTimeout(step, 5);
	});
})();
but you probably shouldn't run a query repetitively to start with. A DB isn't a proper messaging/queuing,etc device
5ms is kinda optimistic :P
i am getting .0003 seconds on what a normal load would be otherwise i would switch to reddis
07:42
anyway. You understand the idea of the code I wrote?
And the example given, that would make the code wait 5 at the end of the execution?
@KarelG dude! You nailed it! window.history.pushState({},'', '') does it! The devs at developers.google.com must have done something similar on their page load. Question is, why would they do this? Why prevent the user from normally jumping forward?
I think that it is an unintended side-effect
But if a query is being bad and takes a 100ms execution, it would make the next execution run at 105ms? or i would get 26 simulations queries? and all would have a extra delay of 5ms
@DenysSéguret
07:44
their blog page consists of many navigations to other sections on the same page
if you use click on a link somewhere that navigates you to a location further down, then using the back button
then you can see that you can forward back to the page
however, you navigated away to a different site and returned
I can't see the bottom faces of the boxes when I view this demo in IE11. Any idea why? jsfiddle.net/akinuri/0ce8fnx5/embedded/result
probably it leads to an incorrect variable to do the pushState
your best bet is to dig in the script snippets for .pushstate or other history API interactions
@DenysSéguret I am a damn idiot
I see what you did finaly
you but the function into a loop
haha
Isn't there a shortcut to getting a specific descendant of a node? For example if there's an option tag inside a select box inside a div with id "time1". (querySelector?)
queryselector yes
07:53
@KarelG Thanks. Sorry for nooby question, but I've encountered a problem with it before. How can I make sure that the node I'm trying to get has been loaded already?
depends of how it is loaded into your dom. If it is via page load, you can listen to DOMContentLoaded or put a script tag at the bottom. If it is via ajax, do it in the callback
whats the best way to reduce a canvas image size?
eg I want to go from 1000x1000 to 100x100
reducing the memory by 100
@SuperUberDuper you may want to have a look at the code I use for this:
fyi
08:05
"best resolution" is in 2^x pixels
100x100 uses a 128x128 image space on GPU
but that is not important :P
is there an algo without all the other stuff
I just want smth that reads a canvas then outputs it to a new smaller canvas
@SuperUberDuper I linked you to the 3 lines doing the stuff
oh so when you draw image, it takes care of the complex stuff?
the drawImage does the job btw
08:07
It probably uses a bicubic, I don't remember, but you don't really have to care
dim is your 100x100
 
1 hour later…
09:37
No?
Ah well, I tried
if you wrote "how about meow" I might have clicked
dammit!
09:54
would it be considered functional programming to generate an object array and then pass that object array into a various functions which modify the object array / return it to the main function?
@alyx no
You wouldn't ever modify an object and return it. You're supposed to leave the original parameter untouched (aka immutable)
Sometimes you can use an immutable object in the creation of a new object rather than necessarily having to copy everything
like adding an item to the end of an array can be simply a matter of a pointer to the original array plus a pointer to the new item
the original parameter is an instruction to build n number of objects, but i'll follow that advice
I mean do it that way if you prefer
it's just not a "functional" way of going about it
@alyx it's ok for keeping some things non-functional
10:10
How should I put the content inside a string variable as the key inside an object? Like this:
var timeId = chn.id;
times.push({timeId:[timeStr1, timeStr2]});
{ [timeId]: ... }
Oh thank you!
10:31
@towc meow is eager to play some Tribo against you
I don't think I've ever won against it
Oh, BTW, if somebody here wants to enter the TWC5, it will be in November, there's just enough time to train for it
Guys, what's the difference between Underscore's functions and a bunch of native JS ones?
@AlexMitan Most of unserscore is just obsolete now. It predates the native ones
Ah okay
10:36
@towc Shouldn't times.[timeId] = [timeStr1, timeStr2]; work too? (it doesn't)
try times[timeId]
underscore is a good example of a library which was created out of language necessity
since then js has improved quite a bit
oh, neat
at least twice
10:39
@towc Works but makes very very little sense to me ;)) (I don't know JS though)
Thanks
JS doesn't make much sense in a lot of its syntax/std library decisions. But it's not too hard to have the gotchas on it
10:53
I'm having a weird time with arrays, I'm just pushing elements to an array and it's still empty, what's even happening
Did something change recently or
Wait, no, nevermind
oh, right, in ecma2018 array push is a noop
after having seen the increase in performance, nobody could discuss this choice
11:10
when you create a new Blob(), you can put an array of different data as first argument. I'm wondering why the second options argument is not an array too?
how do you describe different file data in your data array?
Why? What would the second array contain?
header information?
Those silly mathematicians. They never know their limits
it gets better. Don't stop at the obvious part, or the cringy part. Read to the end. I didn't giggle until the end
even the weird part?
Proxy won't let me open reddit links :P
something something not working something
11:35
images won't work either i think :P
nope
Unless a white image with the text "Image not found" is what you were trying to show me
I think that I would not work a long if my company implements a proxy
gives me a restricted feeling. Something I do not like
Oh, I did read it (pastebin works)
now I just don't get it
did you read the last line?
11:40
what do the mosquitos have to do with forming a gradient?
maaaaan
mosquitoes can be seen as particles in a dynamic vector field
that's my interpretation of the joke anyway
oh, if you say so
Explaining a joke is like dissecting a frog. You can do it, of course, but it tends to die in the process.
well, you just don't have much imagination
I have a minor in mathematics. I can't believe I've never heard of these mosquitoes
I expected to end the joke being really disappointed, but the last twist was great, even if I might not understand what exactly he means by it
11:44
@KarelG did you get it? be honest
ffs sometimes I get fed up by people that is "in" for fast rep: stackoverflow.com/questions/51557177/…
@Neil
> a cloud of multicolored mosquitoes
Reminds me of the joke about the mathematician who became a plumber
at least the first part of the joke
apparently there's a r/antiantijokes
with things like these
I appreciate that it was deviating from the expected result
11:48
but I was expecting a punchline
which you can't see anyway
but I'm not going to copy-paste the whole of that onto pastebin
@Neil you need to know what a conversative vector field is
check this wiki if it is possible en.wikipedia.org/wiki/Conservative_vector_field
and throw in the gradient from the colors that the swarm is generating and the swarm itself as vectors
Had to re-read it again tho
I usually get jokes like that too :(
A computer scientist is standing holding a pair of suitcases in an airport baggage claim area. He is looking rather confused. A traveler asks if he's having trouble finding all of his luggage.
The computer scientist says "Yes, I'm supposed to have 2 bags, but I can't find the other one."
The traveler, now himself confused, states "But they're both right there. See? One, two."
The computer scientist says "No, no, no. Zero, one..."
12:04
@Neil That's a terrible joke
computer scientists are trained to differentiate between ordinals and cardinals
@KendallFrey I think you mean to say, that's zero terrible joke
not "one terrible joke" but "zero terrible joke"
oh boy
someone used reduce to sort an array
almost spit out the coke in my mouth
succesfully? Did they use it recursively?
12:09
0
A: Javascript sort an array except one

BlackBeardYou can use reduce to achieve the desired output: var Comparison = [{key: "None", value: "None"}, {key:"Geographical Area", value:"Geographical_Area"}, {key:"Forests", value:"Forests"}, {key:"Barren Unculturable Land", value:"Barren_Unculturable_Land"}, {key:"Land put to Non agricul...

well, the reduce is being used wrongly as a filter, not as a sorter
oh wait, not even
that's not a bad way to sort as a 2-way stack
-.-
*points my finger to the door*
even if there's better ways
it's not sorting as much as re-ordering
12:27
mom
don't you morn me
you're morning
Happy mourning, punks!
lol I dont know how people can use VS code
that IDE is toxic
12:43
you are one of the exceptions
regex for zero or more digits?
use kleene
\d*
webstorm is so much better
is there a way in lodash or vanilla JS to convert multiple arrays into a single object array, i.e. i have const arr1 = ['a','b','c'] & const arr2 = ['d','e','f'] and I want to make: const arr3 = [{arr1: 'a', arr2: 'd'}, {arr1: 'b', arr2: 'e'}, {arr1: 'c', arr2: 'f'}]
12:59
@alyx the technique is zipping arrays
or was it folding? 🤔
i looked into zipping and it didn't seem right, i'll check out folding
forget it :D
i looked into zipObject, it almost works for what i need
thanks!
not sure the method exists outside of manual
i have a webpack/es6/npm project. when i hit save it rebuilds the bundle and reloads my server.. it seems that nearly every time i do this the chrome tab stalls. even if i close the tab it takes up to 10 seconds to close. i have no idea how to debug this. i would guess its some infinite loop but I checked for that and I can't find anything.
@AlexBollbach in the network view in developer tools does it show a http request hanging?
13:05
i'll have to wait until it happens again. it freezes "randomly"
_.zipWith(arr1, arr2, (el1, el2) => {
  return {arr1: el1, arr2: el2};
});
@alyx ^--- try that lodash method
@KarelG that works perfect, thank you!
no network request is hanging in dev tools when the tab freezes
i suspect its a function infinitely recursing but i don't have a clue how to track down which one
Anyone work with No-IP?
@AlexBollbach i wonder if console.trace() would provide any insight
13:14
would i still need to know where to put it though? i mean it could be one of several hundred functions
it seems to happen when i hit a breakpoint. then i can't step over anymore
13:27
@JBis I use dyndns which is similar
@BenFortune If you don't use No-Ip then I doubt you would know this but worth a try
ps this is completely off topic
Any chance you know how to use the API to get the current IP a domain is set to?
(Not contacts DNS servers but contacting No-Ip direct)
Not sure you can, their API only allows updating
grr
What about changing TTL?
(not through API)
thanks
13:48
Yeah not sure about that, looking at their FAQ it depends on the record type

« first day (2841 days earlier)      last day (2330 days later) »