Technology

You are currently browsing the archive for the Technology category.

The following story is an attempt to show an example of how one can work with Plone in real world project. It’s based on a real product whose development I contributed to: acentoweb.competition.

The requisites

The client wanted a system to manage and organize online photo and video competitions. The competitions’ announcements and rules would be published in the site. The people who wanted to participate in a certain competition would register on it, entering their personal data, and then be able to submit photos and videos to be evaluated for the competition.

Participants should only be able to see their own submissions, and never the ones from the other participants, until the submission time is finished. The judge of every competition, a group of designed people, should be able to see all the submited items, but not their owners. The members of the judge should also be able to rate or reject each submission.

The participants shouldn’t be able to edit or add elements in the rest of the site, only in the competions they had signed up, and the sign-up form should look like if they were signing up for a competition, not like if they were creating an account for a normal Plone site.

The proposed solution

This is how we decided to implement the product in Plone. Surely there might be smarter ways, so comments to improve the product are appreciated. :)

First, we decided to create a folderish Archetypes content-type to represent a Competition, with classic title and description, and rules. Folderish because it would hold photos and videos. The photos would be just a copy of the Image type, and the videos of the File type, perhaps including some integration with p4a. Having special Photo and Video content-types ensures we can assign a custom workflow to them, as we actually need.

To ensure that the participants can only see their own submissions during the competition submission period, we create a special workflow for them, competition_item_workflow, with three states:

  • Private: The participant is still preparing the item. Only he can see and modify it.
  • Pending: The item is waiting for the judge evaluation. The participant can’t modify the item anymore. The judge can see and evaluate it now.
  • Published: The competition has ended and the items is marked for public display.

Only the participant (the owner) can trigger the submission of an item, and the judge can publish it later, which is implemented using role guards in the respective transitions.

Competitions themselves also have a dedicated workflow, competition_workflow, with states:

  • Private: In preparation. Can only be seen by the owner and the users he/she allows manually.
  • Open: The rules are published and participants can sign-up and submit their works.
  • Closed: The competition doesn’t accept new work submissions and the results are published.

Since a single person can participate in more than one competition, we decided to make the participants create a user in the site and sign-up later in each competition individually. To do so we:

  • Create a customized copy of the Plone join_form, with fields for location, phone number, and other personal data they need to enter when they sign-up.
  • Customize the Competition view to include a “Sign-up for this competition!” button, which would grant the “Competitor” local role to the user, which in turn would grant him rights to create and submit items for the competition.

To hide the author info from the judge, we customize the plone.documentbyline viewlet to hide it for users without the Modify portal content permission over an object. It’s not the most optimal solution perhaps, but it just works for now.

The judge for each competition is assigned manually for the managers of the site, assigning the “Reviewer” local role to individual users via the Sharing tab.

The rating is implemented via plone.contentratings. We created a custom category with a custom rating manager, since the default one wasn’t working properly with the permission settings we set for rating and reading the ratings: competitors and the judge can’t see the ratings of submissions before the competition is closed, and the judge can only rate works while the competition is open.

Related articles

Tags: ,

I’ve been working these months in a Google Summer of Code project entitled Core tiles development. One thing I wanted to do is to write some documentation about how the whole Deco/Blocks/Tiles system works together – the reason is that there are a lot of packages and moving pieces involved and it’s easy to get lost trying to understand what does what and in which order. I won’t try to explain in detail how does each package do its work (read each package documentation if you’re interested) but to introduce the different packages involved.

In short, Deco is a page composition system based on semantic HTML and a grid system. Instead of using custom XML namespaces and a templating language (like METAL), Deco uses plain (strategic) HTML.

To add this feature to a Dexterity content-type you just have to add the plone.app.layoutbehavior Dexterity behavior to it. This behavior adds two fields to the content-type: layout, to select the site layout you want to use, and content. This last field will contain all the tile-related HTML markup, and is populated by default with two field tiles: title and description. The Dexterity type with the cited behavior we’re currently using is named Page and lives into plone.app.page.

If the Deco UI package, plone.app.deco, is installed, it will detect the presence of the content field and activate. The Deco UI allows you to insert, drag-and-drop, edit and delete tiles inside the content field of a type.

