What exactly, ‘is’ my development environment?

I reckon this is something rather confusing these days, in most cases among younger folks, it will likely mean an Integrated Development Environment. To me, it just means the environment in which one develops stuff ;).

Being a lower level polyglot in terms of languages and tools, I generally keep a ‘pallet’ associated with each of my main languages, keeping things quite simple to work with:

  • Build Tools:
    • Some viable form of Make is required, generally I’ll use local brew if an extension is needed. I prefer GNU Make over BSD PMake, as I find it more reliably cross-platofrom.
    • CMake, while often little more than a poorly strung together bother, many projects now use CMake based build systems. It is actually a good tool but I don’t favour it for use outside of a single OS family.
    • SCons: powerful and effective, but often irksome to get a portable build. It’s usually worth having available.
    • Ant: you never know when you’re gonna need it.
    • Local brew of IDE and their background stuff, for example Visiual Studio for the vcbuild/msbuild modules and/or Code::Blocks. If I had a Mac, I’d likely have XCode handy.
  • Documentation Tools
    • Unix: troff/nroff and the usual macro packages. I actually like it.
    • DocBook and XML/XSLT processing utilities. LibXSLT comes in handy.
    • ReSTructured text and company
    • Any local language related tools (e.g. for Java, Perl, Python, and C#)
    • Doxygen: a multi-lingual documentation generator.
    • Exuberant CTags: improved and vastly multi-lingual upgrade over ctags.
    • TeX and LaTeX setups. I like TeXLive.
  • Source Code Management / Version Control Systems
    • Git — must have!
    • Anything I need to be handy with:
      • CVS
      • Subversion/SVN
      • Bazaar/BZR
      • Mercurial/HG
  • C/C++
    • I generally setup and maintain several compilers, multiple versions being welcomed. Generally I try to hang onto a member of the GCC 3 and 4 branches, and a fairly recent version of Microsoft Visual C++. Under unix-like and Windows systems respectively, I also tend to carry about a copy of PCC and Watcom.
  • Java
    • A suitable JDK, or a complete software development kit where appropriate.
    • The GNU Compiler for Java can be useful.
  • C#
    • Mono and preferably the full stack of technology.
    • Under Windows: several versions of the .NET framework and at least a workable version of Microsoft Visual C#.
  • Python
    • A copy of CPython, preferably both modern versions of 2.x and 3.x releases.
    • The usual parts of CPython that some distrios strip out, like SQLite3 or Tk bindings.
    • Another implementation for testing (e.g. IronPython) is appreciable.
  • Perl
    • A standard perl distribution, preferably the current major version or the one before it.
    • Common perl modules one is actually likely to use someday.
  • Lisp
    • CLISP for general use, i.e. common lisp
    • Armed Bear Common Lisp (ABCL) in case it eases deployment issues
    • GNU Guile: my normal way to use scheme.
    • Bigloo: a scheme compiler that’s worth poking around
    • Some other readily available Scheme implementation available, preferably one that is at least moderately R5RS compliant
  • PHP
    • Fairly recent version of PHP setup with
      • Command line interp.
      • Suitable Apache modules
      • The CGI/FastCGI friendly thingy
  • Ruby
    • Current local-main line version.
    • Rake build tool.
    • A collection of handy modules
  • UNIX shell scripting
    • Something fairly portable, ash/dash based is nice.
    • GNU BASH.
    • Real and public domain versions of the Korn Shell.
    • ZSH, my favourite.
  • Go
    • Standard distribution compiled from source.
GUI and Console versions of Vi IMproved being a very obvious requirement ;). I also tend to keep versions of Emacs, some flavour of MicroEMACS, and SciTE available in a pinch.  I like having ed available.
Generally some form of webserver, be it a quick tester (ala Python) or dedicated (I like nginx and Apache), is usually required: plus a decent web browser with javascript support.
Profiling, code generation, analysis, and debugging tools are almost universally welcome. I in particular like to keep Valgrind and GDB handy for a rainy day.
Like wise I prefer having certain libraries fully integrated into that stack, i.e. where appropriate having interfaces the common GNU/Gnome libraries (GTK+/cie), Qt3 and Qt4 libraries, bindings for SQLite3 and a major player (MySQL, MSSQL, etc), OpenGL, and so on and so forth. I tend to leverage both languages and tools whenever possible.
Someday I’ll likely incorporate Lua, and dialects of Forth and ML into the mixture. Like wise I prefer a reasonably NAWK friendly version of AWK to be available. I also have interests in picking up Prolog, Haskell, Erlang, Ada, and a few lesser known languages, but just don’t have the time to screw with such things a lot these days :'(. 
Simply put, where I go, a whole freaking lot of development tools go with me!

