What is a better way to organize WPF elements?

I have the following XAML:

<Window x:Class="WpfTest.Window2" ...
    <Grid>
        <Grid.RowDefinitions>
            <!-- 0: Row Zero -->
            <RowDefinition Height="30" />
            <!-- 1: Row 1 -->
            <RowDefinition Height="30" />
            <!-- 2: Row 2 -->
            <RowDefinition Height="30" />
            ...
            <!-- and so on. -->

       <!-- 0: Row Zero elements -->
       <Label Grid.Row="0" ... />
       <TextBlock Grid.Row="0" ... />

       <!-- 1: Row 1 elements -->
       <Label Grid.Row="1" ... />
       <TextBlock Grid.Row="1" ... />
...

read more

How to use inheritance in a more complex type in Julia

I am trying to use a general type Any in the following function:

function f(arr::Array{Tuple{ASCIIString, Any},1})
    arr[1]
end

and it works in

f([("a",1), ("b","x")])

but in

f([("a",1)])

it does not work. One’d think an Int is actually an Any, but apparently not.

How to get f working in this latter case? I am interested in a general solution because this problem crops up in many places in Julia and the above is just a simple example. Should I use a Union of all types in place of Any in the tuple?

read more

How to use inheritance in a more complex type in Julia

I am trying to use a general type Any in the following function:

function f(arr::Array{Tuple{ASCIIString, Any},1})
    arr[1]
end

and it works in

f([("a",1), ("b","x")])

but in

f([("a",1)])

it does not work. One’d think an Int is actually an Any, but apparently not.

How to get f working in this latter case? I am interested in a general solution because this problem crops up in many places in Julia and the above is just a simple example. Should I use a Union of all types in place of Any in the tuple?

read more