Pending Completion

This might someday acquire some direction.

08 Oct 2008

Job’s Done

Here we go. I’ll probably work out little tags to add (Champion, WarMachine, MagicItem, etc) later, but this is a working backbone. I don’t like the text replace messiness in the middle of my code, but I’m too lazy to write a crummy little Boolean method to look at the string and replace what I don’t want. Mebbe this can be done with Regex too? Probably. I don’t know enough about it.

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Xml.XPath;

namespace RosterParserTest
{
    class XmlParser
    {
        static XmlDocument Roster = new XmlDocument();

        static XmlElement rootElement = Roster.CreateElement("", "Army", "");

        public static string RemoveWhitespace(string str)
        {
            try
            {
                //Ryan's Regex
                return new Regex(@"(\s+|\{.*?\}|\(.*?\)|\/+|\.+)").Replace(str, String.Empty);
            }
            catch (Exception)
            {
                return str;
            }
    }

        public void ParseNestedXML(XmlElement thisElement, XmlElement rosterElement)
        {
            bool linkUnitStatsDone = false; //This is a dirty hack.

            string replaceMe = thisElement.GetAttribute("name").ToString();

            replaceMe = RemoveWhitespace(replaceMe);

            XmlElement baseElement;

            XmlNodeList linkUnitStatNodeList = thisElement.SelectNodes("./link | ./unitstat");

            if (rosterElement.Name.ToString() == replaceMe) //So that I don't get duplicate empty nodes.
            {
                baseElement = rosterElement; //Adding to the previous node in the tree.

                foreach (XmlElement parseElement in thisElement)
                {
                    if (parseElement.HasChildNodes && parseElement.InnerXml.Contains("entity"))
                    {
                        ParseNestedXML(parseElement, baseElement); //Parsing out nested.
                    } //if (parseElement.HasChildNodes && parseElement.InnerXml.Contains("entity"))
                    else if (!linkUnitStatsDone)
                    {
                        ParseLinkUnitStats(linkUnitStatNodeList, baseElement);
                        linkUnitStatsDone = true; //Hack implemented.
                    } //else if (!linkUnitStatsDone)
                } //foreach (XmlElement parseElement in thisElement)
            }
            else
            {
                baseElement = Roster.CreateElement(replaceMe);

                foreach (XmlElement parseElement in thisElement)
                {
                    if (parseElement.HasChildNodes && parseElement.InnerXml.Contains("entity"))
                    {
                        ParseNestedXML(parseElement, baseElement); //Whee recursion.
                    } //if (parseElement.HasChildNodes && parseElement.InnerXml.Contains("entity"))
                    else
                    {
                        ParseLinkUnitStats(parseElement, baseElement); //This has always worked.
                    } //else

                    rosterElement.AppendChild(baseElement); //Add to the local node.

                    rootElement.AppendChild(rosterElement); //Add to the Army node.
                } //foreach (XmlElement parseElement in thisElement)

            } //else

        } //public void ParseNestedXML(XmlElement thisElement, XmlElement rosterElement)

        public void ParseRoster(string path, string output)
        {
            XmlDocument parsingRoster = new XmlDocument();

            parsingRoster.Load(path);

            XmlNodeList parsingElements = parsingRoster.SelectNodes("/document/squad");

            foreach (XmlElement thisElement in parsingElements)
            {
                XmlElement rosterElement = Roster.CreateElement("Unit");

                ParseNestedXML(thisElement, rosterElement);
            } //foreach (XmlElement thisElement in parsingElements)

            Roster.AppendChild(rootElement);

            Roster.Save(output);
        } //public void ParseRoster(string path, string output)

        public void ParseLinkUnitStats(XmlElement parseElement, XmlElement baseElement)
        {
            foreach (XmlElement correctElement in parseElement)
            {
                if (correctElement.HasAttribute("name"))
                {
                    string subReplaceMe = correctElement.GetAttribute("name").ToString();

                    subReplaceMe = RemoveWhitespace(subReplaceMe);

                    XmlElement addElement = Roster.CreateElement(subReplaceMe);
                    if (subReplaceMe == "BigUnsCoun" || subReplaceMe == "NetCount" || subReplaceMe == "ItemPts"
                        || subReplaceMe == "EffCount" || subReplaceMe == "Group" || subReplaceMe == "ItemTagsHelper"
                        || subReplaceMe == "ItemCostWorker" || subReplaceMe == "BannerCostWorker")
                    {
                        //Remove tags I don't want.
                    } //if LotsOfCrap
                    else
                    {
                        if (correctElement.HasAttribute("description"))
                        {
                            addElement.InnerText = correctElement.GetAttribute("description").ToString();
                        } //if correctElement.HasAttribute("description"))
                        else if (correctElement.HasAttribute("value") && (Regex.Match(correctElement.GetAttribute("value").ToString(), @"[^0|-]").Success))
                        {
                            addElement.InnerText = correctElement.GetAttribute("value").ToString();
                        } //else if (correctElement.HasAttribute("value"))

                        baseElement.AppendChild(addElement);
                    } //else
                } //if (correctElement.HasAttribute("name")

            } //foreach (XmlElement correctElement in parseElement)

        } //public void ParseLinkUnitStats(XmlElement parseElement, XmlElement baseElement)

