-
“I devoted 25 years of my life to trying to find out whether [psi] is [real]. Now I have given up.”
She wanted to believe but numbers didn’t match. Great insight into how to be truly open to possibility of paranormal. -
put an ERB tag around your js and css links at the top of the page. bundle-fu will bundle it all into one file, rewrite relativeurls, etc.
-
step by step guide to upgrade up to rails 2
Monthly Archives: October 2007
Databind a ComboBox to an Enum and your business object
Databinding intelligently in .net is usually pretty easy. Recently I wanted to quickly bind a combobox where the items are the values of an enum made up of single words and the selected value is tied to my data object. I was surprised that it wasn’t all that straighforward. Here’s me saving you some time in the future.
What you want is an easy way to get a list of objects that you can bind the combobox to. Here is a list you can easily create from any enum that will give you a handle on the names and values of the enum.
code:
public class ComboEnumList <V> : List < keyvaluepair < string,V> >
where V: struct //at least we can constrain that it ain't a class
{
public ComboEnumList():base()
{
//because generics don't allow a constraint like "where V: enum"
if (!typeof(V).IsEnum) throw new Exception( "New Argument Not An Enum " + (typeof(V).FullName));
Array values = Enum.GetValues(typeof(V));
foreach (object value in values)
{
this.Add(new KeyValuePair
}
}
}
To use this, you’d inherit an instance of this class with type V = your enum.
code:
public class AvailableJerseyStyles : ComboEnumList
{}
public enum JerseyStyleEnum{
Stripes,
Diamonds,
Paisley,
CheckerBoard,
Houndstooth
}
Now go into the VS2k5 designer, add a new project data source based on your AvailableJerseyStylesClass. On instantiation, create the AvailableJerseyStyles object and set it as the datasource for your bindingsource. DisplayMemeber = “Key”, ValueMember = “Value”.
Bind the enum property of your business object datasource to the SelectedValue of the AvailableJerseyStylesClass and you are good to go.
Hope it helps.
War on: Grafitti
Urban artist Ellis G has been arrested for drawing art on the sidewalks.
How shameful. His art is drawing the shadows cast by objects in chalk. It’s beautiful and interesting. And it washes away. I’ve happened on his little drawings a few times, always happy to see them.
Nobody pays him, he just does it. And now he’s been arrested. What a waste.
links for 2007-10-26
-
As you type it gets web search results to inform you about related stuff on the net, related news happening around the world, Flickr photos to help you visualize, and amazon recommendations. One step closer to having agents that assist your thinking.
Offline and online
Google came out with a good idea a while ago called Google Gears. The idea is to make some of these new fangled web applications able to function when you aren’t connected to the internet.
It never seemed like that great of an idea to me, but I’ve been using a personal Wiki to track household stuff with my pardner Sam. I’ve been wishing for a wiki that I could use when I’m on the train and away from the internet.
I love the network. When you are away from it though, why couldn’t you have a better cache – a mini net that is the last known version of what you seem to care about. I’ve been using programs to download entire websites locally so I can read them while I commute. It would be nice if you could just mark them as being of special interest in your browser. Let computers hum and whir and keep it all up to date and in synch. If we can do it with email, could we do it with the web, or at least the web I’m interested in?
Some folks think that offline and online will disappear as the network penetrates every corner of the world. I doubt it. Someone’s got to pay for it. More folks are interested in drinking water than BoingBoing, but it hasn’t penetrated every corner of the world.
links for 2007-10-24
-
given:
A & B are nyc residents
A & B > 18
A & B not married or related
A & B live together
neither A or B is in another partnershipThen A & B can form a domestic partnership.
also: rights of domestic partners
links for 2007-10-23
-
Martin fowler on how to properly do inversion of control… This is a good pattern for writing software with plugins. Plugin architecture protects you from feature creep and bloat.
Making the switch to Ubuntu
Yesterday morning, the 7.10 version of Ubuntu was released. It’s supposed to be chock full of goodness, so my neighbor Lawyer Matt and I had an install party with Aaron and Ian.
I dug out an old IBM Thinkpad T20 laptop that had been lying around and we got to it. I’d tried various Linux installs before, including Ubuntu. It always got down to having to know far to much about the internals than I wanted to.
This was a huge difference. The basic install went very smooth. I hit one snag. This old laptop had a PCMCIA wifi card that wasn’t recognized. Aaron found the solution for my Linksys WPC54G on the Ubuntu forums. With that out of the way, it is working. I’m impressed by how simple and smooth the experience is so far. Of course, the experience so far is mainly checking gmail, playing a movie, and writing this post.
links for 2007-10-19
-
Curious parallels between ETF or mutual funds and the bundling of infected computers for sale to criminals.
How far does the analogy go?
links for 2007-10-18
-
Before white settlers arrived, Australia’s indigenous peoples lived in houses and villages, and used surprisingly sophisticated architecture and design methods to build their shelters, new research has found.
-
Way too much to mine here. I’ll probably just download the whole thing and read at leisure.
-
Water and grounds are mixed together for ten seconds, then gentle air pressure pushes the mix through a micro-filter in 20 seconds. The total brewing time of only 30 seconds results in exceptionally smooth flavor. Seems to get rave reviews – me likey.$25