« first day (1359 days earlier)      last day (3598 days later) » 

12:07 AM
Hi everyone, could I get any help here choosing a framework? Im in an urgency
 
@user3062745 don't rely on it
 
I'm stuck working in canvas using multitouch on drawn canvas shapes. I have a memory problem in the code, so I was thinking about choosing any framework. The project I'm working on is a piano
 
My app has a memory leak bug => complete rewrite in unfamiliar technology. WAT?
 
I am not sure how a framework, with which you have had no previous experience, will help you
 
12:13 AM
It could definitely help, because I think I'm having a gap on my code structure and a framework helps solving those kind of problems
 
err...
 
lolwut
 
well being more specifically, does anyone have any experience by adding custom events on canvas objects?
 
define "canvas object"
also, define "custom event"
 
each key in the piano is an object, then I draw them in the canvas with a for loop
 
12:17 AM
I'm not sure there's a library for that
 
the custom event I'm referring is to add the behaviour of each key of the piano inside it's prototype
I'm sorry if my english is not very precise
 
Returns 1 or 0 instead of true or false
 
sweet
not sure if I am surprised, though
 
@user3062745 you will have to handle all that on your own
 
@user3062745 still, you are reacting to touches, aren't you?
 
12:20 AM
@Meredith it looks like something that has been last time looked at in php 4.3
 
@tereško that's true of most of PHP
 
not sure about "most of .." but there are several artifacts that have a feel of "someones pet project"
 
@user3062745 I don't have experience with tons of canvas libraries or frameworks but caat.js is really awesome imo
 
@JanDvorak yes, the touch events are the main problem, that's why I need to add the functionality inside the object prototype and then just use the canvas listener to detec touches and let the objects to all the other (play, stop audio and add and remove color)
 
but fortunately those are being slowly moved to PECL
 
12:23 AM
@user3062745 you will have to detect the touch coords for your objects
with canvas you have to do it yourself
 
@user3062745 why do you have a prototypeqe for each button?
 
@JanDvorak pretty sure he is just using rects or something doubt he has anything in depth from the sounds of it
 
@user3062745 I'm getting a feeling that your "objects" are pointless
 
@Loktar I am detecting the coords for touchstart and touchend but I can't keep track of the audio doing it without the technique I'm looking for
@tereško almost pointless
 
err... are you looking for a framework to help you track the playback???
 
12:25 AM
@JanDvorak If I can track the shapes with an easier way I can track the audio
 
those are unrelated problems
I'm wondering if an image map over the canvas could help.
 
it's a piano
 
what do you want to keep track of about the audio?
 
the touchend for each key on the piano (multitouch)
should do reference to the object where the source of the media is
 
array of objects indexed by the key released.
Still no need for a framework
each object holding whatever information you need to stop the tone
 
12:31 AM
the thing is that if I play one media then another if I release any key it will stop only the last one
 
if it's just a piano, you can find out which key was pressed from just the touch co-ordinates
 
sounds like you're overwriting your data
or that you're reusing media objects you shouldn't
 
indeed I am, I have a memory issue
 
no one can help you without seeing your code
 
I have posted but nones reply
let me look for it
 
12:33 AM
normally "memory issue" means you're using too much of it but the code works otherwise
 
the memory problem is that the touchend are multiplying as they are in the same touchstart event, I had to do it like that to keep track of the media played. I am removing the touchend listener but I still have the same problem
that's why I was looking for a framework that could make it easier
 
omg i fixed it
im so happy
 
@user3062745 if you don't like them coming at once, separate them before handling
 
wanted to try to make a piano as fast as possible
lol its a bit glitchy
and I didn't order the notes they are random
/me orders notes
 
that guy doesn't sound indian at all ;x
 
12:42 AM
@Loktar doesn't work with touches
 
yeah idc about touches those are lame :P
 
err...
 
the coords are messed up for detection
there we go
 
I can keep track of the coords as its a "global function", but then I can't keep track of the audio
as it's not related to the object
 
@Meredith happy, happy, happy. lol
 
12:46 AM
@user3062745 if your object model prevents you from storing certain data, it's that object model's fault
 
@JanDvorak hmm.. ok.
 
Even having a formal class system is unnecessary in most cases
 
done
playing dat magic keyboard of ugly
/me goes to play transformers
 
