on i4PACE(i for Personal Archiving and Creating Environment)
actions » SearchLogin 72 articles • 04 Jul 2009

Recent articles

Saturday, 18 Apr 2009

permalink Portable Ubuntu

Didn't know about PUbuntu, i.e., Portable Ubuntu. Found it thru an article, downloaded Portable_Ubuntu.exe fromhttp://portableubuntu.demonccc.com.ar/. Installation is simply to double click the downloaded file. Installed on a hard disk. Worked fine! Installed on a pen drive. Kinda slow, but worked OK :-) Here's a screen shot to show the co-existence of Windows and Ubuntu.
[[image: pubuntu_1.png]]
The top taskbar is of Ubuntu's, whereas the bottom one of Windows'. The Firefox window is of Ubuntu's, and the Internet Explorer is of Windows.

The size of the downloaded file is 438MB . 1.85GB when installed. For pendrive, I copied the folder on harddisk to a folder in pendrive and worked as it claims to be "portable". Copying in my particular pendrive took some hours.

• Wrote Teru at 23:04 (edited 3×, last on 19 Apr 2009) | read 18× | 0 Comments

Tuesday, 14 Apr 2009

permalink web2py 4

Working with web2py on a server turns out to be troublesome. Because applications often suppose admin operations are performed on a local server. Moreover, the assumption goes into the core of web2py codes in some cases. For example, when inserting data to a database in appadmin of an application, a dialog box shows a selection of folders and files, not of the server, but of the client computer on the LAN. I don't know how to fix it without touching the code in web2py.

My current position is not a developer, but a user. So, avoiding the trouble, I'm going to install a desktop upon server, to do administration work on the local server. This page explains how to install Japanese desktop on an Ubuntu server. Following the instructions, add the repository as

wget -q https://www.ubuntulinux.jp/ubuntu-ja-archive-keyring.gpg -O- | sudo apt-key add -
sudo wget https://www.ubuntulinux.jp/sources.list.d/intrepid.list -O /etc/apt/sources.list.d/ubuntu-ja.list
sudo apt-get update

Upgrade

sudo apt-get upgrade

Install desktop

sudo apt-get install ubuntu-desktop

To create the remixed Japanese version,

sudo apt-get install ubuntu-desktop-ja

.

• Wrote Teru at 20:07 (edited 4×, last on 19 Apr 2009) | read 20× | 2 Comments

Wednesday, 08 Apr 2009

permalink web2py 3

So far, successfully ran web2py locally, then ran it on a local server over LAN and actually over Internet thru a reverse proxy server. The access as an administrator, however, was restricted only to localhost. By enabling https connection, I could access to admin on a server over LAN. When installed some applicances, KPAX CMS was OK, but JobSite had a problem, i.e., I couldn't see the database... It was available when connectind thru a local host. Maybe, it's because the application is not configured to be accessed thru an https connection, I wonder. I'm not sure.

Meanwhile, I found another way to access to admin thru a tunneled ssh here. I didn't know the use of ssh this way before. Surely worth trying. Supposedly JobSite shouldn't cause a problem because it's equivalent to connecting from a localhost.

Yes, it works! JobSite's admin is working correctly :->

• Wrote Teru at 21:45 (edited 2×, last on 08 Apr 2009) | read 12× | 0 Comments

Monday, 06 Apr 2009

permalink web2py 2

have run web2py on a local desktop, and now try to install on a local server.

Downlod the source from here.

$ cd web2py-read-only
$ python web2py -help

gives me

Usage: python web2py.py

