« first day (318 days earlier)      last day (4648 days later) » 

3:01 PM
Wow. JSFiddle is really slow today. Must be a lot of SO-ers online :-P
 
^_^
 
@Warface Use @ or I won't see you responding to me. Lint checks your code for bugs. Google for javascript lint.
GOOGLE IT.
 
@RyanKinal jsfiddle is always slow
 
@Raynos Not always. Just most of the time.
 
user1385191
jsbin tends to be a lot quicker since less people use it
 
user1385191
3:13 PM
it's pretty much the same except it's more of a clean template
 
Aw, one of the two questions I answered seems to have been deleted.
 
0
Q: Making an encoding function faster

pimvdbI currently have this encoding function which simply subtracts one from each character code: String.fromCharCode.apply(null, text.split("").map(function(v) { return v.charCodeAt() - 1; })); E.g. test becomes sdrs. I know that this function is silly because it isn't a strong encoding algor...

 
thx for the tips guys cya
 
user1385191
3:39 PM
vulgarity alert:
 
user1385191
Fucking with custom form field elements instead of just using the goddamn browser defaults that everyone recognizes are why daddy drinks.
 
"Boy, you're gonna drive me to drinkin' if you don't stop using those hot-rod plugins."
Ooh, the SO chat drinking game: Every time somebody says "jQuery" or "jQueryUI", you drink.
 
user1385191
I'd make a game out of the front page
 
I think I am going to save every single thing off from js1k.com
Apparently the demos were down earlier.. theres too many awesome code pieces to be lost.
 
@MattMcDonald ... those rules would have to be slightly different. If we used the same words, I might die in the first 15 minutes.
 
user1385191
3:44 PM
you wouldn't be able to drink fast enough
 
can anybody confirm that FF seems to leak memory for new Image() ?
watch process memory either on os or about:memory
 
user1385191
imageCount is null
fiddle.jshell.net/gUxFK/show
Line 30
 
for me (FF6, win7) memory grows for each transfered image (which makes sense) but this memory is never freed again, even when explicitly nulling those refs
@MattMcDonald: yea that happens on second click, I even null the array itself
 
user1385191
definitely a leak on FF6 OSX
 
user1385191
no UI leak, but the memory is going up even after I reload the page
 
3:48 PM
I waited ages for the Gargabe collector to clean that memory
but it looks like it does not happen
 
@jAndy Er... is it me, or are you nulling imageCount, and not imageArray?
 
@RyanKinal: good call, lol. fixing
 
@Raynos Sublime is cute, but so is TextMate/e Text Editor. Vim/Emacs are still THE powerhouses.
 
ok, you can slap me.. looks fine now
 
And the code map seems useless. I did like the thing that spawns with Ctrl-r
 
3:58 PM
@tereško is inline CSS the devil?
 
mostly
 
eww inline css.
 
user1385191
css chain of command:
 
Is it valid when constructing ui widgets through javascript?
 
there are few exceptions , but as a general rule - yes , inline css is bad
 
3:59 PM
in Node.js, 3 mins ago, by Tom
gist: 1181128, 2011-08-30 15:12:01Z
    /* create button */
    var button = jQuery('<a></a>', {
            href: '#'
          , text: '[ Remove ]'
        }).css({
            'padding-left': '10px'
        }).get(0);
    
    /* attach to file list item */
    jQuery(fileListItem).append(button);
 
user1385191
user stylesheet > inline > style tag/external
 
user1385191
you're editing the DOM style object
 
not in this case
 
What should be done instead?
 
instead you should just set class to the newly created element
 
user1385191
4:00 PM
if it's not dynamic styling (ie: animation), using a CSS class is the way to go
 
@Raynos: why not keeping the jQuery object ref and use .appendTo( fileListItem )
 
What if that piece of code was a module
 
Inline css as in <p style="float:right"></p> is indeed ebil
 
If one writes each piece of UI as a independent module that doesnt know about anything else how do you deal with css name clashes
 