Lately in my spare time, as one might guess: I’ve been picking up C#. That, and reading about electrical wiring and stuff, but I always new I’d light myself up one day xD.

Before bed, I was experimenting with building and structuring assemblies. Being my typical self, this of course means playing with the command line csc (MS) and mcs/gmcs (Mono) compilers, as well as their associated tools. IDE wise, I experimented with MonoDevelop under FreeBSD and the express edition of Visual C# 2010 under XP.  I must admit that as far as IDEs go, MonoDevelop is a pretty good one: the only negative things that I can say about it, being the vi mode is very minimalist (G doesn’t even take a count), and it’s not the most responsive program when the computers under heavy load: but still knocks Mozillas socks off by 9 warp factors :-P. Visual C# on the other hand, I can’t say how the 2010 version differs from the 2008 one: only that it’s not nice. To be honest, my first encounters with the express editions for Visual Studio 2010, shows me that Microshaft seems to have a policy of (yet again) hiding much of the tools from the user. Just starting Visual C# makes me remember how long Windows has hidden file permissions from the user by default. Perhaps most Windows users are to damn stupid to understand the concept of “Privacy”, but any jackinape permitted to touch source code, should at least be made to understand the concept of debug and release builds (a heck of a lot better then VS’s new defaults).

In my experiments using MonoDevelop and Visual C#, it only took a few seconds before I became glad that Vi IMproved doesn’t emulate Intellisense; but it is fair to say that I’m a freak: my customised vim setup even disables syntax highlighting lololol.

And considering how much this build of Firefox has Flash burning through CPU cycles, I think my laptop is going to heat, if I don’t call this a morning :-S.

My dumbest python moment ever….

In cleaning up tmk’s cache related code for a fresh commit, I wrote an expand2str() method that encapsulates the issue of dealing with expand() returning a list of expansions, and a properly converted string being desired anyway.

Suddenly I noticed this backtrace:


Traceback (most recent call last):
  File "tmk.py", line 929, in
    process_recipe(recipe)
  File "tmk.py", line 742, in process_recipe
    recipe.parse()
  File "tmk.py", line 276, in parse
    if not self.eval_pproc_directive(p):
AttributeError: Recipe instance has no attribute 'eval_pproc_directive'

Which is totally ridiculous, because eval_pproc_directive and parse are both methods of the same class. While the former is defined after the latter, by the time the instance (self) exists, the class is fully defined. Making a short test case, proved that the act of one in a billion hadn’t changed Pythons rules about this stuff.

In poking around to see what changed introduced during this commit, may have popped the magic cork, I noticed removing the reference caused the same type of error, successively on methods defined after they were invoked.

Then I saw it!

I had accidentally indented the expand2str() method one short, there by making it a function rather then a class method, and there by doing like wise and making them nested methods inside expand2str().

Sometimes Python really irks the typoist in me!

Today at work, I was thinking over my next agenda with tmk, namely implementing the checksum based method of checking whether or not targets are up to date, and recipe caching.

Implementing the checksums are actually pretty easy, the hardest part is just adding a command line option and a method for changing the checksum algorithm to be used.

Doing the cache on the other hand, is a bit more ‘thought’ required in the solving. Because tmk currently does variable expansions on rules, it’s impossible to correctly cache for any rule or variable assignment involving an environment variable. The principal reason for the variable expansions, was so to help ensure the uniqueness of a rule. So obviously, the proper thing to do is to delay the variable expansions until they are needed, there by making the data store completely cacheable.

