Toot Toot! That is MY Horn. Thank You Very Much.

I was lucky enough to be interviewed by Josh Holmes of Code to Live fame about boo. I’ve been using boo more and more recently and I just love it. Check out the video!

I was a little nervous during the interview and so I caught myself misspeak. Just to clarify, I said “DLR” when I meant “DSL”. Boo doesn’t use the DLR, so please don’t be confused.

Aspie quiz like everyone else

Whoa, everyone else was doing it, so why can’t I?

I have to admit the Hunting point definitely surprised me.

 

I have to admit I learned a new word when taking the test. Actually it was the pre-test background information. Dyscalculia is a word I had to look up. I’d always told people I was slightly dyslexic with numbers. I had never heard of dyscalculia before. I realized I had it when I was 16 or 17 in a high school math class, possibly calculus, when I received the results of a test and the teacher said, “I gave your credit for this one. Everything was right. You just had numbers switched around in your final answer.”

Thank god for partial credit, I passed calculus. I’m glad I didn’t have “You build bridge. It fall down. NO PARTIAL CREDIT.” instructor.

So now I claim to have a mild case of self-diagnosed dyscalculia. Add that to my “who is he” profile.

Binsor From Embedded Resource or Any Stream

Jeremy Jerrell has a couple of great posts about Binsor over at Digital Blasphemy.

In his latest he shows how to Embed the Binsor in your assembly, but IMO his implementation is all wrong. If not all wrong, then it is a hack at best. Maybe Jeremy didn’t know that Rhino.Commons is open source.

IMNSHO Files are code smell. Should it really be the responsibility of class XYZ to open and use that file? Why not pass a stream and move the responsibility somewhere else.

Now in the case of Binsor there is good reason to accept a filename. Binsor allows you to include other files in the same directory as the Binsor file. This feature doesn’t work with my supplied solution, nor does it work with Jeremy’s, unless you manually extract each file first. IMO this defeats the purpose of embedding the Binsor config as a resource.

I couldn’t let it go, so I added a method override to BooReader.Read which accepts a stream as a parameter. Due to the nature of Binsor, you still need to name your boo module, so any string name can be passed as well.

public static void Read(IWindsorContainer container, Stream stream, string name)

The use case is very simple:

_container = new RhinoContainer();

Stream stream = Assembly.GetExecutingAssembly()
.GetManifestResourceStream(“Rhino.Commons.Test.Binsor.EmbeddedWindsor.boo”);

BooReader.Read(_container, stream, “EmbdeddedWindsor”);

Because Rhino.Commons is open source I was able to use TortoiseSVN to create a patch and mail it to Ayende. If you can’t wait, the patch will be available here for a while.

Using boo as an embedded scripting application

fallenrogue was twittering about IronRuby and Ruby.NET and I just don’t get the .NET infatuation with Ruby. IMO boo is better for most use cases, especially green field development.

Today there was an interesting conversation in #boo on using boo as an embedded scripting application. I don’t think I can summarize how to do this much better than the IRC conversation.

13:47   Avictus| Hello everyone.  Boo newb here.
13:47   Avictus| I have a question that I was hoping someone in here could
                 answer, or at least point me in the right direction.
13:48     Griep| What’s up?
13:48   Avictus| I’m planning on using Boo as an embedded scripting language in
                 a C# app that I’m developing.  I’m trying to figure out how to
                 expose methods and properties of my C# app to the Boo scripts
                 that the app will run.
13:50   Avictus| There are examples on how to compile Boo scripts from a C#
                 app, and how to call methods that are in the Boo script from
                 the C# app.  But I need to be able to call C# methods from the
                 Boo script.
13:50   Avictus| Is it possible to do this with Boo?
13:50     Griep| It is.  I am personally unfamiliar with exactly what would be
                 needed, but let me search our archives and see what I can
                 dredge up.
13:51   Avictus| Thank you very much.  I was looking over the website, but I
                 couldn’t find anything.  Your help is greatly appreciated.
13:55     Griep| So, what you’ll likely want to do is set up Boo as an
                 interpreter.  You can do this in C# by creating a new
                 interpreter: “InteractiveInterpreter interpreter = new
                 Boo.Lang.Interpreter.InteractiveInterpreter()”
