Sunday, August 14, 2016

PyDev in Eclipse Cannot Locate multiprocessing.Process

I am using PyDev with Eclipse. Recently, I found that PyDev complains that it cannot find multiprocessing.Process when it analyzes the code, as such, it marked "Process" as a symbol that cannot be resolved in a statement as below, although I can run and debug the script without any problems,


    from multiprocessing import Process


A discussion at Stackoverflow comes to rescue and provides the following answer,


"If you're using Eclipse and PyDev you need to include 'multiprocessing' as a forced builtin for the python interpreter."

The question becomes, how may we add a forced builtin? The answer is in this PyDev manual page, that is,
  1. Go to: window > preferences > PyDev > Interpreter - (Python/Jython/IronPython).
  2. Choose the interpreter you have installed in your computer.
  3. Select "Forced Buildins", and choose "New", finally, add "multiprocessing".



Sunday, August 7, 2016

Developing Google Apps Scripts Add-ons

This posts provides a brief review on the advanced techniques to develop, manage revisions, and publish Google Apps Scripts add-ons.

It is assumed that you have installed the node-google-apps-script that provides gapps and authenticated it with Google Apps engine, and uses Eclipse to manage the Google Apps Scripts add-ons projects.

Initiating a Project

  • Create a new Google Apps Script project remotely at http://script.google.com, name the project properly, and allow it to save to the Google Drive. Note that the project will be stored in your Google drive. You should also now look up the the project id, which can be accomplished by at http://script.google.com, going to "File", and then "Project properties", finally, locating the "Script ID".
  • Create a JavaScript project locally using Eclipse or some other IDEs of your choice.
  • Initialize  the project with gapps locally as follows,
    
    gapps init my_project_id
    

    Note that my_project_id must be replaced by the actual project id.

Developing and Revision Management

You can now develop the project locally and manage it using any revision management system you prefer, such as git.

Be aware that locally, the main script is named as Code.js instead of Code.gs. It will be automatically named as Code.gs when it is uploaded to your Google drive.

Uploading Project


Having tested your code, you can now upload our project to the Google Drive.

gapps upload

Publishing Project

To publish the Google Scripts Add-on projects to the Google Chrome Web Store, you must first have a verified Google Chrome Web Store Console account, without which, you will not be able to publish your project and at present, the website http://script.google.com does not give you much meaningful error messages either.

Therefore, you must first verify your account at Google Chrome Web Store Console site, for which, Google requires you to pay a nominal fee, at  the time this post is written, $5.

Once you meet the above requirement, to publish an add-on, or to update an published add-on. Detail information is in this piece of Google documentation. In the nutshell, at http://script.google.com, choose "Publish", and then select "Publish as Web Add-on".





Friday, August 5, 2016

Installing Adobe Reader in Ubuntu 16.04 LTS

For those who like Adobe Reader to read PDF files, you may find it difficult to install Adobe Reader on Ubuntu 16.04 LTS systems. Assembling information from a few posts, here is the solution that worked for me,
 

sudo apt-get clean all
sudo add-apt-repository "deb http://archive.canonical.com/ precise partner"
sudo apt-get update
sudo apt-get install adobereader-enu
sudo add-apt-repository -r "deb http://archive.canonical.com/ precise partner"
sudo apt-get clean all
sudo apt-get update

If you are on a x64 system, you may see many annoying warning messages when you run acroreader, such as,

......
(acroread:19366): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
......
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "gail"
Gtk-Message: Failed to load module "atk-bridge"


To get rid of the warning messages, install these four packages gtk2-engines-murrine, libcanberra-gtk-module, libatk-adaptor, and libgail-commonfor i386 as follows,

sudo apt-get install gtk2-engines-murrine:i386 libcanberra-gtk-module:i386 libatk-adaptor:i386 libgail-common:i386

If you are running Gnome like I do, then the last step is to set up default application for open PDF files. This is to edit the /etc/gnome/defaults.list file.

sudo gedit /etc/gnome/defaults.list
The editing is to find and replace the line

application/pdf=evince.desktop

by

application/pdf=acroread.desktop
and add the following lines to the end of the file,

application/fdf=acroread.desktop
application/xdp=acroread.desktop
application/xfdf=acroread.desktop
application/pdx=acroread.desktop

Finally, run nautilus to apply change if you do not wish to log out and log back in.

nautilus -q