« first day (24 days earlier)      last day (4929 days later) » 

5:00 PM
all you're doing is changing the mode the client uses to process the request
 
shoots @Tom
 
you're trying to play by the rules of security setup to protect your online banking account
so here's the two options:
do what the browser requires to maintain security
or give me your bank account login info
the whole point of the XHR domain sanity check is to prevent stuff like malicious scripts, like the kind that monitor your login info on bankofamerica.com
 
I must be tired, 'cause now I see a lot of questions on SO I don't even understand...
 
@Chouchenos did you see the latest blog from jeff?
Posted by Jeff Atwood on November 9th, 2010

As I mentioned in The Horror of No Answer: Revival and Necromancer:

It’s fine — expected, even — for there to be a “long tail” of questions that are too obscure, too narrow, or just plain unanswerable for whatever reason. Sometimes you have to be patient; it takes the time it takes. But seeing the number of zero-answer questions grow by 50% over a 3 month period is definitely concerning.

Part of this is our fault for not adapting the homepage to the massive amount of question activity that Stack Overflow now enjoys. We’re working on it, but it will take some time to figure out the right approach.  …

 
@Tom, the file is not being delivered over the web, so there is no origin. You can't load scripts from your local machine when your page's origin is not your local machine. If you could, then any website could load files from your local machine ... which would be very bad.
 
Tom
5:03 PM
@drachenstern, yeah, anyway, $.getJSON(HBPBLoader.scripts[counter], function() { } still results in the same error
 
and they could write to your local machine too @dlongley also bad
 
Tom
@dlongley that's the thing, my page's origin is on my local machine
 
$().ready(function(){
var url = 'http://www.panoramio.com/wapi/data/get_photos?v=1&key=dummykey&tag=test&offset=0&length=20&minx=-30&miny=0&maxx=0&maxy=150&callback=?';
$.get(url, function(data) {
// can use 'data' in here...
});
});
@Tom once the page is in memory it quits caring about where it came from
 
Tom
@drachenstern, what?
 
but you're trying to use HTTP to load another script?
if your page wasn't loaded over HTTP, you won't be able to load scripts over HTTP.
 
5:04 PM
$.getJSON('http://www.panoramio.com/wapi/data/get_photos?v=1&key=dummykey&tag=test&offset=0&length=20&callback=?&minx=-30&miny=0&maxx=0&maxy=150',
function(json) {
alert(json.photos[1].photoUrl);
});
 
Tom
@dlongley I don't know what method jQuery uses
 
did you see those two examples?
 
it uses HTTP
 
Tom
@drachenstern yes, in fact I read that thread before you linked it to me already
 
@Tom stop using "file//" thats the error
 
5:05 PM
Then you don't understand the problem that's my point
@Raynos no it's not,
@Raynos what he wants is perfectly valid
he just has to change the request method
 
Tom
It should be. If one has to run simple html/js files from a server that'd be idiotic
 
@Tom, the "file://" schema won't load using HTTP. jQuery loads using HTTP. So when you use jQuery to load a script, it is trying to load using a method that is different from your original page, hence the error.
 
24 mins ago, by Andy E
Use * instead of null for the value of Access-Control-Allow-Origin
 
@drachenstern by changing the request method you mean using JSONP for cross browser origin ?
 
@drachenstern Well, thanks for pointing that out. But still, I just read question that I tagged and I understand why there are more, but not why a lot of them can't be understand =_=
 
Tom
5:06 PM
@dlongley that makes sense. Thanks.
 
@Tom, you can include scripts from your local machine if your page is from your local machine, the problem is that jQuery isn't doing that. Sure :)
 
Tom
I'm still not sure what alternative method to use for file:// origins though.
$.getJSON("./folder/file.js", function() { }); results in the same origin error
 
there is probably a "load()" method or something in jQuery.
.get() implies HTTP GET... so it's not what you want.
 
$.getJSON("file:///c/development/folder/file.js", function(json) { });
what if you try that syntax
 
5:10 PM
api.jquery.com/load ... there are some other people complaining about it not doing what they would expect in chrome but working in other browsers.
 
Tom
@drachenstern, tried that, no help
 
@dlongley seriously? that's no help
oh well f*me
 
@drachenstern, yeah, it's strange. still looking around...
well, there you go.
 
so then a) I look like a horse's ass, b) good to know for in the future, c) it's still a good idea to learn this stuff
 
Tom
d) I'll resort to firebug :)
 
5:14 PM
and by "learn this stuff" I mean to understand how XHR works
 
Tom
and thanks for the help
 
