« first day (1796 days earlier)      last day (3150 days later) » 

12:00 AM
Hey all. I'm trying to get user input via an html form and then update the page, but NOT refresh the page. This is for a game. Can anyone point me in the right direction?
 
I an 12
 
@Greg xhr is the keyword
This is a good starter: gist.github.com/Zirak/3086939
 
@copy awesome thx :D
 
@phenomnomnominal I thought it was funny
 
@user148098 you are*
 
12:06 AM
grabs popcorn
 
12:29 AM
@Greg Also, once you've got the hang of the basics, there's no shame in using a framework (XHR is complicated)
 
@SomeKittens still working on it :P what kind of framework did you have in mind?
 
Personally, I use Angular
 
@Greg fetch will be supported by browsers natively in the future and there's a polyfill: github.com/github/fetch
Angular just for xhr is a bit overkill
 
as a matter of fact I'm concurrently learning angular right now
 
@copy Yeah, agreed with you there.
Also kinda weird for a game
 
12:32 AM
how come?
 
It's more for a web application, with different-but-related pages
Like a chat system
 
i'm actually looking for a way to receive user input in a chess game
 
oh, chess. Hmm, depends.
how done is it?
 
it seems the easiest way is to get an input text form and then parse it
how 'done'?
 
yeah, is this something where you could paste your code in JSBin?
or is it more theoretical?
 
12:43 AM
I'm actively working on it
Though this is my first real foray into JS and HTML/CSS so I'm hacking it up any way I can
 
@Greg you can put Ninja Javascript Hacker on your resume now
 
lol
im using images of chess pieces which won't render on jsbin
 
throw 'em on imgur?
that's what I do
 
yikes
you can nest arrays
 
12:55 AM
lol
 
!!> var a = [['hello], ['world]]; a[1][0]
 
i've had a bad experience with c++
 
Now you're traumatized?
 
i prefer to make my own functions since i'm too lazy to learn other frameworks/apis
i want my chess game and i want it NOW
 
then why even spend the time developing at all :p
did the SO favicon change?
 
12:59 AM
I made chess once: copy.sh/chess
 
hah
 
It keeps catching my eye, like its brighter or something
 
very nice
 
nice @copy
you ever see that one a guy did in 1k?
 
its just something to put on my resume
 
@Loktar Yeah, very cool
 
so crazy (imo anyway)
 
dark chocolate covered almonds
 
!!> console.Symbol
Just found this snippet
// Retreive the magic inspect Symbol from the API's Symbol constants
var inspect = console.Symbols.INSPECT;

var myVeryOwnObject = {};
console.log(myVeryOwnObject); // logs out `{}`

myVeryOwnObject[inspect] = function () { return 'DUUUDE'; };
console.log(myVeryOwnObject); // logs out `DUUUDE`
and I can't find anything for it
bah
that would have been cool.
 
1:23 AM
So..... I can't tell if I won a SO t-shirt or if this is a scam.... haha
I'm going with scam.
 
@SterlingArcher ^
 
whoa... I actually did win... haha
granted, this email may not be from SO, but...
 
nice @monners !
oh man I'm getting some Retro SA keys soon
 
SA?
 
1:28 AM
like in the next week or two, after months of waiting
 
Wow, nice
 
I got true retro, and the lime modifiers
 
I'm still using the blank keycaps that came with my Das
Those keycaps look like they'd feel really nice
 
yeah they are pretty deep
they are just like the c64 keys
 
@Loktar which switches does it have?
(also, this would be kinda useless for me, since I use numpad for navigation a lot)
 
1:40 AM
@tereško oh thats just a random keyboard, was just showing off the keycaps
its not my image
 
oh
 
the link below the image is for the keycaps
it was only run for like a month
 
What's the difference between creating a schema versus creating a database? I am trying to transition a mongoose implementation into a MySQL one and I came across var UserSchema = new mongoose.Schema({
 
2:01 AM
Well MongoDB is the DB.
Mongoose is just a wrapper.
That has schemas to make things more sane.
 
I have always felt that calling it a DB is somewhat generous
 
hah that too
 
2:18 AM
Well, in translation we have "terminology database" that is rarely more than a simple associated array. That is what caused me to look up the definition of "database".
 
basically MongoDB is a collection store, and it doesn't really care what's in the collections. Mongoose creates a Schema that enforces a bit of definition to what goes into the collections, but it's nothing like a true DB where each table has specific columns
 
