« first day (721 days earlier)      last day (4452 days later) » 

00:22
anybody know what is the js/json equivalent of "SELECT * FROM object
WHERE id=3"
Hello, can anyone help me with a problem? How can I create a custom rounding function?
I have some of the code started...
function round(num, point) {
var whole = Math.floor(num);
var dec = num - whole;

if (dec < 0.5) {

} else {

}
}
It would round a number to a point, like say round(8.889, 2) would round the number to 8.89.
00:38
Anyone have a idea on how to do that?
01:08
@Tgwizman its a seeded random
so everything is random, but based on a seed, so "bob" will be the same set of random numbers each time
01:22
@W3Geek num.toFixed(2)
02:08
@Loktar I can't use toFixed because it goes against the assignment rules.
:?
that seems counter productive lol
Its homework lol :P
Rounders

Round a number to a specified number of digits. You may not use toFixed() method. The number of digits could be 2, it could be 8, etc. Your function should work with any possible number. There are many ways to solve this.
I solved it... but not the logical way. =(
var decimalPlace:uint = Math.pow(10, prec); // get the decimal place needed to perform the calculation
var result:Number = Math.round(decimalPlace * num) / decimalPlace;

return result;
is that AS3?
Yeah but I can easily port code back and forth between them.
meh, id just use that solution tbh.
I think its dumb to learn how to do that when its better if you know about the built in funcs like .toFixed and how/when to properly apply them.
02:14
Yeah I'm going to. xD I would love to know how to do it the logical way without Math.pow()... I'm just going to ask my instructor tomorrow how to do it that way.
Its a Programming Fundamentals class so there trying to get us to come up with our own stuff (think like a programmer) instead of using most built-in code.
yeah, lol idk I would just give problems that don't have built in functions avail
like Math.sum
make a function that will add a list of numbers
yeah that one is pretty easy to do. :P
I don't know why we have to make functions thats already made... guess if we ever use Assembly or something? lol
// Should equal 15
sum(1, 2, 3, 4, 5);

// Should equal 0
sum(5, null, -5);

// Should equal 10
sum('1.0', false, 1, true, 1, 'A', 1, 'B', 1, 'C', 1, 'D', 1, 'E', 1, 'F', 1, 'G', 1);

// Should equal 0.3, not 0.30000000000000004
sum(0.1, 0.2);
^ makes it harder
or a programming language that doesn't have built-in functions like rounding ect.
but yeah @W3Geek I mean the chances of working with something that doesn't have built in functions like that are crazy low
I just hate it when people get frustrated by uninteresting problems
might push some people away from programming which sucks
02:21
@Loktar how did you generate the ship images?
basically just turning pixels on and off in relation to a pattern
lol I won't be pushed away from programming... I've been doing it since 2004! =D
What ship images? @>@
making it prettier currently
and adding sharing options
So you made this @.@
Wow...
No images?
alternatively you can go to it via retroships.com/generate.png?size=3&seed=testing
@W3Geek yup :)
I love doing this kind of stuff
lol all I do is JS/canvas stuff it seems
02:27
How the heck do you generate a image with JS?
Oh with canvas?
thats actually with node, the ships that is
but yeah canvas otherwise
then screenshot it through programming?... and placed in a image tag?
Its just brillant. How long did it take?
^ super simple canvas example
@Loktar i'm becomming more and more interesting in trying to take this use js and canvas to turn an image into css for making background animations. i wonder what the performance of canvas vs keyframe animations is :/
I started working on that last week
02:29
i just was fiddling
@rlemon I saw that actually
yeah I know what a canvas is.
was looking through recent pens
but yeah man idk, seems to take a hit in perf the way they use to gen images
although.. that construction gif is fast
but it's a one off. u gen it once and it's like a precompile
ah yeah true
@W3Geek ah sorry didn't mean to assume you didnt
but yeah I just do canvas.drawImage(image,x,y) to draw the ships, basically
02:31
and see the mona lisa one. that is a hell of a lot of css and it renders pretty fast.
haha wow yeah
I didnt actually look at the code
wtf, thats nuts man
lol its okay @Loktar, I am a web developer. I just would like to know how to do this stuff... I mean, man o man!...
How did you learn how to do it?
I used to program on the c64 making games, then moved on to visual basic and blitzbasic/3d, then once I hit javascript i was like hmm how can I make images
discovered the canvas tag and away I went
but yeah most of my hobby programming has been graphical/game related
so its just random stuff I picked up over the years
is there a way to make a prototype for like, strings in general?
ex: "breui43biuf9".toUpper();
So you have been programming for a long time then? I've just been programming since 2004. :\ Started with Game Maker and moved onto JavaScript.
02:33
^
I really wish I could've programmed on the c64.
yeah it was awesome
well.. it was actually the c128
but it could go into 64 mode
c?
is that commador?
but... the c64 was out before I was born... I was born in 1991.
yes,
ah ok
yeah it was out before I was born too actually, I got mine when i was 8 or so
was born in 82
02:36
Half the time, I see some of this programming stuff today that people make and I'm like holy **** why can't I do things that awesome! #.#
lol
I almost always feel that way >.>
lol @Tgwizman I feel that way 90% of the time.
just do hobby stuff
@W3Geek just a suggestion. jsfiddle.net/rlemon/4ncnx look to where the image changes for my comment.
start small
02:38
renderer.src = screen;
renderer.onload = function() { // place the change of the text to correspond with the change of the image.
    caption.childNodes[0].nodeValue = caps;
    renderer.alt = caps;
};
@Loktar You really should show me the way you did that ship pattern pseudo-random image thing
Ill have to write something up sometime on it
I know the fundamentals, some programming patterns, OOP and how to make my own stuff... but my biggest downfall is... applying advanced mathematics to programming. >,< I cannot seem to do it...
I suck at math
seriously Im effing terrible
lol thats what I hate most about programming
wish I would of paid more attention in Algebra
@rlemon that is the code I'm committing to GitHub in the upcoming update of Shutter. xD
02:41
I love programming because it gets me a lot of chicks.
I cannot apply trig to programming.
but you can in the bedroom.... think about it.
I don't see how people see the angles there coding in? If you catch my drift...
Any chance you want to give me a general idea on how you made them end up looking like a badass space fighter/ship/thing?
@Loktar I do some basic hobby stuff but when I try to do something advanced (like a game) I get lost.
02:44
then actually do something after you have started small :P
(unlike me)
Wow that is awesome @rlemon... With Shutter I started small, converted it to OOP... I don't know where I'm going with it in the next update though.
cool, thank!
omg o.o
@Loktar where are you on these?
I see no animation..... Make them all wave at me! NOW!
just need to work on the animations
those arent procedural, his I mean
he just genereated the hair procedurally
lol yeah thats the next project :P
Im so getting a poster of the little dudes in the 2nd image
Someone is going to have to show me how to generate images... please. @.@ Add me on Skype... W3Geek
@rlemon you have to see something else too
/me gets screenshot
I don't like Skype... holding the pose in my picture was fun and all... but to have to stand there live as to not loose the effect... that is tough.
02:50
I gotta leave this room before I tear my hair out... my coding skills are very pitiful >.<
I don't even understand it either lol I code like 75% of the day...
I may add that to retroships as a feature idk
my face made of ships
lol
lol
that would be a good feature indeed.
yeah, could take any image and "shipilize" it
@rlemon that looks really nice!
Yeah it does look really nice. How do you do these things? Tutorials, research, plans?...
* previous experience
previous experience I guess, and just thinking of random stupid stuff and trying it lol
like "Hmm im gonna make my face out of ships, hell yes!"
@rlemon just has God speak directly to him.
"Thou shalt make a kickass CSS only to do list"
I look at shitty jQuery plugins and think.... well wtf is it doing there.... BAM a new project!
03:03
I would like to have my face made out of ships lol but I won't know where to even start.
step one - start shaving with a big ass knife.
haha
@Loktar I always wondered who that voice was...
step 2, cut a hole in the box.
Now I can finally stop taking these darn pills.
they give me cottonmouth
5 messages moved to recycle bin
:) its like it never happened!
03:11
So... this is a dynamic image?
one sec...
that is base64 image data
what is base64 image data?
1 min ago, by W3Geek
http://pastebin.com/urgCY4cU
> data:image/png;base64,
I know... but why is it useful xD
03:15
To embed image data into the page without any files?
that is one good reason
Does the browser take as long to load them... or is it the same as loading the file?
no longer than it did for you when you pasted in your url
a little longer yes
but not anything noticeable.
Whats another reason besides additional files?
well I plan on using it to beat my cross domain issue
03:18
hmm that does sound good.
can't manipulate image data of an image if it is from another domain. so you get the base64 of the image with a server component and send that back to the client (or extension as the case be)
Hopefully one day I will get better understanding of this stuff. I should buy a c64...
Maybe it could help force me to program better.
for (var i = 0, num = 200 / 10; i <= num; i+=.01) {

var x = i * 10;
var y = Math.sin(i) * Math.sin(i) * 50 + 50;

// use a color triad of Microsofts million dollar color
p.buffer[p.index(Math.floor(x), Math.floor(y - 10))] = p.color(0x00, 0x44, 0xcc);
p.buffer[p.index(Math.floor(x), Math.floor(y))] = p.color(0xcc, 0x00, 0x44);
p.buffer[p.index(Math.floor(x), Math.floor(y + 10))] = p.color(0x00, 0xcc, 0x44);
}
That is where the Math gets me...
What is Math.sin(i) * Math.sin(i)?
Dang... low self-esteem!
 