wish I could've been more help sooner with less blood pressure raising
 
Tom
@drachenstern believe it or not I know what is meant by XHR
 
eh, horse's asses don't look that bad.
 
@tom I figured you did
 
5:16 PM
I feel like Im too much of a high level user :(
jQuery spoils me. I've never even created a XHR object
 
that's a good thing.
 
@Raynos you shouldn't resort to creating them yourself, unless you must. But it's helpful to know how the frameworks manage these things for you so that you understand what the limitations are
 
I mean I didnt even understand how underlying http request works until a while back
 
if you do ever create one yourself, you should only do it twice, once to learn, and once to write a wrapper. ;) and at that point, start using jQuery :p
 
so if you wanted to create a secure mashup without using a server-side proxy, how would you do it?
@anyone.
 
5:24 PM
@dlongley no clue. cant you just treat local host as a server?
 
@Raynos, what exactly do you mean by that?
btw, I'm sort of referencing this SO question: stackoverflow.com/questions/4060867/…
 
never mind. Misunderstood you
 
:)
 
@dlongley isnt that what SHTML is for?
 
@raynos, I don't know... I'll look at that.
 
5:28 PM
SHTML
Server Side Includes (SSI) is a simple interpreted server-side scripting language used almost exclusively for the web. The most frequent use of SSI is to include the contents of one or more files into a web page on a web server. For example, a web page containing a daily quote could include the quote by placing the following code into the file of the web page: With one change of the quote.txt file, all pages including the file will display the latest daily quote. The inclusion is not limited to files. In this very example, on a server that can run fortune, the output of it, a randomly se...
 
I don't think that's what this guy is looking for ...
 
@dlongley the way you suggested it is the way I would go on that answer, or at least a good start
 
@drachenstern, yeah I think he's looking for content that is client-authenticated, not server-authenticated ... which means SSI wouldn't do the trick.
 
no, I was defining what SHTML was
 
right, just saying.
 
5:30 PM
and I concur
 
good evening
home time.
 
@raynos, bye! :)
i wonder if this chat service will actually decrease the amount of easily searchable answers on SO...
it might be good to have a way to associate a question with an answer in the chat... provided that people would actually use it.
 
Tom
@dlongley chat is not really active, especially relative to the amount of visitors SO should have
 
@Tom true.
 
@Tom the chat is a very regular thing and only C++ / Javascript & C# (Objective C and android too. The tavern doesnt count) are semi active
 
Tom
5:35 PM
@Raynos hmm but Javascript is at the top of the active channels
Most often
 
you can always permalink the chat history
 
@Tom but half the people that talk here are here daily.
 
Tom
@Raynos yeah true, anyway I'll be back later
 
5:48 PM
/afk
 
6:02 PM
any function in js / jquery equal to substr(); in php (chars limit)
 
substr() exists in both php and javascript.
in php the signature is: substr(string, start, length), in javascript it is: string.substr(start, length)
 
ty
 
6:38 PM
@dlongley how can i substr if it's like this:
data.entry[ "media$group" ][ "media$description" ].$t.replace( /\n/g, '<br/>' )
 
6:52 PM
Can i save a data for the function youtubeFetchDataCallback in this:
$.getScript( 'http://gdata.youtube.com/feeds/api/videos/<?php echo $m; ?>?v=2&alt=json-in-script&callback=youtubeFetchDataCallback' );
 
/!afk
 
wb
 
danke schoen
 
Can i pass data for the function youtubeFetchDataCallback in this:
$.getScript( 'gdata.youtube.com/feeds/api/… echo $m; ?>?v=2&alt=json-in-script&callback=youtubeFetchDataCallback' );
e.g i pass data "mode" then inside the function i can alert(mode)
 
7:08 PM
that's pretty much how it works, yes. Now before I keep answering questions for you on this topic, I want you to show me the jquery api url for getscript
 
Tek
If I have:

$.get("page.php", function(data) {
});
$.post("page.php", function(data) {
});

How would I get the $.get() data callback to the $.post data callback?
 
you would have to nest them somehow, so for instance (since post may take longer than get) $.post('',function(postdata)){ $.get('',function(getdata){ }); });
 
Tek
ah, I didn't know $.get would work inside $.post's callback
 
Tek
thanks @drachenstern
 
7:14 PM
@Johnson ok, now do you see how to pass the data so you can alert it?
the very first bit of code on the page reads jQuery.getScript( url, [ success(data, textStatus) ] )
 
@drachenstern yes
 
so that means you will write: $.getScript( url, function(mode){ /*dostuff*/ alert(mode);});
 
