Re: [Wikitech-l] Problem with unit tests and dataProviders

2012-09-24 Thread Tyler Romeo
This is a functionality of PHPUnit, not of MediaWiki. The idea is that each
test case (or function) is considered the most basic unit of testing. So
setUp() and tearDown() have to be called before and after each function to
ensure the testing environment is clean for the test.

*--*
*Tyler Romeo*
Stevens Institute of Technology, Class of 2015
Major in Computer Science
www.whizkidztech.com | tylerro...@gmail.com



On Mon, Sep 24, 2012 at 12:18 AM, Niklas Laxström niklas.laxst...@gmail.com
 wrote:

 I'm writing unit tests for one of Translate classes.

 In the setUp I need to create few pages, but I need to also control
 the user ids of the revisions. This seems to work well except for two
 things:
 * dataProvider methods are called *before* setUp, so I cannot use the
 user ids I have stored in setUp.
 * setUp and tearDown are called for *every* item in the dataProvider.
 This seems very wasteful - no wonder the tests takes minutes or so to
 run.

 This just doesn't make any sense to me. I'm considering to stop using
 @dataProvider in this case - any other ideas?

 The code in setUp is something like this:

 $title = Title::makeTitle( NS_MEDIAWIKI, 'Key1/fi' );
 $user = User::newFromName( 'Translate test user 1' );
 $user-addToDatabase();
 WikiPage::factory( $title )-doEdit( 'trans1', __METHOD__,
 0, false, $user );
 $this-user1 = $user;

   -Niklas

 --
 Niklas Laxström

 ___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Problem in rendering a book Guide to star constellations in pdf format

2012-09-24 Thread Matthew Walker
Hello!

I'm guessing I'm seeing the same thing you are; but as MZ indicated a URL
would be very useful. In any case: I just attempted to render to PDF

http://en.wikipedia.org/w/index.php?title=Special:Bookbookcmd=renderingreturn_to=Book%3AGuide+to+the+Constellationscollection_id=a16ec1f0c6cc071ewriter=rl

And it failed with:
An error occurred on the render server: RuntimeError: command failed with
returncode 9: ['mw-render', '-w', 'rl', '-c',
'cache/a1/a16ec1f0c6cc071e/collection.zip', '-o',
'cache/a1/a16ec1f0c6cc071e/output.rl', '--status',
'qserve://localhost:14311/a16ec1f0c6cc071e:render-rl',
'--template-blacklist', 'MediaWiki:PDF Template Blacklist',
'--template-exclusion-category', 'Exclude in print',
'--print-template-prefix', 'Print', '--print-template-pattern', '$1/Print',
'--language', 'en'] Last Output: 64% rendering 84.4260240964% rendering
84.4607228916% rendering 84.4665060241% rendering 84.5012048193% rendering
84.5359036145% rendering 84.6168674699% rendering 84.6631325301% rendering
84.6631325301%... ...88.9831325301% rendering in function system, file
/home/pp/local/bin/nslave.py, line 64

Is this approximately what you're seeing? If so please do add it to the
bugzilla bug that I just created:
https://bugzilla.wikimedia.org/show_bug.cgi?id=40468

Thanks,
Matt Walker

On Sat, Sep 22, 2012 at 11:31 AM, rupesh bende rupeshbe...@gmail.comwrote:

 Hi,
  I was downloading the Guide to star constellations in pdf format.
 While it is rendered at 91% it throws an error. And said failed to render.
 It was working fine in case of .odt file and also .zim file. Please look in
 to the matter.

 Thanks and regards

 --
   ~Rupe$h Bende
 Software Engg
 Games24x7 Pvt. Ltd
 ___
 Wikitech-l mailing list
 Wikitech-l@lists.wikimedia.org
 https://lists.wikimedia.org/mailman/listinfo/wikitech-l

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Problem with unit tests and dataProviders

2012-09-24 Thread Antoine Musso
Le 24/09/12 06:18, Niklas Laxström a écrit :
 I'm writing unit tests for one of Translate classes.
 
 In the setUp I need to create few pages, but I need to also control
 the user ids of the revisions. This seems to work well except for two
 things:
 * dataProvider methods are called *before* setUp, so I cannot use the
 user ids I have stored in setUp.
 * setUp and tearDown are called for *every* item in the dataProvider.
 This seems very wasteful - no wonder the tests takes minutes or so to
 run.

