<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8660486175491404610</id><updated>2012-01-31T17:50:51.261+07:00</updated><category term='linux'/><category term='daemon'/><category term='aur'/><category term='grails'/><category term='non-root'/><category term='centos'/><category term='blogger'/><category term='fpt'/><category term='xvnkb'/><category term='mysql'/><category term='java'/><category term='jetty'/><category term='arch'/><category term='oss4'/><category term='mirror'/><category term='gimp'/><category term='tomcat'/><category term='gae'/><category term='scim-unikey'/><category term='wordpress'/><title type='text'>Things happened in my life</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-677749200367994142</id><published>2012-01-28T22:15:00.000+07:00</published><updated>2012-01-31T17:50:51.272+07:00</updated><title type='text'>How to install Gradle templates plugin globally</title><content type='html'>I've been exposing to Gradle for a couple of weeks and really like it. As a Maven user, I found that Gradle is a refreshing methodology on how a build tool should be. But one thing I miss from the Maven land: the ability to generate the initial structure for a project (I mean the 'archetype' plugin of Maven). Luckily, due to the plugin architecture of Gradle, &lt;a href="http://eric-berry.blogspot.com/"&gt;a Gradle user&lt;/a&gt; has developed a plugin just for that purpose. It's called the 'tempaltes' plugin. The &lt;a href="http://tellurianring.com/wiki/gradle/templates"&gt;wiki&lt;/a&gt; page of the plugin gives you all the details you need to install, but the global installation section is confusing and did not work. Here is how I did to make it work:&lt;ul&gt;&lt;li&gt;Create a file called templates.gradle in the ~/.gradle/init.d/ folder (actually you can name it whatever you want as long as it has the extension .gradle)&lt;/li&gt;&lt;li&gt;Edit that file and paste this little code snippet:&lt;/li&gt;&lt;/ul&gt;&lt;pre class="brush: groovy"&gt;&lt;br /&gt;gradle.beforeProject { prj -&gt;&lt;br /&gt;   prj.apply from: 'http://launchpad.net/gradle-templates/trunk/latest/+download/apply.groovy'&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Now, you can create a project structure event without a build.gradle with the command:&lt;pre class="brush: bash"&gt;&lt;br /&gt;gradle createJavaProject&lt;br /&gt;&lt;/pre&gt;Happy coding!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-677749200367994142?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/677749200367994142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2012/01/how-to-install-gradle-templates-plugin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/677749200367994142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/677749200367994142'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2012/01/how-to-install-gradle-templates-plugin.html' title='How to install Gradle templates plugin globally'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-1705234747973291541</id><published>2011-10-12T07:48:00.001+07:00</published><updated>2011-10-22T17:42:35.400+07:00</updated><title type='text'>Spring Security with Digest authentication and encoded password</title><content type='html'>&lt;p&gt;The title says it all. This post will show you how to configure Spring Security with Digest authentication and encoded password. But first, here is the Spring Security documentation about &lt;a href="http://static.springsource.org/spring-security/site/docs/3.0.x/reference/basic.html"&gt;digest authentication&lt;/a&gt; and encoded password:&lt;/p&gt;&lt;blockquote&gt;The configured UserDetailsService is needed because DigestAuthenticationFilter must have direct access to the clear text password of a user. &lt;strong&gt;Digest Authentication will NOT work if you are using encoded passwords in your DAO.&lt;/strong&gt; The DAO collaborator, along with the UserCache, are typically shared directly with a DaoAuthenticationProvider. The authenticationEntryPoint property must be DigestAuthenticationEntryPoint, so that DigestAuthenticationFilter can obtain the correct realmName and key for digest calculations.&lt;/blockquote&gt;It's not all true. Let's take a look at the source code of &lt;a href="http://www.jarvana.com/jarvana/view/org/springframework/security/spring-security-web/3.0.5.RELEASE/spring-security-web-3.0.5.RELEASE-sources.jar!/org/springframework/security/web/authentication/www/DigestAuthenticationFilter.java?format=ok"&gt;DigestAuthenticationFilter&lt;/a&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {&lt;br /&gt;    // omit code for simplicity&lt;br /&gt;    &lt;br /&gt;    // Compute the expected response-digest (will be in hex form)&lt;br /&gt;    String serverDigestMd5;&lt;br /&gt;&lt;br /&gt;    // Don't catch IllegalArgumentException (already checked validity)&lt;br /&gt;    serverDigestMd5 = DigestAuthUtils.generateDigest(passwordAlreadyEncoded, username, realm, user.getPassword(),&lt;br /&gt;                    request.getMethod(), uri, qop, nonce, nc, cnonce);&lt;br /&gt;    // omit code for simplicty&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;Digging a little more into the method generateDigest of the class DigestAuthUtils, we have:&lt;/p&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;static String generateDigest(boolean passwordAlreadyEncoded, String username, String realm, String password,&lt;br /&gt;                                        String httpMethod, String uri, String qop, String nonce, String nc, String cnonce)&lt;br /&gt;            throws IllegalArgumentException {&lt;br /&gt;    String a1Md5 = null;&lt;br /&gt;    String a2 = httpMethod + ":" + uri;&lt;br /&gt;    String a2Md5 = md5Hex(a2);&lt;br /&gt;&lt;br /&gt;    if (passwordAlreadyEncoded) {&lt;br /&gt;        a1Md5 = password;&lt;br /&gt;    } else {&lt;br /&gt;        a1Md5 = DigestAuthUtils.encodePasswordInA1Format(username, realm, password);&lt;br /&gt;    }&lt;br /&gt;   &lt;br /&gt;   // The rest of the code&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;A little more into encodePasswordInA1Format of DigestAuthUtils:&lt;pre class="brush: java"&gt;&lt;br /&gt;static String encodePasswordInA1Format(String username, String realm, String password) {&lt;br /&gt;    String a1 = username + ":" + realm + ":" + password;&lt;br /&gt;    String a1Md5 = md5Hex(a1);&lt;br /&gt;&lt;br /&gt;    return a1Md5;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;From here, if we set the property &lt;strong&gt;passwordAlreadyEncoded&lt;/strong&gt; of DigestAuthenticationFilter to &lt;strong&gt;true&lt;/strong&gt; and create a suitable password encoder and salt source, we can make Spring Security digest authentication work with our tailored password encoder, salt source. Let's create them:&lt;pre class="brush: java"&gt;&lt;br /&gt;package com.mycompany.myproject;&lt;br /&gt;&lt;br /&gt;import org.springframework.beans.factory.InitializingBean;&lt;br /&gt;import org.springframework.security.authentication.dao.SaltSource;&lt;br /&gt;import org.springframework.security.core.userdetails.UserDetails;&lt;br /&gt;import org.springframework.util.Assert;&lt;br /&gt;&lt;br /&gt;public class DigestAuthenticationAwareSaltSource implements SaltSource, InitializingBean {&lt;br /&gt; &lt;br /&gt;    private String digestRealm;&lt;br /&gt; &lt;br /&gt;    @Override&lt;br /&gt;    public void afterPropertiesSet() throws Exception {&lt;br /&gt;        Assert.hasText(digestRealm, "A Digest Realm must be set");  &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public Object getSalt(UserDetails user) {&lt;br /&gt;        return String.format("%s:%s:", user.getUsername(), digestRealm);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setDigestRealm(String digestRealm) {&lt;br /&gt;        this.digestRealm = digestRealm;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;package com.mycompany.myproject;&lt;br /&gt;&lt;br /&gt;import java.security.MessageDigest;&lt;br /&gt;import java.security.NoSuchAlgorithmException;&lt;br /&gt;&lt;br /&gt;import org.springframework.dao.DataAccessException;&lt;br /&gt;import org.springframework.security.authentication.encoding.PasswordEncoder;&lt;br /&gt;import org.springframework.security.core.codec.Hex;&lt;br /&gt;&lt;br /&gt;public class DigestAuthenticationAwarePasswordEncoder implements PasswordEncoder {&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public String encodePassword(String rawPass, Object salt) throws DataAccessException {&lt;br /&gt;        String a1 = salt + rawPass;&lt;br /&gt;        return md5Hex(a1);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public boolean isPasswordValid(String encPass, String rawPass, Object salt) throws DataAccessException {&lt;br /&gt;        String calculatedPass = md5Hex(salt + rawPass);&lt;br /&gt;        return calculatedPass.equals(encPass);&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    private String md5Hex(String data) {&lt;br /&gt;        MessageDigest digest;&lt;br /&gt;        try {&lt;br /&gt;            digest = MessageDigest.getInstance("MD5");&lt;br /&gt;        } catch (NoSuchAlgorithmException e) {&lt;br /&gt;            throw new IllegalStateException("No MD5 algorithm available!");&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        return new String(Hex.encode(digest.digest(data.getBytes())));&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;And now you can do Digest Authentication with encoded password in Spring Security!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-1705234747973291541?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/1705234747973291541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2011/10/spring-security-with-digest.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/1705234747973291541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/1705234747973291541'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2011/10/spring-security-with-digest.html' title='Spring Security with Digest authentication and encoded password'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-8908602136850108373</id><published>2011-08-14T14:30:00.004+07:00</published><updated>2011-10-22T17:36:09.851+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jetty'/><category scheme='http://www.blogger.com/atom/ns#' term='daemon'/><category scheme='http://www.blogger.com/atom/ns#' term='centos'/><category scheme='http://www.blogger.com/atom/ns#' term='non-root'/><title type='text'>Setting up Jetty 7.4.x on CentOS 5.x as non-root daemon</title><content type='html'>First, please make sure you've already installed JDK on your Centos box. There are tons of tutorials on how to do that :).Now we will download and install Jetty, at the time of this writing, the latest version of Jetty is 7.4.5.v20110725. Every command listing below must be run as user root.&lt;pre class="brush: bash"&gt;&lt;br /&gt;cd /opt&lt;br /&gt;wget http://download.eclipse.org/jetty/stable-7/dist/jetty-distribution-7.4.5.v20110725.tar.gz&lt;br /&gt;tar xzvf jetty-distribution-7.4.5.v20110725.tar.gz&lt;br /&gt;ln -s jetty-distribution-7.4.5.v20110725 jetty&lt;br /&gt;&lt;/pre&gt;OK, we've just installed Jetty to /opt/jetty. Now we will setup Jetty to run on startup&lt;pre class="brush: bash"&gt;&lt;br /&gt;cd /etc/init.d&lt;br /&gt;ln -s /opt/jetty/bin/jetty.sh jetty&lt;br /&gt;chkconfig --add jetty&lt;br /&gt;chkconfig --level 345 jetty on&lt;br /&gt;&lt;/pre&gt;It's a good practice to run Jetty as a non-root user, let's create a normal user called jetty&lt;pre class="brush: bash"&gt;&lt;br /&gt;useradd -m jetty&lt;br /&gt;chown -R jetty:jetty /opt/jetty&lt;br /&gt;&lt;/pre&gt;Now edit the startup script of Jetty located at &lt;strong&gt;/opt/jetty/bin/jetty.sh&lt;/strong&gt; to include the following lines at the beginning (right after a bulk of commented lines describing various variables for Jetty)&lt;pre class="brush: bash"&gt;&lt;br /&gt;JAVA_HOME=/opt/java&lt;br /&gt;JAVA=$JAVA_HOME/bin/java&lt;br /&gt;JAVA_OPTIONS=" -server -Xms256m -Xmx1024m -XX:+DisableExplicitGC "&lt;br /&gt;JETTY_HOME=/opt/jetty&lt;br /&gt;JETTY_USER=jetty&lt;br /&gt;JETTY_PORT=7070&lt;br /&gt;JETTY_HOST=0.0.0.0 # If you don't set this to 0.0.0.0, jetty only listen on localhost&lt;br /&gt;JETTY_LOGS=/opt/jetty/logs/&lt;br /&gt;&lt;/pre&gt;Now start up it:&lt;pre class="brush: bash"&gt;&lt;br /&gt;service jetty start&lt;br /&gt;&lt;/pre&gt;Open your browser and navigate to http://&lt;your-host&gt;:7070/Hope this help!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-8908602136850108373?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/8908602136850108373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2011/08/setting-up-jetty-74x-on-centos-5x-as.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8908602136850108373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8908602136850108373'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2011/08/setting-up-jetty-74x-on-centos-5x-as.html' title='Setting up Jetty 7.4.x on CentOS 5.x as non-root daemon'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-273513913681356902</id><published>2011-03-11T20:05:00.002+07:00</published><updated>2011-03-11T20:17:06.389+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aur'/><title type='text'>ibus-unikey is now in the community repo of Arch</title><content type='html'>I've maintained the &lt;a href="http://www.archlinux.org/packages/community/x86_64/ibus-unikey/"&gt;ibus-unikey&lt;/a&gt; package in Arch User Repository (AUR) for a while and suddenly my package disappeared. While I was wondering what happened to my package, I received an email from a Trusted User (TU) of Arch saying that my package had been moved to the community repo of Arch. Kudo to the ibus-unikey team for such a great piece of software which are so useful for Vietnamese Arch Users!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-273513913681356902?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/273513913681356902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2011/03/ibus-unikey-is-now-in-community-repo-of.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/273513913681356902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/273513913681356902'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2011/03/ibus-unikey-is-now-in-community-repo-of.html' title='ibus-unikey is now in the community repo of Arch'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-2925372906388187138</id><published>2010-10-20T21:43:00.009+07:00</published><updated>2011-10-22T17:41:57.544+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Quick way to secure web application on Tomcat 6 using BASIC authentication</title><content type='html'>&lt;div&gt;You are developing a Java web application, the final application will use some complex security framework (such as Spring Security, formerly Acegi, JSecurity or Shiro, etc.). But in some first milestones, the clients want you to show them the demo of the application, and they want to secure the demo site with a username/password (for things like NDA) and they don't want to wait for later milestones to have that. In this situation, you cannot integrate the above security frameworks because of time constraint, bugs or the complexity of the security frameworks.&lt;/div&gt;A quick and dirty way to do this is using a built-in authentication mechanism of Tomcat (I'm using Tomcat 6.x).&lt;br /&gt;&lt;div&gt;First put those into your web.xml file:&lt;/div&gt;&lt;pre class="brush: xml"&gt;&lt;br /&gt;&lt;web-app&gt;&lt;br /&gt;&lt;br /&gt;&lt;security-constraint&gt;&lt;br /&gt; &lt;web-resource-collection&gt;&lt;br /&gt;  &lt;web-resource-name&gt;EntireApp&lt;/web-resource-name&gt;&lt;br /&gt;  &lt;url-pattern&gt;/*&lt;/url-pattern&gt;&lt;br /&gt;  &lt;http-method&gt;GET&lt;/http-method&gt;&lt;br /&gt;  &lt;http-method&gt;POST&lt;/http-method&gt;&lt;br /&gt; &lt;/web-resource-collection&gt;&lt;br /&gt; &lt;auth-constraint&gt;&lt;br /&gt;  &lt;role-name&gt;client&lt;/role-name&gt;&lt;br /&gt; &lt;/auth-constraint&gt;&lt;/security-constraint&gt;&lt;br /&gt;&lt;br /&gt;&lt;security-role&gt;&lt;br /&gt;  &lt;role-name&gt;client&lt;/role-name&gt;&lt;br /&gt;&lt;/security-role&gt;&lt;br /&gt;&lt;br /&gt;&lt;login-config&gt;&lt;br /&gt; &lt;auth-method&gt;BASIC&lt;/auth-method&gt;&lt;/login-config&gt;&lt;/web-app&gt;&lt;br /&gt;&lt;/pre&gt;If you use Spring Security, remember to remove Spring Security filter in the web.xml file. Now in your context file (the context.xml file in your META-INF of your web archive or in ther conf/Catalina/localhost/ context file), adding the following:&lt;br /&gt;&lt;pre class="brush: xml"&gt;&lt;br /&gt;&lt;context&gt;&lt;br /&gt;  &lt;realm classname="org.apache.catalina.realm.UserDatabaseRealm" resourcename="UserDatabase"&gt;&lt;/realm&gt;&lt;br /&gt;  &lt;resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" readonly="true" type="org.apache.catalina.UserDatabase"&gt;&lt;br /&gt;  &lt;/resource&gt; &lt;br /&gt;&lt;/context&gt;&lt;br /&gt;&lt;/pre&gt;Finally, edit the tomcat-users.xml (usually located at &lt;tomcat_install_path&gt;/conf/tomcat-users.xml) to include all the roles you've specified in the security constraint of you web application, my tomcat-users.xml looks like this (yours may be different):&lt;/tomcat_install_path&gt;&lt;br /&gt;&lt;pre class="brush: xml"&gt;&lt;br /&gt;&lt;tomcat-users&gt;&lt;br /&gt;    &lt;role rolename="client"&gt;&lt;/role&gt;&lt;br /&gt;    &lt;user password="client_password" roles="client" username="client_username"&gt;&lt;/user&gt;&lt;br /&gt;&lt;/tomcat-users&gt;&lt;br /&gt;&lt;/pre&gt;Now, every time the clients access the demo site, the browser will pop up a dialog asking for username and password. After successfully authenticated, the clients will use the demo site as normal.&lt;br /&gt;This authentication mechanism is the &lt;a href="http://en.wikipedia.org/wiki/Basic_access_authentication"&gt;Basic access authentication&lt;/a&gt;. As the title said, this is a quick and dirty way to secure a web application on Tomcat 6.&lt;br /&gt;Hope this saves you some time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-2925372906388187138?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/2925372906388187138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2010/10/quick-way-to-secure-web-application-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/2925372906388187138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/2925372906388187138'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2010/10/quick-way-to-secure-web-application-on.html' title='Quick way to secure web application on Tomcat 6 using BASIC authentication'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-8954585070163003754</id><published>2010-06-11T09:48:00.002+07:00</published><updated>2011-10-22T17:38:48.423+07:00</updated><title type='text'>Vietnamese resource bundle for PrettyTime</title><content type='html'>I've just come across a Grails plugin called &lt;a href="http://ocpsoft.com/prettytime/"&gt;PrettyTime&lt;/a&gt; and I find it's really interesting library. Basically, it's utility library to format Date/Time value in a human-friendly form (eg: "right now", "two days ago", "3 months from now"...), it also supports localization for many languages but Vietnamese. So I decide to write a small resource bundle class for it.&lt;br /&gt;&lt;pre class="brush: java"&gt;&lt;br /&gt;package com.ocpsoft.pretty.time.i18n;&lt;br /&gt;&lt;br /&gt;import java.util.ListResourceBundle;&lt;br /&gt;&lt;br /&gt;public class Resources_vi extends ListResourceBundle&lt;br /&gt;{&lt;br /&gt;   private static final Object[][] OBJECTS = new Object[][] {&lt;br /&gt;   { "CenturyPattern", "%n %u" },&lt;br /&gt;   { "CenturyFuturePrefix", "" },&lt;br /&gt;   { "CenturyFutureSuffix", " sau" },&lt;br /&gt;   { "CenturyPastPrefix", "cách đây " },&lt;br /&gt;   { "CenturyPastSuffix", "" },&lt;br /&gt;   { "CenturyName", "thế kỷ" },&lt;br /&gt;   { "CenturyPluralName", "thế kỷ" },&lt;br /&gt;   { "DayPattern", "%n %u" },&lt;br /&gt;   { "DayFuturePrefix", "" },&lt;br /&gt;   { "DayFutureSuffix", " sau" },&lt;br /&gt;   { "DayPastPrefix", "cách đây " },&lt;br /&gt;   { "DayPastSuffix", "" },&lt;br /&gt;   { "DayName", "ngày" },&lt;br /&gt;   { "DayPluralName", "ngày" },&lt;br /&gt;   { "DecadePattern", "%n %u" },&lt;br /&gt;   { "DecadeFuturePrefix", "" },&lt;br /&gt;   { "DecadeFutureSuffix", " sau" },&lt;br /&gt;   { "DecadePastPrefix", "cách đây " },&lt;br /&gt;   { "DecadePastSuffix", "" },&lt;br /&gt;   { "DecadeName", "thập kỷ" },&lt;br /&gt;   { "DecadePluralName", "thập kỷ" },&lt;br /&gt;   { "HourPattern", "%n %u" },&lt;br /&gt;   { "HourFuturePrefix", "" },&lt;br /&gt;   { "HourFutureSuffix", " sau" },&lt;br /&gt;   { "HourPastPrefix", "cách đây " },&lt;br /&gt;   { "HourPastSuffix", "" },&lt;br /&gt;   { "HourName", "giờ" },&lt;br /&gt;   { "HourPluralName", "giờ" },&lt;br /&gt;   { "JustNowPattern", "%u" },&lt;br /&gt;   { "JustNowFuturePrefix", "" },&lt;br /&gt;   { "JustNowFutureSuffix", " khắc sau" },&lt;br /&gt;   { "JustNowPastPrefix", "cách đây " },&lt;br /&gt;   { "JustNowPastSuffix", " khắc" },&lt;br /&gt;   { "JustNowName", "" },&lt;br /&gt;   { "JustNowPluralName", "" },&lt;br /&gt;   { "MillenniumPattern", "%n %u" },&lt;br /&gt;   { "MillenniumFuturePrefix", "" },&lt;br /&gt;   { "MillenniumFutureSuffix", " sau" },&lt;br /&gt;   { "MillenniumPastPrefix", "cách đây " },&lt;br /&gt;   { "MillenniumPastSuffix", "" },&lt;br /&gt;   { "MillenniumName", "thiên niên kỷ" },&lt;br /&gt;   { "MillenniumPluralName", "thiên niên kỷ" },&lt;br /&gt;   { "MillisecondPattern", "%n %u" },&lt;br /&gt;   { "MillisecondFuturePrefix", "" },&lt;br /&gt;   { "MillisecondFutureSuffix", " sau" },&lt;br /&gt;   { "MillisecondPastPrefix", "cách đây " },&lt;br /&gt;   { "MillisecondPastSuffix", "" },&lt;br /&gt;   { "MillisecondName", "mili giây" },&lt;br /&gt;   { "MillisecondPluralName", "mili giây" },&lt;br /&gt;   { "MinutePattern", "%n %u" },&lt;br /&gt;   { "MinuteFuturePrefix", "" },&lt;br /&gt;   { "MinuteFutureSuffix", " sau" },&lt;br /&gt;   { "MinutePastPrefix", "cách đây " },&lt;br /&gt;   { "MinutePastSuffix", "" },&lt;br /&gt;   { "MinuteName", "phút" },&lt;br /&gt;   { "MinutePluralName", "phút" },&lt;br /&gt;   { "MonthPattern", "%n %u" },&lt;br /&gt;   { "MonthFuturePrefix", "" },&lt;br /&gt;   { "MonthFutureSuffix", " sau" },&lt;br /&gt;   { "MonthPastPrefix", "cách đây " },&lt;br /&gt;   { "MonthPastSuffix", "" },&lt;br /&gt;   { "MonthName", "tháng" },&lt;br /&gt;   { "MonthPluralName", "tháng" },&lt;br /&gt;   { "SecondPattern", "%n %u" },&lt;br /&gt;   { "SecondFuturePrefix", "" },&lt;br /&gt;   { "SecondFutureSuffix", " sau" },&lt;br /&gt;   { "SecondPastPrefix", "cách đây " },&lt;br /&gt;   { "SecondPastSuffix", "" },&lt;br /&gt;   { "SecondName", "giây" },&lt;br /&gt;   { "SecondPluralName", "giây" },&lt;br /&gt;   { "WeekPattern", "%n %u" },&lt;br /&gt;   { "WeekFuturePrefix", "" },&lt;br /&gt;   { "WeekFutureSuffix", " sau" },&lt;br /&gt;   { "WeekPastPrefix", "cách đây " },&lt;br /&gt;   { "WeekPastSuffix", "" },&lt;br /&gt;   { "WeekName", "tuần" },&lt;br /&gt;   { "WeekPluralName", "tuần" },&lt;br /&gt;   { "YearPattern", "%n %u" },&lt;br /&gt;   { "YearFuturePrefix", "" },&lt;br /&gt;   { "YearFutureSuffix", " sau" },&lt;br /&gt;   { "YearPastPrefix", "cách đay " },&lt;br /&gt;   { "YearPastSuffix", "" },&lt;br /&gt;   { "YearName", "năm" },&lt;br /&gt;   { "YearPluralName", "năm" },&lt;br /&gt;   { "AbstractTimeUnitPattern", "" },&lt;br /&gt;   { "AbstractTimeUnitFuturePrefix", "" },&lt;br /&gt;   { "AbstractTimeUnitFutureSuffix", "" },&lt;br /&gt;   { "AbstractTimeUnitPastPrefix", "" },&lt;br /&gt;   { "AbstractTimeUnitPastSuffix", "" },&lt;br /&gt;   { "AbstractTimeUnitName", "" },&lt;br /&gt;   { "AbstractTimeUnitPluralName", "" } };&lt;br /&gt;&lt;br /&gt;   @Override&lt;br /&gt;   public Object[][] getContents()&lt;br /&gt;   {&lt;br /&gt;       return OBJECTS;&lt;br /&gt;   }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Hopefully they will integrate this snippet into the next release of PrettyTime.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-8954585070163003754?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/8954585070163003754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2010/06/vietnamese-resource-bundle-for.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8954585070163003754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8954585070163003754'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2010/06/vietnamese-resource-bundle-for.html' title='Vietnamese resource bundle for PrettyTime'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-8985264908008342720</id><published>2010-05-16T12:42:00.004+07:00</published><updated>2010-05-16T14:50:59.371+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wordpress'/><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><title type='text'>Moving back to Blogger</title><content type='html'>A couple months ago, I moved my blog from Blogger to Wordpress, that's because Wordpress offers some nice themes. Recently, I've bought a new domain (my first domain actually) and I want to use that domain for my blog but it costs me 10$/year to use custom domain in Wordpress! Searching around and I found that Blogger let you use your custom domain for free with hassle-free setup. Horay!&lt;br /&gt;Then I moved back to Blogger, but the problem arises, the ugly theme! I think it's the right time for me to learn CSS and start hacking Blogger API. And after 2 weeks of hard working, I've finished my custom theme for Blogger based on &lt;a href="http://xfep.com/wordpress/wordpress-theme-natural-power/"&gt;Natural Power theme for Wordpress.&lt;/a&gt;&lt;br /&gt;I'm quite happy with the result I've got so far. Not too bad for a CSS newbie.&lt;br /&gt;From the normal user perspective, Wordpress provides many useful functionality out of the box, but if flexibility is your top priority, Blogger is your best choice so far.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-8985264908008342720?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/8985264908008342720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2010/05/moving-back-to-blogger.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8985264908008342720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8985264908008342720'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2010/05/moving-back-to-blogger.html' title='Moving back to Blogger'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-3291135426258475479</id><published>2010-04-23T11:42:00.002+07:00</published><updated>2010-06-12T17:16:18.112+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='grails'/><title type='text'>Some thoughts about Grails</title><content type='html'>I've just finished my first Grails project. To be honest, it's a quite good mind refreshment for me as a Java developer. Grails simplify alot of complex stuff of Java ecosystems like IoC(Spring), ORM(Hibernate), XML configuration with convention over configuration. It takes you less than 10 minutes to create a full working web application with Spring Security for authentication and authorization, Quartz for job scheduling and Hibernate for data persistence when you're familiar with it. Here are some Pros and Cons:&lt;br /&gt;&lt;strong&gt; Pros:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Almost "zero learning effort" for Java developers (although it almost took me a week to get productive with it)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;No XML configuration&lt;br /&gt;&lt;/li&gt;&lt;li&gt;GORM is much easier to work with comparing to Hibernate (both XML-based and annotation-based), dynamic methods for domain class is definitely a good selling point for me here. It saves me tons of DAO code.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Lots of plugins to extend Grails functionalities&lt;/li&gt;&lt;/ul&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Grails heavily uses convention-over-configuration but the documentation about conventions is not enough. Sometimes it get frustrated when you reading someone's code without knowing the convention his/her using.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Bugs. Lots of it, just navigate to &lt;a href="http://jira.codehaus.org/browse/GRAILS"&gt;JIRA of Grails&lt;/a&gt; and you will know what I mean :)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Lacking of good IDE support. First I've tried Spring STS, then NetBeans, then IntelliJ IDEA Ultimate (free trial) and finally finishing my first Grails project in Gedit!&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Grails is a great framework and I'm still learning it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-3291135426258475479?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/3291135426258475479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2010/04/some-thoughts-about-grails.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/3291135426258475479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/3291135426258475479'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2010/04/some-thoughts-about-grails.html' title='Some thoughts about Grails'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-3667608233800587355</id><published>2009-12-08T21:48:00.005+07:00</published><updated>2010-12-21T16:57:26.517+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arch'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>ibus-unikey is now in the AUR</title><content type='html'>I've uploaded a PKGBUILD for ibus-unikey to the ArchLinux AUR. You can install it with &lt;strong&gt;yaourt&lt;/strong&gt; like this:&lt;br /&gt;&lt;pre class="brush: bash"&gt;yaourt -S ibus-unikey&lt;br /&gt;&lt;/pre&gt;If you don't want to build from the source, you have to install all the dependencies first:&lt;br /&gt;&lt;pre class="brush: bash"&gt;pacman -Sy gcc gconf gtk2&lt;br /&gt;&lt;/pre&gt;And then download and install the &lt;a title="Download ibus-unikey-0.3-1-i686.pkg.tar.gz" href="http://dl.dropbox.com/u/1059802/wordpress-blog/ibus-unikey-0.3-1-i686.pkg.tar.gz"&gt;binary package&lt;/a&gt;&lt;br /&gt;Then add the following to your .bash_profile&lt;br /&gt;&lt;pre class="brush: bash"&gt;&lt;br /&gt;export XMODIFIERS=@im=ibus&lt;br /&gt;export GTK_IM_MODULE=ibus&lt;br /&gt;export QT_IM_MODULE=ibus&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;PS: Ok, there is no spyware/malware/rootkit in this binary package! If you don't trust me, don't use this method and build the package yourself (this is the way I recommend)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-3667608233800587355?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/3667608233800587355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/12/ibus-unikey-is-now-in-aur.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/3667608233800587355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/3667608233800587355'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/12/ibus-unikey-is-now-in-aur.html' title='ibus-unikey is now in the AUR'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-4594674557287077896</id><published>2009-12-07T21:42:00.006+07:00</published><updated>2010-05-12T21:16:19.697+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Configuring JNDI mail session in tomcat</title><content type='html'>I've just joined a project as a freelancer to customize a commercial e-commerce solution (so let called it EP). OOTB, the email sending of EP does not support authentication, which is a weird thing for such a cool product like that. Actually, EP does declare an JNDI mail session in the context, but in the code they don't use it. With the source code of EP in hand, things get much easier. First, we declare a JNDI resource in our application context (either in your context file in the conf/Catalina/localhost/ or in your context.xml under META-INF inside your war):&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;context&amp;gt;&lt;br /&gt;&amp;lt;Resource name="mail/Session" auth="Container"&lt;br /&gt;    type="javax.mail.Session"&lt;br /&gt;    username="my.smtp.user"&lt;br /&gt;    password="my-secret"&lt;br /&gt;    mail.debug="false"&lt;br /&gt;    mail.transport.protocol="smtp"&lt;br /&gt;    mail.smtp.host= "xxx.xxx.xxx.xxx"&lt;br /&gt;    mail.smtp.auth= "true"&lt;br /&gt;    mail.smtp.port= "25"&lt;br /&gt;    mail.smtp.starttls.enable="true"&lt;br /&gt;    description="Global E-Mail Resource"&lt;br /&gt;/&amp;gt;&lt;br /&gt;&amp;lt;/context&amp;gt;&lt;br /&gt;&lt;/pre&gt;And put those in your &lt;strong&gt;web.xml&lt;/strong&gt; file:&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;resource-ref&amp;gt;&lt;br /&gt;    &amp;lt;description&amp;gt;Email Session&amp;lt;/description&amp;gt;&lt;br /&gt;    &amp;lt;res-ref-name&amp;gt;mail/Session&amp;lt;/res-ref-name&amp;gt;&lt;br /&gt;    &amp;lt;res-type&amp;gt;javax.mail.Session&amp;lt;/res-type&amp;gt;&lt;br /&gt;    &amp;lt;res-auth&amp;gt;Container&amp;lt;/res-auth&amp;gt;&lt;br /&gt;&amp;lt;/resource-ref&amp;gt;&lt;br /&gt;&lt;/pre&gt;And now, in your Java code, you will use this email session like this:&lt;br /&gt;&lt;pre class="brush: java"&gt;Context initContext = new InitialContext();&lt;br /&gt;Context context = (Context) initContext.lookup("java:comp/env");&lt;br /&gt;Session mailSession = (Session) context.lookup("mail/Session");&lt;br /&gt;//Your code to send the email goes here&lt;br /&gt;&lt;/pre&gt;If you get a &lt;strong&gt;java.lang.ClassCastException&lt;/strong&gt;, don't worry, this is a known issue. It's because you have multiple Java Mail jar file and Java Activation Framework jar file in your CLASSPATH!&lt;br /&gt;Hope that may help!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-4594674557287077896?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/4594674557287077896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/12/configuring-jndi-mail-session-in-tomcat.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/4594674557287077896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/4594674557287077896'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/12/configuring-jndi-mail-session-in-tomcat.html' title='Configuring JNDI mail session in tomcat'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-8315695444456445703</id><published>2009-09-13T18:50:00.001+07:00</published><updated>2010-04-24T14:12:19.800+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wordpress'/><title type='text'>Moving to Wordpress</title><content type='html'>I've just imported all my post and comments from blogger.com to my wordpress.com account. So far so good! I've also cleaned up all of my posts on wordpress.com to make it *cleaner*. Wordpress.com does come with a cool code syntax highlighter as described here &lt;a href="http://support.wordpress.com/code/"&gt;http://support.wordpress.com/code/&lt;/a&gt; , the number of programming language it supports is quite impressive.&lt;br /&gt;By the way, I've just found out some cool tricks to use the built-in code highlighter of wordpress. Instead of typing [&lt;span&gt;sourcecode &lt;span&gt;language='css']&lt;/span&gt;&lt;/span&gt; code here [/&lt;span&gt;sourcecode&lt;/span&gt;], you can use one of the following:&lt;br /&gt; &lt;ul&gt;&lt;li&gt;[&lt;span&gt;source&lt;span&gt; language='css']&lt;/span&gt;&lt;/span&gt;code here[/&lt;span&gt;source&lt;/span&gt;]&lt;br /&gt; &lt;/li&gt;&lt;li&gt;[&lt;span&gt;code &lt;span&gt;language='css']&lt;/span&gt;&lt;/span&gt;code here[/&lt;span&gt;code&lt;/span&gt;]&lt;br /&gt; &lt;/li&gt;&lt;li&gt; [&lt;span&gt;sourcecode &lt;span&gt;lang='css']&lt;/span&gt;&lt;/span&gt;code here[/&lt;span&gt;sourcecode&lt;/span&gt;]&lt;br /&gt; &lt;/li&gt;&lt;li&gt;[&lt;span&gt;source &lt;span&gt;lang='css']&lt;/span&gt;&lt;/span&gt;code here[/&lt;span&gt;source&lt;/span&gt;]&lt;br /&gt; &lt;/li&gt;&lt;li&gt;[&lt;span&gt;code &lt;span&gt;lang='css']&lt;/span&gt;&lt;/span&gt;code here[/&lt;span&gt;code&lt;/span&gt;]&lt;br /&gt; &lt;/li&gt;&lt;li&gt; [&lt;span&gt;sourcecode='css']&lt;/span&gt;code here[/&lt;span&gt;sourcecode&lt;/span&gt;]&lt;br /&gt; &lt;/li&gt;&lt;li&gt;[&lt;span&gt;source='css']&lt;/span&gt;code here[/&lt;span&gt;source&lt;/span&gt;]&lt;br /&gt; &lt;/li&gt;&lt;li&gt;[&lt;span&gt;code='css']&lt;/span&gt;code here[/&lt;span&gt;code&lt;/span&gt;]&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-8315695444456445703?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/8315695444456445703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/09/moving-to-wordpress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8315695444456445703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8315695444456445703'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/09/moving-to-wordpress.html' title='Moving to Wordpress'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-8363998194841572625</id><published>2009-07-29T20:36:00.009+07:00</published><updated>2010-12-17T11:47:40.952+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>Some MySQL installation gotchas!</title><content type='html'>I always use PostgreSQL for every project in my company, both in development and production. Recently, I have to use MySQL (version 5.1.36) in my new project because the client uses MySQL for deployment. The first step I have to do is to setup MySQL on my laptop for the project development, I'm using ArchLinux so the steps are straight-forward:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Install MySQL with the pacman: &lt;strong&gt;pacman -S mysql&lt;/strong&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Start it up: &lt;strong&gt;/etc/rc.d/mysqld start&lt;/strong&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Set the root password: &lt;strong&gt;/usr/bin/mysqladmin -u root password 's3cr3t'&lt;/strong&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Execute the recommended script to secure the new MySQL installation. Basically, the script will remove the test database, the anonymous users and only allow connection from localhost: &lt;strong&gt;/usr/bin/mysql_secure_installation&lt;/strong&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Here come the gotchas!&lt;br /&gt;I open up MySQL Administrator and connect to the new 'shiny' server with the user 'root', everything is fine. I create a new user, then a new catalog and grant all the neccessary permissions for the new user to use the new catalog. I fire up Tomcat which contains my web application (Spring + Hibernate), the application creates a connection pool (c3p0) at startup to improve performance, but it failed with the error message &lt;strong&gt;Connection refused&lt;/strong&gt;". Hmm...strange! Googling for a while, I was suggested to put this into my /etc/hosts.allow the following line:&lt;br /&gt;&lt;pre class="brush: bash"&gt;mysqld: 127.0.0.1:ALLOW&lt;br /&gt;&lt;/pre&gt;Restart my web application, now the error message is different &lt;strong&gt;Communications link failure ...&lt;/strong&gt;. Open up the configuration of MySQL (/etc/my.cnf), I found out that the &lt;strong&gt;skip-networking&lt;/strong&gt; is on! Here is the documentation about this entry:&lt;br /&gt;&lt;pre class="brush: bash"&gt;# Don't listen on a TCP/IP port at all. This can be a security enhancement,&lt;br /&gt;# if all processes that need to connect to mysqld run on the same host.&lt;br /&gt;# All interaction with mysqld must be made via Unix sockets or named pipes.&lt;br /&gt;# Note that using this option without enabling named pipes on Windows&lt;br /&gt;# (via the "enable-named-pipe" option) will render mysqld useless!&lt;br /&gt;&lt;/pre&gt;Comment that entry (by adding the &lt;strong&gt;#&lt;/strong&gt; before it) and restart the mysql server. My web application now can startup properly!&lt;br /&gt;Gotchas solved.&lt;br /&gt;PS: I'm totally new to MySQL, this is my way I made my application work with MySQL, if you have a better setup, I'm glad to know :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-8363998194841572625?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/8363998194841572625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/07/some-mysql-installation-gotchas_29.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8363998194841572625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8363998194841572625'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/07/some-mysql-installation-gotchas_29.html' title='Some MySQL installation gotchas!'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-8795238786737032555</id><published>2009-07-12T08:48:00.007+07:00</published><updated>2009-07-12T09:38:13.703+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arch'/><category scheme='http://www.blogger.com/atom/ns#' term='oss4'/><title type='text'>OSS4 sound distort after kernel update</title><content type='html'>I'm a "fanboy" of OSS4 since I switched from Fedora to ArchLinux. OSS4 is a great sound module except for... its mixer program, ossxmix:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_0lYyfd8fuLw/SllDWt9ocUI/AAAAAAAAAFI/l1YttxLMEDQ/s1600-h/screenshot_001.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 194px;" src="http://2.bp.blogspot.com/_0lYyfd8fuLw/SllDWt9ocUI/AAAAAAAAAFI/l1YttxLMEDQ/s320/screenshot_001.png" alt="" id="BLOGGER_PHOTO_ID_5357387289308197186" border="0" /&gt;&lt;/a&gt;It's not a GUI, it's a GSDI or Graphical Sound Developer Interface :). I have no idea what the functionality it provides, so my approach to use this kind of application is try-and-see.&lt;br /&gt;Recently, I've upgraded my kernel to 2.6.30.x and the sound on my laptop get distored. I googled for solution many hours without any luck, it's time to solve this by myself. Fire up ossxmix, try-and-see alot of settings and I found this:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_0lYyfd8fuLw/SllK5X-fgRI/AAAAAAAAAFQ/Xf_WrPlbG18/s1600-h/screenshot_002.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 242px;" src="http://4.bp.blogspot.com/_0lYyfd8fuLw/SllK5X-fgRI/AAAAAAAAAFQ/Xf_WrPlbG18/s400/screenshot_002.png" alt="" id="BLOGGER_PHOTO_ID_5357395581283041554" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Hope this may save you some time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-8795238786737032555?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/8795238786737032555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/07/oss4-sound-distort-after-kernel-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8795238786737032555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8795238786737032555'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/07/oss4-sound-distort-after-kernel-update.html' title='OSS4 sound distort after kernel update'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_0lYyfd8fuLw/SllDWt9ocUI/AAAAAAAAAFI/l1YttxLMEDQ/s72-c/screenshot_001.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-6662971261919322780</id><published>2009-06-14T09:23:00.007+07:00</published><updated>2011-03-11T20:53:58.930+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='gae'/><title type='text'>My first application on Google App Engine</title><content type='html'>Google App Engine (GAE) has been around for some time. But I don't have time/chance to try it out. A couple of days ago, I registered and activated my account with the help of a close friend in the US because Google uses SMS for the activation process and Vietnam is not in the list of supported countries of GAE right now (or any Vietnamese carriers either).&lt;br /&gt;So what is my first application? It's a IP lookup application. So why? A couple of days ago, my co-worker complained about site providing the same service because it contains too much distracted content. He just want a deadly simple alternative :). Here is my answer &lt;a href="http://ip-bot.appspot.com/"&gt;http://ip-bot.appspot.com&lt;/a&gt;&lt;br /&gt;This is the first draft-unstable-alpha-0 version :), so don't expect to much. I will make it a *feature-rich* site but the simplicity is the top priority. So stay tuned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-6662971261919322780?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/6662971261919322780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/06/my-first-application-on-googl-app_14.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/6662971261919322780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/6662971261919322780'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/06/my-first-application-on-googl-app_14.html' title='My first application on Google App Engine'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-8589380250478233063</id><published>2009-03-06T09:55:00.008+07:00</published><updated>2010-04-24T11:54:24.384+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arch'/><category scheme='http://www.blogger.com/atom/ns#' term='fpt'/><category scheme='http://www.blogger.com/atom/ns#' term='mirror'/><title type='text'>FPT will have a mirror for Arch.... soon!</title><content type='html'>I've switched to ArchLinux from Fedora a couple of months ago and I really miss the mirror of Fedora on FPT (my current ISP). A few days ago, I wrote an email to ask the FPT mirrors admin to add a mirror for ArchLinux to their mirror systems. Here is what I wrote (in Vietnamese):&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Gởi Admin mirror của FPT.&lt;br /&gt;&lt;br /&gt;Arch Linux (&lt;a href="http://www.archlinux.org/" target="_blank"&gt;www.archlinux.org&lt;/a&gt;)&lt;br /&gt;là một distro khá phổ biến hiện nay (Arch đang đứng trong top 20 distro&lt;br /&gt;phổ biến theo Distrowatch.com). Nếu được, mình xin admin cài đặt một&lt;br /&gt;mirror tại &lt;a href="http://mirror-fpt-telecom.fpt.net/" target="_blank"&gt;http://mirror-fpt-telecom.fpt.net/&lt;/a&gt;. Mình gởi bạn địa chỉ URL của ArchLinux repository: &lt;a href="ftp://ftp.archlinux.org/" target="_blank"&gt;ftp://ftp.archlinux.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hi vọng mình sớm được thấy ArchLinux repositories sẽ xuất hiện trong danh sách mirror của FPT.&lt;br /&gt;Cám ơn Admin rất nhiều!&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Basically, what I said is ArchLinux is a popular distro, it's in top 20 of DistroWatch (02 Mar 2009) and asking them to setup a mirror for ArchLinux.&lt;br /&gt;And here is their reply (in Vietnamese):&lt;br /&gt;&lt;blockquote&gt;Chào ,&lt;br /&gt;Cám ơn về ý kiến đóng góp của bạn. Chúng tôi sẽ mirror archlinux trong thời gian sớm nhất.&lt;br /&gt;Mong nhận được những ý kiến đóng góp tiếp theo của bạn.&lt;br /&gt;&lt;br /&gt;Mr.Admin&lt;/blockquote&gt;&lt;br /&gt;What they said is: "Thanks for your suggestion. We will mirror ArchLinux ASAP. We hope to receive your suggestions in the future". I have changed my real name and the name of the author of the above email. It's great news for Arch lovers in Vietnam.&lt;br /&gt;At the moment, FPT have mirrors for the following distros: CentOS, Debian, Fedora, Gentoo, Mandriva, openSUSE, Slackware and Ubuntu.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-8589380250478233063?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/8589380250478233063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/03/fpt-will-have-mirror-for-arch-soon_06.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8589380250478233063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8589380250478233063'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/03/fpt-will-have-mirror-for-arch-soon_06.html' title='FPT will have a mirror for Arch.... soon!'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-5680194445243784005</id><published>2009-02-22T15:01:00.014+07:00</published><updated>2010-04-24T13:04:53.127+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scim-unikey'/><category scheme='http://www.blogger.com/atom/ns#' term='aur'/><title type='text'>scim-unikey is now in the AUR</title><content type='html'>I've just made a PKGBUILD (including the source code) for &lt;a href="http://code.google.com/p/scim-unikey/"&gt;scim-unikey&lt;/a&gt; version 0.2a~20090218 to the AUR. On the main page of the project, the latest stable version you could find is 0.1.2, which is quite old at the moment, and they don't have a public Subversion url right now. The author runs &lt;a href="http://forum.ubuntu-vn.org/viewtopic.php?f=85&amp;amp;t=2592"&gt;a thread on Ubuntu-vn forum&lt;/a&gt; (in Vietnamese) to call for testers for the next release (0.2) of the project. The packaging process is a little bit tricky, because the project does not have a valid url to fetch the source code during the build process, so what I've done is to set the 'source' of the PKGBUILD file to the source tarball of scim-unikey in the same directory like this:&lt;br /&gt;&lt;pre class="brush: bash"&gt;source=($pkgname-$pkgver.tar.bz2)&lt;br /&gt;&lt;/pre&gt;You have to make sure that the file scim-unikey-20090218.tar.bz2 is located at the same directory as the PKGBUILD file.&lt;br /&gt;Then run the command:&lt;br /&gt;&lt;pre class="brush: bash"&gt;makepkg --allsource&lt;br /&gt;&lt;/pre&gt;This will create a file .src.tar.gz, upload that file to the AUR to share the fun with others!&lt;br /&gt;To install this package, simply run the command:&lt;br /&gt;&lt;pre class="brush: bash"&gt;yaourt -S scim-unikey&lt;br /&gt;&lt;/pre&gt;Follow the instructions (on screen) after you install the package to configure scim-unikey.&lt;br /&gt;There is a small toolbar pop up every time a new application is executed, it's very annoying, to disable it, just Right-click on the Scim icon on the system tray, select &lt;strong&gt;Hide Toolbar&lt;/strong&gt;.&lt;br /&gt;&lt;strong&gt;Troubleshooting:&lt;/strong&gt;&lt;br /&gt;-If you are a Java developer and Eclipse is your IDE of choice, it's likely scim-unikey will not work properly with "vanilla" Eclipse setup.  Here is the my &lt;a href="http://code.google.com/p/scim-unikey/issues/detail?id=4"&gt;bug report&lt;/a&gt;. Solution is simple, just right-click on your main editor, select &lt;strong&gt;Input Method --&amp;gt; Scim Input Method&lt;/strong&gt; or &lt;strong&gt;Scim Bridge Input Method&lt;/strong&gt; depending on which one you are using.&lt;br /&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;br /&gt;13th March 2009: update scim-unikey to version 20090313 to the AUR.&lt;br /&gt;16th May 2009: update scim-unikey to version 0.2.0 to the AUR.&lt;br /&gt;11th July 2009: update scim-unikey to version 0.3~r32 to the AUR to fix a problem with scim 1.4.8+ on Firefox and Epiphany&lt;br /&gt;14th September 2009: update scim-unikey to version 0.3.1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-5680194445243784005?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/5680194445243784005/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/02/scim-unikey-is-now-in-aur.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/5680194445243784005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/5680194445243784005'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/02/scim-unikey-is-now-in-aur.html' title='scim-unikey is now in the AUR'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-8900031817410612578</id><published>2009-02-17T21:17:00.013+07:00</published><updated>2010-04-24T13:03:06.899+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='gimp'/><category scheme='http://www.blogger.com/atom/ns#' term='xvnkb'/><category scheme='http://www.blogger.com/atom/ns#' term='aur'/><title type='text'>Xvnkb is now in AUR</title><content type='html'>I just submitted my first package to the AUR, it's xvnkb-0.2.9a. If you are using Yaourt, you can install it by entering the command:&lt;br /&gt;&lt;pre class="brush: bash"&gt;yaourt -S xvnkb&lt;br /&gt;&lt;/pre&gt;After installing, you have to put this to your .bashrc:&lt;br /&gt;&lt;pre class="brush: bash"&gt;export LD_PRELOAD=/usr/lib/xvnkb.so&lt;br /&gt;&lt;/pre&gt;That's it! Don't forget to vote for it after the installation :).&lt;br /&gt;I have an annoying problem with xvnkb on Arch, it uses CPU a little higher than normal, I've never experienced this before on Fedora or Ubuntu.&lt;br /&gt;Another thing need to mention is GIMP give me a segmentation fault at start up with the above LD_PRELOAD. This is expected as many people experienced this before. A quick and dirty workaround is to unset the LD_PRELOAD right before launching GIMP. In the terminal, do this:&lt;br /&gt;&lt;pre class="brush: bash"&gt;unset LD_PRELOAD;gimp &amp;amp;&lt;br /&gt;&lt;/pre&gt;If you don't prefer the "command-line", create a small executable bash script file and put it in your PATH, I called it gimp-launcher.sh with the following content:&lt;br /&gt;&lt;pre class="brush: bash"&gt;unset LD_PRELOAD;gimp $1 &amp;amp;&lt;br /&gt;&lt;/pre&gt;Next, find the .desktop file of GIMP (I'm using Arch and it's located at /usr/share/applications/gimp.desktop, your distro may put it in a different place), replace the line Exec and TryExec with:&lt;br /&gt;&lt;pre class="brush: bash"&gt;Exec=gimp-launcher.sh %U&lt;br /&gt;TryExec=gimp-launcher.sh&lt;br /&gt;&lt;/pre&gt;And now, you can use GIMP as normal.&lt;br /&gt;I've filed a &lt;a href="http://bugzilla.gnome.org/show_bug.cgi?id=572147"&gt;bug report&lt;/a&gt; about this, hopefully the GIMP developers will fix this in the next release.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-8900031817410612578?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/8900031817410612578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/02/xvnkb-is-now-in-aur_17.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8900031817410612578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/8900031817410612578'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/02/xvnkb-is-now-in-aur_17.html' title='Xvnkb is now in AUR'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8660486175491404610.post-3546603395241809676</id><published>2009-02-08T19:30:00.002+07:00</published><updated>2011-10-22T17:37:33.377+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oss4'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>OSS4 and gstreamer based player problem</title><content type='html'>Sound system on Linux is confusing, both for end users and developers. When I was using Fedora, I used Alsa for all of my sound needs, from listening to music, filming and gaming. Recently, I've switched to Arch Linux and installed OSS4 for my sound. The sound quanlity is quite better than Alsa but I've got an annoying problem: all the gstreamer-based music player uses CPU too much, about 40%-60% (rhythmbox, totem, exaile) when playing mp3 files. After googling, I found &lt;a href="http://www.4front-tech.com/forum/viewtopic.php?t=2846"&gt;this&lt;/a&gt;, try this on my system:&lt;br /&gt;&lt;pre class="brush: bash"&gt;/usr/sbin/vmixctl detach /dev/dsp&lt;br /&gt;/usr/sbin/vmixctl attach -r /dev/dsp&lt;/pre&gt;What it does is to detach the virtual mixer and reattach without recording setting. The CPU usage down to 6-10%, cool!&lt;br /&gt;But after reboot, the CPU usage of gstreamer-based music player still high. It seems that our hack is not persisted. So I have to edit the /etc/rc.d/oss to detach and reattach without recording ability, here is my /etc/rc.d/oss:&lt;br /&gt;&lt;pre class="brush: bash"&gt;#!/bin/bash&lt;br /&gt;. /etc/rc.conf&lt;br /&gt;. /etc/rc.d/functions&lt;br /&gt;&lt;br /&gt;case "$1" in&lt;br /&gt;start)&lt;br /&gt;     stat_busy 'Starting Open Sound System'&lt;br /&gt;     if /usr/sbin/soundon&lt;br /&gt;     then&lt;br /&gt;             add_daemon oss&lt;br /&gt;             /usr/sbin/vmixctl detach /dev/dsp&lt;br /&gt;             /usr/sbin/vmixctl attach -r /dev/dsp&lt;br /&gt;             stat_done&lt;br /&gt;     else&lt;br /&gt;             stat_fail&lt;br /&gt;     fi&lt;br /&gt;     ;;&lt;br /&gt;stop)&lt;br /&gt;     stat_busy 'Stopping Open Sound System'&lt;br /&gt;     if /usr/sbin/soundoff&lt;br /&gt;     then&lt;br /&gt;             rm_daemon oss&lt;br /&gt;             stat_done&lt;br /&gt;     else&lt;br /&gt;             stat_fail&lt;br /&gt;     fi&lt;br /&gt;     ;;&lt;br /&gt;restart)&lt;br /&gt;     $0 stop&lt;br /&gt;     $0 start&lt;br /&gt;     ;;&lt;br /&gt;*)&lt;br /&gt;     echo "Usage: $0 {start|stop|restart}"&lt;br /&gt;esac&lt;/pre&gt;Now, all the gstreamer-based applications are now playing nice with my CPU, but my box lost the ability to record sound :(. If you have a better solution, please share with me.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8660486175491404610-3546603395241809676?l=www.tinhtruong.me' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.tinhtruong.me/feeds/3546603395241809676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.tinhtruong.me/2009/02/oss4-and-gstreamer-based-player-problem_08.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/3546603395241809676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8660486175491404610/posts/default/3546603395241809676'/><link rel='alternate' type='text/html' href='http://www.tinhtruong.me/2009/02/oss4-and-gstreamer-based-player-problem_08.html' title='OSS4 and gstreamer based player problem'/><author><name>Trương Xuân Tính</name><uri>http://www.blogger.com/profile/06494927095356964880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_0lYyfd8fuLw/SbCnPLUjdoI/AAAAAAAAACU/4KLwBnlamy0/S220/MG_0917-small.jpg'/></author><thr:total>0</thr:total></entry></feed>
