« first day (83 days earlier)      last day (4848 days later) » 
00:00 - 17:0017:00 - 00:00

12:00 AM
@Na7coldwater how do i capture them as they happen quietly? Object.defineProperty would be nice but isn't really an option
 
Maybe modify your script to use get and set functions on an object instead of modifying it directly.
@Raynos Could you stand doing foo.set("bar.baz", value) instead of foo.bar.baz = value?
 
gyar
i had a masterful idea of adding a 'tracker' object to the prototype chain just before the 'object'
but you can't change the prototype of primitive types :(
 
You can't? Just do Object.prototype.foo = bar;. Or is that not what you meant?
 
@Na7coldwater I could but users couldn't I want some quiet working in the background
@Na7coldwater @david do not change Object.prototype or I will hurt you. bad.
 
i'm not changing the object.prototype :P i'm inserting a new prototype before it
@Na7coldwater this doesnt work:
var x="hello";
alert(x.prototype);
x.prototype={};
alert(x.prototype);
but if you change it to var x = {a:"hello"}; that will work
 
12:08 AM
Try String.prototype instead.
 
Don't mess with native objects prototype unless you do sandboxing
 
sandboxing?
 
I make assumptions that no-one corrupted String.prototype in my for in loops and in other places.
sandboxing means you dont edit String itself, you edit a localised sandboxed copy of String and delegate all your string handling through it
 
12:30 AM
for(i in {})
{
    // Someone modified the prototype!
    MakeSomeonePay();
}
 
/*someone didn't check hasOwnProperty!*/ MakeSomeonePay();
 
I think JavaScript needs a createScriptContext() function that creates a new context with it's own global object and everything.
 
just use the module pattern and don't leave off the 'var' keyword
or, if you don't want a module, just use an anonymous self executing function
 
@david If javascript had such a function, you could modify the object prototype in a different context and leave the rest of the page unaffected. It would also be useful for projects like ADSafe because they could run untrusted code in a context where the script couldn't access things like location.href and stuff. </wishfulThinking>
 
1:10 AM
So anyways
 
1:46 AM
yeah like totally
 
2:02 AM
I wish I can become a js pro. Its been almost a year since I started >:|
 
2:18 AM
read lots :o
and make sure you realise that a lot of the stuff out there that you're reading is probably wrong
once you've read enough you will be able to tell what's good and what's batshitinsane
and sign up to this: javascriptweekly.com
the weekly emails are a good way to keep you hand in
 
 
1 hour later…
3:27 AM
thank you!
 
 
3 hours later…
6:53 AM
Hi, I am using a CSS button as

<a href="" class="btn green" title="Delete" OnServerClick="MyCodeBehindFunction">Delete </a>

Previously, I was using a button control instead of CSS button and using AJAX confirm extender before deleting. But how do I ask for this confirm action in < a href=""> now?
 
 
2 hours later…
9:13 AM
@user458790 <a href="#" onclick="return confirm('Are you sure?')">Delete</a>
 
9:58 AM
@IvoWetzel morning
 
@Raynos Good morning
 
1
Q: Javascript object encapsulation that tracks changes

RaynosIs it possible to create an object container where changes can be tracked Said object is a complex nested object of data. (compliant with JSON). The wrapper allows you to get the object, and save changes, without specifically stating what the changes are Does there exist a design pattern for t...

Suggest an alternative before I implement a hashing solution
 
Hm I think either going through everything or just dumpin to JSON for the hash is the only viable solution that doesn't require a ton of hacking
You can't hook into a generic obj.__defineProperty__ method
Even if you could you would need to acccess all the references of the object...
And mark them as changed too.
 
@IvoWetzel I was thinking of overwriting the getters & setters
<object id="Beasty" height="85%" width="99%" classid="somedll" viewastext><\object>
"The object doesn't work! fix it!" -.- I didn't even know you can hook into dll's
 
10:14 AM
@Raynos Well, is there any chance of new properties being added?
 
@IvoWetzel yep. They have to be detected and overwritten with setters & getters by the hashing thing
 
you can't do that without special syntax
there's no way to hook into that, which sucks
 
