A passionate programmer’s findings in the world of internet.

Archive for the 'Programmers should read' Category

Embed Windows Media Player for Firefox

Sunday, December 14th, 2008

I have done some Google searches researchs recently to fulfill the requirements of a project. One of them is to embed audio player in them web-based system, which will be played in Mozilla Firefox.

Server side

The HTML code that works for me:

<OBJECT id="Player"
	width="210" height="45">
	<PARAM name="autostart" value="false"/>
	<PARAM NAME="URL" VALUE="test-mp3.mp3">
	<PARAM name="PlayCount" value="1">

Client side

In Firefox, I found that I'll have to install a plug-in from Port25: Windows Media Player Firefox Plugin

The better solution might be to use Flash media player, but most of it are not suitable for a commercial product (unless I write a new one?).

Do comment if you have better recommendations!

eGenting Programming Competition 2008

Friday, October 24th, 2008

eGenting Programming Competition 2008

It has already became a tradition of R&D department of eGenting to organise this event every year. I still can remember the feeling when I took part in the eGenting Programming Competition 2004. I felt very nervous, especially when you see hundreds of contestants coming from every part of Malaysia to be at this competition. I must say the questions are really challenging, not those that you can find in universities. It is really a good place to really know your real ability in programming.

If you think you are good in programming, why don't you prove whether you are right? This is a good chance to really test yourself. Highly recommended to fresh graduates! It is also a good place to get a well-paid job (as our economy is heading downwards at this moment)!

Details of the event

  • Competition date: 15 November 2008
  • Time: 10.00 am to 6.00 pm
  • Venue: Auditorium, 25th Floor Wisma Genting, Jalan Sultan Ismail, 50250 Kuala Lumpur.
  • Nature: Open-book handwritten programming task

Few changes to the event this year:

  1. The venue is no longer at Genting Highlands (which is sad). You no longer get free ride to Genting Highlands.
  2. This year they have abolished the professional category. Everyone can join the same category.

The registration will close end of this month. You still have 7 days to go. Register quickly. Don't miss this golden opportunity!

New website: eGenting Programming Competition 2008

Programming Brain Teaser

Wednesday, July 9th, 2008

I joined the fun to work on a programming brain teaser by Dustin Diaz (read the original post for details). The general rule is as follows:

Group together all duplicate items that occur anytime beyond twice by wrapping them with a tag, naturally "bookending" them.

Here's my solution in PHP:

$arr = array ('a', 'b', 'c', 'c', 'd', 'e', 'e',
'e', 'e', 'e', 'f', 'e', 'f', 'e',
'f', 'a', 'a', 'a', 'f', 'f', 'f');

$count = 0;
$prev = '';
foreach ($arr as $item) {
	if ($prev == $item) $count ++;
	if ($count == 2 && $prev == $item) echo '<strong>';
	if ($count >= 2 && $prev != $item) echo '</strong>';
	echo $item;
	if ($prev != $item) $count = 0;
	$prev = $item;
if ($count >= 2) echo '</strong>';

Give your comments, if any.

Update: After pointed out by gbyeow in the comment, I agree that it could be optimized. I was too overwhelmed by achieving the result that I forgot to optimize after I completed the code.

The optimized version:

$arr = array ('a', 'b', 'c', 'c', 'd', 'e', 'e',
'e', 'e', 'e', 'f', 'e', 'f', 'e',
'f', 'a', 'a', 'a', 'f', 'f', 'f');

$count = 0;
$prev = '';
foreach ($arr as $item) {
	if ($prev == $item) {
		$count ++;
		if ($count == 2) echo '<strong>';
	if ($prev != $item) {
		if ($count >= 2) echo '</strong>';
		$count = 0;
	echo $item;
	$prev = $item;
if ($count >= 2) echo '</strong>';

HTML Linking – Common Mistake

Sunday, December 2nd, 2007

At times, I was wondering why would an author link to an invalid site in their new article. It could be caused by typing mistakes but the author should always try to click on their own link before they publish the article.

I found one common mistake that lots of people would make. Google has a goodbad example on this.

At this What is Web History? help page, if you point to the link in the page (refer the following image), you will see a weird link at status bar.

Incorrect link

What I saw in status bar:

Status bar of incorrect link

If the author used the following code to link, he will get the problem.

<a href="www.enrii.com">enrii.blog</a>

The author should include "http://" to avoid the problem.

<a href="http://www.enrii.com">enrii.blog</a>

So, web programmers, take note about this!

eGenting Programming Competition 2007

Wednesday, July 25th, 2007

eGenting Programming Competition 2007

The annually organised eGenting Programming Competition is here again. If you have not heard of it before, there are basically 2 categories:

  1. Graduate category for under 26 years old
  2. Professional category for 26 years old and above

The prizes are very attractive, with cash prizes and job offer for graduate category, and computers and cruise trip for professional category.

Competition Details

  • Competition date : 22 September 2007
  • Time : 10.00 am to 6.00 pm
  • Venue : Resort Convention Centre, Genting Highlands, Malaysia
  • Nature : Open-book handwritten programming task

Registration is closing on 31 August 2007. Make sure you don't miss this great chance to win those fabulous prizes and even job offers.

Official website: eGenting Programming Competition