« first day (1569 days earlier)      last day (3373 days later) » 
00:00 - 18:0018:00 - 00:00

12:07 AM
how do i keep a form from redirecting but still do an action?
i have a jquery $("#form").submit() handler that takes the contents of an input and sends it to a node server that then sends it to the clients (chat app)
whats weird is it was working before when i had a return false in the handler, but suddenly it stopped working
e.preventDefault() is not the solution either as it breaks using the enter key to submity
anyone know a workaround, or a reason why return false stopped working in the first place
 
@ROODAY chat is dead today no one wants to help
 
i see
 
yup
i been trying to get help all day but no luck
 
12:24 AM
@ROODAY Those two things have nothing to do with eachother
 
about time someone is helping
 
Say what?
 
no one has helped in this room all day
 
This has to be the fastest tiny avatar action in history of chat
 
lol
 
12:30 AM
@Steve noone is entitled to help anyone.
 
i know
 
doesn't look like so
 
1:20 AM
I'm making a website. when a button is clicked on the site, I would like to scrape data from a different website and display it. Is this possible?
 
@Zaghie Welcome to the JavaScript chat! Please review the room pseudo-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.
 
@Zaghie Possible, yes, ethical, not really.
 
any pointers as to how it can be done?
 
Like I said, I'm not sure about the ethicality of scraping. If the site's got an API, you should use that (and they've probably got documentation on how-to)
 
I'm scraping because no API is available
 
1:26 AM
Then it sounds like the owners of said content don't want you to use it - which would be stealing.
 
fair enough
thanks!
 
 
1 hour later…
m59
2:55 AM
what route would you guys use for resetting a password?
DELETE api/users/self/password
I got no clue =D
 
i think its about right @m59
 
Honestly, I'd probably just do POST api/resetpassword or something similar. (maybe api/users/self/resetpassword, if you already have a "api/users/self" route)
 
m59
resetpassword sounds like an action, which isn't really REST y
 
But I'd rather have a single route than try to treat a password like it's a resouce.
 
Is there a way to get the original innerHTML of an element, i.e. what you would see in view-source?
I suspect no :(
 
3:05 AM
@m59 PATCH?
 
m59
perhaps. I am literally just removing the password. They have to log back in via email link.
 
True
 
m59
or I could set their password to the unique code in the link and they could use either.
 
3:43 AM
@PeeHaa @m59 can you help me with something
 
m59
3:59 AM
@Steve I dunno. What is it?
 
i gave up
 
m59
on what >.>
 
@m59 im using this theme preview.w3layouts.com/demos/pinball/web the issue im having issue the page takes forever to load since there are a lot of images and the theme is depending on the plugiin for imagasesloaded.js so the issue with theme is like if you were to open the page it doesn't display anything because its waiting for the images load to complete so im trying to see how can i over write the code so it doesn't reply on that plugin and yes i did try to remove it from the
source but when i do that nothing displays
 
m59
seriously - <li onclick="location.href='single-page.html';">
seriously..
 
i know
 
m59
4:12 AM
oh, forgot to tell ya. Hanging with my wife. I don't have time to look it over much right now. Sorry man. You could recreate that thing anyway.
 
i spent too much time on fixing this the theme there is no going back
anyways umm is there way to force <video> to be like 200px
 
 
5 hours later…
 
2 hours later…
11:49 AM
Not sure how to explain this but does anyone know if/how i can redirect to a page on a button click and then execute a function? Got an add to cart button on a sister site. Im new to javascript so sorry if this seams obvious.
 
@BenRhys-Lewis Welcome to the JavaScript chat! Please review the room pseudo-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.
 
@BenRhys-Lewis Only if the page you're redirecting to is in your control.
 
yeah it is
 
You can't execute code from page A after the user left for page B
So the code you want to run must be on page B
 
Yeah its a cart on page B. The info about the product is on page A but the cart doesnt exist there. So i want to redirect to the main shop on page B and then add that product to the cart as normal.
 
11:54 AM
@BenRhys-Lewis Redirect to the URL with a query parameter (www.example2.com/shop/?itemID=42)
Then your code should be able to act on that
 
ah yeah ok. That seams really obvious now and so much simpler than what i was trying. Thanks
 
user4202350
12:18 PM
@SecondRikudo Good Morning Sir,
 
@ShaU Good morning
 
Is there any way i can detect that the keyboard is open
in iOS webviews ?
resize doesn't work.
 
@darkyen00 For what reason?
 
I have a search list of elements
when the keyboard is open
the painful browser
still renders the page with its original height
and thus the results of my search are under the keyboard :-(
 
@darkyen00 For what reason?
Why must it be when keyboard is open?
 
12:27 PM
it doesn't have to
but it kills the scrollability
 
Can you describe the scenario?
 
wait :-)
I have an app with a fixed header, the fixed header is used as a search bar component, when i search the results are populated in an overlay on the top of current view
it searches as they are typing
 
now they can scroll while the keyboard is up, or dismiss the keyboard
but when the keyboard is up
since the ui is rendered of its original height
the content hides under the keyboard and breaks the scroll.
 
I see
 
12:36 PM
Hiya all. Just trying to write a script for google sheets. To send a notification email, once a task is done.
Unfortunately, mail cant be sent with the onEdit trigger.
I've tried to create a small, standalone script, that is called at the end of the onEdit script. to send the mail. But that doesn't seem to work either. Does anyone know of anyway i can achieve this.
 
@SecondRikudo I am pissed off on that yankyness :-(
it has caused me to come to office and fix this issue on a sunday :-(
 
how would that help ?
 
@darkyen00 It's a native implementation of what you want
See if that works for you
 
enlighten me
 
12:40 PM
Sorry
Not details
Which is unfortunately not supported only in Safari -_-
 
Howdy
How do I remove an object from an array using a function of the object? (this.destroy = function(){})
Array.filter?
 
@Jonathan Array.filter is usually your best bet
Note that it doesn't affect the original array, but creates a new one
!!> var arr = [1, 2, 3, 4, 5]; var filtered = arr.filter(function(el) { return el % 2 === 0; }); console.log(arr, filtered);
 
@SecondRikudo "undefined" Logged: [1,2,3,4,5],[2,4]
 
How can i execute a function using url parameters?
 
@JanDvorak thanks for the comment, next time use flags please (Instead of commenting on another's post)
 
12:55 PM
@SecondRikudo in my callback, what do I test my obj against? return !Object.is(this, value2);
 
@Jonathan I don't know, what is your passing criteria?
 
I want to filter out this obj from the array, so keep all that are not this
enemies = enemies.filter(removeMe, this);
 
arr.filter(function(el) { return el !== this; }, this);
should do it.
For that matter
 
function removeMe(enemy) {
return enemy !== this;
}
 
And that doesn't work?
 
12:58 PM
Just wrote it, let me check
 
This seems to work nicely
 
Hehe, it destroys the entire array :P
Moaaaar explosions
 
@Jonathan see how your implementation differs than mine
Because mine works.
 
@SecondRikudo What am I doing wrong? jsfiddle.net/Jonathan_Ironman/ro9y95b5/11
Oh lol, its my collision detection
think it returns true for every explosion
Got it
 
1:24 PM
@Jonathan method names who lie... Yeah, that's not cool
 
@ircmaxell What do you mean?
 
the function says "remove" but it doesn't remove
 
Ah yes
 
user4029378
1:40 PM
hi, i've implemented oauth2 in an angularjs+html5 app. when i run it on a phone the authentication process works perfectly
but when i run the same thing in my browser through localhost, it doesn't work and gives an error
"XMLHttpRequest cannot load https://oauth-elance.jit.su/auth/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access."
....can anybody explain please
 
@Jonathan Name it "notThis"
Then arr.filter(notThis) makes sense.
or "notMe"
 
Yes, its now an anonymous function. It indeed was a bad name
 
@Jonathan You should name all of your functions.
Even inline functions for that matter
 
enemies = enemies.filter(function (el) { return el !== enemy; }, enemy);
 
(function() {
    (function() {
        (function() {
            throw new Error('oops');
        })();
    })();
})();
Paste that in your console
Then try with this
(function outer() {
    (function middle() {
        (function inner() {
            throw new Error('oops');
        })();
    })();
})();
 
1:47 PM
Yes that makes sense
 
destroy: function () { --> destroy: function destroy() {
 
@Jonathan That's not needed
 
ok
 
Most browser's dev tools are smart enough to name the function destroy in that case
Same goes with var destroy = function() {
 
1:49 PM
oh right
 
But arr.filter(function notMe(el) { ... }, this) definitely.
 
Ok, so stuff dies now. What's next? :)
 
@Jonathan Next you die.
 
Got that as well. Big explosion...
 
@Jonathan Continuous click for moving
 
1:54 PM
@SecondRikudo Fixed it all
WKWebview
 
I'm dropping mouse movement
!! make enemies smarter or improve player movement
 
@Jonathan improve player movement
 
!! lunch or lunch
 
@Jonathan Cheater cheater your house is a heater
 
lol
@Jonathan WASD?
 
2:05 PM
Yes, wasd and arrows
space to fire
 
Since this is a space game, you should make it like so:
 
but I don't liek the up/down/left/right
I'll make the mouse pointer forward
and a/d strafe
 
W and S control acceleration and deceleration
 
yes exactly
WASD now has static speed. Mousemove uses nice bezier from CSS
 
Direction can be controlled with mouse, sure.
 
2:08 PM
But, lunch first :P
 
Hi again, whats up?
I just happened to create a nice stagger effect when an item is clicked but when clicking on a second item it doesnt work jsfiddle.net/HCY5m/31
 
 
1 hour later…
3:21 PM
Mornin
 
Sometimes, when you get hit, it takes like 7 health instead of 1 (bug), but I did finish my game in 18 hours for the gamejam I was doing! nickdugger.com/heliarena
The code is ugly, but I didn't have time to make it more organized github.com/ndugger/HeliArena (I spent too much time on stupid math)
 
Any idea whats wrong with my code? jsfiddle.net/HCY5m/43
 
@Daniels Welcome to the JavaScript chat! Please review the room pseudo-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.
 
here the question to my problem, no one seems to be able to find the error stackoverflow.com/questions/28263764/…
 
I have a question, If writing inline javascript was bad, why is ng-click and like in React event binding is written inline?
 
3:34 PM
It's an inline reference to a function that's contained in a controller etc, it's not on the window like old school in line HAD to be.
 
@PiniH Welcome to the JavaScript chat! Please review the room pseudo-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.
 
ok
React Native is awsome. atleast there moto is
 
3:47 PM
I am doing socket.io, but how does a one to one chat work ?
 
@argentum47 One connection per couple.
 
:D
on different ports?
I have to read on this
 
m59
lol oops. I wrote all my resetPassword() code as though I knew the user's email address (like they were logged in)
 
Hahaha
 
m59
Should I make a table to store a unique code, email a link containing it to the address given, and have them click that to trigger the password reset?
otherwise, you could just type in someone's email address and delete their password haha.
 
3:55 PM
@m59 Yeah, something like that
 
m59
Man, it sucks when you're like, "well that's done, moving on" and then it hits you that your code doesn't do anything :)
 
@m59 A password reset link is considered as secret as the password itself
You don't store the link itself, you store the hash of an ID
and you send that ID to the user by email
 
m59
hmm, ok. I don't quite get why it matters with the unique code. If you have the raw one or hashed one, it's equally effective.
 
@m59 No, it isn't.
Because then your application requires the user to input a string that will hash to your result
The hash itself is useless.
If you store the ID as it is, it can be used by an attacker to reset the user's password
The exact same reason you don't store a password in plain-text, but only a strong hash of it.
 
If someone has access to your database, they shouldn't just be able to reset someone's password because you stored the reset code in there
If it's hashed, they can't do that without a bunch of trouble
 
m59
4:03 PM
Ohhhh. If someone has access to my database, I'm not sure why that matters.
 
Well, that's why you hash your passwords too
 
@m59 Because that way, even if someone accesses your database your users are not compromised.
 
Got to keep it as secure as you can
 
m59
I thought the problem with plain text password was just because you don't want someone to see the password the user created, for obvious reasons.
 
@m59 That's not it.
If an attacker gains access to a database full of plain-text passwords, he has a lot of passwords
If an attacker gains access to a database full of strongly-hashed passwords, he has a list of useless hashes.
 
m59
4:05 PM
Exactly. But if he can view those passwords, why can't he also change them?
 
@m59 the hashed passwords?
 
m59
sure.
 
He probably can, if he has write access.
And assuming he knows your hashing algo which is trivial
But he cannot access the user's original password
 
m59
Sure. So, it seems like a minor benefit. If you can inject sql, you can probably do whatever you want, right?
 
@m59 SQL Injection should never be an issue.
 
m59
4:07 PM
Is there another way someone can read from your database?
 
@SecondRikudo l really expected that to rickroll me
@m59 Having physical access
Or remote access to the physical computer that is your server
 
m59
I see.
makes sense.
 
@m59 Leaked backup files, resentful employee, physical access.
An attacker will always look for the weakest link
Your goal is for that weakest link to always be your users' incompetence and not yours
And even then you should take measures to ensure that even with their incompetence, their credentials and data are relatively safe.
(By not allowing 12345 as a password, for example)
 
posted on February 01, 2015

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker("UA-3727700-1"); pageTracker._trackPageview(); } catch(err) {} Hello February.

 
any VIM user ?
 
m59
4:11 PM
yep
 
?
what are the best plugins you use for web development
 
@amin WebStorm
:P
 
m59
I don't really use any for any specific purpose like that. I haven't had any need so far.
 
@SecondRikudo that is not a vim plugin !
 
@amin Yes, I made a funny
 
4:12 PM
@m59 but VIM lacks many of popular editors features ...
@SecondRikudo :)
 
m59
indentLine, swap, jade are the only plugins I have.
@amin what do you need it to do?
 
commenting , uncommenting , code indentation , autodomplete
opening files, fast navigation between tabs ,
 
@amin Seriously though, WebStorm
vim is nice and all, but it's not an IDE
 
m59
I can do all of that except for autocomplete :)
 
If you want that, why use VIM? Use what works; not what is "cool".
 
4:15 PM
With all due respect to vim, Extract into a variable, Extract into a method and Inline variable/method are invaluable to me.
 
@RoelvanUden VIM is more productive ( at least for me ) even without this feature(s)
 
window.innerWidth; returns my monitor width, not the inside width of the browser in Chrome?
 
Yeah, apparently not. If you're missing all that, you aren't exactly being productive right now. Just tune the thing that's closest to your required features o_o
 
@Jonathan No repro.
 
m59
220
Q: What's a quick way to comment/uncomment lines in Vim?

EthanI have a Ruby code file open in vi, there are lines commented out with #: class Search < ActiveRecord::Migration def self.up # create_table :searches do |t| # t.integer :user_id # t.string :name # t.string :all_of # t.string :any_of # t.string :none_of # ...

 
4:17 PM
!!> window.innerWidth
 
@Jonathan "ReferenceError: window is not defined"
 
@m59 thanks
 
document.body.offsetWidth works, but window.innerWidth doesn't
 
m59
@amin indent 5 lines with 5>> and then repeat with .
 
Works in Fiddle though -.-
 
m59
4:23 PM
@amin I'm also faster at finding/opening files with grep, like vim -p $(grep -rl 'foo' ./) than I am with a ui.
or :tabnew path/to/whatever
The only thing I wish I could figure out is once I have gone through a bunch of tabs and closed them, I have to access the rest of the files that didn't fit by using :next, one at a time.
I wish I could move them all into tabs with a single command.
 
@m59 WebStorm
CTRL+SHIFT+N > Fuzzy search file name
 
m59
nah, I way prefer vim over all that mess.
 
@m59 i'm readly :h tabnew its cool :)
 
Or even better, SHIFT SHIFT > Fuzzy search files, classes, symbols
 
@m59 reading (typo)
 
4:26 PM
Can someone explain why this doesn't work: jsfiddle.net/Jonathan_Ironman/dxqqe1mk
 
m59
I used IntelliJ IDEA for a while.
 
@m59 That's what I'm using right now.
 
@SecondRikudo i used intelliJ once ... but i sucks !
 
m59
I think the best thing is that vim helps me stay focused so I am less sleepy.
 
@amin Intelli is complicate if you don't work with Java
But that's what WebStorm is for, it's specialized for web development
 
4:28 PM
@SecondRikudo i used it for javascript ... dont know about java ...
 
I use Intellij to write in Java, PHP, JavaScript, HTML, CSS, LESS, shell scripts, etc
So it provides tools which are very useful.
 
@SecondRikudo i recall it had a very slow VIM PLUGIN ... i will check if this is still the case or not ...
@SecondRikudo if VIM PLUGIN is fixed ... then i will have no problem considering a more popular ide ...
 
IntelliJ is pretty decent for Java, I prefer using their relevant tooling for other languages though.
Also, HTML CSS and LESS are not interesting languages for editors - they're just markup - that's like having a fancy markdown editor
 
@BenjaminGruenbaum True enough.
Aside for Visual Studio for C#/.NET, I've yet to see an IDE that tops Intellij in any other language I work with
Which admittedly is not much.
 
4:49 PM
Visual Studio isn't very good without ReSharper :D
 
@SecondRikudo Visual Studio isn't very good (source)
 
I guess today is bad decisions day
 
@BenjaminGruenbaum Wonder how many kids will be born in October this year...
 
4:58 PM
Hey , Whats the best way to parse xml from an angular app
 
@SecondRikudo November?
 
@BenjaminGruenbaum That
 
@BenjaminGruenbaum it was you that linked me to the oracle machine wiki thing, right?
 
so, it's like a normal turing machine, but with an additional head and tape added, + the ASK and RESPONSE states, according to the wiki
> From time to time, the oracle machine may enter the ASK state. When this happens, the following actions are performed in a single computational step:

the contents of the query tape are viewed as an instance of the oracle's computational problem;
the oracle is consulted, and the contents of the query tape are replaced with the solution to that instance of the problem;
the oracle head is moved to the first square on the oracle tape;
the state of the oracle machine is changed to RESPONSE.

The effect of changing to the ASK state is thus to receive, in a single step, a solution to the proble
that is from the wiki...
how are those things done in a single computational step?
is the query tape the oracle tape?
 
5:11 PM
@towc Maybe it uses duct tape
 
what's the oracle's computational problem
@SecondRikudo that solves everything! It all makes sense now XD
is square the same as cell?
what does the RESPONSE do?
it says that the problem is written on the oracle tape... how?
I've read about it a bit more, but ended up not understanding much... looked somewhere else on google and youtube, but nope
can anyone enlighten me?
 
@towc It's just a model
 
@copy but is that actually achievable in the real world?
 
Sure
 
5:26 PM
little hint?
 
@towc I'm not sure we can talk about this stuff before you read the more basic material on decidability problems (Try Sipser it's a good book). Oracles are tricky.
 
ok
 
@towc You're too young for "the talk". Go read some books.
=P
 
m59
5:41 PM
@SecondRikudo I was just going back through and hashing those codes
boned me though, since I was actually looking up the code
I guess I need to put some other kind of id in the url as well?
 
Is it possible to add an if statement for button clicks?
 
@JaWapa Welcome to the JavaScript chat! Please review the room pseudo-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.
 
Can someone please test on a js encryption code?
 
@JaWapa yes. Put it inside the event handler
@Charly did you implement the encryption/decryption yourself?
 
yes
 
5:52 PM
@Charly What algorithm did you implement? Do you understand the mathematical foundation behind it at a deep level?
 
I don't really know...
 
@copy you're going to enjoy this
@Charly what algorithm did you implement?
 
if the converted charcode is 20 21 22 and the key is 123, result would be 20+1, 21+2, 22+3.
 
That's incredibly simple to break.
 
:(
even if you don't know the key?
 
5:56 PM
@BenjaminGruenbaum Would this be correct?
if (document.getElementById("myBtn").onclick = function()){
//do stuff here
}
 
@JaWapa no, add the onclick anyway and then inside //do stuff here put the if
@Charly yes. In generally you should never roll your own crypto. EVER.
The exception is when you understand the mathematical foundation behind it, are getting lots of peer review by experts and have a lot of penetration testing. Those are not trivial.
 
But how? I mean both the text and the key can be really long and how do you figure out one without the other?
 
Of course - writing your own crypto is fine, just don't roll it anywhere.
 
@BenjaminGruenbaum penetration testing teehee
 
No its not for serious business. Powered by boredom.
 
5:58 PM
@Charly if the text and the key are of equal length and the key is only used once then it is called an OTP (one time pad) and it is safe.
If you just want to learn about cryptography by all means do, it's fun.
Also, the key has to be completely random (Math.random() for example is not really random, nor should you ever use it for anything that has anything to do with cryptography, ever).
 
@BenjaminGruenbaum you're so depressing
 
yeah so window.crypto.getRandomValues()
 
nothing is completely random
 
@Mosho your mom is
 
00:00 - 18:0018:00 - 00:00

« first day (1569 days earlier)      last day (3373 days later) »