@IvoWetzel you can if you pass out a normal object and have a hashed equivelant internally. you cant detect it on the fly. But you can look for it when the user calls .save() or .update()
 
10:40 AM
0
Q: embed dll in html <object>

RaynosI've come across some old code <object id="foo" classid="/location/bar.dll#ProjectName.ClassName" viewastext></object> It doesn't currently work and used to work in older versions of IE. I've never come across embedding a dll in a web page like this. It appears to be a windows .NET...

This is absurd.
 
@Raynos To answer your question about Firefox support, the chances of it happening is almost nil. The almost there would account for, say, rewriting the thing as a Firefox add-on or plugin
 
@YiJiang It's a hideous activeX thing where you can port a windows application directly into IE and only run it locally or something
 
(shhh I'm here.)
 
@ClemDesm OMFG WHERE WERE U WE WERE LOOKING ALL OVER TEH PLACE FOR U!!!
 
(shhh I said)
 
11:11 AM
@Raynos If it's the answer, post it as an answer to your own question instead of editing it...
 
@ClemDesm it don't think its the answer
 
11:59 AM
$(document).ready(function() {
     ...
     $(document).ready(function() {
          ...
     });
     ...
});
The above is redundant right? I can't think of any good reason to nest them. (I can imagine the cause being based on auto generated code or regex find and replace)
 
@Raynos Drop it
(yes it is redundant)
and won't even work since ready one fires once
 
12:54 PM
@IvoWetzel it will work because its clever. Any calls to .ready after its fire will run immediatly
@IvoWetzel are you sure there is nothing like .__defineProperty__ Where I can intercept not just setters & getters of properties but also creation of properties
 
@Raynos At least not in V8
 
@IvoWetzel I could .preventExtensions
 
1:06 PM
Preventing extensions is the best solution. The rest I can do with getter/setter overwriting.
 
1:33 PM
@IvoWetzel look into why node-proxy can do it and we can't.
 
link
 
1:49 PM
Hi @ircmaxell
 
Good morning
(or afternoon or evening)
 
(or night)
 
good *
 
Well, I consider good night to be a departing endearment rather than a meeting one.
If it's not one thing, it's another... sigh...
 
@IvoWetzel that doesn't count, use eval or regex please.
 
1:55 PM
Good (morning|afternoon|evening)
 
/Good (morning|afternoon|evening|night|\w+)/
 
Special SO question for @ircmaxell
4
Q: Ashamed to admit using jQuery?

Matt StevensSomething I've noticed over the past few weeks is how many big commercial websites use jQuery combined with lots of plugins - but don't admit it. They will rename the main library to something obscure, as well as the plugins. Quite a few will even remove the comments that contain the MIT/GPL lice...

 
Today's DailyWTF: thedailywtf.com/Articles/WasDogKicked.aspx - People prone to exploding on seeing bad JavaScript like @IvoWetzel might want to refrain from clicking through
 
@ClemDesm hehehe, yeah, that's an interesting one...
 
@YiJiang ...
 
2:00 PM
if (0!=0) {
        t=setTimeout("sessionTimeout()",360000)
        }
 
@ircmaxell Brilliant, right?
 
Well, it does take into account our universe suddenly collapsing into one in which 0 is identical to null. You have got to give him (or her) credit for defensive programming...
2
 
Behold! I present to you, greeting, the ultimate!
eval("document.write(new Array(\"Good\", new RegExp(\"(morning|noon|afternoon|evening|night)\").exec(new Array(\"morning\", \"noon\", \"afternoon\", \"evening\", \"night\")[Math.floor(5 * Math.random() * Math.random())])[1]).join(\" \"))");
 
uhhhh....
 
What? Should I drop it and totally use jQuery?
 
2:07 PM
is still trying to figure out what's going on there...
And it'll favor earlier in the day much more than later
 
Ugly...I hate escaped quotes
 
@MichaelAngstadt Well I tried to make it as ugly as possible :P
 
@IvoWetzel Haha, you succeeded! :)
 
You could have done worse...
There's no inner eval, and no global variables
 