To position the tiles in the screen, the Deco UI makes use of the so-called Deco Grid System, a bunch of carefully crafted CSS classes that, when applied to div elements, position them in the page with the appropiate dimensions.

Tiles are little more than browser views with associated configuration data, and their base classes live in plone.tiles. We have transient tiles, which store the configuration data in a querystring in the tile HTML, like:

http://host.org/@@plone.app.standardtiles.helloname/tile-1?name=Israel

and persistent tiles, for config data not encodeable into querystrings (e.g. a large file), which store the data in the ZODB as annotations in the content object. Note the expected ‘@@’ for browser views — when this URL is accessed, it will return an HTML page with headers and a body, like:

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="names.css" />
  </head>
  <body>
    <p class="aName">Hello Israel!</p>
  </body>
</html>

The plone.app.tiles (notice the “app” namespace) package registers the helper views @@add-tile, @@edit-tile and @@delete-tile to do exactly what their names say, the two first ones using a form generated from the tile data schema via plone.autoform.

So how are tiles actually rendered into a page? The answer resides in plone.app.blocks. This package is in charge of loading the page layout (remember the “layout” field added by plone.app.layoutbehavior?), merging in the contents of the page and “expanding” the tiles, merging the head of the tile into the head of the resulting page and putting its body where the placeholder for the tile was, as detailed in the documentation.

Finally, the basic tiles to be inserted, including image, video, attachment, navigation tree and searchbox among others, live in plone.app.standardtiles.

Muchas gracias por vuestras respuestas.

Finalmente vamos a intentar quedar días antes de empezar el mes de alquiler para firmar el contrato, pagar la fianza en metálico y recibir las llaves: todo a la vez.

Además, vamos a pedir a nuestro (futuro) casero que nos envíe una copia del texto del contrato antes, para poder tener tiempo de discutirlo si no estuviésemos de acuerdo en algo.

Por otra parte, buscando información por la Red he encontrado este par de enlaces, bastante útiles:

http://www.spaviv.es/informacion/normativa.php
http://www.upv.es/perfiles/estudiante/documentos/alojamientos_triptico.pdf

Related articles

Tags: , , ,

Plone 3 Multimedia cover

Time for a new review of a Plone book! This time it’s Plone 3 Multimedia, by Tom Gross, and published by, guess who… Packt Publishing! One would say that Packt has a really good marketing team. :P

The mistake in the title is here strikes once again, since most of the book, if not it all, will apply also for Plone 4, but Packt continues following this policy.

First think I thought was… do we really need a whole book about multimedia in Plone? The answer is, well, there is enough material, enough multimedia-related products for Plone out there to write a book about the topic if you want to.

One thing I don’t understand is what the target audience is supposed to be. The “Who this book is for” section claims that (please Packt don’t sue me for copyright-related issues ;):

This book is for Plone integrators who want to extend the core of Plone with multimedia features. It gives no introduction to Plone and readers should know how to set up a Plone site using a buildout. The book can be read and understood well even if the reader is not a Python developer, though some examples have Python code included.

The book starts giving definitions of what a CMS or what multimedia is and the different types of multimedia elements we can stumble upon, so you think it’s going to be soft, but it soon dives into using multimedia in Zope Page Templates and Python code, and later uses some more advanced concepts (e.g. automated testing, traversers, marking interfaces, zope events…) without (IMO) proper introduction.

Is not that I can’t accept the reader is required to have some former Plone knowledge — what I don’t understand is the mixture of really-newbies with more advanced coding material.

I would have appreciated a kind of requirements story to give more coherence to the content as a whole, something like what happens in the Plone 3 Products Development Cookbook or Proffessional Plone Development: a fictitious client that presents some requirements for a to-be-developed Plone site.

Plone 3 Multimedia doesn’t follow this pattern, and the result is a different structure, a reference presenting and briefly explaining different products to add multimedia features to your site, like the whole Plone 4 Artists (p4a) suite, plonetruegallery, Slideshowfolder, collective.flowplayer, Plumi, Vice, collective.uploadify or Red5, among others.

The two last chapters deal with what I think are vital topics when dealing with multimedia: storage and caching. In the storage one, I miss some more guidance about which storage system choose in every situation and why, instead of just a list of different available products with storage-related features.