/* create button */
    var button = jQuery('<a>', {
            href: '#'
          , text: '[ Remove ]'
        }).css({
            'padding-left': '10px'
        }).appendTo( fileListItem );
 
user1385191
4:02 PM
"name clashes"?
 
Multiple css classes used in different modules
 
Well in that case you don't know how they should be spaced either. Also, what if someone has a default style setup for their a tags? IMO just better to create a class and include the .css with your module.
 
Because CSS is always global and has no system for namespacing your polluting global scope
 
eh, just prefix it with something then, moduleName-className
 
user1385191
so you're worried about "foo bar foo"?
 
4:03 PM
@Raynos , only cases where inline css is a defendable ideas , is when you use css to create some sort of content ( usually for faking effects with background and similar things )
 
I guess so
 
user1385191
a proper addClass function will avoid that
 
basically , when your css is actually making the content
 
@MattMcDonald not that
 
it seems pretty common place to include css with a module, most jquery plugins do it, as well as jQuery-ui just try and namespace the classes.
 
4:15 PM
No not that.
Modules as in modular application design
where every single piece of ui inside your application is a module
 
heh idk then, I guess think about it in terms maintainability, wade through js code to change some padding, or wade through a css file. I prefer the css file for sure.. but if not named intuitively it can be just as bad.
 
hey, could I get a hand with some javascript quickly?
 
user1385191
ask away
 
basically, I am new to front-end web dev, and I am trying to make a website (psd to html) that I designed. I am having trouble making the font-weight of some text 400 upon page launch in the navigation menu, have you any idea how I can do this? It is to show the user what page he is on.
I already have javascript code which makes the fontWeight 400 upon click of the text.
 
user1385191
stop it
 
user1385191
4:23 PM
use the :active pseudo-class for "click" styles
 
wow...
I hate web-dev so hard sometimes
var foo = new Image();
      foo.src = 'http://www.foobar.com/some_big_big_image.png';
// memory for the big big image eaten at this point

     foo = null;  // this will just not free the image memory, major leak
     foo.src = null; // this will do it
I wondered why all browsers swapped up to 1GIG when lazy loading high res motives on the background, I just nulled the image ref, no garbage collector cares
 
user1385191
I tend to do that sort of stuff with my flash work
 
user1385191
remove all children of a "node", then the node instead of the node itself
 
@jAndy why do you need to null it?
Doesnt the v8 GC do that for you when foo goes out of scope
 
@Raynos: V8 .. didn't test so much on that, FF3-6 and Safari so far
since for the currrent project, FF is the only target browser. however.. THIS IS HORRIFIC
 
4:32 PM
@jAndy v8 probably just works :P
I spend 3 hours writing this pretty print thing
The top one is mine, the bottom one is the default
git nerds!
How do I push the content of one branch into another one?
destorying and recreating the branch will work
 
5:32 PM
whoah @Raynos is that really you in the photo? Are you boat programming?!?!?
@jAndy that memory behavior is very sad.
 
5:57 PM
I never thought hed be on a boat.
 
@jAndy Are you sure GC actually ran?
@jAndy Also, the image itself won't be stored on the JS heap
 
@gsnedders: it lookes like it memory allocated for those images is not freed by nulling the image object itself. It's not in the JS heap, but its still on the heap somewhere, looking at about:memory
@gsnedders: they gave images as own branch there, and the memory just keeps allocated regardless if the object is gone or not
 
@jAndy Are you sure GC actually runs, though?
 
@gsnedders: I left my browser open for 20 minutes, I don't think even Firefox GC needs that long
watch about:memory or your OS own memory manager
 
@jAndy Firefox doesn't do GC while idle, you have to actually allocate enough memory to do GC.
 
6:06 PM
@gsnedders: I had my heap went above 1gig without reaction
but I dunno really, didn't test that much, all I say now is it lookes pretty wierd so far
also the fact that a .src = null instantly cleans up the memory
while image = null does nothing at all
 
Woo, time to figure out Long Polling/comet in .NET with IIS!
 
@Nathan yes no
 