What tools/framework can i use to recreate this game (has multiplayer as well) youtu.be/ITOVn_qAQLc
 
trying to import data from MongoDB to MySQL can sometimes be a challenge, and you really have to inspect the data very carefully.
 
It Was originally a Java applet game
 
What tools/applicances can I use to recreate a dessert? Usually it is not the tool that matters, it is your programming skill. You care about which tool only after you have learned a decent level of skill, be it cooking or programming.
 
2:24 AM
Well I'm curious I'm a web developer never done game dev
 
user406009
@Phreak I would start with HTML5 canvas.
 
user406009
It's nice and simple for 2d work.
 
Okay that seems like a good starting point I'll start with that
 
You are a web dev. But do you want to do it with web or do it with other languages? We don't know that.
If you want to do a web game, search "HTML game engines".
Then you have to choice between specific but (often) less mature engines, and generic but (often) more mature engines. Like web frameworks.
 
Aaight deff will google that thanks for providing some helpful starting points
 
2:31 AM
44 points from 10k, man the suspense is killing me :P
 
@Zirak incorrect
let me know if you wanna know how so maybe you would want to remove it :/
 
!!stats Claies
stabs Cap
 
@Luggage She's already dead, Jim
 
2:49 AM
did I miss anything while I was away playing Mad Max?
 
Yes
you missed me making a pot pie
 
@JanDvorak really don't know how to play youtube videos backward?
 
!!procrastinate or research
 
@AwalGarg There's nothing in the options. Is there an extension for that?
 
@JanDvorak I meant, I'd expect you to google :/ anyways, yeah chrome.google.com/webstore/detail/reverse-playback-for-yout/…
 
3:02 AM
Now, if you reply to me on disqus, you'll save work not just for me but for everyone who stumbles upon the comment ;-)
 
