Freelancer's Playground! Learn Programming, The Freelancer's Way

5May/070

Setting Broadcom Wireless Device in Kubuntu in detail part 1

Well, This actually is an alternative solution from my previous post. This time, the problem still the same. But I did using different method. Instead of using driver from installer which is came from CD included with my laptop. I'm using driver that's already installed on my laptop. Why I did this? because I don't bring the installer and I'm just reinstall my kubuntu with ubuntu 7.04 Fiesty Fest.

Filed under: Tutorial Continue reading
5May/070

Strange Javascript Behaviour

Yeah... I'm dumb. But, how do I know that this simple code generate quite difficult to understand error?

	function buildParameter(scr, txt){
		var returnValue = "";
		var temp = txt.split("\n");
		returnValue = '<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?><request>'
					+ '<script>' + scr + '</script>';
		for(i = 0; i < temp.length; i++){
			x = temp[i].split('=');
			returnValue += '<param name="' + x[0] + '">' + x[1] + '</param>';
		}
		returnValue += '</request>';

		alert(returnValue);
		return returnValue;
	}

Go a head, test it with your editor. Here, I got

unterminated string literal

And how do I know what is generating this error?. You know what? Here's the suspect :

		returnValue = '<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?><request>'
					+ '<script>' + scr + '</script>';

I don't know why is this generating error and I'm googling without result. Maybe wrong query. But, I found the solution by trial and error. So, here's the weapon to terminate this suspect :

		returnValue = '<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?><request>'
					+ '<' + 'script' + '>' + scr + '</' + 'script>';

Filed under: Non Technical No Comments