A data provider give a stream of cases that will be used as an
independent test. Kind of save you from copy pasting the same test
function over and over.

setUp() is a method called before each test, so it is indeed called
before each of the cases provided via a data provider. Similarly,
tearDown() is called after each test.

 This just doesn't make any sense to me. I'm considering to stop using
 @dataProvider in this case - any other ideas?
 
 The code in setUp is something like this:
 
   $title = Title::makeTitle( NS_MEDIAWIKI, 'Key1/fi' );
   $user = User::newFromName( 'Translate test user 1' );
   $user-addToDatabase();
   WikiPage::factory( $title )-doEdit( 'trans1', __METHOD__, 0, 
 false, $user );
   $this-user1 = $user;

One possibility would be to only set it once using the
setUpBeforeClass() and tearDownAfterClass(). Those are only run once in
the class. So you could create a new test file having a class dedicated
to this test.

You could probably skip the addToDatabase() call if the user is already
in there.  Note your code will produce an edit for any case.

Can you possibly send the code in Gerrit so we can have a look at it?

-- 
Antoine hashar Musso


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] #switch limits

2012-09-24 Thread Alex Brollo
2012/9/24 Tim Starling tstarl...@wikimedia.org

 I suppose a nested switch like:

 {{#switch: {{{1}}}
   | 0 = {{#switch: {{{2}}}
  | 0 = zero
  | 1 = one
   }}
   | 1 = {{#switch: {{{2}}}
  | 0 = two
  | 1 = three
   }}
 }}

 might give you a performance advantage over one of the form:

 {{#switch: {{{1}}}{{{2}}}
| 00 = zero
| 01 = one
| 10 = two
| 11 = three
 }}


I was thinking about something different - to split a long list into a tree
of  sub-templates, and to use upper templates to select the right one
sub-template. This would avoid parsing of a single, heavy template, but has
the disadvantage of multiple calls to much smaller templates.(one for each
level); so, if basic #switch is unexpectably fast, I don't see a sound
reason to add complexity to the code.

Alex
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] What causes the status anonlogin?

2012-09-24 Thread Krenair

On 24/09/12 04:02, wangfeng wangfeng wrote:

Hi,
I want to implement SSO function between Mediawiki and another application.
Now I can login and logout synchronously.
But I have a problem that I find a status called anonlogin. When it
comes, I will lose my login status.
I don't know how it appears, and howto handle this status.
Can someone help me?
Thanks very much.
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I don't know much about what you're trying to do or the autologin 
status, but maybe this is helpful?


includes/SkinTemplate.php:# anonlogin  login are the same
includes/SkinTemplate.php:$login_id = 
$this-showIPinHeader() ? 'anonlogin' : 'login';


Krenair

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Proposal to add an API/Developer/Developer Hub link to the footer of Wikimedia wikis

2012-09-24 Thread Jon Robson
So I had a brainwave about this over the weekend.
The home page for the developer page should act like a personal appeal
only with __developers__ as the writers.

I think a personal touch is a great way to explain to a would be
developer to why they should care about our apis and our codebase.
Hearing from real people with real problems that they are solving in
the real world would be an extremely inspiring way to get new people
involved

I think the home page should be written as a personal appeal to a new
developer from ALL developers with links in the right places to the
right thing.
I think this should also be followed up by a randomised personal
appeal from a developer himself - we should mix these between app
developers, bug wranglers, feature developers, volunteers, employees
etc etc

I've knocked up a first version here:
http://www.mediawiki.org/wiki/Developer_Hub

In future I'd love to see banners ads asking people to donate
development time pointing to these pages or at least see the donation
page inform people that they can help in other ways.

Is anyone else excited about this idea or is it just me...?

