« first day (961 days earlier)      last day (3988 days later) » 

12:00 AM
0
Q: Error returning a value from a function?

WayneIt tells me the error is on this line: this.srcX = ShipSrcXPicker(type); However I cannot see it? I am returning the values from these methods that are being called? Is there something I am missing? I am making a Object and drawing the image to the screen? function Player() //Object { this.P...

 
m59
Sweet, I found a hack to fix vw on window resize in Chrome. Just set a window resize listener to add z-index to the element. It causes a repaint, which fixes it.
 
@copy have you ever ran v8 with --trace_deopt etc?
 
Nope
 
pretty interesting
 
Holy fuck
But it might be really complicated to test my code in that
 
12:09 AM
like wtf
Inlined hashStringSmi called from smiHashSpeed.
Did not inline hashNumber called from numberHashSpeed (target not inlineable).
maybe I will make separate functions for integer and floats then
 
Why are you using 0x3fffffff instead of 0x7fffffff?
 
because small integers are 31 bit
you can only have 32-bit integers locally
 
?
 
if you pass as argument/return or use as closure var / object property, then you have to use 31-bit integers to avoid boxed doubles
oh yeah
just got 8x speed on integer hashing
cos of the inlining
fucking win
here's the difference in time when I don't enforce 31-bit integers
SMI average time for 50000 hashes: 4.25 milliseconds
normal average time for 50000 hashes: 25.4 milliseconds
in firefox they use NaN tagging so they don't have that problem, and the first runs slower, but only at 80% speed of the second
 
Never heard of that
Is the >>> 0 of ( ( Uint32View[0] ^ Uint32View[1] ) >>> 0 ) & 0x3FFFFFFF also an optimization?
Since & 0x3FFFFFFF cancels out the sign bit anyways
 
12:18 AM
it's maintenance artifact.. I added the SMI mask later and forgot to look at the code
yeah it's useless now, thanks
most ridiculous thing is how switch cases are optimized
you need
1. less than 128 cases
2. all cases must be either small integer LITERALS or string LITERALS
3...
so you cannot use named constants or such
:(
 
Closure Compiler can inline constants
 
even property access constants?
 
Nope
 
like if I have
switch( op ) {
case Operation.XOR : ...
}
oh ok
 
I have actually asked that on SO
They should really just put function inlining into Closure Compiler
/** @inline */ function a() { /* ... */ }
 
12:25 AM
yea
 
Error with explanation if it doesn't work
 
did you know that v8 actually looks at the physical text size of a function
like if you have a long comment, then it cannot inline
xD
 
...
 
Did not inline hashyhash called from numberHashSpeed (target text too big).
yea
 
12:53 AM
is there much benefit to using document fragment ?
 
i see so mainly it reduces the amount of appends to document/
that help with allowing me to use loops rather than hard coding all the divs :D
 
And the resulting code is cleaner.
 
yeh
damn i hate learning something new later.. have to go back and edit lots of scripts :'(
 
@Esailija Anyways, I'm off to sleep, but let me now if you have more interesting findings (maybe write a blog post or so?)
 
12:58 AM
ok night
 
@Dave Well, you don't have to. And read Tino Zijdel's comments.
 
okay
 
my god
calling a bad function from a function causes the parent function to be deoptimized too if the target function is inlined
making a huge comment in the target function fixes it
 
Witchcraft.
 
I am giving up on javascript
lmao
 
1:23 AM
with document fragment can you add to it like text with innerHTML ?
or does fragment not work like that
 
Hey guys, how do I active asserts? I have the follow: assert (startGrab.getAmount() > 0) : "The amount is to low.";
assert (startGrab.getAmount() < 1000) : "The amount is to high, your account does not contain those funds.";
 
o/
 
@DavidBiga, what is that meant to be?
 
@phenomnomnominal What do you mean? Oh I am having trouble running this in Java because I can't figure out where to put the Java -ea unitprojBank; to activate the assert.
 
This is not the Java room.
 
1:31 AM
Thought it would be close enough because there was no Java room with peps in it.
take away the script and you have Java :P
 
car is to carpet as Java is to JavaScript.
fun is to funeral as Java is to JavaScript.
ham is to hamster as Java is to JavaScript.
 
Ha
So you have no idea?
 
I just don't care :)
 
long story short why are asking about java in the wrong room
 
You never know what people might know, especially with you smart people :)
@phenomnomnominal I still love you
 
