Tuesday, March 27, 2007

The Controversial Anti-Smacking Bill

I have some sympathy for both sides of this debate actually. I think that most of the Bill's supporters are genuine in their belief that this will address NZ's very real child abuse problem.

However the proposed legislation is seriously flawed and is unlikely to actually achieve it's stated objective. It also has serious potential for misuse in child custody cases and other situations where people may lay complaints against perfectly good parents with ulterior motives.

There are a good discussion at this website: http://www.publicdebate.co.nz/ at the moment.

Friday, February 9, 2007

WPF - Blend Beta Video Training Now Available!

WPF (Windows Presentation Framework) is surly the next big thing in development world. And Expression Blend is the new user interfaces design tool for WPF.

And now there is a video tutorial available over at Lynda.com. It is called Expression Blend Beta Preview and it covers all of the basics of using Blend to create WPF applications. At the end you put what you’ve learned to the test by creating a Flickr photo viewer. Go on over and check it out!

Wednesday, February 7, 2007

Cool F1 Wallpapers

With Alonso replacing the famous brainless and careless Kimi Raikkonen, Mclaren really have a great chance winning the F1 championship this year.

Mclaren alway have the best looking car on the grid, so here we go, some nice wallpapers for you desktop.


Monday, February 5, 2007

Shameless and Corrupted

Here is the shameless Labour Party again – apparently they still having a second thought about paying back the election overspending which they passed a bill in parliament to make it legal.

Yes, I know Helen Clark have put pressure on Mike Williams to withdraw that claim, and assured they will pay the $800,000 back by this financial year. My point is you can see how ‘intelligent’ these people are in the Labour Party, and our country is lead by these idiots. That’s why the inflation is still going up, house price is sky-rocking, export is hurting and we are not getting more salary! Well done Labour, well done Helen! I guess I might be better off to get on the benefit queue and join you guys.

Sunday, February 4, 2007

Editable combobox

One of the most common issues when building web application is the need of a editable combobox - control that allow user to type in whatever they wanted as well as to pick from a pre-defined list. With a textbox, select control and some javascript, it is not too difficult to create a cross browser solution. Here is how I did it.



<html>
<script language="javascript">
function findPos(obj){
var curleft = curtop = 0;
if (obj.offsetParent){
curleft = obj.offsetLeft
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
}
return [curleft,curtop];
}

function findObj(id){
try{
var obj=document.getElementById(id);
return obj
} catch (e) {return null;}
}

function showCategories(obj){
var offset = 5;
var pos = findPos(obj);
var list = findObj("lstCategories");
if (list!=null){
list.style.left = pos[0];
list.style.top = pos[1]+obj.clientHeight+offset;
list.style.width = obj.clientWidth+offset;
list.style.display = "";
}
}

function setValue(objId,value){
var obj=findObj(objId);
if (obj!=null) {
obj.value = value;
}
}

function onTxtKeyPress(event){
if ((event.keyCode==40) || (event.keyCode==38)){
var obj=findObj("lstCategories");
if (obj!=null){
obj.focus();
}
}
}

function onListKeyPress(obj,event){
switch (event.keyCode){
case 13:
setValue('txtSearch',obj.options[obj.selectedIndex].text);
obj.style.display='none';
break;
}
}
</script>
<body>
<table border="0" style="z-index:1;">
<tr>
<td><input type="text" id="txtSearch" name="txtSearch"
onclick="javascript:showCategories(this);"
onkeypress="javascript:onTxtKeyPress(event);" /></td>
</tr>
<tr>
<td><input type="text" id="txt1" name="txt1" /></td>
</tr>
<tr>
<td></td>
</tr>
</table>
<select id="lstCategories" name="lstCategories" size="10"
onclick="javascript:this.style.display='none';setValue('txtSearch',this.options[this.selectedIndex].text);"
style="display:none;z-index:10;position:absolute;"
onkeypress="javascript:onListKeyPress(this,event);">
<option>Javascript</option>
<option>Editable</option>
<option>Combobox</option>
<option>Textbox</option>
<option>HTML</option>
<option>DHTML</option>
<option>c#</option>
<option>.NET</option>
</select>
</body>
</html>