All posts by Jim Geurts

Why bird poop is white

In an effort to broaden my post categories….

I was talking with a very wise friend of mine a while ago and we got on
the subject of why bird poop is white.  He started off describing
that humans have one of the most inefficient bodily waste
systems.  We have seperate functions for excreting liquid and
solid waste… As a result, our kidneys excrete nitrogenous wastes as urea which ends up getting dissolved in urine… 

On the other hand birds are unable to urinate so their kidneys excrete
nitrogenous wastes in the form of uric acid.  Uric acid has a low
solubility with water, so it comes out as a white paste.  Combine
that white paste with some intestinal output and you get white bird
poop sprinkled with little black bits. 

My approach to dating….

I can’t help but think that the way I approach people has changed in
the last year or two.  I rarely think of various people as my
superior… I respect people who deserve it, but I will not bow down to
someone just because they hold a title.

Along those lines, I have come to an enlightenment of sorts with how I
approach girls these days… Rather than try to approach them in an
effort to just have sex, I’ve changed to where I approach them as if I
were their friend.  I find this approach works much better
overall.  Getting my drunken self to follow this logic is another
thing entirely, though 🙂

Art of software development

I just got out of a 5 hour meeting with the owner of the company that I
work for.  Among many discussions, we had one about the art of
coding.  The current mindset is that people who work with software
should be treated the same as people who stamp widgets.  By that,
I mean that they should be expected to work 8-4:30 and put in overtime
if you’re behind schedule.  What we tried explaining was that it
actually hurts performance if you force software developers to work
more hours (without pay).  If you give them more freedom in hours,
the chances are pretty good that they’ll end up working more than 40
hours anyway. 

But we came to a conclusion that working on software is similar to
writing music.  Sometimes you’re just in a zone and are very
creative.  Other times, you’re not.  Putting in more time
doesn’t necessarily mean that you’ll get that much of a return. 
In fact, it could work against you.

So through that, we realized the value of a product plan.  With a
product plan, you’re accountable for features, etc by certain days…
If you get them done, great.  If not, then you put in extra time
to get them done.  All without forcing hours or anything.

My future with web development

Lately, I’ve been feeling like I am digging myself into a shallow
hole.  I feel that I am locking myself into a boring couple of
years of asp.net development.  No offense to anyone, but asp.net
has really lost steam for me.  Even with the recent release of
asp.net 2.0, I feel myself wanting to drift to another
language/platform.  Asp.net has just lost a lot of true innovation
and watching MS time after time ignore community software is really
getting to me.  If I were to pick a platform right now, I could
pick Ruby On Rails.  There is such an amazing buzz around that
language and framework, that it reminds me of the excitement that the
internet used to have.  Extremely rapid development giving anyone
with an idea a shot at making a virtual (and possibly physical) impact.

So why not dig myself out of the MS hole and start developing with
RoR?  Well, there are a couple issues that I need to tackle before
I can venture down that path.  First, RoR isn’t optimal on the
Windoze platform. Overall, this is fine by me, but I don’t have a lot
of time to learn how to configure Apache on a unix variant. 
Second, I have some personal projects that are eating up every waking
moment for me.  These projects are important to me and have a
substantial code base, so porting them to RoR wouldn’t make sense at
this point.  I’ll have to wait till I have a stable version of
each project until I can port them.  Finally, my knowledge with
asp.net and c# is much greater than RoR.  Taking the time to ramp
up to coding techniques/syntax of Ruby is something that I cannot
afford at this time.  Again, when my personal projects have hit a
stable version, I will take the hit and learn Ruby more thoroughly.

If you’re curious what prompted this short rant, I can answer that in
two words… Visual Studio.  I cannot tell you how much I despise
that piece of software.  I am jealous when I look at how simple
and STABLE TextMate is.

So my ideal course of action is to get a working copy of OSX (either
buy a power mac or get the osx86 dvd) and start developing under that
OS. 

NHibernate: hbm2ddl NAnt task

I recently wrote an NAnt task to wrap the NHibernate hbm2ddl logic.  Hope it helps you…

I haven’t tested it very thoroughly, but it did work for me using this syntax:

<hbm2ddl
    connectionprovider=”NHibernate.Connection.DriverConnectionProvider”
    dialect=”NHibernate.Dialect.MsSql2000Dialect”
    connectiondriverclass=”NHibernate.Driver.SqlClientDriver”
    connectionstring=”server=(local);uid=sa;pwd=sa;database=MyProject”
    delimiter=” GO “
    outputtoconsole=”false”
    exportonly=”true”
    formatnice=”true”
    outputfilename=”${nant.project.basedir}/sql/schema.sql”>
    <assemblies>
        <include name=”${nant.project.basedir}/bin/MyProject.dll” />
    </assemblies>
</hbm2ddl>

Anyway, here is the code for the task. 

using System;
using System.Collections;
using System.IO;
using System.Text;

using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;

using log4net;

using NAnt.Core;
using NAnt.Core.Attributes;
using NAnt.Core.Tasks;
using NAnt.Core.Types;

