Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Sunday, March 21, 2010

[Solved] DocumentConverter.py via PHP on Linux RedHat Centos


This is a guide to fix the use of PYODConverter on linux RedHat Centos 5 box users.
If you wanna use DocumentConverter.py written by artofsolving, you have to follow those steps.

1)Install openoffice on your linux box or verify installation through commands:
Install Packages

yum install openoffice.org-xxx.

Check Packages

yum list | grep "openoffice".


2)Install python-uno bridge

3)Download DocumentConverter.py

4)Add the following line below "import uno"...

import sys
sys.path.append("/usr/lib/openoffice.org/program")


5)Run openoffice like a service with -headless and -nofirtstartwizard options.


/usr/lib/openoffice.org/program/soffice -nologo -nofirststartwizard -headless -norestore -invisible "-accept=socket,host=localhost,port=8100,tcpNoDelay=1;urp;"




The port 8100 must be the same for client and server obviously.


If you execute this php code



$cmd = "/usr/bin/python /var/www/html/DocumentConverter.py inputfile $outputfile.pdf 2>&1 | tee /var/www/html/mylog.txt"; // tee used to log output and errors of cmd
exec($cmd, $results);
printf("Exec Output: {".print_r($results).";}\n"); //print results of exec command


you'll probably get this error:


[Java framework] Error in function createSettingsDocument (elements.cxx).javaldx failed!

And other permissions problems on tmp dirs.

To solve this, simply add into your php script those lines of code

if (!file_exists("/tmp/ooohomedir"))
{
mkdir("/tmp/ooohomedir");
chmod("/tmp/ooohomedir", 0777);
}
putenv("HOME=/tmp/ooohomedir");







If you have another workaround about this please leave a comment below.
C u.


Read more...

Tuesday, July 14, 2009

How to code a wordpress plugin.

Hi everybody. I would like to bookmark this screencast tutorial that explains how to build a simple wordpress plugin.



You could find the complete tutorial on tutplus




Read more...

Thursday, May 22, 2008

Programming of i-Sobot Robot Humanoid

Check this out :)


Read more...

Thursday, May 15, 2008

Developing and deploying an application on Google App Engine Video

This video introduces developers to building apps on Google App Engine. It helps us to understand the basic and the how it simple to develop an application through this engine.
Enjoy it.





Latest and more info about it: http://code.google.com/io/


Read more...

Saturday, May 10, 2008

Video: Javascript Advanced Programming

This Great video with Douglas Crockford really goes through a lot of material and points out the practical best practices which is nice. We are not agree with him when he says: "Javascript is the only protypical inherritance language".
Remember Newton Script, it was also prototypical too.
Almost similar to Javascript, but more closer to Object Oriented Programming and scoping rules.



This is the second one:




In the end the third lesson about javascript.



Read more...