The World Where Nothing Works

I work in the World of Windows.

Software development, technical support, system administration – you name it. If it breathes Microsoft, I’ve given it CPR at some point. It’s a world where things are.. heavy.

And nothing works.

I’m a little jaded, nowadays. Part of it comes from the excitement I feel about my upcoming journey into the programming language called Python, and part of it comes from my analogy-generating brain which keeps comparing the work of publishing on this blog to the work of developing and deploying software using technologies such as:

  • C#, with Visual Studio, ASP.NET
  • Crystal Reports
  • BizTalk

You see – if I get one more “Unrecoverable build error” message after trying for the umpteenth time to build my Crystal Reports project that was building fine a few minutes ago, or if I get one more cascading series of breakages with the most unhelpful “symptoms” ever in a BizTalk Orchestration, well then I’m just gonna.. reboot. For good.
Continue reading “The World Where Nothing Works”

Slithering Through Python

Today I am pleased to add a new category to my blog – “Programming”.

I am a programmer. Naturally, I should occasionally write about programming. But there is something which I always found off-putting about doing that. I think, partly, that I have not had anything interesting to say. And partly, I didn’t like the idea of tediously collecting some relevant source code and then writing about it. After all, others who are better than I am have already covered every interesting topic in programming.

But this blog is different, as it was created for the self-serving purpose of helping me to work through and understand new ideas. Hence the name: Working Sandbox.

The idea is that the content, design, or whatever, of this blog could break at any time. And I would still march on with the publishing, ignoring the lapse in quality. (Of course, as a practical matter, I’m not really going to let a lot of things break in any significant way – but knowing that I can is quite empowering.

There was a bug in the previous paragraph. Can you spot it?

So, I recently decided to take up the programming language Python, for the following reasons:

  • It is cross-platform.
  • Everybody I trust seems to think it is a great language.
  • It is “mainstream” enough at this point that it is easy enough to get started without a lengthy research or tool-finding phase.
  • Dropbox was written in Python, and it works pretty darned good!
  • Dynamic Languages Strike Back has been nagging at me, ever since I read it nearly two years ago.

Beyond that, I discovered while writing my first “sandbox” program that the following brief code will pull in all the nodes from an XML file and load them into a Python data structure, ready for use:

from xml.etree.ElementTree import parse
nodes = parse('data.xml')
data = []
for node in nodes.findall('x/path/to/data/nodes'):
# "data" is now a list containing the specified nodes from the XML file

Now, my guess is that there is a way to add all the node text to the list without using a for loop. Maybe not. In any event, this short bit strikes me as being simple, short, easily retrievable from memory, etc., etc..

Please note: I have not tested the exact code above – it was hand-typed with a few modifications from an existing Python program I am working on. May have made a typo, or two?

Finally, I realize that if I am going to start posting bits of source code, then I will need to do a better job than what I did here, which was to just wrap the code in the HTML “pre” tag. Any tips on a WordPress plugin that helps with this?

Ten Things I Learned About Python This Week

  1. The introductory book – Learning Python, by Mark Lutz – is over 1000 pages!
  2. I picked up enough to “get going” after reading less than 15% of the book. 🙂
  3. It’s more than just “that language where whitespace is significant”.
  4. Typing “dir(s)” and then “help(s)” (where “s” is a string) is WAY better than Intellisense or F1 in Visual Studio.
  5. It’s easy to compile Python code to a Windows executable.
  6. There’s something very freeing about being able to use either single or double quotes.
  7. I don’t think I’m going to use shelving, I don’t yet comprehend comprehensions, and it seems like interfaces are called protocols.
  8. Tuple?
  9. I’m really diggin’ this interactive language environment.
  10. I can already see how things like array manipulation and file reading could be done in WAY less code than C#, and I’m guessing that usually turns out to be a good thing?