user1385191
why in the world is nodeknockout requiring a facebook login for a public voter?
 
user1385191
:dunce:
 
user1385191
that stupid sketcharound app is facebook-exclusive, too
 
6:21 PM
@IvoWetzel is an associative array ordered?
 
yes
 
I often wonder if there should be a "web-programming.stackexchange.com" - all these poor C/C++/other-non-web-language devs that have to sift through questions like "jQuery making images bigger" and "Error in Firefox".
 
@Raynos: who is Anna :p
 
@IvoWetzel wikipedia claims otherwise
Can we edit wikipedia to say its ordered
 
@RyanKinal there kind of is
 
6:29 PM
0
Q: Is an assocative array ordered?

RaynosAn associative array has many common similar names, hash, keymap, map, table, index. It's a map of keys and values but I cannot find a reputable definition of the phrase which tells me whether a map has to have order to be an associative array. What is a reputable definition of the term "Assoc...

@jAndy anna?
 
but definitely not as many js questions there, I guess its more configuration focused
 
@Raynos: the girl voted for stackchat :p
pretty hot
 
@jAndy wow your a stalker
Kind of creepy, man
 
whooot I just looked at the site!
 
user1385191
considering the circumstances, I think you guys did a pretty decent job
 
6:43 PM
Another down voter picks at something that's not relevant to the question
1
A: How to check for undefined or null variable in javascript

Andy EIf you try and reference an undeclared variable, an error will be thrown in all javascript implementations. if (some_variable) is equivalent to if (some_variable != null), but you still need to check the variable has been declared first. Properties of objects aren't subject to the same condition...

sigh
 
user1385191
lol
 
0
Q: Is an assocative array ordered?

RaynosAn associative array has many common similar names, hash, keymap, map, table, index. It's a map of keys and values but I cannot find a reputable definition of the phrase which tells me whether a map has to have order to be an associative array. What is a reputable definition of the term "Assoc...

@AndyE are associative arrays ordered?
 
@Raynos: I don't think there's a requirement for AAs to be ordered
 
Then why are javascript objects not AAs ?
 
@AndyE Have an upvote :-)
 
6:48 PM
@Raynos, Perl's hashes, which inform many AA implementations, are definitely unordered.
 
@Raynos: my guess is because if we refer to them as AAs, that will further the misguidance of many developers to use Array() instead of Object() when creating "associative arrays".
 
JS objects aren't simply arrays of name/value pairs. They have methods too.
 
@Raynos They're not because keys must be strings in JS objects.
 
@gsnedders And also, objects don't (necessarily) have a length property
 
@gsnedders so WeakMaps are AAs ?
 
6:50 PM
@RyanKinal Do you need a length for an array?
 
@gsnedders In my opinion, yes
 
Some languages have both ordered and unordered name/value collections, like .NET and Cocoa Dictionaries...
 
@Raynos eh, weak maps are a type of them, pretty much
JS objects have an order! Insertion order! And then do something random with uint32 properties…
 
@Ryan: cheers :)
 
Man, COMET scares the crap out of me. I mean, what if the library I choose is bad at it? Then my server gets overloaded and completely hosed.
@gsnedders In most implementations, JS objects preserve insertion order. But it's not required by the spec.
(as far as I know)
 
6:53 PM
@RyanKinal correct
 
@RyanKinal No, it's not. But the web will break if you don't.
@RyanKinal And a browser in which Gmail doesn't work is rather useless. :)
 
@gsnedders You're saying Gmail relies on preservation of insertion order? That's... disappointing, to be completely honest.
 
Chrome doesn't preserve insertion order.
 
@RyanKinal It does.
@AndyE It does for non-uint32 properties.
 
Bad Google. Bad, naughty Google. tisk tisk
 
6:55 PM
@AndyE Everyone does for non-uint32 properties. What they do for uint32 properties varies massively.
(Some browsers vary between objects with Array in their prototype chain and those that don't when it comes to order for them, even. How that interacts with dynamic prototype chains, as everything but Chakra has, I don't know.)
 
