« first day (406 days earlier)      last day (4542 days later) » 
02:00 - 16:0016:00 - 00:00

2:00 AM
g'day
 
hey
 
how's it going ?
 
I destroyed my blog :(
 
how'd you do that ?
 
by taking the blog server down
destructively
it ran on node 0.4, I now need to reboot it on 0.6
 
2:07 AM
Interesting
I'm at a hackfest
working on some JS
waiting for my team member to finish the response to my XHR
 
anybody wants to help me finish a jquery script? there is soemthing i cant figure out
 
1 message moved to bin
Two flags already, blah...
 
2:23 AM
Since I destroyed my blog
and I need to set up a new host
Whats a friendly way of telling people I will be back up soon
I guess I need any old web server with a flag
 
3:15 AM
@sebas I will if you email me at shawn@weebuild.biz
 
@Shawn31313 thats weird :\
 
Hi All, I'm new to StackOverflow. Am I allowed to ask questions here?
 
Yes
if they are sensible
 
What exactly do you mean by sensible? I'm learning jQuery and sometimes I have basic questions that don't seem appropriate for a full blown question. Is the chat room appropriate for that? I guess I'm just trying to understand how best to use the chat functionality of StackOverflow.
 
3:32 AM
sensible as in good questions not "please be free tech support" or "please do my work for me"
You just chat and talk
feel free to ask
 
Great, I found a post on json eval() vs parse() from '09 that says some browsers don't support parse(). Has this changed? Is parse() fully supported? And if not, can I use jQuery to abstract-away the difference?
 
@jp_hill caniuse.com/json - browser support
 
Wow, that's perfect. Thank you!
 
Thats why we include json2.js for IE<8 :)
 
jQuery has api.jquery.com/jQuery.parseJSON which you can use
I'm not entirely sure the tag excerpt needs the "JavaScript is not Java" warning
 
3:41 AM
for the record parseJSON uses eval
 
The excerpt is already far too long
@Raynos AFAIK it just uses json2.js
Which uses eval after sanitizing the JSON
 
@YiJiang jQuery does not come bundled with json2
thats madness
I mean it borrows some regular expressions from json2, yes
it uses a tiny subset of json2
 
I mean, yeah, not all of json2, that would include JSON.stringify which jQuery doesn't need
It doesn't actually use eval, but new Function does the same thing
 
...
look at the json2 source code
oh wait
Im an idiot
they pretty much did just include json2
 
@Raynos They do that, if the browser doesn't have native JSON
 
4:01 AM
hello friends, Good morning
i here with one issue
how to hide the cursor from text field
 
;_;
Why would you ever want to do that
and I'm sure there a caret option in CSS
 
@gowri its afternoon in here :P
 
@alFReDNSH: timezone issue... lol
 
@gowri u can do #textField { cursor:none; }
 
@alFReDNSH: i will try it.Thanks
 
4:08 AM
@alFReDNSH First, you spelt cursor wrong
 
hi folks; can the existence of 2 forms on a page prevent the onsubmit function of the forms not to work?
 
Second, that hides the mouse cursor, not the caret
 
whistling
 
anyone here?
 
@YiJiang but works, i just tried it
 
4:11 AM
@alFReDNSH: not working for me
 
@alFReDNSH Doesn't work on Firefox
Just tried it, the mouse cursor disappears, but the text caret is still there
 
well he wants the cursor
 
@alFReDNSH Ah, read the question wrong. I blame @Raynos :P
 
@YiJiang:you are right
 
well if you want the caret, you should forget using html textbox I think!
 
4:14 AM
it's not working in ff. it hides in mouse pointer in chrome
 
are we talking about the cursor or the caret(the blinking thingy)?
 
@alFReDNSH: caret
 
@gowri Oh, for goodness sakes make yourself clear the next time
They are different things
 
@YiJiang: sorry about confusion. any solusion
 
No, you can't hide the caret.
 
4:17 AM
blur actually works but. i attached another function in blur.so can't do it
@YiJiang:that's really bad for me. anyway thanks for your advice
 
@gowri jsbin.com/ihobe4 check this out
 
@alFReDNSH: yes tried the same
but as i said i can't use blur
 
its not blur... it makes another textbox
 
i can't see the code in ur jsbin
 
@gowri add edit to url -> jsbin.com/ihobe4/edit
 
4:27 AM
@alFReDNSH: i ll try that
 
I need help with some javascript code
 
@user705339 ask the question, don't say that u have a question pls! its annoying :P
 
