Netstat - I have been researching info on a utility called netstat. There is surprisingly not much said about it, other than the multiple options that it support. N...
At first I thought I specified the namespace incorrectly. That lead to nowhere but more problems. I was stumped. When in doubt, do some Googling I always say. In fact, I went back to some example code that I found in a prior Google search. There were some differences between my code and the examples.
I decided to trace down one specific difference. The XML Schema in the examples had an elementFormDefault="qualified" on the top level schema element of the xsd file. As soon as I added that attribute with the qualified value, my problems were solved. I should have known this was related to my issue. Hello? I am trying to qualify local elements with a prefix (to indicate the namespace).
I had seen this attribute before. Just had no idea what it meant. Just goes to show that you need to work through some examples to gain true understanding. I wonder if anyone else in my XML college class is figuring this stuff out?
So I asked why both the instance and main xsd file needed to reference the other xsd files. That did not seem to make much sense. It seemed like overkill. My instructor told me that a lot of things in XML Schema don't make sense. In fact, he told me that it might make more sense if I drank some whiskey. LOL.
Okay. My instructor is good in that he usually backs up class presentations with some homework. I was struggling to get this to work. It needed to display in a browser with some CSS. That part worked fine. Then I needed this to validate in XML Spy. Oh oh. I tried to follow the handouts. But things were just not working.
When I get into trouble like this, I use Google to find web sites to help me dig myself out. I found a great resource from Liquid Technologies. They show how to make a compound schema document. That document references the other XSDs. The instance document only needs to reference the main xsd file. Now that made a whole lot more sense. There was also Definitive XML Schema, although those examples were including other xsd files.
P.S. The funny thing is that I actually own a paper copy of Definitive XML Schema. The book set me back 60 bucks. It is some dry reading. However being able to Google a specific topic from the book seems strong.
For some shapes, I need to do some math to come up with the coordinates. This is nothing fancy. I just iterate through some loops, and do some computations such as add/subtract/multiply/divide. In the middle of development, I found the browser complaining about my computations. What was up?
Some debugging showed me that although my operands were whole numbers, they got converted to a fractional output when I divided. Then I would use the result as an index into an array. That did not turn out too well. Turns out I had to do truncation of the decimal portion using the Math.ceil() function.
There was one other HTML gotcha I encountered late last night. I am using a proportional font to make sure all the cells of the dungeon lined up. However I was having some trouble with the spaces. I thought I would be saved by the proportional font. However I had forgot that the browser ignores the whitespace, trimming batches of spaces down to a single space. I needed to add the non-breaking space entity in there to preserve the spaces.
var my_2D_Array = new Array(Array());
Slick right? I got an array of arrays. In other words, I should have a two dimensional array. Wrong. When I tried to run my code, it bombed when trying to access elements in this array. What was up? It took a while to figure it out. I should have just made sure I fully understand two dimensional array.
The outer array will be the container for the rows in my array. I need 25 rows total. Therefore I need to add two items to that outer list. In my code, I was only added one item to the list. Thus I was only getting one row. I needed to add 25 different arrays to my outer array. I did this with a loop. Then I was good to go.
Since the out array contains the rows, I need to use the vertival y value to index into the outer arrray. Some my code will look like this:
my_2D_Array[y][x] = 'x';