Archive for October, 2008

HTML: Link with OnClick and blank Href

Thursday, October 30th, 2008
<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

Wednesday, October 29th, 2008

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)

Saturday, October 18th, 2008
<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).closest(“form”).submit();
}
</script>

jQuery: Fixing Event with jQuery.event.fix

Saturday, October 18th, 2008

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>

Web2.0: Twitter & FriendFeed RSS/Atom query

Wednesday, October 15th, 2008

http://friendfeed.com/search?q=yokway&format=atom

http://search.twitter.com/search.atom?q=yokway

Pics: Web 2.0 Badges (with Photoshop source file)

Monday, October 13th, 2008

From dezinerfolio

Mysql: Create Foreign Key

Sunday, October 12th, 2008

Assuming 1 to M from Person to Address:

ALTER TABLE address ADD
CONSTRAINT FK_address_person_id
FOREIGN KEY (person_id)
REFERENCES person(id) ON DELETE CASCADE

MySQL – SQL Table Basics – Table Relationships

Html: Create form definitions outside table.

Sunday, October 12th, 2008

Make sure that you keep the

tag outside of the table definition.

and not

iBatis: Return id on Insert

Saturday, October 11th, 2008
<insert id=”addProduct” parameterClass=”sample.Product”>
insert into PRODUCT (name,desc) values (#name#, #description#)
<selectKey resultClass=”Long”>
select LAST_INSERT_ID() as id
</selectKey>
</insert>

Freemarker: hasNext

Saturday, October 11th, 2008
[#assign seq = ["winter", "spring", "summer", "autumn"]]
[#list seq as x]
${x_index + 1}. ${x}[#if x_has_next],[/#if]
[/#list]

See Freemarker doc for more.