if (document.registration){ var form_name; form_name = document.registration;
$('#registration').bind('submit', function(){alert('working'); return CheckRegistration(this);});
$(form_name.registration_btn).bind('click', function(){return CheckRegistration(form_name);});}
});
registration is the name of the form
and the id also
when the button is clicked, the code works fine
but if the enter key is pressed, nothing happens
I can't seem to figure out what the problem is
can the existence of another form on the same page cause the problem?
 
why don't u listen for enter key?
 
@alFReDNSH: I solved it. i replaced text box as span.Thanks
 
4:34 AM
@gowri clever idea!
 
@YiJiang:thanks you too
 
on submit should work; I've used it multiple times , just not sure why it's not working this time
 
is if (undefined === curr) or if ('undefined' === typeof curr) better in terms of forward compatibility (ECMA5)?
 
@user705339: of course form id should be unique
 
it is unique
 
4:39 AM
gowri, what were you trying to do?
 
I see why it's not working
 
It sounds like you simply switched the element based on if it works or not and NOT on the context of using the correct element.
 
I was using the button type of input, instead of the submit type
 
@user705339 can you reproduce the problem in a jsfiddle?
 
What is the specific problem?
 
4:40 AM
I've solved it; my submit button was <input type="button" value="Submit" />, instead of <input type="submit" value="Submit" />
 
Use classes on input elements for good compatibility.
 
once I switched it to type="submit", it worked perfectly
 
<input class="button" in example or <input class="text"
 
thanks for the help though
 
Your form was not submitting?
 
4:42 AM
onSubmit wasn't working
 
Gotcha. :-D
 
is there a way to prevent the form from not submitting, even if JS was disabled?
 
With JavaScript disabled no unless you remove type="submit" from the form...but technically I could client-side inject that and still post the form.
You should be checking for necessary conditions (e.g. <?php isset($_POST['whatever']) before handling a request.
 
how can u use client-side inject to post the form?
yeah...I always do that
 
If all the conditions aren't met slap them with a 403 and log it to a 403 log, if it's a $_POST request log print_r($_POST) as well.
Firebug or ANYTHING that can manipulate the DOM.
 
4:44 AM
@John dear server, I enabled your form submit. problem? troll!
 
lol you can troll in that way I suppose
Always be ready to accept a request and able to deny it at the server REGARDLESS of what is at the client.
JavaScript writes out easier the opposite way...if (acceptable condition) {} else {can't do that}
 
@John thats why they invented server-side validation! be prepared for the trolls!
 
Where as with PHP it's easier to do the upfront rejection, but if I had my choice I'd keep it as it is.
 
@John how can you client-side inject a form?
 
Yes. :-)
easy...
Use ANY developer tool that lets you manipulate the DOM.
Gecko / Firefox --> Firebug
 
4:46 AM
@user705339 if using chrome, just open up console... :P
 
Presto / Opera --> Dragonfly
CTRL+SHIFT+J
for Chrome but if you're going to use Chrome don't...one sec...
SRWare Iron
Use that instead, it's Chrome without Google spying on you.
 
use chromium then!
 
You can real-time edit the DOM, add attributes, elements, etc and pretty much inject ANYTHING you want.
 
hmm...thanks for the information; wasn't aware of such injections until now
 
How do I quickly use @ in chat alfred?
NEVER trust the client, for good reason.
 
4:49 AM
@John type @ , type the first char, hit tab!
 
dirty man who looks homeless approaches you I have a business proposition that will make you lots of money, please step in to the alle...my office over between these two buildings.
 
I never do
 
@alFReDNSH sweet thanks!
Do you log errors?
I log 403, PHP, MySQL and JavaScript errors.
It's VERY useful to do so, you can start fixing your own errors and make your work much more valuable...and then eventually once you've cleaned the errors up that only other people in embarrasing situations can find that you can't...you'll see other stuff there instead such as say, failed SQL injections.
 
how/where do u log JavaScript errors?
 
Most JavaScript errors I get are bogus, lots of people mess with address bar javascript: on my site which makes error reporting a bit redundant, but the other reports can give you a big fat red flag about someone looking to cause trouble BEFORE they become successful.
 
4:53 AM
there are I think libraries for that..
 
error event handler, one sec.
window.onerror=error_report;
that's the function you assign it to.
 
but error handlers can only log it on the client, unless u ajax it
 
Works in ALL browsers except Opera however someone at Opera TENTATIVELY confirmed that Opera 12 (? I think) will support that event.
I use AJAX. :-P
function error_report(msg,url,line)
var param = '&ajax=1&javascript=error&msg='+encodeURIComponent(msg)+'&url='+encodeURICompone‌​nt(url)+'&line='+encodeURIComponent(line)+'&browser='+browser+'&browser_version='‌​+browser_version+'&section='+section+'&page='+page;
 
nice
 
Set your parameters that way and submit it to the server.
Now there's a couple things to consider....
Browsers are buggy as HELL.
But also people like to test stuff sometimes.
At least on my site so...
You may not want to record line 0 or line 1 errors.
I've also tried tracking the cursor position to hunt down the more miscellaneous errors though that didn't work out so well LoL.
If you have really good coding practices (consistency that makes your XHTML / CSS easier) it'll be easier to track issues down.
PHP's error handling is thankfully easier.
brb phone
 
5:34 AM
Anybody here??
 
yes?
 
0
Q: Regex Remove some text

Dileep DilI have a Regex and replace function to replace some CSS. i have some CSS Classes in a variable. so var BodyContent = "body{background:red;width:450;}"; BodyContent = BodyContent.replace(/background:\s*([^;]+)/ ,""); alert(BodyContent ) // returns "body{;width:450;}"; But it doesn't remov...

@island205 Could you please help me to figure out this problem ? its something about Regex.
 
5:54 AM
it solved.
 
@DileepDil yes i see
i am not good at Regex
 
@island205, Im intrigued, how long have you been programming in javascript?
 
then maybe you should learn
 
@Kayote one year maybe
 
not bad for a yr, you seem to be quite fluent
 
5:57 AM
@Kayote but i can't remember the fuck rules and symbols
 
@island205 , playing with something like rexv.org helps a lot
 
@tereško tks.i will try!
 
after getting some flak from Raynos & Matt, Im reading up on Closures :)
 