1:36 AM
isnt that what stack overflow questions are for ;)
 
@Dave Not AFAIK.
 
The minute you ask something, unless it seems 'fit' to someone else they mark you down for a question you sincerely have and need help on and your account gets banned from asking questions that people don't like :(
 
@DavidBiga, Love you too buddy. I just want you to get better and stop using Java.
 
you must be doing it wrong =/
 
I think you should join Javaholics Anonymous.
 
1:39 AM
SO doesn't ban for asking a Q unless its spam
 
@phenomnomnominal I do, I am a all rounded programmer, I do C++, java, php, c++, c, objective c, jquery, javascript, etc... but I get confused on all these languages and forget where to put certain stuff lol
@Dave I don't span
 
dunno how you got banned then
 
A) You listed C++ twice. B) jQuery IS JavaScript.
 
@phenomnomnominal Some people don't know that
:P
 
Especially people in here.
 
1:41 AM
I know, and it causes me a lot of pain.
 
me too
hurts my little heart :P
 
I die a little bit inside
 
@Dave I think it is when you get a large number of down votes or something like that.
 
I missed my Jailbroken i5
 
im quite proud ive made my js game with my own library from blank page!
 
1:43 AM
whats the game?
 
taken me over a year though which i could of done in 6 months
its an isometric browser RTS
 
I made a mario remix in Java...you can pick up a gun and shoot the little crab looking things
 
bit like age of empires
 
show me?
 
just looking into websockets now for player to player stuff
not finished yet to show
 
1:44 AM
use HTML5..looks coll what you can do in it
 
it is html5
but browsers are still not up to par except the main 3 FF,IE and Chrome
i prefer to call it HTML5(BETA)
 
That is true
 
my main concern is performance due to my server being cheap :P as im poor
 
You will make it my man!
 
hope so ^_^
 
1:52 AM
So hows the economy down in Europe?
 
Safari and Opera are a long way ahead of IE
 
I am using the following code JQuery form validation where the email textbox automatically validates and checks to see if the email entered already exists.
Here is my JS code:
jQuery("#signUpemail").validate({
	rules: {
		required: true,
		email: true,
		remote: "/inc/1x7dsL3-email-Ez7iv91.php"
	}
});
Do you see anything wrong with it?
It doesn't work.
 
@DemCodeLines, make a fiddle
 
@phenomnomnominal i get terrible canvas FPS on those .. but IE is equal to Chrome in performance
 
IE fakes it
 
1:59 AM
how so ?
 
They just don't draw every n frame
 
but at least its playable :P
 
How can I make a fiddle? It uses PHP code to check against a database.
 
I've personally never had any problems in Opera or Safari, I'd be interested to see what you're doing
@DemCodeLines, jsfiddle can still access the php to to the validation
Presuming you have it on an actual hosted server
 
Ill just use a predefined email to show
 
2:01 AM
I have to go anyways, someone else might look into it
 
ill show u some performance results tomorrow
 
Anyone else please?
 
@copy 41782729.80501393 integer get operations per second over 359 ms when using Map
75757575.75757575 integer get operations per second over 198 ms when using Native
better than 100x slower xD
 
@Potatoswatter you there?
 
@DemCodeLines What's going wrong? I don't know PHP or what the role of the script is here
 
2:10 AM
12 mins ago, by DemCodeLines
I am using the following code JQuery form validation where the email textbox automatically validates and checks to see if the email entered already exists.
12 mins ago, by DemCodeLines
jQuery("#signUpemail").validate({
	rules: {
		required: true,
		email: true,
		remote: "/inc/1x7dsL3-email-Ez7iv91.php"
	}
});
What's wrong with that part of code, if anything?
 
Is the server getting properly validated emails? Where's it going wrong?
 
I don't know at all what's going wrong.
 
I mean in terms of functionality.
Is there a textbox on the page? Can you type in it? Does it complain if you type an invalid email? Does it send an Ajax if you type a valid one?
 
Yes. I don't know. It should take the email that I entered, launch the php file in the remote url, and validate in the php file if it is the same.
 
I'm not going to help you if all you can tell me is that it doesn't reach the end.
 