1 hour later…
04:39
May someone please see this fiddle: jsfiddle.net/rqerz/3 I think there is a bug with jQuery countdown. When the onExpiry happens, it needs tab to switched before it gives the alert. Please test there, and tell me what you got.
04:54
Thats not a bug, its by design
@Loktar ok, but how I could avoid it
avoid which part?
the alert not appearing until you switch tabs?
yes
theres nothing you can do :?
i would like that the alert would immediately appear
04:57
the page needs to be active for it to appear
why?
most likely for security, or annoyances from other webpages
also sites kind of go into "sleep mode" when inactive
for example timers update at a much slower rate
that causes alert to appear
even if you are in different tab
so it's a bug in jquery countdown I think
just open it and change to different tab
yeah.. maybe im just retarded wtf
the alert will appear
so how I could avoid that bug in the jquery countdown
04:59
lol yeah you're right
/me relooks at other fiddle
ah ok
its due to that sleep mode I was talking about
they are using requestAnimationFrame
which doesn't update if a tab is inactive
so its not a bug, its just because they arent using setInterval, or setTimeout by default
they fall back to setInterval if requestAnimationFrame isnt available
keith-wood.name/countdown.html "Added $.noRequestAnimationFrame to force use of setInterval"
I think that's what I need?
I just wonder, how can I apply it on my code?
^ thats just to illustrate the problem
let me see if I can find out how to use noRequestAnimationFrame
Hello guys. Does anyone code in Visual Studio here?
@Loktar got it working! It was just quite hard to put it on jsfiddle! :D jsfiddle.net/rqerz/9
05:13
nice
@Olli yeah wtf I couldnt figure it out
lol I should of done no-wrap :?
hi guys
ok :D
sorry for my earlier statement too
I swore alerts didnt pop up when they were inactive
I was totally wrong lol
ok
now you know it
yup :)
hey @Maddy
05:14
i'm creating a page which does ajax requests after a time period and that requests should happen also if I am not in the page currently
I have a colorbox.. i want to open a popup from the colorbox.. and refresh the colorbox page from the opened popup window.. is it possible ?
I have a colorbox.. i want to open a popup from the colorbox.. and refresh the colorbox page from the opened popup window.. is it possible ?
hi loktar
hi tuyentk
@Loktar I checked, and the alert will focus browser window even if you are on a totally different window! :D
nice
actually, it may be annoying for some users
05:21
yeah I hate alerts
I remember years ago using them to debug apps...
thank god for firebug, and now chrome dev tools
yes
I used alerts too
but now i figured out console.log
what an excellent function! :D
but its bad if you forget it there after the debugging
then it uses user's resources
yeah
hey loktar i got an innerhtml question can u help me out
maybe, I can try
Hello guys, does anyone use Visual Studio?
05:26
am callin two inner html variables from differnt functions to one another is that possible -
am call two inner html variables from differnt functions to one another is that possible
am callin two inner html variables from differnt functions to one another is that possible -
what do you mean?
like foo.innerHTML = baz.innerHTML?
@loktar like am getting a variable through an innerhtml dynamically and display at one part of my code so as another in two different functions can we get the sum or product of both of em
yeah like function function1()
{
some code
}function function2()
{
some code
}
if you make a jsfiddle.net of the code I can help you out
yeah sure just a sec and thanks for the time
use the return keyword in function otherwise implicit null
@Maddy are you drunk?
05:35
lol
yeah how do u know that....
I mean.. what you have there will work
x and y are global variables because you dont declare then with var
the thing is i donno how to do it so i gave u the rough code so you can correct it
func1, and fun2 would need to be called first though
ok one sec..
I guess Im confused as to what you're trying to do here
Hello
I am looking for a pluggin like in the image I will provide
with next prev button
and light box open on clicking the image
Any budy knows something like this
@loktar: hey yor the man.... that was simple...thanks bro
yeah np
hey dextOr
hi @Maddy
do you have any thing like that
?
05:44
just photoshop two images to one...
use a normal slider
0_0 poker face
escapemodule.com use thse cant u google it @dextOr
palm in face
thx @Maddy
slidorion.com dextOr u can even use this
@dskanth hi
06:15
Is it bad way to have subfunctions like this $(document).ready(function(){function fef(){alert("few");} fef();});
06:52
@olli hi
hi
I need to ask the doubt in canvas html5
ctx.drawImage(img,x,y)
here x and y are the cordinates.How to change the x any y coordinates in order to fit for all the devices like ipad,android,browser
07:24
@dievardump git add -u
@dievardump they don't, there can only be one onclick handler on an element, there can be several addEventListener
07:44
0
Q: Language Design: Is language like phyton and coffescript really more comprehendable?

