See below for a good article on the various types of indexes available in Oracle.
Oracle Indexing
Thursday, 8 December 2011
Thursday, 31 March 2011
Extending Django CMS Page Model
A very useful article suggesting a method by which custom properties can be applied to a page:
Extending Django CMS Page Model
It just goes to show how easy it is to extend Django CMS :)
Please note, as advised in the follow-up article, the custom properties are not automatically available in the menu, since menu items are instances of NavigationNode not Page. The follow-up article suggests a solution for this, but there is a proviso - it is quite inefficient from an SQL perspective, although this could be mitigated somewhat through diligent caching.
Extending Django CMS Page Model
It just goes to show how easy it is to extend Django CMS :)
Please note, as advised in the follow-up article, the custom properties are not automatically available in the menu, since menu items are instances of NavigationNode not Page. The follow-up article suggests a solution for this, but there is a proviso - it is quite inefficient from an SQL perspective, although this could be mitigated somewhat through diligent caching.
Sunday, 20 March 2011
Creating a custom 404 page in Django CMS
The default 404 (page not found) response outputs the 404.html file in your application templates directory. But what if you want something a bit more user-friendly? You can override the default 404 handler in urls.py:
Make sure you publish the page, otherwise you will get a server error instead!
I would recommend removing all but the necessary permissions on this CMS page, to stop pesky non-super-users from removing it...
handler404 = 'application.views.handler404'Now simply create a views.py module in your application and define a handler404 method:
from cms.views import details def handler404(request): return details(request, 'page-not-found')Finally, via the Django CMS interface create a page with the slug 'page-not-found'. The contents of this page now be displayed in place of the default. I use this page to display a message and the site map to the user.
Make sure you publish the page, otherwise you will get a server error instead!
I would recommend removing all but the necessary permissions on this CMS page, to stop pesky non-super-users from removing it...
Starting a new DJango CMS application, using South
This is actually very simple. Firstly, make sure that 'south' is listed in your INSTALLED_APPS. Next, simply give the following commands:
python manage.py syncdb --allThis will create all the tables required by the installed applications, as per the old method.
python manage.py migrate --fakeThis will populate the south_migrationhistory table with migration info for all applications where South is setup. Finally, you can confirm the status of your application:
python manage.py syncdb Syncing... No fixtures found. Synced: + django.contrib.admin + django.contrib.contenttypes + django.contrib.sessions + django.contrib.sitemaps + django.contrib.sites + mptt + publisher + sorl.thumbnail + sekizai Not synced (use migrations): - django.contrib.auth - cms - cms.plugins.text - cms.plugins.picture - cms.plugins.link - cms.plugins.file - cms.plugins.snippet - menus - south (use ./manage.py migrate to migrate these)You can also check what South migrations have been installed via the following:
python manage.py migrate --listThanks to Martin for his assistance with this.
Friday, 18 March 2011
Django CMS - Disabling MultilingualURLMiddleware
I have a Django CMS site, which is currently configured to display in multiple languages - I am in the process of converting this to a single-language site.
As such I need to disable the Django MultilingualURLMiddleware, but I want the old /en/ URLs to resolve and redirect to the new URLs, so that any cached/bookmarked links with behave sensibly and I don't lose the Google Page Rank for the existing pages.
How do we do this? Easy, via an Apache RewriteRule:
RewriteRule ^/en/(.*) /$1 [R=301,L]
Thanks to Benjamin Wohlwend for his solution.
As such I need to disable the Django MultilingualURLMiddleware, but I want the old /en/ URLs to resolve and redirect to the new URLs, so that any cached/bookmarked links with behave sensibly and I don't lose the Google Page Rank for the existing pages.
How do we do this? Easy, via an Apache RewriteRule:
RewriteRule ^/en/(.*) /$1 [R=301,L]
Thanks to Benjamin Wohlwend for his solution.
Informix LIMIT Clause
Informix has a proprietary specification of LIMIT clauses, via the FIRST and SKIP keywords:
SELECT FIRST 5 SKIP 20 * FROM mytable WHERE a = 1 ORDER BY b;In comparison MySQL uses the following syntax:
SELECT * FROM mytable WHERE a = 1 ORDER BY b LIMIT 5 OFFSET 20;I don't know that one is better than the other, but this is for reference.
Subscribe to:
Posts (Atom)