Finally, I don’t think the appendices, covering multimedia and syndication formats, licenses and links for getting more help, are worth it. We already have Wikipedia, Google searches and all, so if one wants to read about, say, Ogg Vorbis, one ends here or here, with a lot more info that what one can find in the corresponding appendix of the book. All these pages could have better been employed in explaining more deeply the more advanced technical concepts, for example.

To sum up, I find this book good for “advanced” integrators or developers who are looking for an overview of the different available multimedia products for Plone. For the rest, I’ve not doubt you can learn something from it, but perhaps others fit your profile better.

Related articles

Tags: , ,

The Free Culture X Conference and Unconference took place the past 13th and 14th of February at the George Washington University, in Washington, DC. I had the privilege to attend thanks to a travel grant from the generosity of Google, Mozilla and Shareable.

As they define it, its vision is to bring together student activists and free culture luminaries to discuss free software and open standards, open access scholarship, open educational resources, network neutrality, and university patent policy, especially in the context of higher education.

Below there is a summary of the notes I took during the conference. It doesn’t aim to be complete nor precise, but I hope it will provide an idea of what did we discuss about.

During the different keynotes and panels, we used, apart from the classical hand-up, the backchan.nl tool for audience intervention during conferences. Better than a massive Twitter, IMO.

After a short introduction, we started discussing about the politics of open networks. It was pointed out that we need to come up with a clear definition of net neutrality and push the ISPs to implement the policies we want. The politics-related meetings about net neutrality often include a lot of industry representation, but seldom people from other sectors of the population, which are also affected, as university campuses or consumers’ groups.

The three-strikes law to cut the access to the Internet can become extremely harmful in contexts where it’s being used as a platform for services like VoIP or TV, disconnecting the affected user completely, unable to make even emergency calls.

In general, the existence of a competitive market of ISPs, like the one in England, contributes to the natural enforcement of the net neutrality.

Controversely, one of the panelists, Timothy B. Lee, exposed his ideas about how to preserve the net neutrality without law regulations. You can read more about his ideas, and a quite long and in-deep paper, in his blog.

I’ve recently read bad news about net neutrality in Spain. Some of the major ISPs operating in the country, like Telefónica or Vodafone, claim a monetary compensation from companies that use their infrastructures for their business, like search engines, mobile apps distributors, or VoIP companies. I personally oppose the Internet to become another TV.

Next, Pat Aufderheide directed a keynote about the concept of fair use to reuse and remix existing culture. Fair use is perfectly legal in the US and should be encouraged, even enlarging or modifying non-copying policies for homework in schools. There’s a lot of interesting material about fair use in the Center for Social Media website.

Moving on to the topic of Open Access and Access to Knowledge, it was pointed out that Open Access in public universities is low-hanging fruit and we should contact these universities to encourage them to adopt this model. The Open University Campaign, a Students For Free Culture project, contains valuable information about this. Also, the Right to Reseach Coalition is an excellent source of info about how to demand the research work paid with our taxes to come back to us without having to pay additional unfair fees.

Unfortunately, some countries lack from copyright exceptions for libraries and universities, and the changes in the law, usually promoted by the industry, always tend to make it more restrictive.

We need to take the discussion about Access to Knowledge from experts to the “family dinner”, explaining current common behaviour that is or would be illegal under the current laws, to make the public aware of how are they affected and take part in the legal discussions about copyright laws.

Also, it was pointed out that personal meetings, faxes and phone calls are much more effective than emails or Facebook campaigns to make the politicians hear our opinion.

The next panel was about Open Educational Resources (OER). Eric Frank, from Flat World Knowledge (FWK), told us that textbooks are a major portion of the tuition costs in some countries. Flat World Knowledge provides a platform to create, publish and distribute quality, peer-reviewed, customizable and flexible-licensing books that are freely accesible online and affordable as printed copies. The people from FWK have observed that, even when there’s a free printable copy of the book available, some students prefer to buy the book, which makes this publishing model presumably sustainable.

The Michigan University OER Team (Open.Michigan) is working on an impressive list of projects to enable groups and individuals to openly share their work. These are mostly collaboration tools, supporting the idea of that the knowledge is not just “transferred” from teachers to students, but something socially constructed. Some of the most interesting are dScribe, a framework to help faculty staff to gather available educational material, clear possible copyright restrictions over it (so it can be published legally under certain circumstances) and reuse it to create and publish new OERs; or OERca, the free software platform that powers most of the dScribe framework.

