« first day (60 days earlier)      last day (4886 days later) » 

8:42 AM
I have this script pastebin.com/NBqfyAfu -- How can I post a link and continue in the script based on which link the users clicks (Y/N)?
 
Attach a click handler to the yes and no links which call some function that does your "continue" stuff
think event-based programming, you're done with * that code * once the AJAX request returned
 
ah, okay
so I have to call some ofter function with the click handlers?
 
okay, thanks
 
you can define it wherever you want, but you attach it to the links
 
8:45 AM
yes
 
jquery has some method to attach handlers to elements that dont exist yet... or you can inline it (<a onclick="something()"...)
 
@DanGrossman live, although Nick will tell you to use delegate if at all possible. Also, please don't use inline events
 
what's bad about inline?
 
8:49 AM
@DanGrossman Classical failure to not separate content and behavior - HTML is a Markup language, used for ascribing the semantics of contents, so JavaScript should be kept out of it
 
but the javascript is rewriting the markup which is creating new behavior which is creating new markup which is...
 
And anyway, since you're using jQuery, which abstracts away any potential problem you might have with using event handlers there's no real excuse to using inline events
@DanGrossman .live handles it just fine
 
I'm kinda depending on being "through" with the data processing in that first function
since it will return either false or true to the submit function
or is it a better way to solve this?
 
return false
in whichever yes/no is supposed to submit the form, call the form's submit event
 
hmmm, okay
but how to I "return true" from the spamFilter() next time it's evaluated?
 
8:59 AM
why should it return true the second time but not the first?
 