web2py Web Framework startup script.  ATTENTION: unless a password is
specified (-a 'passwd') web2py will attempt to run a GUI. In this case command
line options are ignored.

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -i IP, --ip=IP        the ip address of the server (127.0.0.1)
  -p PORT, --port=PORT  the port for of server (8000)
  -a PASSWORD, --password=PASSWORD
                        the password to be used for administration (use -a
                        "<recycle>" to reuse the last password))
  -u UPGRADE, --upgrade=UPGRADE
                        upgrade applications
  -c SSL_CERTIFICATE, --ssl_certificate=SSL_CERTIFICATE
                        file that contains ssl certificate
  -k SSL_PRIVATE_KEY, --ssl_private_key=SSL_PRIVATE_KEY
                        file that contains ssl private key
  -d PID_FILENAME, --pid_filename=PID_FILENAME
                        file where to store the pid of the server
  -l LOG_FILENAME, --log_filename=LOG_FILENAME
                        file where to log connections
  -n NUMTHREADS, --numthreads=NUMTHREADS
                        number of threads
  -s SERVER_NAME, --server_name=SERVER_NAME
                        the server name for the web server
  -q REQUEST_QUEUE_SIZE, --request_queue_size=REQUEST_QUEUE_SIZE
                        max number of queued requests when server unavailable
  -o TIMEOUT, --timeout=TIMEOUT
                        timeout for individual request
  -z SHUTDOWN_TIMEOUT, --shutdown_timeout=SHUTDOWN_TIMEOUT
                        timeout on shutdown of server
  -f FOLDER, --folder=FOLDER
                        the folder where to run web2py
  -v, --verbose         increase --test verbosity
  -Q, --quiet           disable all output
  -D DEBUGLEVEL, --debug=DEBUGLEVEL
                        set debug output level (0-100, 0 means all, 100 means
                        none, default is 30)
  -S APPNAME, --shell=APPNAME
                        run web2py in interactive shell or IPython(if
                        installed) with specified appname
  -P, --plain           only use plain python shell, should be used with
                        --shell option
  -M, --import_models   auto import model files, default is False, should be
                        used with --shell option
  -R PYTHON_FILE, --run=PYTHON_FILE
                        run PYTHON_FILE in web2py environment, should be used
                        with --shell option
  -T TEST_PATH, --test=TEST_PATH
                        run doctests in web2py environment, TEST_PATH like
                        a/c/f (c,f optional)
  -W WINSERVICE, --winservice=WINSERVICE
                        -W install|start|stop as windows service
  -C, --cron            trigger a cron run manually, usually invoked from a
                        system crontab
  -N, --no-cron         Do not start cron automatically
  -L CONFIG, --config=CONFIG
                        Config file
  -F PROFILER_FILENAME, --profiler=PROFILER_FILENAME
                        profiler filename
  -t, --taskbar         Use web2py gui and run in taskbar (system tray)

Run the server as

$ python web2py --ip=192.168.1.81 --port=8801 --password=******

where ****** is a password. To make it secure, rerun it in the background as

$ python web2py --ip=192.168.1.81 --port=8801 --password="<recycle>" &

where "<recycle>" spacifies the password used last time. Open a browser on a desktop computer connected thru LAN, and wow :-D
[[image: web2py_on_server.png]]
It worked so easily. Thanks Massimo for making this excellent software ^_^

Now, when I click the link "click here for the administrative interface" on the page, I get a message on a browser:

Admin is disabled because unsecure channel


Ooops, what's wrong? Checked the archive of GoogleGroup web2py Web Framework, and found a comment by Massimo: "... admin and appadmin only work from localhost and remotely via ssl (ssh tunnel or https is enabled) " OK, some work to do. Looked at Deployment Recipes in a manual for web2py. Hmm, seems a lot of work to run behind Apache...

Seek a minimal requirement to let me access to admin thru LAN here. I.e., get a ssl certificate and a ssl private key as options for running web2py. Found a page for Creating Certificate Authorities and self-signed SSL certificates. Follow the instructions to create a self-signed certificate.

$ sudo su
$ cd /etc/ssl
$ mkdir self_signed
$ chown root.ssl-cert self_signe
$ chmod 7
$ cd /etc/ssl/self_signed
$ chown root.ssl-cert self_sign
$ openssl genrsa -des3 -out server.key 4096

