Yawd website

Articles Tagged open-source

  1. Tuning the yawd-elfinder Django file manager performance

    The latest version of yawd-elfinder allows you to manage your remote files through the application and link them to your models using Django file storages. There exist several 3rd party storage applications (like django-storages, django-dropbox etc.) that enable connection to various remote systems. Amazon s3, ftp and sftp backends, even your dropbox public folder are just an example of what can be connected to yawd-elfinder.

    However, depending on the driver, remote connections may affect the performance of yawd-elfinder. For example the dropbox storage uses a restful API to perform its operations, meaning that an http request must be sent for any required information. Although yawd-elfinder instantiates each storage only once in an effort to avoid negotiations for subsequent elfinder requests, this is not enough. To improve performance in this case you can use two options that tune the caching behavior of yawd-elfinder.

    Posted on November 7th, 2012 by Pantelis Petridis
  2. Managing files with django - a yawd-elfinder tutorial

    File management with django and yawd-elfinderFile management with django and yawd-elfinder.

    I've always liked elFinder. It is a jQuery application that allows for managing files through a web page. elFinder is capable of uploading, moving, previewing and editing all kinds of files on the fly. In version 2 you can also resize, rotate and crop your images online, so it is a perfect solution for your django website's administration interface. To integrate elfinder with django we created a reusable django application, the yawd-elfinder. In this simple tutorial we will install yawd-elfinder and connect it to our models. For more control over your files, please advice the documentation.

    Posted on September 24th, 2012 by Pantelis Petridis
  3. Ajax Coin Slider: A jquery image slider with asynchronous image loading

    Ajax coin slider - screenshot from the yawd websiteFigure 1. Ajax coin slider - screenshot from the yawd website

    While working on my latest project, I was in need for a jquery slider capable of loading images asynchronously. When you run a big website with heavy pages and you need a slider with, say, 10 slide images, you are in trouble. Let's do the math: Suppose each image is sized 100KB, then you need to put an extra weight of 1MB to your homepage! Traditionally, image sliders load all images from the html code and as soon as the page loads, a javascript comes in to make the magic happen. This means that a user must wait a long time before the webpage loads. Moreover, it is always better to display content on demand rather than pre-load it. It saves you from the extra bandwith and lets the web server breathe!

    Posted on January 10th, 2012 by Pantelis Petridis
  4. Embed the elRTE WYSIWYG editor in your django applications

    Screenshot of the yawd website admin panel - the elRTE django widgetScreenshot of the yawd website admin panel -the elRTE django widget

    Elrte is an open-source "What You See Is What You Get" editor written in jQuery. In my latest projects i tend to prefer this over other solutions (such as TinyMCE, (F)CKEditor etc) for its elegant UI, ease of use and mainly for its accompanying File manager (the elFinder). In this article we'll se how to integrate elRTE with django models, so that your text fields can take advantage of this editor.

    Posted on September 16th, 2011 by Pantelis Petridis
  5. Using class-based views to process a django form through ajax

    Field-specific errors with the JSONFormView class-based view Since Django 1.3 class-based views have been introduced to allow for code reusability. Class-based views have been criticized for their poor documentation (count me in) and their amazing ability to grow our code size instead of reducing it! The latter appears to be true only if we are not careful with sub-classing. On the other hand class-based views finally deliver django what has been missing: a consistent way of coding all your models, forms and views.
    Unfortunately, django's generic class-based views do not provide a mechanism for implementing JSON views. Ajax requests are the standard way of doing things these days and I feel that django needs some work towards this direction. However, the official documentation offers the implementation of a simple JSONResponseMixin that we will use as a base for our own view. What we try to achieve here is create a view that will process a form, return the errors when the form is not valid or save the form and return a success message otherwise. This is a fairly common scenario and extremely useful when a full page reload is not acceptable (e.g. a newsletter subscription form).
    Posted on August 30th, 2011 by Pantelis Petridis
  6. Allow for lazy dynamic choices in django's model fields

    Here's a quick how-to for those that need to dynamically generate model field choices with django. Normally we would define a CharField as follows, where choices should be a tuple containing static choices.

    Posted on August 16th, 2011 by Pantelis Petridis
  7. Migrate to Keystone 5

    If you want to upgrade your old Keystone TKL digital library and exploit the fast performance that Keystone 5 offers, here's what you most likely need to change. Please note that since PHP5 differs significantly over PHP4, you should also modify your custom PHP code, especially if it involves XML/DOM manipulation to work with PHP5.

    Posted on August 5th, 2011 by Pantelis Petridis
  8. Install Keystone 5 under Ubuntu/Debian

    In this article we'll see how to install Keystone 5 (ex. Keystone DLS (TKL)) under Ubuntu/Debian. I have tested the procedure using Ubuntu Natty (11.04) as well as Debian Lenny (5).

    Posted on July 21st, 2011 by Pantelis Petridis
  9. Use of classes and static variables with the Drupal 6 Batch API

    Drupal provides a nice API for anyone that needs to process a massive amount of data: the Batch API. This allows for running heavy scripts split into multiple operations while providing a progress bar to monitor the process' progress. However this API is not adequately documented and I had a hard time trying to resolve some issues I come across. I thought of sharing my findings in case someone else needs this.

    Posted on July 13th, 2011 by Pantelis Petridis
  10. How to add sitemap functionality in websites powered by django-articles

    Django-articles is an open-source blogging engine written in django. Unfortunately it does not offer a sitemap mechanism and since the yawd blog uses django-articles I had to implement it. If you have a django-articles powered website and want to add a sitemap here is how to do it:

    Download the sitemaps.py file attached to this article and place it under your project's main application. This module uses django's built-in sitemaps framework to define a...

    Posted on June 30th, 2011 by Pantelis Petridis
  11. How to automatically add taxonomy term relations when adding content in Drupal 7

    Let's suppose we want our Drupal article content type to have a parent category and a sub-category. We have defined a 'categories' vocabulary and we are also able to add new terms and set their parent elements. When using the administration UI to add a new article we can create a new category, set a new sub-category and both taxonomy terms will be saved along with the article. However, the sub-category won't be connected with its parent category automatically. We need to manually visit the taxonomy terms list and set the sub-category's parent category term.

    This is a problem I came across when working on a yawd project and to solve it I had to create a simple module that programmatically correlates the sub-category with its parent category field...

    Posted on June 29th, 2011 by Pantelis Petridis
  12. Keystone TKL framework for Digital Libraries now supports PHP5

    The past few years IndexData's Keystone Library framework has not been actively developed. When PHP5 was introduced back in 2004 it featured a completely redesigned Document Object Model (DOM) implementation that lacked backward-compatibility. At the same time, Keystone was heavily relying on XML manipulation, so it was not possible for these two to work together and Keystone users were forced to use PHP 4. IndexData at the time focused on other projects and officially stopped...
    Posted on June 24th, 2011 by Pantelis Petridis
  13. Admin widget for generic relations in django

    The contenttypes framework adds wonderful functionality for dynamic foreign keys in Django. However, it lacks of a widget to allow the user select the content object from the administrator website. This article explains how to implement such a widget and embed it to your django-powered project.

    Posted on May 26th, 2011 by Pantelis Petridis
  14. Using signals to generate a decoupled tree-menu application in django

    Although there exist several django menu applications -the excellent django-treemenus is one of them-, they all require that the user explicitly sets the menu structure. Consider the following scenario in a django CMS application: The user will probably be able to define a list of article categories -and sub-categories- and will also write a bunch of articles tied to each one of these categories. At the same time, this hypothetical user would also be able to use a blogging engine and publish his thoughts. Let's assume that the user wants to add an article category to the menu and use its sub-categories as sub-menuitems. He also wants to add a link to the blog main page and use the most popular tags as sub-menuitems. To accomplish this he must manually define a menuitem for each menu link and map it to the corresponding url, which is less than ideal. In this article, we will demonstrate a menu application that would enable the user to define a top-level item -e.g. an article category- and optionally have all children items automatically inherited from the corresponding parent element.

    Posted on May 20th, 2011 by Pantelis Petridis