2:14 AM
Wait a second.
expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;"
I have that, so it doesn't work until I put a valid email in
@Potatoswatter ^
Yes, its a textbox in which you can type.
As soon as the textbox loses focus, it uses JQuery validate to validate.
@Potatoswatter ?
 
I'm poking around the jq.validate docs but not finding much about what the predefined rules are or how they're supposed to be applied.
It looks like you might need a set of objects like email: { required: true, email: true }, remote: { required: true, remote: "..." } }
 
oh boy
 
Their examples go 2 deep.
@DemCodeLines Oh. They have an example for just this. Yeah, you just need an extra wrapper object.
$( "#myform" ).validate({
rules: {
email: {
required: true,
email: true,
remote: "check-email.php"
}
}
});
@DemCodeLines Oh. They have an example for just this. Yeah, you just need an extra wrapper object.
 
@Potatoswatter ...
jQuery("#signUpHome").validate({
	rules: {
		signUpemail: {
			expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;",
			required: true,
			email: true,
			remote: "/inc/1x7dsL3-email-Ez7iv91.php"
		}
	}
});
Still doesn't work. It proceeds forward when the submit button is clicked, even if the email entered already exists in the database.
 
2:29 AM
Did it send the AJAX?
 
In fact, even if I don't enter anything in the email textbox, it still proceeds forward.
 
hey guys, I know this isn't the right place but I couldn't think of any other. Has anyone ever setup an XMPP server? using Openfire.
 
2:48 AM
What? I'm no longer the model? :(
 
@BadgerGirl could you please help me?
 
@DemCodeLines Am I the model?
 
@DemCodeLines You gotta use more descriptive words than "proceeds forward" if you want help. And putting code in a string, especially with a return statement, is a huge red flag. It's probably choking on that, the plugin would never be designed that way.
 
@BadgerGirl If saying yes pleases you, then yes.
 
In jQuery what is the difference between $("div p") and $("div > p")
 
2:53 AM
@Potatoswatter When I say proceeds forward, I mean it just executes whatever url is put in the "action=" part of the form.
 
@demcodelines, why do you need the if an the returns? Just use match, it returns a Boolean.
 
@phenomnomnominal Are you talking about the expression statement?
 
Does anyone know if you have a function in string format, if you can assign it as a function still somehow?
 
@dem yes.
@callmedummy, > selects only direct children
@dylan use the Function constructor.
 
@phenomnomnominal, that clears it , thank u
 
2:56 AM
Its just to make sure the email is in correct format and I have been busy with this thing for so long that I haven't really thought much about other parts of code unless altering them applies major changes to this problem.
@phenomnomnominal ^
 
@dem match will return true or false if there is a match, so just use that bit.
You don't need to check what the result is.
 
so just return VAL.match... ?
 
With the regex of course, and cast it to a bool.
 
@phenomnomnominal I see how you could use that if you had each parameter individually as a string, but not the function as a whole
 
@dylan, I'm on my phone so I can't check, but - new Function(funcstring); should work? Give more details and someone will help.
 
3:06 AM
@phenomnomnominal expression: "return (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/));" ok?
 
Anyone here familiary with OAuth2?
 
Almost, put !! before VAL.match, and you have an extra pair of brackets
 
@phenomnomnominal expression: "return !!VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/);" ?
 
Looks good, probably won't fix your problem though
 
So how would I fix my problem?
 
3:11 AM
57
Q: QR Code in shopping cart handle

MurtaThis week, the market people from my work wanted to put QR codes in shopping cart handles, but when they tested it, the QR code did not work. I noted that the cylindrical curvature (even small) distorted the image, and the cell phone can't read it. Here is some test QR code: I thought that...

2
 
I don't know what your problem is.
 
@rlemon Wow
 
@phenomnomnominal the email field is not validating properly.
 
@rlemon shiiiiiiiiiiiit!
 
@phenomnomnominal Okay, well I'm taking an existing function, removing 2 lines of code with regex, then would like to reassign it as a function. So I guess if the result function was function() { alert("test");} for example, I would also have to remove the "function(){}" ?
 
3:16 AM
I thought it was pretty interesting
 
Come on, no one has worked with JQuery Validation before?
 
@demcodelines @dylan, I'm driving, someone else might help you.
 
what do you guys do?
 
0
Q: Game not checking for keyboard input?

