Thứ Năm, 25 tháng 3, 2010

Tomcat, Apache2, AJP, Load balancing

Tomcat:
I have webapp deployed at / in Tomcat.
server.xml


Connector port="8009" protocol="AJP/1.3" redirectPort="8443"

Apache
httpd.conf
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module /usr/lib/apache2/modules/mod_proxy_balancer.so


BalancerMember ajp://127.0.0.1:8009 route=osmoz-tomcat-1 retry=5



Allow From All
ProxyPass balancer://tomcatservers/ stickysession=JSESSIONID nofailover=off
ProxyPassReverse /

Thứ Hai, 11 tháng 1, 2010

Submit forms to a new window

Submit Form to a new Window? Sound easy.
Not easy to me until I found this link
http://classicasp.aspfaq.com/forms/how-do-i-submit-forms-to-a-new-window-with-window-open-features.html

That link does help me.

Thứ Năm, 7 tháng 1, 2010

jQuery treeview plugin: Drag n Drop support

I'm using jquery treeview plugin and I want to add drag & drop feature by using
Drag n Drop of interface
Here the code so far ( from source ).
$('span.folder').Droppable(
{
accept : 'file',
hoverclass : 'dropOver',
activeclass : 'fakeClass',
tollerance : 'pointer',
onhover : function(dragged)
{

},
onout : function()
{

},
ondrop : function(dropped)
{

var $dropped = $(dropped);
var $parent = $dropped.parent();
$parent.removeClass("last");
// try to remove first

$("#browser").treeview({
remove: $parent
});
var $this= $(this);
var container = $this.next();
$("span").appendTo("#foo");
var branches = $parent.prependTo("#"+container.attr("id"));

$("#browser").treeview({
add: branches
});
// recall droppable
$drag.DraggableDestroy(); (1)
$drag.Draggable( (2)
{
revert : true,
autoSize : true,
ghosting : true
}
);
}

}
);
var $drag = $('span.file,span.folder').Draggable(
{
revert : true,
autoSize : true,
ghosting : true
}
);
}
);

(1) (2) After dragging one file item to a folder, I can not drag it again. So I played a trick by destroy current dragable object and init it again.
It is not cool. But I don't know how to overcome this.

The example here works well. Any help?

Realtime web - A look at Orbited, ActiveMQ and Rails

update soon ....

Thứ Bảy, 2 tháng 1, 2010

Echowaves sucessfully install

After two hours try-and-error, I successfully set up Echowaves.
It's a setup tasks. What do I do next?
+ Authlogic
+ OAuth
+ Sphinx
+ Workling and Starling
+ thinking-sphinx ( Sphinx easily in Rails)
+ rake tasks

linux, tip #1

Sometimes, I want to build library from source, and with option --prefix, I install those libs elsewhere from /usr/local/bin.
One problem is we can't explicitly call >>some_command_under_lib_bin.
To achieve using ln -s /bin/* /usr/local/bin
for example, when I install Sphinx
ln -s /home/pilgrim/opt/tools/sphinx/bin/* /usr/local/bin

Sqlite3: UT8 support in migration in Rails?

Got the error:
"Migration error: Unsupported database for migration to UTF-8 support"
When trying to migrate data in Rails by using sqlite3.
Change db to mysql. It's ok but sql3 may contain error.
Use two links below may help ( not try it yet)
http://snippets.dzone.com/posts/show/6070
or
http://woss.name/blog/2006/10/25/migrating-your-rails-application-to-unicode.html