        public void ParseLinkUnitStats(XmlNodeList parseNodeList, XmlElement baseElement)
        {
            foreach (XmlElement correctElement in parseNodeList)
            {
                if (correctElement.HasAttribute("name"))
                {
                    string subReplaceMe = correctElement.GetAttribute("name").ToString();

                    subReplaceMe = RemoveWhitespace(subReplaceMe);

                    if (subReplaceMe == "BigUnsCoun" || subReplaceMe == "NetCount" || subReplaceMe == "ItemPts"
                        || subReplaceMe == "EffCount" || subReplaceMe == "Group" || subReplaceMe == "ItemTagsHelper"
                        || subReplaceMe == "ItemCostWorker" || subReplaceMe == "BannerCostWorker")
                    {
                        //Remove tags I don't want.
                    } //if LotsOfCrap
                    else
                    {
                        XmlElement addElement = Roster.CreateElement(subReplaceMe);

                        if (correctElement.HasAttribute("description"))
                        {
                            addElement.InnerText = correctElement.GetAttribute("description").ToString();
                            baseElement.AppendChild(addElement);
                        } //if (correctElement.HasAttribute("description"))
                        else if (correctElement.HasAttribute("value") && (Regex.Match(correctElement.GetAttribute("value").ToString(), @"[^0|-]").Success))
                        {
                            addElement.InnerText = correctElement.GetAttribute("value").ToString();
                            baseElement.AppendChild(addElement);
                        } //else if (correctElement.HasAttribute("value"))

                    } //else

                } //if (correctElement.HasAttribute("name"))

            } //foreach (XmlElement correctElement in parseNodeList)

        } //public void ParseLinkUnitStats(XmlNodeList parseNodeList, XmlElement baseElement)

    } //class XmlParser

} //namespace RosterParserTest

And the XML…


  
    
      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      4+ Armor Save
      3
      9
      3
      4+
      4
      5
      6
      4+*
      3
      2
      4
      2
      
        
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
          4+ Armor Save
          +1 Armour save bonus.
          
          2
          9
          
          3
          3+/2+
          4
          4
          
          5
          4+*
          1
          1
          3
          
        
        1
        0+
        5
      
      
        During opponents magic phase, steal 1 power die to use as a dispel die
      
    
  
  

      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      4+ Armor Save
      3
      9
      3
      4+
      4
      5
      1
      6
      2
      3
      4
      
        The unit causes Fear.
        
      
    
  
  

      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      +2 Strength when on foot; +1 Strength if mounted. Always strikes last unless charging. Two-handed.
      4+ Armor Save
      3
      9
      3
      1+
      4/6
      5
      1
      6
      2
      3
      4
      
        1+ Armor Save, cannot be improved.
      
    
  
  
    
      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      30" Range, Strength 4, Move or Fire.
6+ Armour save.
      
      2
      9
      
      3
      6+
      3
      4
      1
      4
      
      1
      1
      3
      
    
  
  
    
      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      30" Range, Strength 4, Move or Fire.
6+ Armour save.
      
      2
      9
      
      3
      6+
      3
      4
      1
      4
      
      1
      1
      3
      
    
  
  
    
      
        +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
        5+ Armour save.
        +1 Armour save bonus.
        
        2
        9
        
        3
        4+/3+
        3
        4
        1
        4
        
        1
        2
        3
        
      
      +1 to combat resolution in a tie. +1 Leadership when attempting to Rally (may not exceed 10).
      +1 to Combat Resolution; Standard can be captured if unit Flees.
      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      5+ Armour save.
      +1 Armour save bonus.
      2
      9
      3
      4+/3+
      3
      4
      1
      4
      1
      1
      3
    
  
  
    
      
        
          +1 WS, +1 Strength.
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
          +2 Strength when on foot; +1 Strength if mounted. Always strikes last unless charging. Two-handed.
          5+ Armour save.
          2
          9
          
          3
          5+
          4/6
          4
          1
          5
          
          1
          2
          3
          
          
        
      
    
  
  
    
      
        +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
        +2 Strength when on foot; +1 Strength if mounted. Always strikes last unless charging. Two-handed.
        5+ Armour save.
        
        2
        9
        
        3
        5+
        4/6
        4
        1
        5
        
        1
        2
        3
        
      
      +1 to combat resolution in a tie. +1 Leadership when attempting to Rally (may not exceed 10).
      +1 to Combat Resolution; Standard can be captured if unit Flees.
      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      +2 Strength when on foot; +1 Strength if mounted. Always strikes last unless charging. Two-handed.
      5+ Armour save.
      9
      3
      5+
      4/6
      4
      1
      5
      1
      1
      3
      2
      
        Unit is Immune to Fear and Terror.
        
      
    
  
  
    
      
        +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
        4+ Armor Save
        +1 Armour save bonus.
        
        2
        9
        
        3
        3+/2+
        4
        4
        1
        5
        
        1
        2
        3
        
      
      +1 to combat resolution in a tie. +1 Leadership when attempting to Rally (may not exceed 10).
      +1 to Combat Resolution; Standard can be captured if unit Flees.
      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      4+ Armor Save
      +1 Armour save bonus.
      9
      3
      3+/2+
      4
      4
      1
      5
      1
      1
      3
      2
      
        The unit counts as double its actual Unit Strength.
      
    
  
  
    
      
        
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
6+ Armour save.
          
          
          2
          9
          
          3
          6+
          3
          4
          
          4
          
          1
          1
          3
        
      
    
  
  
    
      
        
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
6+ Armour save.
          
          
          2
          9
          
          3
          6+
          3
          4
          
          4
          
          1
          1
          3
        
      
    
  
  
    
      
      
      
      2
      9
      
      
      4+
      4
      5
      3
      4
      
      3
      2
      
    
  
  
    
      
      
      
      2
      9
      
      
      4+
      4
      5
      3
      4
      
      3
      2
      
    
  

03 Oct 2008

Events Continue Apace

Halfway done — removing duplicate nodes for characters is a pain in the ass. Also, there’s a logic error somewhere (and I think I know where) preventing an entity’s links being parsed if it contains a subentity. Argh, I don’t want to write some fucked up if statement to deal with it.

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Xml.XPath;

namespace RosterParserTest
{
    class XmlParser
    {
        static XmlDocument Roster = new XmlDocument();

        static XmlElement rootElement = Roster.CreateElement("", "Army", "");

        public static string RemoveWhitespace(string str)
        {
            try
            {
                return new Regex(@"\s*\(*\)*\{*\}*\/*").Replace(str, string.Empty);
            }
            catch (Exception)
            {
                return str;
            }
    }

