« first day (126 days earlier)      last day (4825 days later) » 

4:00 PM
Use non-greedy versions of .
 
@Raynos I've seen that
@Raynos how?
 
.*?
 
@IvoWetzel thats silly? This is JS :D
 
@Raynos search localization is a piss take
 
    var replaceExp = /([^\\]|^)\{([^\{\}]*[^\\^\}]|)\}/g,
        accessExp = /^\.?([^\.\[]+)|\[((-?\d+)|('|")(.*?[^\\])\4)\]/,
        formatExp = /\:([a-zA-Z]+)(\((.*?)\))?$/,
        argumentsExp = /^(,|^)\s*?((true|false|(-?\d+))|('|")(.*?([^\\]|\5))\5)/;
no that's JS regex...
 
4:01 PM
Why isn't it documented :(
 
@Raynos Nicely done man
 
@YiJiang but Regular expressions and the JS version there different
Or is there a standard that all reg exp engines implement?
 
@Raynos Well, the JS engine implements a subset of that I believe
The most common options should be available in all I believe
The site also has a compatibility table if you want
 
/^(?:foo|bar){1}\1{1}$/ will this work? It should match foofoo and barbar
 
4:08 PM
@IvoWetzel im failling into your trap of not using comments
Its just so easy to not use comments :)
 
:D
Well I try to add more comments in recent code
I'm also going to add comments for the regexp above
 
Is my code going to get raped in codereview.SE ?
 
although I have a ton of tests
 
I need to write more tests -.-
 
Depends, if you get lucky, someone with no clue about JS posts an "improved" version :)
the fomatto has ~ uh... 70?
 
4:09 PM
Its a pain in the ass to test a testing framework using the testing framework
 
@IvoWetzel like me :D
 
I have to write proper documentation ;_;
 
guess I'll post fomatto for review later
 
Would anyone like to recommend an API documentation tool
Not looking for auto generated comments from code
 
4:14 PM
Does that ping you?
1 message moved to Sandbox
 
jsfiddle.net/Nyuszika7H/Ahb4B/8 Check it out now! [url]http://google.com[/url] for textless link.
 
Hmm anger issues :P
 
@MylesGray with mine? what kind of issues?
 
@Nyuszika7H no not you, Raynos
 
@MylesGray :)
 
4:20 PM
This does not amuse me.
 
Does that ping you?
 
1 message moved to Sandbox
 
I hat gh-pages
 
hi all again
 
i wanted 4, stupid room control thingy
@Raynos Why?
 
4:23 PM
4 messages moved to Sandbox
@IvoWetzel showing you how it's done.
@IvoWetzel I keep developing on gh-pages rather then master and keep fucking up with merges
 
:362832 Using CSS, use the counter property
 
@deostroll stop doing that >_<
 
my mistake sorry.
i was trying to edit. hide face
@YiJiang so wht numbering system is that?
 
Remove and edit are different
@deostroll think its natural numbers. You know, 0,1,2,3,4,5,6,7,8,9,...
 
4:31 PM
@Raynos tragically i didn't find a confirmation box asking me to actually delete
 
@deostroll Well no, because it would be incredibly annoying if that would be the case
Especially if you're cleaning up multiple messages
 
Indeed, if I want to delete, delete it
and not like windows "Oh you really wanna move this to the recycle bin?"
-.-
RAGE
 
And ah, yes, it called a hierarchical numbering system, thnx to @YiJiang
and as to the deleting, purely me error, in the last attempt. Actually in all three attempts. I wanted to edit, but I kept deleting.
 
@IvoWetzel SHIFT+DELETE windows: Are you sure? YES windows: Are you really sure? YES windows: this will be permanent RAGE
@deostroll its cool.
 
@deostroll Pressing up will edit your last message
 
4:38 PM
@deostroll And pessing down will format your hard drives.
 
And ignoring @Nyuszika7H will cause you to not have to see messages like that again :P
 
Pleased with this:
Mind you my answer to point ratio is shit
its amazing what having 10K+ does to your accept and vote up rate
 
yes 10k has a big influence
made the last 1k with just a few answers
everything were up votes accepts of older answers
 
@IvoWetzel Also because you're like... uh, the only answerer here?
 
I gotta stop answering questions from people with 1-30 rep and low accept rates
they just ask and then piss off
>.>
 
4:46 PM
I wasn't very active on the node.js tag in the last month
 
speaking of node...
0
A: Node.js: Get Response Time

Ivo WetzelThere's no builtin function or value to get the response time. But you can easily get the value yourself. var http = require('http'); var start = new Date(); http.get({host: 'google.com', port: 80}, function(res) { console.log('Request took:', new Date() - start, 'ms'); });

 
Speaking of node.js It's awesome
 
definitely
speaking of weekends, they suck
 
@MylesGray it gets better after 3k. Get about 50 random rep a day Admittedly I wasted 1k of rep in bonuses :P
 
4:52 PM
well, ok only in this special case
 
@Raynos It was a lot more than 1K was it not?
2x350 and 1x500?
1.2K :P
 
wooooooohhh watch out! how much more that is :P
 
200... that makes a big difference to someone like me :P
 
@MylesGray its small change.
I've had other bounties of 50 & 100
 
@Raynos What is a vectorized parameter? - Tried Googling, all I got was calculus vectors
 
4:54 PM
Probably 1.5k total
@MylesGray in context?
 
Not sure
but just do id="id1;id2;id3"
 
I've tried adding php etc but that doesnt work
so I did "120"
and it brings up a load of info about a person
Zach someoneorother
 
id is a number
Cmon!
its a unique id attached to each SO user
 
Well in that case... I haven't asked ANY questions O_o
lies
 
4:59 PM
My bad
Looks like its the id
for a question
 
of the tag?
ohh
 
@MylesGray It's the question id
 
3
Q: ASP.NET Site Maps

Zack PetersonHas anyone got experience creating SQL-based ASP.NET site-map providers? I've got the default XML web.sitemap file working properly with my Menu and SiteMapPath controls. But I'll need a way for the users of my site to create and modify pages dynamically. I'll need to tie page viewing permissi...

 
If you want to search for questions by tag use the /search route
 
@YiJiang Cheers man
 
Is unix epoch time just the time from 0AD?
in seconds
 
@MylesGray 1st Jan 1970
 
Why the hell did they choose that O_o
 
> Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.
 
well there you go :P
 
5:09 PM
@MylesGray Practical reasons, because if you choose something like 0AD the size of the number will overflow integers on most systems
 
year 2038!
aaaaaahhhhh
 
Oh okay fair enough, just random to choose the likes of 1970 when they could have chosen 2000 and started in negative
 
2000 was so far away back then
 
well, its less than the number is now :P
 
0
Q: Refactoring this unit testing function

RaynosI've got this javascript function which was written a bit ad-hoc and I'm not really sure how to go about refactoring and improving it. It's basically an implementation of draft Unit-Testing/1.1 specification. // Runs the object as a test. The async paramater is an optional function // To be pas...

Hell's yeah! I love shameless plugs.
 
5:21 PM
Unix time converter :D
 
\o/
Chrome 11 vs IE6
IE has to catch up a tiny little bit
 
@IvoWetzel You are running IE in WINE though
so it's definatly not a fair test due to the virtualization layer
 
@IvoWetzel I'm surprised that IE6 even passes all the tests
 
That's still faster than Win7 on the Netbook
There are worlds between Ubuntu and Win7 on the netbook...
 
you didn't try and run win7 on a netbook did you :P
 
5:25 PM
It was pre-installed...
 
@IvoWetzel epic. win7 on a netbook.
 
was it one of those HP ones?
theyre really nice
 
No, an eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee pc
I like it (as long as it runs Ubuntu, windows.... RAGE)
 
this.element = this.element; GOLD. he wins the price for redundant code
 
5:27 PM
@Raynos Tautological code is Tautological :P
 
@IvoWetzel run chameleon and dual boot OS X onto that beast ;)
 
And then, test IE5.5 Mac? :D
 
guys, how to get name of function that send ajax request?
 
@IvoWetzel exactly! :D
 
@Mirgorod You can't, unless you somehow pass it in
 
5:30 PM
For jQuery it's always $.ajax :P
 
help where can I upload SVG images?
 
@Nyuszika7H Dropbox?
 
page is http://nakolesah.ru/
when onchange select with id "ctl00_contentPlaceHolder_ddlSizeVendorsAuto" -> post request to http://nakolesah.ru/

And i have no idea how JS creates this post request...
 
@YiJiang Nope - dropbox doesn't even hand png's right
 
@YiJiang Maybe, but I have to register, and that takes even more time…
 
5:31 PM
@Nyuszika7H Wikipedia :P
 
any idea?
 
@Mirgorod Like we said, there's no way, unless you pass something in explicitly
 
what means explicitly?
aa
 
@Mirgorod naming convention like that make me want to murder people
 
oh my god :(
 
5:35 PM
@Raynos I believe that's automatically generated by ASP.NET. Either that or it's the spry framework with Dreamweaver
 
@Raynos was your name fidel castro in your previous life?
 
@Mirgorod If you want the name of the of the function that's responsible for the ajax call on the server for instance you'll have to include that information in the data you send to the server; there's no way for the server to infer from the request itself what instigated the call
 
I keep telling myself I don't need one of these but my brain is saying "YOU NEEED IT" :(
 
@YiJiang @Mirgorod using ASP.NET makes me want to ...
 
it's not my site :D
 
5:38 PM
Objects name like that are fine. There auto generated. never manually mess with auto generated code.
 
i am freelancer
 
Either use the ASP.NET back end abstractions completely
or don't do it.
Accessing them by id directly rather then throught he high level ASP.NET abstrations is mis-using the tool & hacking.
@MylesGray no impulse buying
 
this fu ASP.NET :(
 
@Raynos Can't resist - I know I shouldn't... But I also need a new phone - Android based maybe but I can't resist waiting for the iPhone 5 too
I hate technology ;(
 
why i can get result of every page with help of php curl in asp except ajax? :(((
 
5:43 PM
@Mirgorod I cannot understand what are you trying to ask here
 
how to get name of function or line of code wich sends this ajax post request
 
@IvoWetzel is it possible to create a boundless array in JS?
 
@Mirgorod You can't, not by inspecting the ajax request itself. You can try to get Firebug to break on XHR, but that may or may not help, depending on the code
 
@MylesGray Uh, define "boundless"
 
as in one I can just keep adding new values to
without defining an initial size
e.g. var tagArray = new Array[];
 
5:46 PM
foo = []
for(var i = 0; i < 10000; i++) foo.push(i)
you don't have to declare any initial size
the implementation are most likely array lists
 
@IvoWetzel so just run a push/pop?
 
yeah
 
don't push pop's run as LIFO?
 
@Mirgorod why is that relevant. The fact that you rely on means your codes bad. Refactor the damn code.
@MylesGray no push/pop are to the end shift/unshift are to the front
 
@Raynos this is not my site. I making parser
 
5:55 PM
So for say the user add's php to their subscribed tags, how do i specify it's location in the array if they want to remove it?
 
foo.splice(foo.indexOf('php'), 1)
 
@IvoWetzel what does splice do?
 
@Nyuszika7H I was wondering that too, I was just googling cause I didn't want ot look thick
 
@MylesGray Splice removes and inserts array elements
 
@YiJiang So it runs a search for the term and removes it?
 
6:07 PM
@MylesGray Array.splice(startIndex, removeCount, insertElement1, insertElement2, ... insertElementN)
 
I may just use a normal array then use array.sort(); to sort alphabetically and then use a binary search to remove and add
 
The search part is indexOf's job
Oh, and splice returns the removed elements in an array.
 
@YiJiang but what if I don't know the key-word's index in the array?
 
3 mins ago, by Yi Jiang
The search part is indexOf's job
 
Sorry I misunderstood that, thanks :)
 
6:12 PM
But remember to check for indexOf returning -1, or else splice will remove the last array element
 
0
A: Looking for improvements on my jQuery-UI tagging widget

RaynosCocky comment saying that this is almost max-optimized deserves a harsh review. I don't know anything about the $.widget, from my brief look of it none of my comments can be ignored because it's "Something you need to do to play nicely with the $.widget". just ctrl-f //* (function($) { $....

Is it harsh to call him cocky?
 
user1385191
hahaha he's my age
 
user1385191
he's just impatient
 
@MattMcDonald you look 30 :)
 
user1385191
uh that's rob halford of judas priest fame
 
user1385191
6:16 PM
not me
 
@Raynos lol
 
@Raynos A few of the comments are not entirely relevant, the last one in particular about destroy isn't warranted because all $.widget elements need a destroy function
 
@MattMcDonald you must appreciate good music then :D
 
I believe you have to reset it not for the garbage collector but... hmmm, well maybe it's redundant code
 
@YiJiang I can understand that. I was just commenting that he really shouldnt destory the array
Removing things from the DOM on the destroy method would be better
 
6:18 PM
Can't comment because it's been a while since I looked at jQuery UI code
 
I'll leave a comment saying that you aught to clean up the DOM not JS
 
Anyway upvotes on CR questions are pretty meaningless, surely he'd known that?
 
user1385191
I still can't wrap my head around using "this" everywhere in JS. I know what it means and its usage, but it just reads wrong in my mind.
 
@MattMcDonald Why?
@YiJiang I also realised my method of reviewing by injecting comments into code makes it hard for anyone but the OP to see what's wrong with it
 
@Raynos Just search for WTF and replace with TODO if you're the one developing the code :P
 
6:21 PM
:D
 
user1385191
I understand it's used for public vars, but OOP JS is still weird to me
 
            //*WTF Why are you removing the selected class from the last
            // li on every key down press? This really could use a comment.
            if (lastLi.hasClass('selected'))
                lastLi.removeClass('selected');
 
Yeah I don't get why He would do that on every key down
 
You also miss the fact that the check is totally unnecessary since you can't remove a class that isn't there
 
I didn't get that far :P
 
6:23 PM
Bigger problems, yes :P But it's something to note for him when writing that in the future
        //* Style issue. i don't like passing html strings around.
        /*
            this.input = $("<input></input>");
            this.input.addClass("tagit-input");
            this.input[0].type = "text";
            var li = $("<li></li>");
            li.addClass("tagit-new");
            li.append(this.input);
            this.element.empty();
            this.element.append(li);
Why not use the new 1.4 syntax?
 
Because I was lazy
You mean
 
Isn't that more code to write?
 
user1385191
reading that code and seeing curly braces missing after if/for blocks makes me mad
 
Hi! :)
 
$("<input></input", {
     "class": "tagit-input",
     "type": "text"
});
@YiJiang I really don't like HTML strings. I always use DOM manipulation
and I use document.createElement("input")
 
6:26 PM
@Raynos Yeah, but no need for that second </input>, just <input> should do
There's an IE-only problem that it won't let you change the type of input elements, so you'll have to pass it <input type="text" /> though, which is annoying
 
var input = $('<input>', {class: 'tagit-input', type: 'text'}),
    li    = $('<li>', {class: 'tagit-new'});

li.append(input);
 
@YiJiang I found some bugs with passing in "<foo>" So I got in the habit of always closing the tags
 
@Raynos I sort of doubt that, because they use regex to catch <foo> input strings, so that they can use createElement
So it should make no difference
 
@YiJiang My code stopped breaking when i changed $("<td>") to $("<td></td>")!! Yes it's just my paranoia. I swear jQuery says to always close them
"To ensure cross-platform compatibility, the snippet must be well-formed. Tags that can contain other elements should be paired with a closing tag:"
So if you want to append to it make sure it is well formed
 
if (typeof selector === "string") {
    match = quickExpr.exec(selector);
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
 
6:37 PM
How do I define the innertext of an element?
 
user1385191
.innerHTML?
 
I have a span and I want to insert some generated text into it
I thought there was an innerText function too?
 
@MylesGray .innerHTML will usually do, but if you want that you'll need to set both innerText and textContent
(innerText is IE, textContent is Mozilla; all other browsers support both AFAIK)
 
user1385191
you can create a text node through the DOM as well and append it
 
hmm aparrently I can't do this: document.getElementById('humanTime').innerHTML(convertedDate);
 
6:40 PM
@MylesGray innerHTML is a property not a function
 
user1385191
.innerHTML = convertedDate
 
god damn it
 
@MylesGray Too much jQuery for you my good sir!
 
@YiJiang yes ashamed - I want to code everything I do in straight JS so i understand the language from now on
 
user1385191
atta boy
 
user1385191
6:42 PM
mixing and matching will benefit you well in the future
 
Oh, and setting innerHTML will require you to escape < s
 
@YiJiang Thank you :)
function addToTagArray() {
    for (var i = 0; i < 10000; i++) {
        tagArray.push(i);
    }
}
That is my add to array function
but how do I make it add an inserted value to array
it seems it has an upper limit of 10K?
 
@MylesGray What do you mean by that?
 
Ivo said earlier on your me to use a for loop to push the new tags into the array
but i'm not quite sure how he intended it to work
 
uh, that was just a demonstration that arrays have no predefined size limit
 
6:47 PM
@IvoWetzel Ohh okay.. understood
I just get a linter error when I dont define an upper bound
 
2
A: Looking for improvements on my jQuery-UI tagging widget

RaynosCocky comment saying that this is almost max-optimized deserves a harsh review. I don't know anything about the $.widget, from my brief look of it none of my comments can be ignored because it's "Something you need to do to play nicely with the $.widget". Admittedly there are no obvious mistak...

Added some more useful information rather then having all the reviewing in the cocde
 
user1385191
reads a lot better
 
@MylesGray your going to just write a subset of jQuery to abstract away cross-browser dom manipulation. What your learning is not JS but your learning the bastardized DOM which is not implemented properly anywhere.
 
@Raynos say what?
 
@Raynos Not really, people are far too touchy about touching the DOM
 
6:50 PM
@MylesGray no your just going crazy

var array = [];
array.push("I'm a string");
array.push(42);
array.push({ "foobaz": "I'm valid!" });
 
A lot of it is cross-browser compatible, and the bit that isn't are mostly just naming conventions
 
No-one made a review for me :(
CodeReview really needs to work on that instant feedback things SO has going
 
@Raynos Not yet, it's not easy reviewing that amount of code. (I'm not reviewing it, by the way)
@Raynos Too few people, too much code - it takes time to write good reviews
 
@YiJiang I know. I just did one.
Most of the time its like woh over 50 likes. CBA.
 
Main problem there's not much code to get reviewed atm
 
6:57 PM
@IvoWetzel Want me to add some more code?
 
@IvoWetzel Yeah, the question volume is really low
 
Gonna post my fomatto thingy
 
@IvoWetzel I'm going to rip it to shreds
 

« first day (126 days earlier)      last day (4825 days later) »