XMPP4R supports Chinese

*** parsers/baseparser.rb~ 2011-01-12 22:35:06.000000000 +0200
*** parsers/baseparser.rb 2011-01-12 22:35:06.000000000 +0200

*** 216,222 ****
version = version[1] unless version.nil?
encoding = ENCODING.match(results)
encoding = encoding[1] unless encoding.nil?
! @source.encoding = encoding
standalone = STANDALONE.match(results)
standalone = standalone[1] unless standalone.nil?
return [ :xmldecl, version, encoding, standalone ]
— 216,222 —-
version = version[1] unless version.nil?
encoding = ENCODING.match(results)
encoding = encoding[1] unless encoding.nil?
! @source.encoding = encoding unless encoding.nil?
standalone = STANDALONE.match(results)
standalone = standalone[1] unless standalone.nil?
return [ :xmldecl, version, encoding, standalone ]

Reference Link: http://pastie.org/1454110

Apache Proxy to Thin (ROR app server)

1. sudo a2enmod proxy
2. sudo a2enmod proxy_balancer
3. sudo a2enmod proxy_http
4. sudo a2enmod rewrite

5. sudo /etc/init.d/apache2 force-reload

6. sudo nano /etc/apache2/sites-available/domain.com

<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com

DocumentRoot /home/demo/public_html/railsapp/public

RewriteEngine On

<Proxy balancer://thinservers>
BalancerMember http://127.0.0.1:5000
BalancerMember http://127.0.0.1:5001
BalancerMember http://127.0.0.1:5002
</Proxy>

# Redirect all non-static requests to thin
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f

RewriteRule ^/http-bind(.*) http://127.0.0.1:5280%{REQUEST_URI} [P,QSA,L]
RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]

#ProxyPass / balancer://thinservers/
#ProxyPassReverse / balancer://thinservers/
#ProxyPreserveHost on

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

# Custom log file locations
ErrorLog /home/demo/public_html/railsapp/log/error.log
CustomLog /home/demo/public_html/railsapp/log/access.log combined

</VirtualHost>

Start ROR

source .bash_profile
rvm use 1.9.2 –default

sudo /etc/init.d/kannel stop
sudo -s
bearerbox -v 0
smsbox -v 0 &

rails runner script/send_sms.rb

rails runner script/xmpp4r_forwarder.rb
rails runner script/notifier.rb
bundle exec thin start –server 3

Re-installation of ROR

1. curl -L https://get.rvm.io | bash -s stable –ruby

2. sudo apt-get install zlib1g-dev

3. rvm reinstall 1.9.2-p180

$ rvm reinstall 1.9.3

apt-get install libsqlite3-dev

sudo apt-get install libssl-dev

Than go to the source of ruby and go to the following path

cd ext/openssl

sudo apt-get install libssl-dev

Than go to the source of ruby and go to the following path

cd ext/openssl

Run the command one after the others.

ruby extconf.rb
make
sudo make install

 

Sent Deferred Bounced

Deffered: grep status=deferred /var/log/mail.log | awk {‘print $7’} | sort -u | wc -l
15
Bounced: grep status=bounced /var/log/mail.log | grep -v info | awk {‘print $7’} | wc -l
39
Sent: grep status=sent /var/log/mail.log | awk {‘print $7’} | grep -v root | grep -v alfred | wc -l
31

Translate Domain Name via VPN

Server Side:

1. Install dnsmasq

2. setup tcp tunnel of openvpn

3. iptables -t nat -I POSTROUTING -s 10.x.x.x/24 -j SNAT –to x.x.x.x

Client Side:

1. Add DNSMASQ_OPTS=”–clear-on-reload” to /etc/default/dnsmasq

2. setup tcp tunnel client of openvpn

3. Add 0 5 * * * lynx -source https://smarthosts.googlecode.com/svn/trunk/dnsmasq.conf | grep address | awk -F / {‘print “server=/”$2″/10.9.0.1″‘} > /etc/dnsmasq.d/smart_host_domain;; /etc/init.d/dnsmasq restart to crontab

4. Modify /etc/resolv.conf to use “nameserver 127.0.0.1” only