« first day (2140 days earlier)      last day (2799 days later) » 

4:00 PM
@KevinB I understand the concept behind it, I just do not understand its implementation, how the if statement should be changed instead of the example given. Do you have an example?
 
@RoyiNamir yes, sometimes you want to handle errors in the promise but not in the then handler. Doing promise.then(x, y) is like doing promise.then(x); promise.catch(y) not like promise.then(x).catch(y)
 
the only part that needs to change is the part within (...)
 
@BenjaminGruenbaum give up. that guy is trolling ou or he'll never get it.
He'll just throw some half-baked philosophy at you.
 
!!afk stuffs
 
@Gothdo +1
 
4:14 PM
0
Q: Not getting proper result with angular $routeParams and $http.get

Sagnik ChakrabortiI have to fetch posts related to a specific tag so the api link that I have made in nodejs is /post/tag/:tagname. I want to fetch the result through angular's $http.get. My tag collection in mongo has 2 attributes. name used (number of time the tag has been used) My angular initiator: (fun...

got stuck.
 
Hey everybody!
 
@Turk Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Are image maps manipulable from jQuery? I am just trying to get it inside a div. For whatever reason I can't use the wrap methods to place a div around it, nor can I use the append/prepend methods to insert it. any suggestions if you've dealt with a similar problem?
 
1 message moved to Trash can
@Michael Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
So If i dont want to pollute global scope with a particular variable. I need to make sure it is defined within the scope of a function:

function(){
if (isSearching) { return; }
var isSearching = true;
}

But here I want *isSearching* to default to false however, I am declaring it as true because I want it to be set to true if it gets passed the if-statement above. Whats the best way to approach this problem?
 
4:24 PM
it can only "get by" the if it it's already true.
 
1 message moved to Trash can
@Michael Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
perhaps I can do this?:

function(){
if (isSearching) { return; }
var isSearching = false;
isSearching = true;
};

JS's async nature is so confusing
 
there is nothing async in that code.
 
@Luggage its not? how can I declare the variable after the conditional then
 
you don't that makes no sense.
 
4:26 PM
Then why does it work?
 
1. Check if a variable is true. 2. Create that variable.
 
what are you actually trying to do?
 
I want to stop a button from getting repeated clicks while my function searches /loads data
 
put the var before the function
outside of it
 
@ssube Then it goes into global scope?
 
4:28 PM
@BenjaminGruenbaum Replace 'promise' with 'god' and 'spec' and with 'the bible' and you'll see why argument isn't valid.
 
No, specs are real.
 
var clicked = clicked || false
...
if(!clicked){
  clicked = true
  ...
}
 
@Michael you need it to live longer than just one invocation of the function
it doesn't have to be global, but it does need to be outside of the function
 
@ssube true.
How do I make it not global then? wrap in another function?
 
disable button;
ajaxRequest().then(function() { enable button; });
 
4:30 PM
since JS is single-threaded and variable access is atomic, you're just looking for the boolean lock pattern: var lock = false; function oneAtATime() { if (lock) return; lock = true; /* do stuff */; lock = false; }
 
1 message moved to Trash can
@teivaz Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
function getClickFunction() {
  var clicked = clicked || false
  return function() {
    if(!clicked){
      clicked = true
      ...
    }
  }
}
 
that would work
@teivaz just make sure you reset clicked at the end
 
This is just a concept =)
of 'How do I make it not global then?'
 
@teivaz thanks! yeah i guess that does work
 
4:34 PM
    I am trying to wrap an image map in a div, what is the correct way to reference the map, I have tried this method but it isn't working.
            $('map[attribute="imgMap"]').wrap('<div></div>');

I have tried a few other variations of this including changing 'attribute' to 'usemap' but it made no difference. I also tried selecting the map via jQuery and appending it to a <div> but even that wouldn't work. I am thinking something is wrong with my selector or image maps are not responsive to jQuery, but I can't find anything online to confirm this.
 
So now, I'm just curious why declaring a variable*after* it is first used is valid in JS?

if(someVariable){/*do stuff*/}
var someVariable = true;
 
