| .gitignore for Python developersPosted on July 23, 2010 by Mikko OhtamaaFiled Under git, plone, python, technology, web development, zope If you are using Git for version control for your Python egg and buildout development below are is a sample which you might want to put into your .gitignore file. *.mo *.egg-info *.egg *.EGG *.EGG-INFO bin build develop-eggs downloads eggs fake-eggs parts dist .installed.cfg .mr.developer.cfg .hg .bzr .svn *.pyc *.pyo *.tmp* Suggestions for new ignores are welcome.
Zoho integration for Python and Plone CMSPosted on July 18, 2010 by Mikko OhtamaaFiled Under plone, python, technology, zoho Zoho is a web application provider competing with Google Docs, Microsoft Office and Live. Zoho provides a very wide set of browser based applications from text editing and spreadsheets to project management and customer relationship management (highlighted items should ring a bell for small software development companies). Especially the last one, CRM, is a very attractive deal as you get a hosted complex CRM application with API services for very affordable or free price. Small organizations are not necessarily rich enough to go for Salesforce API supported edition which would be 135 € / month / user. mFabrik has been working on Zoho Python bindings as we use Zoho internally. Zoho API is HTTP GET/POST based.
mfabrik.zoho is a GPL’ed Python library which provides basic facilities for Zoho API calls. Currently the feature set is very CRM weighted, though it can be easily expanded for other Zoho applications. mfabrik.plonezohointegration is a Plone CMS add-on product which marry Plone and Zoho together. The add-on provides a control panel where you can enter Zoho API key details for Plone. Forms for CRM lead generation are provided as standalone and as a portlet (you can see them in action on our web and blog site). The source is hosted on Github, so you can easily start tailoring it for your own organization needs. I happily accept all merge requests, providing that unit tests for new features are included. If you do not feel comfortable with Python programming, but still want to integrate Zoho to your systems, please contact us for further help.
Debugging Skype crash problems on Ubuntu 10.04 Lucid Lynx LinuxPosted on July 16, 2010 by Mikko OhtamaaFiled Under linux, technology, ubuntu Symptoms: Your Skype crashes on incoming chat message or if you try to open a contact info / chat message – usually this leads to a crash on Skype start-up because there are always incoming chat messages in a queue. Skype is not really helpful regarding how to get meaningful log information from the client, but it is possible. Create a log directory mkdir ~/.Skype/Logs Run Skype from the command line and open a chat window so that it crashes moo@murskaamo:~$ skype Aborted Now there should be log data available moo@murskaamo:~$ ls -lh ~/.Skype/Logs/ total 724K -rw-r--r-- 1 moo moo 607K 2010-07-16 11:10 skype_20100716-1110.log -rw-r--r-- 1 moo moo 116K 2010-07-16 11:10 skype_20100716-1110.trace.txt However, those log files are little useful for anybody except Skype developers as they are encrypted. Your only hope is to submit them to a Skype bug tracker and hope that someone answers you something meaningful. The guidelines how to create a bug report and how they are processed is little unclear – there doesn’t seem to be clear announcement from Skype whether they process these reports or not. The crashes probably are due to incompatible system library versions / bugs in them. Try downloading static Skype versions which does not use system libraries.
Easily install all Python versions under Linux and OSX using collective.buildout.pythonPosted on July 16, 2010 by Mikko OhtamaaFiled Under plone, python, technology, ubuntu Here are short instructions how to install all versions (2.4, 2.5, 2.6, 2.7 and 3.1) of Python interpreters on UNIX system. The instructions were tested on Ubuntu 10.04 Lucid Lynx Linux but should work on other systems as is. The installation is based of downloading, compiling and installing different Pythons and their libraries using buildout tool. A buildout configuration for doing this is maintained by a Plone community. This buildout is especially useful to get Python 2.4 properly running under the latest Ubuntu 10.04 Lucid Lynx. This is because Ubuntu repositories won’t ship with Python 2.4 packages anymore. The installation will also include static compilation of some very popular libraries. These are dependencies for other Python packages including, but not limited, to
Prerequisites
Running itsvn co http://svn.plone.org/svn/collective/buildout/python/ cd python python bootstrap.py bin/buildout Using itAll Pythons are under virtualenv installations. This means that you can activate one Python configuration for your shell once easily (python command will run under different Python versions). Activating Python 2.4 source python/python-2.4/bin/activate (python-2.4)moo@murskaamo:~/code$ python -V Python 2.4.6 Check that Python Imaging Library works python Python 2.4.6 (#1, Jul 16 2010, 10:31:46) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import PIL (No exceptions raised, Python Imaging Library works well).
Changing the location of Ubuntu 10.04 Lucid Lynx notification bubble to a different cornerPosted on July 16, 2010 by Mikko OhtamaaFiled Under linux, technology, ubuntu Ubuntu notifications, those grey bubbles for incoming instant messages and such, are in the top right corner under the system tray area by default. Many applications, like Google Chrome browser, place lots of controls there and notifications might block them. Also, you might prefer some other corner due to your personal taste. The application for responsible for those bubbles is called notify-osd. Here are instructions how get a custom notification-osd which can read a config file where you can specify settings for the notifications. Though it requires you to install a custom notify-osd version, the instructions are plain and simple. For less hardcode users, there also exists a version with graphical user interface to configure notify-osd.
Nokia N900 direct OVI map download links – no Windows software neededPosted on June 6, 2010 by Mikko OhtamaaFiled Under n900, technology Here. You can directly download files using N900 browser. Then with little shell diving you can also install them. Automatically generating description based on body textPosted on June 4, 2010 by Mikko OhtamaaFiled Under plone, python, technology Below is a sample script to automatically generate descriptions based on page body text. It is for Plone CMS, but should be applicable to any Python based CMS with some modifications. The idea is that we take three first sentences and use them as a description. Use case: People are lazy to write descriptions (descriptions as in Dublin Core metadata). You can generate some kind of description by taking the few first sentences of the text. This is not perfect, but this is way better than empty description. Also, the script comes with good comments which should be helpful for beginner Plone programmers.
Please comment if you have other simple ideas to generate descriptions.
Usage
Since Zope uses RestrictedPython for through-the-web created scripts, the user of this script cannot breach the server security (they cannot make Python calls they have no permission for). This sets some limitations for automating tasks like this, but we don’t hit those limitations in our use case. def create_automatic_description(content, text_field_name="text"):
""" Creates an automatic description from HTML body by taking three first sentences.
Takes the body text
@param content: Any Plone contentish item (they all have description)
@param text_field_name: Which schema field is used to supply the body text (may very depending on the content type)
"""
# Body is Archetype "text" field in schema by default.
# Accessor can take the desired format as a mimetype parameter.
# The line below should trigger conversion from text/html -> text/plain automatically using portal_transforms
field = content.Schema()[text_field_name]
# Returns a Python method which you can call to get field's
# for a certain content type. This is also security aware
# and does not breach field-level security provded by Archetypes
accessor = field.getAccessor(content)
# body is UTF-8
body = accessor(mimetype="text/plain")
# Now let's take three first sentences or the whole content of body
sentences = body.split(".")
if len(sentences) > 3:
intro = ".".join(sentences[0:3])
intro += "." # Don't forget closing the last sentence
else:
# Body text is shorter than 3 sentences
intro = body
content.setDescription(intro)
# context is the reference of the folder where this script is run
for id, item in context.contentItems():
# Iterate through all content items (this ignores Zope objects like this script itself)
# Use RestrictedPython safe logging.
# plone_log() method is permission aware and available on any contentish object
# so we can safely use it from through-the-web scripts
context.plone_log("Fixing:" + id)
# Check that the description has never been saved (None)
# or it is empty, so we do not override a description someone has
# set before automatically or manually
desc = context.Description() # All Archetypes accessor method, returns UTF-8 encoded string
if desc is None or desc.strip() == "":
# We use the HTML of field called "text" to generate the description
create_automatic_description(item, "text")
# This will be printed in the browser when the script completes succesfully
return "OK"
How to install Joomla! on your Ubuntu/Linux server with basic securityPosted on May 31, 2010 by Mikko OhtamaaFiled Under apache, linux, technology, ubuntu This how to shorty explains how to set-up a Joomla! hosting on a shared hosting server you own to have basic security. This instructions apply for Debian/Ubuntu based systems, but can be generalized to any Linux based system like Fedora.
In this how to we use the following software versions
The instructions may apply for other versions too. PrerequisitementsWhat you need to have in order to use this how to
User setup
|
