Command line completion with mysql October 31, 2007
Posted by maxmil in : MySql , add a commentFor automatic completion with the mysql command line client issue the “rehash” command.
Sending parameters using GET method and UTF-8 October 25, 2007
Posted by maxmil in : tomcat , add a commentIn order to send parameters with GET using UTF-8 with tomcat you need to configure the connector
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" port="8080" redirectPort="8443" URIEncoding="UTF-8"/>
Find and replace text in files October 22, 2007
Posted by maxmil in : Debian , add a commentTaken from here
To replace all occurances of a string:
find /your/home/dir -name "*.txt" | xargs perl -pi -e 's/stringtoreplace/replacementstring/g'
To replace the first occurance:
find /your/home/dir -name "*.txt" | xargs perl -pi -e 's/stringtoreplace/replacementstring/'
To replace all files in a folder:
for arg in `ls -C1`; do perl -pi -e 's/stringtoreplace/replacementstring/g'; done;
you can do more cool tricks using the for shell command as demonstrated above. you can add more specific searches. However, you might be better off just writing a shell script. Here is an example of the first find:
for arg in `find /your/home/dir -name "*.txt"` ; do perl -pi -e 's/string/replacement/g' $arg; done;
Setting up apache web server and apache tomcat 5.5 with mod_jk
Posted by maxmil in : Apache, Debian, tomcat , add a commentTo use tomcat for serving java and apache web server for serving other content you can use mod_jk. Here's a bried recap on how i have just configured them under debian.
1) Install both tomcat and apache.
2) Download binary mod_jk.so (from http://tomcat.apache.org/download-connectors.cgi)
3) Copy module to /usr/lib/apache2/modules/mod_jk.so
4) Create file /etc/apache2/mods-available/jk.load
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
5) Create file /etc/apache2/mods-available/jk.conf
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel error
6) Create file /etc/apache2/workers.properties
# Tomcat and Java configuration #
worker.list=worker1
# Definition for local worker using AJP 1.3 #
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.cachesize=20
7) Create virtual host in /etc/apache/sites-available/myVirtualHost
<VirtualHost 127.0.0.1:80>
ServerName max-p.sytec.tecfa.com
DocumentRoot /home/maxmil/project/tecfa-systec/webapp
ServerAdmin mpimm@tecfa.com
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/systec.log combined
Alias /edita "/home/maxmil/eclipse-tomcat/wtpwebapps/systec-edita"
<Directory "/home/maxmil/eclipse-tomcat/wtpwebapps/systec-edita">
Options Indexes +FollowSymLinks
</Directory>
JkMount /edita/* worker1
<Location "/edita/WEB-INF/">
deny from all
</Location>
</VirtualHost>
Enable new modules and site
cd /etc/apache2
ln -s mods-available/jk.load mods-enabled/jk.load
ln -s mods-available/jk.conf mods-enabled/jk.conf
ln -s sites-available/myVirtualHost sites-enabled/myVirtualHost
Add variable to path in XSession October 20, 2007
Posted by maxmil in : Debian , add a commentDon't know why but with my Debian when i start an XSession neither .bashrc nor .bash_profile gets executed.
Normally i add variables to the PATH environmental variable in one of these two files.
To add a variable to the XSession environment i've found that you need to create a file in /etc/X11/Xsession.d.
The files in this directory are executed in alphabetical order so i've created 999local-profile which executes last.
Multi touch screens
Posted by maxmil in : Uncategorized , add a commentCheck some of these
Jeff Han at TED
http://www.youtube.com/watch?v=5JcSu7h-I40
Microsoft surface
http://www.microsoft.com/surface/
Setting up PDF printer en GNOME October 18, 2007
Posted by maxmil in : Debian , add a commentTo set up a pdf printer using the gnome-cups-manager. As root
1) aptitude install cups-pdf
2) Open gnome-cups-manager
3) Add new printer
4) Select manafacturer: Generic, model: postscript-color-printer-rev4 and driver: standard.
5) Apply
6) Mark as default printer.