because in js all declarations automatically moved to beginning of the scope
 
@Michael hoisting
 
$('map[attribute="imgMap"]') is wrong likely unless you have <map attribute="imgMap"></map>
 
the variable is defined anywhere in the same scope, but it may not have been initialized yet
 
4:36 PM
@ssube is that an async concept or just a fancy language perk?
 
@Michael neither, it's a mostly-useless holdover from C
99% of JS isn't async, just callbacks and promises
most if it is just a weird C/Lua mashup, for most purposes
 
the other 1% is jQuery
 
@rlemon that is what I figured, however that doesnt explain why changing it to

$('map[usemap="imgMap"]')

also didn't work
 
what does the element look like
 
interesting stuff
 
4:37 PM
console.log(foo); // logs "undefined"
let foo = 3;
 
I also think I am formatting wrong haha
 
let foo;
console.log(foo);
foo = 3;
 
Caprica will be mad =)
 
guys wait, I am an idiot nevermind
 
4:38 PM
wrong selector?
 
yea, I was looking a the wrong element this whole time
 
@Michael the fun part is that functions are also hoisted, but are hoisted with their body.
but variables set to functions are not
 
Should be referencing the name, not usemap
 
can smb please explain me this regexp /\.css$/
 
@ssube fantastic
 
4:39 PM
It is always when I ask for help that I figure it out haha, thanks anyway for listening to my banter
 
@teivaz end of the string is .css
 
@teivaz find .css from the end of a string
 
Thanks
 
i.imgur.com/mp7ifYe.jpg @SterlingArcher :P
follow up in the comments: i.imgur.com/y7Oahed.jpg
 
@rlemon oh my god
 
4:48 PM
that's too much I guess
 
@rlemon I could see this happening. Maybe this is why women hover pee
 
my god
 
@SterlingArcher g+
you're welcome
 
Soon, lunch just ended lol back to training
 
Spy training?
 
4:58 PM
@KevinB :32490747 Something like this: if (a > b && !!a < c) {}
 
He's playing sexy twister with his agile friends
 
@Caspert KevinB is afk: stuffs
 
@CapricaSix Oh oke!
 
@Oleander what?
If we were having an argument about the bible and I found a verse that says god said something - that'd work.
We're having an argument about JavaScript, and the language clearly defines something a certain way.
It's not objective, unless you object to the ECMAScript spec as the authority that defines JavaScript and disagree with every single vendor out there.
At which point you can decide whatever you want since you're not writing JavaScript anymore.
 
I could sell you Jabbascript.org if you like
 
5:02 PM
You are by far the sorest loser I've talked to in the last 2 years - and in this room that means a lot.
@ssube nit - in the browser.
 
On behalf of the room I say: "Hey!"
 
@BenjaminGruenbaum Command soreloser learned
 
!!soreloser
 
35 mins ago, by Oleander
@BenjaminGruenbaum Replace 'promise' with 'god' and 'spec' and with 'the bible' and you'll see why argument isn't valid.
 
5:04 PM
!!slidepoop
 
Mar 13 '13 at 1:40, by rlemon
(Random Fact, when rlemon was 13 he pooped on a slide. he isn't proud of it, but he felt it was time to confess. I'm sorry slide.)
 
never gets old :D
 
!!crustypoop
 
@ndugger http://chat.stackoverflow.com/transcript/17?m=9878470#9878470
 
oh wow, like 3 and a half years ago.
 
5:04 PM
@CapricaSix Can you maybe help me with it?
 
@Caspert Considering that she's a bot, no
 
this Ubuntu install is freezing. nothing in /crash and nothing in /log/syslog
 
!!abhishekpornfreak
 
Jan 21 '14 at 16:46, by Abhishek Hingnikar
they love there work like i love p***. maybe i should do a p*** site !
 
shh, she doesn't know
 
5:05 PM
!!gayclubs
 
Mar 18 '13 at 20:08, by Loktar
I've been to gay clubs more than regular clubs lol
 
Caprica remembers :D
 
@Caspert replace c with a and b with c
 
@CapricaSix ew
 
@CapricaSix Hmm than I get this:if (a > c && !!a < a) {}
 
