» Archive for the 'Ubuntu' Category

Cross Compiler-Building Windows application under linux

Saturday, November 18th, 2006 by rubypdf

I used to use JavaCompiler0.8 compile windows and Linux applications under windows xp, but some feature I want it does not support(for example, Regex, UTF-16E, MacRoman encoding), and the last version called NativeJ is never free(one developer license need USD35, still does not support UTF-16 encoding).
So I decide to compile one by myself, but I have very little knowledge about GCC and Linux, how can I do?
Google helped me, I found this article:Building GCJ for Windows, it is very detailed. base on this article, I got the Linux version and windows version under Ubuntu, both can build windows application(no matter under windows or under Linux), but I found it omits some resources, when I try the String.replaceAll method of java, it failed, this problem easily to solve, another one is not so easy for me, it not include libiconv, so it does not support most Unicode converting(UTF-16, UTF-16BE, UTF-16LE and so on), I ask the author of the article, he let me ask gcj mail listing.
Last night, I found thisiscool has released the GCJ4.2, and said it also support cross compiler, I have test windows version(just download the compiled version from the website), it work, support Regex and UTF-16BE, great, I can do something base on it. and will try to compile it under Ubuntu next Monday.
Todo:
compile the gcj 4.2 source code get from thisiscool under Ubuntu.
try to compile a version that supports compile Mac OS X application under Ubuntu, because I have no Mac.

Install Ruby on Rails , Lighttpd,Sqlite3 and Mongrel under Ubuntu

Friday, October 20th, 2006 by rubypdf

nothing but the script I used:
#install Mysql
apt-get install mysql-server

#install Ruby and relative
apt-get install irb libdbm-ruby1.8 libgdbm-ruby1.8 libmysql-ruby1.8 libmysqlclient14 libopenssl-ruby1.8 libruby1.8-dbg mysql-common ri ri1.8 ruby1.8-dev

#install rubygems
wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
tar zxfv rubygems-0.9.0.tgz
cd rubygems-0.9.0
ruby setup.rb
gem update –system

#install Rails and dependencies
gem install rails –include-dependencies

#before install Mongrel,
apt-get install build-essential #we need it to compile mongrel and Sqlite3

#intall Mongrel
gem install mongrel –include-dependencies

#install Sqlite3
apt-get install sqlite3 swig libsqlite3-ruby libsqlite3-dev
gem install sqlite3-ruby #compile this need libsqlite.h

#install Lighttpd
apt-get install lighttpd

some useful link
http://mongrel.rubyforge.org/docs/lighttpd.html
http://fo64.com/articles/2005/10/20/rails-on-breezy
http://scottstuff.net/blog/articles/2006/07/23/typo-installer

UTF-8,Ruby on Rails under Ubuntu

Friday, October 20th, 2006 by rubypdf

I installed Ruby on Rails under Ubuntu(from /var/lib/locales/supported.d/local, I know, my default charset is en_US.UTF-8 UTF-8), and create a demo, by default, mysql (table type is MyISAM)supports UTF-8. But when I input Chinese character and save to database, the output on the web is UTF-8 code, not what I want, why? After searching, I got the answer , I need modify app/controller/application.rb just like this:

class ApplicationController < ActionController::Base
before_filter :set_charset

def set_charset
@headers["Content-Type"] = "text/html; charset=utf-8"
end
end

P.S.
My environment:
Server:
OS: Ubuntu 6.06.1 on Vmware(default charset is en_US.UTF-8 UTF-8)
Ruby: 1.8.4
Rails: 1.1.6
Mysql: 5.0.2
Mongrel: 0.3.13.4
Client:
Firefox: 1.5.0.6
IE: 6.0