namespace NHibernate.Tasks
{
    [TaskName(“hbm2ddl”)]
    public class Hbm2DdlTask : Task
    {
        private static readonly ILog log = LogManager.GetLogger( typeof( Hbm2DdlTask ) );

        private string _connectionProvider = “NHibernate.Connection.DriverConnectionProvider”;
        private string _dialect = “NHibernate.Dialect.MsSql2000Dialect”;
        private string _connectionDriverClass = “NHibernate.Driver.SqlClientDriver”;
        private string _connectionString;
        private string _delimiter = ” GO “;
        private bool _outputToConsole;
        private bool _exportOnly;
        private bool _dropOnly;
        private bool _formatNice;       
        private FileSet _assemblies = new FileSet();
        private string _outputFilename;

        /// <summary>
        /// Gets or sets the connection provider.  NHibernate.Connection.DriverConnectionProvider is the default
        /// </summary>
        /// <value>The connection provider.</value>
        [TaskAttribute(“connectionprovider”)]
        public string ConnectionProvider
        {
            get
            {
                return this._connectionProvider;
            }
            set
            {
                this._connectionProvider = value;
            }
        }

        /// <summary>
        /// Gets or sets the dialect.  NHibernate.Dialect.MsSql2000Dialect is the default
        /// </summary>
        [TaskAttribute(“dialect”)]
        public string Dialect
        {
            get
            {
                return this._dialect;
            }
            set
            {
                this._dialect = value;
            }
        }

        /// <summary>
        /// Gets or sets the connection driver class. NHibernate.Driver.SqlClientDriver is the default.
        /// </summary>
        /// <value>The connection driver class.</value>
        [TaskAttribute(“connectiondriverclass”)]
        public string ConnectionDriverClass
        {
            get
            {
                return this._connectionDriverClass;
            }
            set
            {
                this._connectionDriverClass = value;
            }
        }

        /// <summary>
        /// Gets or sets the connection string used to access the ddl.
        /// </summary>
        /// <value>The connection string.</value>
        [TaskAttribute(“connectionstring”, Required=true)]
        public string ConnectionString
        {
            get
            {
                return this._connectionString;
            }
            set
            {
                this._connectionString = value;
            }
        }