@ircmaxell nO wai! Math.random() * Math.random() is ever moarz randoms
 
2:09 PM
(not to mention a lot of other things)
 
Oh I see what it is now, lol
 
eval("array = new Array(\"morning\", \"noon\", \"afternoon\", \"evening\", \"night\");length=0;while(array[length])length++;if(0==0)document.write(new Array(\"Good\", new RegExp(\"(morning|noon|afternoon|evening|night)\").exec(array[Math.floor(length * Math.random() * Math.random())])[1]).join(\" \"))");
want more?
 
getting better, but still could use some more voodoo
 
e.g.?
 
use your imagination. I want to see at least 2kb of source code
 
2:16 PM
@ircmaxell Woah, reverse code golf!
 
hehehe
Yup
 
@ircmaxell Hm I could create a mini language with a regex based parser and then execute that...
 
@IvoWetzel You need holidays.
 
@ClemDesm No, he need a job
2
 
I could also write a node.js server which server a random greeting...
then write some broken ajax thing to request it and parse it out...
 
2:18 PM
Actually, let's make a golf: Make the most perverse and abused method that's at least 2kb long (bonus points for longer, double bonus points for longer while still seeming necessary) that prints at random a string that matches the following regex: ^Good (Morning|Afternoon|Evening|Night)$
 
or no, I'll post it on a VB forum, then request that page an then parse it out
@ircmaxell I'll try
 
I HATE WINDOWS
ARG
 
@ircmaxell then that's not "golf"
 
I wish the colonel could explain to you how windows is awesome.
 
lol
 
2:23 PM
I only came over here for that, I've got work to attend
 
@drachenstern: Code bowling... Better?
 
Windows was using 8gb of page file, when there was 8gb of ram free. Not to mention that there was only 1 application running which uses 256mb ram. So 16gb of ram used (eating the entire HDD) for 256mb required...
 
@Raynos OK, with C++ that should be doable
 
@IvoWetzel >_< its an extension to node rather then written in javascript. I only bothered to read the javascript tests rather then the src. Proxies are supported in Firefox 4
 
2:28 PM
And FF3 with FoxyProxy
 
Is it considered cheating to answer a javascript & node.js question with an extension to node written in C++ that implements new "native" objects/methods for you?
 
@ircmaxell Welcome into the world of tomorroowwwww
 
@ircmaxell different use of proxy I think. Were talking about the ES5 Harmony proxies
 
@Raynos If it's not possible with node.js natively, then I think it should be okay
 
@Raynos Which is?
 
2:31 PM
@ircmaxell A hook to catch setters/getters and the like
You wrap an object in a proxy and whenever you do anything with the object it goes through hooked functions
 
Ahhh, proxy pattern...
gotcha
ECMA Script 5 (ES5, I got ya now)
 
1
Q: Javascript object encapsulation that tracks changes

RaynosIs it possible to create an object container where changes can be tracked Said object is a complex nested object of data. (compliant with JSON). The wrapper allows you to get the object, and save changes, without specifically stating what the changes are Does there exist a design pattern for t...

It's something I wish to use to solve the above issue. This is also what I meant when I wanted to remove my current solution to it which is deep cloning/copying. Do you have any alternative suggestions? (@ircmaxell)
 
Well, you could use a proxy to monitor changes... But I'm not sure that's the proper use of the pattern... sourcemaking.com/design_patterns/proxy
My suggestion is to track the changes as they are made onto a stack
(etiher by diffing, or as the one answer said serialization)
that way you just need to replay the stack from where you last left off. It'll make keeping track of everything a lot easier...
 
@ircmaxell isn't serialization just as bad as deep cloning
 
from what standpoint?
What's so bad about deep-cloning?
 
2:46 PM
oh gosh what I'm creating...
 
@ircmaxell deep cloning in javascript feels painful. It just seems wrong to make deep copies in javascript
@IvoWetzel what are yo udoing wrong?
 
@Raynos: You could redesign your application so you weren't pushing deep-objects into the history, but for your given design, it seems to be the best solution...
 