On Thu, Sep 20, 2012 at 9:15 PM, MZMcBride z...@mzmcbride.com wrote:
 James Forrester wrote:
 On 20 September 2012 08:54, Quim Gil quim...@gmail.com wrote:
 Alright, let's move onto the next round: which dev hub?

 http://meta.wikimedia.org/wiki/Wikimedia_developer_hub
 http://www.mediawiki.org/wiki/Developer_hub

 mediawiki.org is a better default landing place for developers than
 Meta, do you agree?

 Is it worth considering the merge of both pages, as it has been suggested?

 And in any case the API should be promoted upfront. Now the Meta hub
 has no mention (I could find) while the dense MediaWiki hub features
 the link if you are patient to find it (or you use the search, as I
 did).

 Of course, we already have a link to the mediawiki.org front page on
 every page we serve - that's what the Powered by MediaWiki button
 links to. There, the four most prominent links are:

 * https://en.wikipedia.org/wiki/Wiki
 * https://www.mediawiki.org/wiki/Installation
 * https://www.mediawiki.org/wiki/Manual:Configuration
 * https://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker

 I assumed that the point of this additional link was to take people to
 our API because we already use our bully-pulpit to ask for more
 developers quite strongly, but people who want to use us as a service
 need to dig further to even know we have one. If all we're doing is
 duplicating the general hey, you're a techy person link with another
 text label, this exercise will have lost its value.

 Hi!

 Sorry for starting this thread and then disappearing for a bit; it's been a
 busy week.

 I've taken the (wonderful!) comments in this thread and on bug 33464 and
 synthesized them into a requests for comment here:
 https://www.mediawiki.org/w/index.php?curid=99106.

 To address your point specifically, the Powered By MediaWiki button is a
 bit of promotion (or advertising, branding, whatever) for the MediaWiki
 software. What we're discussing here is something different. Based on how
 other sites behave, I think there's a reasonable expectation that if you
 want to figure out, generically, how to get involved, looking in the footer
 of the Web site is a reasonable place to start.

 Most of my thoughts are in the RFC now on mediawiki.org, but my big
 revelation earlier this week was that I don't think we really have an
 audience problem as some have suggested. The people we want to attract are
 all developers (which is why I suggested using Developers as the link
 text).

 That said, I think the first step in the landing page should be to split _by
 motivation_:

 * are you wanting to re-use Wikimedia wikis' content; or
 * are you wanting to contribute code to Wikimedia/MediaWiki?

 From there, you can sub-divide based on programming language, component
 (user interface, ops, etc.), and a bunch of other variables. My mock-up for
 the tree/matrix/wizard is here:
 https://www.mediawiki.org/w/index.php?oldid=585564#Blueprint.

 MZMcBride





-- 
Jon Robson
http://jonrobson.me.uk
@rakugojon

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


[Wikitech-l] Learning Git/Gerrit? Answer poll to choose tutorial date

2012-09-24 Thread Sumana Harihareswara
Git, Gerrit, and You! A Tutorial

Where:  IRC/SIP/SSH

We want all our developers to feel comfortable with Git, git-review, and
Gerrit. So saper is leading a hands-on online training:
https://www.mediawiki.org/wiki/Project:WikiProject_Extensions/MediaWiki_Workshops/Git_/_Gerrit_Tutorial
. Check [[Git/Workshop]] for testing access to the conference  lab setup.

Saper will be available for 3 hours, and there'll be a break in the
middle. Absolute beginners with Git might want to stay for the whole
three hours; people with some experience won't need as long.

Answer this poll to help saper choose a date: 17:30 UTC on 26 September,
27 September, 2 October, or 3 October.

http://www.doodle.com/pbdbrcrh5gdpvrfu

If you want to attend, please also answer this question: how much do you
already know?

http://www.doodle.com/zhn7buksgrg8e8rx

Thanks for doing this, saper.

-- 
Sumana Harihareswara
Engineering Community Manager
Wikimedia Foundation

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] GLAMwiki Toolset Project : Request for Comments - Technical Architecture

2012-09-24 Thread Emmanuel Engelhart

On 09/20/2012 04:34 PM, dan entous wrote:

dear all,

as some of you may already know, the GLAMwiki Toolset Project, 
http://outreach.wikimedia.org/wiki/GLAM/Toolset_project, is a collaboration 
between Wikimedia Nederland, Wikimedia UK, Wikimedia France and Europeana, with 
the goal of providing a set of tools to get materials from GLAM institutions 
onto Wikimedia Commons in a way that reuse can easily be tracked, and that 
Commons materials can easily be integrated back into the collection of the 
original GLAM or even other GLAMs.

