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...
I am two weeks into my PHP Programming college course. I am writing small PHP code snippets in my HTML files now. To run the code on my machine, I decided to install WAMP. This gave me automatic installations of Apache, MySQL, PHP, and so on.
To start with, I am just dropping HTML files with PHP code into the root Apache web server. That way I can access them via localhost using my browser. As soon as I started making changes to my PHP code to fix bugs, I found some annoying behavior. I click refresh in Internet Explorer. However the browser just shows the results from the old PHP code.
I eventually found a work around. I could click the Back button in IE, then the Forward button, and finally Refresh would work. That was just too many steps to see the latest output from my new code. I was using Internet Explorer 9. But I doubt that version had anything to do with the problem.
I emailed my instructor. He told me to see him after class. Doh. There he walked me through some settings to jiggle in IE. Specifically I chose Internet Options from the Tools menu in IE. Then I clicked the Settings button under the Browsing History group. There I clicked the radio button that said "Every time I visit the web page" under the "Check for new versions of stored pages" label.
Turns out the default value of "Automatically" does not check for new versions of stored pages. I found this to be a weird location for such an option. But I am just glad that every time I click Refresh, IE actually does refresh my browser with a new run of my PHP code.
My latest chore was to produce a list of unique cities from our big file of XML data. No trouble. I put together a little template that compared the current node to the preceeding ones. Any dups got culled, leaving me with a unique list. Simple to put it in order with
Next came what seemed to be the tricky part. The unique city listing needed to be comprised of links that took you to the section in the raw data there people from that city are listed. I figured I needed a link to a local in my HTML file. Just need to generate an ID, and reference that ID. And what better a way to generate these anchors? XSL templates of course.
I wonder how some of my other classmates are doing. Some of them got stuck in the XML Schema assignments and never came out. I just hope they know their HTML. It is a requirement for this course.
I just read some info on the Hoodie library. This thing claims to let you write web apps quick. One fun thing was that it stores stuff locally, and can work even if you are online. A lot of the sample code looked positively simple. Can this possibly work? I don't know. But it has my interest.
Then I came to the following declaration:
Hoodie is currently a developer preview. Some features are missing, some things might change, there's a lot of optimization to be done. Don't use this for production.Oh snap. That did not instill confidence. I guess it is nice to get an early look at what they might have going. But I don't fool around much. I write code that I want to ship now. Perhaps I should wait and see how Hoodie pans out. Too bad. It seemed pretty cool.
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';
I tried for a while. All I could find was a 30-day evaluation copy of XML Spy. It seems they used to offer a free scaled down version of the software. I can't find it any more. It was called XML Spy Home Edition 2006, or something of the sort. Altova really wants me to buy a copy of their software.
The problem is that XML Spy costs either $1000 or $500, depending on whether you opt for the enterprise or professional version. I need something more like a lite version. Better yet, I could go for an educational version. No such thing seems to exist. So I checked out the free alternatives. A student has to eat. And you can't eat if you spend a grand on XML validation software.
First up we have XML Copy Editor. This program is released free of charge under the GNU IGPL license. When you first bring up the program, it looks to have a very minimal interface. It almost feels like something you might role out yourself. Next I tried XMLPad. The thing wanted to reboot my computer on install. That was strange. I decided not too, but then the program displayed weird error messages. It has a better user interface than XML Copy Editor.
I have to say that XML Spy seems to have the most intuitive messages when something goes wrong with validation. I also like that it automatically detects when the file you have open gets changed on the disk. You get prompted to reload the file. Not ready to shell out 500 clams for the thing. I don't even know if it is worth having my company buy a copy for me.
Maybe the hard core thing would be to develop a version for myself. That will take a massive amount of time and effort. However the benefit would be that I would be close to an XML expert when I was done.