RegEx: Best RegEx Eclipse Plugin QuickRex

November 12th, 2008 by jeremychone | No Comments »

Sql: Select rows with duplicate values (select, count, group by, having)

November 8th, 2008 by jeremychone | No Comments »
select count(lastName), lastName from employee group by lastName having count(lastName) > 1;

Mysql: Java Web App and MySql 5.x UTF-8

November 8th, 2008 by jeremychone | No Comments »

To fully support UTF-8 with mysql, make sure of the followings:

  1. Set HttpServletRequest UTF-8 character encoding.
    request.setCharacterEncoding(”UTF-8″);
  2. Set HttpServletResponse UTF-8 character encoding
    response.setContentType(”text/html; charset=UTF-8″);
  3. Create the Column, Table, or DB need to have the UTF8 charset and collation
    CHARACTER SET utf8 COLLATE utf8_general_ci
  4. THE TRICK: Add the character encoding instruction in your JDBC URL
    jdbc:mysql://localhost:3306/DATABASENAME?useUnicode=true&characterEncoding=UTF8

Related links:

Tomcat: Virtual Hosting and Web App

November 2nd, 2008 by jeremychone | No Comments »

To map a domain name to a “war” web application.

File: [tomcat-path]/conf/server.xml

<Service>….
<Service>….
<Engine>…

<Host name=”www.yourdomain.com” appBase=”webapps/webappname”
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”" docBase=”.”/>
</Host>

</Engine>
</Service>
</Server>
Note: This obviously assumes that this domain name is mapped to the specific tomcat instance.

Pics: 1001 Free Icons from FamFamFam

November 1st, 2008 by jeremychone | No Comments »

One of the best set of free icons on the market! Thank you famfamfam.com.

Windows: Changing the LMHOSTS on Vista

November 1st, 2008 by jeremychone | No Comments »
  • Start Notepad or your text editor as Adminstrator
  • Open and edit the following file
    C:\Windows\System32\drivers\etc\hosts

HTML: Link with OnClick and blank Href

October 30th, 2008 by jeremychone | No Comments »
<a onclick=”myFuction(event);return false;” href=”">Some Text</a>

The return false; prevents the browser to follow the href link. Note that have the method return false does not work.

Using HREF JavaScript Links

IBM: WebSphere Portal Express

October 29th, 2008 by bbuffone | No Comments »

Make sure that you are logged into logged into your machine’s local admin account before installing. If you don’t - whether or not the account is an admin it will fail to install properly.

PS - It takes about 2:30 to install it completely.

jQuery: File Upload Auto Submit using jQuery.parents(exp)

October 18th, 2008 by jeremychone | No Comments »
<form action=”" method=”post” enctype=”multipart/form-data”>
<input style=”margin-left: 0″ type=”file”  name=”photoFile” onchange=”upload(event)”/>
</form>
</div>

<script>
function upload(e){
var target = $.event.fix(e).target;
$(target).parents(”form:first”).submit();
}
</script>

jQuery: Fixing Event with jQuery.event.fix

October 18th, 2008 by jeremychone | No Comments »

If you want to use the traditional HTML event binding and still use jQuery, here is a quick tip to get a “clean” (i.e. cross browsers) html event using jQuery.event.fix:

<input type=”file” name=”photoFile” onchange=”upload(event)”/>
<script>

function upload(e){
var e = $.event.fix(e);
alert(”target: ” + e.target);
}

</script>