because the rest of the submit form function depends on it?
$('form#seek').submit(function() {
if(spamFilter()) {
 
in what way?
 
for the rest of the function to run?
 
then create a variable that tracks whether the spam filter was already run or not
 
okay, that easy
thanks =)
 
9:01 AM
if (already_filtered || spamFilter())
 
how do I keep it?
ah
 
9:37 AM
hi.
 
hey @Chouchenos
 
Is it possible to place a single iframe in quirksmode in IE8 ?
 
@Raynos Don't think so. You can give it a try, of course.
 
Ah, apparently iframe's are in quirksmode by default. No clue how to check this
 
@Raynos Really? That's interesting. You can check it by using document.compatMode
 
9:54 AM
I checked on the fiddle. Which is most interesting
Are html comments inside javascript files valid? Of course not. never mind
 
// or /*
 
@DanGrossman I know what a js comment is :P I wanted to see whether I could slip <!--[if IE lte 6]> <![endif]> into my code
 
10:31 AM
Can I open a new window and then just append stuff to its dom rather then giving it a url to a html document?
 
Me is back!
 
@DanGrossman ?
 
var win = window.open("");
win.document.body.appendChild(document.createElement("p"); // throws no such interface supported error
I take it cross window dom access is denied? :(
 
@CodingKitten \o/
 
10:45 AM
@YiJiang Goes to find a good music?
 
well I guess you should inilintially point the window to a blank page on the same domain
@CodingKitten I haz some good music for ya threshold.ocremix.org
 
@IvoWetzel Oh. Not as a standby, just images, buttons and the minimum event should be balanced :p
 
@Raynos you have to document.open(); before you can use it
 
@NickCraver thank you
 
10:51 AM
@NickCraver document.open(); document.write("foo");document.close(); What am I doing wrong?
 
win.document :)
 
ah im pointing at the wrong document :P
 
jsfiddle.net/nick_craver/R4EyM (disable popup blocker to see)
 
@NickCraver jsfiddle.net/Raynos/R4EyM/2 throws a no such interface supported in IE8. Works as expected in chrome
 
create elements in the same document ;)
 
10:56 AM
Why are you dynamically constructing popup window bodies anyway?
 
@DanGrossman printing
Thank you nick
 
Why in JavaScript?
 
@DanGrossman because ;_;
 
10:58 AM
@DanGrossman He likes the pain
 
You already have some code that produces the page, make the part that gets printed modular, make a second page, and both pages use that bit of code. Once inside a larger page and one with just that alone.
 
^----- Exactly that
 
Or in your favorite MVC framework, $page->setLayout('print_layout');
 
@DanGrossman PHP?!!!!!!
 
Why not?
Most of the non-static web is written in it...
 
11:00 AM
@DanGrossman Still... I used it for a couple of sites, then I wrote one using Python...
 
I have written in both languages, I still use PHP most
 
Dunno I just hat the syntax of PHP also every language that uses -> is pain on a german keyboard :(
 
Symfony is my preferred framework, same as Yahoo! Answers, Yahoo! Bookmarks, Delicious, Current TV, TED...
 
@DanGrossman Well if you like to build stuff with it, no problem, I probably would also code in PHP, that is, if I was getting paid to do so
 
I dont use frameworks :P
back-ends! psh!
 
11:07 AM
I remember a couple of years ago, I had to get the duration of MP3's with PHP...
I couldn't find any library back then, that would do the job for me
So I ended up writing a MP3 decoder in PHP >_>
 
shudder
 
2
Q: Get the length of an audio file php

Belgin FishHow I can get the length of an audio file in php. If it's too hard to do in php then any other way should work alright.

it's impossible to write large web apps without some kind of framework
if you don't use someone else's, you'll end up building your own piecemeal as you go
 
@TimStone MP3 alone is an abomination of a file format...
 
@NickCraver I cant quite do it like that. I need to clone large chunks of the parents window's dom into the new window, so the no such interface supported is an issue
 
@DanGrossman true, that's why I'm using them ! Mwhahaha ¬_¬
 
11:12 AM
@Raynos I have a feeling you're going to end up creating some kind of monster. Load up a Java applet to take a screenshot, render it into a canvas element, crop only the part you want to print, copy that canvas point by point into a canvas element in another window and print... or something equally horrific
 
0
Q: Get IE8 to print the correct iFrame

RaynosI am having issues getting an iframe printed in IE8 The solution needs to work in IE8 & quirks mode. Here is an example : http://jsfiddle.net/prq3k/18/ I've tried various variants and most of them print either the wrong iframe or an outer iframe. I've also tried creating a documentFragmen...

I just want to be able to print document fragments cross browser :(
 
hide everything but the fragment, print, unhide?
within the same document
 
@DanGrossman ew. Nope it needs to be invisible
 
what you're doing is already ew!
 
@DanGrossman Should be simple enough - you don't even need print stylesheets
@DanGrossman Seconded
 
11:15 AM
The issue is, I dont want to visually change the page whilst printing
 
why do you want your website to work different from the rest of the web
everyone knows how to go to a news article, click the print link, a window pops up pointing to a URL with a print version of the page and prints
the browser doesn't rearrange the world, the server just serves a print version
:stomach rumbles:
 
User complain if functionality of legacy code changes. It works in IE6 now I just need to get it to work in IE8
 
or... maybe... just use print and screen css ? :S
 
Once you're done, make sure you write up your code for thedailywtf.com
 
@DanGrossman :(
 
11:19 AM
1
A: What would be the math symbol for showing division

Andy EJudging by your comments, it looks like you're specifically asking how to display fractions. If that's the case, several fractions are defined as HTML entities, e.g. &frac12; will give you ½, and for the specific example in your question: &frac23; Result: ⅔. If you...

*sigh*
 
$HTTP_GET_VARS?
This stuff must've been written for PHP 3, which means 11 years ago or older
PHP was not a real language back then >_>
 
I learned it with this version while in college or high school u_u
 
Rasmus Lerdorf (creator of PHP) quotes:
> I really don't like programming. I built this tool to program less so that I could just reuse code.
> PHP is about as exciting as your toothbrush. You use it every day, it does the job, it is a simple tool, so what? Who would want to read about toothbrushes?
> I was really, really bad at writing parsers. I still am really bad at writing parsers.
> We have things like protected properties. We have abstract methods. We have all this stuff that your computer science teacher told you you should be using. I don't care about this crap at all.
> I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say "yeah it works but you're leaking memory everywhere. Perhaps we should fix that." I'll just restart apache every 10 requests.
> For all the folks getting excited about my quotes. Here is another - Yes, I am a terrible coder, but I am probably still better than you :)
 
And also
> I did not develop the PHP we know today. Dozens, if not hundreds of people, developed PHP. I was simply the first developer.
 
11:32 AM
Hehe yeah. PHP4 and on are Zend's baby, nothing like PHP3 and older.
 
0
Q: java programming

adnanhow to get table structre of a database in java?

@CodingKitten You KNWS?
 
@IvoWetzel After that, I went to interact with onclick I guess
 
Just reached 400 votes in the [html] tag... silver badge should be along shortly :-)
 
11:49 AM
Hi, all!
 
@Nyuszika7H no
 
@Chouchenos What?
 
Said no.
 
At my school, we've got new computers with Windows 7 Enterprise, and Flash Player isn't installed – that's required for lots of online games. I asked my teacher, she said “they don't have rights to install programs like that”. What the heck? They had right to install Office 2007 (a program that you must pay for – schools probably won't download it from torrent), and hadn't to Flash Player (which is free software)?
 
@CodingKitten Hello world!
 
11:54 AM
@YiJiang No, trying to your server then I'll be an exception. They need to find a problem just give commit rights to me.
 
Maybe you're not connected to your pc as administrator, therefor, can't install any new software on it.
 
@IvoWetzel What do you think? Do you want to give kitten rights to commit code? :P
 
@Chouchenos Yep, but why they can't install it with their user account?
 
@Nyuszika7H: maybe they don't want you playing online games
 
0
Q: Appending a button

oshirowanenI am trying to append a "remove" button to ul items on hover. It seems to work, but I can't seem to get the button to align to the right of the screen. Each time I try, it seems to go to the right and down one line. Here is the full script: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran...

 
11:56 AM
@AndyE LOL. Some weeks ago, the old (really old) computers had Flash Player installed (OS: WinXP).
 
Grrr... the fundamental problem here is that you really shouldn't do DOM manupilation like this on hover
@Nyuszika7H Be thankful you even got an upgrade. My school got new hardware, then downgraded them to XP
 
@YiJiang :O
 
@Nyuszika7H Maybe your teacher doesn't have the rights too on student's computer. And maybe the manager doesn't find any obligation to install it. "Seriously ? Flash player ? What for ? Spending brandwidth on youtube?"
 
@YiJiang Don't think that's a good idea.... it will eventually become SkyNet
 
@CodingKitten Will you?
 
12:03 PM
@YiJiang He seems to do a search with
 
@CodingKitten ...google?
 
@IvoWetzel Well, downtime is inevitable. It's too late to edit that overrides the body class
 
!kitten wob
D:
 
it's broken again -.-
!kitten wob
 
12:06 PM
chat link fail
 
@IvoWetzel Wrong URL - returning 404 for me
 
It's @IvoWetzel's fault
 
!kitten wob for real
 
It's radpins fault!
 
12:08 PM
hm guess it doesn't correctly resolve users from other sites then
 
@IvoWetzel It does - your URL was wrong
 
@YiJiang I was speaking about my code :P
 
Also, who's radpin?
 
@YiJiang Duh, you got the link !
 
@YiJiang Hm, SO user search failed
> radp > radpin
 
12:12 PM
@Chouchenos No, I mean why is he on the WOB
 
!kitten wisdom radp
 
Guess you're out of luck with radpin. Yawn I nearly fell asleep when checking their answers.
 
yep, search fails :(
 
!kitten wisdom Chouchenos
 
@IvoWetzel He's badp on other sites
 
12:12 PM
Guess you're out of luck with Chouchenos. Yawn I nearly fell asleep when checking their answers.
 
D:
I'll try every day
 
@YiJiang Then why was there an r in the WOB stuff? Oo
 
@IvoWetzel Because he's radp on MSO
See the family resemblance?
 
@YiJiang How should I know that? :( I just copy pasta'd the usernames from your script
 
12:14 PM
@IvoWetzel Spend more time on MSO :P
Anyway, the /profile command built into the chat script should be useful for this
 
what is the correct syntax for this: var concat = datavar . "foobar";
 
var concat = datavar + "foobar";
 
ahh.. of course
 
@DanGrossman: can you test something for me?
try adding a request
the try adding another
the you get a question
 
12:26 PM
I can't add one...
 
pressing the seek button didn't do anything
I don't know how to test this
 
ah, something I did.. 2 sec
 
@YiJiang Hey 10k :)
 
@IvoWetzel Be honest, were you the one who dropped the last two votes? :P
 
12:31 PM
@YiJiang Hey you made all the picture image Firefbug screenshotty thing and got only one up :(
Also it's widely known that the SO chat works like the Mafia, isn't it?
 
Wow these tools are shiny
Also, 70+ comments in two days O_o
2
A: How can using gettext help me here?

marioWhen you have been recommended to use gettext, it was actually an advise to use a gettext-like translation system. Your current code is complex because of mnemonic text indicies. And the trouble you got into with the regular expressions for editing is caused by fiddling with variables in there. L...

^ Courtesy of the 'most commented' data in the 10k tools
 
lol
 
Please, someone give me a link to SO's Markdown Editing Help!
 
Let me sum it up: "Hey wasn't the order $haystack, $needle?" "No I guess that changed it in X.X.X" "But he's using X.X.X" "Yeah then the order is...." "But the order of that other function is wrong too"..
 
@Nyuszika7H Just go to any question, then look for the editor
Or even better, in the ask question interface
The 10k tool pages are ugly... (goes off to work some magic with Stylish)
 
12:44 PM
function foobar { $.ajax { sucess: function(data) { how can I tell foobar to return true/false depending on data } } }
 
@LasseAKarlsen Uh, you can't, you need to provide another callback
 
hmm.. how?
 
isn't this what we did earlier with the spam check
 
I run spamFilter() yes, which get a respond from spam.php wether or not it's spam
inside the ajax
then I need for spamFilter() to either return true or false, depending on the data received from spam.php...
wrong approach?
 
you can't, foobar returned after the ajax request was queued, long before its response comes back. but you don't need spamFilter to return true or false depending on the data
 
12:50 PM
okay?
 
in your anonymous function that's getting called after the data returns (success), you can submit the form by calling the form's .submit() event
 
call that function you mean?
 
no that's you attaching ANOTHER function to the submit event
you're going to call submit itself, which will do what the browser always does when a form is submitted
success: function() { $('form#seek').submit(); }
you have to think in terms of events and event handlers, because your code does not run top to bottom like a procedure
 
I have problems thinking that way obv.. :)
so I can just skip function() inside that submit()?
 
you can think of it procedurally by moving your thought process up another abstraction layer
and imagine the javascript interpreter's internals and its event loop
 
12:55 PM
:-)
 
I'm not sure if it'll call your submit handler again, you should try it and find out
if it does, write a check to not call the spam filter again
if it doesn't, you're done
 
gotta love questions that can be greatly simplified, shame there aren't more in the day:
 
$('form#seek').submit(function() {
if(validateForm() && spamFilter()) {
 
1
Q: Problem solving, radio buttons adding values on textbox. Improving solution.

StarterI have a series of radio buttons (rdoGroup1,rdoGroup2,rdoGroup3) and three textboxes at the end of the table which each textbox txtTotalC will count the amount of radio buttons with C value have been selected, txtTotalB will count the amount of radio buttons with B value, txtTotalA will count th...

 
1:00 PM
is this a wrong approach?
 
I don't know, it depends on the answer to the last thing I mentioned
 
@LasseAKarlsen $('form#seek') should be just $('#seek'), it's much faster.
 
@NickCraver agreed
 
@Nyuszika7H You... do realize what stars in chatrooms are used for, right?
 
1:01 PM
then my problem is.. how can I write that check to not call the spam filter again?
since I can't do anything inside the ajax part of spamFilter()
 
I am not a JS expert, but I would make a variable in a higher scope (outside where you attach these event handlers) that you can access from both the submit handler and the ajax callback function
 
I'm just getting more and more confused :)
 
you set it in the ajax success handler, and check its value in the submit handler, to know whether spam checking already happened
 
even higher scope, okay
I tried inside the spamFilter() function, that obv didn't work
okay
 
1:23 PM
People should vote on the tag synonyms -.-
 
@DanGrossman: yes, exactly :-)
thanks
 
@IvoWetzel The problem is that they can't really vote on many of them
 
Amazon RDS is such a mess... they're billing me at the wrong rates now :(
 
@YiJiang Hm, yes there's only a handful of people with enough score on the tag, but one would think that they'd actually take a look at the synonyms page
 
I don't even know what a synonyms page is, and I have more than enough rep to edit tag pages...
you assume people know more than they do, and care more than they do
0
A: How to have a variable accessing through different class methods in PHP?

Dan GrossmanPlease read "Classes and Objects: The Basics" in the PHP manual: http://php.net/manual/en/language.oop5.php

:sigh:
 
1:32 PM
Good Day All...
 
hi @ircmaxell
 
....tagging it googlable any moment now..…
@CodingKitten do something
 
@IvoWetzel Yes you can. But you can't make it bigger to fit a little small though. Shame they said this works?
 
!kitten ban Coding Kitten
 
not enough rep, and it's not that stupid
 
1:38 PM
stupid to what
Coding Kitten never interacts with itself, the ban would have no effect
 
to ban itself
 
!kitten say !kitten ban Coding Kitten
 
Nice try, did you really think that would work? I mean, are you really that stupid?
 
maybe one day I'll remove the anti-self conversation check and then....
 
@IvoWetzel Let all hell break loose!
 
1:41 PM
How's it going?
 
@CodingKitten Answer him!
 
@IvoWetzel You Dimensions (L*W*D): 4"* 2.5" * 2" mean from LiquidWeb? an ARM CPU IIRC with flash HDD and javascript)
 
No, no, kitten. The TonidoPlug is not from LiquidWeb.
 
lol... It picked up some of what I said
 
@CodingKitten You'd like to live in such a plug?
 
1:44 PM
@IvoWetzel Personally I say avoid iframes like 30 minutes
 
@CodingKitten Why do you avoid 30 minutes in the first place?
 
@IvoWetzel Yes... But the CPU is fairly weak, so my co-dev was pressed, since that's the middle mouse click?
 
@CodingKitten You're using your co-workers as mice?
 
@IvoWetzel 102$ in God... rickrolled
 
@CodingKitten: Why is wireshark being so bloody slow?
 
1:45 PM
@ircmaxell We probably want someone to maintain performance, and decreases automatically during demand lulls to be balanced :p
 
Hm we should lower the minimum number of words
 
wow, that's actually reasonably on-topic... It's learning
 
so it can produce "I rickrolled God"
 
hi all!
 
@ircmaxell Confirmation bias, cough :P
 
1:46 PM
I, for one, welcome our new Coding Kitten Overlords...
 
@CodingKitten Sentient yet?
 
Me is back!
 
:confused:
 
@CodingKitten Some new, shorter, sentences for us?
 
@IvoWetzel uh, relying on the search picks random seeds to your pc as administrator, therefor, can't add one...
 
1:47 PM
@DanGrossman It was probably gone for a second when Ivo's connection cut out or something
 
@CodingKitten Sentient yet?
 
@DanGrossman Just go to any way to program less so it can produce "I rickrolled God"
 
@YiJiang: Yeah, but I asked about a performance problem with no mention of performance other than slow, and it responded with a blurb about performance. It doesn't matter if it's not exact, it's somewhat on-topic...
 
that was quick
@CodingKitten Do you know what performance means?
 
@DanGrossman you searched for document.createEvent?
 
1:48 PM
If anyone has the time; can anyone put some comment tags by a jsfiddle so i can understand it better and maybe simplify it?
 
Wow, didn't expect this answer to be so popular:
17
A: What would be the math symbol for showing division

Andy EJudging by your comments, it looks like you're specifically asking how to display fractions. If that's the case, many fractions are defined as HTML entities. As an example, a few of those entities are: &frac12; &frac14; &frac18; &frac23; &frac25; &frac34; &frac38; ...

 
this is the link jsfiddle.net/opoe/MQy6G
 
@AndyE: It's a good answer...
 
@Opoe Hm mootools broken in FX4
 
@IvoWetzel It's vanila JS, no library
 
1:49 PM
Isn't there a more appropriate site to ask about an HTML entity than SO, though? It's hardly programming...
 
@DanGrossman doctype.com sucks, so...
 
@YiJiang The framework is set to mootools here, hm but the page fails in mid load
 
@YiJiang lol...
 
@ircmaxell: thanks :-) when I posted it, there was already another answer with 8 votes, so I wasn't sure if it would be right or not. I'm still unsure, because the question is a little ambiguous. I'm not complaining though ;-)
 
Wow, talk about a come from behind!
 
1:50 PM
doctype isn't an SE site?
 
Okay wait my bad
 
@DanGrossman It's not
 
still fails since JSFiddle itself uses mootools :/
> (this.className + " " + l).clean is not a function
Looks like evil String.prototype extension....
 
strange..
 
1:53 PM
hey, without firebug it works...
 
@ircmaxell wow, just checked and it's the highest voted answer today and my third highest voted answer overall. Go me :-)
 
it only works for me if I drag outside of the window first
@AndyE! Nice! It's weird how sometimes the answer you least expect is huge, but the ones you think are on the money are underappreciated...
 
Oh my... Now I know why I hate Oracle.
 
@ircmaxell yeah that's so true
 
@Chouchenos hm?
 
1:55 PM
@IvoWetzel okay :o so without firebug it works is this my fault?
 
For example, this is a +9:
9
A: PHP Lazy Boolean Evaluation

ircmaxellYes it does. It's called short-circuit evaluation. See the comments on the documentation page... As for the order, it preforms the checks based on Operator Precedence and then left to right. So: A || B || C Will evaluate A first, and then B only if A is false, and C only if both A and B ar...

But this is a +0:
0
A: Edit 2 - PHP funciton to clean and escape any variable used in Dynamic MySQL - my Code.

ircmaxellOk, since you've edited your question and I better understand what you're trying to do, let me say this: Don't Do It! You will run into problems with the character set of the connection, differing collations, etc. There are a fair number of edge cases that you will likely miss and still be vul...

 
@Opoe Nope, most likely a bug with recent FX/FB versions
 
@IvoWetzel I used MySQL too much. Not same date management... Looked for hours for a solution.
 
@Opoe For assigning blame we use the WOB
!kitten wob
 
It's rcherns fault!
rchern, St. Louis, MO
1.9k 1 3 16
 
1:57 PM
haha what did she do :') its my fault
 
!kitten rchern
 
@Opoe: She's one of the channel's scape-goats...
 
oooh i see haha
 
@CodingKitten Anything new?
 
1:57 PM
@IvoWetzel me: Task Manager -> flex-4 -> flex-4 -> flex-4 -> kill task ie: "I noticed I know that? :(
 
@ircmaxell: +1 to both of those. Often the highest voted answers are the ones where users can see the result right in front of them (like in the case of my fractions answer). The lowest voted answers are the ones that are hardest to validate or solutions that aren't well known.
 
Yeah, quite true...
 
the more people understand the answer the higher the vote count
 
RTFM gets lots of upvotes
 
if you dig around in the source and pull up some code to verify a bug... chances are high you don't get a single up vote, although it gets accepted
 
1:59 PM
I find that the more references you give, the higher the upvote as well
 
I'm up to 8 "great comment" votes in few minutes
0
Q: Help with php Str_replace Function

RandyHi, i have the following 2 arrays that i am looking to replace variables from. However my problem is how to tell to not replace variables that are in %XX format. Right now 0 will get replaced with %30, and this will then again get replaced with %%330 (replaced 3 with %33). Any help greatly apprec...

 

« first day (60 days earlier)      last day (4886 days later) »