Sometimes it happens that Xcode throws you an exception, and you don’t know why. How do you print the relevant Exception information?

To get more information, you can configure the debugger to break when any exception is thrown. Go to the Breakpoint Navigator and click the little ‘+’-button at the bottom. Then click “Add Exception Breakpoint”.

Add Exception BreakpointBut, in many cases, even then you don’t get the information you wanted when the Exception occurs. Add these commands to the breakpoint configuration to show the name and reason of the breakpoint. This should get you on the way to eliminate the error.

Breakpoint on all exceptions

po [*(id *)($esp+4) name] and

po [*(id *)($esp+4) reason]

 

This works when you are using LLDB by printing the name and reason of the exception in the command window. You can also execute those commands in the command window, but you have to make sure to select stackframe 0 first.

I’ve implemented a Filter to apply on text fields in ASP.NET Dynamic Data websites.

To use it: include the code in your project by putting it in the DynamicData\Filters folder. Then apply the filter to the field you want to enable filtering on using the FilterUIHint attribute.

Example:

[MetadataType(typeof(Category_MetaData))]
public partial class Category
{
  class Category_MetaData
  {
    [FilterUIHint("TextFilter")]
    public string Description { get; set; }
  }
}

You have to manually trigger the application of the query filter by adding a button to the appropriate template. For example, add this to the List.aspx template:


in the code behind for that template:

protected void SearchButton_Click(object sender, EventArgs e)
{
  ((IQueryableDataSource)this.GridDataSource)
      .RaiseViewChanged();
}

If you want to see it in action, you can download the full sample code, which is based on the famous Northwind database on SQLExpress.

I got a lot of inspiration and help from msdn and this blog post to get to a decent implementation for this.

Like always I’ve compressed the code using 7-zip. The best compression tool. Ever.

The video shows a prototype of a machine that is powered by the wind that reaches speeds higher than the wind, moving directly down wind.

DDWFTTW stands for Direct Down Wind Faster Than The Wind.

Every Windsurfer with a little bit of experience knows that this is impossible using just a stationary sail, because of losses due to friction, it is not even possible to go as fast as the wind, when moving directly down-wind. If you have an angle, it is possible to go faster than the wind using a modern sail.

Now how does this work? What you have to notice is that the turbine is not moving the wheels, but the wheels are moving the turbine, this means that the turbine is blowing in the direction that the wind is coming from. The wind pushes the cart forward, this sets the wheels in motion, which in turn sets the turbine in motion, which generates extra trust. Really cool and at first contra-intuitive. Don’t you just love engineering!!

This new-found knowledge will certainly buy you a beer at the bar, if you can lure the right people into a wager.

[update: Obsolete since modem swap]

I promised I would write about the new network topology I realised by using my brand new wireless router. I installed DD-WRT on my new linksys WRT54G2. Now I will show how to configure it, so you don’t need an extra switch in a common telenet configuration. First I will describe the old situation and explain why it is done that way. Next I will describe how I managed to get the same result, using just one device and a bit of configuration magic.

So what is the old situation?

Old situation with separate switch and router
Old situation with separate switch and router. The blue lines are COAX cable, the green one is scart/hdmi, the purple ones are UTP (network) cables.

This is how telenet installs it. They provide an extra hub, to split the connection between the digibox / digicorder and the internet connection. It is necessary for the digibox/digicorder to work, that it can get an external (telenet-internal) ip address from a dedicated range (10.169.*.*). If the hub or switch would be removed, and the digibox/digicorder plugged into the router, it would get a private ip (192.168.1.*), from the routers lan-dhcp range. This is because the usual configuration of cheap router, does not allow to the split its switch-interface between internal and external ranges. It has one fixed WAN (wide area network) port, and the other ports are for the private network.

The new situation

elimination of the hub via VLAN
elimination of the hub via VLAN

This is my current setup. It’s almost the same, but now without a separate device for giving the digibox/digicorder its dedicated external ip address. It is now done using some configuration magic.

I used one of the fixed internal network ports to form a WAN-switch. This can be done by configuring a VLAN where this interface, and the WAN port are combined, which leaves me with only 3 internal fixed network ports. This is enough for me. One for my fixed computer, one for my XBOX360, and I even have on left unused. My other computers are connected to my private network using Wifi.

This is how you configure it using DD-WRT: It is as easy as unchecking, and then checking another checkbox, and saving the settings. (rebooting the router if it doesn’t work the first time)

checking the checkboxes
checking the checkboxes

Click the image to get the full size.  The result is the same as if you would have the extra physical switch in between, only now, it is implemented as a “virtual” switch inside the router.

The advantage

You only need one device, where you used to have two. This saves a UTP cable, a wall-plug, the space to put the switch and lots of energy (= money). I have not calculated how much energy my old setup consumed, and now that the router has died, it is also no longer possible, but I guess that in this case one device consumes less energy than two. If someone has a kWh meter, I will gladly measure the energy consumption. We can than compare and calculate how long it takes before the new router has paid itself back.

What would be the impact if all telenet customers (that have internet + digital tv) changed their configuration? How much energy would be saved? I have always wondered how much energy the telenet customer side setup costs in terms of energy. There are so many boxes in my closet, all plugged in, are they really all necessary?