13:55     Griep| Then, you can use “interpreter.Eval(scriptString);”
13:56     Griep| You can use interpreter.load(
13:56     Griep| to load in external references, such as to a library.
13:58     Griep| The main library you’ll probably want to look into is
                 Boo.Lang.Interpreter.
13:59   Avictus| So, if I had a method named myObject.GetSomeData() in my C#
                 app, I could call that from within a Boo script using
                 Boo.Lang.Interpreter?
14:02     Griep| Yes.  You can add references to the interpreter just as you
                 would for a compiler.  So, your could do something like:
14:02     Griep| interpreter.References.Add(System.Reflection.Assembly.GetExecutingAssembly());
14:03     Griep| If myObject is an instance, you would likely need to set that
                 variable for the interpreter to be able to access it as such:
14:04     Griep|
14:04     Griep| interpreter.Declare(“myObject”, typeof(MyObject));
14:04     Griep| interpreter.SetValue(“myObject”, myObject);
14:05   Avictus| Thank you, that looks like exactly what I need.  I appreciate
                 the help.
14:06     Griep| You’re welcome!  Happy hunting.

Brain fart with Apt

I just ran what could be one of the dumbest command lines that I’ve run in years in Linux.

sudo apt-get install pidgin & sudo apt-get remove gaim

 

No really, I want to install pidgin and remove gaim in parallel!

Any apt user will tell you where I went wrong. Apt locks the dpkg database. Only one operation at a time please.

E: Could not get lock /var/lib/dpkg/lock – open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

 

DUH!

I’m amazed that I even tried this. I blame Saturday morning foggy mind. I’ve only had 2/3 of a cup of coffee so far.

Reminder to self: don’t program or do important stuff with foggy mind. Tools nice enough to save you from yourself like dpkg are OK.

Blog Code Snippets License Examples

Here is an example of a piece of code posted to a blog which doesn’t explicitly have a license attached. It is a pretty cool example and something that would be nice to use in a basic winforms project.

Now that piece of code doesn’t have a license, but the blog itself does have a Disclaimer in the menu saying “Postings are provided ‘as is’ with no warranties and confer no rights.” with a link to http://www.microsoft.com/mscorp/legal/policy/online_disclaimer.asp 

This is definitely better than nothing.

Even better I think is this post by Jon Gallant on TypeConverter. At the end of the post he explicitly says:

Use of included code sample is subject to the terms specified at http://www.microsoft.com/info/cpyright.htm

This posting is provided “AS IS” with no warranties, and confers no rights.

In other words, you have no rights to what you just saw. You cannot copy and paste into your code. You cannot pass Go or collect $200.

Thankfully Marcos of filehelpers fame corrected me on what I previously wrote about CodeProject. Code at CodeProject explicitly gives others developers permission to use the sourcecode. There isn’t an explicit license attached, but I’d say it is closest to BSD. It just says “keep the original copyright notices”.

The bad example is http://en.csharp-online.net/Design-Time_Integration%E2%80%94Type_Converters. I found this URL when I googled for TypeConverter.

I poked around csharp-online.net and I couldn’t find a license or copyright notice for the site.

Remember to check the copyright on that class that you copy from some guys website.

Goodbye Window Clippings, Hello Greenshot

Kenny Kerr’s Window Clippings is a great tool. It recently tripped me up when I tried to take a screenshot of a window with no title. It just didn’t seem to work.

Enter: Greenshot. Open source sweet open source, Greenshot is written in C# and is actively developed. I’m not sure why they still use CVS on SourceForge, but I’m ok with it. https://sourceforge.net/projects/greenshot/

ViewVC the source:  http://greenshot.cvs.sourceforge.net/greenshot/GreenShot/Forms/

My first experience with it was excellent. I highly recommend this tool.

A Line In The Sand Has Always Existed

Colin Ramsay says to Abandon ALT.NET!

A lot of people in the ALT.NET camp may not feel that they’re being divisive but I can tell you that by propagating this idea you’re creating a line in the sand, with the highly-knowledgable on one side and the masses on the other. You’re not encouraging dissemination of your information, you’re just creating another impenetrable gang of developers that is almost opaque to the guy on the ground.

I’m half laughing because of the absurdity of it. I’m half crying because so many people just don’t get it.

The line in the sand that Colin suggests is newly created has always existed. It is approximately the same line between those who “get it” and those who don’t. Every programmer knows within a short period of time of meeting another programmer if they would like to work with that person. These are the guys who “get it”. When you know you don’t want to work with another programmer, they can fall into the “don’t get it” category. But this is certainly not absolute. I don’t mean to say those that don’t get ALT.NET are people I would not want to work with. On the contrary I’ve been reading Colin’s blog for a while, and I think I’d definitely enjoy working with him.

I think anther example about this line already existing can be seen in the 7+ year old essay by Joel Spolsky, “The Guerrilla Guide to Interviewing“. In it, Joel separates programmers into two camps those you would hire and those you would not hire. These no hires, according to Joel, are anyone who is not smart and who doesn’t get things done.

In my opinion, anyone who is both smart and gets things done will automatically grok the ALT.NET tenets. These tenets, which definitely vary from individual to individual, includes many agile principles such as DRY and DRT. Doing the right thing is important. Most of what is going on in ALT.NET is a response to inability to DRT using existing tools. Its programmers doing what they do best: being lazy. Lazy in that they are making things better for themselves by making it easy to do the right thing.

The problem is that these unknowledgeable masses (myself included) whom Colin defends are, by definition of the lack of knowledge, unable to to create these tools and make things better for themselves. I’d like to think that some of us can grok this ALT.NET thing. But I know that some of us trying to grok it, aren’t currently capable of joining the party as a tool maker.

I’m not currently a tool maker because I can’t take things like Windsor and look at EntLib’s Policy Injection Block and even know where to begin to build something similar. Others can not just know what to do, but actually do it in less than an hour.

The nice thing about ALT.NET is that I shouldn’t have to be able to be a tool maker. I should be able to to just use the tools of others. I should be able to stand on the shoulders of these giants. I should… except that I’m currently on a contract in which ONLY naked CLR is allowed. No EntLib on which to build. No Spring.NET or Windsor to help me with decoupling for testing. No NUnit or MbUnit to help me test. At least I have MSTest. The SCARY thing is that these are some of the things which define Colin’s line. I’m sure I’m not alone in my peril. Consider this a heartfelt giant hug to all those who are forced to develop in such a vacuum.

As for Colin’s line? I think I’ll stand with one foot on one side and another foot on the other side and I’ll straddle it until it ceases to exist.

MS-RL Considered Harmful

Oren and Frans know what is up. Its nice to see other thoughts and reasons for the same things I am worried about. Others suggest not worrying so much.

While I don’t think things are as bad as the comic on Phil’s page suggests, I am on the side of not looking into Medusa’s face. I need The Powerpuff Girls to come and save me from Sedusa. Frans has a suggestion that could save me! It basically references the Java Research License’s Residual Rights clause which says that one cannot be tainted.

I still don’t see the big deal. I keep links to Mono’s System.Windows.Forms implementation and the rest of Mono’s .NET library implementation on hand as references. For one, there are no (or very few) P/Invokes! This makes implementing something myself far easier than much of Microsoft’s System.Windows.Forms implementation. At least easier than the small bits I’ve seen in Reflector.

As for bugs, well, since you can’t actually DO anything about the underlying Microsoft bug implementation, I’m not sure what the big deal is. Heck, Microsoft doesn’t so anything about serious bugs. Workarounds are great, but sometimes bugs can bite you in the ass and cause production downtime. When its known and unfixed bugs that do this, I get angry and wonder why I’m not running on open source to begin with.

Boo at MichiPug

I presented Boo at Michipug last night. That is the Michigan Python Users Group. Boo was interesting to present there because, well, boo is not python. Yes, boo has some language features similar to python, but for a python programmer I think boo is different enough that there is still a steep learning curve. Plus the absence of all of the python standard library in favor of the .NET libraries makes for an very different programming experience.

I don’t know boo deep enough to be able to focus on its extensibility, and I don’t think that those features would be well received by a group of pythonistas. I focused on the basics and instead we talked about python and .net differences and what they meant when you are writing boo.

Assuming the date and time are translated from Israel to EDT, then right around the time I was finishing my boo presentation, Oren wrote a blog post on boo.

… I keep getting more and more and more amazed by the power that Boo is giving me.

In order to fix some of those bugs, I had to literally change the meaning of the if statement. (I defined my own nullable propagator, which I had to implement deeply into the language).

Damn, I love this language.

Oh, and FYI, if 2+2 == 4 will not do the expected thing anymore 🙂 

I’m not there yet with boo, but I will be… I will be.

 

I did enjoy pointing out IQuackFu and how easy it is to have method missing. I have a deep love hate relationship with method missing. On one hand, if you are relying on method missing, then you are probably doing something wrong. On the other hand, it sure is nice to have it if you need it. Who needs IronRuby or IronPython? I’d much rather write boo. That said I think those Iron projects are really sweet and I hope they succeed greatly. I long for the day that I can run a TurboGears app on IIS/ASP.NET or Apache/Mono.