« first day (137 days earlier)      last day (4814 days later) » 

Neo
12:27 AM
damn I just closed nano in ubuntu without saving Ctrl+X(^X) can I continue it?
nvm sorry to post here to late to remove/edit it
 
@Neo use a better editor like emacs :D
 
Neo
well I found out how to do it thanfully by typing fg
@Nathan I really should, I am trying to learn vim
 
oh you must've pressed Ctrl+z, not Ctrl+x
ctrl+z backgrounds the current process (usually)
 
Neo
12:43 AM
yeah I meant Ctrl-z
I couldnt remember what I was supposed to type to bring it back
 
1:15 AM
ooh, i'll have to remember that...
 
RT @cowboy: jQuery snippet that simulates the DOM building: (function n(e){e.eq(0).fadeIn(99,function(){n(e.slice(1))})})($(":visible"). ...
 
i cannot get that working :(
 
1:31 AM
@david The extension?
 
nah the snippet they tweeted
ah, better
i think they may have cut it off :S
feeds shouldn't have a character limit less than 140 characters :P that's silly
ahaha, okay that's cool
(function n(e){e.eq(0).fadeIn(10,function(){n(e.slice(1))})})($(":visible").css("display","­none"))
and if you're using the jsshell chrome extension you can run it on any page
or run it from the console i guess
 
1:46 AM
just refactored almost 600 lines out of this crappy 4000 line js
saved 60 kb, woo!
 
v.v ouch
 
I think there's more to go too
hopes it still works
it does!
 
2:21 AM
I guess this is an udocumented feature of youtube, or it's not supposed to be public youtube.com/…
Now I just need to figure out what some of the params mean
 
well darn, only 9kb saved from the google closure compiled version :(
 
on advanced?!
 
no
it's too broken for advanced
 
yeah i was about to say, a 4k line js file that compiles on advanced would be awesome.
 
or too amazing... advanced mode replaces the whole 4000 lines with like, {/* haha */}
4
 
2:33 AM
ahah
 
actually it's the external reference thing I read about but I don't think I will use the advanced compiler.
anyway gotta go to dinner! goodnight.
 
laters
 
 
3 hours later…
5:52 AM
RT @IE: Announcing: #DevUnplugged - an HTML5 contest to push the limits of gaming & music online http://cot.ag/e0o1Iy
 
6:38 AM
@Feeds UnPlugged and online?
... must be that wahrless stuff them younguns keep yappin bout.
 
 
3 hours later…
9:17 AM
Aloha all
made it into the SO top 1% this quarter :D
Anyone want a laugh?
Run JSLint on the stuff we have been given for our JS practical today: jsfiddle.net/Mutant_Tractor/vLP2f/3 :P
 
...
It doesn't need JSLint to rip that stuff apart
 
i hv 1 unsolved question
can I post it here ?
its related to calendars ?
0
Q: Consolidate calendars and display in a browser

user522003Hi,I wanted to display facebook, yahoo and yahoo calendars and den diplay them in a browser as a global calendar .The global calendar should be able to sync automatically with the above calendars for updates to events/tasks/reminders . I wanted to use "VMWare Zimbra 7" but was unable to install ...

is anyone there ?
 
9:32 AM
I'll look for you
 
@IvoWetzel yeah its pretty bad :/
 
Can someone look at this <canvas> .. why isn't is being drawn with the right dimensions?
 
the usual problem
canvas takes it's acutal pixel dimensions from the width / height attributes
jQuery only sets the style tag
so the thing gets streched
while falling back to a default pixel size
 
oh yeah I see, but I wanted to use the "beautiful element creation"
I thought putting width and height as properties in that creation object would set the attributes, is this impossible?
 
10:10 AM
What's the most efficient method on parsing a string as an integer? My program is doing it a LOT from the data its given, and I'm intrigued in how efficient parseInt is
 
@Greg If it's just a number, then do +'123.45' will get you the number
No other character in the string is a requirement here though
 
@YiJiang there are characters in the number in my situation
 
parseInt should be faster than regexp, which is probably the next best option
 
ahhh ok, just thought there may be a window of optimisation here
 
I keep getting selectedIndex not defined in my console, anyone got any ideas?
function getSelected() {
    var selected = document.getElementById('dropdown').selectedIndex;
    getMovieInfo(selected);
}
 
10:19 AM
@MylesGray exactly what is document.getElementById('dropdown')?
 
@Greg it is a <select> dropdown list
 
what child nodes does it have?
 
@Greg here's the fiddle (dont shout at me, not my code, my lectuers)
 
Is it just me or StackExchange sites are SO slow since some days?
 
@MylesGray selectedIndex is defined in the scope of getSelected() but you are trying to use it in getMovieInfo() - it's not in scope there
@Nyuszika7H just you
 
10:24 AM
@Greg right ;) got cha
 
@MylesGray Oh god, cannot unsee, cannot unsee...
2
 
@Greg surely it should just pass it a value though?
@YiJiang yeah... welcome to my wednesday mornings
 
@MylesGray yeah or make the code more object oriented, and store it as a private variable
 
@MylesGray Surely your code can be improved.
Instead of doing this:
 
@Greg sorted it, the element wasn't in the DOM at that point
 
10:27 AM
var arr = new Array(8);
arr[0] = 'foo';
arr[1] = 'bar';
arr[2] = 'baz';
…
 
@Nyuszika7H as I said, not my code - im working on improving it
 
var arr = [
    'foo',
    'bar',
    'baz'
];
@MylesGray ah ok :)
 
Good idea though man :)
 
