Wikipedia & YSlow

classic Classic list List threaded Threaded
35 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Problem with edittoken

javi bueno
 Hi! I'm trying to get the edittoken using a POST call through the next code :
 
$URL="es.wikipedia.org/w/api.php";
$ch = curl_init( );
curl_setopt($ch, CURLOPT_URL,"http://$URL");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$poststring["action"] = "query";
$poststring["prop"] = "info|revisions";
$poststring["intoken"] = "edit";
$poststring["titles"] = "Portada";
$data = curl_exec ($ch);
 
 ... but I always received the following response :
 edittoken="+\"
 
 anybody knows what's happening?
 
 Thanks.
 
PD : "Sorry for the last email format :-) ".

_________________________________________________________________
¿Sigue el calor? Consulta MSN El tiempo
http://eltiempo.es.msn.com/
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with edittoken

Roan Kattouw
javi bueno schreef:

>  Hi! I'm trying to get the edittoken using a POST call through the next code :
>  
> $URL="es.wikipedia.org/w/api.php";
> $ch = curl_init( );
> curl_setopt($ch, CURLOPT_URL,"http://$URL");
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
> $poststring["action"] = "query";
> $poststring["prop"] = "info|revisions";
> $poststring["intoken"] = "edit";
> $poststring["titles"] = "Portada";
> $data = curl_exec ($ch);
>  
>  ... but I always received the following response :
>  edittoken="+\"
>  
>  anybody knows what's happening?
Since you haven't logged in (or, if you have, aren't passing the login
cookies), you'll be treated as an anonymous users, whose edit token is
always +\ .

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with edittoken

javi bueno
Thanks for the response, but I was logged in. I think the problem is the loggin cookies. I don't know how to pass it. The parameter I am passing are the following ones :

1. action= query
2. prop = info|revisions
3. intoken = edit
4. titles = Main_Page

Do I must to pass another parameter? Which is it?

Thanks.
 



> Date: Tue, 7 Oct 2008 16:19:14 +0200
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [Wikitech-l] Problem with edittoken
>
> javi bueno schreef:
> >  Hi! I'm trying to get the edittoken using a POST call through the next code :
> >  
> > $URL="es.wikipedia.org/w/api.php";
> > $ch = curl_init( );
> > curl_setopt($ch, CURLOPT_URL,"http://$URL");
> > curl_setopt($ch, CURLOPT_HEADER, 0);
> > curl_setopt($ch, CURLOPT_POST, 1);
> > curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
> > $poststring["action"] = "query";
> > $poststring["prop"] = "info|revisions";
> > $poststring["intoken"] = "edit";
> > $poststring["titles"] = "Portada";
> > $data = curl_exec ($ch);
> >  
> >  ... but I always received the following response :
> >  edittoken="+\"
> >  
> >  anybody knows what's happening?
> Since you haven't logged in (or, if you have, aren't passing the login
> cookies), you'll be treated as an anonymous users, whose edit token is
> always +\ .
>
> Roan Kattouw (Catrope)
>
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l

_________________________________________________________________
Prueba los prototipos de los últimos en MSN Motor
http://motor.es.msn.com/
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Wikipedia & YSlow

Aryeh Gregor
In reply to this post by Daniel Friesen
On Mon, Oct 6, 2008 at 11:18 PM, Daniel Friesen <[hidden email]> wrote:

> Minification being pointless when gzipped is actually logical to
> understand if you know their principles. Both gzipping and minification
> follow the same principle. They take sequences that are repeated, create
> an optimized tree, and then store smaller sequences that refer to the
> data in that tree.
> Once something has been optimized like that, it's almost impossible to
> get it any smaller because you've already removed the repeat sequences
> of data.
> Basically trying to minify then gzip, is like trying to gzip twice, it
> can't technically give you much more.

Sure it can, because minification is lossy, and knows the syntax of
JavaScript.  gzipping cannot know that most runs of whitespace
characters and all comments are unnecessary for execution and can be
stripped entirely.

Although you're right that minify=0 would not solve everything.  For
instance, if the error console gives an error as occurring on a
specific line, that won't be helpful if you check the unminified
version, and might be unhelpful if you check the minified version too
(if everything is crammed onto a few lines).

I think the best way forward is to 1) concatenate all the JS/CSS files
into one using a PHP script; 2) add a configurable minification
option, set to false by default; and only then 3) experiment with how
much faster/more inconvenient it would actually be to use minification
on Wikipedia.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Wikipedia & YSlow

Thomas Dalton
> Although you're right that minify=0 would not solve everything.  For
> instance, if the error console gives an error as occurring on a
> specific line, that won't be helpful if you check the unminified
> version, and might be unhelpful if you check the minified version too
> (if everything is crammed onto a few lines).

