To use Tesseract, you need an uncompress Tiff file. To do that:
C:\tools\ImageMagick-6.5.8\VisualMagick\bin\convert.exe c:\tmp4\toto.jpg c:\tmp4\toto.tif
C:\tools\Tesseract>tiffcp -c none c:\tmp4\toto.tif c:\tmp4\unc_toto.tiff
C:\tools\Tesseract>tesseract c:\tmp4\unc_toto.tif out
Go and read the OCR result in out.txt
Friday, January 8, 2010
Saturday, December 26, 2009
ImageMagick
- Windows7 / VisualStudio 2008 , To build it, get: ftp://ftp.imagemagick.org/pub/ImageMagick/windows/ImageMagick-windows.zip unzip
- To convert pictures using the command line:
C:\tools\ImageMagick-6.5.8\VisualMagick\bin>convert "C:\Users\x\Downloads\2010-05-16 16.05.43.jpg" -resize 10% toto.jpg
When you open, build, and run: VisualMagick/configure/configure.sln
you get: VisualMagick/VisualStaticMT.sln
Now you can build ImageMagick.
To build a release of an exe using ImageMagick, I ran into VisualStudio libraries conflicts using STATIC_MAGICK. I built the "dynamic" ImageMagick using configure, and then I could have it to work fairly easily.
- Ubuntu $tar xvfz ImageMagick.tar.gz
$ cd ImageMagick-6.6.3-1
$ ./configure
$ make
$ sudo make install
- ImageMagick-6.7.8-8/utilities/convert DSC_6093.JPG -resize 40% out2.jpg
Monday, December 7, 2009
Axis2 Web Service (Tomcat v6)
These are informations that complements
http://people.apache.org/~ruchithf/hw-axis2/
http://www.roseindia.net/webservices/axis2/axis2-client.shtml
Install Tomcat6/Axis2 1.5.1 (Axis2 servlet)
Tomcat configuration on Windows:
C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\conf\server.xml
Install eclipse-jee-galileo-SR1-win32.zip (version 3.5)
(to be able to build "Dynamic Web Project")
install "Service Archive Wizard - Eclipse Plug-in" (aar generation). You can get it from the axis2 page: download/tools
Do File/New/"Dynamic Web Project"
(Target Runtime: "Apache Tomcat v6.0")
New Package
New ws Class
Create a file services.xml in WebContent/META-INF (that is what will be exposed as service features).
Create the aar file:
File/New/Others/AxisServerArchiver
- "Class File Location": C:\EclipseWorkSpace\MyWs\build\classes\
- do "not include .class only"
- Next
- Skip WSDL
- Next
- Next
- Set the service XML file: "c:\eclipseworkspace\myws\webcontent\meta-inf\services.xml"
- Next
- "Ouput file location": C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis2\WEB-INF\services
- WARNING: on Windows 7, eventhough I enter this path, the aar file ends up in
C:\Users\lefla\AppData\Local\VirtualStore
not sure why, must be a privilege problem. I have to copy the aar file in the correct folder afterwards.
Restart Tomcat
if you did:
You should see the wsdl generated when click on your service from:
http://127.0.0.1:8082/axis2/services/listServices
(need to "view source" on the blank page on Chrome browser)
and also you should see the echo response (with "null" as parameter)
< ns:echoResponse >
< ns:return > Hello : null < /ns:return >
< /ns:echoResponse >
http://127.0.0.1:8080/axis2/services/myws/echo
If you want a Java client for the Axis WS:
The following command creates the two stubs java files for the client:
(if you use the -t option, it also generates the client java test source code)
C:\tmp>wsdl2java -uri http://127.0.0.1:8080/axis2/services/myws?wsdl -o client
If you want to use a JSP to connect to the WS
You can create a new "Dynamic Web Project"
Reuse the same stub files as in the Java client above in your project
I had to add httpcore-4.0.jar and berkeleydb-1.5.0.jar (sleepycat collections classes) to the project WebContent/WEB-INF/lib.
Put your .jsp files in WebContent
Once done, you can right-click "Export" as a WAR file and put it in
C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\webapps\MyJspProject.war
You have to remove the folder MyJspProject in
C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\webapps
before restarting Tomcat.
Look at
C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\logs\localhost.20xx-xx-xx.log to debug
Please note the typo in the ruchithf apache tutorial. According to the original echo(String value) command, the associated client instruction should be:
request.setValue("Hello world");
and not:
request.setParam0("Hello world");
http://people.apache.org/~ruchithf/hw-axis2/
http://www.roseindia.net/webservices/axis2/axis2-client.shtml
Tomcat configuration on Windows:
C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\conf\server.xml
(to be able to build "Dynamic Web Project")
(Target Runtime: "Apache Tomcat v6.0")
File/New/Others/AxisServerArchiver
- "Class File Location": C:\EclipseWorkSpace\MyWs\build\classes\
- do "not include .class only"
- Next
- Skip WSDL
- Next
- Next
- Set the service XML file: "c:\eclipseworkspace\myws\webcontent\meta-inf\services.xml"
- Next
- "Ouput file location": C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis2\WEB-INF\services
- WARNING: on Windows 7, eventhough I enter this path, the aar file ends up in
C:\Users\lefla\AppData\Local\VirtualStore
not sure why, must be a privilege problem. I have to copy the aar file in the correct folder afterwards.
Restart Tomcat
if you did:
public String echo(String value) {
return "Hello : " + value;
}
You should see the wsdl generated when click on your service from:
http://127.0.0.1:8082/axis2/services/listServices
(need to "view source" on the blank page on Chrome browser)
and also you should see the echo response (with "null" as parameter)
< ns:echoResponse >
< ns:return > Hello : null < /ns:return >
< /ns:echoResponse >
http://127.0.0.1:8080/axis2/services/myws/echo
The following command creates the two stubs java files for the client:
(if you use the -t option, it also generates the client java test source code)
C:\tmp>wsdl2java -uri http://127.0.0.1:8080/axis2/services/myws?wsdl -o client
You can create a new "Dynamic Web Project"
Reuse the same stub files as in the Java client above in your project
I had to add httpcore-4.0.jar and berkeleydb-1.5.0.jar (sleepycat collections classes) to the project WebContent/WEB-INF/lib.
Put your .jsp files in WebContent
Once done, you can right-click "Export" as a WAR file and put it in
C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\webapps\MyJspProject.war
You have to remove the folder MyJspProject in
C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\webapps
before restarting Tomcat.
Look at
C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\logs\localhost.20xx-xx-xx.log to debug
request.setValue("Hello world");
and not:
request.setParam0("Hello world");
Tuesday, November 10, 2009
Some Java Application Servers and Application Frameworks
- TomCat from Apache Servlet container, no EJBs (Approx 6 Megabytes)
- Jetty no EJBs, light, run on Android
- JBoss from RedHat JSP, Servlets and EJBs
- Blazix from Desiderata Soft JSP, Servlets and EJBs (1.5 Megabytes)
- WebLogic from BEA Systems JSP, Servlets and EJBs (Approx 40 Megabytes)
- WebSphere from IBM JSP, Servlets and EJBs (Approx 100 Megabytes)
- GlassFish from Sun/Oracle JSP, Servlets and EJBs
- Spring - for the Java platform and .NET Framework - alternative to, replacement for, or even addition to the EJB model. - light weight
- Tapestry - builds upon the standard Java Servlet API - integrates with any kind of backend, including JEE, Spring and Hibernate. - successor of HiveMind - light weight
- Hibernate - many Java frameworks use Hibernate as a persistence layer, which can generate a database schema at runtime capable of persisting the necessary information. This allows the application designer to design business objects without needing to explicitly define a database schema. - Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate solves object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions. - Hibernate's primary feature is mapping from Java classes to database tables (and from Java data types to SQL data types). Hibernate also provides data query and retrieval facilities. Hibernate generates the SQL calls and relieves the developer from manual result set handling and object conversion, keeping the application portable to all supported SQL databases, with database portability delivered at very little performance overhead. - Hibernate can use the XML file or the annotation to maintain the database schema.
- Struts - cleanly separate the model (application logic that interacts with a database) from the view (HTML pages presented to the client) and the controller (instance that passes information between view and model). Struts provides the controller (a servlet known as ActionServlet) and facilitates the writing of templates for the view or presentation layer (typically in JSP, but XML/XSLT and Velocity are also supported). - face competititon from "light weight" MVC frameworks such as Spring MVC, Stripes, Wicket, MyFaces and Tapestry
- JBoss Seam - managed by Gavin King, initiator of Hibernate - Seam combines the two frameworks Enterprise JavaBeans (EJB3) and JavaServer Faces (JSF).
- See also: - java-source.net
Saturday, October 24, 2009
Apache 2 on Ubuntu
DocumentRoot value is set in the file:
/etc/apache2/sites-available/default
Note that, by default, the value is /var/www/
/etc/apache2
/var/log/apache2
lsof -i:80 (including docker publish)
Saturday, October 10, 2009
Your time is limited
"Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma — which is living with the results of other people's thinking. Don't let the noise of others' opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary."
...........................................................................Steve Jobs delivered on June 12, 2005 at Stanford
...........................................................................Steve Jobs delivered on June 12, 2005 at Stanford
Wednesday, September 30, 2009
mysql on Ubuntu
sudo apt-get install mysql-client
sudo apt-get install mysql-server
Add this source to your sources.list:
deb http://security.ubuntu.com/
do an
apt-get update
sudo vi /etc/mysql/my.cnf
then
# skip-external-locking
bind-address = 192.168.0.11
* Checking for corrupt, not cleanly closed and upgrade needing tables.
It is not an error, it just says that "mysql is" Checking for...
sudo /etc/init.d/mysql start
(don't forget the sudo, otherwise it fails and not very explicit in the error)
sudo firestarter
or if the server doesn't have kde
sudo /sbin/iptables -A INPUT -i eth0 -s 192.168.0.20/24 -p tcp --destination-port 3306 -j ACCEPT
mysql -u root -p
mysql> GRANT ALL ON GG.* TO 'root'@'192.168.0.11';
or
mysql> GRANT ALL ON test.* TO 'root'@'192.168.0.11' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> commit;
From phpmysql, you should see a user with the following privileges:
root 192.168.0.11 global ALL PRIVILEGES Oui
mysql> CREATE DATABASE GG;
mysql> CREATE TABLE j_2 ( Id int AUTO_INCREMENT PRIMARY KEY, Date Date, Myint integer, Url varchar(255) );
mysql> commit;
etc
/var/log/mysql/mysql.log
SHOW DATABASES;
SHOW GRANTS FOR 'root'@localhost;
SELECT * FROM j_3 INTO OUTFILE '/toto.txt';
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
you need a root password:
mysql -u root
>UPDATE mysql.user SET Password=PASSWORD('admin') WHERE User='root'
>FLUSH PRIVILEGES;
Also, don't forget to create the link
sudo ln -s /usr/share/phpmyadmin/ phpmyadmin
/var/www/phpmyadmin/libraries$ vi config.inc.php
$cfg['PmaAbsoluteUri'] = 'localhost/phpmyadmin/';
$cfg['Servers'][$i]['host'] = '192.168.0.5';
$cfg['Servers'][$i]['password'] = 'mypassword';
Also, you may want to add the line (it seems it is 3600 sec by default)
/etc/phpmyadmin$ vi config.inc.php
$cfg['LoginCookieValidity'] = 10000000;
Export:
mysql -u root -p
mysql> use test
mysql> select * from jg_seeds_3 INTO OUTFILE '/tmp/jg_seeds_3.txt'
Import:
$ sudo mysqlimport -u root -p GG /tmp/jg_seeds_3.txt
-> password (mysql pw)
Please note that the file base name jg_seeds_3 has to match the table name in GG. The file extension (txt here doesn't matter). Put the input file in /tmp since mysql user has all privileges on the folder and all its parents.
mysqldump -h bo-sql-lb-master.be.p1.canon -u bill -p --max_allowed_packet=1073741824 --lock-tables=false stats_fr tb_popu > popu-all.sql
load:
mysql -h hostname -u user --password=password databasename < filename
Subscribe to:
Comments (Atom)