Thursday, January 31, 2008

TRS-80 model III and Sudoku stumper

Gah! hillaborg found my blog too? You are right, the TRS-80 model III was the first computer we had. It has the text X jumping game. I don't remember the name of it either. I think it was loaded on there with 5 1/4 floppy disks. The game was a series of underscore character "platforms" and a capital X could bounce from underscore to underscore using the arrow keys on the keyboard. If you missed the platform, you died on some asterisks at the bottom of the screen. The 486SX made that thing look ancient.


So I am stuck on this sudoku. I can easily find the answer to it but what I want to know is, how do you logically determine the next spot to fill in without guessing. I am unable to find anymore spots on this sudoku using basic cross-hatching techniques. I need a new sudoku trick to solve these kind.

original sudoku



as far as I am able to get it solved:



I am not sure what logic tool I am missing that would help me find the next numbers needed to solve this one.

Wednesday, January 30, 2008

Turbo Assembler

What I feel was the most difficult course in obtaining a computer science degree was the compiler class. I wrote it alone, in an apartment for months and months, I actually started writing the tokenizer before the course even started. The professor was knowledgable, but very old school, he did not look at any of the students work until the very end of the semester. The class was packed for a few weeks but by the end, only a dozen people were left. Writing a compiler is a big task for someone to do. You have to write code for the interface, as well as code for the assembler. I used turbo assembler to create my executables and MFC for the interface using Visual Studio 6. That Visual Studio's IDE was so much better than Borland's. I was nervous to use it at first because I knew and used Borland for nearly all of the assignments in all of my previous classes. I stuck with Turbo Assembler because again I was familiar with it and didnt want to learn a new assember in addition to a new C++ IDE. I was reminded of this class recently when I saw a MASM site on the net.

I wonder if TASM is still around. I finished the compiler and passed it off during finals week, Kim Oberg finished his a month or two earlier because his wife was due right at the end of the semester. Nothing felt better than hearing the professor say, "You passed.", it was like all that time invested was finally worth it. I knew that moment that I was going to obtain my degree in CS, I just finished the toughest course while working 30 hours a week and taking a full course load.

The first computer I had was a 486Sx, I wanted the 486DX but it was too much and my Dad bought it so you can't complain. I think it had a 400MB hard drive which was "double-spaced" to 800MB. It ran MSDOS 6.2 and MSWindows 3.1. I got games for it like the first graphical Zork adventure game, Return to Zork. To play this game I had to boot to MS DOS with a floppy disk, I could not just exit Windows 3.1. The reason for this was the memory in MS DOS was so tiny that I had to load the bare minimum possible into memory to have enough left to play the game. I would load the CD ROM driver, Mouse driver, Sound driver and try to eliminate anything else in the startup files that might take unnecessary space. Using this method I was able to play Under a Killing Moon, DOOM, QUAKE, and probably more games, but I can't remember other ones that I played growing up.

Tuesday, January 29, 2008

Candy + Dice = FUN

We celebrated Eleanor's first birthday and played a game where you roll two dice (die?) and if you get doubles you can take candy from a pile in the middle, or from someone else. The timer is set for 4 minutes and it is a free for all as people rush to roll and snag the most candy before the time runs out. I think it is a fun game and for the record:
  • everyone played (no one decided to take a nap instead)
  • nobody got bored (the game keeps your attention)
  • it was over in about 10 minutes (two 4 minute rounds and it is over)
  • the reward was not winning it was candy, lots of candy (many winners)
I am not sure what the real "name" of the game is, if you have suggestions or know what it is, put it in the comments. Anyway I need to send Rebecca the url of my blog, she does not know I even have one, Hannah found it first, big surprise!

Thursday, January 24, 2008