@ircmaxell or I could use a proxy, and track setters/getters in real time and keep a running history on one object
 
that's not the purpose of a proxy as far as I understand it, but you could
That's more of a decorator
 
@ircmaxell I dont actaully need to use a proxy
a combination of overwiting getters/setters & using .preventExtensions works fine
 
2:55 PM
dang only 1.4 kb so far
 
But even with tracking the setters/getters in real time, you're still deep-cloning
 
@IvoWetzel of what?
 
@Raynos: that's a decorator then, not a proxy...
 
@Raynos Code Bowling
 
@ircmaxell sorry I dont actaully know what either of those are. I'm not a proper software designer.
 
@ircmaxell something like that
 
One of BestBuy's Guarantee exclusions:
Personal	items	left in the product (you are responsible for removing all personal items from the product
before service is performed); parts and services
covered under your product ’s manufacturer’s warranty; remote control reprogramming; damage due
to contact with any human or animal bodily fluids, or
secondary damages.
 
Okkkkkkkkkkayyyyy
rand = Math.random
tims = new Array()
timeString = "morning,afternoon,evening,night"
timesCount=4
makeArray(timeString, timesCount)
greeting = null

function makeArray(data,max){
        ex = regeExFromStr("[a-zA-Z]+", "g")
        while(m= ex.exec(data))if(tims.length< max)tims.push(m[0])
        return tims
}

