Author Archives: admin

Evolus Pencil – wireframes and prototyping

During my consequential research and exploration of UML and prototyping tools for Linux I found something I really enjoy way too much than expected. It's the Pencil Project.

Pencil is an open source tool based on Firefox for drawing UI prototypes, schemes, wireframes. It has a pretty interface which is usable and fast, it could be ran over Firefox or as a stand-alone application in most of the operating systems around. I had installed it on my Fedora station and now I enjoy drawing schemes for my clients since then. 

The Pencil project offers some standard shapes for drawing, web components (h1 to h6, lorem ipsum, panels...), UI components from Forms (buttons, labels) and other popular things like tables that you might need to show the basic structure. Using a Windows Form/Frame as a parent component it looks exactly like a standard Swing or Forms application. Also, it has alignment of components by horizontal and vertical coordinates related to previously positioned elements. And so on. It's mandatory to try and use in the future. 

Other more complex charts could be painted as well - it's up to you. Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati

Export PDF with handouts in Impress, Linux

I need to print an Impress presentations as PDF with handouts - 3 slides per page in the left column and empty rows for taking notes on the right. 

The File -> Export to PDF option doesn't allow chaining more than 1 slide to a page. On the other hand, printing allows dividing a page to a few handouts, but no PDF export could be done. The only option in-between is priting as file to a .PS format which is still a file, but not that portable and popular (and flexible) as PDF.

So, we need to create a virtual printer.

  1. Install cups-pdf - it's freely available in all repos for Debian, Ubuntu, Fedora etc.
  2. Add a default printer for cups-pdf (it got installed automatically here)
  3. Open the Impress presentation
  4. Go to File -> Print
  5. Select the Print Content -> Handouts (with 3 or 6 for a page) and then find your new virtual printer.
  6. PDF is exported (hint: by default is sent to the desktop). Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati

Project moon circle

Projects come and go, and this cycle is way important for a freelancer.

