29. September 2012

Plone buildout problem – We already have zc.buildout

If you want to upgrade Plone just with buildout, then you may find following funny error:

 Installing.
 Loading extensions.
 Error: There is a version conflict.
 We already have: zc.buildout 1.5.2

Typical cause of this problem is that your bin/buildout is out of date. Solution is simple. Remove bin directory. Download latest version of bootstrap.py and let it generate new version of bin/buildout for you. Run biuldout again :)

wget http://svn.zope.org/*checkout*/zc.buildout/trunk/bootstrap/bootstrap.py
python bootstrap.py
./bin/buildout

26. August 2012

WebExpo Startup Camp – summer 2012 – materials

I’m glad that I had opportunity to join Startup Camp in Trhový Štěpánov as mentor. Together with startup teams we were discussing and preparing new sites for their products. People were learning how to use Git, how to program in Python and how to create sites in Django. At the end of the day they were able to create prototype or deploy it to Heroku cloud.

Yyou can find my slides at SlideShare or download it as PDF.

Examples of Python code and simple Django testing project are available at GitHub in repository try_git.

Read more about WebExpo Startup camp.

23. August 2012

IntelliJ Idea – How to enable zoom of text by CTRL + Mouse wheel

You can zoom-in or out text in editor window of IntelliJ idea (PyCharm) by CTRL + Mouse wheel.

The only problem is that this feature is disabled by default. You have to turn it on.

Press CTRL + Alt + S (Settings) and type: “change font size” into text search field. Select: Editor and check option “Change font size (Zoom) with Ctrl+Mouse Wheel”

20. August 2012

Problems with deploying Heroku Django app from Windows

Deploying Django app to Heroku from Windows machine is little bit tricky.

You can follow instructions in Heroku manual. The first problem that you may encounter is with Postgres support in Python. There is problem with this command:

pip install Django psycopg2 dj-database-url

If you do not have Visual Studio installed on your machine, you’ll receive error that vcvarsall.bat is missing.

Solution is quite easy. You don’t need to install Visaul Studio. Just download binary version of psycopg2 module from http://www.stickpeople.com/projects/python/win-psycopg/

Then you can exclude psycopg2 from pip install command, because it is installed in system directory of Python.

Another tricky issue is with command:

pip freeze >requirements.txt

If you type this command in PowerShell then it will automatically create Unicode file with extra bytes. When you try to deploy project with messed requirements.txt to Herou then you’ll see self explanatory error ;-)

TypeError: must be encoded string without NULL bytes, not str

Nice :-)

Just open requirements.txt file with notepad and select Save as. In Save as dialog choose ANSI.

Commit file and push project to Heroku. It will work ;)

6. December 2011

Fine tune three.js export from Blender

Three.js exporter for new version of Blender 2.60 supports many features. The problem is that default exporter settings generates quite big JSON file even for small models.

Here is list of defaut options for save model function from export_threejs.js:

         filepath = "",
         option_flip_yz = True,
         option_vertices = True,
         option_vertices_truncate = False,
         option_faces = True,
         option_normals = True,
         option_uv_coords = True,
         option_materials = True,
         option_colors = True,
         align_model = 0,
         option_export_scene = False,
         option_lights = False,
         option_cameras = False,
         option_scale = 1.0,
         option_embed_meshes = True,
         option_url_base_html = False,
         option_copy_textures = False,
         option_animation = False,
         option_frame_step = 1,
         option_all_meshes = True

These are good settings when you want to save all objects from scene. It is quite overkill when you need to save just one dynamically generated object. I recommend to turn off following options:

option_all_meshes, option_materials

Here is sample code in Python which will select object by name and save it to file with defined options:

import bpy

bpy.ops.object.select_name(name="ObjectName")
bpy.ops.export.threejs(filepath="ObjectName.js", option_all_meshes=False, option_materials=False)

Further articles about Blender and Python are located under the tag Blender on my blog.

Enjoy :)

8. August 2011

Which programming language is the most popular?

Do you wonder whether your favorite language is the most popular?

Tiobe Programming Community Index could give you some hints about it.

Here is small sample:

You can find more details about other languages also at Tiobe.com.

27. June 2011

Quick start: Blender and Python

If you know right tricks then writing scripts for Blender is quite easy.

Here is video tutorial that explains some of those tricks. Enjoy.

22. June 2011

Create mesh with correct faces in Blender by Python script

This video tutorial explains how to create mesh using Python script.

Vertices must be defined in right order when we want to define correct face.

Let’s imagine that we would like to create following object:

Numbers are marking vertices beginning from 0.

Let’s define them:

faces = ((0,1,2,3), (1,2,6,5), (1,0,4,5), (2,3,7,6), (0,3,7,4), (4,5,6,7)

Just display normals to see whether everything is ok.

As you can see, only few faces have correct normal.

In order to define face correctly use following rule:

Imagine that you’re sitting inside object and you’re looking outside.

You have to define face by naming vertices in clockwise fashion.

Solution is:

faces = ((0,1,2,3), (5,6,2,1), (4,5,1,0), (2,6,7,3), (0,3,7,4),(7,6,5,4))

For more details about Python and Blender pay a visit to blendercookie.com.

21. June 2011

Writing Python scripts for Blender with Intellij IDEA

Blender is powerful 3D modelling tool. What makes it really powerful is support for Python.

I was playing little bit with configuration of Intellij IDEA and I found out that it is possible to use Intellij IDEA for developing Python scripts for Blender.

Here is video tutorial:

Update 23.06.2011: Video tutorial was recorded for Blender 2.57. There is small change in Blende 2.58 – scripts are located in Program Files directory, like: C:\Program Files\Blender Foundation\Blender\2.58\scripts\modules

Some useful links:

20. February 2011

EuroPython 2011 – Florence

EuroPython will be this year in Italy – Florence.

When? 20.-26. 6. 2011

Speakers can submit their talk. Call for paper is now open.

You can find further information at: ep2011.europython.eu.

Twitter: @europython

  • Babel fish

      Translate from:

      Translate to:

  • Where’s the fish?

  • Further info

  • Badges

  • Video channel

  • Learning

    lynda.com online training tutorials
  • Tags

  • Topics

  • Comments