Somebody remind me why I even suggested COMET to my boss as a solution for our chat application?
 
people think you need it... but this chat here doesn't use it.
 
@RyanKinal Because WebSockets doesn't have wide support?
 
@Nathan Yeah, I noticed that.
 
@gsnedders: they fixed the original bug marked "WontFix" then.
 
6:58 PM
@gsnedders Hah, that's possible too. I think I just included it in my proposal for completeness's sake. But now I have to implement it -_-
 
@AndyE That was for uint32 properties. Note that since Chrome/V8 shipped both Carakan and Chakra have followed the lead of not maintaining insertion order for uint32 properties.
 
user1385191
good
 
@gsnedders: nope, there was another - code.google.com/p/chromium/issues/detail?id=883
 
@RyanKinal just do it! Make the best library choice you can make, read the docs and get it working!
Long polling is a good idea.
 
user1385191
seeing that "issue" as WontFix makes me happy
 
7:00 PM
@Nathan Working on it. Just trying to figure out which is the best library choice. For .NET/IIS
 
non-primitive values affected for...in order. Was marked WontFix but appears it is now.
@MattMcDonald: yet firing up the test page indicates that it is fixed. Perhaps accidentally.
 
@AndyE AFAIK they've never changed behaviour
 
@AndyE Wow. There's quite the comment war going on in that issue.
 
Yeah, it's ridiculous. They were right to close it as WontFix. If anything, the issue should have been taken up with ECMA-262.
 
@AndyE Huh, if they did change anything it was before Chrome 1.
 
7:05 PM
can sumbody help mw with a little CSS positioning?
 
There's a proposal to define an order in Harmony, though.
 
@gsnedders like I said, perhaps it was an accidental fix.
yeah I saw that.
back in a few minutes, need to restart
 
user1385191
arrays for ordered data, objects for unordered data
 
@AndyE They seem to have not preserved order given an array set as a property value, which is just a weird exemption from iteration order (and almost certainly a bug)
@MattMcDonald Unfortunately the war is already really lost with objects being ordered in JS.
 
i have a paragraph and a very small image(icon size) that i have of a down arrow. now i want to position that image at the end of the paragraph bedides it
 
user1385191
7:08 PM
@gsnedders this is part of the "it will break the web" quip, right?
 
user1385191
userAgents, etc, etc
 
@MattMcDonald Yeah, indeed. Breaking Gmail wouldn't make a browser popular.
 
@lovesh Code?
 
yes
 
<http://wiki.ecmascript.org/doku.php?id=strawman:enumeration> is the Harmony strawman
 
7:10 PM
<div id="div1" class="content">some content.</div>
<img src="down.gif" class="show" />
 
user1385191
when I read "paragraph", I think "p" tag
 
now i wnt the image to be positioned just like the star and flag images are positioned in this chat
 
user1385191
float it
 
<div id="div1" class="content">some content.<img src="down.gif" class="show" /></div>
Images are inline elements. Win.
 
@RyanKinal well thanks but i cant do that because that would break a lot of javascript. i hav to keep the image out of the div
 
user1385191
7:13 PM
div#something, img#somethingelse
{
	float: left;
	clear: right;
}
 
user1385191
though you may want to toss in a display: block; for the img
 
user1385191
-1
Q: Why does this while loop freeze my page?

Davidvar f = 5, d; while (f === 5) d = 2; alert(d); Why does this freeze my page. I thought only when the page is doing a document.write, alert, or console.log inside a while loop (without a incremented value with a limit) it will freeze the page, but not with variables... Do I still have to have ...

 
user1385191
oh boy...
 
@lovesh Go with @MattMcDonald's answer, then
 
user1385191
I'm recalling memories of my first year of programming
 
user1385191
7:17 PM
"uh...why is this while loop crashing flash?"
 
user1385191
"screw it, I've never using one of these again"
 
@MattMcDonald It doesn't hang Opera!
 
(Y)
 
user1385191
IE can break out of them
 
We don't actually break out of it.
We'll eat CPU, but we still yield from JS periodically so the UI remains responsive.
 