as part of our initial goal of creating a GLAM Upload System, we are looking to 
gather Wikimedia community input on the proposed architecture and technologies. 
if you have time and interest, please take a look and let us know your 
thoughts, 
http://outreach.wikimedia.org/wiki/GLAM/Toolset_project/Request_for_Comments/Technical_Architecture.


with kind regards,
dan


Hi Dan,

I have a few questions about the choice of the Zend Framework:
* Why exactly using the Zend Framework?
* Do we really need such a dependency?
* Do we have this framework installed on the Wikimedia servers?
* If no, is that not a problem?

Regards
Emmanuel

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Proposal to add an API/Developer/Developer Hub link to the footer of Wikimedia wikis

2012-09-24 Thread Isarra Yos

On 24/09/2012 13:35, Jon Robson wrote:

So I had a brainwave about this over the weekend.
The home page for the developer page should act like a personal appeal
only with __developers__ as the writers.

I think a personal touch is a great way to explain to a would be
developer to why they should care about our apis and our codebase.
Hearing from real people with real problems that they are solving in
the real world would be an extremely inspiring way to get new people
involved

I think the home page should be written as a personal appeal to a new
developer from ALL developers with links in the right places to the
right thing.
I think this should also be followed up by a randomised personal
appeal from a developer himself - we should mix these between app
developers, bug wranglers, feature developers, volunteers, employees
etc etc

I've knocked up a first version here:
http://www.mediawiki.org/wiki/Developer_Hub

In future I'd love to see banners ads asking people to donate
development time pointing to these pages or at least see the donation
page inform people that they can help in other ways.

Is anyone else excited about this idea or is it just me...?



That is an intriguing concept that could indeed work quite well to get 
people interested, but how many will remain interested after they 
encounter gerrit?


--
-— Isarra


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Proposal to add an API/Developer/Developer Hub link to the footer of Wikimedia wikis

2012-09-24 Thread Derric Atzrott

 Is anyone else excited about this idea or is it just me...?


That is an intriguing concept that could indeed work quite well to get 
people interested, but how many will remain interested after they 
encounter gerrit?

I can't actually say I like this idea a whole lot.  Here's why:
* Personal appeals have to be well written in order to work.  A poorly written
personal appeal will not actually appeal to someone and may in fact turn them
away.
* We use personal appeals for the fund raising drive.  I think using them here
as well, especially when we have these [1] going on every year is a bad idea.
* A personal appeal on a page like this is a wall of text.  We need to be very
careful not to elicit the TL;DR response from people.
** On a similar vein: This page needs to be fairly appealing in appearance, like
the MediaWiki.org homepage is, or people will leave.

In my experience, programmers are very practical pragmatic people.  I don't
think that a personal appeal is the best way to appeal to them.  At least not
how the idea is currently presented.  The Mediawiki.org homepage does a better
job of getting my hyped to use Mediawiki right now.

[1]: http://knowyourmeme.com/memes/wikipedia-fundraising-campaign


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Problem with unit tests and dataProviders

2012-09-24 Thread Platonides
Antoine Musso wrote:
 One possibility would be to only set it once using the
 setUpBeforeClass() and tearDownAfterClass(). Those are only run once in
 the class. So you could create a new test file having a class dedicated
 to this test.

Oh, I didn't know those existed...


Niklas, implement addDBData() method for that (called by MediaWikiTestCase)


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Proposal to add an API/Developer/Developer Hub link to the footer of Wikimedia wikis

2012-09-24 Thread Jon Robson
 That is an intriguing concept that could indeed work quite well to get
 people interested, but how many will remain interested after they encounter
 gerrit?

That's a separate problem.. haha!

Derric - in reply to your concerns... just a few points
1) The mediawiki homepage puts ME off. This is mainly because I'm more
interested in doing things with the data on wikipedia rather than the
software that runs Wikipedia. I think this is the problem we are
trying to solve - there are many different types of developers out
there and we need something generic to appeal to as many of them as
possible.

2) I agree personal appeals need to be well written - but I feel we
have lots of expertise around to help us with that if that is
something we want to do