5:07 PM
You know what I love more than this lamborghini? KNAWLEDGE
 
!!a < a what is this i don't even
 
Why check a boolean with less than
 
TIL false < true
 
0<1
Yea..
 
^
that's basic KNAWLEDGE right there
 
5:09 PM
!!> Number(false)
 
That not good no.. I will try some things for now.
 
@rlemon 0
 
go casper i beleave in u
 
@littlepootis nice!
 
5:12 PM
but how friendly are you?
 
Quite friendly why?
 
I cant figure out how to start webpack-dev-server
 
you shouldn't really be starting it
you should automate it
 
mkay
 
@ndugger -_______-
 
5:16 PM
And that means what?
 
that guy
good evening eryone
@teivaz what's happening?
 
I have a folder 'build' with static content. How do I get it served on localhost:8000?
 
@teivaz eh still not clear enough, what have you tried?
webpack doesn't really know about any files apart from javascript files, so you need to tell it about any other file that you want to 'serve' with it
 
@bitten I've tried to read this webpack.github.io/docs/webpack-dev-server.html
I've managed to copy html file to build with 'file' module
and now I have two files in build folder: index.html and main.js
 
@ndugger LMFAO I'm dying
 
5:22 PM
@teivaz so main.js is an entry point?
 
It is for the project
it is actually main.jsx that is transformed to main.js
and included in index.html
 
@teivaz and have required your assets in main.jsx?
 
I'm getting a strange webpack error...
 
Yes, html and other stuff is there
 
It says a file at a path does not exist. However, when I use open [path] it opens the correct file. It is an absolute path.
 
5:27 PM
@teivaz what assets are you having trouble requiring?
 
None. I'm trying to get webpack-dev-server up and running
And i can't figure out how
 
@teivaz oh right. have you installed it and running webpack-dev-server?
 
I've installed it locally with npm
 
@teivaz heh okay.. i'm finding it hard to figure out what your having trouble with :3
 
5:30 PM
maybe i'm derping
 
ew, express
 
@teivaz i'm afk, sorry to leave you hanging
 
No problem, I'm wrapping my mind around this concept
 
OMG @SterlingArcher i.imgur.com/XrdalNq.mp4
I'm loosing it here
 
For past two days I've been trying to migrate one project to react along with learnign it.
And I'm still under the effect of it
 
5:38 PM
post your config file
i'm also still learning webpack, it can be quite overwhelming as you need to get used to a few different things
 
user986408
is running jenkins in a docker container helpful for ci in any way? or is it only done for the sake of starting it easier in different environments
 
@corvid are you requireing the file?
 
imgur.com/user/BottlesOfBeer/submitted this is gonna be one helluvah ride
 
@bitten I found the problem, it seemed to try to resolve index.js.js
 
@bitten here it is pastebin.com/nLSA9eLm
 
@SterlingArcher @KendallFrey RIP OP imgur.com/gallery/wIpsF
(text)
 
@rlemon so sad
 
@bitten It really is. But I'm trying to carry it out.
 
What's the easiest way to create a 2 dimensional array? I've tryed var array = [][]; and seen a few post's saying to use for loops but is there an easier way?
 
6:07 PM
Poor OP
Brutal way to get cancer
 
BTW. about regexp. Did anyone try verbal expressions?
 
@rlemon wow..
 
that looks awful
 