        /// <summary>
        /// Gets or sets the delimiter.  GO is the default.
        /// </summary>
        [TaskAttribute(“delimiter”)]
        public string Delimiter
        {
            get
            {
                return this._delimiter;
            }
            set
            {
                this._delimiter = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the schema should be outputted to the console
        /// </summary>
        /// <value><c>true</c> to output to the console; otherwise, <c>false</c>.</value>
        [TaskAttribute(“outputtoconsole”)]
        public bool OutputToConsole
        {
            get
            {
                return this._outputToConsole;
            }
            set
            {
                this._outputToConsole = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the schema ddl script should only be exported
        /// or if it should be executed on the database server.
        /// </summary>
        /// <value><c>true</c> if only output the script; otherwise, <c>false</c> – Execute the script on the db server.</value>
        [TaskAttribute(“exportonly”)]
        public bool ExportOnly
        {
            get
            {
                return this._exportOnly;
            }
            set
            {
                this._exportOnly = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether only the drop script should be executed
        /// </summary>
        /// <value><c>true</c> if only drop objects; otherwise, <c>false</c> – Drop and Create objects.</value>
        [TaskAttribute(“droponly”)]
        public bool DropOnly
        {
            get
            {
                return this._dropOnly;
            }
            set
            {
                this._dropOnly = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the ddl script should be formatted nicely
        /// </summary>
        /// <value><c>true</c> for nice format; otherwise, <c>false</c> – One statement per line.</value>
        [TaskAttribute(“formatnice”)]
        public bool FormatNice
        {
            get
            {
                return this._formatNice;
            }
            set
            {
                this._formatNice = value;
            }
        }

        /// <summary>
        /// Gets or sets the filename to write the ddl schema script to.
        /// </summary>
        /// <value>The output filename.</value>
        [TaskAttribute(“outputfilename”)]
        public string OutputFilename
        {
            get
            {
                return this._outputFilename;
            }
            set
            {
                this._outputFilename = value;
            }
        }

        /// <summary>
        /// Gets or sets the assemblies load with embedded *.hbm.xml resources.
        /// </summary>
        /// <value>The assemblies.</value>
        [BuildElement(“assemblies”, Required=true)]
        public FileSet Assemblies
        {
            get { return _assemblies; }
            set { _assemblies = value; }
        }

        /// <summary>
        /// Executes the task.
        /// </summary>
        protected override void ExecuteTask()
        {
            Configuration config = new Configuration();
            IDictionary properties = new Hashtable();

            properties[“hibernate.connection.provider”] = ConnectionProvider;
            properties[“hibernate.dialect”] = Dialect;
            properties[“hibernate.connection.driver_class”] = ConnectionDriverClass;
            properties[“hibernate.connection.connection_string”] = ConnectionString;

            config.AddProperties(properties);

            foreach (string filename in Assemblies.FileNames)
            {
                log.Info(“Adding assembly file: “ + filename);
                try
                {
   
           
    System.Reflection.Assembly asm =
System.Reflection.Assembly.LoadFile(filename);
                    config.AddAssembly(asm);
                }
                catch (Exception e)
                {
                    log.Error(“Error loading assembly: “ + filename, e);
                }
            }

            SchemaExport se = new SchemaExport(config);
            if (!IsStringNullOrEmpty(OutputFilename))
            {
                se.SetOutputFile(OutputFilename);
            }
            se.SetDelimiter(Delimiter);
            log.Debug(“Exporting ddl schema.”);
            se.Execute(OutputToConsole, ExportOnly, DropOnly, FormatNice);

            if (!IsStringNullOrEmpty(OutputFilename))
            {
                log.Info(“Successful DDL schema output: “ + OutputFilename);
            }
        }

        private bool IsStringNullOrEmpty(string input)
        {
            return (input == null || input.Length == 0);
        }
    }
}

Ajax: GET requests are cached but not POST reqeusts

I recently came across an issue with IE
caching responses from ajax requests.  My ajax code would send an
HTTP GET request if the querystring was less than 2067 characters and a
HTTP POST if the query data was larger.  When IE caching was set
to Check for newer versions of stored pages:
automatically, IE would cache the GET web response.  Changing the
ajax code so that it always performed HTTP POST requests fixed the
weird issues I was seeing (related to requests being cached). 

IE properly caches GET requests but doesn’t cache POST requests. 
So, I could have either altered the url of the GET request to be unique
everytime or I could have set the “Expires” header to -1.  I chose
to just use POST requests since I don’t want them to be cached
anyway.  More information can be found on the wikipedia page.

Anyway, hopefully this will help someone that runs into the same situation. 

Dreams involving death

I had some interesting dreams last night.  In the first one, I was a
murderer.  I don’t think that it was premeditated murder, but I
definitely killed people.  I remember somewhat waking up after the
dream and thinking that I needed to think happier thoughts… I feel
back asleep and don’t think the killings kept occurring.  A quick look
to a dream dictionary
says that I have heavy stress causing me to lose my temper.  This is
very true as I noticed it while talking to a family member Friday
night.

The other dream that I had was sort of a reoccurring dream.  The people
(as far as I can remember) and the place were all familiar.  The story
was somewhat different though.  Well, let me be a little more clear. 
The events that happen in the dream were the same, but my choices and
the end result of the dream were different.  The setting of this dream
is in a rural community in a warm climate.  I keep thinking of a small
village in New Mexico or Arizona.  From what I can remember, I was a
spectator of the dream, rather than a direct actor.  The dream reminded
me of a choose your own adventure type of a setting.

Anyway, the main portion of the dream takes place in a deli or butchers
place of business.  The main character of the dream is sitting at a
table with a bottle full of fluid.  There are about 5 people
sitting/standing around various places in the room and it seems that
everyone in the room is aware of the importance of the bottle.  The
main character hands the bottle over to two people (who I got the
feeling were aliens).  The aliens proceed to open the bottle (an
intricate procedure)… this is where the story diverges from the
previous time that I observed it.  This time, I noticed that everyone,
except for the aliens, had taken a hiding place.  It’s important to
mention that the hiding places were very well protected, like a cast
iron bathroom tub.  Once the aliens opened the bottle, a bomb
exploded… I would characterize the bomb as a radiation bomb, rather
than an explosive bomb.  That is, it didn’t destroy anything physically
but it did instantly kill the two aliens and any other human/alien
being, who wasn’t protected, for miles around.

In the aftermath of the explosion, the people who were hiding in the
shop, came out.  They had a sense of relief about them and the
dream
ended with the main character driving away.  Now the other part of
the
dream that was different than the first time I had it was that while
the main character is driving away, he comes to a fork in the
road.  Rather than turning right and seeing further carnage from
the explosion, he turned left
towards green fields/valleys and the unknown.



So while both of these dreams dealt with death, I feel that the second
dream was not nearly as dark as the first one.  Apparently I need to
relax a little more and deal with the stress that has been building
up.  I also find it curious that I was aware that I had the dream
before, while I was having the dream.  I was aware of my previous
decisions and decided to observe/change things.  I’m not sure how
accurate the dream dictionaries are, but I find them interesting never
the less.  Just using some key objects/events from the dreams and how I
interpret them:

Alien – Seeing aliens may represent an encounter with an unfamiliar or neglected aspect of your own self.
Explosion/bomb
– The bomb could represent repressed desires and unexpressed emotions
that are likely to explode or burst if not dealt with soon
Death – The death of a stranger can be the development or transition of different aspects of the self.
Fork in the Road – Represents an important decision that you need to make.
Kill – Forewarns that heavy stress may cause you to lose your temper and self-control.
Green
– Green signifies a positive change, good health, growth, healing,
hope, vigor, vitality, peace, and serenity. Green is also symbolic of
your strive to gain recognition and establish your independence.
Green Field – Great abundance, freedom, and happiness. You may also be going through a period of personal growth.