7:19 PM
@gsnedders: that comes at a cost, no ?
in terms of "max performance"
 
@jAndy To JS execution speed? Yes.
 
I don't really like it I guess. You should leave that job to the web dev guys
keeping things responsive, like run-away-script timing and whatnot, javascript has all the tools
 
@jAndy More important on mobile where a smaller, shorter script can cause the UI to become unresponsive more easily.
 
no, the user needs the UI to be responsive enough to kill a bad page/tab.
 
@jAndy You really have to a fairly long running script thread for it to actually make any different, though
 
7:22 PM
no question, but I still think js deserves 100% cpu cycles (at least 100% possible for the js engine)
 
@jAndy Well, it still has rounded to 100.0000000% of the CPU :)
 
but, well, then again there might be too many unexperienced javascript pseudo developers out there
so might be reasonable to block a bit
 
@jAndy The perf hit is minute
 
Ooh... interesting thought: Does the use of jsFiddle hide the importance of the document ready event, since it automatically executes all JS on ready?
 
@jAndy Practically any window-manager will get in the way of JS execution more than that.
 
7:25 PM
I saw this answer, and thought that might be the case - lack of $(document).ready(), and use of JSFiddle:
0
A: simple fade out image on link click

Rikudo SenninYou need to prevent the default event behavior. $(document).ready(function() { $("a").click(function(e) { e.preventDefault(); $("#wrapper").fadeOut("slow"); }); }); See this jsFiddle Example. Also, you must make sure the DOM is ready, by wrapping your whole code with ...

Huh... answer was edited.
 
On a side note, I find it interesting how often a quick answer is posted, and then, very soon after, edited for completeness.
 
user1385191
354
Q: Fastest Gun in the West Problem

Omer van KloetenI feel like there's a problem with Stack Overflow, as the number of people prowling it increases. Each question's answers are sorted by descending score and then descending time of posting. This means that if a person sits down and answers a question in a long, thorough way, going through every ...

 
@RyanKinal Becuase SO isn't about great answers, it's about a race to post answers nobody thought about to get the first wave of upvotes by people who didn't bother to think about it. Welcome to critical mass at 2million questions and thousands of users.
Questions you need to think about? Not that I have access to stats, but I'd be amazed if the bounce-rate wasn't over 70% before they read the thing.
 
@Incognito saw it
 
7:31 PM
@Incognito See, those are the questions I like.
 
user1385191
people only care about questions if they're on the front page
 
@MattMcDonald That's true too
 
I posted suggestion a few month ago on meta, suggesting that answers should get optionally delayed by the questionier
 