kittensatplaythe "Verbally Readable !== Quicker Comprehension" arguement on http://ryanflorence.com/2011/case-against-coffeescript/ is really potent and interesting. i and im should other would be very interested in evidence arguing against this. there's clear evidence for this and i believe it. ppl naturally...

08:17
hello
I have a jQuery question. Since the jQuery room is empty
It's about injected elements
When I inject a checkbox, it can not respond to the predefined event handlers in my script file.
$(element_html).appendTo(parent).trigger('create');
does not work either
Does anybody know any work arounds?
Hello?
@chx101 you need to attach the event to the new element after it is created but before it is added to the page - the predefined event handlers will only attach to the elements that are on the page when they run
 
1 hour later…
09:52
position eliment relative to div not to page
how to do it ?
top and left in div
10:26
0
Q: Which of the two JavaScript snippets has a better structure?

MrBhootI sat down to write a demo HTML5-ish page that lets a user to perform following operations on a canvas - draw lines, draw a filled rectangle, and reset the canvas. Each operation is represented by a button, clicking on which the operation is carried out. My initial attempt ended up as a mingled ...

11:17
RT @caniuse: Thanks to the nice folks at Twitter, the @whencaniuse account is now simply @caniuse. Also the site title has been changed ...
 
3 hours later…
14:02
0
Q: General solution to solve different sports results in different languages