@drachenstern But i need the mode in the function that it callbacks youtubeFetchDataCallback
 
then you would put youtubeFetchDataCallback(mode)
 
yes function youtubeFetchDataCallback(mode) {
...
}
Conclusion:
$.getScript( 'http://gdata.youtube.com/feeds/api/videos/<?php echo $m; ?>?v=2&alt=json-in-script&callback=youtubeFetchDataCallback', function(mode){ var mode = 'ha'; } );
then in function youtubeFetchDataCallback(mode) {, i can do alert(mode) and get "ha" ?
 
7:20 PM
try this instead:
$.getJSON( url, function(mode){ /*dostuff*/ alert(mode);});
 
I think we misunderstand eachother
i want to pass a data, e.g a user's id
so in the callback function i can work with it there
 
try my last snippet of code, just for the sake of trying it. Or did you?
if it's wrong please let me know, because I believe it to be correct...
 
I did halfway until i thought where the id is getting passed ?
(data)
I did now,
$.getJSON( 'http://gdata.youtube.com/feeds/api/videos/<?php echo $m; ?>?v=2', function(mode){
alert('mode');
});
i receive alert with 'mode' inside
 
why would you put 'mode'?
also, does the URL really have a php string in it?
 
i did alert(mode) and got null
Yes it needs it, as it's the founded videoid in the message
 
7:27 PM
ok, so it doesn't really have the php string in there, you're copying source
and I'm rereading something on jquery's website and I'm trying to give you a shortcut method but that does the wrong thing for what you want
sorry, try this instead:
$.ajax({
url: URL,
dataType: 'jsonp',
jsonpCallback: 'youtubeFetchDataCallback',
});
my apologies, it seems the documentation says or said two different things
 
i dont get anything now
With the $.ajax
 
grrr, is it jsonp or jsonpCallback ... does firebug show any response from the server on the ajax request?
 
data.entry is undefined
that means it runs the function, but doesnt pass anything in it
 
but does firebug show a response from youtube at all?
also, did you try changing the jsonpCallback to jsonp ? I see instances in both directions where that works and where it doesn't
 
yes it does
i get response and everything
dataType: 'jsonp',
 
7:32 PM
$.ajax({
url: URL,
dataType: 'jsonp',
jsonp: 'youtubeFetchDataCallback',
});
 
Now im getting "missing ; before statement" and that is from all the youtube response
think the other one is better
 
what url is it requesting in firebug?
 
But dont i need to pass the data from the json to youtubeFetchDataCallback
 
the callback does that for you
 
id adds &callback=youtubeFetchDataCallback
it adds *
now it works
i added &alt=json-in-script to the URL
it works like the other one, and now again how should i pass data?
just did: data: { test: 'bammmm' },
function youtubeFetchDataCallback( data, bla )
{
alert(bla);
Didnt work out.. "undefined"
 
7:44 PM
why do you expect two input parameters?
what does alert(data) do for the same code?
 
object object
i want to pass a parameter to the function
with the id of the message
so it knows which div element to show the youtube thumbnail in
 
ok, what does alert(data.test) show for the same code?
 
that's my issue
undefined
 
but data is an object?
 
yes
i can e.g do alert(data.entry[ "media$group" ][ "media$player" ].url);
and it comes out link to the youtube video
 
7:48 PM
what all elements are in data? where's the api documentation for that?
 
check this:
 
JSON-in-script output (aka JSONP) To request a response that wraps JSON in a script tag, use the alt=json-in-script parameter and add a callback function by adding the callback=functionName parameter.
which the alt=json-in-script is just what you had to add
 
yes, thats what i found out
 
7:50 PM
and you want the data id?
 
no
 
data.entry.id
 
I want to make a own "parameter/element" called msgId and inside it have <?php echo $msgid; ?> and then use it for the function
 
so you want the data that you passed to google for yourself?
 
I dont think you understand
forget the data
that everything is working just fine
I dont want anything from data.entry, and what came from the url
but i want to create a new parameter, to use in the function
 
7:53 PM
ya ya ya, you want the id that you gave to youtube in the first place
the problem is you don't get that back from google
 
NO
 
you have to manage that yourself
 
:P that's not what i want :P
noo please misunderstanding is happening here
 
I see that but I think I know what you want
 
Users writes messages to eachother, if the message contains a youtube link, $getJSON runs and show the youtube thumbnail in a div element
 
7:54 PM
where you inject <?php echo $m; ?> into the url earlier
you want the $m to track with the data, right?
 
Now the messages the users writes to eachother have an id and i want to pass that to the function
no not the $m.. $m contains the video id
but $msgid contains the message id i want to pass
/inject with the rest json
 
then you're going to have to maintain that on the page somewhere
I suggest a hash
hash on the videoID and get back the messageid
so when you get the videoid back from youtube, before you try and display anything, then you check the hash real quick, and get the message id out
and before you send the json request off, you add the video id and message id to the hash
or instead of hash above substitute dictionary or tuple array or pair of lists
 
What is hash?
Is that the only way?
 
it is the only way to correlate data between pre-jsonp and post-jsonp yes
because you can't get youtube (or anyone) to return just whatever data to your page
the point is to prevent malicious data
 
ahh
okay
 
7:59 PM
if you can pass just whatever and get it back, you could cause malicious data
 
Yes true..
okay
so hash? can you send me a api about that?
 
2 mins ago, by drachenstern
or instead of hash above substitute dictionary or tuple array or pair of lists
hash is just a word I was trying to use to indicate a key-value pair lookup
 
why making it easier for me to understand :P
harder*
 
I wasn't trying to make it harder
hash is a common programming term
A hash function is any well-defined procedure or mathematical function that converts a large, possibly variable-sized amount of data into a small datum, usually a single integer that may serve as an index to an array (cf. associative array). The values returned by a hash function are called hash values, hash codes, hash sums, checksums or simply hashes. Hash functions are mostly used to speed up table lookup or data comparison tasks—such as finding items in a database, detecting duplicated or similar records in a large file, finding similar stretches in DNA sequences, and so on. ...
 
so when you get the videoid back from youtube, before you try and display anything, then you check the hash real quick, and get the message id out <--
check the hash real quick, for what?
how is the coding of this?
 
example* so you dont think i just want stuff
 
before you jsonp you will: myHash[videoid] = messageid;
 
aha
 
after you jsonp you will reverse it to get it out
since you already have the videoid on response, yes?
so messageid = myHash[videoid];
 
yes
 
8:04 PM
and myHash is a global object, so everybody can talk to it nicely
 
do you need to make it global or is it default
 
don't define it in a function
put it in your head of your page
var myHash = new Object();
I think that would work
 
the videoid should be in the messageid?
But....here's the problem
 
myHash[videoid]
 
to why i asked all of this
is that what if the messages have more youtube links
it will all run this
and all turn out the same
because it all reads from myHash[videoid]
it's just like all elements gets prepended in <div class="showVideo"></div>
That's why i need the $msgid, to say what element to get prepended in e.g <div class="showVideo92"></div>
with the solution you provided with hash, will be the same issue
although just that it all uses same video id
assuming im going to ask a question for this..
 
8:12 PM
I'm confused (and was in another room discussing controls)
if the message has more youtube links, what does that have to do with anything?
store the returned data element in the jquery data for the message div
then you can have all the original returned information right there
 
8:56 PM
@Johnson, if you have more than 1 videoid per msgid, then you will just have more entries in myHash. If you have more than 1 msgid per videoid, then store them in an array. Once you've updated the message (doing whatever it is you need to do) per your callback, you can remove that particular message from the array so it won't be updated again.
 
@dlongley so my idea didn't sound terribly dumb? It's the only way I can consider to keep track of it out-of-bound with the json request
 
@drachenstern, seemed fine ... the callback from jsonp is going to be called without any sort of closure so you're going to have to grab the data from somewhere.
i'm not quite sure what issue Johnson is referring to with multiple youtube links etc. (probably due to minor language barriers), but it should be solvable using the method i suggested (i think).
 
I think he means the "associated videos" or whatever
"you might also like" or "related"
 
i guess a message might have more than 1 "related" video... but that's the easy case (just myHash[videoid1]=msg1, myHash[videoid2]=msg1)...
so i figured i'd cover the slightly more complex case of more than one message ID per video ID
anyway, hopefully he's already fixed it :)
 
but so here's my thought: it's already in json when he gets it, so he has a object of related videos already
he just has to keep track of that list somewhere, so I suggested attaching it to the jquery data for the messageid div
that has the json structure on it
 
9:11 PM
looking
 
/afk
 
yeah if that's what he's trying to do. i wasn't really sure what he was trying to do so i was just answering his immediate question so i didn't have to try to think of a complete solution to his overall problem :)
 
heheh, yeah, I've kindof already considered about 3/4 of it :\
 
hahaha, I blame @ElijahManor for the flood of users. (:
 
as well you should.
 
9:20 PM
ha ha nice
@rchern I thought more people should know
Welcome new people ;)
So can non-stackoverflow people get in here? is there a minimum rep you have to have?
 
fun to see how fast a tweet gets clicked :-)
 