ugh uneven coils :(
 
6:13 PM
@RowanHarley var array = (new Array( size )).fill(new Array( size ))
actually, does that bring back the same exact array in the second dimention?
 
yes
 
!!> var array = (new Array( 10)).fill(new Array( 10 )); array[0][1] = 2; array[1][1]
 
@towc "ReferenceError: size is not defined"
 
arr = Array(size).fill(null).map( _=>Array(size).fill(0))
 
@towc 2
 
6:14 PM
@towc fill fills with the same value
i.e. the reference array
 
The array is too big to give it a size. It would take a while to find out how big the array is
 
it doesn't mimic map
 
Is there any way that doesn't involve me giving the array size
!!> var array = [[]];
 
@RowanHarley "undefined"
 
that gives you an array with an array
what are you trying to do?
 
6:15 PM
@RowanHarley yes: array = [];, then expand as you see fit by pushing arrays
 
and don't say "generate a 2d array"
 
a 2d array is an array of arrays, just remember that
 
just use a Map
 
seriously, what is the end goal
 
I need an array that can hold x and y co-ordinates which can be found using something like var currentSector = array[x][y];
 
6:17 PM
you could use a 1d array with offsets
const index = x * 2 * y * 2 * width;
err, + y...
(that is how images store their data)
also if you have x/y cords I can assume you have minX / maxX bounds
 
To get the maxX and Y all I need to do is add the sector's size. They're all the same size
 
so then you do know the size.
if you're doing a grid system, I'd recommend just flattening it to a 1d
 
@rlemon You mentioned a 3d library for javascript a while ago... what was it called? Four or something?
 
@corvid pretty sure four just wraps three
 
@littlepootis also in Haskell which has a great type system everyone loves :D
 
6:37 PM
@BenjaminGruenbaum Well, to be fair, that property of Haskell has nothing to do with its type system.
 
It is a property of the type system, so there's that.
 
A property of the type system? Or a property of the type?
 
@rlemon well, by adding a y row, you'd need to compute so many shifts...
 
@KendallFrey both, but more importantly a type is part of their type system.
 
I thought the type system was just the system in which types are created and used, not actually including the types themselves.
 
6:45 PM
I'm not sure now, I always thought the types are a part of the type system.
 
I would have said they're part of the standard library
 
How can you make your own types without built in types?
 
With the type system
Bool is easy to define in Haskell
data Bool = False | True
 
What's True and False?
You need the concept of a literal, but I see what you mean.
 
Those are data constructors
 
6:48 PM
You need a union type to define bool
 
That's part of the type system, it's not a type in itself
 
hah.
 
7:21 PM
@mikeTheLiar Penis, also known as "Pen" for short, is a device that allows you to leave your mark on the world.
5
 
looks kinda interesting
(released on Steam today)
 
Oh cool
There are latex yeoman generators
 
alpha.trycarbide.com not sure how I feel about this
> Carbide shows results in-between the lines of your code— letting you see data in context
sounds quite annoying/intrusive
 
Does anyone know why cancellation is disabled by default in bluebird ? Any performance implications I should know about ? Or is it just because there is no formal spec around it yet.
 
@rlemon sounds like CodeLens
 
7:27 PM
@rlemon Looks like it could be cool, but it's implemented weirdly
Idk why you need a huge box below each line of code
 
@WillemD'Haeseleer it's a tiny bit slower.
There is one more property per promise if cancellation is turned on - you can safely use it
 
some of the stuff looks.. idk. "neat" but It feels too much like DW for me
give me a plugin for livereload and I'm okay
 
Have any of you guys used yeoman for latex
 
7:46 PM
turns out I can't simply make a proper nodejs smtp server, as I need to get trusted certificates :/ I can probably still make a functional compatible one, except not actually working, but from which I can still send and receive data in my own controlled environment
 
how do i change my avatar image on stackoverflow
 
ohh god, how do you unsub from youtube comments
I made the mistake of suggesting a game to someone and people are having side arguments in his reply chain
 
^ delete the comment
 
that doesn't help
I don't want to remove the comment, I just don't care about replies.
 
meaning it didn't work?
that's the only way to do it on facebook that i know of i doubt youtube is much better
 
7:52 PM
@Loktar have you seen any of the alpha videos for Totally Accurate Battle Simulator
looks like a lot of silly fun
 
I like the hwachas
Idk if I spelled that right
 
It's actually spelled, "sandwiches"
 
Yeah I mean I like the sandwiches
I hate latex
Fuck latex
 
if you are just doing papers I lik emathematica better then latex
 
latex the typesetting thing?
ok, i guess so
 
7:58 PM
Yeah
 
I like it in theory, but I've never used it in anger.
 
In theory it's nice
But it's like they make everything purposely difficult
 

« first day (2140 days earlier)      last day (2799 days later) »