function formatGreting(){
        mesage ="Good " + randm
        msglength=0
        while(mesage[msglength])msglength++
        console.log(msglength)
        captialisised=''
        for(i=0;i <msglength; i++)
dang missing 26 bytes
gonna add them :P
ok a couple more indents and I'm at 2055
 
3:13 PM
function stringIsDifferent(a,b) {
        ex=regeExFromStr("^"+b+"$","i")
        same=ex.test(b)
        return
            istrue(same)
}
Wow... that's all I can really say
 
Aaaaaaaand... we have a winner!!!
 
Guess that's what you call negative application of knowledge
This is the worst code I've ever written, but hey it was fun!
 
@IvoWetzel, you have just earned yourself a place beside Enterprise Fizz-Buzz!
 
Now all I have to do is to add one subtle bug and post it on SO
(of course as some random 1 rep user)
 
3:15 PM
HAHAHAHAHA
 
of course there are a ton of bugs in there
but it still works :D
Because all of them make it work in the first place
 
add a special character to one of the options, so it'll bork the stringIsDifferent regex ;-)
 
you didn't read the code, you fail :P
the comparison doesn't work
never
first it compares b to b
and then it returns undefined
which evaluates to false
 
HA!
isn't used to JS semantics
 
@ircmaxell And now go and open up that Anti-CodeGolf on SO / Programmers
 
3:25 PM
hehehe
 
function istrue(value){
        bool = new Boolean(value)
        if(bool==true)
            return true

        else
            return false
}
I just love that.
 
can be improved
 
Asking question now...
What tags?
 
code-golf rosetta-stone etc?
 
jquery
 
3:32 PM
:D
 
since jquery = javascript for some person
 
Code-Bowling Output Random-String intentionally-bad-code bloatware
 
great
now I've done it
 
not sure about the last one
 
I ended up in a endless loop
DEBUG THAT(!!!!)
 
3:33 PM
lol
Wait, I can't make a CW from the initial post anymore?
 
nope, but I guess we can edit the hell outta it
 
wait, I can't make it a CW even after editing. What?
 
so it switches to CW mode
 
0
Q: Make an application that displays text at random that conforms to the specified regex

ircmaxellOk, so in the spirit of Code-Golf, I'm trying out something new here: Code-Bowling. In golf, you try to get the lowest score (smallest application, most elegant, etc). In Bowling, you try to get the highest score. So if you follow, the goal of a Code-Bowling challenge is to make the biggest, m...

 
go guys edit it :P
 
3:37 PM
I'm really curious what happened to the CW button
 
31
A: What can we do to make Community Wiki better?

wafflesImportant Change - Status completed Users can not mark questions wiki anymore, across the network. I have an easy idea for a fix. Disable the option to mark questions community wiki by the question author. (allow them to become CW naturally if thats what GxD wants, or allow moderators to) ...

 
Fair enough
 
ahhhh
got it
 
But I figured since I had 10k rep, I could...
 
global variables
@YiJiang How many edits does it take again to make it CW?
 
3:41 PM
@IvoWetzel 10 from OP, or 5 from 5 different users
 
7 to go then @ircmaxell
 
I think it's 10 per users, with 5 unique users actually. Or something. Whatever.
 
I can't edit, I can't play, I'm sad.
 
Can't another 10k make it CW?
 
only mods
 
3:42 PM
Dam line between 10k and mods. We can do most, but not all...
Uhhh... Why is it +0 when there was 1 up-vote and 0 down-votes?
 
@ircmaxell Actually, we can't do most, only watch
 
Ahh, there we go
@YiJiang: we can do most, just not individually. It's a group effort...
I don't care about the rep from it (although I wouldn't mind the badges, since I don't ask many questions)
 
well it most likely will get closed without CW
 
that too
No close votes or -1s yet, with 24 views, so maybe we might be on to something
 
Is there some fancy way to create a small popup dialog like when pressing the username in this chat? My main concern is how to position the container next to the mouse, and having it appear below or above depending on space on the screen.
*jQuery
brb
 
3:50 PM
@raRaRa For positioning, you'll want to look at jQuery's positioning functions, together with absolute positioning.
 
@raRaRa use event.mouseX or something like that
 
OK added a few more bugs
 
@IvoWetzel I'll outdo you and write it in raw jQuery :)
 
rand = Math.random;
tims = new Array()
timeString = "morning ,afternoon,evening, night"
    timesCount=4
makeArray(timeString, timesCount)
greeting = null

function makeArray(data,max){
        ex = regeExFromStr("[a-zA-Z]+", "g")
        while(m= ex.exec(data))if(tims.length< max)tims.push(m[0])
        return tims }

function formatGreting(){
        mesage ="Good " + randm;
        msglength=0
        while(mesage[msglength])msglength++
        captialisised=""
        for(i=0;i <msglength; i++)
oh wait I have more ideas
 
@IvoWetzel I don't see you modifying the Object prototype yet :D
 
4:04 PM
@YiJiang Ah good idea :)
you know
you never know
it'd be better if all object had caching of their lengths!
 
@IvoWetzel Oh boy...
 
someone can write some demonic call text stuff? :D
 
\o/
 
with fails
so hard
 
just earned my first golden badge
 
4:11 PM
with(this) doesn't work correctly!
@ClemDesm Congraaaaaaaaaaaaaaaatluations
 
@ClemDesm grats
 
rand = Math.random;
tims = Array()
timeString = "morning ,afternoon,evening, night"
    timesCount=4
makeArray(timeString, timesCount)
greeting = null

String.prototype['getChar'] =function(big,p){
return String.fromCharCode(big!=false? this.charCodeAt(p)-32: this.charCodeAt(p)) }

function makeArray(data,max){
        ex = regeExFromStr('[a-zA-Z]+', "g")
        while(m= ex.exec(data))if(tims.length< max)tims.push(m[0])
        return tims }

function formatGreting(){
        mesage ="Good " + randm;
Oh and random() * random() really does its job
It's almost never night!
 
4:31 PM
0
A: Make an application that displays text at random that conforms to the specified regex

ircmaxellHere's one from me, in PHP. There are at least a few WTFs in it, at least a few bugs, and way too much over-engineering. Enjoy... <?php class RandomString { protected $options = array(); protected $lenght = 0; public function __construct(array $options) { $this->optio...

Congrats @ClemDesm!!!
 
posted
and I don't even want rep for that thing
 
I might try to use as many browser specific methods as possible. And then have the thing crash and burn on every browser but IE4 for macintosh. Alternatively writing a piece of code that runs & only runs on IE4 macintosh is an achievement of sorts
 
Use some old behavior of arguments?
 
+1 @IvoWetzel
 
Do UA sniffing and do a alert and tell the user his browser fails and is da sukx if you're using anything other than IE4?
 
4:37 PM
:D
@Raynos Add in some ActiveX
then you can go even more crazy in the C code
 
Anyone have experience with multiple rulesets (say, a wizard) in jquery validation?
 
is it just me or is the syntax highlighting on that question broken?
stringIsDifferent is really my favorite
 
It is @IvoWetzel
 
@Chance I have some. Show me a jsfiddle or jsbin.
 
it's broken on so many levels
 
4:41 PM
@IvoWetzel I'm pretty sure it's because of the tag based syntax inferring
 
@ircmaxell I knew, it Nick's only working at SO for week and he starts breaking things
 
Since no language related tag is given, syntax highlighting is turned off
 
@NickCraver can you fix SO?
 
Ahhh
that makes sense
(not really, but ok
 
@YiJiang That's stupid, the highlighting sucks even if there are tags
 
4:43 PM
@ircmaxell No, indeed it doesn't make sense
But it's the only reasonable explanation I can give
 
Well, it makes sense from the is reasonable standpoint
 
So anyone wants to post that thing on HN when it gets a couple more answers? :P
@YiJiang That's like saying the world is flat because you don't know any better :P
 
HN?
 
@Raynos - sorry, its not as clean as i'd like
 
4:46 PM
@Chance Compared to the thing I just wrote this is a dream :D
 
Ahhh
 
but yeah, could need some DRYing
 
@IvoWetzel opinion on www.gammajs.org please
 
Go for it!
(it's up to 73 views already, not much more to get really high)
 
@Chance I see a large block of code. Whats the actaul question? Rather then "make it better"
 
4:48 PM
@Raynos sorry, here's my question which may be a bit more clear stackoverflow.com/questions/4626913/…
 
but you know what was really hard, adding all the typos...
 
@Raynos I've basically defined 3 different sets of validation options with their own rules / messages. Each time I need to validate a given fieldset, I am trying to validate with the given option set. The problem appears to be that once I validate a form with an optionset, every subsequent validation uses that optionset, regardless of what i pass it
 
@Chance whats wrong with removing rules and adding new ones? Rather then passing a ruleset, write a function that cleans the rules out and adds new rules from the ruleset
 
@ircmaxell You should have used $$ or even $$$$ :D
:kitten quote
 
> "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning." - Rick Cook
 
4:53 PM
@CodingKitten Gimme that one about perverted proffesionals
 
@IvoWetzel Programmer (n): An organism that instead ><
 
<>
 
@CodingKitten Instead what?
 
@IvoWetzel It's executable line noise
 
ahhh
@CodingKitten So a programmer is executable line noise?
 
4:54 PM
@IvoWetzel The sooner we fall behind, the job offers there are US
 
@Raynos ive tried performing a .rules('remove') at the form level but that doesnt seem to wrok
 
@CodingKitten Brilliant! You always say the truth!
 
@YiJiang Anyway, should I think I'm pretty sure they ought to be private
 
@Raynos based on the docs, looks like its element specific
 
@CodingKitten Yes, you should think they ought to be private.
 
4:55 PM
@YiJiang > that instead >< Does your alert work?
 
@IvoWetzel: I wasn't going for fubar. I was going for over-engineering with a bit of not-invented-here thrown in
 
@ircmaxell See I was just going for your 08/15 JS code in the intertubez
 
Well, that's the beauty of Code-Bowling, you can pick a number of different meanings of it.
 
Code-Golf is dead, long live Code-Bowling!
@CodingKitten You want to bowl too?
 
Either from making a 2 line program into 200 by over-enigneering, making the dirtiest code you can imagine, solving another problem which just by chance appears to solve the original, etc...
 
4:57 PM
@IvoWetzel I still want something superior :P
 
@CodingKitten :(
 
@IvoWetzel Indeed isn't free >:( JS questions for last couple of weeks just plain suck so much. So yeah, you'll get there. Soon
 
Nice, it neatly spliced together our two messages complaining about how recent JS questions on SO suck
 
00:00 - 17:0017:00 - 00:00

« first day (83 days earlier)      last day (4848 days later) »