@Kayote how nice they are
@Kayote what's the meaning of 'reading up on Closures'?
do you mean the "Closures" in javascript?
 
6:25 AM
@island205 :), they are cool enough, they do help a lot of people
readingup, as in learning about
 
 
2 hours later…
8:48 AM
guys i am using jquery v1.7, which i use to open tabs and here is what i am using
<script>
$("#galery").live("click", function(){
$("#menu_div1").load("<?=ROOT_PATH?>ajax/div_opengallerypages.php?user_id=<?=$user_id;?>");
// document.getElementById("menu1").load("t.php");

document.getElementById("menu_div2").style.display='none';
document.getElementById("menu_div1").style.display='block';
});</script>
now when page gets loaded i need to show a loader like ajax pages, Where shud i put it??
 
9:05 AM
@Sibu , XHR has has in progress and on success stages
use them
of course that will require you to use proper XHR methods instead of the stupid $.load() method
 
@tereško can you explain by an example??
 
you are "jquery programmer" so read the damned manual : api.jquery.com/jQuery.ajax
 
10:05 AM
hi
 
hi hi!
 
 
1 hour later…
11:34 AM
 
12:02 PM
got to level 10
@Amaan but i still dont get it what are the rules
 
Seriously?
Well, you grow that circle thing
 
is the limit on tries or time
 
Both
 
then you should add indication about both of them
 
Indication? Is the timer on the left, and the cirplosions on the right not enough?
Oh, wait. By tries, you didn't mean explosions
Limit's on time and explosions (clicks)
Attempts just reduce the number of points you get
 
12:10 PM
well .. the lvl10 is not fair
is that , or the bubble grows too slow
 
Hah. The levels are the same as they are in the original Flash version of the game
Nope. Bubble grows the same in all the levels.
 
@Amaan great game
 
@island205 Thanks
The game idea isn't mine though
 
i still say that level 10 is not fair
 
Hahaha. I could make it a little easier if you wanted
 
12:13 PM
@Amaan haha
 
i could make it easier myself
 
@tereško let the speed down
 
@tereško Yeah? Tell me how you do it (if you do it using JavaScript)
 
by adding a breakpoint
 
A breakpoint? I've never used them so I don't know
 
12:16 PM
@tereško how genius you are!
 
@tereško How would you do it by adding a breakpoint?
 
@Amaan debug
 
by giving player more time or more "bubbles"
 
Yeah, but you can't do that, because all of those variables are private
 
hell , i can even just view source in opera , edit you JS as apply changes
 
12:27 PM
Oh
 
@tereško, remember the code you gave me some time ago..., where i was telling it isnt good for me.
it turns out it is good.So i want to apologize that i was arrogant that time...
 
honestly , i do not remember
was it that "generating tree" thing ?
 
was a tree of array's to build
yes
still not can use it as i should,but that is my failing
0
Q: jquery-mobile multilevel menu with multilevel array