Recently I've been in a full circle for the past few months with no option to turn off for a week or so. I've been occupied even during my summer holiday (although I hadn't worked a lot there), however all of my time here is busy with existing projects, trainings, events etc.

I'm trying to close 3 CakePHP based projects at the moment and bugfix on a Croogo one. At the same time I'm doing my final lectures of my Java for QA's training for VMware. I've rejected few web projects because I cannot handle that much work and I sincerely hope that we could start something bigger. There is too much communication and coordination when you manage 4+ projects and I prefer working on 2 projects at all. That would reduce the time that we spend on meetings, skypes, mails etc with many clients at a time and help me focus on the real core of the project.

I am also negotiating on 2 Java projects, one of them is Groovy based. I am keen on Java and on scripting RAD as well and Grails does them both, so I'd be happy to code that for a couple of months, I suppose. At the same time I'm trying to teach trainings and manage more in order to have some sort of relaxation for a month or two, before I get back to the real hardcore freelance for a living. Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati

Freelance Seminar 2010

Last week we had our first formal Freelance Seminar in Bulgaria. After few conferences and public lectures we did a full-day seminar on freelance. The Freelance Lodge with cooperated with, MiNDS and CCB for that event to happend. 

Video materials are expected, more info is available here and here. However, we hope that freelancers all around the country will join our community and be responsible enough to help other events and workshops happen as well. Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati

Linux noob command line hints

I've been working with Linux for a couple of years but I'm not sysadmin so I use the parts of the system that I need at work. Mostly different activities with user interface interactions (which is similar to Windows behavior). However working on remote servers, comparing data, transfering and managing projects requires ssh-ing, some file management, archiving, searching in file system, filtering data, hiding folders etc. Here there are few of the tips I've used in the past days and I find useful:

Create/Extract archive ('z' option could be added as well if working with tar.gz files):

tar cvf archive.tar directory

tar xvf archive.tar

Print/list the content of a tar archive:

tar -tvf archive.tar

Create an archive from a SVN-based project excluding SVN:

tar --exclude=.svn -c -f archive.tar projectdirectory

Works for copying an SVN directory with rsync without .svn subdirectories:

rsync --exclude=.svn -r somedirectory somenewplace

Find differences between 2 directories with changes in each file:

diff -r directory1 directory2

Print only file names of different files in 2 similar directories:

diff -r -q directory1 directory2

Filter the 2 directories comparison and hide the .svn entries from output

diff -r -q directory1 directory2 | grep -v .svn

Copy data directory from local machine to a remote machine via SSH (reverse paths for vise verse):

scp -r yourdirectory

Any tips from you? Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati

Access beforeFilter set variable in controller (CakePHP)

In a CakePHP application we could define an intermediate abstraction of a controller called AppController. The concept is having a Controller class defined by Cake core, writing controllers for our project and defining app_controller.php file for our common functions repeated in every controller.

In this case we usually use beforeFilter or beforeRender method in AppController in order to define some data to be transferred automatically in every controller. More about app_controller and callback functions.

When a variable is set in beforeFilter, it could be used with it's name later in CakePHP views. For example:


  2. $this->set('products', array('P1' => 'Pizza', 'P2' => 'Water'));


Any view later:


  2. <?php echo $products['P1']; ?>

But that variable could not be accessed directly in a controller function. In this case we could use viewVars array in order to access beforeFilter set variable in other controller method, which solves our problem: 


  2. function test() {
  3. $products = $this->viewVars['products'];
  4. $product_1 = $products['P1'];
  5. }
  6. Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati

Django multilingual: select translation instead of ‘None’

If you use the django-multilingual module for multilingual content, you need to add a translation for every language your entity could be seen through. Otherwise you get 'None' as a title (which is way too blurry and quite indescribable). Thanks to my colleague and friend lpetrov I found a way to pass through this limitation and print any possible translation if the current one is not available.

I've added a file in my project which I import in all my apps when necessary. Here there is the code:

  1. def get_local_str_or_other(obj, field_name):
  2. result = getattr(obj, field_name)
  3. if result:
  4. return result
  5. else:
  6. field_for_search = field_name + "_"
  7. translations = [getattr(obj, field_for_search + lang[0].replace("-","_")) for lang in settings.LANGUAGES]
  8. for translation in translations:
  9. if translation != None:
  10. return unicode(translation)

Later I import the function in my models and I redefine the __unicode__ function. If the name I want to print by default is the field 'title', we have the following:

  1. def __unicode__(self):
  2. return get_local_str_or_other(self, "title")
  3. Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati

Django debugging (presentation)

 I found a great presentation on Django debugging from Simon Willison.

It's a presentation on "Django 101 in troubleshooting". You could find information how to address any errors from the error pages that django throws away, how to follow stack traces and how to debug information in variety of ways.

Simon pays attention to the basic and the core of all debugging tools - the console. Every single output pass through the console itself so it is the mother of all outputs. Other popular options is the python debugger under the pdb package. 

I personally do like django-debug-toolbar for my apps. It is quite useful for taking care of the HTTP requests and response, passed variables across the website and so on. You could check the number of SQL queries and the load time of your website. Another important feature is printing the list of all templates used for rendering a web page. You could check the settings list for the current page load as well as the signals being called at the moment.

More on the django-debug-toolbar - Rob speaks here. Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati

Easy AJAX calls in CakePHP

 CakePHP is a great framework for rapid development of web based applications that serves well the principles of DRY (Do not Repeat Yourself). However unlike other web frameworks, CakePHP is not (and probably will not) fully AJAX based (for instance, you could check the list of PHP Ajax frameworks or try some Java/Python implementations such as Google Web Toolkit and Pyjamas). 

In no way the statement above means that you cannot do some flexible and dynamic client-side calls into your CakePHP site. You could freely use plain Javascript in your views, use the JS helper of CakePHP or add some prototype/jQuery library and take advantage of its features. Beyond all that possibilities you could use one more helper of Cake - the AJAX helper. The AJAX helper provides an intuitive interface for maintaining some standard task with only few lines of code.

Some of the methods that you can use with the Ajax helper:

  • link
  • remoteFunction
  • form
  • observeField
  • autoComplete
  • drag & drop

and few more that you could find in the link above. 

The standard 1.2 implementation expects prototype and scriptaculous in order to run properly. However you could easily replace them with jQuery (and jQuery UI) libraries. Some examples on that: Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati

How to hide load time comment for AJAX calls in CakePHP

 CakePHP puts some debug info after page load including the load time of the page. Even though it is an HTML comment line, it does affect returned data for AJAX calls (and not only). 

If we do return JSON, we could set the returned type for json-like and then json_encode the data using the $this->autoRender = false; clause. However, if we expect some specific data (like a boolean yes/no result), we would have problems with the debug feature of CakePHP.

So we could disable the debugging feature of Cake only for AJAX calls adding this statement to the beforeFIlter() action of the app_controller.php:


  1. if ( $this->RequestHandler->isAjax() ) {
  2. Configure::write('debug',0);
  3. } Digg DZone Facebook Google Google Reader Magnolia reddit SlashDot Technorati