JSON notation is much better. And it's pointless to set array sizes, use var arr = []; to initialize an array. Or if you're instantly going to add values, init it with the values there (see my previous example).
Though new Array can be useful in some cases, let's say you want to repeat a string multiple times:
 
@Nyuszika7H Just init the array with all the values in there, no need to explicitly set array size
 
10:29 AM
function repeat_str(string, times) {
    return new Array(times + 1).join(string);
}
@YiJiang Yep, agreed.
 
gah
document.getElementById('dropdown') returns null
 
@MylesGray If I'd write only vanilla JS, I'd create a simple selector function:
 
@MylesGray do it after dropdownMake() else it won't exist
 
@Greg It is, the whole thing is just messed up :(
here is the newer version:
 
function get(selector) {
    var d = document;
    if ( /^[a-z]/i.test(selector) ) return d.getElementsByTagName(selector);
    if ( /^#/.test(selector) ) return d.getElementById(selector);
    if ( /^\./.test(selector) ) return d.getElementsByClassName(selector);
    if ( /^\[/.test(selector) && /\]$/.test(selector) ) return document.getElementsByName(selector);
}
 
@Nyuszika7H get("span.error") what will that return?
 
@Greg Nothing, I think. That was just a first try.
get('#id');
get('.class');
get('tag');
get('[name]');
 
@MylesGray what debugger are you using?
 
@Greg Chrome console
 
break it before the getElementById and in the dopdownMake function
 
10:39 AM
still doesnt work :P
 
its only doing what you're telling it to
 
seems this is broken now:
if(document.getElementById('dropdown').selectedIndex > 0){
            alert(movieTitles[i]);
    info.innerHTML = infoString;
    }
it never passes that if
nevermind it works :)
 
How can I actually delete a variable? I can't seem to be able to do that unless I use the console.
 
RT @nimbuin: JSHint Edition Update (now with plugins for your favourite text editors!): http://t.co/DZ2RIoh
 
10:54 AM
@Feeds You're too slow! :P TweetDeck notified me about it 2 mins ago.
 
@Nyuszika7H It only updates every 5 min
 
Web Notifications draft published: http://www.w3.org/TR/notifications API for exposing platform-level notification mechanisms to Web apps
 
2 messages moved to bin
 
What feeds does it read?
 
@DontCare4Free Currently, the HTML5 and jQuery twitter feeds
 
11:06 AM
@YiJiang ah you've beaten me :)
 
Is it room-specific?
 
Unsure about including other feeds, since they might contain personal messages, which may be awkward
@DontCare4Free Yes
 
@DontCare4Free Yep.
 
@YiJiang 2 seconds… (!)
 
11:07 AM
@Nyuszika7H ;)
 
@YiJiang Maybe include the prototype, etc blogs?
 
Anyone know what is wrong with the clicking here?
 
@DontCare4Free Blogs come out rather badly, I've requested for this to be improved on Meta
 
It seems when they select an item from the dropdown they then need to click the dropdown again to get it to update
 
@MylesGray Hmm, I get something like this:
The Prestige [2006]
undefined
undefined
undefined
undefined
undefined
Sunshine [2007]
 