The obstacle of course, is that rule definitions can no longer have the chance to be a way in which the rules become unique, which rules out the possibility that variable assignments can occur after the top level: which encourages me to push the spec in the direction I had originally planned. Another option, would be to just leave it as is, and note the issue around environment variables in the manual. Of course, a third possible solution is making the processing step more aware of line numbers.

Since I’d rather have it that way, I’m opting for the first: delaying the variable expansions so that the entire result of the parsing phase can be cached.

I also feel like a chicken with it’s head cut off atm :-S

+1 for design

I’ve just fixed the bug about tmk reporting the wrong filename when an included file contains an error. The thing that makes me smile, is because I designed the recipe parsing and processing code reasonably well, making that work correctly was trivial. At worst, I expected that I would have to modify the Recipe class to incorporate a separate data stack into the parser, but not even that was necessary. Most changes were (as hoped) just refining the data structures used for storage.

tmk is pretty simple, it does two passes at a recipe:

  • First it parses the recipe into an internal data store, most serious (e.g. syntax) errors are reported here. A minimal level of evaluation is done, namely we need to do some expansions or you can’t use variable substitutions when defining a rule.
  • Secondly, it walks through the data store at processing time (e.g. doing the magic), conducts final expansions when needed, and carries out its mission in life.
One reason I chose the syntactic style that I did for tmk, it is both visually straight forward, and easy to code around. I like simple but effective, when it works.
My next (and real) task, will likely be making the rules relational to one another, exempli gratia to topologically enqueue rules in dependency order. Right still tmk is limited to sequentially executing the rules. That’s actually good *enough*, but I’d rather have that tidbit taken care of by tmk, then having to address it in the recipe construction.

I must admit however, that adapting isnewer() by way of it’s cmpfunc parameter, to cope with using file checksums instead of modification times, will be fun to implement :-D.

I’m going to be dead tired before noon even approaches,  but I’m smiling now! The focus of my day, has been on getting tmk up to snuff enough that I can use it as a general purpose solution to my problem: cursing at the present ‘generation’ of such tools.

I worked on getting a base set of magic bound variables and teaching tmk that certain rules may be skipped, if a set of pre-conditions hold about the files involved. Getting that done was easy enough. The checking code is now more robust, properly handling an arbitrary set of input/output names, in as much is humanly possible ;). I’m smiling, because I spent most of the night being annoyed every which ways up, on top of an already splitting head. Ended up having to quit coding for a bit, and just hit RvS for a couple hours.

About two hours sleep, and still plenty of hours until sunrise, I woke up and got back to the codin’ and now it’s done!

So far, tmk is put together in a rather short amount of time, even if it’s been on my dancing list for a few months; finally it’s almost beta quality. Only show stopper that’s come up in testing, is it fails to handle unexisting tmk variables correctly, but that’s a one LOC fix. An outsanding issue, is that tmk variables with whitespace in them are improperly expanded, e.g. $(foo bar) expands to bar) even when a variable named ‘foo bar’ exists. That however is because of how the tokenization feeds the parsed data into the variable expansion system. Although for the sake of simplicity, I planned long ago to make the specs dictate such variable names as invalid whether or not tmk actually accepts them, so it’s a lesser issue. The include processor directive, also reports the wrong (e.g. parent) filename but correct line number (e.g. from the included file), yet that bug can be fixed in a few minutes; so I haven’t bothered yet.

Two features that remain to be done, is making rules relational (by dependency) rather then executing them in sequence, and to giving tmk the option of using checksums rather then modification times for minimising rebuilds.Which also comes into part of the leg work, for implementing a cache, hehe

Most of what needs doing, is some light polish and adding more builtin directives. Been thinking about making tmk understand a simple plugin system, that would allow it to load reasonably trusted bits of python code into part of the program, thus allowing new directives to be added at will, as well as replaced. I’ll worry about that later though.

A bit of fun with tmk

Yesterday I setup tmk to understand how to include files, by using a simple pre processing directive, making the syntax for tmk fairly simple:

variable = value

rule lhs -> rule rhs:
        command directive! word arguments