I don't see the problem. Unless the error is intermittent, you'll get
the error with the minified version with a useless line number and
then you'll add minify=0 to the url and will get the error with the
unminified version which will give the line number for the unminified
version.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Wikipedia & YSlow

Aryeh Gregor
On Tue, Oct 7, 2008 at 11:28 AM, Thomas Dalton <[hidden email]> wrote:
> I don't see the problem. Unless the error is intermittent, you'll get
> the error with the minified version with a useless line number and
> then you'll add minify=0 to the url and will get the error with the
> unminified version which will give the line number for the unminified
> version.

I was assuming that minify=0 would be a parameter for the combining
script, not the whole page, but of course the latter could be done
too.  It seems prudent to make it optional anyway, though.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with edittoken

Roan Kattouw
In reply to this post by javi bueno
javi bueno schreef:
> Thanks for the response, but I was logged in. I think the problem is the loggin cookies. I don't know how to pass it. The parameter I am passing are the following ones :
>
> 1. action= query
> 2. prop = info|revisions
> 3. intoken = edit
> 4. titles = Main_Page
>
> Do I must to pass another parameter? Which is it?
You have to pass the cookies, which aren't parameters. The CURL
documentation probably has information how to fetch and pass cookies
using CURL. The idea is that when you log in with action=login , you get
a set of cookies along with the usual API response. You have to pass
those cookies back in the action=query request and all subsequent
requests that require you to be logged in.

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with edittoken

Soxred93@gmail.com
http://en.wikipedia.org/wiki/User:ClueBot/Source provides a good base  
for cookie storage.

Soxred

On Oct 7, 2008, at 11:52 AM [Oct 7, 2008 ], Roan Kattouw wrote:

> javi bueno schreef:
>> Thanks for the response, but I was logged in. I think the problem  
>> is the loggin cookies. I don't know how to pass it. The parameter  
>> I am passing are the following ones :
>>
>> 1. action= query
>> 2. prop = info|revisions
>> 3. intoken = edit
>> 4. titles = Main_Page
>>
>> Do I must to pass another parameter? Which is it?
> You have to pass the cookies, which aren't parameters. The CURL
> documentation probably has information how to fetch and pass cookies
> using CURL. The idea is that when you log in with action=login ,  
> you get
> a set of cookies along with the usual API response. You have to pass
> those cookies back in the action=query request and all subsequent
> requests that require you to be logged in.
>
> Roan Kattouw (Catrope)
>
> _______________________________________________
> Wikitech-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l


_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with edittoken

Roan Kattouw
Soxred93 schreef:
> http://en.wikipedia.org/wiki/User:ClueBot/Source provides a good base  
> for cookie storage.
>
> Soxred
You might wanna wrap those code blocks in <source lang="php">code
here</source> so you get automatic fancy highlighting, which greatly
improves readability.

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Wikipedia & YSlow

Domas Mituzas
In reply to this post by howard chen
>
> Results is quite surprising, Grade F (47). Of course lower mark does
> not always means bad, but there are some room for improvement, e.g.


did it mention we don't use CDN too?

--
Domas Mituzas -- http://dammit.lt/ -- [[user:midom]]



_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Wikipedia & YSlow

Aryeh Gregor
On Tue, Oct 7, 2008 at 6:26 PM, Domas Mituzas <[hidden email]> wrote:
> did it mention we don't use CDN too?

Yep.  Do we/should we?  (We have the Squids in Amsterdam and Seoul, do
those count?)

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem with edittoken

javi bueno
In reply to this post by Roan Kattouw
Thank u for all. Now, I think I understand all the process.
 
Javier Bueno.

> Date: Tue, 7 Oct 2008 17:52:57 +0200> From: [hidden email]> To: [hidden email]> Subject: Re: [Wikitech-l] Problem with edittoken> > javi bueno schreef:> > Thanks for the response, but I was logged in. I think the problem is the loggin cookies. I don't know how to pass it. The parameter I am passing are the following ones : > >> > 1. action= query> > 2. prop = info|revisions> > 3. intoken = edit> > 4. titles = Main_Page> >> > Do I must to pass another parameter? Which is it?> You have to pass the cookies, which aren't parameters. The CURL > documentation probably has information how to fetch and pass cookies > using CURL. The idea is that when you log in with action=login , you get > a set of cookies along with the usual API response. You have to pass > those cookies back in the action=query request and all subsequent > requests that require you to be logged in.> > Roan Kattouw (Catrope)> > _______________________________________________> Wikitech-l mailing list> [hidden email]> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
_________________________________________________________________
Prueba los prototipos de los últimos en MSN Motor
http://motor.es.msn.com/
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Wikipedia & YSlow

Tei-2
In reply to this post by Aryeh Gregor
On Tue, Oct 7, 2008 at 5:37 PM, Aryeh Gregor
<[hidden email]> wrote:

> On Tue, Oct 7, 2008 at 11:28 AM, Thomas Dalton <[hidden email]> wrote:
>> I don't see the problem. Unless the error is intermittent, you'll get
>> the error with the minified version with a useless line number and
>> then you'll add minify=0 to the url and will get the error with the
>> unminified version which will give the line number for the unminified
>> version.
>
> I was assuming that minify=0 would be a parameter for the combining
> script, not the whole page, but of course the latter could be done
> too.  It seems prudent to make it optional anyway, though.
>

I am a Internet newbie, so maybe I don't understand the problem.

Desktop programmers often distribute his applications as binary
compiled form version of his SRC files.
I don't see what is the problem to distribute a application webpage
has a binary file.. or a ofuscated file-optimized file. If having a
separate (keyword here is: separate) download for the SRC files. Has
programmers of Desktop applications have a separate folder labeled
"SRC" with the SRC files of any binary distribution program.

Two folders:
src/<all the SRC files goes here>
bin/alljs_20081002.js
bin/.htwhateverconfig

You can have a make process that recreate that alljs_<build date
here>.js from the SRC files.
The .htwhateverconfig make Apache send the right expiration http
headers, so browsers are forced to cache a file called
alljs_20081002.js forever (or til 2012).

I know you can still have poeple that may need the un-ofuscated
original (not compiled) src. But he!.. developping sould work on a
beta server or something, not on production. People geek enough to
need the original src files, could google about it, and download the
full src/ folder or something alike.








--
ℱin del ℳensaje.
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Wikipedia & YSlow

Aryeh Gregor
On Wed, Oct 8, 2008 at 10:10 AM, Tei <[hidden email]> wrote:
> I am a Internet newbie, so maybe I don't understand the problem.
>
> Desktop programmers often distribute his applications as binary
> compiled form version of his SRC files.

JavaScript is a scripting language, not a compiled language.  It
cannot be distributed as a machine-executable binary, because that
would be insecure: JavaScript needs to be sandboxed in a way that
machine-executable code cannot be.  It cannot be distributed as
bytecode, the way Java can, because there's no standard JavaScript
bytecode.  It can only be distributed in source code form.

> I don't see what is the problem to distribute a application webpage
> has a binary file.. or a ofuscated file-optimized file. If having a
> separate (keyword here is: separate) download for the SRC files. Has
> programmers of Desktop applications have a separate folder labeled
> "SRC" with the SRC files of any binary distribution program.

This works for languages like Java or C where the convention is to
distribute more optimized forms than source code.  The problem with
JavaScript is that the entire infrastructure for viewing it and
debugging it depends on the fact that it's distributed in source-code
form.  If an error occurs, the browser will give the line number in
the source code: if your source code is minified so it's all on one
line, this is useless.  Debuggers like Firebug can set break points on
individual lines, which again is useless for minified code.  All of
the above also present the code to you for inspection in source-code
form, which is very difficult to read if it's minified, with all
spaces and comments removed.

Again, in compiled languages (whether byte-code or machine code) this
isn't such an issue.  There are established ways of dealing with this:
you can compile debug versions and your debugger will automatically
use info on the line number and so on to jump to the correct place in
the source code.  No such facilities exist for JavaScript.

In the long term, the "correct" solution might be for the web
community to come up with a standard JavaScript byte-code or something
like that, and have debuggers updated to work with that.  But that's
not an option right now.

> I know you can still have poeple that may need the un-ofuscated
> original (not compiled) src. But he!.. developping sould work on a
> beta server or something, not on production. People geek enough to
> need the original src files, could google about it, and download the
> full src/ folder or something alike.

It's a lot more difficult to reproduce problems on local wikis than to
be able to inspect them in-place where they're reported, on production
wikis.  Moreover, a lot of our JavaScript is put into place by sysops
on individual wikis, who mostly don't have access to test wikis.  It's
not practical to just say "don't give an option to view the readable
source code".  Yes, this is indeed a peculiarity of web development
compared to other types of software development, but that's the facts
on the ground.

_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Reply | Threaded
Open this post in threaded view
|

Re: Wikipedia & YSlow

Tei-2
On Wed, Oct 8, 2008 at 4:32 PM, Aryeh Gregor
<[hidden email]> wrote:
..
> It's a lot more difficult to reproduce problems on local wikis than to
> be able to inspect them in-place where they're reported, on production
> wikis.  Moreover, a lot of our JavaScript is put into place by sysops
> on individual wikis, who mostly don't have access to test wikis.  It's
> not practical to just say "don't give an option to view the readable
> source code".  Yes, this is indeed a peculiarity of web development
> compared to other types of software development, but that's the facts
> on the ground.

Ok, I see. So this why "&minify=0" is needed.


off-topic: humm... seems /. uses this stuff...   <script
src="//images.slashdot.org/all-minified.js?T_2_5_0_223"
type="text/javascript"></script>



--
ℱin del ℳensaje.
_______________________________________________
Wikitech-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
12