11:08 AM
@YiJiang Oh
 
Anyway, I don't believe any of the regulars here uses Prototype
 
yeah exactly
all those undefineds are caused by the weird clicking method
 
@MylesGray Though adding others seems to fill these places. (Not always.)
 
5
Q: Make chat feed awesome (or at least usable)

Yi JiangIn the Stack Overflow JavaScript room, we wanted to add the feeds of the blogs of several prominent JavaScript developers. This is what we got: This sucks. The format is totally unusable, there's no indication of which goes to what (the top link goes to the feed URL, the bottom link links to ...

 
@MylesGray Why are you using spans instead of buttons?
 
11:11 AM
@DontCare4Free the lecturer told me to
im not allowed to do any different >.>
 
@MylesGray Ah, although it seems a bit like reinventing the wheel
 
@DontCare4Free ask @YiJiang or @IvoWetzel what my uni is like.. they know the story by now :P
 
11:25 AM
Oh dear...
You will now implement the final part of this practical. Modify the code that displays the customer list so that the list is now displayed inside an HTML table. The first column of the table contains the movie title. The next three columns contain options to (a) move a DVD up the list, (b) move it down the list and (c) to delete the movie from the customer list.
Tables >.>
for layout I'm gonna go out killing
 
11:40 AM
RT @stevefaulkner: New post: Tweaking "HTML5 edition for Web Authors" http://bit.ly/dVLbrS #HTML5 #W3C #accessibility cc/ @sideshowbarke ...
RT @stevefaulkner: HTML Speech API Proposal from Microsoft http://bit.ly/eCITXc "enable pages to incorporate speech recognition and synt ...
 
12:07 PM
I got marks taken off me for NOT using HTML MAP tags and using JS insted >.>
 
12:20 PM
Hi again! :)
RT @junejawebblog 10 jQuery useful plugins http://bit.ly/fnBwBx #jquery #plugins
RT @addyosmani: The jQuery 1.5.1 Offline Learning Kit http://bit.ly/gZxRbX #jquery #javascript
SIDEWAYS #jQuery fullscreen image gallery http://goo.gl/fb/aFda7
OK, that's enough. :) If someone wants more jQuery tips and tricks, search for #jquery in twitter.
 
12:39 PM
@MylesGray tables can be used. For say tabular data :) Also take his code. Bin it, write your own UI that doesnt suck. Then tell your lecturer he sucks :)
@MylesGray seriously file a complaint that your lecturer is incompetant and teaching you worthless material and insist you get the marks not revoked.
 
@Raynos Seconded, this is just... stupid.
 
@Raynos Thirded?
 
@Raynos I will do - I have another assignment prettymuch the same again, I'll just jump through the hoops :(
I had something else to complain about it... what was it :P
 
@MylesGray no don't jump through the hoops. Write a formal letter of complaint. Insist that the department redoes the course to be competant.
 
@Raynos Yeah I will do, I could re-write the assignments to make then standards
Another thing, they DONT teach us how to use "createElement"
 
12:52 PM
What do they suggest instead? document.write ?
 
el.innerHTML = stringhere
 
@YiJiang innerHTML manipulation vs DOM manipulation. The latter always win right?
 
@Raynos Well, it depends. If your application is performance sensitive or if you're just replacing everything in the element then it makes sense to use innerHTML. Otherwise DOM manipulation is almost always better
 
innerHTML is 84% faster (at least in Chrome 11 dev), though DOM manipulation is more readable. jsperf.com/createelement-vs-innerhtml
 
hmmmm..
the innerHTML doesnt allow for tr and td tags
 
12:58 PM
@Nyuszika7H Expected, of course. But like I said unless it's incredibly performance sensitive use DOM manipulation
@MylesGray Where?
 
@MylesGray really?
Notice Java 6 Update 24 released
 