I wish my satellite hacking Q had more quality answers :(
@jAndy I suggested a quality criteria review system.
 
@Incognito I dont see what special about it
 
user1385191
7:32 PM
the problem is entirely on navigation to the question
 
@MattMcDonald yeah those are mostly the ones I target, unless Im trying to target a specific tag (namely canvas right now) then Ill look at older unanswered ones.
 
user1385191
I navigate by tag, so more and more questions show up
 
@Raynos New fish in a small pond.
 
Its all about spitting something out fast, and revising it
 
user1385191
does adding a new answer push the question to the top of the front page?
 
7:34 PM
@RyanKinal Y U NO SOCKETIO
 
user1385191
I seem to recall otherwise
 
@Incognito meh HTML5 games are cool but most are tech demos
 
only thing I would like to see is hiding the person who answered and their SO points for 10 mins or so
 
show me something polished and I'll be interested
 
19
Q: What would one need to do in order to hijack a satellite?

IncognitoI realise this borders on sci-fi, but there's been some interesting demonstrations regarding security of various satellites. What would be required to hack a satellite (in general terms, any hack really)? Are they all basically connected in the same way, or would I need different equipment, sof...

 
7:35 PM
@Raynos woah man.. just look
 
NOW they start putting out better answers :(.
After I give up 500 rep.
 
theres a few really good canvas games
highly polished
 
user1385191
bounty questions are pinned to the top
 
user1385191
"featured"
 
7:35 PM
@Loktar I looked :P
I've seen it already
 
@Raynos I'd like to see multiplayer games on the phone that doesn't suck :P.
 
playbiolab.com <-- is one of the better ones
problem isnt with the tech right now, its with the people focused on it
mostly early adopters, and tech demo geeks
Flash can be monetized thus has the weight of the seasoned developers behind it for games
actually isnt @ivowetzel working on some cool html5 game related things with Zynga
 
@Raynos ... why don't I use socketIO on my Windows/IIS server? Well, because it's a Windows/IIS server.
 
@RyanKinal use node-iis
 
node-iis??
 
7:38 PM
I mean dear god why would anyone put node in IIS
 
oh my thats amazing.
 
but its an easy way to trick .NET management into running node
 
yeah esp at places where thats all you have access to :? like here bleh.
 
@Raynos How's integration with MSSQL?
 
@RyanKinal hmm, didnt think about that
 
7:39 PM
(Nearly typed that with a straight face)
 
@RyanKinal non existant \o/
 
@Raynos \o/
 
Seriously write a small C# application that does database shit and expose an API over TCP
then set up iis-node and socket.io, and get the node backend to pipe commands down TCP to your C# MSSQL thing
 
I'm thinking maybe ASPComet
 
ugh no commits since nov 2010
dont trust it :P
 
7:41 PM
Damn. Fair enough.
 
@RyanKinal seriously use this as excuse to install node
then keep mentioning "oh we already have node, we can do this a lot easier in node"
 
Is Node honestly worthy of a multi-million dollar business? Is it up to snuff?
 
Node is pretty badass, I keep thinking of it as the new ror .. idk why I make that comparison but I do regardless. google.com/…
 
@RyanKinal sorry your clearly not in the know ;)
node.js is awesome
I mean really awesome
.NET = puke, PHP = puke, Ruby on rails? lol no. Java? Hell no. Python maybe? node awesome.
 
@Raynos I'm really not. I understand it's awesome, but is it awesome enough to convince my server administrator and boss?
 
7:49 PM
For a chat yes
 
ah @RyanKinal yeah thats a tough one.. since its not even 1.0
 
socket.io is the de facto standard for real time communication
If you want to make this chat real time and scalable slap node on
 
how critical is the chat app?
 
And just isolate node for the chat logic and pipe all other stuff (database etc) to MSSQL
 
@Loktar We're making a big push for social features within our course-delivery application. Chat is one of the two big ones (the other being user comments)
 
7:51 PM
@Raynos: you forgot about perl and mojolicous
 
@jAndy perl :(
I forgot erlang and haskell
 
yeah I mean I love node and think its awesome, but idk I personally would be weary still of using it in a production critical system, mainly without other people who know the ins and outs as well.
 
I would actively recommend researching those, they sound pretty awesome
but ehm the problem with erlang and haskell is that people in business can't deal with it
@RyanKinal let's put it this way, if I want COMET or websockets, nothing is more trustworthy and tried & tested then either socket.io or APE
@RyanKinal by the time you've finished the app 0.6 will be out and stable. microsoft is backing node.js
 
@Raynos Fair. That is my worry with COMET - if it's done poorly, it can go bad in quite a spectacular way.
 
Yep, so use socket.io
You do know how awesome socket.io is right?
 
7:53 PM
I've done some reading.
 
the fact you can bake into IIS is the only reason I would recommend it
You can also play the websockets reduce latency by a factor of 3 compared to COMET and significantly reduce server load card
 
The other thing I'm worried about is the dev environment - Visual Studio's crappy little dev server isn't IIS.
I'll have to do some more reading. Maybe test a few things out.
 
lul wut?
You dont have a local copy of IIS on your dev machine?
What kind of .NET dev machine is that? :\
 
@Raynos I do have a local copy of IIS. But it's not integrated with VS. And that's the way it is on all of our dev machines.
Lame as hell, but that's what they give me.
 

« first day (318 days earlier)      last day (4648 days later) »