too late, I closed that tab :(
 
@AwalGarg Nice extension, but not what I meant
 
@JanDvorak Modern video formats are not designed to be played backwards. Usually you need a video editor.
P.S. "Modern formats" means "formats after .avi".
 
so, this looks like it takes a promise, and turns it into a promise. What's the point?
 
3:19 AM
@SomeKittens takes a set of promises prefixed by yield, and returns a promise after they are all resolved. and returns a promise not raw value probably for chaining I guess.
 
so instead of having a promise and using it, I have a promise, port it through a generator, and then get a promise out?
 
you don't have a promise, you have a lot of them.
 
In other words, it lets you say "I want to do this after I have read all the files, in parallel".
 
@SomeKittens surely you have used bluebird's Promise.coroutine? it's the same
 
@Sheepy but you can do all that with promises
so is this just syntactic sugar?
and both are throw-safe, etc, etc
 
3:27 AM
Syntactic sugar makes the language edible
 
I am just rephasing Awal's words. Like Awal said, the Promise we have now provides this feature built-in. Perhaps it was designed for a time before promise when it was started.
 
@Sheepy Promise.coroutine is not native
 
That sounds like Promise.all to me?
 
If anything, this talk will teach me how to spell yield
 
@Sheepy no, Promise.all works only for an array of promises
 
3:29 AM
@AwalGarg You can use an object in Bluebird
 
@AwalGarg Ok.
 
Promise.props() for an object (bluebird-only)
 
@SomeKittens really?
TIL
@Luggage so props is an alias to all?
 
no, Promise.props() takes and object with promises for values
 
i need to learn the bluebird api :(
@Luggage if promise.all can do that, why have promise.props?
 
user406009
3:36 AM
@AwalGarg Shortcut + better naming for individual promises you care about.
 
cya guys
 
Promise.props({
    key1: makePromise(),
    key2: makePromise()
}).then(function(result) {
    console.log(result.key1);
    console.log(result.key2);
});
 
user406009
Promise.all([getUsername(), getPicture()]).then(function([username, picture]) { console.log(username, picture)});
 
yup, also good.
 
user406009
Promise.props({username: getUsername(),picture: getPicture()}).then(function({username, picture}) { console.log(username, picture)});
 
user406009
3:39 AM
You can sorta see the similarity between the two.
 
indeed. it reminds me that i can stop using .spread((a, b) => ) and start using .then(([a, b]) => )
 
7 mins ago, by Awal Garg
@Luggage so props is an alias to all?
Yeah
wait, no
at least for Bluebird
yes for $q
too many libraries, let's go back to jQuery
 
user406009
No. Bluebird is the one true promise libraries. All others are merely poor imitations.
 
sharpens his guns
including ES2105. That's a half-complete copy of bluebird.
 
bah
so what's the best way to add a script to a page without <script>?
 
3:53 AM
xhr -> new function -
 
user406009
What's the arguments on new Function vs eval again?
 
new function can defer evaling
 
but it creates a new scope
 
which is gooood
 
I want to import Bluebird in JSH
 
3:56 AM
gist.github.com/awalGarg/6fbf685ff0deeeeaa5fe#file-main-js-L17 btw new is not required for native constructors
 
user406009
@AwalGarg Good. Learn something new every day.
 
user406009
MDN letting me down :(
 
user406009
I believed in you!
 
what?
!!> Function('return 4+5')()
 
user406009
MDN claims you need the new. I don't know who is correct.
 
3:59 AM
I may just have to use JSBin
 
@Lalaland oh that, lemme link you to the spec, sec
> Thus the function call Function(…) is equivalent to the object creation expression new Function(…) with the same arguments.
 
user406009
Yeah, just found that same line.
 
 
4:12 AM
@SomeKittens and I want a million dollars.
 
@phenomnomnominal I'll probably get my wish first
Does Kangax not cover import?
 
you can use my require implementation :D
actually good idea, lemme try and see if it really works
 
Last comment: May 24
yey GH
 
@SomeKittens jsh.zirak.me/1jq24rqaoe8 works :D
 
because I assigned it to the promise variable?
 
everytime I look at the bluebird source and I see all the bitfield shit, I remember how bad at programming I am.
 
@AwalGarg so you did the easy part
 
@SomeKittens jsh.zirak.me/1kg0xmvej9c assigned to bluebird too :/
 
ah, I misread
where's the unminified source?
 
4:17 AM
of what?
 
your require
 
interesting that you check for the url ending with .json rather than the headers
 
it was headers originally, then the server from which I was fetching json started returning text/plain and I thought fuck it
I literally just copy pasted it from my project to gist
 
hah
 
4:39 AM
I just spent 10 minutes reading and re-reading the readme of a certain lib, trying to figure out how to use it
then I looked at the code and it's literally 113 lines of javascript
 
more lines in the documentation than in the actual code?
 
That sounds like some good doc :D
 
you know who that developer is... he's the one that tells you how to build a watch when you ask him what time it is.
 
how do you obtain the screen width using angularjs
i use: Math.max($($window).width(), $window.innerWidth); but it only gives me the desktop width
 
$($window).width() is JQuery
 
4:47 AM
$window.innerWidth is angularjs based on this so's question: stackoverflow.com/questions/21626357/…
so, i have a checkWidth function like this:
var checkWidth = function () {
                        var width = Math.max($($window).width(), $window.innerWidth);
                        $scope.isMenuVisible = (width >= 980); //a menu visible is when the width >= 768
                        $scope.isMenuButtonVisible = !$scope.isMenuVisible; //a menu button is visble if the menu is not visble
                        console.log("Wdith = " + width);
                        console.log("$($window).width() = " + $($window).width());
                        console.log("ismenubuttonvisible: " + $scope.isMenuButtonVisible);
 
$window is angular service that exposes the global window object. you are using jquery $ to retrieve the width of that service, and returning the larger of that width or the innerWidth defined inside the $window service. seems like you are always going to get the jquery evaluated value.
does your function not work if you just use var width = $window.innerWidth; ?
 
i have a situation where someone might be adding and removing an iframe with my code in it,does adding an iframe execute all the js within it. where can i find more info on this(Im trying to convince them to hide and show a div instead)
 
393
Q: Invoking JavaScript code in an iframe from the parent page

Tamas CzinegeBasically, I have an iframe embedded in a page and the iframe has some JavaScript routines I need to invoke from the parent page. Now the opposite is quite simple as you only need to call parent.functionName(), but unfortunately I need exactly the opposite of that. Please note that my problem i...

 
um,I want to know what happens when an iframe is removed from the page and added again.is the code in the iframe executed again?
 
5:05 AM
yes
 
oh I did backup my userscripts, how wonderful.
!!afk
 
5:54 AM
Mornin'
 
6:23 AM
> I have reached a point in coding that I have code tangles.... a mess. I never used a MVC or similar pattern. I have about 300k lines + 300k in 3rd party
eek
 
7:12 AM
@AwalGarg :-/ why does india have powercuts and ups' that do not support uSB
like are half the engineers born here brain dead or what ?
 
At least half. AT LEAST.
 
I stole this on the interweb and found it mildly amusing to run in my dev console: pastebin.com/qRE0DpSC
 
:-(
@RoelvanUden know any windows inbuilt utility that will gracefully shut it down in x minutes of internet failure
(cause that is the only way i can be sure that power has failed)
 
@Abhishrek A powershell script is your best bet I suppose
 
@RoelvanUden or node
 
7:17 AM
I've 5 records in my database for every 5 seconds i'm updating its date column, if any column did not modified/updated its date column within 10 seconds then delete it
 
@Abhishrek our country is irrecoverably fucked up
 
@AwalGarg wanna leave ?
 
leave where?
 
@AwalGarg USA
 
no
 
7:20 AM
okay.
 
usa is pretty fucked up too
i hate there damn money politics
 
Can anyone answer/extend the answer on stackoverflow.com/q/11439540/871050?
 
hey @MadaraUchiha
 
That first answer lacks context (see my comment)
@FlorianMargaine o/
Sup
 
just 5 mins ago I was thinking "hey it's been a while since we saw madara"
 
7:23 AM
Yeah, crapton on my mind recently
 
@MadaraUchiha living the dream, you?
 
hey madara
 
Been lurking more than being active in the past few days
 
hello why i am not getting chosen here jsfiddle.net/qubkhtsc ?
 
@MadaraUchiha interesting stuff?
 
7:24 AM
Not really :(
 
@MadaraUchiha how do you pronounce your name?
 
ma-da-ra u-chi-ha
 
interesting. "ma-da-ri" in hindi is a person who makes animals (pets) do interesting stuff
 
Madara is "spots" in Japanese, or something like that
And Uchiha is "fan" (as in, the object to blow air, not the adoring person)
 
together, they combine into a really lame name
 
7:28 AM
Hence the Uchiha symbol being a fan
 
so "spots blowing".
 
@Mosho Perhaps... Perhaps.
 
@MadaraUchiha "second rikudo" is sooooooo much better
 
But if he were alive in this world, it would be a 3rd world war, everyone against him, nukes and all, and we'd still lose :P
 
"second rikudo" can also be shortened to sudo
 
7:30 AM
@AwalGarg Rikudo is the godlike status of someone who had trancended the Six Paths
The Six Paths are based on the Six Paths of Buddhism
In Naruto, a Rikudo is equivalent to God/Buddha
And Madara is the second to ever reach that status
 
kids...
btw for some reason I always tend to read "rikudo" as "rikduo"
 
I read it as sudoku
 
Morning guys
Can I ask a SQL question here ?
Cause no one is answering in PHP room
 
I just look at the profile pics.
 
How can I sum the credit column and then store it in each row ?
Remember it's a RESULT SET
 
7:43 AM
I don't think a JavaScript solution is what you want
 
Yes :P
 
"Yes it is", or "Yes it isn't"?
 
Lo all. I'm having trouble with an Angular update to a model which isn't being reflected in the view. The save request follows controller -> model -> service -> model -> controller, but when my service returns a failed PUT and I update my model, the change isn't reflected in the view. As far as I know I'm in a digest cycle when it all takes place, not sure if anyone knows of any possible points of failure
 
Can you make sure you're in a digest loop?
 
So back in the controller I've just added...
.catch(function(response) {
        vm.showError(response);
        console.log(!$scope.$$phase);
      })
And that returns true (so that means I'm not?)
 
7:46 AM
What does it log?
 
> The only reason coders' computers work better than non-coders' computers is coders know computers are schizophrenic little children with auto-immune diseases and we don't beat them when they're bad.
 
If that returns true you're not in a digest cycle.
 
OK, but calling $apply here would be an anti-pattern because its inside the controller?
And just threw an $apply in but got a $digest already in progress error :/
 
!$scope.$$phase && $scope.apply()
 
Gahhhh this freaking RequireJS is driving me insane
 
7:55 AM
@MadaraUchiha what happen
 
So far I have setup my system to shutdown on powerfailure
adding a simple dumb android phone + android shell i should be able to send me an sms :-> for this event too :D
 
@AwalGarg Trying to invoke Karma with tests and mock some modules
This proved to be a much much bigger problem than it should have been.
But it lacks context
 
@Cerbrus that's some BS. how can not allowing religion related content be offending? it's a site about programming, come on - use your brain please. — low_rents 17 secs ago
Oh this guy.
 
!!tell 25737455 letitgo
 

« first day (1796 days earlier)      last day (3150 days later) »