Where variable expansions and file name globbing is widely used as part of the design, while keeping the recipe parsing code fairly trivial. I designed it this way, both to be familiar with Make (although lhs/rhs are reversed), fairly obvious at a glance, and to be easy to implement. Now tmk also understands the concept of a (pre) processing directive. Since directive! is used within rules, the processing directives use the inverse, i.e. !directive. I believe that makes a better distinction then using a different symbol, especially since you can not use a command directive everywhere a processing directive is permitted. Right now there is only one directive, !include which slurps up it’s argument list as the name of a recipe file to include within the current, before continuing of course. Some form of conditional will probably be added later on; even though the rule syntax gives a way to define certain looping behaviour.

Today’s goal is to basically implement the concept of if the outputs (lhs) are more up to date then the inputs (rhs), the rule can be skipped. I don’t expect that to take to long, since most of it is just screwing with the rule expansions in order to properly stat the files. If I can get it done expeditiously, I’ll also have time to setup a few late binding `special` variables that will be useful, in proper Make fashion lol.

At which point, tmk will be effectively as good as a generic make implementation; and I can work on the parts that need to follow on. Namely the parallel support and portability aspects. The latter of course, being the main reason why CMake, SCons, and most every other such tool I’ve tried, has been rejected as more trouble then it’s worth.

An idiosyncrasy no one else gets

Whenever someone asks me how I am, I often phrase ‘and how are you?’ as ‘&you ?’, which is something usually lost on everyone. In the C programming language, the ampersand is used as an address-of operator used to create a reference of sorts, and is integer to utilising pointers. So litterally ‘address-of you ?’ makes a very explicitly reference while remaining a syntactically correct substitution of ‘&’ for ‘and’, in English anyway.

If anyone finds that odd, just try not to think about how Lisp and Perl have impacted my brain over the years lol.

Visual C++ 2010 Express, new levels of weirdness…

As usual there is a redist.txt file in the Visual Studio root, that explains about what Microsoft supplied files you’re allowed to redistribute with your applications. In MSVC9.0, the express edition only came with release and (non re-distributable) debug assemblies of the C, C++, and  managed code runtime libraries.

In looking at the files installed by the latest and strangest version yet, I see that there is no vcredist folder… instead there is a vccrt folder, that contains a mungle of C and C++ that appears to be source code for some type of MS C/C++ runtime libraries :-/.

+1 simple relationals

On my way to the head, I was thinking about ways to improve the robustness of a program  that I’ve been tinkering with on the side. Simply put it defines an ordered set of roughly hierarchical data, that is integral to processing later based on certain groupings of it. The set is such a collection of information, that recalling it later would best be done through an associative container, where in the keys may be any unique attribute of the data set being processed, rather then having to be any given accessor.

The obvious solution to bundling the data, is to create an abstract record representing the keys that need querying, e.g. each objects attributes are expected to correspond to an unique instance formed by the data set. In thinking about how such a thing might be implemented without losing the speed of a hashed table look up; the first thought to come to mind, of course was the most simple and straight forward idea. If the implementation language was C, it would be trivial to throw together a set of structures for representing items in the data set, and wrap them in an opaque record that binds together a group of hash tables or balancing BSTs for each key type we want, which would then look up a pointer to the individual records, through a structure tuned for minimal memory usage. Second to come to mind, was a rather interesting tree structure to minimise cost for retrieving any given node. In which of course I remembered that this particular implementation case dealt with a certain language that traded such memory conciousness for a garbage collector.

On my way back to my work station, I thunk to myself, “Well hell, I just defined a relational data structure!”, and with the idea of running an SQLite database in process memory now floating through my mind, sure enough the API that I had envisioned, was little more then a relational algebra tuned to the problem domain being worked in.

The implementation language might lack an equivalent to Cs memory management, and gives no guarantee that the amount of copying and GC work involved wouldn’t grow exponentially with the data set size… but it does have a binding to the SQLite database, which is fairly handy, hehehe. So the obvious question is which way handles things more efficiently: relying on the language implementation to avoid unnecessary copying of memory, or going through the overhead of a lite weight SQL database.

Sometimes I love how these kind of things are so simple to work out in the course of short trip down the hall, lol.