WayneI have tried to explain as much as I can with commented code also. Working example: http://www.taffatech.com/Source.js -Code is organised by commenting html game: http://www.taffatech.com/DarkOrbit.html I have an Object called Player1 that has the following information: function Player() //Obje...

 
Well, could someone else please help me?
 
3:18 AM
I'm sure if someone can they will.
 
odds are there may be someone looking at it now
 
Well, I hope there is.
 
bur a word of advice: people get annoyed when you do that.
i know how you feel.
 
@rlemon Delayed 'wow' from digesting it. Now that's an answer!
 
3:19 AM
Well, if people wouldn't help on SO, then I would ask here, but if they get annoyed here too, then...
 
u want to sort the think out nowQQQ
 
hello how to paste codes here?
 
@DemCodeLines i didnt say that
 
link it?
 
said people get annoyued whn u keep asking the same thing
not being a jerk, just think about it
 
3:21 AM
Yes, but if most people just remain silent and no one answers on SO nor do the articles on it help, then what do i do?
 
i just walked in,
whats ur problerm
in brief
 
anyways
 
there arn't any other active rooms atm so i'm going to ask it here :p It's a nooby question but i'm gonna have to ask it. Is this pure ajax or does it use something else like jquery ?
$.ajax({
type: "POST",
url: "/diagnose_hoofdpagina/table_diagnose/" + DosierID,
success: function (data) {
$("#diagnoses_zelf").html('');
$("#diagnoses_zelf").append(data).trigger('create');
LastDate = lastdate;
//stelt de globale datum wanneer er het laatst geupdate in met de variable die mee wordt gegeven wanneer de tamplate geladen wordt
 
I am trying to validate an email textbox that automatically checks if the email entered by the user already exists in the database.
 
@GertV jQuery indeed
 
3:23 AM
My code:
jQuery("#signUpHome").validate({
	rules: {
		signUpemail: {
			expression: "return !!VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/);",
			required: true,
			email: true,
			remote: "/inc/1x7dsL3-email-Ez7iv91.php"
		}
	}
});
 
so it's like jquery ajax ?
 
" It's a nooby question but i'm gonna have to ask it. Is this pure ajax or does it use something else like jquery ? " do yourself a favour and never apologogize for being a noob again
no shame in it
jquery is not ajax
 
k :) ty
 
WAIT
 
@GertV That's what it is, you can use pure JS if need be by manually converting it to an xmlhttprequest
 
3:24 AM
im still talking
 
@DemCodeLines how to paste a code like yours on this textbox?
 
Asynchronous Javascript And XML
 
uhu
 
@vincent you just copy and paste it here and then press ctrl and k to format it properly.
 
meaning it appears to be working in realtime
instant
 
3:25 AM
@DemCodeLines thanks
 
Anyways, @skopp I gave you my problem and my code above. Tell me if you would like to see my PHP code too.
@vincent np
 
l
 
ajax ?
 
it is a jQuery function
what you pasted
 
isn't it more like the page can just go on w/o refreshing everything but only a partial div or form
and with synchronous technologies it would just be stuck till the response gets back ?
 
3:26 AM
@GertV you need to read up more
u on track, but thats not really correct
 
That's the idea/purpose of the function, yes. You can specify async if need be
 
but what has ajax to do with jquery ?
and why is my query build with ajax and jquery instead of just ajax :p
 
It uses jquery's father
javascript
or jquery itself
demcode ill be with u now
 
Ok, thank you.
 
3:29 AM
in fact Ajax, as you said, has comer to mean ... well, like this chat room
ot gmail
Yeah... no need to refresh the whole page.
 
@GertV AJAX is just an httprequest so any language, I.E. javascript, jQuery, php can use it...
 
but it could be using pythonscript or no script at all
 
@GertV ajax isn't a thing. It's just an http request, and it's not bound to jquery in any way. gist.github.com/Zirak/3086939
 
Alas, you really should read up on the theory more befoer you can make such deductions
 
ah !
k thats a fine answer right there :)
 
3:31 AM
@bigbearzhu 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.
 
which
 
I mean that is jQuery syntax there..
 
I am trying to learn jQuery from a tutorial website and the script tag to include jQuery is used at the end of the body, is that necessary ? or is it okay if I include it in the head tag ?
 
jquery, jquery everywhere...
 
so this means i could use ajax with anny technology that supports it. jquery is the technology that will in my case execute it
 
3:32 AM
@CallMeDummy head tag would be preferred
 
sry :p
 
nor any drop to drink
 
@GertV yes
 
@dylanmaxey thank you
 
awesome :) ty
thx everyone :)
 