sq2I currently have some code that checks if squash and tennis scores are valid, both in javascript and PHP. This results in 4 blocks of code existing, 2 languages * 2 sports, which does not scale well should any extra sports come around, or extra languages... How can one describe the valid scores...

Hello. I have a line <a href="#" onClick="javascript:vidSwap('http://www.vorbis.com/music/Epoq-Lepidoptera.ogg'); return false;">open</a>
which calls this:
function vidSwap(vidURL) {
var myVideo = document.getElementsByTagName('video')[0];
myVideo.src = vidURL;
myVideo.load();
myVideo.play();

}

and I don't get the logic of accomplishing this thru that:
I wanna browse thru the file system and then play the video in the browser using a custom html5 webplayer
I think I can do this by first of all loading the content source from the anchor tag onto an array and then passing that array index as a src to the video player. Is that possible?
@Olli
@Anuj Hi, may you please create fiddle @ jsfiddle.net
i will look it
14:21
@Anuj yes it seems to be working, which you would like to add there?
no ia m busy
change the video
?
yup, i want to change the video, download the source on your system, click on the open, it will load the other video from the url that I have specified in the code.
but it works now?
when i press open
it changes the video
yeah, but not the way i want it to
14:23
what way u wnat
i want it to work this way, i want a browse button thru which I can browse any video or audio and then play it
i think it may not be able to browser your local videos...
that would require flash
nope, the browser does not loads local files because of security issue, which can be get rid of using "getdataurl()"
@AnujKaithwas no it cant
yes, i have read that
it converts local files in to base64 data and the loads it
14:26
you cannot access a local file
unless you use the file:/// and that requires privilages
drag and drop is different you know ?
you provide the file and privilages
well, i think drag and drop and my case aren't far apart,
both ways you are loading a local file
14:50
howdy folks
What are the specific differences between using multiple ifs and if/else?

« first day (721 days earlier)      last day (4452 days later) »