« first day (133 days earlier)      last day (4821 days later) » 

1:05 PM
@Nyuszika7H Nope
 
@CodingKitten You there?
 
@IvoWetzel another problem with tests, you tell me why not just push and no probs man
 
@CodingKitten I would not just push anything...
 
@IvoWetzel fix is a validation god? the 2^128th digit of pi? up eh? lol the below...
 
0
Q: How To write a voting bot

sherifhi I need to try and program a bot to do lots of voting on something with NO need to enter captcha or anything I want also to to try and use proxy or change the ip to be able to do lots of votes where should I begin

8 downvotes in 5 mins? Nice!
Someone upvoted it!!
 
1:29 PM
@IvoWetzel Reminds me of Rubber Ducking
 
Kev
Am I missing something here: <a id="bob" onclick="alert('boo!')">do thing</>. When I try to $("#bob").unbind(); I still get an alert
 
@Kev You have several issues.
 
Kev
oh ok :)
 
1. click is an invalid attribute, you should use onclick instead.
2. It seems you're using jQuery, you shouldn't use inline event handlers.
 
Kev
sorry that was a typo
 
1:31 PM
3. You're using single quotes inside single quotes. That's invalid, too.
 
Kev
ah ok
i know typo
 
Try removing the inline event handler and bind it with jQuery.
 
Kev
right gotcha
 
I'm not entirely sure if unbind will work with inline events
 
Kev
what makes inline events "special"
 
1:33 PM
But yes, it would be best to bind with jQuery, no real reason to use inline events these days...
@Kev Eh, define special
 
Kev
yes I know....this is a legacy page, it's littered with them :/
 
@Kev It's a bad idea to mix HTML, CSS and JavaScript.
 
Kev
@YiJiang "special" as in why unbind() can't remove inline's
i wrote this stuff three years ago before I knew any better :/
 
@Kev I'm simply unsure if jQuery has that function, let me check the docs and source
 
Kev
i'll ask this as a question so one of you guys can get some rep
 
1:38 PM
@Kev Don't bother
 
tried using "click" as the first param?
 
Kev
yeah tried that too
 
Well, maybe @Nyuszika7H would appreciate the free reps ;)
 
I thought $('#el2').click(function() { $('#el1').removeAttr('onclick'); });, but that didn't work either.
 
then it only removes stuff added with jquery
 
Kev
1:40 PM
@Nyuszika7H yeah i tried that also, but i guess the event is bound and removing the atribute has no effect by then
 
@YiJiang Have you ever used clearTimeout()?
 
@Kev Oh, wait, if I do that inside a document.ready block, it works!
 
I have a setTimeout for a function and I can't grab the ID off of it
 
@MylesGray What's the code?
 
setInterval(userLookup, 60000);
 
1:42 PM
The id should be what's returned from the setTimeout call
 
Kev
@Nyuszika7H this is happening inside a function called by document.ready
 
to clearInterval aparrently I need the Id
but I have no idea how to get it
 
var id = setInterval(...)
 
do i need to trace the execution stack?
 
read the freaking garden!!!!!
 
1:43 PM
var id = setInterval(functionName, interval);
clearInterval(id);
 
@IvoWetzel I've seen that but i need to call it froma seperate function
that's why it isnt so easy
 
then save the id somewhere
also, show more code
 
As a global var?
 
1:43 PM
show the code...
 