3:32 AM
99
Q: Where is the best place to put <script> tags in HTML markup?

mipadiWhen embedding JavaScript in an HTML document, where is the best place to put the <script> tags and included JavaScript? I seem to recall that you are not supposed to place these in the <head> section, but placing at the beginning of the <body> section is bad, too, since the JavaScript will have ...

If it's in the head, the entire script needs to be loaded before the page is displayed. At the end of the body, the page loads, appears to the user, and then the script starts loading
 
okay back to js, it's been a while since I asked so..
Okay, well I'm taking an existing function, removing 2 lines of code with regex, then would like to reassign it as a function. So I guess if the result function was function() { alert("test");} for example, I would also have to remove the "function(){}" ?
 
the essential scripts i put in head
 
@dylanmaxey Why the fuck would you want to do that?
 
yes lol
 
That reeks of bad design choices
You shouldn't be fucking with functions like that
 
3:38 AM
It is after the fact, with greasemonky/tampermonkey, which I think is irrelevant. I just need to change the function...
 
@Zirak Thank you, so if I put it between head tags it would cause problems with webpage rendering. Do I have to include the related link tag at the end of the closing body tag as well ?
 
@CallMeDummy It wouldn't "cause problems", and style tags for displaying the page should go at the head
@skopp Shut up
 
it beeped when he put that message so i assumed it was refereed to me. my apologies
 
I was talking to you
 
@Zirak ^_^ Thank you
 
3:41 AM
@Zirak so not really bad design..
just a workaround
 
Why do you need to change the function like that? What is that function?
If it's an event listener, you can remove it. If it's a method, you can override it. If it's a function you have access to, hey, you can override it.
 
it is a function in QuickBooks online, that if you change the tax rate, it will automatically focus the element, but I am programatically changing it, so no need for unnecessary scrolling or loss of focus of the previous element
 
Then remove the event listener
!!/tell dylanmaxey mdn removeEventListener
 
What? No he didn't
How will he be writing a userscript in php?
 
3:45 AM
Is this real, or were there magic mushrooms in my salad?
 
...and that's a different person
 
@Zirak I need it though, for the listener contains much more code, that changes several elements based on the selected rate, so I would prefer the remainder of the function remain in-tact
 
Then don't care, it's a userscript
Or even better, change the target element's focus handler to prevent default.
26 messages moved to Trash can
 
@Zirak yes but it's also for a small business to increase convenience and efficiency
 
@maethorr 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.
 
3:49 AM
@Zirak
I quoted that for a reason
to ask something
 
LOL
closure compiler removes this code
    if( ( val | 0 ) === val ) {
        return val & 0x3fffffff;
    }
and the result is 3-5x times slower
thanks a lot xx
 
overflow
 
no it's perfectly useful code
 
lemme check it out
closure is a horrible old man
 
this the exact code
var hash = function hashFunction( val ) {
    switch( typeof val ) {
    case "number":
        if( ( val | 0 ) === val ) {
            return val & 0x3fffffff;
        }
        return hashNumber( val );
    case "string":
        return hashString( val );
    case "boolean":
        return hashBoolean( val );
    default:
        return hashObject( val );
    }
};
 
3:53 AM
@Esailija What I meant is that JSON will unlikely be a bottleneck,
 
keyboard event on textarea not simulating....... if you have time to see this code jsfiddle.net/Y4VEt
 
what comes after comma
:P
 
Well, initially something about why the point is that he shouldn't worry about it, but I think we both know that already so I didn't bother typing. Also, maybe something about how alt+comma is a macro here :P
@vincent keyboard events are not trusted events
 
@BenjaminGruenbaum ohhhh okay.. shoot .
 
@skopp you still there?
 
3:59 AM
yeah had a fkash problem
i hate flash
 
@BenjaminGruenbaum First of all...how did that article come from the future? Second, you just gotta love the explosive title followed by careful steering to the opposite direction.
 

« first day (961 days earlier)      last day (3988 days later) »