Typed a pass phrase when asked.

$ openssl req -new -key server.key -out server.csr

then

Country Name (2 letter code) [AU]:JA
State or Province Name (full name) [Some-State]:Yamagata
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:YUI Limited Partnership   
Organizational Unit Name (eg, section) []:                        
Common Name (eg, YOUR name) []:web2py.emedia.jp
Email Address []:homma.t@gmail.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

For signing the certificate signing request,

$  openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Signature ok
subject=/C=JA/ST=Yamagata/O=ip/CN=web2py.emedia.jp/emailAddress=homma.t@gmail.com
Getting Private key
Enter pass phrase for server.key:******

Create a version without password.

$ openssl rsa -in server.key -out server.key.insecure
Enter pass phrase for server.key:******
writing RSA key

$ mv server.key server.key.secure
$ mv server.key.insecure server.key

Now accessing http://192.168.1.81:8801/ from a browser at a desktop gives [[image: web2py_server_1.png]]
Oops %-|
Changed to http://192.168.1.81:8801/ gives
[[image: web2py_server_2.png]]
Hitting to accept it,
[[image: web2py_server_3.png]]
Jump to the link " click here for the administrative interface", then
[[image: web2py_server_4.png]]
After typing the password, get [[image: web2py_server_5.png]]

OK. Ready to run appliances/applications! :-D
Later, will need to daemonize the start of the server with the script providec as ./scripts/web2py.ubuntu.sh. To deploy in production, will need to run web2py as an wsgi application on Apache.

• Wrote Teru at 08:09 (edited 9×, last on 29 Jun 2009) | read 49× | 0 Comments

Thursday, 19 Feb 2009

permalink web2py

Download the source code from here. Unzip web2p.zip. At terminal,

$ python web2py.py

returns

unpacking apps, this may take a few minutes...
default applications are now installed
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2009
Version 1.56.3 (2009-02-16 10:07:09)
Database drivers available: SQLite3

and a new window
[[image: web2py_server.png]]
Type a password in and push "start server" button.
[[image: web2py_start_server_1.png]]
Push "OK"
[[image: web2py_start_server_2.png]]
is shown on a browser. Click [click here for the administrative interface].
[[image: web2py_start_server_4.png]]
Type the password, and push 実行 button.
[[image: web2py_start_server_5.png]]

Downloaded an application KPAX CMS, and uploaded with a name Kpax. [[image: web2py_start_server_7.png]]
Hit the Kpax link.
[[image: web2py_start_server_8.png]]
Register a user and login.
[[image: web2py_start_server_9.png]]
Looks good... but, how am I going to edit the site? Go back to http://127.0.0.1:8000/admin/default/site, and hit "design" under Kpax.
[[image: web2py_kpax_1.png]]

• Wrote Teru at 12:55 (edited 5×, last on 19 Feb 2009) | read 12× | 0 Comments

Friday, 09 Jan 2009

permalink Translate toolkit

Installed the latest version of translate-toolkit 1.2.1. First, downloaded translate-toolkit_1.2.1-1_all.deb at http://translate.sourceforge.net/wiki/. Needed to add python-lxml on Ubuntu.

Also, installed virtaal, a simple editor for PO files by downloading a deb file at the same site. It's version0.2 and very simple, which may be good for further customization.

• Wrote Teru at 16:45 | read 76× | 11 Comments

Thursday, 25 Dec 2008

permalink CouchDB