Finally, Timothy Vollmer, from ccLearn, told us about how CreativeCommons is helping to the development of OERs, the available tools for adequately tag content for further indexing and discovery.

Related articles

Tags: , , ,

Now one can generate graphs like this one. :)

Related articles

Tags: ,

Update! I’ve extended and polished the library and published it as pyyahoofinance at github. Feel free to critizise my coding style and laugh at me, and of course to use it and/or contribute.

I’m working on a project where I need to analyze the ups and downs of different stock values along the history and find correlations between the contraction and expansion of the market, the evolution of the indexes and simulate certain trading strategies to become rich and famous. ;)

Yahoo! Finance lets you download historical financial data in CSV, but only provides data for one stock at a time. Clicking, saving, cutting and pasting is always tedious, error-prone and a waste of time in general, so I’ve taken advantage of my good friend Python to write a script to plunder (yeah, I’m a pirate, you know ;) Yahoo!’s Standard & Poor’s 500 index in a couple of minutes and save it in a space-separated-values file named “results.txt”.

You can then generate beautiful charts like this one:

Code follows:

#!/usr/bin/python

import urllib2

CLOSE_COLUMN = 4 # the index of the column containing the close value
TICKER_COLUMN = 0 # the index of the column containing the ticker name

# get the Standard & Poor stock tickers
tickers = []
for n in range(0, 500, 50):
    url = urllib2.urlopen("http://download.finance.yahoo.com/d/quotes.csv?s=@%5EGSPC&f=sl1d1t1c1ohgv&e=.csv&h=PAGE".replace('PAGE', str(n)))
    data = url.read()
    stocks = data.split('\r\n')
    for stock in stocks:
        try:
            ticker = stock.split(',')[TICKER_COLUMN]
            ticker = ticker.replace('"', '') # remove surrounding quotes
            if ticker: # not empty ticker
                tickers.append(ticker)
        except IndexError: # empty row
            pass

global_closes = {}

for ticker in tickers:
    print "getting data from ticker: %s" % ticker
    url = urllib2.urlopen("http://ichart.finance.yahoo.com/table.csv?s=%s&a=00&b=1&c=2000&d=00&e=1&f=2009&g=m&ignore=.csv" % ticker)

    history = url.read()

    measures = history.split('\n')
    measures = measures[1:-1] # the last row is empty and the first
                              # one contains the labels

    closes = [measure.split(',')[CLOSE_COLUMN] for measure in measures]

    global_closes[ticker] = closes

columns = [[ticker] + global_closes[ticker] for ticker in global_closes.keys()]

rows = zip(*columns)
out = open('results.txt', 'w')
for row in rows:
    out.write(' '.join(row))
    out.write('\n')
out.close()

Related articles

Tags: , , ,

Back to Stockholm! I’ve spent this whole weekend in Barcelona in the Free Culture Forum, working together with more than a hundred people from all over the world to debate about how to face the new (and old) challenges with copyright, net neutrality and education, among others, and decide the next actions to take.

First of all, I’d like to congratulate and thank everyone who contributed to organize and manage this. Despite the lack of a solid financial and human support, the forum was an undeniable success in terms of organization – I felt like at home and had a real good time.

Our main task was to elaborate a document reflecting our vision, goals and demands. We worked in five groups: Education, Economy, Politics, Digital Infrastructure Rights and Legal. I worked on Education since I was invited to the event in representation of Alqua.

Since the document has been composed with the input of so many people, I’m a bit concerned about its coherence and homogeneity, so I’ll advocate for several different proof-reads before publishing anything, including mine. Also, the idea is that the different individuals and organizations who attended the forum will sign it as a whole, so we have to be very careful with the inclusion of any “too” radical demand in order to reach a reasonably broad acceptance.

One of the atendees suggested that we should speak about the next steps we, as individuals, either representing a project/group or not, will take to achieve the goals stated in our chart. I think this is rather important since otherwise (and even if we do so) we’re in risk of this awesome forum to become no more than a declaration of intentions, an utopy, without any real commitment of work and thus failed. Don’t get me wrong – I’m the first who starts slackering and procrastrinating if I don’t state my own commitments clearly. So here are my agenda of next actions, which I will post to our (hopefully upcoming) mailing list:

- Concact the Spanish universities and ask them to upload their already existing educational material to OAI-enabled repositories. OAI is a metadata standard for easy dissemination of content. Contact Ignasi Labastida (Creative Common Spain), who showed us some of the different tools available, to help me to understand how these repositories work.

- Place the already existing Alqua documents in OAI-enabled repositories, or create a new one, to increase their visibility.

- Contact David Gómez-Ullate, who is currently leading a (publicly funded!) pedagogical innovation project to use free software in some courses and research work in Universidad Complutense de Madrid.

- Investigate the current use of Free Software in the Spanish universities to find out use cases and good practices.

This is all for now, friends. If you’re (even slightly) interested in helping or have any suggestions, don’t hesitate to contact me! :)

Related articles

Tags: ,

I got bored of having to write “site:plone.org/documentation blabla” in the Firefox search box to use Google to look for documentation in Plone.org so I created a plugin following these instructions and using this generator.

Check it out!

Some tips:

  • Use Ctrl+K to get to the searchbar.
  • With the focus in the searchbar Alt+Up/Down lets you select what search engine you want to use.
  • While selecting an engine, typing a character makes you jump to the first search engine starting with this character. In our case, use ‘p’.

Related articles

Tags: , ,

It’s not the first time someone tells me that he doesn’t want to create a Facebook account for himself because he wants to keep his private life on his own. I usually think they’re too over-concerned due to a variety of reasons.

First of all, you’re not obliged to share anything you don’t want to. If you’re depressed and don’t want to tell anybody about it, nobody will interrogate you and post it in your status feed. If you’ve make up with somebody, Facebook won’t tell this to your parents.

Second, Facebook has one of the most flexible privacy settings customization I’ve ever seen. You can choose who can see each part of your profile, photos taken by you, photos of you, data sharing with 3rd party applications and much, much more, like if you allow Google to index your “profile page” or if you want to appear in public searches of people.

Some people is concerned by the possibility of somebody uploading photos of them drunk. Well, this can always happen even if you don’t have an account and:

  1. You can choose not to share your photos with everybody so unauthorized people won’t see these photos as “photos of you”.
  2. You can contact your “friend” and ask him/her to remove these photos, please.
  3. You can eventually report the photo to the Facebook staff for them to hide it, if the previous step didn’t work.

Whereas I must agree on that social networks encourage people to share more than they would have shared outside them, I don’t think the problem is in the tool but in the people using it – one has to keep in mind what’s he sharing and with who.

I’ve not read the whole Privacy Policies of Facebook so I’m not aware of all the privacy issues that could emerge from them, but I don’t think it can be worse than receiving tons of printed ads in your ordinary mailbox everyday, or even some governments’ surveillance.

Related articles

Tags: ,

What started as an utopic idea has now become real! Over the last Plone releases, the documentation had become sadly outdated, because the people writing code for the new features of the product were faster than the people writing the documentation for them.

During the last Plone Conference the Plone Documentation Team was revived. It was time to start doing things The Right Way (TM). Our idea was to bind the development to the documentation, studying PLIPs after being approved by the Framework Team and updating and extending the documentation base accordingly before the new product version is released.

And finally, we did it for 3.3! So congrats to everybody who’s participated! I hope that in the future more people will chime in and we will improve our workflow for updating and testing changes in the documentation. Some ideas:

  • We can’t publish (make visible to everybody) the documentation for the new version before the new version is released, because it will confuse people. Next PHC version will likely provide us Working Copy Support so we will be able to edit documentation “privately” while keeping the old (stable) version of a page public.
  • We have to coordinate better with the PLIP implementors to write, review and verify the documentation. Proposed workflow:
    1. Make a list of affected docs. This list will likely include only documents in the official documentation area.
    2. Make a copy of them and find someone to document the changes. With Working Copy Support, thiw will no longer be neccessary.
    3. Ask the implementer of each PLIP to review the introduced documentation changes. Test them against a beta or release candidate release.
    4. After the final release, copy the contents of the copied articles back to the live ones, and delete the copies. With Working Copy Support, promote the changes to the public page.

Happy ploning to everybody!

Related articles

Tags: ,

« Older entries