Monday, January 10, 2011

Query Connection in Postgresql

This sql can be used to query active connections in Postgresql database:
select * from pg_stat_activity;

PermGen Error on Tapestry

If your Tapestry application is displaying PermGen Error, it looks like you need to increase MaxPermGen value. According to http://tapestry.apache.org/specific-errors.html, you need to set -XX:MaxPermSize=512m in your JAVA options. Default MaxPermSize is only 64m.

The permanent generation is used to hold reflective data of the VM itself such as class objects and method objects. This is where class definitions go (and this explains why you may get the message OutOfMemoryError: PermGen space if an application loads a large number of classes and/or on redeployment).
If you're using Tomcat running as Windows Service, you can set this value on  Start->Program->Apache Tomcat->Configure Tomcat, and choose Java tab.



Note: Tapestry 5.2 needs bigger PermGen than Tapestry 5.1, but will consume lower heap memory (Maximum heap setting can be configured using: -Xmx600M).

Source:
http://www.mail-archive.com/users@tapestry.apache.org/msg47526.html
http://tapestry.1045711.n5.nabble.com/T5-5-2-4-and-memory-td3333624.html#a3333665
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
http://stackoverflow.com/questions/1634216/what-is-permsize-in-java

Access Git Repository behind HTTP Proxy

Use this command on Git Shell to set HTTP Proxy:
# export http_proxy=”http://10.0.0.1:3128″

http_proxy should be in lowercase.

Get source from Github

This is steps to get source from Github:
1. Download and install Git from http://git-scm.com/download

2. Go to your workspace folder and enter the following command:
# git clone http://github.com/hlship/tapestry5-hotel-booking.git

Wednesday, December 22, 2010

Tapestry 5.2 Multiple Context Values

This is sample for declaring multiple values on context.
In .tml file:
<t:actionlink t:id="exportToExcel" t:context="[workingUnitId, strDateFrom, strDateTo]">Export to Excel</t:actionlink>

In .java method:
Object onActionFromExportToExcel(Long workingUnitId, String strDateFrom, String strDateTo)

And this is sample for using multiple context values on .java onActivate and onPassivate: 
void onActivate(Long workingUnitId, String strDateFrom, String strDateTo)

List<Object> onPassivate() {
        List list = new ArrayList<Object>();
        list.add(workingUnitId);
        list.add(strDateFrom);
        list.add(strDateTo);
        return list;
    }


Source: http://tapestry.1045711.n5.nabble.com/multiple-context-values-td2429828.html

Tuesday, December 21, 2010

SQL Server Licensing

2 SQL Server license available: Per Processor (unlimited CAL / Client Access License) and Per Server + CAL (CAL is needed for every workstation connecting to SQL Server).

So for web application published on the internet, we should use Per Processor because we can't buy CAL for every person accessing our website.

Per Processor means physical processor, so 1 Quad Core Processor just need 1 Per Processor License.

If SQL Server is hosted on Windows Server, then we need "CAL Windows Server" and "CAL SQL Server" for every client connecting to SQL Server.

Wew.. that would cost a lot of money...

CAL also available "per device" and "per user". We can choose which one more suitable for us.
"Per user" means license is coupled with user, so the user can use multiple device for connecting to server. "Per device" means license is coupled with device (PC/notebook), so any user can use that device for connecting to server.

Source:
http://www.developer.com/db/article.php/3502746
http://www.microsoft.com/sqlserver/2005/en/us/pricing-licensing-faq.aspx
and discussion on dotnet netindonesia mailing-list

Tapestry 5 Samples

Samples for Tapestry 5:

http://jumpstart.doublenegative.com.au/jumpstart/


Beware! This samples not using Tapestry 5.2 yet.
Same of the samples can be simplified if using T5.2, for example: Ajax Select (Ajax Combobox).

Ajax Select on Tapestry 5.2 is very simple.
Look on http://tapestry.apache.org/tapestry5.2-dev/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html section "Chaining of Select Component" for example.