still no touch support :-(
 
12:57 AM
@Loktar doesn't work for me
 
hmm I'm not really experienced with touch I just duplicated mousedown/up/move to touchstart/end/move
ah crap yeah I need e.changedTouches; apparently
can the audio api modify preexisting sounds I wonder..
that would be cool if I could change the pitch of mp3's, ogg's ect.
 
It doesn't even react to touch starts. Chrome still tries to scroll the screen.
 
could make a dog bark keyboard
 
Try preventing default from the touchstart event
 
@JanDvorak ah weird, if I had my phone id mess with it more but its all the way downstars :P
ok
done
lied, now its done
 
1:00 AM
if you know anyone who smokes, e-cigs seem to work as long as you get a quality one
#just-saying
 
ok... if I touch-click, the press is registered, but the release isn't. If I touch-hold, nothing happens.
 
yeah touch hold I need the list of touches and need to check those
didn't realize it was that in depth
prob could get away with just checking the first
 
not if I attempt two at a time
 
@JanDvorak try touch move now
only did it for the first, didnt loop
 
@Loktar doesn't seem to react to touches at all
 
1:03 AM
touch end was jacked up
I copied the code from mousedown
thats why it didnt seem to stop
 
HAMMERTIME!
 
@CapricaSix I guess that's the solution
hammer.js
 
As a side note - the canvas takes up more space than what its size appears to be
 
wtf
some of my changes aren't taking
its weird
my changed touches isn't even in the code now..
2nd time thats happened to me tonight on jsfiddle
 
@Loktar the touch events are there and the click events too
 
1:05 AM
weird
@user3062745 old versions thereof
 
oh oj
ok
 
ok try now?
touchstart/end and move should be good
I loop through the changedevents now
 
Still no reaction
 
damn
made it use teh whole canvas now... lol the pitch is crazy high
 
@Loktar does it aggravate your dog
 
1:08 AM
haha dog hasn't came up yet I'm surprised
bleh Im going to go get my phone now damnit
5 min project turns into 20 :P
 
you need to go higher, then
@Loktar what's the point of having a gain of 1 in the pipe?
 
gain is what gives it its volume
 
Please do exponential attentuation instead of constant gain
@Loktar isn't a gain of 1 just an identity?
 
Im doing
> gain.gain.value = 1;
which is redundant naming i know
is that the part you're talking about?
 
yep
or rather, I'm talking about the gain node itself
Why not connect the oscillator directly to output?
 
1:15 AM
haha idk I am not experienced with doing generated audio at all
 
could you guys tell me how are you doing to test it so fast?
 
@user3062745 I open it and touch a key.
 
man wth I cant get touches to work at all..
 
Just checked the console.
> Uncaught TypeError: Cannot read property 'gain' of null
in touchmove, mousemove and touchend
 
I have the same issue
*problem
 
1:20 AM
hey it works
well in chrome anyway
and touch
 
single-touch, anyways
it goes crazy once you try multitouch
 
haha yea
 
same problem as user306's
 
its better now
 
guys I'm really glad you are trying to help. I am leaving you for a short if you are not here later
 
1:23 AM
np @user3062745
it only seems to drag 2 keys for some reason hmm
 
@Loktar confirmed. It only goes crazy until the next touch now
@Loktar hardware limitation?
 
might be
idk that seems weird though
 
my laptop screen can only handle two touches at a time
still it's twice as much as most apps can handle
 
god I'm hungry
 
@Mosho try fish and bread
 
1:25 AM
I would try anything but I'm on a diet
 
hey hey
it works now
had to do preventDefault on the touchmove
the sound acts a bit weird, but the keys all work
I think thats a hardware/browser limitation on the device though
because the sound even goes a bit crazy on the pc
god dang phone vs is glitchy as heck
alright going to go play games for real that was a fun diversion
thanks for forcing me to do touch @JanDvorak :P
 
np
now do attenuation :-D
 
haha maybe tomorrow
 
err... multitouch still kills it
 
:(
maybe I need prevent default on that too again
but that seemed to mess it up when it was on touchstart
 
1:33 AM
the default action of touchmove is to mousemove
but your primary issue is the same as that of @user3062745. You seem to be overriding your data.
 
2:23 AM
Is there a way to get a child element of a specific parent element by ID rather than className?
 
if you know the ID, why do you care about its family relations?
 
because im using a template. and some times the template is loaded in twice so the id exists twice
but they are inside two different parent divs
 
@Dave not good
 
well i cant use a class name theres hundreads of them what other option i got =/
 
There won't be two elements with the same ID
Not even if you try
 
2:25 AM
What do you have hundreds of, and how does it prevent you from using a class name?
 
explain ?
i have hundreds (exagerating) of divs with the same className
imagine the same template imported side by side but different text output
 
... so?
 
the only differences between them is the parent element i imported the template in
so i have two divs with the same id
 
No you don't
you have an error
 
well i cant make two of the same template just with different ids =/
thats wasteful
 
2:27 AM
You can look up by class name and ancestry
 
Well you can't make two elements with the same ID
it's against the rules
 
Please note there's no plural form of document.getElementById
 
i know but if there was a way to do :

parentDiv.getElementById ('');
then technically no rule broken really
but i guess it can't be done
 
That's redundant though
 
parentDiv.getElementById ('*');
 
2:29 AM
Because there will only be one element with a given ID
 
oh wait
what am I saying
 
the first step is to fix your template
 
@Mosho I'm not sure it's a valid ID, but I'm pretty sure noone names their elements that
 
I'm dumb, carry on
 
xD
 
2:30 AM
@KendallFrey the only other option is to copy paste the template and have the div id changed in the second one but thats a waste
 
@Dave use a class instead of an id
 
Am I using the && operator right?
else if (sec2 < 10 && option2 === 3) {sec2 = "0" + sec2;}
 
yeh i shall have to @JanDvorak thanks :)
 
@Leaf depends on what the desired behavior is
 
@Leaf you know your doing string+sec2 which might be string+int ?
unless thats delibrate
 
2:32 AM
@Leaf you seem to be type-confused, though. You assume sec2 is a number in the condition, then force it to be a string in the body
 
I'm not sure of any other way to get something like 3(seconds) to appear as 03(seconds)
 
seems plausible but you might want to convert to string anyways.
An alternative is to stringify first, then check the length
 
i would change sec2 = "0"+sec2 and use a different variable
 
also, that^
 
I see what you mean, but sec2 should always be an integer before/when it gets to the conditions, as every time the function is called, sec2 is reset to an integer
 
2:35 AM
because if u need to use sec2 in a comparison again it won't work for sec2 < int after that
do you return sec2 from the function? if so why not:

return "0"+sec2;
 
Actually, I think you're right, my problem might be that I'm trying to combine strings and integers together later as if they're both strings

else if (option1 == "hms")
{returningTime = hr2 + min2 + sec2;}

Since hr2 is always an integer, whereas min2 and sec2 may or may not be strings
 
aye. int + int = int
""+ forces concatenation by coercing the first argument to string
 
So what would say 13 + "07" equal?
 
that would be "1307"
but 1+2+"4" is "34"
 
I see... Maybe that's not the problem after all, since "1307" is what I desire/what the program expects
Though it's still an issue that I should fix
 
2:43 AM
Your expectations break if both hr2 and min2 are numbers
And that's why I like strong typing :-)
 
Exactly xD That'd definitely be a problem in that case
 
You can't mess that up in Haskell ;-)
> No instance for (Num [Char]) arising from the literal `1'
or
> Couldn't match expected type `[Char]' with actual type `Integer'
 
I want to learn a new language
something that gets shit done
 
@Mosho Ruby?
 
2:49 AM
There's an obvious mistake here I know it
But I can't find it
 
@JanDvorak do people use that for something other than rails?
 
@Meredith those active states are no different from the opposite passive states
 
Rephrase
 
I thought about lisp
 
the style for .alert.ng-hide-add.ng-hide-add-active is exactly the same as that for .alert.ng-hide-remove
!!mdn transition
 
@Meredith all is not a valid transition property
 
Weird
They use it in the angular documentation
It is valid
I was under the impression that when something is shown, it transitions from .ng-hide-add to .ng-hide-add-active
Is that wrong?
 
o/
 
Hi
 
3:06 AM
I have the hiccoughs.
 
so I'm using everything search
and I can't help but wonder, could this have been so difficult the entire windows team couldn't do it?
for decades?
 
it needs low-level access, though
I have no idea how it works
 
today is not a good day
 
how come?
 
I've just been struggling with things that should be easy
 
3:34 AM
god, I had to download like 20GB to start using winJS
 
could someone please look into jsfiddle.net/B2PzA and help me solve the problem , in the last output both the objects get changed ..
 
@shortCircuit you are probably creating a shallow copy of an object
 
Yes ,,, but I was trying to do a deep copy but all of a sudden when I add a 3 layer nested property it breaks ... Like {thud:{bash:{barz:"thud"}}}
 
It doesn't look like you're doing it recursively
Either that or I don't see the recursive step
 
3:49 AM
arguments.callee(dest,p,p[k]); I guess
which you aren't supposed to do btw, just call the function
 
Ok
But that one comes into play when both source and destination has same property names, so that the existing values do not change and new properties are added ... In the example that will be the 'baz' property
I guess this approach with getOwn** is getting twisted ..
 
@shortCircuit yeah, in the end you get a shallow copy
use for var prop in obj, or just one of the many existing tools for doing that
jQuery, lodash etc.
 
Ok
Byez
 
4:09 AM
how to deep copy jsfiddle.net/9GeSv @shortCircuit
Sorry it took so long I was returning old instead of copy and couldn't figure out what I was doing wrong
 
anyone created joomla template?
 
4:41 AM
shit! orkut is shutting down...
I always used orkut as a lonely old forest for privacy
 
 
2 hours later…
6:33 AM
Can I ask a node.js question here?
 
6:45 AM
yes
 
This is my module:
var fs = require('fs');
var path = require('path');

var fileFilter = function(directory, extension) {
    var test = 1;
    fs.readdir(directory, function (err, list) {
        test = 2;
    });
    return test;
};

exports.fileFilter = fileFilter;
But test is always returning 1 instead of 2, what is it that I am not getting? I am just learning node btw.
I think is has to do with readdir being run asynchronously? So is there where I would use a callback?
 
7:01 AM
@joshhunt there is already a callback
fs.readdir(directory, function (err, list) {
        test = 2;
    });
second argument is the callback
but it doesn't have a chance to call back because you return from the function it was called from
if you want to do something like that, take a callback as an argument with your fileFilter, or return a promise
 
right... was I right that it is because it is async?
 
yeah, it sends the request for the read, but the JS keeps executing
so it just returns
 
Slowly making sense... So I could do something like this?
var fileFilter = function(directory, extension, callback) {
 
yeah
 
I'll give it a go, thanks for your help!
 
 
1 hour later…
8:11 AM
@rlemon : is that your sister ?
 
8:45 AM
!!mute
 
@BenjaminGruenbaum 3717756(6d 5h)
 
!!unmute 3717756
 
room mode changed to Public: anyone may enter and talk
@BenjaminGruenbaum Unmuted user 3717756
 
No need for gallery for that guy alone
@KarelG haha
I unstarred it though, since poop picture have a tendency to annoy some people :S
 
gooood mooooooooorning alabama!
probably many were offline when I've tried to figure out something with css animations..
12 hours ago, by towc
is there a reason why something should work on codepen but not from a locally stored file?
it starts from there, in case someone would like to help
then just scroll down and you'll see the problems
basically css animations work on codepen and mdn, but copy pasting the code into a local file won't make them work
 
9:03 AM
Look at the styles in the inspector
It seems like Codepen is adding the apt prefixes
 
when I go in the dev tools everything that starts with animation is considered: Invalid property value
@SomeGuy does it? let me check...
 
apparently.. yeah...
 
So yeah, apparently CodePen has prefix-free built-in
 
there actually is a library called prefixfree in the head... but I've never heard about it
 
9:07 AM
Yeah, prefixfree.js is a fairly common library
 
@SomeGuy I was checking it out... it looks very cool...
what??? only IE and FF don't need -webkit-?
and chrome is planning to keep webkit for the 3 upcoming versions??
ok...
 
Hello World!
 
Hello stupid troll
 
hi @towc
sorry people wrong room
 
9:29 AM
I just got a mail from codecademy stating
> Great job finishing Building a Cash Register!

Congratulations! You've mastered an entire language — no small feat!

Why not celebrate by seeing how awesome your profile now looks?

SEE YOUR ACHIEVEMENTS!
ok, "You've mastered an entire language", this thing bugs me
can I now answer any JS question?
Please someone tell me what does mastered here mean?
 
It means you've probably finished all the material that Codecademy has
Nothing about your actual skill level
 
@SomeGuy where next now?
 
Try making something
Make a website or a game or something
 
well, actually. I am fealing a bit cheated
 
Cheated?
 
9:31 AM
I went to codecademy to learn js to help me in web dev
they didn't teach me anything about that document thing
 
Efficiency question
 
like document.getElementById thing
that is the part which troubles me like hell
 
Will for (var i = arr.length-1; i--;) be more efficient than for (var i = arr.length-1; i >= 0; i--)?
Relying on the fact that i-- would be 0 at some point and then be falsy
 
Well, the DOM is not part of JavaScript as a language
You won't find it in NodeJS or Rhino or something like that
It's part of the browser
So you learn that separately
It is pretty important, though
 
does codecademy have a dom tut?
 
9:34 AM
No idea, I don't use Codecademy
@SecondRikudo Try a JSPerf test?
 
9:55 AM
@Zirak Check out Mike Birbiglia. He's pretty funny
 

« first day (1359 days earlier)      last day (3598 days later) »