In the one I was doing at uni, I had a string printing <td><span>TEXT</span></td> and instead what showed in the DOM was just the <span> tags
And yeah I tried it elsewhere
same thing
Anyone want a bounty? (Not quite up to @Raynos's standards)
0
Q: Prototypes and nested return functions, help!

Myles GrayIntro: I know that "How does this code work?" type questions are frowned upon and I'll look about as clever as a brick reading "The Sun" for asking such a question but... here goes. I am trying to understand prototyping in JavaScript, now this isn't the problem, I understand the basics of the...

 
if-elseif-else vs. switch vs. if-return if-return if-return?
 
Dom wins vs string. end off. String isn't actaully any faster.
 
@Raynos You broke the most important rule of jsPerf! No for loops! They do it for you.
 
1:04 PM
@Nyuszika7H -.- the code should have for loops.
 
It makes your tests slower. 506 ops/sec…
@Raynos NO.
 
Yes it should
I'm testing string concatination vs dom methods
 
@Raynos It doesn't change anything.
 
Of course it does.
There's a big difference
 
@Raynos I used for loops
so it must be faster :)
Thats how you iterate through to string concatenate
Unless you are doing inline concatenation with no iterations, which is largely pointless
 
1:06 PM
The point is. DOM manipulation is faster
 
@Raynos me too
 
Using loops in jsPerf is pointless, since all of the code is already wrapped in a for loop.
 
@Nyuszika7H But in real life we use for loops
so you may as well use them in JSPerf
 
@MylesGray Yes, but jsPerf does that for you!!!
 
@Nyuszika7H fail. look at the code. I need to loop string concatination
 
1:09 PM
@Nyuszika7H I realise that :P but think about the execution what if the loop is executed multiple times (it is in my example) so you have to put the for loop in to get an accurate representation
 
There is a clear difference between my for loop and the for loop wrapper around my code
 
@Raynos Ok, that may be true. But why do you do createElement when you append a string? That is really pointless.
 
Turns out there is little difference between the two
To create a container div
 
@Raynos lol, you do exactly that with appending a string to its innerHTML!
 
@YiJiang jsperf.com/domvsstring/2 it's a myth that string concatination is magically faster
 
1:16 PM
@Raynos Well, I suppose that depends on what javascript engine you are using
 
0
Q: Hello world ASCII art

Nyuszika7HDraw Hello, world to the screen with the smallest possible code. Sample input helloworld *Sample output * ** ** ********** ** ** ********** ** ** ** ** ** ** ** ** ** ** ** ** ** ** *********...

 
@Nyuszika7H heh
 
@DontCare4Free tested both in IE8 & chrome
 
hi
I'm trying to implement a chat server, and I'm trying to understand what's the best to keep a list of online users. Does anyone have any experience with something like that?
 
2:16 PM
Depends. I would use an ArrayList
 
Hi again! :)
@Raynos ArrayList?
 
@EdanMaor check above comments :)
 
2:54 PM
Good morning, would anyone be able to look into this problem for me? stackoverflow.com/questions/5168008/…
 
3:04 PM
What does ^= means in JS?
 
bitwise operator
The ^ (caret) operator performs a bitwise exclusive-OR on two integers. Each bit in the result is 1 if one, but not both, of the corresponding bits in the two input operands is 1.
 
var num = 1;

// they're the same
num = num ^ 2
num ^= 2
 
likes jQuery.noop
 
noop should be nop to be standard...
 
3:16 PM
@Loktar Thanks.
 
@ircmaxell Why? noop means no operation. james.padolsey.com/jquery/#v=1.5&fn=jQuery.noop
 
In computer science, NOP or NOOP (short for No Operation or No Operation Performed) is an assembly language instruction, sequence of programming language statements, or computer protocol command that effectively does nothing at all. NOP machine instruction Some computer instruction sets include an instruction whose explicit purpose is not to change the state of any of the programmer accessible registers, status flags, or memory and which may require a specific number of clock cycles to execute. In other instruction sets, a NOP has to be simulated by executing an instruction having oper...
 
> …NOP or NOOP…
 
Right, but it's NOP by formal definition
 
4:01 PM
Hello
Anyone familiar with RadCombobox here?
 
NOP is from assembly where mnemonics tend to be 3 letters or less, like ADD, MUL, XOR, MOV, DIV, etc.
oh.. and not to forget CMP and JMP
i've just seen the wikipedia snippet.. looks like I'm in write onlny mode.. again
 
4:24 PM
@Raynos How about Firefox, Opera or older versions of IE?
 
Server push technologies in IE, do we have them?
 
@Raynos Some kind of reversed ajax?
 
Yes
Like a forever iframe, how does that work?
or "AJAX multipart streaming"
 
@Raynos No idea, but wouldn't the server push thing be possible with ajax polling?
 