//Add's users tags to subscription array
function addToTagArray() {
    var tempArray = document.getElementById('addToArray').value.split(','),
        i = 0,
        updatedArray = false;
    //Strips whitespace from tempArray
    for (i = 0; i < tempArray.length; i++) {
        if (tempArray[i].length > 0) {
            tempArray[i] = trim(tempArray[i]);
            tempArray[i] = tempArray[i].toLowerCase();
            if (tagArray.indexOf(tempArray[i]) === -1) {
                //Pushes from tempArray to tagArray
 
you could place it inside the anonymous wrapper
 
That is the setInteval code
 
or switch to setTimeout
and move that into tagLookup and let it decide whether to call setTimeout another time
 
Hmm.
(function foo() {
    alert('bar');
})();
This alerts bar, but later I can't call this function. Why?
 
1:46 PM
so put a setTimeout on the addToTagArray function
 
@Nyuszika7H Because it's a function expression, not a declaration
 
and then within the tagLookup add a setInterval?
 
in case of a expression, the name only gets exposed inside the function itself
 
@IvoWetzel A function expression? Really?
I thought this was a function expression:
var foo = function() {
    alert('bar');
};
 
() evaluates the expression
that's one too
 
Kev
ah ha
ok...don't laugh
this is an ASP.NET Forms application
 
@MylesGray All in the global scope? Could need some modularization
 
Kev
I used a thing called a ConfirmButtonExtender
 
@Kev You should post it much more important that particular bit at the top
 
@IvoWetzel Kitteh's misbehaving!
Or becoming sentient!
 
1:51 PM
@YiJiang Working like expected :O
@CodingKitten Good kitty, responded to a formerly picked word
 
@IvoWetzel I Wai you mis-typed cheezburgez! would say :(
 
Kev
@CodingKitten yes, but I'd forgotten about these bloody extenders
 
@Kev Ah right, first time in the old chat room for me
 
@Kev @CodingKitten is a bot, just so it doesn't become weird in here
 
Kev
@YiJiang seriously?
 
1:52 PM
!kitten help
 
but it has a silver badge!!! muhaha
 
@YiJiang Too late ... the kitten makes things weird
 
Kev
!kitten help
lol
is that one of the "easter eggs"
 
@Kev No, it's really a bot built by @IvoWetzel
 
!kitten ?Yi Jiang
 
1:54 PM
Huh? What's a "?Yi Jiang" supposed to be? If you can't type you should reconsider your profession, what about writing the next Harry Potter? Can't get any worse with that...
 
:kitten wisdom Kev
 
!kitten ? Yi Jiang
 
Hold on a second, googling that for you... "Yi Jiang did you mean horrible typo?" There you go!
 
sigh
!kitten ? Facebook
 
1:54 PM
@CodingKitten Hey, I ain't horrible typo!
 
Hold on a second, googling that for you... "Facebook did you mean horrible typo?" There you go!
@YiJiang understands now are competant
 
:kitten wisdom Yi Jiang
 
kitten also has useful features like... and.... not to forget!!!
 
!kitten ? Kitten
 
That's my name. Well actually my full name is Kitten Gustaf Theodor Johanson of Rijkvek the 4th, sounds impressive hm? You know what else sounds impressive? Leave me alone &!%$&!
 
1:55 PM
:kitten quote .net
 
> "I think Microsoft named .Net so it wouldn’t show up in a Unix directory listing." - Oktal
 
:kitten quote Jeff Atwood
 
Never heard anything quoteworthy about that.
 
and the all beloved wob
 
zing
 
1:56 PM
:kitten wob
 
Kev
excellent
 
It's Yi Jiangs fault!
 
:kitten wisdom Jeff Atwood
@CodingKitten Oy!
 
@YiJiang Yeah that one is pretty good.
 
-_-"
 
1:56 PM
And at times it even gives good replies
 
:kitten rchern
 
Kev
that's very cool :)
 
0
A: jquery addClass strange problem

Nyuszika7HYour code has several issues. 1. Since you've selected onDomReady on the sidebar, the functions you defined aren't global. Use no wrap (head) instead. 2. You don't need <style> and </style> in the CSS pane. 3. You're adding the class on the radio button, this has no effect. You sho...

 
@IvoWetzel what do you mean global scope, I thought some of them were locally defined?
 
2:03 PM
I mean the functions themselfs
like uh
var API = function() {...}
new API(key, site)
API.schedule.lookup('users', query, 60000, callback)
right now it's a big mess of functions and duplicated code
time to DRY it
promises would be great here
 
Dont repeat yourself?
 
yes
that's even a good use of the new jQuery defferred stuff
 
So instead of calling an individual URL for each api
have a function that generates the API uRL?
 
@Raynos There you go, you have a good use now
exactly
if you continue with the current code, it will end in a maintainence nightmare
and I can never figure out how to spell that
 
maintenance?
 
2:11 PM
Main-ten-ance, say it with me :P maintenance Or just get a good spellchecker ;)
 
I always mess up on the e instead of ai
 
So do I
I only got it right cause of the mac's global spell checker :P
 
I think English's got a list of words that doesn't spell like their pronunciation
 
:kitten say Meow!
Kitten is broken. I have 503 rep.
 
it takes some time to update the users
every 10 minutes irrc
 
2:16 PM
ah ok :)
 
Kev
ok...I ripped out all that nasty ASP.NET AJAX nonsense and now got this working the way I want....thanks for all the help again :)
 
GitHub is missing a preview for readmes
 
@IvoWetzel Yeah, I was kind of hoping they had used wmd, but no
As of now, wmd is actually the best editor for markdown, with the instant preview thingy and the editor bar
 
well I'll do what I always do... push and then push a dozen fixes to the readme!
6 messages moved to Sandbox
 
2:32 PM
@IvoWetzel Is schedule.lookup a built in JS function?
 
uh, no
 
@MylesGray Never heard of it, where had you seen it?
 
I gave him some examples on how I would write a JS wrapper for the SO API
 
So I'll need to write functions for those or was that just pseudo code?
 
@Raynos That API would be a good use for the jQuery deferred stuff
pseudo code
of course the design is up to you, just wanted to give some examples of how the API could look
 
2:36 PM
@IvoWetzel Kitten converts Markdown to HTML… look at the Sandbox.
 
It's just that kitten sees the HTML stuff returned from the server
it never sees the plain markdown
 
@IvoWetzel Okay cool I understand now
 
@IvoWetzel and can't you fix it? :/
 
uh, I won't write a HTML > Markdown converted...
 
@IvoWetzel Okay cool I understand now
 
2:38 PM
deja vu? Oo
 
@MylesGray Hi!
 
Oops :P
@CodingKitten Oh dear jesus you stalker!
 
@MylesGray its a chat API -> DB Repo -> Provider whatever you know where to look
@MylesGray Stalker you jesus dear oh!
 
@MylesGray Ingore my invite, I wanted to invite you to Sandbox.
 
@CodingKitten O hai der sxy!
 
2:39 PM
@MylesGray Thanks you have made this way, eh?
 
@IvoWetzel Seriously, where did it go wrong? Kitteh never replies unless it was mentioned
@CodingKitten or are you becoming sentient
 
@YiJiang Who's been talking table in HTML5
 
@CodingKitten talking table yo in HTML5!
 
@YiJiang the take it a backslash doesn do it? modules var isn't PHP specific
 
:kitten ban Nyuszika7H
:kitten likes
 
2:46 PM
Hold on a second, googling that for you... "likes did you mean horrible typo?" There you go!
 
@YiJiang Uh, guess what Nyuszika wrote in those removed messages
:kitten say Me is getting used by thee!
 
Me is getting used by thee!
 
Aha! Interesting...
 
!kitten wob
 
2:49 PM
!kitten ban Nyuszika7H
 
Congratulations Nyuszika7H you have been rewarded with the [BANNED]-Badge.
 
!kitten jquery
 
Kitten doesn't like yu Nyuszika7H!
 
11 messages moved to bin
 
@YiJiang why? :/
 
2:51 PM
abusing the system mannnnnn
 
I still don't get it… I experimented in the sandbox… and it didn't hurt anyone…
 
@YiJiang unbannzor him
 
@Nyuszika7H just don't use say anymore, gnah I'll just remove it
:kitten unban Nyuszika7H
 
How much did you pay them for that Nyuszika7H? Whatever consider your self lucky... this time...
 
@IvoWetzel okay
 
2:57 PM
gnah, I'll keep it just make it 10k rep
 
> var obj = {'foo': 'bar'}
> Object.defineProperties(obj, {'baz': 'quux'})
TypeError: Property description must be an object: quux
 
1
Q: is node.js' console.log asynchronous?

dhruvbirdAre console.log/debug/warn/error in node.js asynchrounous? I mean will javascript code execution halt till the stuff is printed on screen or will it print at a later stage? Also, I am interested in knowing if it is possible for a console.log to NOT display anything if the statement immediately a...

For you @IvoWetzel
 
@IvoWetzel How do you extend your functions like you did here? API.schedule.lookup as API is a var defined as a function, what handles the .schedule and .lookup?
anyone?
 
one moment answering that question
 
Oh no problem, I appreciate it
Found a website on extending objects but its all how to extend prototype :P
fail
 
3:17 PM
In jquery there is a method serialize(). Is there any advantage and disadvantage of using this method?
 
@Prashant advantages compared to what?
 
0
A: is node.js' console.log asynchronous?

Ivo WetzelWell let's see what console.log actually does. First of all it's part of the console module: exports.log = function() { process.stdout.write(format.apply(this, arguments) + '\n'); }; So it simply does some formatting and writes to process.stdout, nothing asynchronous so far. process.stdout...

@MylesGray Uh, well I would favor putting the things on a prototype so you can easily have multiple API instances
 
So make my OWN prototype?
rather than extending the defaults prototypes?
 
3:34 PM
hi, is it possible to pass a variable from php into a javascript?
for example:
<?php
$album = $_GET['album'];
?>

<script></script>
 
@MylesGray
function API(site, key, ...) {
    this.site = site;
    this.key = key;
    this.schedule = new Scheduler(this);
}

API.prototype = {
    lookup: function(resource, callback) {
        // build the url etc here
        this.request(url, callback);
    },

    request: function(url, callback) {
        // build a request here and send it
        request.on('finished', function() {
            callback();
        });
    }
};

function Scheduler(api) {
    return function(method, options, interval) {
 
and then call :
var xhqr = jQuery.getJSON("getimages.php?album=<?= $album ?>");
 
@Roel best to ask @CodingKitten
:P
 
doesn't seem to be to way to go.. any sugegstions?
 
@IvoWetzel Wow man, I didn't expect you to write it for me!
Ill have to find a few of your q's to vote up
 
3:36 PM
uh well it's half complete stuffs
but it shows the concept
 
Still its a massive help!
thank you VERY much :)
 
apiInstance.schedule will return an object which has the stop() method on it
 
@CodingKitten What do you think, is it possible to pass a variable from PHP to JavaScript?
 
@MylesGray the string interpolation thing has useful features like... and.... not to learn that comment...
 
@IvoWetzel okay...
 
3:37 PM
@CodingKitten is there a way to pass php variables to javascript?
 
@Roel I hear some nasty wind outside
 
var userInterval = SO.schedule('lookup', 'users'..., 60000); if (buttonClicked) userInterval.stop();
 
?
 
of course you could add more stuff on there to restart the interval etc
 
so see API.prototype that is you defining API as a prototype method?
 
3:38 PM
@CodingKitten come again/
 
@Roel Hey never sees the plain markdown I know how to use that stuff!
 
@Roel ... Sorry had to do that :P
CodingKitten is a bot
;)
 
ah lol
 
uh, you know how prototypes work, right?
 
About passing vars from php to js then...
@IvoWetzel I have a very rough idea
 
3:39 PM
well it doesnt need to be vars from php... i just want to get the querystring.. seems so cumbersome in js
 
It isn't actually JSON that you are parsing with getJSON is it?
you could use XMLHttpRequest
 
yes the getimages.php returns json
but it needs the album name.. and that is passed in the querystring eg: /site/album.html?album=test
 
@Roel is the album name in the JSON response?
If it is it is very easy to parse the value form the JSON
Can you show us a snippet of the JSON response?
 
ok just a sec
 
@IvoWetzel Found this: ejohn.org/apps/learn/#64 I'll have a read
 
3:47 PM
damn just a sec
hold on pls
 
@IvoWetzel Oh i get it! A prototype allows for asynchrosity of the same function!
@Roel dont worry man, take your time dude :)
 
so the json from getimages.php = ["testalbum\/1.jpg","testalbum\/2.jpg"]
 
thats the JSON?
Is it not wrapped in a class?
e.g:
 
yes well, just an array of images in enough
*is
then i do this:
var xhqr = jQuery.getJSON("getimages.php?album=<?= $album ?>");
xhqr.success(function (data){
for(var i = 0; i < data.length; i++){ ....etc
 
what you need to do is call the outer classes that lead up to the array:
JSON.className.images[i]
where images is the wrapper for the image array
Well actually
in your case it would be:
 
3:51 PM
yes ok that i can do, but that's not the issue
 
@Roel Since jQuery 1.5, you can use:
var xhqr = jQuery.getJSON('getimages.php?album=<?= $album ?>').success(function(data) {
    // success callback
});
 
data.images[i] I take it you want the image name to be sent back?
 
@Roel Use Ctrl+K to format code blocks.
 
@Nyuszika7H thanks. I know, but it is the <?= $album ?> that is not begin parsed into the jsonrequest
 
@Roel Escape it like this: \<?= $album ?\>
 
3:54 PM
ok hold on let me try, thanks @Nyuszika7H
 
Oh the JSON URL wasn't being generated correctly?
 
@MylesGray indeed
 
right i completely misundersttod your question
 
it is begin generated as follows:
getimages.php?album%3C?=%20$album%20?%3E
 
@YiJiang advantages in comparision of traditional method of passing values in ajax as separate parameter. Also for speed, performance and security reasons etc?
 
3:59 PM
@MylesGray no problem
 
:kitten wob
 
It's badps fault!
 
so i can't seem to figure out how to pass the request string correctly to the getimages.php
here is a snippet of the code:
http://codepaste.net/heykw9
like i said, it calls getimages.php?album%3C?=%20$album%20?%3E instead of getimages.php?a=testalbum
 
@Roel use jsFiddle or JS Bin!
 
@Roel It is just encoding < and > to Unicode versions
Like @Nyuszika7H they need escaped
 
4:08 PM
i tried that
 
try this:
 
same effect
 
<?php
$str = "<? $album ?>";
echo addslashes($str);
?>
That will make sure the string is printed as it should be
 
i mean, it works, but the php scripts get this:
echo $_GET['a']; ---> <?= $album ?>
i want the value 'testalbum'to be passed
maybe i'm just going about it the wrong way
but like i said, getting the request string through javascript seems like such a hassle
 
@IvoWetzel what was that Dead Space 2 funny video review?
 
4:34 PM
@IvoWetzel On prototypes, I'm trying to get this working: ejohn.org/apps/learn/#68
I get can't set property of undefined with this code:
Ninja.prototype.swing = function() {
  swung = false;
}
 
first off, you're missing a this. infront of swung
also read it carefully
 
Oh I tried that too
 
Add a method to the Ninja prototype which returns itself and modifies swung
 
hey guys thanks for your help
 
@Roel did addslashes fix it?
 
4:41 PM
everyone was right, it was just my php server messing it up
 
@IvoWetzel I tried this too:
Ninja.prototype.swing = function() {
  this.swung = false;
}
 
it didnt need to be escaped
 
But I changed to just swung as I got this error:
 
@MylesGray itself = the instance
 
i just forgot to add .htm to the .htaccess :$
 
4:42 PM
ERROR Cannot read property 'swung' of undefined
 
it wasn't parsed as php.. stupid
 
@MylesGray !ninjaA.swing().swung, calls swing, what does swing return... ?
 
OHHH!
Ninja.prototype.swing = function() {
  return true;
}
 
...
ninjaA.swing().swung <-- access property swung of what swing() returned...
if you still don't get it, I'll show you the solution... and give you an F
 
Why do i get PASS for both with the above code then?
 
4:45 PM
:P
 
No no no, I want to work it out
:P
 
I don't think I'm ever going to learn this stuff properly.
 
@IvoWetzel:
 
@MylesGray That's because Resigs asserts are borken beyond repair
 
Ninja.prototype.swing = function(){
   return this.swung = true;
}
 
4:50 PM
...
this is what he wants:
 
It passes too :(
 
Ninja.prototype.swing = function() {
    this.swung = false; // set swung to false
    return this; // return the instance for chainability
};
now, why does your code work:
assert( !ninjaA.swing().swung, ....
 
This is going to sound amateurish, but, how can I check to see if a form input field contains at least one number and letter?
 
asserts in case the property swung has a falsy value
your method returns a boolean "true"
true.swung =undefined = falsy
test passed!
Let's ship it :)
 
ahhh okay
Cause it's undefined, null ,NaN or 0 it is falsy?
 
4:53 PM
'' is also falsy etc..
 
okay anything with no length, value etc
I don't understand what he means by chainability
does it mean you edit in one place and it changes everywhere?
 
if you return this from a method
you can call another method of the same object
foo.do().some().thing()
 
but return this.swung = false; wouldn't do the same?
 
uh no
return (this.swung = false) -> return false
and false... is not the instance, at least it wasn't the last time I've checked
 
oh I see, because I am returning this.swung = false
rather than just returning false
where as if I did return this then it would return this objects inner methods?
 

« first day (133 days earlier)      last day (4821 days later) »