wHiTeHaTThe equivalent php version of what i want is answered here: Creating a multilevel array using parentIds in PHP I'm following a jquery mobile documentation for dynamic page generation. The goal here is to follow links and generate the "next" pages from an provided array. The documentation is pro...

 
1:01 PM
hello
 
hello my friend!
 
o/
 
LOL
 
@island205 nice, any idea on the performance?
 
@alFReDNSH i know the performance is low
 
is ES6 related to this?
 
and i think the future of javascript will take over then
them
like as coffeescript move and so on
 
well the thing is that web is not based on non-developers and lazy ones, its based on the performance...
 
2:08 PM
@alFReDNSH yes, i agree with you
@alFReDNSH and my opinion is that in the future,js would take over of them.
 
definitely...
 
@alFReDNSH definitely
 
move is very silly
 
2:27 PM
well coffescript looked silly to me :P
but it gained a lot of audience!
 
just learn javascript
 
@alFReDNSH my audience.
 
coffeescript is a joke as well
 
@Raynos but i consider that they are the JS's Pioneers
 
user50049
2:53 PM
Howdy folks
 
hey there
 
Anyone wants to join about 6000 ppl and watch NASA mars lunch?
 
user50049
We recently had an old question come back to the surface:
 
user50049
277
Q: Current commonly accepted best practices around code organization in JavaScript

HugowareAs JavaScript frameworks like jQuery make client side web applications richer and more functional, I've started to notice one problem... How in the world do you keep this organized? Put all your handlers in one spot and write functions for all the events? Create function/classes to wrap all yo...

 
user50049
2:55 PM
Would any of you folks be interested in cleaning it up?
 
@TimPost How would you want us to help?
 
user50049
There are some helpful answers there, I'd like to keep them around, but the question is going to need some work, and the 'not so good' answers need to be flagged, or moved into some of the better ones.
 
user50049
Just reviewing the question resulted in learning a few things, and evaluating how I keep some of my work projects organized. So I think the answers are surely worth keeping.
 
user50049
I just don't know how the question itself could be asked more objectively.
 
user50049
Or, is it really worth saving?
 
3:01 PM
I don't think there is a case for keeping this content on SO
The question itself is too broad
It is inherently subjective, so voting is a bit useless
 
user50049
That's what I thought. I just really appreciated a few of the answers
 
I agree with YiJiang in the sense of it being to broad
 
And the tips aren't organized in any meaningful manner
 
There are many areas here to cover, ranging from file level (code layout) to project level (tooling)
 
It would do better in a wiki or blog
 
user50049
3:02 PM
Alright, then we won't take any measures to prevent it from being deleted so it can be worked on. Thanks for looking at it :)
 
Seeing as I defended this question, I'll pipe in
 
If you look at the answers for instance, some deal with how to organize code that interfaces with the DOM, while others talk about how to write modular code
 
Keep in mind that I know nothing about Javascript
I see this question as asking how to cope with limitations of the language
namely, the lack of good features to organize code, such as a module system
Now my understanding may be off-the-mark due to my incompetence
Does JS have namespaces in any form?
 
It completely depends on your environment when it comes how to organize stuff e.g. Where I work we're using "Class" and "Module" wrappers combined with a full blown Python Toolchain for handling dependencies and optzimization
@Gilles foo.bar.blub.test.stuff = {}
enough namespacing I'd say :D
 
is . an ordinary character in identifiers?
is foo an entity of its own?
 
3:06 PM
foo will be another object
 
If so, then I don't see the major technical limitation to overcome
 
In JS, it's Objects all the way down
 
user50049
@Gilles There's also namespace in the language you use to actually render pages
 
@IvoWetzel JS is prototype-based, right?
 
user50049
Or, well, you hope there is, anyway :)
 
3:08 PM
@TimPost You mean the server-side languages?
 
user50049
@YiJiang Yes.
 
Hmm, ok
 
Well, if you're using node to server the page...
 
so there's more than way to do it, or things like it
 
user50049
Yes, barring node
 
3:10 PM
So this question does have its place
and it seems to have some decent answers, with explanations and sample code
 
Yes, the topic might be valid, but that doesn't mean the question itself is any good
 
(I can't judge if they're correct)
 
@TimPost how should it be "cleaned up" ?
 
15 mins ago, by Tim Post
There are some helpful answers there, I'd like to keep them around, but the question is going to need some work, and the 'not so good' answers need to be flagged, or moved into some of the better ones.
 
user50049
@Raynos Is there a particular objective question that the answers could speak to?
 
user50049
3:12 PM
If so, then the question needs to be edited more in that direction.
 
Because right now the question is loosely subjective, and overly broad
 