yeah, you have to have 20 to participate
 
@maartenba yeah ;)
 
lol, that is kinda funny
now I gotta have all my little soiled undergarments flapping about in the breeze :p
 
@AndrewWirick welcome ;)
 
9:22 PM
howdy
 
ah well, I never did mind looking like a fool coder ;)
 
@elijahmanor I think you should do a dance now, or something
 
THis is like IRC for those that don't like IRC ;)(
 
so what was this Twitter link?
 
with gist support gist.github.com/589968
ohh i thought those got expanded out
 
9:24 PM
Signing off for today, cheers mates!
 
gist: Use === and !==, 2010-09-21 16:26:13Z
// Use === and !==

// It is often better to use the === and !== operators  
// rather than == and != operators. The reason for this
// is that === and !== (also known as the identity operators)
// check for the type as well as the value when being compared
// whereas the == and != will try to coerce the two values
// into the same type before the comparison is made, which
// may lead to some very unexpected results.

// Unexpected Comparisons using the == Operator
console.log( "\nUnexpected Comparisons using the == Operator" );
console.log( "0 ==  ''", 0 ==  '' );                     //true
console.log( "0 == '0'", 0 == '0' );                     //true
console.log( "false == '0'", false == '0' );             //true
console.log( "null == undefined", null == undefined );   //true
console.log( "' \t\r\n ' == 0", ' \t\r\n ' == 0 );       //true

