I found this funny. Can it report its own errors?
Category: Tech
Technology and Computers are my primary interests. It is also how I
earn dollars for spending on food and housing.
C# is already whitespace significant
error CS1040: Preprocessor directives must appear as the first non-whitespace character on a line
Of course you would put an #if or #pragma on its own line, but what if you didn’t?
#pragma warning disable/restore makes sense to be on the same line as the warning generating code. But in this case the C# language is white space significant. Why not extend this to other areas of the language?
Using xmllint because xml still sucks
I already mentioned how to get human readable xml from the non-human readable.
Today I had a human readable xml file, but it had many branches, some deep, with lots of information in it. I wanted to know only the names of the nodes which are direct children of the root node.
e.g.
<someRootElement><firstChildOfRoot><someOtherBS><couldBeMoreBS>… </…> …</…></firstchildOfRoot><secondChildOfRoot>…insert tons of crap here</secondChildOfRoot><nextchild…
I could have done this by paging the file, but this would not have scaled. It was just long enough that I didn’t want to do this.
xmllint rescued me again. I started in shell mode
$ xmllint –shell mystupid/xmlfile/thatIhate.xmlhated
Then I am greeted with an xmllint prompt with which I can navigate my xml document much like I do a filesystem with command like ls and cd.
/ > ls
— 21 someRootElement
/ > cd someRootElement
someRootElement > ls
ta – 3
— 21 firstchildOfRoot
ta – 3
— 21 secondChildOfRoot
Pretty cool eh?
<3 Tools.
The Fastest Readable Xml
I hate xml.
I really hate it. No humans should have to read it.
As a developer, if I have to even think about Xml, then it is because some developer before me made the wrong choice.*
That said, sometimes a developer full of contempt toward Xml does need to read xml.
Both feedburner and WordPress output mostly well spaces xml, but what if I look at rss from blogs.msdn.com? It looks like the webserver is running a whitespace filter. This is not human readable Xml. Now, I COULD copy and paste into Visual Studio, but then I have to open a new xml document, or save what I’m viewing in the browser and open in Visual Studio. All too many steps.
Cygwin comes with an optional program called xmllint. It is part of the libxml2 package, so be sure to select libxml2 when you run cygwin setup.exe.
$ curl http://blogs.msdn.com/giorgio/rss.xml | xmllint –format – | less
This reformats the xml into a nice 2-space indented by tag display.
* This may be a bit extreme, but I will stand by it most of the time.
History Blog Meme
Please Put Uninstall Links In The Start Menu
start -> control panel (wait 8 seconds) -> visual scan what I want to click on for ~ 15seconds and find “uninstall a program” -> wait ~13 seconds for the Programs list to complete loading. Use the search (hurray) functionality of vista to find the program I want to uninstall. Highlight and click uninstall.
This is a too common task for me to do. It takes long enough that I avoid doing it. It should be something I can just do and accomplish without thinking about it.
I admit I don’t have the fastest computer in the world. A Dell Latitude D820 with 2.5G of ram running Vista Business edition. I don’t have a lot of crap installed, but I do have tons of tiny files in the form of source code, mostly from open source projects, littering my hard drive filling up my MFT. I think the fragmented MFT causes a lot of my slowness.
Regardless, the remove program process would be far faster and a better experience for me if I could simply browse start->programs-> <insert program here> -> uninstall.
*this post was inspired by Jeff Atwood.
Cmd.Exe and Which
I love bash.
I hate cmd.exe. This is mostly due to unfamiliarity, but I don’t care, I hate regardless.
Enter, me configuring cc.net and msbuild complaining about a version 10, Visual Studio 2008, sln file. This is because the msbuild that cc.net knows about is the 2005 msbuild. So I fire up a 2008 Command Prompt run msbuild, and everything runs fine.
Now it seems like the “Microsoft way” would be for me to examining the path manually, go trouncing through the directories in this path, looking for msbuild. WTF??? I don’t work that way.
In Linux, there is a command called which, which will tell you which command you are executing if you type it at the prompt. All it does is search your path, in order, to tell you which command would run if you actually type a command. The exception is shell built-ins, but lets ignore that.
[jrwren@utonium:$] which ls
/bin/ls
It turns out this is TRIVIAL to write as a batch file. cmd.exe has the goods for you. I’m writing this here because MS keeps changing urls on me and my del.icio.us links don’t work anymore.
Maybe this link won’t change.
which.bat:
echo %~$PATH:1
Pretty slick eh?
IMNSHO this should be in every windows directory on every windows computer everywhere 🙂 Its 2008. I’ve been living with which in linux/unix since I started using it in 1995. Please step into 13 years ago by copying this batch file to all of your windows computers.
Bane
Definitions of bane on the Web:
- something causes misery or death; “the bane of my life”
wordnet.princeton.edu/perl/webwn - The meaning of bane as an English form of , the bringer of ruin, dates only from 1577. Now an affliction, curse, evil, ill, plague, scourge or woe, in Old English bana had a more specific and immediate meaning, of “slayer”, “murderer.”
en.wikipedia.org/wiki/Bane - Bane (also known as the Black Hand and the Black Lord), is the god of hatred, fear, and tyranny and one of the main evil gods in the fictional Dungeons & Dragons campaign setting, Forgotten Realms. …
en.wikipedia.org/wiki/Bane (god) - Bane, a hardcore punk band, began as a side project between Aaron Dalbec (then of Converge) and Damon Bellardo. Dalbec approached Aaron Bedard (who had previously sang for the Worcester, Massachusetts hardcore band Backbone) about singing for Bane. …
en.wikipedia.org/wiki/Bane (band) - Bane is the DC Comics supervillain, and sometimes ally, best known for having broken Batman’s back. Bane first appeared in Batman: Vengeance of Bane #1 (1993). …
en.wikipedia.org/wiki/Bane (comics) - “Bane” is an episode from Season 2 of the science fiction television series Stargate SG-1.
en.wikipedia.org/wiki/Bane (Stargate SG-1) - Bane is the 10th episode of Season 2 of ””. It first premiered on September 10, 1994. This is the first and last time Bane appeared as an episodes main villain. Bane appeared in Batman & Robin the movie several years later.
en.wikipedia.org/wiki/Bane (The Adventures of Batman & Robin) - An archaic word for bad, evil, destructive.
www.geocities.com/sorchagriannon/terminology.htm - That which destroys life, which is poisonous, destructive, evil, dangerous.
uss.za.org/school/mod/glossary/view.php - [Scottish] pale or white, usually of hair
freepages.genealogy.rootsweb.com/~randyj2222/gendictb.html - 1. Death, destruction. 2. A poison. 3. (Scot.) bone.
www.traditionalmusic.co.uk/traditional-music/ency/b1.htm - Used to denote destructive qualities, or to kill; used often in the folk names of herbs; for example wolfsbane, henbane.
www.mysticcauldron.com/dictionary.html - A centaur who lives in the Forbidden Forest.
www.madebyghost.co.uk/hpencyclopaedia/characters.html
Ann Arbor Computer Society Meeting On February 6th, 2008
I just got off the email with Joe O’Brien 🙂 I’m really excited for this one.
On Wednesday, February 6th 2008, Joe O’Brien of EdgeCase will be speaking at the Ann Arbor Computer Society about Domain Specific Languages: Molding Ruby.
Ever wondered what all the fuss is about when it comes to DSL’s and Ruby? It seems to be all we hear about. This talk will peel away the onion and look at what it is about Ruby that makes it the perfect candidate for creating your own languages. I will show you, through examples, how you can create your own languages without the need for compilers and parsers. We will also cover some real world examples in areas of Banking and Medicine where DSL’s have been applied.
From EdgeCase:
Joe is a father, speaker, author and developer. Before helping found EdgeCase, LLC, Joe was a developer with ThoughtWorks and spent much of his time working with large J2EE and .NET systems for Fortune 500 companies. He has spent his career as a developer, project manager, and everything in between. Joe is a passionate member of the open source community. He co-founded the Columbus Ruby Brigade and helped organize the Chicago Area Ruby Users Group. His passions are Agile Development in the Enterprise, Ruby, and demonstrating to the Fortune 500 the elegance and power of this incredible language. Joe is currently working on a book for the Pragmatic Programmers on building DSL’s with Ruby.
If you haven’t seen Joe speak, I promise you he is awesome. I’m always left scratching my head wondering why I don’t write Ruby.
The Ann Arbor Computer Society meets at SRT Solutions offices at 206 S. 5th Avenue, Ann Arbor, Michigan at 6pm the first Wednesday of every month.
Sara Ford’s Parents Were Cheap, and So Were My Sisters!
Meeting Sara Ford at CodeMash was fun. I don’t know very many Microsoft Employees and I know even fewer who actually work in Redmond.
Sara was so down to earth and fun to hang out with that I am left with an even better opinion of Microsoft’ies post-codemash.
Sara was joking that her parents were too cheap to pay for the h in her name. I love this. I wish I had thought of it so I could have made fun of my sister while we were growing up. My sister is Sara without an h too!
Sara does a great job of introducing herself in the CodeMash podcast with Chris Woodruff. I was very happy to get to talk with her, Steven Harman, Joe Brinkman, Kevin Devine and Michael Kimsal of webdevradio. Our conversation was totally unprepared. I think the idea was to have an open spaces discussion and when only a few people showed up, Michael started recording.
At times the conversation reminded me of the DotNetRocks open source panel episode, but as a 12+ year member, user and contributor to open source projects, I felt like some major points were missed on the DotNetRocks episode. Since I was part of the conversation I was able to represent these points.
Thanks for waving me over Steven. Thanks for putting the mic in my face Michael.
If this sounds interesting, give it a listen.