#me { float: left; }

February 29, 2008

When in Rome

Filed under: Humour, Odds & Sods — Simon Rigby @ 2:12 am

This is brilliant. I just heard on the radio that a British peace campaigner decided to walk to India with no money and relying purely on the charity of those me met along the way. He said that he was warmed by the generosity of strangers in the UK, but when he hit the French coast of Calais he had trouble getting people to understand his concept. Well in fact, to understand anything at all .. wait for it .. he doesn’t speak French. Cold and hungry he was forced to return to the UK, where he now plans to walk around the coast of Britain instead.

However, he is turning that to his advantage by learning French along the way so that he can try again next year.

I wonder what happens when he leaves France? He’ll have to do a lap of France so that he can learn Italian, Swiss or German :)

February 21, 2008

All HTML elements can live server side in ASP.NET

Filed under: ASP.NET, Web Design — Simon Rigby @ 8:04 am

In doing a search for something the other day I discovered that its a popular misconception that if an HTML tag doesn’t have an ASP.NET equivalent then you are forced to work with that tag purely in JavaScript. This is not the case as any HTML tag can have a runat="server" attribute. It’s just that the tag is then cast as an HtmlGenericControl.

I’m not advocating frames as a design construct but let’s say you have a search box on your website and you want to pass off the entered criteria to a popup which is essentially two frames, a header that brands it as ‘our’ site and a bottom frame that contains a search result document from another domain. (Yes I know there are better ways of doing this. Its an example, not doctrine).

The results page from the other domain expects http://www.somedomain.com/result.php?query=foo.

Firstly, we would have a bit of JavaScript on our main site that opens a popup window and loads in our frameset.

The frame set is an aspx page and expects a URL in the format http://www.mydomain.com/StockSearch.aspx?query=foo.

When that frameset loads I need to process the query string parameter so that I can use it formulate the src property of the search results frame. So the first thing to do is to create the frameset like so:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StockSearch.aspx.cs" Inherits="StockSearch" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Stock Search</title>

    <frameset rows="64,*" frameborder="0" framespacing="0" framepadding="0">
        <frame src="pop_header.html">
        <frame runat="server" id="searchFrame" />
    </frameset>
</head>

<body>
    <form id="form1" runat="server">
        <div>

        </div>
    </form>
</body>
</html>

Two things to note. Note that the second frame (the one that I want to get at) has the runat="server" attribute. Also note that it is ‘closed’ (i.e. <frame />). The closing slash is important otherwise .NET kicks up about an end of file error. All server side tags must have either a matching close tag version (i.e. <frame></frame) or a closing slash for empty tags (i.e. <frame />).

Now in the code behind I can quiz the passed in query string and set the src property of the second frame accordingly.

public partial class StockSearch : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlGenericControl frame = (HtmlGenericControl)searchFrame;
        frame.Attributes.Add(
            "src",
            "http://www.somedomain.com/result.php?query=" + Request.QueryString["query"].ToString()
        );
    }
}

You can use a similar technique for any HTML tag that lacks an ASP.NET equivalent.

February 20, 2008

Sorry and the stolen generation

Filed under: Opinion, Politics — Simon Rigby @ 12:29 pm

As a quasi-Australian (ie I lived there most of my life) and someone who has spent quite a bit of time in aboriginal Australian communities and parts of the country that have a mostly indigenous population, I have always found the stories about how aboriginal children were taken from their families and ‘fostered’ out to white families as a horrible state of affairs and one of the reasons why the breakdown of aboriginal culture has been so devastating to that section of the population. I feel a number of emotions when I think about it. I am ashamed that my ‘cultural heritage’ acted in such a way; I feel pity for those affected. But what I don’t feel is sorrow. I feel no need to say sorry. This isn’t dodging some ethical or moral obligation. The fact is I didn’t do it and neither did the current Australian government.

(I know this is going to wind people up but hear me out)

Sorry doesn’t undo the damage. If I perform some horrible wrong on someone and I later regret it then sure I am going to want to apologise but I will do that through a deeply personal motivation to try and put things right or to begin some process of reconciliation. And I can understand how some people see an apology from the government of the day as a first step in a similar process. The problem I have with this is that governments often ‘speak’ through a need for political expediency not some desire to to the right thing by all people.

Why is is so important for the government to offer this apology? What does it achieve and is it heart felt? Make films, write books, write music, paint pictures and make sure the world never forgets about a tragic part of our history. Don’t lobby the government to do it on your behalf.

Yes the government of the time made this policy and it was wrong in so many ways. The current government didn’t and as our elected officials they speak on our behalf. I’m quite capable of doing that myself, thanks.

I was never a major fan of John Howard, but by offering a statement that basically condemned the actions of the government of the time but not going so far as saying sorry was right and proper in my opinion. If we are going to hold our past responsible for the future we are in dire straights. Learn from the past, make sure as many people as possible know what happened and try to make sure it doesn’t happen again. Society does that, not government.

February 15, 2008

ASP.NET Menu control not rendering correctly in Safari

Filed under: ASP.NET, Safari, Web Design — Simon Rigby @ 12:22 pm

I found this neat solution to a long standing problem on ASP.NET.

Add a file called safari.browser to the app_browsers folder, containing the following:

<browsers>
    <browser refID="safari1plus">
        <controlAdapters>
            <adapter controlType="System.Web.UI.WebControls.Menu" adapterType="" />
        </controlAdapters>
    </browser>
</browsers>

Thanks to micheilvoo for the solution. The original thread can be found here.

Theme: WordPress Classic. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.