I see
I think the question can be pushed into "patterns for writing modular javascript"
 
user50049
I'm what I would consider .. just o.k. when it comes to JS. I write lots of control systems, and ultimately have to write a front end for them. Every time I do this, I lean heavily on Google Stack Overflow, so I'm not the best judge.
 
Basically it can be split into
 - define what a module is
 - how do you write modules
 - how do you share / load modules
its all about what code belongs in a single .js file and how to share code across multiple files
 
user50049
That's a bit out of scope of a general cleanup.
 
3:15 PM
Yeah I agree
 
user50049
Alright, well, clearly the thing for us (moderators) to do is nothing beyond what we've done.
 
user50049
The post and answers, however are CW, if someone feels like they could salvage it, editing is wide open.
 
user50049
Thanks all for taking the time to look at it :)
 
@TimPost no, the CW was reverted
it shouldn't have been CW in the first place, not in 2011
 
0
Q: Evaluate JavaScript document.write from external file in a div block

MatoeI know this question sounds rather confusing, yet let's see if I can explain this right: I have an outer .js file which contains a couple of document.write calls. As the URL from which I get this .js file is changeable, instead of adding a <script src> tag to my div element, I decided to e...

 
3:24 PM
@TimPost I can try cleaning it up, but I think ill refactor it too heavy
 
user50049
@Raynos It's out there. It will take a lot of votes to delete at this point, so it's not going anywhere in the near or even distant future. If someone works on it and thinks it's in good shape, they can flag it. I'm inclined at this point to not do anything else (as a mod).
 
IMHO, @TimPost , that optimizaion topic contains almost nothing related to optimization
it turned into "which is my favorite library"
and how the hell "closed as not constructive" turns into community wiki ?
 
user50049
The mod that originally handled it made it CW, presumably so the post would be easier to curate over time. I don't think that was a bad action to take.
 
It's only 1030am and I figured out how to hack free coffee coupons from @starbucks. Wondering if I should automate this or that's just evil.
 
user50049
The point of CW is to make things easier to maintain. Not to dodge the subjective nature of a question with 'nobody is getting rep for this!' .. so I think it was (and @Gilles will probably disagree) applied appropriately in this case.
 
3:41 PM
hI, could someone say why isnt this working $("#formi:text, #formi:textarea")
i want to select all textfields and textareas from form formi
 
@Olli In that case there should be a space between the :text and the id selector
 
$("#formi :text, #formi :textarea") ?
 
Yes
 
but it didn´t worked
it just sends the form normal way
not with AJAX
 
@Olli you code please
 
3:44 PM
:textarea doesn't exists
 
@Olli Where are you reading that selctors work like that?
 
Just select the element, textarea
 
gods below , protect us from jquery programmers !
 
@tereško I don't even understand where some of the confusions come from.
 
yes but i select textarea
 
3:46 PM
i think i do:
 
$("#formi :text, #formi :textarea").each(function() {
text is normal input type text
textarea is textarea
 
the most common method that jquery programmers use for developing code is copy-paste
 
@Olli Seriously, what do you think : does?
 
@Olli Like I said, the selector :textarea doesn't exist. Just use textarea.
@tereško So does most JavaScript developers, what's your point?
 
@tereško Right, I've entirely forgotten about that. :(
@YiJiang I think his attack was more on the "programmers" part.
 
3:48 PM
@YiJiang actually , i suspect that part of javascript "programmers" migrated to jquery ages ago
 
@YiJiang it started to work. Thank you for help ! actually it seems very confusing when other form elements have : and others not
 
@Olli is it a true css expression,#formi :text, #formi :textarea?
 
@Olli sigh. jQuery gives you the :text pseudo class as a shortcut. Do you understand how CSS pseudo elements are suppose to work?
:text actually means input[type="text"].
 
ah
i didnt know that
 
@island205 It's not a "real" CSS selector. :text does not exist in any CSS specifications
 
3:51 PM
thank you very much
i think it needs very clever from you
 
@Olli If you don't know what something does you need to ask.
 
but jquery treat this as input[type="text"?
 
You probably shouldn't be using :text anyways. They should've deprecated that long ago, and they are doing it now
@island205 Its a shortcut that Sizzle, the selector engine in jQuery, uses
 
it is a bad way,i think.
 
@YiJiang and what i should use instead of it
 
3:56 PM
Just use input[type="text"]
 
"Because :text is a jQuery extension and not part of the CSS specification, queries using :text cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. For better performance in modern browsers, use [type="text"] instead." quote from there
 
02:00 - 16:0016:00 - 00:00

« first day (406 days earlier)      last day (4542 days later) »