00:02
<zewt>
heh, unreadable examples on msdn ... because, as usual, of someone using nonstandard tab stops
01:41
<MikeSmith>
"You are really good master. It’s easy and enjoying to work with you."
01:41
<MikeSmith>
He is indifferent to music of Kraftwerk.
01:42
<annevk>
Well that explains it, Kraftwerk is awesome
01:54
<annevk>
http://quuz.org/webvtt/ now with <title> and <h1>
02:16
<MikeSmith>
I made some personal fashion changes recently
02:16
<MikeSmith>
this is my new look:
02:16
<MikeSmith>
http://www.oneyeartrip.com/2010/04/isawa-onsen.html
02:16
<MikeSmith>
feedback welcom
02:16
<MikeSmith>
oops
02:17
<MikeSmith>
http://2.bp.blogspot.com/_88RoabsTacs/S92ZA4h7NDI/AAAAAAAACZ4/VBy0WeKWj9U/s1600/IMG_2060.JPG
03:27
<jarek>
Hi
03:27
<jarek>
what's the correct way for implementing toggle buttons with HTML5?
03:27
<jarek>
I can't find anything like <button type="toggle">
03:28
<jarek>
should I be doing it the old-fashioned way? (a couple of divs with click events attached to them)
03:30
<jarek>
but this won't work when uses keyboard for navigation
03:33
<jarek>
another idea is to have something like <button data-is-toggled="true">, but I would still need event listeners to to watch and update button state
03:34
<jarek>
s/uses/user uses
03:43
<Hixie>
jarek: <input type=checkbox>
09:19
<annevk>
why is string lastIndexOf not the same as array lastIndexOf
09:19
<annevk>
what insanity is this?
11:06
<MikeSmith>
Ms2ger: so do the canvas test-suite changes to add testharness.js need to be reviewed by anybody other than Philip` ?
11:06
<Ms2ger>
Anyone who's interested, I guess :)
12:18
<annevk>
why does onhashchange not expose old and new hash rather than old and new URL?
12:28
<hsivonen>
hmm. the Reader version of Opera Mobile Labs allows getUserMedia go through without prompting the user
12:29
<hsivonen>
i.e. it turns on the camera without prompting the user
12:29
<hsivonen>
not cool
12:41
<zcorpan>
hsivonen: "The device API does not have a user interface yet. This will be added soon.
12:41
<zcorpan>
These are proof of concept builds, and should be considered experimental and for developer use only."
12:48
<hsivonen>
zcorpan: ok. I reported it as a bug anyway, because I didn't like having the camera turn on without permission
12:50
<hsivonen>
btw, https://www.cs.columbia.edu/~smb/blog//2011-10/2011-10-21.html is interesting as far as the implications of an "always allow" option goes for allowing a given origin access the camera or the microphone
12:58
<zcorpan>
abarth: so does script need crossorigin=""? would it break the web to include an Origin header for script requests?
14:38
<adtykfhyipoh>
Hey, is anyone here? I need help.
14:39
<divya>
ask adtykfhyipoh
14:40
<adtykfhyipoh>
Hey, I am building a javascript application, and I have an if statement, and in the condition, I need to know if one variable equals the value of any item in an array. How can I do this?
14:40
<divya>
array.indexOf(variable)
14:41
<adtykfhyipoh>
that might work I'll try it
14:48
<adtykfhyipoh>
thanks mate it worked
14:48
<divya>
np mate
15:21
<gsnedders>
divya: You need indexOf(foo) >= 0 or !== -1
15:21
<gsnedders>
divya: [1].indexOf(1) === 0
15:22
<divya>
gsnedders: yep, I just wanted to point what f() to use to adty
15:22
<gsnedders>
divya: Kinda unclear from what you said, though
15:23
<divya>
yeah probably :P
16:10
<_bga>
heh but new trend is ~a.indexOf :/
16:10
<divya>
coz that looks like you know what you are doing even if nobody else does
16:12
<_bga>
divya its for waste your brain "tacts", each time you remember that ~-1 == 0 and Bool(0) == false
16:14
<divya>
hah
16:15
<zewt>
bga: i'd smack anyone who tried to put garbage like that in my codebase
16:15
<_bga>
:)
16:15
<zewt>
leave that crap to obfuscated programming competitions; it belongs nowhere else
16:16
<Philip`>
How about "if (1+a.indexOf(b))" ?
16:17
<_bga>
i have some patterns for string lookup
16:17
<zewt>
that'd also incite me to install an "upside the head" device in someone's desk
16:18
<_bga>
https://github.com/bga/jbasis/blob/77683e222909279548a1fdc3e3ee03d4c83d96b4/src/$jb.Url.js
16:18
<_bga>
>>> 0, ~(~a || ~b || ~c)
16:19
<_bga>
+ 1 for lastIndexOf
16:19
<zewt>
__this $$code _$_is $somewhat _unpleasant ___to __$$$read
16:19
<_bga>
:)
16:19
<zewt>
return ~(~s.lastIndexOf('?', s.lastIndexOf('#') >>> 0) || ~s.length) <- yeah sorry this is bad :)
16:21
<_bga>
writing something like if(i < 0) i = s.length is annoing
16:22
<zewt>
write a helper for it
16:22
<Philip`>
return urlSubstringAfterQueryBeforeFragment(s);
16:22
<zewt>
that's what functions are for :)
16:22
<Philip`>
Easy to write *and* to read
16:23
<_bga>
zewt i made it when illed by "perfomance"
16:25
<_bga>
Philip` and you will have *alot* of fns, its not orthogonal
16:25
<_bga>
get intexes and slice is better
16:25
<zewt>
at least there are no yoda conditionals :P
16:26
Philip`
wonders why JS developers seem to focus so much on micro-optimisations like loop iteration conditions, rather than on profiling and optimising what actually matters
16:27
<_bga>
zewt i use _ prefix for fns to differ map which is hashtable from _map which is Array#_map
16:27
<_bga>
var a = a.map
16:27
<_bga>
what is that?
16:27
<_bga>
fn or data?
16:28
<zewt>
sorry, it's just hard on the eyes (and harder since there are both _functions and __functions)
16:28
<_bga>
__fn is private fn
16:29
<_bga>
zewt may be
16:29
<zewt>
bga: so use a clearer name ("mapping", "addressToUserMap", etc)
16:30
<_bga>
i do ir
16:30
<_bga>
*it
16:58
<gsnedders>
Philip`: Because profilers for JS engines almost uniformly suck.
18:02
Philip`
wonders why profilers for JS engine almost uniformly suck, given the relatively large amounts of effort put into JS engine performance
19:55
<zewt>
Philip`: most profilers in all categories suck
20:01
<smaug____>
Shark is good. (Apple has managed to do something I like)
22:25
<jgraham>
Probably profiling jitted code is moderately hard
22:26
<jgraham>
At least you need to keep extra information around
22:33
Philip`
often feels that JIT people talk too much about how their clever dynamic compilation systems can produce code that's as fast as C, and ignore that practical performance optimisation actually depends on a feedback cycle between programmer and compiler, and that C/C++ are good for performance because that feedback cycle is pretty easy to understand
22:34
<Philip`>
(since they have adequate profiling tools and the compiler isn't too clever)
22:35
<Philip`>
I suppose working on profiling tools is less fun than working on clever compilers, though
22:35
<Philip`>
and doesn't help with benchmark results
22:35
<jgraham>
Yeah, that's what I was going to say
22:36
<jgraham>
Although maybe in the future it will be more important to have non-sucky profilers if games are going to take off in browsers
22:36
<Philip`>
That's even harder since you have to worry about GPU performance too :-(
22:37
<jgraham>
Being able to use the profiler to tune an application (or game) to work better in on javascript engine than another seems like a likely vector for things that only work acceptably well in one browser in the future
22:38
<Philip`>
That sounds like an excellent incentive for each browser vendor to produce the best profiling tools, so games are optimised for their browser rather than for their competitors
22:39
<jgraham>
Right, I think it probably will be
22:39
<zewt>
Philip`: well, there are endless cases in low-level languages of people who think they intuitively understand performance without profiling (and don't) ... high-level languages aren't unique there, it just raises the bar of understanding that much further
22:39
<jgraham>
It will also cause people to copy each other's optimisations of course
22:40
<zewt>
in particular since a single function may have differently-optimized versions under the hood for different arguments
22:40
<zewt>
(at least in C++, it's explicit when that's likely to happen--templates)
22:43
<jgraham>
I wonder if anyone published a reasonably up-to-date piece about how to get decent perf. from javascript. Just basic things like "don't change he types of variables"
22:43
<Philip`>
zewt: There will always be people who do it wrong, but at least with C/C++ you can run a compiler and profiler and look at assembly code and get a fair idea of what's going on if you want to, whereas higher-level languages seem to make that pretty much entirely impossible for anybody except the language implementers themselves
22:44
<Philip`>
(e.g. with SpiderMonkey it seems the only way to see what code compiles into is to run in the command-line shell with various environment variables to trigger dumps of the assembly code of the entire script, which isn't very practical for non-trivial applications)
22:49
<Laster>
naive question from a nube. why doesn't editor.html implement fontsize, fontcolor and a lot of other functionality?
22:55
<zewt>
Philip`: browsers should definitely expose more internals to their debuggers (bytecode, jit output, etc); browsers seem to treat developers like babies
23:02
<Philip`>
zewt: Are any other similar languages any better than JS at this?
23:04
<zewt>
you can read back the bytecode of a function in Python (but it doesn't JIT so there's no analogue there, and I'm not sure how documented its bytecode is)
23:05
<zewt>
there's also the dis module, but i havn't looked at it much
23:07
<zewt>
(i wouldn't suggest that anything about this sort of thing should be anything but browser extensions; not limiting optimizations is far more important)