I don't understand this:
yepnope({
  test : Modernizr.geolocation,
  yep  : 'normal.js',
  nope : ['polyfill.js', 'wrapper.js']
});
 
4:36 PM
@DontCare4Free but then your polling. Isn't that the client polling every x seconds?
 
@Raynos Yes, but it would produce almost the same end-user result (with small delays)
 
Yes and no
What if the server doesnt push any data for 5 days?
 
Reverse Ajax refers to an Ajax design pattern that uses long-lived HTTP connections to enable low-latency communication between a web server and a browser. Basically it is a way of sending data from client to server and a mechanism for pushing server data back to the browser. This server–client communication takes one of two forms: * Client polling: the client repeatedly queries (polls) the server and waits for an answer. * Server pushing: a connection between a server and client is kept open and the server sends data when available. Reverse Ajax describes the implementation of either...
 
What if someone leaves the browser open all week?
 
I see that that could consume quite some bandwith
 
4:38 PM
Yes. Hence I want a real push
 
Does pushing work on other browsers?
 
@Nyuszika7H Basically a form of Comet. Why do we need to come up with a new name for every sight tweak of a concept...
 
@ircmaxell I like the name Reverse Ajax better.
 
I don't. what the heck does Reverse Asynchronous Javascript and XML have to do with HTTP long polling or push?
 
@ircmaxell Well, it is (can be) working like ajax, although the server "is in control", rather than the client
 
4:47 PM
Ajax itself is a misnomer since it's not really used that way anymore anyway
 
@ircmaxell So, rather reverse AHAH?
 
AHAH?
 
If I remember correctly it is another term for ajax
but not specific to js/xml
 
Still, it's not Reverse anything. It's just long polling. It's not making a connection from the server to the client (which is in practical terms not possible). That's why the name for it when it was first created was something different: Comet
 
Yes, but then, I'd argue that it has even less to do with comets, although, that is probably just a name with no technical background
 
4:52 PM
Comet has been around for years (I first heard and played with it around 2006). But just because someone comes along and thinks they've created something new (without researching waht exists first), we get terms like Reverse AJAX. It does nothing but dilute the environment with useless synonyms...
 
@ircmaxell True
 
@DontCare4Free It does have to do with Ajax however, since Ajax and Comet are different brands of sink cleaners)
:-P
 
Heh
Anyway, isn't Ajax often used as placeholder company names in some disney comics?
 
no idea
 
@DontCare4Free AHAHAHAHAHAHAH
 
4:54 PM
can someone explain to me what line 113 does in yui.yahooapis.com/2.8.2r1/build/yahoo/yahoo.js ?
o[d[j]]=o[d[j]] || {};
 
@ircmaxell how does comet work? It all seems like polling to me.
 
@Greg seems like some pretty complex array handling
 
@Raynos: it's a combination of techniques, including polling as one of them
 
Are there any true push techniques?
 
@Greg Simple, factor out the variables
 
4:55 PM
Is there any point of JSDoc?
 
I really like how yahoo deal with namespaces, and I'm trying to figure out what's happening so I can do it myself
 
Dont they use the module pattern?
 
var k = d[j];
o[k] = o[k] || {};
 
@ircmaxell I've never seen an assignment like that, with || in there
 
@Raynos Not for server->client interaction. You can't due to NAT firewalls and the such
 
4:56 PM
@Raynos Is bandwidth your primary concern for not polling?
 
what does it do?
 
@Greg: it's saying return the first part if it evaluates to true, or the second part if not
 
I want to keep a page in sync in real time
The only solutions I can think of are websockets
 
so it's saying Leave o[k] alone if it's set, but if it's not tell it to be {}...
 
@Raynos Slow loading over ajax? Would minimize the need for polling, I suppose.
 
4:57 PM
@ircmaxell ok I see
 
@Raynos: Long polling is about the best you can do
 
@ircmaxell Or "fat" clients with a custom protocol
 
if (typeof Douglas.Crockford === 'undefined') {
    new Roundhouse().kick();
}
 
@DontCare4Free But even then, you can't get true push with unknown clients
You can get pseudo push (long-poll or heartbeat), but you can't initiate a TCP connection from a server to an arbitrary client
 
What evaluates to true in js? Everything apart from false, null and undefined?
 
4:59 PM
@ircmaxell UPnP/NAT-PNP
 

« first day (137 days earlier)      last day (4814 days later) »