// Expected Comparions using the === Operator
console.log( "\nExpected Comparions using the === Operator" );
console.log( "0 === ''", 0 === '' );                     //false
console.log( "0 === '0'", 0 === '0' );                   //false
console.log( "false === '0'", false === '0' );           //false
console.log( "null === undefined", null === undefined ); //false
console.log( "' \t\r\n ' === 0", ' \t\r\n ' === 0 );     //false​​​​​​​​
straight links work
 
ohh what did you do?
StackOverflow chat rooms are interesting... example: JavaScript http://bit.ly/9q5u06
 

Sandbox

Where you can play with regular chat features (except flagging...
spiffy tweet
 
@drachenstern ohh thnx, sorry about that
 
no it's cool
the new visitors might like the sandbox tho, if they've never been on chat.SO
 
9:29 PM
@ElijahManor That was worthy of an RT (:
 
@sworoc Thnx, yeah... this is cool stuff
 
Any thoughts in here regarding svg support in the future, or any reason not to build a new app around raphaeljs.com?
 
I plan on building some display elements around raphael, so I say do it
maybe I need to learn something tho? :)
feel free to school me ;)
 
It just seems like Canvas is the new hotness right now, getting lots of love, but raphael seems to have a lot of really cool things available
 
@ElijahManor Not liking irc is just silly
 
9:42 PM
@rchern but being able to run a pseudo IRC over :80 instead of worrying about blocked ports is so much saner
especially when we have chrome
 
@rchern Ha ha... I think it just isn't as approachable as something like this. People are so used to web this web that. To find an IRC client and channel & stuff is more than some are willing to invest
 
@ElijahManor agreed, this is more "mom-friendly"
 
@rchern IRC still has it's place, but I think this type of chat is what will bring more people to adopt
 
Hmm, @rchern, why haven't we blackmailed Nick Craver into pinning a link to the userscrupt in here? :P
 
@TimStone This is a good question
 
9:44 PM
adds it to the todo list
 
We could blackmail @AndyE too
 
@rchern This is true, since he's just a head, he'll have a hard time resisting.
 
what amount of wood would a woodchuck chuck if a woodchuck could chuck wood?
 
@jAndy "Hey, you woodchucks. Quit chucking my wood."
 
Hello
 
9:51 PM
no one's playing monkey island here then I guess
 
have any of you tried to use tigra calendar with asp.net
 
function howMuchWood(woodchuck) {
  if(woodchuck.canChuckWood) {
    return wood_count;
  }
}
4
 
lol, too true
 
a woodchuck would chuck no amount of wood since a woodchuck can't chuck wood...
 
(fyi hehe)
 
9:52 PM
;)
 
if woodchuck could chuck wood would a woodchuck chuck some wood and what amount of wood would a woodchuck chuck ?
-> oh shut up
 
@NEWprogrammer I have not tried using tigra with asp.net
 
@NEWprogrammer ditto
 
@NEWprogrammer are you running into some issues, we might be able to help?
 

« first day (24 days earlier)      last day (4929 days later) »