        public void ParseNestedXML(XmlElement thisElement, XmlElement rosterElement)
        {
            string replaceMe = thisElement.GetAttribute("name").ToString();

            replaceMe = RemoveWhitespace(replaceMe);

            XmlElement baseElement = Roster.CreateElement(replaceMe);

            foreach (XmlElement parseElement in thisElement)
            {
                if (parseElement.HasChildNodes && parseElement.InnerXml.Contains("entity"))
                {

                    ParseNestedXML(parseElement, baseElement);
                }
                else
                {
                    foreach (XmlElement correctElement in parseElement)
                    {
                        if (correctElement.HasAttribute("name"))
                        {
                            string subReplaceMe = correctElement.GetAttribute("name").ToString();

                            subReplaceMe = RemoveWhitespace(subReplaceMe);

                            XmlElement addElement = Roster.CreateElement(subReplaceMe);

                            if (correctElement.HasAttribute("description"))
                            {
                                addElement.InnerText = correctElement.GetAttribute("description").ToString();
                            }
                            else if (correctElement.HasAttribute("value"))
                            {
                                addElement.InnerText = correctElement.GetAttribute("value").ToString();
                            }

                            baseElement.AppendChild(addElement);
                        }
                    }
                }

                rosterElement.AppendChild(baseElement);

                rootElement.AppendChild(rosterElement);
            }
        }

        public void ParseRoster(string path, string output)
        {
            XmlDocument parsingRoster = new XmlDocument();

            parsingRoster.Load(path);

            XmlNodeList parsingElements = parsingRoster.SelectNodes("/document/squad");

            foreach (XmlElement thisElement in parsingElements)
            {
                XmlElement rosterElement = Roster.CreateElement("Unit");

                ParseNestedXML(thisElement, rosterElement);
            }

            Roster.AppendChild(rootElement);

            Roster.Save(output);
        }
    }
}

And the output.


  
    
      
        
          
            
              +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
              4+ Armor Save
              +1 Armour save bonus.
              
              
              
              0
              
              
              2
              -
              9
              
              
              3
              0
              3+/2+
              4
              4
              
              
              5
              4+*
              1
              1
              3
              0
              
              
            
          

        
          During opponents magic phase, steal 1 power die to use as a dispel die
          
        
      

  
  


        
          The unit causes Fear.
          
          
          
        
      
    
  
  

      

        
          1+ Armor Save, cannot be improved.
          
        
      

  
  
    
      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      30" Range, Strength 4, Move or Fire.
6+ Armour save.
      
      
      
      0
      
      
      2
      -
      9
      
      
      3
      0
      6+
      3
      4
      1
      4
      
      
      1
      1
      3
      0
      
      
    
  
  
    
      +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
      30" Range, Strength 4, Move or Fire.
6+ Armour save.
      
      
      
      0
      
      
      2
      -
      9
      
      
      3
      0
      6+
      3
      4
      1
      4
      
      
      1
      1
      3
      0
      
      
    
  
  
    
      
        
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
          5+ Armour save.
          +1 Armour save bonus.
          
          
          
          0
          
          
          2
          -
          9
          
          
          3
          0
          4+/3+
          3
          4
          1
          4
          
          
          1
          2
          3
          0
          
          
        
      

  
  
    
      
        
          +1 WS, +1 Strength.
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
          +2 Strength when on foot; +1 Strength if mounted. Always strikes last unless charging. Two-handed.
          5+ Armour save.
          
          0
          
          
          2
          -
          9
          
          
          3
          0
          5+
          4/6
          4
          1
          5
          
          
          1
          2
          3
          0
          
          
          
          
        
      
    
  
  
    
      
        
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
          +2 Strength when on foot; +1 Strength if mounted. Always strikes last unless charging. Two-handed.
          5+ Armour save.
          
          
          
          0
          
          
          2
          -
          9
          
          
          3
          0
          5+
          4/6
          4
          1
          5
          
          
          1
          2
          3
          0
          
          
        
        
          Unit is Immune to Fear and Terror.
          
          
          
        
      

  
  
    
      
        
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
          4+ Armor Save
          +1 Armour save bonus.
          
          
          
          0
          
          
          2
          -
          9
          
          
          3
          0
          3+/2+
          4
          4
          1
          5
          
          
          1
          2
          3
          0
          
          
        
        
          The unit counts as double its actual Unit Strength.
          
          
        
      

  
  
    
      
        
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
6+ Armour save.
          
          
          
          
          
          0
          
          
          2
          -
          9
          
          
          3
          0
          6+
          3
          4
          
          
          4
          
          
          1
          1
          3
          0
        
      
    
  
  
    
      
        
          +1 Armour save bonus in combat when on foot and fighting with a shield; no effect if mounted.
6+ Armour save.
          
          
          
          
          
          0
          
          
          2
          -
          9
          
          
          3
          0
          6+
          3
          4
          
          
          4
          
          
          1
          1
          3
          0
        
      
    
  
  
    
      
      
      0
      
      
      
      
      0
      
      
      2
      -
      9
      
      
      -
      0
      4+
      4
      5
      3
      4
      
      
      3
      2
      -
    
  
  
    
      
      
      0
      
      
      
      
      0
      
      
      2
      -
      9
      
      
      -
      0
      4+
      4
      5
      3
      4
      
      
      3
      2
      -
    
  

02 Oct 2008

Work Work

Got in the way. Yay for two hour meetings! Started refactoring the thing based on what Ryan did in Ruby. Here’s what I have so far — I’ll work on this at home tonight and update this post to bitch about how Ruby takes like 90% less typing. Both kinds. Look how clever I am!

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.XPath;

namespace WarhammerSimulator.XMLParser
{
    public class RosterToXML : System.Web.Services.WebService
    {
        XmlDocument Roster = new XmlDocument();