3) Agreed with presentation - the wall of text approach doesn't work.
I should have stated in my original mail that people should focus on
the text itself rather than presentation. I would expect us to reuse
the fundraiser presentation style. There is no way this alone would
suffice.

4) I don't think this would attract so many memes - several reasons -
one it is a link on the bottom of the page and out of most of people's
view - two we don't even have to show photos - we could show people's
avatars or the apps/extensions people have built instead.

Also if we do attract memes maybe that is a measure of success as it
shows we are successfully attracting people to our developer page ;-)

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Problem with unit tests and dataProviders

2012-09-24 Thread Niklas Laxström
On 24 September 2012 13:27, Antoine Musso hashar+...@free.fr wrote:
 One possibility would be to only set it once using the
 setUpBeforeClass() and tearDownAfterClass(). Those are only run once in
 the class. So you could create a new test file having a class dedicated
 to this test.

Those are static methods, I cannot store the users anywhere if I use those.

 Can you possibly send the code in Gerrit so we can have a look at it?

Yes.

  -Niklas
-- 
Niklas Laxström

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] Proposal to add an API/Developer/Developer Hub link to the footer of Wikimedia wikis

2012-09-24 Thread Isarra Yos

On 24/09/2012 15:41, Jon Robson wrote:

That is an intriguing concept that could indeed work quite well to get
people interested, but how many will remain interested after they encounter
gerrit?

That's a separate problem.. haha!

Derric - in reply to your concerns... just a few points
1) The mediawiki homepage puts ME off. This is mainly because I'm more
interested in doing things with the data on wikipedia rather than the
software that runs Wikipedia. I think this is the problem we are
trying to solve - there are many different types of developers out
there and we need something generic to appeal to as many of them as
possible.

2) I agree personal appeals need to be well written - but I feel we
have lots of expertise around to help us with that if that is
something we want to do

3) Agreed with presentation - the wall of text approach doesn't work.
I should have stated in my original mail that people should focus on
the text itself rather than presentation. I would expect us to reuse
the fundraiser presentation style. There is no way this alone would
suffice.

4) I don't think this would attract so many memes - several reasons -
one it is a link on the bottom of the page and out of most of people's
view - two we don't even have to show photos - we could show people's
avatars or the apps/extensions people have built instead.

Also if we do attract memes maybe that is a measure of success as it
shows we are successfully attracting people to our developer page ;-)

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Brief appeals, with a bunch of big linkey thingies to categories of 
thingies! It could work! Thingies make everything better. Mainpage needs 
more thingies too. Or perhaps less. Or maybe just better ones. I guess 
my point is I agree about 1, although for me it's more just because it's 
ugly and confusing than anything else.


--
-— Isarra


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


[Wikitech-l] shortened links (was Re: MediaWiki 1.20 release candidate (and triage announcement))

2012-09-24 Thread Mark A. Hershberger
On 09/23/2012 06:33 PM, K. Peachey wrote:
 On Mon, Sep 24, 2012 at 4:03 AM, Mark A. Hershberger m...@everybody.org 
 wrote:
 On 09/23/2012 12:54 PM, Krinkle wrote:
 https://bugzilla.wikimedia.org/[...]

 Link shortened: http://hexm.de/lp
 
 There is no need to shorten urls in emails, Please don't.

I've personally seen mail readers and MTAs that mangle long URLs. Since
this sort of mangling happens, I see a need for a way to make URLs
usable.  I use a shortener for those URLS as a precautionary measure and
to help me communicate with others.

Mark.

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Proposal to add an API/Developer/Developer Hub link to the footer of Wikimedia wikis

2012-09-24 Thread Tim Starling
On 25/09/12 05:35, Jon Robson wrote:
 I've knocked up a first version here:
 http://www.mediawiki.org/wiki/Developer_Hub

I moved it to

https://www.mediawiki.org/wiki/User:Jdlrobson/Developer_Hub

I don't think your proposed text is appropriate, since it portrays
MediaWiki as a WMF project. There's a difference between being a
MediaWiki developer and being a WMF developer. Your text reads like a
WMF job advertisement.

Maybe something like that could be on wikimediafoundation.org.

-- Tim Starling


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l