Got interested one of Apache projects called CouchDB (http://couchdb.apache.org).

Looked at http://wiki.apache.org/couchdb/Installing_on_Ubuntu, and installing on Ubuntu8.10 is just

$ sudo apt-get install couchdb

To start,

$ sudo /etc/init.d/couchdb start

$ sudo /etc/init.d/couchdb status

returns

Apache CouchDB is running as process 4455. Time to relax.

Accessing http://localhost:4455/ gives me an error. Following http://wiki.apache.org/couchdb/Installing_on_Ubuntu, accessed http://localhost:5984/ gives me

{"couchdb":"Welcome","version":"0.8.0-incubating"}

on a browser. Well, /etc/couchdb/couch.ini shows the port 5984. Should've looked at.

OK, what's next? Going back to FrontPage of the wiki, and hit Basics. Among the listed languages, choose Getting started with Python. It tells me to install couch-python, but on Ubuntu8.10, all i need is to do

$ sudo apt-get install python-couchdb

python-httplib2 and python-simplejson are installed as well.

python-couchdb installed was version 0.3, and didn't run some examples i ran. Uninstalled it and did

$ easy_install couchdb

which installed versio 0.5 at

/usr/lib/python2.5/site-packages/CouchDB-0.5-py2.5.egg

Following http://www.ibm.com/developerworks/jp/web/library/j_wa-couchdb/, installed couchdb0.8.1 after unistalling 0.8.0 as

$ tar zxvf apache-couchdb-0.8.0-incubating.tar.gz
$ cd apache-couchdb-0.8.0-incubating
$ ./configure

At the end on terminal, there were comments checking for JS_NewContext in -ljs... no

checking for JS_NewContext in -lmozjs... no
configure: error: Could not find the js library.
Is the Mozilla SpiderMonkey library installed?

Guess i need to install js library... Installed spidermonkey and libmozjs0d, and ran ./confiture... failed again. Well, i don't know what's missing, but installed the following applications which i skipped

sudo apt-get install build-essentials
sudo apt-get install libtool
sudo apt-get install automake
sudo apt-get install libmozjs-dev
sudo apt-get install libicu-dev
sudo apt-get install erlang

Over 100MB downloaded. Ran ./configure again, and got the last line

You have configured Apache CouchDB. Time to relax.

Ran

$ make
$ make install

Check

$ couchdb -V
couchdb - Apache CouchDB 0.8.1-incubating

OK.

Ran couchdb as

$ couchdb -b
Apache CouchDB has started. Time to relax.
$ couchdb -s
Apache CouchDB is running as process 21959. Time to relax.

The couchdb-python example using Javascript functions now works :-)

• Wrote Teru at 23:47 (edited 11×, last on 27 Dec 2008) | read 26× | 0 Comments

Sunday, 07 Dec 2008

permalink OmegaT

Installed OmegaT, one of open-source software for computer assisted translation tools. Using Ubuntu 8.10, it's just one command:

$ sudo apt-get install omegat

Its menu shows up as one of the office applications, and its initial screen looks like [[image: omegat.png]] Automatically showing Japanese interface :-) Look forward to making use of it for translating software, especially as a tool to manage translation memory.

• Wrote Teru at 18:24 (edited 1×, last on 07 Dec 2008) | read 19× | 0 Comments

Thursday, 04 Dec 2008

permalink Japanese translation of Pinax 1

Working on translating Pinax into Japanese.

Using gettext and its tools, useful commands are: msgfmt : create .mo file from .po file msgunfmt : create .po file from .mo file msgmerge old.po temp.po > new.po : create new.po with template temp.po using data in old.po

Pootle has turned out to be an excellent tool. To install on Ubuntu,

$ sudo apt-get install pootle

Edit files in /etc/pootle. Create translation projects in /var/lib/pootle. Start pootle server by

$ sudo /etc/init.d/pootle start

As for translation memory, Pootle has "terminology" feature, which is limited to 30 characters per item and upto 500 words. Better program is updatetm as explained at http://translate.sourceforge.net/wiki/pootle/updatetm. E.g.,

$ updatetm -i sample.po -t memory.tmx -o sample.po.tm

where sample.po.tm is created from sample.po with memory.tmx as a translation memory, and is a translation memory file used to create suggestions on Pootle.

Well, it uses the translation memory, but how do I create it? There are other commands as shown at http://translate.sourceforge.net/wiki/decathlon/wordpress_files:

$ po2tmx -l ja -i translation_folder -o translation.tmx

which reads the po files under the folder translation_folder and put the translation into the translaton memory file translation.tmx. When a template po file sample.pot is created by xgettext or django-admin.py/manage.py makemessages, run

$ pot2po -t translation.tmx -i sample.pot -o sample.po

.

Just found out that there are many other "msg" commands:

$ man -k msg
msgattrib (1)        - attribute matching and manipulation on message catalog
msgcat (1)           - combines several message catalogs
msgcmp (1)           - compare message catalog and template
msgcomm (1)          - match two message catalogs
msgconv (1)          - character set conversion for message catalog
msgen (1)            - create English message catalog
msgexec (1)          - process translations of message catalog
msgfilter (1)        - edit translations of message catalog
msgfmt (1)           - compile message catalog to binary format
msggrep (1)          - pattern matching on message catalog
msghack (1)          - Alter .po files in ways no sane mind would think about
msginit (1)          - initialize a message catalog
msgmerge (1)         - merge message catalog and template
msgunfmt (1)         - uncompile message catalog from binary format
msguniq (1)          - unify duplicate translations in message catalog
poen (1)             - Initialises a directory English PO files by taking POT...

In addition, there are html2po and po2html commands as well:

$ html2po -t old_readme.html.po -i readme.html -o new_readme.html.po
$ po2html -t readme.html -i new_readme.html.po -o new_readme.html

as shown at http://translate.sourceforge.net/wiki/decathlon/wordpress_files.

• Wrote Teru at 15:00 (edited 7×, last on 04 Dec 2008) | read 16× | 0 Comments

Monday, 01 Dec 2008

permalink Pinax deployment using mod_wsgi

Try to run Pinax using mod_wsgi.

Use the exemple ~/pinax/projects/complete_project/deploy/complete_project.wsgi. Create an Apache2 configuration file pinax_complete_project_site at /etc/apache2/sites-available as follows:

WSGIScriptAlias / /home/yarrow/pinax/projects/complete_project/deploy/complete_project.wsgi
WSGIDaemonProcess complete_project user=yarrow group=yarrow threads=25
WSGIProcessGroup complete_project

Alias /media/ /var/lib/python-support/python2.5/django/contrib/admin/media/
<Directory /var/lib/python-support/python2.5/django/contrib/admin/media>
Order deny,allow
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>

Alias /site_media/ /home/yarrow/pinax/projects/complete_project/site_media/
<Directory /home/yarrow/pinax/projects/complete_project/media>
Order deny,allow
Allow from all
</Directory>

<Directory /home/yarrow/pinax/projects/complete_project/deploy>
Order deny,allow
Allow from all
</Directory>

Load the file by

$ sudo a2ensite pinax_complete_project_site

Rerun

$ python manage.py syncdb

Run Apache by

$ sudo /etc/init.d/apache2 start

Got errors. Modified settings.py: The line

DATABASE_NAME = 'dev.db'

is changed to

basepath = os.path.dirname(__file__)
DATABASE_NAME = os.path.join(basepath, 'database.sqlite')

or, according to a tip on pinax-user,

DATABASE_NAME = PROJECT_ROOT + '/dev.db'

'dev.db' worked for me.

Rerun manage.py and apache2.

OK, it worked :-)

Added the following code at the top of /etc/apache2/sites-available/pinax_complete_project_site

# Don't expose .svn files/directories    
<DirectoryMatch "^/.*/\.svn/">
    Order deny,allow
    Deny from all
</DirectoryMatch>

References:

  1. http://pinaxproject.com/docs/trunk/deployment.html
  2. http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
  3. http://it.kndb.jp/entry/show/id/2370
• Wrote Teru at 12:05 (edited 4×, last on 01 Dec 2008) | read 110× | 1 Comments

10 shown; more articles may be found in the archives. The permalink icon is the article's permalink.
Process times: page=0.180 request=0.202 cpu=0.210