Juno not bad (ain't great either)

The latest movie I decided to take in was Juno and I liked it overall. The movie will be a classic and will probably be viewed a few billion times mostly repeatedly by the target audience, teenagers. That is not to say older people cannot like the movie, I did like it too. If you have not seen it, in the next few months/years teenagers will say things that will make very little sense to you. It is that kind of movie, one that tweens and teens will quote and re-quote in normal conversation expecting others to get it, think Princess Bride or Napoleon Dynamite or even worse Monte Python. Will Juno have that huge of an effect on pop culture for the next 10-20 years, never say never. It is about a teenage girl who gets pregnant with another teenage boy. She then becomes the "cautionary whale" for the rest of the movie. The film is not serious despite the serious subject, but at the same time I do not consider it to glamorize high school pregnancy. The lasting consequences of the young couples' bad choice is not full explored in the film; leaving me a little uneasy about the message it intended to send. Hopefully the message sent is that getting pregnant before you are old enough is not the end of the world, and you can still have a good life after making a serious mistake. The wrong message to get from the film would be: LOL, I can has high school pregnancy, ticktak?

Monday, January 21, 2008

My girlfriend can kiss

When I say she can kiss, I mean she can kiss me like no one else. Wow, is all I can say to that. I still remember the first kiss we had on her porch, I forgot where I lived and what my name was for about 2 hours after. Kisses since then have not had that profound of an effect on me, but at the same time, they are addictive. I can't imagine kissing someone else.
I helped with a move out move in on Saturday. Moving others makes me glad I don't have to move, boxing up stuff and carrying it in and out of homes is fatiguing. I think I am kind of impatient when helping others move. I just want it to be over and done with, which means the faster I work and less I chat and rest, and the quicker it will be over and done. I had some sweat coming off the forehead in the cold from all the effort. I did see a lot of gratitude from the woman who we helped and that for sure is worth the time investment. No one hurt their back and nothing got broken (at least that I know of) during the move so it was a huge success. Pizza was provided after and it certainly hit the spot.
I was able to play some Blue Dragon with my bro-in-law for several hours as well. I am liking that game. We had a battle with a headless horse-man thing and after several deaths, I killed him with a hail Mary style spell from the last party member still alive. Very good times, I am glad we are playing it on hard mode. Final Fantasy XII was not difficult enough in many areas, so it was mindless to beat, we were too high in levels for the end and just ran through the bosses on autobattle.
Blue Dragon is requiring more strategy and has killed me more than XII, X, IX, or VIII. Of course Final Fantasy XII is a whole other animal and I am glad to have stopped playing it (I was a total addict). But to say my favorite game remains FF Tactics by far. Tactics has so many fun battles and I love the game's job system.

Wednesday, January 16, 2008

Important Dates

I just sent an email to my family asking for accurate birthdays. I have not been the best at remembering birthdays and wishing happy birthday to my family. Now that I have a kid and two nieces, I think it is important to get organized in this area or I will be in deep trouble. Important dates that I think I will be glad to be reminded of:

  • Our Anniversary

  • Wife's Birthday

  • Kids's Birthday(s)

  • Parent's Birthdays

  • Sibling's Birthdays

  • Sibling Spouse's Birthdays

  • Niece and Nephew Birthdays

  • Boss's Birthday ($$)

  • Some holidays (like Mother's Day, Father's Day) but those are not always on a specific date



That is all I can think of now. With Google calendar I can create custom events of these dates (which continue to repeat annually). These events can have attached reminders so I chose to create an email reminder for a day or two before it. Since I check email frequently, I think this will work well for me and SMS text messages are expensive for my cell phone plan with AT&T.

Monday, January 14, 2008

So my Mom has Cancer

She is pretty young (or pretty and young ha!) to be on a deathbed. They found a cyst on an ovary looking at a scan for a previous gall bladder surgery (I've heard she is lucky they even noticed it at the bottom of the scan). This poor lady has had more surgeries that anyone I know. So to have ovarian cancer is totally not fair to her. I think she will make it, they operated and do not believe it spread (caught it very early), but now they (the smart doctors) want to do three (3) chemo treatments to be "extra sure" (read: cover their backsides). From what I was told, most post-op plans for this type of cancer have six (6) chemo treatments, so 3 is less than 6, which is good. Zero is even lower, but you can't always have zero I guess.
My wife's mother died of this exact cancer when my wife was in her 20's. So if my mom goes too, then our kid(s) will not have a grandma... That, to me, is sadder than anything else about this. So I am praying for her and I think many other people are too. I think she will be ok, but I do have a strong desire for her to be ok that clouds my ability to rationally process her condition completely. I will update this as events unfold. Just hope my blog does not pop up on google results for searches including words like funer.. I guess typing it won't help.

Saturday, January 12, 2008

My eclipse XSL-FO workflow

I hope that this helps someone. Keep in mind I do not give any warranty to any recommendations I make on this blog. If you are able to blow up your hard drive with it (or your Mom's hard drive), I assume no liability for damages.

Problem: I needed to quickly see the output of changes made to some XSL-FO XSLT stylesheets.

Resolution: Eclipse, Apache Ant, Adobe Acrobat

  1. I created an eclipse project and added the following to it:

    • Sample source XML:

      <?xml version="1.0" encoding="UTF-8"?>
      <!--
      Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements. See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License. You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
      -->
      <!-- $Id: xslfoRef.xml 426576 2006-07-28 15:44:37Z jeremias $ -->
      <!--
      tbd: - internal linking
      - one line explanation
      - example
      please note: the short explanation of each fo is based (mostly verbatim) on the section 6.3 of
      the Extensible Stylesheet Language (XSL) Version 1.0 W3C Candidate Recommendation 21 November 2000.
      authors: Sharon Adler, Anders Berglund, Jeff Caruso, Stephen Deach
      Paul Grosso, Eduardo Gutentag, Alex Milowski, Scott Parnell,
      Jeremy Richman, Steve Zilles
      url: http://www.w3.org/TR/2000/CR-xsl-20001121/

      -->
      <root>
      <div0><head>formatting objects</head>
      <div id="fo:basic-link">
      <fo>fo:basic-link</fo>
      <explanation>represents the start resource of a simple link.</explanation>
      <content>(#PCDATA|%inline;|%block;)*</content>
      <properties>
      <property>common-accessibility-properties</property>
      <property>common-aural-properties</property>
      <property>common-border-padding-and-background-properties</property>
      <property>common-margin-properties-inline</property>
      <property>common-relative-position-properties</property>
      <property>alignment-adjust</property>
      <property>alignment-baseline</property>
      <property>baseline-shift</property>
      <property>destination-placement-offset</property>
      <property>dominant-baseline</property>
      <property>external-destination</property>
      <property>id</property>
      <property>indicate-destination</property>
      <property>internal-destination</property>
      <property>keep-together</property>
      <property>keep-with-next</property>
      <property>keep-with-previous</property>
      <property>line-height</property>
      <property>line-height-shift-adjustment</property>
      <property>show-destination</property>
      <property>target-processing-context</property>
      <property>target-presentation-context</property>
      <property>target-stylesheet</property>
      </properties>
      </div><div id="fo:bidi-override">
      <fo>fo:bidi-override</fo>
      <!-- snip -->


    • Sample XSL-FO for the source:

      <!--
      Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements. See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License. You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
      -->
      <!-- $Id: xml2pdf.xsl 426576 2006-07-28 15:44:37Z jeremias $ -->
      <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
      xmlns:fo="http://www.w3.org/1999/XSL/Format">

      <xsl:template match ="root">
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

      <!-- defines page layout -->
      <fo:layout-master-set>

      <fo:simple-page-master master-name="simple"
      page-height="29.7cm"
      page-width="21cm"
      margin-top="1.5cm"
      margin-bottom="1.5cm"
      margin-left="2.5cm"
      margin-right="2.5cm">
      <fo:region-body margin-top="1.5cm"/>
      <fo:region-before extent="1.5cm"/>
      <fo:region-after extent="1.5cm"/>
      </fo:simple-page-master>
      </fo:layout-master-set>

    • Sample Apache FOP config XML:

      <?xml version="1.0"?>
      <fop version="1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation=
      "http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co">
      <renderers>
      <renderer mime="application/pdf">


    • A batch script to convert a source XML file to a PDF like this:

      set FOP_COMMAND=C:\OpenSource\fop-0.93\fop.bat
      set FOP_XML_CONFIG_FILE=C:\Projects\WelcomePages\conf\fop_config.xml
      set INPUT_XML=C:\Projects\WelcomePages\src\sample_data.xml
      set OUTPUT_PDF_FILE=C:\Projects\WelcomePages\out\welcomepages.pdf
      set FOP_XSLT=C:\Projects\WelcomePages\src\xslt\sample.xslt
      set XSLT_PARAMS=%XSLT_PARAMS% -param CREATE_WELCOME_PAGES 1

      %FOP_COMMAND% -c %FOP_XML_CONFIG_FILE% -xml %INPUT_XML% -xsl %FOP_XSLT% %XSLT_PARAMS% -pdf %OUTPUT_PDF_FILE% -pdfprofile PDF/A-1b

    • Ant build script (build.xml) in the project like this:

      <project name="welcome_page" default="all" basedir=".">
      <property file="build.properties"/>

      <target name="all" depends="createPDF, openPDF">
      </target>

      <target name="clean">
      <delete file="${pdf.file}" quiet="true" />
      </target>

      <target name="createPDF" depends="clean">
      <exec executable="cmd">
      <arg value="/c"/>
      <arg value="${create.pdf.script}"/>
      <arg value="${pdf.file}"/>
      </exec>
      </target>

      <target name="openPDF">
      <exec executable="cmd">
      <arg value="/c"/>
      <arg value="${open.pdf.script}"/>
      <arg value="${pdf.file}"/>
      </exec>
      </target>

      </project>


    • build.properties file for the Ant Script XML

      pdf.file=welcomepages.pdf
      create.pdf.script=welcomepage.bat
      open.pdf.script=C:/Progra~1/Adobe/ACROBA~1.0/Acrobat/acrobat.exe



  2. In a new project in Eclipse I configured a builder by right clicking and choosing properies on the project, then selected builders and clicked new Ant Build and used the build.xml in the project

  3. Workflow complete, now when changes are saved to any of the Eclipse project files, whether is it the XSLT transforms, the source input XML, or even the config files for Apache FOP, the output and effect of those changes is automatically created and the PDF is automatically opened.



*Right now you have to close the output pdf before saving changes in the eclipse project. I would like to improve this so that I can make changes to the source files even if the previously created pdf is still open in acrobat.

Friday, January 11, 2008

xsltApplyOneTemplate: problem with xsl:with-param

If you happen to be writing XSLT and are getting a strange error such as this:
xsltApplyOneTemplate: problem with xsl:with-param


But the template seems to run and produce the output, then it could be a typo problem with one of your templates. I ran into this and it took some time to actually discover the problem, (there was a lot of XSLT templates to look at):

I had created a template like this:
<xsl:template match="*[contains(@class,' map/topicref ')]" name="topicrefNestedSection" mode="nestedSection">
<xsl:with-param name="level" />


It should be changed to this:
<xsl:template match="*[contains(@class,' map/topicref ')]" name="topicrefNestedSection" mode="nestedSection">
<xsl:param name="level" />


For some reason I put an xsl:with-param instead of an xsl:param tag. This typo is, for some reason, NOT an XSLT syntax error that is caught by the processor. The only indication I found of a problem is the messages printed by the XSLT processor. Obviously the parameter passed to the template was not working when I was using xsl:with-param and began working once I fixed the typo.

Tuesday, January 8, 2008

XSLT brings back memories

Komodo is what I have been using for XSLT debugging for a OAISIS DITA open toolkit project I am currently on. I have been taking some specialized DITA sample data and adapting the DITA open toolkit dita2docbook transform to the client specifications. In ActiveState Komodo, I love being able to set break points in the XML input or the XSLT and step through the execution. It is very handy to see the order of execution or what template is used for a particular part of a large XML collection. However it is very annoying that I cannot see a partial output of the transform... also the watch options in Komodo do not seem to work (I get exceptions). I have used Oxygen XML at a previous job and liked it but can't remember if it was any better than Komodo in these areas. I may have to go on a hunt for a new XSLT IDE that allows me to:
  • set break points in xml source or xslt and execute a transform in debug (stepping mode)
  • inspect using xpath while in debug (stepping mode)
  • view partial xslt transform output in debug mode
  • select which xslt processor (Saxon, Xalan, MSXSL or Xerces)
  • perform XSL-FO transforms with Apache FOP
I have also used Eclipse as a XSLT development tool, I even had setup a process such that changes made to sample input XML, or the project XSLT files would trigger a transform using Apache Ant and then a second transform using Apache FOP and finally launch a PDF viewer to check the results. I will try to find time to post those Ant scripts and how I configured the Eclipse project to do it.

Programming in XSLT reminds me of when I was an intern working for Tracy, ah the memories, back then I used UltraEdit and just did command line XSLT processing with MSXSL. I was finishing my CS degree writing a compiler and had the crazy idea that I could generate XML with the tokenizer and parser and use XSLT to actually transform it into assembly. I was too worried about the project deadline to actually try it. I almost did it in Perl but chickened out and just used C++ with Visual Studio. I hadn't taken much Java and, at the time, Java seemed like too much typing. C# had just come out and I didn't dare try to learn a new language while also learning how to write a compiler.

Friday, January 4, 2008

Four Gables is a blog I like

I live at a house with Four Gables (something I learned on my wife's blog) so I decided to call my blog Four Gables Guy. Not sure when I will tell people I have a blog. It is sort of like admitting you play harmonica. I hope it just kind of gets 'discovered' by those interested rather than me having to advertise or promote it. I program as my occupation. Love video games and scifi.

P.S. No, I do not play harmonica.

About Me

My photo
Lead Java Developer Husband and Father

Tags