        [WebMethod]
        public XmlElement ParseNestedXML(XmlElement thisElement)
        {
            XmlElement _returnElement = Roster.CreateElement(thisElement.GetAttribute("name"));

            bool _items;
            bool _character;
            bool _crew;

            //Try to guess if it's a champion, character in the unit, or item
            foreach (XmlElement parseElement in thisElement)
            {
                _items = CheckForItems(parseElement);
                if (_items)
                {
                    XmlNode itemNode;

                    itemNode = CreateItemNode(parseElement);

                    _returnElement.AppendChild(itemNode);
                }

            }

            return _returnElement;
        } //public XmlNode ParseNestedXML(XmlNode thisNode)

        [WebMethod]
        public XmlDocument ParseRoster(XmlDocument thisDocument)
        {
            bool _items;

            foreach (XmlNode thisNode in thisDocument)
            {

            }

            return Roster;
        }

        public bool CheckForItems(XmlElement thisElement)
        {
            if (thisElement.HasAttribute("itemsummary"))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public XmlElement CreateItemNode(XmlElement parseElement)
        {
            XmlElement returnElement = Roster.CreateElement("Items");

            foreach (XmlElement thisElement in parseElement)
            {
                XmlElement thisItem = Roster.CreateElement(thisElement.GetAttribute("name"));

                thisItem.InnerText = thisElement.GetAttribute("description").ToString();

                returnElement.AppendChild(thisItem);
            }

            return returnElement;
        }

        public bool CheckForCharacters(XmlElement thisElement)
        {
            if (thisElement.HasAttribute("totalcost"))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public XmlElement CreateCharacterNode(XmlElement parseElement)
        {
            XmlElement returnElement = Roster.CreateElement("Champion");

            foreach (XmlElement thisElement in parseElement)
            {
                XmlElement thisItem = Roster.CreateElement(thisElement.GetAttribute("name"));
            }
        }

    } //public class RosterToXML
} //namespace WarhammerSimulator.XMLParser
01 Oct 2008

It’s A Start

If only ArmyBuilder used proper XML instead of hidden attribute shit, this would probably be a lot easier. I don’t know if writing XSLT would make this easier. Mebbe. I’ll update this at the end of my workday today and see what I haven’t hacked out of the Links.

using System;
using System.Configuration;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Xml.XPath;
using System.Xml.Xsl;

namespace WarhammerSimulator.RosterImport
{
    ///
    /// Summary description for Service1
    ///
    [WebService(Namespace = "http://pendingcompletion.com/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class RosterImport : System.Web.Services.WebService
    {
        [WebMethod]
        public int GetNextUnitID()
        {
            int returnValue;

            string s = ConfigurationManager.AppSettings["SqlConnString"].ToString();

            SqlConnection conn = new SqlConnection(s);
            SqlCommand cmdGetNextUnitID = new SqlCommand();

            cmdGetNextUnitID.Connection = conn;
            cmdGetNextUnitID.CommandType = CommandType.StoredProcedure;
            cmdGetNextUnitID.CommandText = "SelectNextUnitID";

            returnValue = int.Parse(cmdGetNextUnitID.ExecuteNonQuery().ToString());

            return returnValue;
        }

        [WebMethod]
        public DataTable ConvertRosterToDataset(XmlDocument Roster)
        {
            int count = 0;

            int UnitID = 0;

            string RaceName;

            DataTable dt = new DataTable();

            XmlNodeList Squads;

            XmlNodeList Links;

            XmlNodeList Entities;

            XPathNavigator nav = Roster.CreateNavigator();

            XPathExpression expr;

            XmlNode rosterNode;

            rosterNode = Roster.SelectSingleNode("/roster");

            RaceName = rosterNode.Attributes["racename"].ToString();

            Squads = Roster.SelectNodes("/squad"); //Get all squads

            foreach (XmlNode squadNode in Squads)
            {
                Entities = squadNode.SelectNodes("/entity"); //Get all entities in a squad

                UnitID = GetNextUnitID();

                foreach (XmlNode entityNode in Entities)
                {
                    Links = entityNode.SelectNodes("/link"); //Get all links in an entity

                    foreach (XmlNode linkNode in Links)
                        {

                        } //foreach _XmlNode linkNode in Links)
                    count++;
                } //foreach XmlNode entityNode in Squads
            } //foreach XmlNode squadNode in Squads
        }

    } //public class RosterImport : System.Web.Services.WebService

} //namespace WarhammerSimulator.RosterImport
24 Sep 2008

Megapost: AKA I Suck At Blogging

It has been far too long since I’ve blogged. I suppose it’s largely because the vast majority of my work time these days is spent actually working, and what little remains is basically just keeping up with the news. I don’t normally blog from home, since Missy and the kids are extremely distracting. Sometimes I think about it, but there’s just always something to be done, something that I could be doing, or I’m just hanging out and fucking about on EVE or whatever. I do wish that I weren’t so fucking lazy about blogging, and I’d like to post more, but it just feels so… blah sometimes. The only people that read this site, so far as I’m aware, are Ryan and Missy. I know that Ryan keeps up on the news, and I spend virtually all of my free time with Missy, so both are kept pretty well apprised of how I feel about a given thing on a given day. Bah. Writing that just made me think of how much easier it’d be to write $thing and $day, but that’s Ryan’s thing. I’m not stealing it, and I don’t write Perl besides. It feels off.

Anyhow, the damned Warhammer project has fallen well behind schedule. This pisses me off, to be honest, because I started the thing back in June when Ryan came to visit and planned to complete it during downtime at work. I’ve not had much of that recently. I think I’ll have more time now that the great post-summer code rush is just about finished, but it’s extremely hard to say. The company is busily in the process of reinventing the wheel. Well, I shouldn’t say that. They’re using several wheels as a prototype and trying to make some sort of all-inclusive superwheel that will replace them all. But the old ones are still there, and likely will be for awhile. It’s grand, and a perfect example of overreach. I don’t particularly care for the old systems, and I don’t want to give the impression that I do. They’re total shit, originally written in Classic ASP and now entirely made up of a collection of hacks and bandaids. They need to be rewritten. I just don’t think that trying to do it all at once is a good idea. It does avoid interoperability issues with the old systems. The new system is plagued with those same sorts of issues, is nearly six months behind schedule, already cost a fortune for new quad core servers, and just plain fucking sucks. There are three independently operating small development teams working on different segments of the new POS system. There is no oversight. There is no collaboration. Occasionally our resident project architect will completely rewrite a component to make it compliant with the other components, but whatever changes are made invariably end up being hacked within three weeks or so to include the same fucking problems that were present before the rewrite. In short, it’s retarded.

Add that to the current economic holocaust and an ongoing Presidential campaign and… well, I’m very much occupied for the most part. It does help that those two things dovetail nicely in the form of the McCain campaign, since his campaign manager is a sleazy piece of shit who was taking $15,000 a month from Freddie Mac as recently as last month. McCain, of course, denied that his manager was doing anything. Of course, it turns out that he actually was doing nothing. Supposedly. I don’t know that any business at all has the bad sense to pay someone that kind of money every month for doing nothing, no matter how well connected they may be with the Republican Party, but I’ve been shocked by this sort of thing before. It’s just… argh. McCain knows nothing about nothing. Wait, wasn’t that a term used for a xenophobic political party in this country about 150 years ago? Oh, that’s right. Except that those guys actually had a platform that didn’t involve holding a séance with the ghost of Ronald Reagan. Since, you know, that guy knew what the fuck he was talking about economically. I’m not even going to discuss Sarah Palin here. She’s an absolute joke. Rich white trash, if such a thing is possible. The supposed “Hillary Republicans” love her to death, basically because she has a vagina, but I can’t understand those people. I can only imagine that most of them are holdovers from the great social movements of the 60’s who never quite caught on to the fact that a powerful woman can nonetheless be an enemy to feminists. Margaret Thatcher should have been the first sign. But the belief borders on the religious, and there’s really no arguing with the people that believe these things. I’ll be happy to see her lose and, hopefully, get impeached in Alaska for any one of her (seeming) dozens of scandals and missteps.

On the upside, the kids are doing very well. Anya has adjusted completely to being in kindergarten now. She behaves well at school, goes to bed at a reasonable time, wakes up at 8:00 AM even on the weekends, and seems very happy in general that things have changed. I never did think that I’d see Anya happy to wake up early-ish in the morning or to go to bed early-ish in the evening, but the fact remains that she is. I suppose it’s a good thing. Alex is… well, Alex. He spends a lot of his time sleeping while Anya’s at school, since it seems as though he gets really bored without someone to boss him around. He should pose no trouble at all once he starts kindergarten. He basically does whatever he’s told to do anyway (exception: cleaning messes that he’s made), and is capable of entertaining himself quietly for long periods of time. I suppose when I say that I should qualify the statement and say “is capable of watching TV quietly for long periods of time”. He absolutely loves the television. He doesn’t want to play with me or Missy while he’s watching it. Hell, he didn’t even want to spend time with Karen while she was recently in town on some days because he was watching TV. Inasmuch as I hate the television and probably spend two hours a week watching the thing, the kids’ love for TV makes up for what I don’t watch. It’s ridiculous. But at least they’re not watching PBS Kids’ “Sprout” anymore. That channel is fucking abysmal. You’d think that PBS would show Sesame Street, Mr Rogers’ Neighbourhood, and the like, but they just don’t. The shows are fucking stupid and are the opposite of educational. Good riddance to that network in my house.

Ah… and the Warhammer project again. Ryan has said that he’s going to write an XSLT for it, which I had been meaning to do, in order to convert ArmyBuilder’s funky tree and node quasi-XML into actual SOAP-standard serializable XML. I do agree with him that SOAP is basically a hack that hijacks HTTP for something other than its indended purpose, but it’s plainly the easiest method for running a distributed application without making a fuckton of remote database transactions. I don’t particularly care for those. Additionally, SOAP really helps debugging by allowing me to look at exactly what the application is sending to the server, and what the server response is, without running an SQL profiler or the like. Those tools are fine, but they’re real-time. Since I’m not planning on having an audit table for this Warhammer application (how fucking stupid would that be), XML files will provide me with a record of what’s gone on during a given turn or whatnot. This should be exceptionally useful for “recording” battles for later review and shit like that. Should I ever make the decision to build that kind of functionality into the application, that is.I really need to get working on the thing again. I kind of stalled last time I worked on it trying to figure out in an abstract fashion which models were in base-to-base with each other but, the more I think about it, the more I think that I should just calculate it from the GUI while the app is running. I don’t actually care for that solution, just in case the differing clients running on players’ PCs don’t agree about how the battlefield looks and I’d rather calculate it on the server, but I just don’t see a way to make the method work without making the thing 1,000 lines long. I’m not making a class-length method. Not for this. It will be somewhat necessary to make extremely long methods for data transactions, since there will probably be 20-odd parameters being passed in the course of normal operation, so I suppose I should clarify. I am not making a method that calculates this sort of thing 1,000 lines long. It doesn’t make any sense and I don’t think I’d ever be able to optimize the method. Also, it would be far too easy to make an infinite loop, or forget to set a return variable properly, in such a scenario. Too many variables in play. I don’t want to mess with it. Here’s my last completed file.

Also, Chrome does not play nicely with Wordpress. And Ryan, what code markup tool are you using?

using System;

using System.Collections.Generic;

using System.Text;

namespace WarhammerSimulator
{

class AttackTable
{

BaseUnit unit = new BaseUnit();

public bool RollAttack(int AttackerWS, int DefenderWS)

{
int NeededToHit;

if (AttackerWS > DefenderWS)
{
NeededToHit = 3;
}
else
{
if (AttackerWS == 2 * DefenderWS + 1)
{
NeededToHit = 5;
}
else
{
NeededToHit = 4;
}
}

Random rand = new Random();

int roll;

roll = rand.Next(1, 6);

if (roll >= NeededToHit)
{
return true;
}
else
{
return false;
}
} //public bool RollAttack

public bool RollWound(int _strength, int _toughness)
{
int NeededToWound = 4;

int Difference;

int roll;

Difference = _strength - _toughness;

if (_toughness >= _strength + 4)
{
return false;
}

if (Difference > 2)
{
Difference = 2;
}

NeededToWound = NeededToWound - Difference;

Random rand = new Random();

roll = rand.Next(1, 6);

if (roll >= NeededToWound)
{
return true;
}
else
{
return false;
}
}

public bool Shoot(int BallisticSkill, bool hasMoved, bool softCover, bool hardCover, bool singleTarget, bool largeTarget, bool Skirmishing, RangedWeapon Weapon, decimal Range)
{
bool Result;

int NeededToHit = 0;

int roll;

if (hasMoved)
{
 NeededToHit++;
}

if (softCover)
{
NeededToHit++;
}

if (hardCover)
{
NeededToHit = NeededToHit + 2;
}

if (singleTarget)
{
NeededToHit++;
}

if (largeTarget)
{
NeededToHit++;
}

if (Skirmishing)
{
NeededToHit++;
}

if (Range > Weapon.Range / 2)
{
NeededToHit++;
}

if (NeededToHit < 2)
{
NeededToHit = 2;
}

Random rand = new Random();

roll = rand.Next(1, 6);

if (NeededToHit <= 6)
{
if (roll >= NeededToHit)
{
return true;
}
else
{
return false;
}
} //if (NeededToHit <= 6)
else
{
if (roll != 6 || NeededToHit > 9)
{
return false;
} //if (roll != 6 || NeededToHit > 9)
else
{
switch (NeededToHit)
{
case 7:
NeededToHit = 4;
Result = RollHit(NeededToHit);
return Result;
case 8:
NeededToHit = 5;
Result = RollHit(NeededToHit);
return Result;
case 9:
NeededToHit = 6;
Result = RollHit(NeededToHit);
return Result;
default:
return false;
} //switch (NeededToHit)
} //else
} //else
} //public bool Shoot(int BallisticSkill, bool hasMoved, bool softCover, bool hardCover, bool singleTarget, bool Skirmishing, RangedWeapon Weapon, decimal Range)

public bool RollHit(int NeededToHit)
{
Random rand = new Random();

int roll;roll = rand.Next(1, 6);

if (roll >= NeededToHit)
{
return true;
}
else
{
return false;
}
} //public bool RollHit(int NeededToHit)

public bool RollMeleeArmorSave(int ArmorSave, MeleeWeapon Weapon, int AttackingStrength)
{
int roll = 0;

Random rand = new Random();

roll = rand.Next(1, 6);

AttackingStrength = AttackingStrength - 3;

ArmorSave = ArmorSave + AttackingStrength;

if (Weapon.HandWeaponAndShield)
{
ArmorSave--;
}
if (roll >= ArmorSave)
{
return true;
}
else
{
return false;
}
} //public bool RollMeleeArmorSave(int ArmorSave, MeleeWeapon Weapon, int AttackingStrength)

public bool RollRangedArmorSave(int ArmorSave, RangedWeapon Weapon, int AttackingStrength)
{
int roll = 0;

Random rand = new Random();

roll = rand.Next(1, 6);

AttackingStrength = AttackingStrength - 3;ArmorSave = ArmorSave + AttackingStrength;

if (Weapon.ArmorPiercing)
{
ArmorSave++;
}
if (roll >= ArmorSave)
{
return true;
}
else
{
return false;
}
} //public bool RollRangeArmorSave(int ArmorSave, RangedWeapon Weapon, int AttackingStrength)

public bool RollWardSave(int WardSave)
{
int roll = 0;

Random rand = new Random();

roll = rand.Next(1, 6);

if (roll >= WardSave)
{
return true;
}
else
{
return false;
}
} //public bool RollWardSave(int WardSave)
}
}
26 Jul 2008

I Can’t Think Of A Title

Or, in fact, anything to write about. I know I probably should have things to write about, since it’s been like three weeks since the last one I posted, just… nothing is coming to mind. There’s an enormous “party” of sorts in a week or so, though I confess that I don’t understand why it’s even being called a party. Approximately 50 people will be dropping by my in-laws’ house to celebrate the birthdays of Missy, Katie, and Randy. Excessive drinking and gorging on food are assumed likely, and I don’t even know half of these people.

At any rate, the preparations for the party are mind-numbing. They basically consist of finding some sort of place for all of the kids’ toy, which is impossible, and scrubbing every goddamned surface in the house by hand. The fridge and kitchen floor got done last weekend, but I’m sure there are spots to do again. It’s not that I have any objection to scrubbing floors or whatnot, to be honest, just that I hate doing it for some artificial schedule. The party is next Saturday. People start coming here on Wednesday, I think, which means that I can’t really spend any day after Wednesday cleaning. And the kids can make one hell of a mess in half of a week. Keeping the house spotless until Saturday is gonna be impossible.

And that is the most irritating part of this whole thing. Everything must be perfect on Party Day. I don’t have the mentality to keep up with this, to be honest. The idea that out of thousands of variables ranging from weather to peoples’ health to tastes in food will align perfectly is pretty laughable. May as well assume that Fate smiles on you that day, ditch the party, and just go buy lottery tickets. Except, of course, that everything won’t be perfect. And it won’t really matter after the fact. Before the party, it’ll be a big fucking deal, with questions like “Why didn’t you move the stove and scrub the floor underneath it?!” whereas after the party things should be a lot more mellow. Given that, I have half a mind just to clean to the same standard I do every Saturday. I don’t know if that’s a good idea, though.

/sigh

This had better be the last such worry for a long time.

On a brighter note, my sixth anniversary was yesterday. Yay! Though we’re pathetic homebodies, it was still fun. Missy’s grandmother watched the kids for the night (due to the aforementioned general uselessness of my in-laws as sitters), and we got to go out to the Persian Room and get some yummy Persian food. Chicken Eggplant Borani, Hummus, Gheimeh, and fuck, I’m making myself hungry.

At any rate, we proceeded to leave the restaurant and go to the gaming store. Which is pathetic, I know, but we’re too cheap to go to a bar/club/whatever. Unfortunately, the gaming store did not have movement trays. At least not the movement trays we were looking for. They did have the stupid-assed nine piece Games Workshop movement trays that you get to cut yourself which are just… I’m sorry, but a movement tray does not need to be nine pieces and should not be nine pieces. So we left there empty-handed.

We picked up some movies after that and went home to watch them, but even I think it’s a little sad that Missy and I couldn’t think of a single thing to “do” outside of the house even when the kids were taken for the night. But we had fun together, which I suppose is all that really counts on a day like that. I’m not deluding myself, now or ever, to believe that people’s relationships function like they do in Hollywood. “I know finances are tight, but I’ve secretly been socking away money for five years now. It’s time to take a European vacation, and you can buy anything there that catches your eye!” Which seems distressingly common in movies. I will never understand how it is that something so central to modern life, that being finances, can pass by with nary a mention on damn near every TV show/movie made. I suppose it’s because TV/movies are supposed to be an escape from reality, but I still don’t approve.

09 Jul 2008

Things you don’t say to family

Yay! Now we’re not talking to Katie as well, since she decided that she was gonna get pissed off for no good reason. I got home, and Katie got home like 20 seconds after me. Because she’s lazy as sin, she followed me in through the front door. Missy had already called me into the bedroom, so I was headed there, and Katie decided that she’d follow. This is approximately how the exchange that followed went.

Katie: “Can I come in?”

Missy: “No, go away.”

Katie: “But I have something to…”

Missy: “Go away. Come back later.”

Katie: “Fuck it.” *walks away*

This put rather a damper on any mood that might have been in the air and upset Missy quite a bit. I’m not really happy about that one. Anyway… I go over to ask Katie what she wanted and her only response is “Tell Missy to go fuck herself”. This is not okay. Missy had already gone to snag a bottle of champagne and had locked the door from the garage into our house. Katie knew the door was locked, because she’d tried to use it. Any non-lobotomized person should have an idea what’s going to happen, but Miss Theworldrevolvesaroundme couldn’t be bothered to give us a fucking half hour of privacy. Jesus.

At any rate, I got to thinking — can I imagine a situation in which I told Ryan to go fuck himself? Perhaps if he murdered my children or somesuch. I don’t really think that, for example, if I were to come close to interrupting some “private time” between him and Heather that I would respond that way. Nor do I think that I would tell Ryan to go fuck himself in any one of 1,000 other circumstances that occurred to me. You don’t tell family to go fuck themselves. I have finally realized that Katie is her father’s daughter in every way, down to the feeling that she can should say anything she damn well pleases whenever the slightest thing interferes with her plans. What a shame.

07 Jul 2008

Poor Missy

Has had a headache for close on six months now. I mean… I’ve had a headache for years, but I can just kind of push it to the background and ignore it. Hers is crippling. She gets a neck/back rub virtually every night, and all she gets for it is a small bit of temporary relief. I would pay a lot of money to know why it happens to her. Actually, I have payed a lot of money to know why it happens to her. Just that the $1,000 for an MRI turned up no anomalies. Medical science has no idea why her head hurts, but it’s just awful for her. This bothers me.

Also… argh. Tonight was boring as hell. This Dwarf crewman is nearly done, dammit! He’s been this way for a couple of days. All he needs is to have his eyes done and to have his aiming reticle (the red gem on top of his head) ahm… gemmified. It’s seemingly hard to approximate the look of a faceted ruby when there are no fucking lines at all molded onto the model. It’s perfectly round, which is fine, but argh. Such a simple thing, and he won’t even be noticeable from the field, but I want it done right. Dammit. Even Missy, who is better than I am at these sorts of things, has had no luck at all with it. I get the feeling I’m gonna have to like.. pluck a hair and paint with it. Nothing else is fine enough to do. But the ‘eavy Metal team managed! I’m as good as they are, right?

I guess there are valid reasons for not having him done. I had a nice long conversation with Ryan last night which was… well, really nice. We spent time looking at real estate in Augusta. Not that it does us any good at the moment, but it’s nice to feel like we can afford a decent place to live and still have money left over to upgrade the place. And think about paint schemes. And any number of other things that should serve to make our new home feel like, well, home. No more stark base white walls. No more shitty appliances. No more fucking Formica counters. These things might initially be present in a place that we buy but, without ~ $120 a month going to Everquest and given that we’ll probably refinance our auto loan and subsequently knock it out entirely, well — even $250 a month from a reduced car payment buys a $3,000 slab of marble to upgrade the kitchen in a year. Or one nice stainless steel appliance every four months. Or a great dining table and chairs. Or, or, or. It’s just a wonderful feeling to think that we might have enough money and few enough retarded monetary drains that we can actually make a place our own. And like the decorations. And, what’s more, be proud to have people over to the house to relax. Homeowner’s pride is seemingly something that has grown on me in the time that I’ve not actually owned a house. Kinda stupid how these things work sometimes.

06 Jul 2008

Ass Backwards

I’ve heard back from a few of my friends in Augusta. Pay scale and whatnot are even higher than I remember. Anthony tells me that some people are getting offered $90,000. Not that I really expect to be offered that much, but I’m figuring on $60,000 as a baseline. That’s the minimum anyone gets. My JCOM should net me an extra $7,000 at minimum. $67,000 is a king’s ransom in Augusta!

I don’t honestly know why I’m letting myself get excited about a move back to Georgia. Well… yes, I do. My marriage is 100% better than it was last time I was working at the building, I know the things that led to my last marital issues, and I know how to avoid them. So I can go there and live in a nice house that I will actually keep clean, with privacy from my in-laws, and basically have a clean slate. Plus money to have nice things and to give Missy what she deserves without sweating about it.

As Missy mentioned, we moved away previously for my mental health. Arizona is far, far worse for my mental health than my old job. I just cannot deal with ridiculous childish fucking drama every month. I don’t want the fact that I have kids to be thrown back in my face by my in-laws. I don’t want to walk on eggshells each and every day for fear of offending some oversensitive person with a meaningless offhand remark. And I don’t feel like worrying about my job a year from now, when gas hits $6, I’m commuting 25 miles one-way to work, and no one wants to rent a moving truck because the cost is just plain prohibitive.

I figure I’ll just revert back to my old plan B. Go work as a contractor and apply to NSA. I don’t know if I’ll take the NSA offer when it comes in, since it’ll depend on how much they offer, but… Christ, it’d be nice to be in a place where I actually have multiple high-paying job options that don’t require me to work 60-80 hours a week. It’d be nice to be in a place where my language skills and experience actually count for something. And it’d be nice to be in a place where we have friends that we can go to see and act like normal people.

Truth be told, I’d probably rather live in a house with Ryan somewhere. I know that moving to Augusta is far from optimal for that, since it’s not a big city and doesn’t offer a rich job market like… say… Minneapolis, Raleigh-Durham, Baltimore, or the like. But I’m not sure that Ryan has a choice right now. Missy seems to’ve made up her mind, so I’ll go with that. If any other option rears its head… I’ll consider it.

05 Jul 2008

This weekend, the hotel, etc.

I fucking hate the J.W. Marriott Desert Ridge Resort. The place was kinda cool when we went for Jamie’s bachelorette party, sorta okay for Memorial Day, and just plain ridiculous this weekend. To summarize — we got dragged to the goddamned hotel on Memorial Day and this weekend. Cindie also has it booked for Labor Day. Now… I only get six holidays a year off. New Year’s Day, Memorial Day, Independence Day, Labor Day, Thanksgiving, and Christmas Day. Having five of my six holidays occupied with family is okay. Spending the entire fucking weekend for half of them at some goddamned filthy crowded hotel so that we can spend a fortune on food is not okay. Preventing me from spending time with my wife on those days is not okay.

This “resort” is designed only to suck every last dime out of each and every person that goes there. A cheeseburger is $16(!). Internet access if $13.50 a day. I can go to La Quinta and pay $60 a night, Internet included. Why does a five star hotel not offer it? So I can’t do any work, nor can I do anything else fun. All I can do is lay in the sun and watch the seconds slowly tick by. Fuck that. Oh, I also get to run out every four hours or so for food of some sort. I was intending to work on my Warhammer simulator this weekend, but no… the glare off of everydamnedthingaround was so bad that I couldn’t see shit on my screen even in Visual Studio, even with its white-as-the-sun background.

Now… this time was a little different. I telecommuted on Thursday and was there Friday + today. I won’t be going back tomorrow. Both on Friday and on today, the kids got “cranky” and my in-laws insisted that they be sent in for a nap. Okay, there’s no problem with that. Missy and I go in and sit with the kiddos while they sleep. This should be fine, right? Wrong. Missy is called a few times wondering why we’re not outside. The in-laws are reminded that Alex is still sleeping, and that they themselves requested this. Doesn’t matter. Eventually Missy goes outside. Alex and I go outside like 45 minutes later. Joan asks me how I’m doing. I respond that I’m glad to be outside, since I was so bored inside. We go down the Lazy River, which is filthy. It’s three feet deep, and the bottom can’t even be seen. Ugh. Anya loses her goggles going down the water slide, so we go around again and come back. Randy is in a red fury over something, and eventually it comes out that he’s “feeling abused” because I said I was bored. I can only assume that he got it second hand from Joan and some meaning was lost. It’s not like I wasn’t bored in general, but I wouldn’t say that. That said, a fight ensues between Missy and Randy. Missy decides that we’re leaving, and so off we go.

This whole chain of events is just ridiculous. Cindie asked Missy and I to cut Randy some slack, since he’s been drinking. But he’s always been drinking. I don’t really care about whatever trivial shit is going on. Randy and Cindie have been acting like children all weekend. I mean… for God’s sake, Katie wasn’t even there all weekend because Cindie invited a friend that Katie doesn’t like. Does this sound backwards? The 50-year-old woman invites a friend that no one likes to a weekend at the hotel, and the 20-year-old gets pissed off about it? Nevermind that their pregnant daughter is in town for the weekend. Nevermind that none of their daughters likes at least one of these people, who is a cold bitch. It’s important that Randy and Cindie can have their fucking friends come to the hotel and enjoy themselves. I don’t care. I spent the better part of the weekend in a hotel room staring at the wall while the kids slept.

What about this cannot be done at home? The spending time outside swimming? We can do that at home. How about the 250% food markup? Hotel only. The need to hide drinks? Hotel only. Inability to do anything else when the kids are taking a nap? Hotel only. Frankly, the kids have more fun at home. They like to be home. We like to be home. The fact that Cindie likes the hotel does not mean that everyone else should be dragged there. Hopefully Randy and Cindie will be the only ones going on Labor Day. It’d suit me just fine.

Oh… and I am so fucking tempted to change my cell number and just not give it to them. We got called twice while we were out getting breakfast to inform us that Anya had skinned her knee and was sad. Joan called us. She’s a great-grandmother and has dealt with how many skinned knees? I’m sure the number is in the hundreds. Anya skinned her damn knee before Missy and I even left. So she skinned her knee and was crying. They knew this before we went to eat, and Anya was perfectly happy before we left to eat. I know that she was sad but, Jesus, deal with it. If they can’t deal with a skinned knee, they should have asked us to bring her with to breakfast. We wouldn’t have minded at all. Agreeing to watch the child and subsequently calling every five minutes is worse than not watching the child at all.

Note to in-laws — Just leave us the fuck alone to live how we want. The kids are happy and healthy. The house is clean. We’re current on our bills. I know that we had out problems in the past, but… just fuck off. I’m so sick of this.

About Me

    About

    Some details about you.

    Open "about_text.txt" file in the theme folder to edit this text.