tag:blogger.com,1999:blog-76516513676371803812024-03-13T11:42:30.008-04:00XML HomeI attended a class on XML. Now I want to learn all about the types and use of markup languages. Finally I understand the SOAP versus REST debate. There is still much to learn.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.comBlogger111125tag:blogger.com,1999:blog-7651651367637180381.post-3809910083281713192015-06-16T15:30:00.001-04:002015-06-16T15:30:18.712-04:00Test Data Generation with Python<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJU0R9efl-o2bp0sbJuCrgBzeom28ay1TnQBIdQ4irTrb5bvVqAzSNPTeMib3ptMZl44g8eNjXmJw8YKGNESF9TBmRr3U1_YK02sjjm_UUUBI_bN6Y1aDKaQpltgR3cNGVXtLTNyaArZM/s1600/TestData.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJU0R9efl-o2bp0sbJuCrgBzeom28ay1TnQBIdQ4irTrb5bvVqAzSNPTeMib3ptMZl44g8eNjXmJw8YKGNESF9TBmRr3U1_YK02sjjm_UUUBI_bN6Y1aDKaQpltgR3cNGVXtLTNyaArZM/s1600/TestData.jpg" /></a></div>
My latest task has me writing a utility to generate test data in XML format. My language of choice for this task is Python. At first, I got some push back from management. They told me they thought Python could not handle XML. Ha.<br />
<br />
I am starting with the basics. I am using the ElementTree that comes in the Python standard library. It is really easy to parse an XML file in Python. Just takes a few lines of code for ElementTree. The actual parsing is delegated down to a parser program. Expat is such a program that ships with Python.<br />
<br />
It is also easy to find or iterate through nodes of interest in the XML. The parsing puts the data in a tree. ElementTree gives you methods to search and destroy. I got hung up for a second because there did not seem to be a method to clone a node. That's okay. I rolled my own.<br />
<br />
You need to make sure to do a deepcopy() from the copy module. That way you get the whole node. Then you can append() it to the tree. Make sure to write() the resulting in memory tree back out to an XML file to persist your changes.<br />
<br />
Next up I need to figure out which values I need to manipulate in my cloned nodes. Good times I tell you. Good times. No wonder the new guys straight out of college prefer Python for their tools.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-91635129802806066912015-02-20T16:48:00.001-05:002015-07-04T00:07:01.840-04:00Microsoft Virtual Academy<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8eWSqyjbIQEzRvvFNZaOf4xDqTmYB6o7SPDOFVqjYhbT-JTMW7fLrBzQWh-0azhv4NKlFxExQJ5WvIONTZBzz9T8Rg2zJ-XnX8nFIr0dWemlqtLCKPuXseLSAPPsJaH6Z1HKmPmrjpfE/s1600/MVA.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8eWSqyjbIQEzRvvFNZaOf4xDqTmYB6o7SPDOFVqjYhbT-JTMW7fLrBzQWh-0azhv4NKlFxExQJ5WvIONTZBzz9T8Rg2zJ-XnX8nFIr0dWemlqtLCKPuXseLSAPPsJaH6Z1HKmPmrjpfE/s1600/MVA.png" /></a></div>
I was planning to complete a Microsoft Virtual Academy (MVA) course on Python. Specifically I was interested in the Developing Web Applications with Python and Flask. Upon review of the topics for the course, I thought it might not be what I really want. I want to write apps. Not so much web apps.<br />
<br />
So I perused the MVA courses related to Python. I tried out the Intro to Python. After viewing the first module, I think it might be too rudimentary for me. The presenters were interesting. Their links were out of date. Don't know why. They hosted their stuff on Github. It should still be out there.<br />
<br />
Learned that there are a lot of flavors of Python: CPython, JPython, IronPython, PyPy. Not exactly sure what version I have been learning. Maybe these are specific to Microsoft Windows or something. Of course the MVA recommends you use Visual Studio to do your development. So far I have gotten used to the Python Shell that comes with Python 3.4.<br />
<br />
One week left until the local Python Hackathon. I think my skills need more practice. Even the MVA guys say you need to practice to learn. Is it time to implement the game of Othello? Or maybe go full blast a try to code up a mini-roguelike?XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-2976843803589441302015-02-19T23:56:00.003-05:002015-02-19T23:56:35.085-05:00Python Battleship<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzAZBfpuPa9sGHDe2tSWY7giFk5pUwZEAEauy6x-lEiOYp2HjBePyu8g74PiJX5PjOPmsML-PwC7x98TkvkSvqq7RJfB1NNBKx7hVfPpYsl_z4jVpDDsHP1-oHTF5xNYJrCb9fcHDio8g/s1600/BattleshipBoard.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzAZBfpuPa9sGHDe2tSWY7giFk5pUwZEAEauy6x-lEiOYp2HjBePyu8g74PiJX5PjOPmsML-PwC7x98TkvkSvqq7RJfB1NNBKx7hVfPpYsl_z4jVpDDsHP1-oHTF5xNYJrCb9fcHDio8g/s1600/BattleshipBoard.png" /></a></div>
I implemented a crude version of the game of Battleship in Python. This is all about x and y coordinates. How should one store such a pair of coordinates? I chose a tuple. A tuple in Python is a set of comma separated numbers. Normally they are programmed within parentheses. I just happened to represent the ship coordinates using tuples. Then I put those tuples in a list.<br />
<br />
The good thing about tuples is that you access the elements of a tuple like you would a list, with brackets. A zero based index goes in the bracket. The values in the tuple are immutable. Once set, you cannot change them. This is fine as the ships in Battleship are not changing during the game.<br />
<br />
Previously I had learned to use the int() function to convert a string to an integer. Well now I know there is also a str() function to convert an integer to a string. Useful information. Where to go next? I might implement a simple encryption method in Python. Or I might go full tilt and try to code the game of Othello. Still might also want to investigate a Python library. So much to learn. So little time.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-70553353464559948212015-02-19T18:12:00.001-05:002015-02-19T18:12:32.683-05:00Missing From Python<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7oPinBdZubUdWi-zfw4wtBeKwYuq1ktTWE12Syk9aPYbhtYbj4xCvzIwmVGOoKP0CzB93qMTVnCDvtasPX3LSDQjKKqS4Hf5v_5LZg2APynGixk_AGPbMYH34jc0Yk-tgJTAtuDQFVTg/s1600/Battleship.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7oPinBdZubUdWi-zfw4wtBeKwYuq1ktTWE12Syk9aPYbhtYbj4xCvzIwmVGOoKP0CzB93qMTVnCDvtasPX3LSDQjKKqS4Hf5v_5LZg2APynGixk_AGPbMYH34jc0Yk-tgJTAtuDQFVTg/s1600/Battleship.jpg" /></a></div>
This week I have been concentrating on the features that are present in the Python programming language. However I have noticed some omissions in Python that other programming languages have. One is the case statement. There is no such thing in Python. You got to do a bunch of if else statements.<br />
<br />
Another thing that does not seem to be supported out of the box is graphics. Sure you can pipe some characters to the console output. But there are no bitmapped graphics that I can see. Luckily there are popular add on packages that supplement this shortcoming.<br />
<br />
I have read about PyGame which will give me graphics and sounds. And there are other choices too I presume. My last big project is going to be implementing the game of battleship. Unfortunately I did not play this game as a kid. I expect that is it something akin to Minesweeper. Let's see how hard that will be using Python.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-31977058061044905652015-02-18T18:58:00.000-05:002015-02-18T18:58:23.737-05:00Python Pass By Reference<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcfWdhLH9WyR_NW2S_V7PXEVpuO0I4-WSbDWw3Y-uhsUJ9OMsPwkFHEuCwAmzRQbkSE0WD3KNY8PwCLQnJ0OXuiCAkgvhfAkqtd4Todk23A2gA_eKZ8lilY7sLcUSxwwra7S1eLNb84AA/s1600/Python.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcfWdhLH9WyR_NW2S_V7PXEVpuO0I4-WSbDWw3Y-uhsUJ9OMsPwkFHEuCwAmzRQbkSE0WD3KNY8PwCLQnJ0OXuiCAkgvhfAkqtd4Todk23A2gA_eKZ8lilY7sLcUSxwwra7S1eLNb84AA/s1600/Python.png" /></a></div>
I implemented a bare bones version of Tic Tac Toe using the Python programming language. Since my last post, I added logic so that the computer made moves during its turn. The computer AI is not too intelligent. It just follows a preset path, and skips over spots that are taken on the board. The goal here is to learn Python, not figure out the Tic Tac Toe bot.<br />
<br />
During this exercise, I needed to finally figure out whether parameters passed to a function are by value or reference. The answer is not so simple. Let's get one thing out of the way first. If you pass a string to a function, it cannot be changed as that type is immutable. But let's discuss passing mutable types to a function.<br />
<br />
When you pass a variable, you are supplying a name that is associated to an object. That name is like a reference. The function gets its own reference that is separate from the formal parameter name. However the version that the function has can be used to reference and change the object it points to. So that is kind of like passing by reference.<br />
<br />
You can reassign the local function reference to some other object. However the original variable (reference) that the caller has is unchanged by this reassignment. Confused? I guess you got to play with it a bit to understand what the heck is going on here. I will just treat this as pass by reference with some caveats.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-64054078286617496162015-02-18T15:34:00.003-05:002015-02-18T15:34:42.335-05:00Python Tic Tac Toe<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIsAMnuFVcb4OJY1m2QRgz_YXd95AzCTSNHu4JBkYAHCc3A-mQz0T2_R8RYZ3nBNOTqO70nr-BUA5cWYJ4KZqUkZUZxPIxTcTYvdxdLlSOMSBWod9_9qouG3-LIcR2_EKSLoSa6FKbYQw/s1600/TicTacToe.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIsAMnuFVcb4OJY1m2QRgz_YXd95AzCTSNHu4JBkYAHCc3A-mQz0T2_R8RYZ3nBNOTqO70nr-BUA5cWYJ4KZqUkZUZxPIxTcTYvdxdLlSOMSBWod9_9qouG3-LIcR2_EKSLoSa6FKbYQw/s1600/TicTacToe.png" height="313" width="320" /></a></div>
I am in the middle of implementing a Tic Tac Toe game using the Python programming language. So far I can draw a board with ASCII graphics. I also get user moves and show them on the board. I can detect whether the latest move is a winning move. Next I need to implement the computer moves. That will require some rudimentary artificial intelligence.<br />
<br />
Although I did not have to use it, I figured I should try two dimensional arrays to represent the board. In Python, it would actually be a two dimensional list. The creation of such a beast is not intuitive. I found some weird ways to specify it. However I decided to start simple and create a list with brackets. Then I appended lists to that main list using append(). Then I append the actual moves that sub-list.<br />
<br />
The good news is accessing the two dimensional list is just as you would an array: myList[x][y]. I learned a couple other things today. Looks like you have to enclose expressions in parentheses for your if statements. And when there are compound expressions with parentheses themselves, wrap the whole thing in extra parentheses.<br />
<br />
I did take advantage of a neat feature in Python. You can return more than one value from a function. Just do a return value1, value2. The caller can use the syntax global1, global2 = fxn(). You don't see that syntax in many (any?) other languages. Now back to tic tac toe implementation.<br />
<br />XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-84117369039523949202015-02-17T19:06:00.002-05:002015-02-17T19:06:48.622-05:00Python Hangman<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfYxMydRIo1zys9MnD4rgI34Bo6qOBQ237ied7Wu2wEykzVLFK8cHBDamBEhCrlNaukUPBydgjJlUorH6rFtX5fvUy8BZJ0etUmOMCpRmNfEjnlxnoYjiZWFjIE4h4zIS_LELaqGJN1UQ/s1600/PythonHangman.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfYxMydRIo1zys9MnD4rgI34Bo6qOBQ237ied7Wu2wEykzVLFK8cHBDamBEhCrlNaukUPBydgjJlUorH6rFtX5fvUy8BZJ0etUmOMCpRmNfEjnlxnoYjiZWFjIE4h4zIS_LELaqGJN1UQ/s1600/PythonHangman.jpg" height="199" width="320" /></a></div>
I wrote a hangman style game using the Python programming language. This required me to use the skills I learned so far, and stretch a bit to learn more. One thing I picked up was that you can use the keyword elif to act like else if. Saves a few characters.<br />
<br />
Also made use of a kind of for loop. You can use for i in range(n) to make i loop from 0 to n-1. Very handy to enumerate the indexes of a string. Speaking of a string, you can use a zero based index in brackets after the string variable name to access individual characters in the string.<br />
<br />
The "in" keyword has other uses. You can check whether an item is in a list by using myItem in myList. That is pretty handy. Finally the values for a boolean variable are written True and False. Yes. You must use capital letters to start those keywords.<br />
<br />
Now that I got hangman out of the way, it is time to reach for the stars. Next I think I shall implement tic tac toe. That will require a bit of artificial intelligence. But nothing too deep. I might even use the algorithm my book taught me so I can concentrate on the Python programming aspect.<br />
<br />XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-63489708257101299622015-02-17T16:49:00.001-05:002015-02-17T16:49:39.074-05:00Python Functions<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTrJ3kuLQCbmIIzkIX-GwPCWYzQIoRtyn7OL0OhUckVKCCxzBmAYLXCMTI6m2jgigAHxYqY3rwFe2UwBdnlWY6J2PrbXdxRM25jId6T1D0FXgDqoQ3-s5rmwYJywfTVpykcNIsvM-dMzY/s1600/DragonsRealm.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTrJ3kuLQCbmIIzkIX-GwPCWYzQIoRtyn7OL0OhUckVKCCxzBmAYLXCMTI6m2jgigAHxYqY3rwFe2UwBdnlWY6J2PrbXdxRM25jId6T1D0FXgDqoQ3-s5rmwYJywfTVpykcNIsvM-dMzY/s1600/DragonsRealm.jpg" height="165" width="320" /></a></div>
It is pretty easy to write functions in Python. You use the keyword "def". Then you put the name of your function followed by parentheses. Optional argument names go inside the parentheses. After that you place a colon.<br />
<br />
The rest of the indented code after the colon is the body of your function. The function can optionally return a value with the return keyword. Now there is variable scope business that I have read about and have not played with. More on that later I presume.<br />
<br />
Calls to the function can be made after it has been defined. You just reference the function name followed by parentheses. You put any actual values for the parameters within the parentheses. And you can assign the return value of a function, if any, to the left hand side of the function call.<br />
<br />
The colon seems to be standard fare in Python. You put it after the function declaration. You also put if after conditional checks and looping constructs. I am going to be kicking it into high gear next, writing a non-trivial game of hangman in Python.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-79749212331981226432015-02-17T12:47:00.001-05:002015-02-17T12:47:51.418-05:00Python Lists<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlpBFTq6d_zgpqVE6bJkp5SqefKB6c6GzO7nmNKNbriIhbgpl6k9IFt6KWxKlMrRbYK4N4unYxf5FNrj58k7P_8GxrQaPq4RKs5v5Gz3ralmhoYwT7Ddf6ST6xiJfyhU2z71tAD5bl0J8/s1600/PythonLists.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlpBFTq6d_zgpqVE6bJkp5SqefKB6c6GzO7nmNKNbriIhbgpl6k9IFt6KWxKlMrRbYK4N4unYxf5FNrj58k7P_8GxrQaPq4RKs5v5Gz3ralmhoYwT7Ddf6ST6xiJfyhU2z71tAD5bl0J8/s1600/PythonLists.png" height="265" width="320" /></a></div>
Time to write my second program in Python. This one will need to hold a bit of data. So I decide to use an array. Ooops. Python does not seem to have an array. But they do have lists. All right. Set a variable name equal to a comma separate list in brackets. Then I have a list.<br />
<br />
The list is accessed with a zero-based index in brackets. You can create an empty list with just brackets. Then you can add items using the append() function. The list items do not need to be the same type. But you cannot access an entry in the list that was not created yet. That would cause an error.<br />
<br />
I also need some random number generation. I import the random package for help with that. Then I can use the randrange() function which takes the upper and lower bounds of the range for the random integer that is returned.<br />
<br />
Next up I am going to learn how to create a function in Python.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-70276021621946659072015-02-16T17:30:00.000-05:002015-02-17T12:41:52.183-05:00Invent With Python<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEa3sBxTjtTyHRnyGsK0-rYDljvgAurFhi5F1jK1ODKAmBF2ev64ImiQdmdCT8h63fibmXl3LsHQpfPzGtEE0V9J3dStp_5Z7S04YAL3Tv1OvRcAE5udqxrLnVcKrRkwiaNGtK7r85Pp0/s1600/InventWithPython.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEa3sBxTjtTyHRnyGsK0-rYDljvgAurFhi5F1jK1ODKAmBF2ev64ImiQdmdCT8h63fibmXl3LsHQpfPzGtEE0V9J3dStp_5Z7S04YAL3Tv1OvRcAE5udqxrLnVcKrRkwiaNGtK7r85Pp0/s1600/InventWithPython.jpg" height="320" width="256" /></a></div>
I have been interest in learning the Python programming language for a while. My college had offered a class to teach you Python. But I have not seen the class offered in the last two years or so. Finally I have figured it is time to take matters into my own hands and learn the language by myself.<br />
<br />
To help with this, I got a copy of the book Invent Your Own Computer Games with Python. I call it Invent with Python for short. I read through the book over the last month or two. I took a lot of notes. But I did not work through any exercises. Bad move. When I sat down to write my first program, I was clueless.<br />
<br />
Now it is time to really learn this language. I did complete my first program with the help of Google. My plan is to write the games that were covered in the book. But I will write them on my own without looking at the source code in the book.<br />
<br />
My company is sponsoring a Python hackathon in less than two weeks. Time to really get up to speed so I can complete. All right. I can use the input() function to grab data from the user. That returns a string. Need to convert it to a numeric value using int() before comparing to other integers. I can also use the print() function to do my output.<br />
<br />
This is going to be a long ride.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-65498612231057882902014-10-16T00:13:00.000-04:002014-10-16T00:13:15.666-04:00WordPress Carousel<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKIsEFaHh-sXFjdGncK8cuGjNkor1ReeNAC-AJ2q4jxTLEwKCAuDWNhjM5NSRLrJemw1oOJClf1qLHVNSFzm_WBqsWg84SDoanhEu_TF7tbNBkKtRd23VdHU-eio9NCdK6HjXyvQSJvi4/s1600/Gallery.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKIsEFaHh-sXFjdGncK8cuGjNkor1ReeNAC-AJ2q4jxTLEwKCAuDWNhjM5NSRLrJemw1oOJClf1qLHVNSFzm_WBqsWg84SDoanhEu_TF7tbNBkKtRd23VdHU-eio9NCdK6HjXyvQSJvi4/s1600/Gallery.jpg" height="66" width="320" /></a></div>
I am taking a college class on WordPress. Have not been really doing any coding in the class. So I am not having a whole lot of fun. I planned out my semester project web site. The initial page was going to have an image slider on it. I figured I would use a Carousel plugin for WordPress. Easier said than done.<br />
<br />
I don't know how many plugins I tried. It was at least five. Maybe closer to ten. Lots of them were duds. Yes they were free. But I figured that a carousel was a common item these days. Many times the plugin would not display a single image. Others would display an image or two, but they would not move.<br />
<br />
Finally I found Tiny Carousel Horizontal Slider Plus, also known as <a href="http://www.gopiplus.com/work/2014/06/06/tiny-carousel-horizontal-slider-plus-wordpress-plugin/">tchsp</a>. I will admit that I initially had some trouble getting my images into this carousel. Once I did though, the magic happened. Thank you <a href="http://www.gopiplus.com/work/about/">Gopi</a>.<br />
<br />
I uploaded a bunch of images to my gallery. However I had trouble getting them to work with tchsp, which requires that you enter the image URL. Turns out if you edit the image in your gallery, there is a File URL in gray over on the right hand side of the screen.<br />
<br />
I sure hope the rest of my site will not be as much pain as the carousel was.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-65833070696101474822014-05-17T00:49:00.002-04:002014-05-17T00:49:42.538-04:00Brute Force PHP<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXk9Vh-AHlDEsar4_Vy0PQDqY1GrXoahwunNg_Ssdoybo6n2UO26k4Z8YcVNz33D3rxVeKNHU6yyySsuTt7pN9B1n5zQf_UfavlusJCBhsZ0851i3DP60GBmZ24zGt5sQIwgTb7Fp7y80/s1600/UI.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXk9Vh-AHlDEsar4_Vy0PQDqY1GrXoahwunNg_Ssdoybo6n2UO26k4Z8YcVNz33D3rxVeKNHU6yyySsuTt7pN9B1n5zQf_UfavlusJCBhsZ0851i3DP60GBmZ24zGt5sQIwgTb7Fp7y80/s1600/UI.jpg" /></a></div>
I have long since finished my PHP class. Did a simple game earlier this year where I saved the state of the player to my online MySQL database. Now I am teaming up with a friend to write another database application - The Fan Fiction Database.<br />
<br />
The minimum viable product is going to only have three fields to display, each of which you can query against. My code is doing a brute force analysis of the combinations of entries the user can make. I have an "if statement" for each combination of inputs. They each produce a custom SQL to execute.<br />
<br />
I did do some good stuff in my PHP. It posts back to itself, so I only have one PHP source file. It also detects weird conditions like the database is missing, or there are no matches for your query. I will post the actual user interface in a little while after my partner does her part.<br />
<br />XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-32337612233343284622013-09-05T13:51:00.000-04:002013-09-05T13:51:27.518-04:00PHP Promotion<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh45DxSXKm4KNGAvLg9Xjf5umTVh1Ci72Tkac2AVGJvKO0sn9qm3e7ww37yudMl-4VDL1W1wysSDH2fQSoeRKKNY6gHQobOVsdER9hROuroJt0q2BUw-Utub321L9Y0wMkynj5T4P-Q4Sw/s1600/IEsettings.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh45DxSXKm4KNGAvLg9Xjf5umTVh1Ci72Tkac2AVGJvKO0sn9qm3e7ww37yudMl-4VDL1W1wysSDH2fQSoeRKKNY6gHQobOVsdER9hROuroJt0q2BUw-Utub321L9Y0wMkynj5T4P-Q4Sw/s320/IEsettings.jpg" width="252" /></a></div>
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
<br />
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. XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-16968049847058210292013-07-15T14:04:00.000-04:002013-07-15T14:04:08.109-04:00JavaScript Library Performance Penalty<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGTkMG0WKMELaKlYX5Zpi0HplYd42vRdyHk18ZPQjh2rHghxH2z4V32bBER2-qg4Xq7-NV0YQSu8xZiPCytRDxC3PhQIiumI8XjSGh8OHaa_T28RDZbKLlAIKfXdlkkCby1W3PEFRcKE/s1600/JSlibs.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHGTkMG0WKMELaKlYX5Zpi0HplYd42vRdyHk18ZPQjh2rHghxH2z4V32bBER2-qg4Xq7-NV0YQSu8xZiPCytRDxC3PhQIiumI8XjSGh8OHaa_T28RDZbKLlAIKfXdlkkCby1W3PEFRcKE/s320/JSlibs.jpg" width="320" /></a></div>
<br />
Just checked out a <a href="http://fr.slideshare.net/nzakas/enough-withthejavascriptalready">deck</a> by Nicholas C Zakas. He shares his insight in making modern web pages load fast. Apparently this is not rocket science. These days a lot of JavaScript library code is downloaded before the page finishes loading. Not all of that code is required up front. You should just download what you absolutely need on page load. Then grab other JavaScript library code on demand. Why didn't I think of that LOL?<br /><br />
Luckily I do not depend on heavy JavaScript libraries in my own code. Heck. I sometimes don't even use jQuery. Yes that is a recipe for pain. But sometimes you got to roll with just your own code. Makes for a quick page load time. You are in full control.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-52002682568210253892013-05-31T09:27:00.000-04:002013-05-31T09:27:48.260-04:00Making JavaScript Fast<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoe1lbjL4qYNBbNNy6-YV30vR6GpcfijflznPQoYPFsr3K6uO54TZEPGthXQu8iuYDHunBwBN4EiQiOrJvTspKo58Yc0KZ6UhxY3zDbOE2d2p1rtBZdF1eMlO_i95QrDx7nwyjq0WFVwM/s1600/Mozilla.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoe1lbjL4qYNBbNNy6-YV30vR6GpcfijflznPQoYPFsr3K6uO54TZEPGthXQu8iuYDHunBwBN4EiQiOrJvTspKo58Yc0KZ6UhxY3zDbOE2d2p1rtBZdF1eMlO_i95QrDx7nwyjq0WFVwM/s320/Mozilla.gif" width="320" yya="true" /></a></div>
The good folks over at <a href="https://hacks.mozilla.org/2013/05/optimizing-your-javascript-game-for-firefox-os/">Mozilla</a> have posted many tips on how to make JavaScript fast in Firefox. Many of these ideas can speed up JavaScript on any browser. One interesting point was to avoid a lot of local storage calls. Otherwise your main thread gets blocked slowing everything down. That makes sense. Instead you should access a cache of local storage data that is held in memory. Nice.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-12305567514932909502013-04-22T15:41:00.000-04:002013-04-22T15:41:37.868-04:00XSL Plus Local Links<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxlSVxAqnO8TTjQl3YvenweG7W3leJftRDMZbFjCNLAlxf4e3ktOJb0SPIXQxGxRnZNpXs3oBfqNDAHGMyCD-gxt7EATNgZe5O0PGvhqjc74MpQWJDSQ55-JHYPQWh42B8LG1n95lhPdQ/s1600/Sorting.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" dua="true" height="207" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxlSVxAqnO8TTjQl3YvenweG7W3leJftRDMZbFjCNLAlxf4e3ktOJb0SPIXQxGxRnZNpXs3oBfqNDAHGMyCD-gxt7EATNgZe5O0PGvhqjc74MpQWJDSQ55-JHYPQWh42B8LG1n95lhPdQ/s320/Sorting.bmp" width="320" /></a></div>
We are coming to the home stretch of my XML college class. The current topic of interest is the eXtensible Stylesheet Language. At first XSL seemed a bit confusing. Like XML Schema, it was not a simple topic if you don't know what the heck is going on. Luckily we got a few homework assignments that are driving the points home.<br /><br />
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 <xsl:sort> too. We also needed to show all the raw data, grouped and sorted by city. Another template took care of that in short order.<br /><br />
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.<br /><br />
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.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-36140842093906835002013-04-09T01:43:00.000-04:002013-04-09T01:43:27.457-04:00Almost a Hoodie Ninja<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBJjoZlIgvr4jT5wgwGzizfKoWJ_M5-10GDHXzYRoN_lJRpnWHge4zZTdIXt6l1gbFQvEzzhlXVi29vZ7-RQM6LW7FqPTTdXTn5eX6UEGe_BbJCoEyvizfK3lWWiqA6FPfH9KBbJqsgno/s1600/Hoodie.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBJjoZlIgvr4jT5wgwGzizfKoWJ_M5-10GDHXzYRoN_lJRpnWHge4zZTdIXt6l1gbFQvEzzhlXVi29vZ7-RQM6LW7FqPTTdXTn5eX6UEGe_BbJCoEyvizfK3lWWiqA6FPfH9KBbJqsgno/s320/Hoodie.png" width="254" /></a></div>
<br />
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.<br /><br />
Then I came to the following declaration:<br /><br />
<pre>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.</pre>
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.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-24214345305742287552013-03-26T20:02:00.000-04:002013-03-26T20:02:00.334-04:00elementFormDefault<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR2w0d351yViVQ06PYGeoM0eKreJG9NRtGKvOFF8mUsEQKO8m_12pjplDb1_e1c_BMRt7Yl3dclSYGDfMz5rC7-1NMnBxCpxjBB-5nLEdQYHnFKM_jJS6PWFWCeHWEuU9UiiNDcGZoogE/s1600/Element.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR2w0d351yViVQ06PYGeoM0eKreJG9NRtGKvOFF8mUsEQKO8m_12pjplDb1_e1c_BMRt7Yl3dclSYGDfMz5rC7-1NMnBxCpxjBB-5nLEdQYHnFKM_jJS6PWFWCeHWEuU9UiiNDcGZoogE/s320/Element.png" ssa="true" width="320" /></a></div>
I was working on creating a compound XML Schema document. There was a main xsd file which imported two other xsd files. The problem was in my instance file. I tried to used a prefix for some tags. This worked for tags that were global in the imported xsd files. However the local elements with prefixes did not validate. What the heck?<br /><br />
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.<br /><br />
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).<br /><br />
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?XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-65818700795860915072013-03-25T16:55:00.000-04:002013-03-25T16:56:46.200-04:00Compound Schema Document<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGpIOmcKrLAo4MTthJ1zPckIdAr5mOaLFzZvAxFgzaEkKrnIwAxQgQfFFIfQ05WWVhIavcy2LhVLI1WzQSJXmcc3O7D5-EC401Y4Ou0qTLNPryOfpPR59Z97QMpa_f_y0KnVChsD_wqps/s1600/Compound.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="295" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGpIOmcKrLAo4MTthJ1zPckIdAr5mOaLFzZvAxFgzaEkKrnIwAxQgQfFFIfQ05WWVhIavcy2LhVLI1WzQSJXmcc3O7D5-EC401Y4Ou0qTLNPryOfpPR59Z97QMpa_f_y0KnVChsD_wqps/s320/Compound.png" ssa="true" width="320" /></a></div>
I went to my XML college class last week. We were talking about using namespaces in XML Schema. The instructor showed me a compoud XML schema document. It referenced multiple namespaces, importing different xsd files. Fair enough. Then he showed me the corresponding instance file. Now this thing was referencing the multiple xsd files as well. WTF?<br /><br />
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.<br /><br />
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.<br /><br />
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 <a href="http://www.liquid-technologies.com/Tutorials/XmlSchemas/XsdTutorial_04.aspx">Liquid</a> 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 <a href="http://www.datypic.com/books/defxmlschema/chapter04.html">Definitive</a> XML Schema, although those examples were including other xsd files.<br /><br />
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.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-58755434689093832792013-03-10T23:31:00.000-04:002013-03-10T23:31:28.566-04:00Beware JavaScript Math<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHSzDGWjrMjn378a9Or35Bq5TAOyF8j5qJkeor6s4RvdHO_0lyo6wGysTuWhv-gp3D1qfgGV5sczrUAbJp5Bc5JoaykwPregvQtu9QyAbgs69XdDgar5zFkZ8lqVq5wb2D6nPN6XHGWnQ/s1600/Math.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="265" psa="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHSzDGWjrMjn378a9Or35Bq5TAOyF8j5qJkeor6s4RvdHO_0lyo6wGysTuWhv-gp3D1qfgGV5sczrUAbJp5Bc5JoaykwPregvQtu9QyAbgs69XdDgar5zFkZ8lqVq5wb2D6nPN6XHGWnQ/s320/Math.jpg" width="320" /></a></div>
I am getting heavy into my latest JavaScript project. I am writing a rogue-like game for the web browser. The dungeon is a two dimensional representation. Therefore I am using 2D arrays. That's fine, because JavaScript natively supports them. I am drawing all kinds of ASCII art for the layout of the maze for the dungeon.<br /><br />
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?<br /><br />
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.<br /><br />
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.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-65800679913480392642013-03-10T16:50:00.000-04:002013-03-10T16:50:48.123-04:00JavaScript Arrays<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJMeAwXctiXKnesdoxj4gd0wXoK11Ir_3yG3zFT_AFTrBFF181GQmwjtjAEj8aF-HAjI7ZS77XVXCHSOZfjCr_FzcDFVTfTgR6diTOGBSA1bteFiPEzzd3iEBtfmpGo-3aaYsfqs2QNEU/s1600/Arrays.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="245" jsa="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJMeAwXctiXKnesdoxj4gd0wXoK11Ir_3yG3zFT_AFTrBFF181GQmwjtjAEj8aF-HAjI7ZS77XVXCHSOZfjCr_FzcDFVTfTgR6diTOGBSA1bteFiPEzzd3iEBtfmpGo-3aaYsfqs2QNEU/s320/Arrays.gif" width="320" /></a></div>
I am taking a week off from work to do some training. This will be an independent study. Time to put my JavaScript studies to work on a real project. I needed to represent the floor space of a dungeon. Easy enough. I would just roll out a two dimensional array. I am sure I had done this before. So I kicked out some JavaScript code:<br /><br />
var my_2D_Array = new Array(Array());<br /><br />
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.<br /><br />
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.<br /><br />
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:<br /><br />
my_2D_Array[y][x] = 'x';<br /><br />
Yeah. That looks a bit weird. Don't you usually access 2D arrays like arr[x][y]? Well not in JavaScript. I also had a little trouble getting my fonts to appear monospaced. But that is a story for a future blog post.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-41485154115349210662013-02-26T16:57:00.000-05:002013-02-26T16:57:49.236-05:00Validation<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXNA7gIyb69dfNKfbJXQdvKEv3MajRvkg8VlKCcyj44_HPcaZ8AStbhvIJ_PKa2QnG1v0oS5ww-KN0qDBBTvFmvDb9JIOPDwX5FtjdE5gmDQzpYywN9JkV02ciIsgi0InEnBE1zJwglzo/s1600/Validation.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" gsa="true" height="244" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXNA7gIyb69dfNKfbJXQdvKEv3MajRvkg8VlKCcyj44_HPcaZ8AStbhvIJ_PKa2QnG1v0oS5ww-KN0qDBBTvFmvDb9JIOPDwX5FtjdE5gmDQzpYywN9JkV02ciIsgi0InEnBE1zJwglzo/s320/Validation.jpg" width="320" /></a></div>I am taking a semester long college course on XML. This week we covered Document Type Definitions. I wrote up a DTD for my XML file. Now I was tasked with validating the XML file against it. The browsers did not seem to provide any help. The teacher said we should grab a free copy o XML Spy and get to work.<br /><br />
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.<br /><br />
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.<br /><br />
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.<br /><br />
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.<br /><br />
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.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-76955538221343284822012-11-23T12:01:00.000-05:002012-11-23T12:01:44.918-05:00XMLHttpRequest Access Denied<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimOZbgt9xpzbhcpEKWjpKTWm-EJUyYDTWJClQajyjQQ0aeoeul5a2ybONrRH9ULLdWmDaaHIeZy6aM5abL3rcyrX0LFjugdkKVbyHOtykKP0wc1yoPyfJle9cHgQjZdrYovfX61Fs3OhA/s1600/Access.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="200" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimOZbgt9xpzbhcpEKWjpKTWm-EJUyYDTWJClQajyjQQ0aeoeul5a2ybONrRH9ULLdWmDaaHIeZy6aM5abL3rcyrX0LFjugdkKVbyHOtykKP0wc1yoPyfJle9cHgQjZdrYovfX61Fs3OhA/s200/Access.png" /></a></div>I am trying to learn a little bit of AJAX. The first exerise in my textbook tells me to read a local file and display it. Sounds easy. I set up some code to create an XMLHttpRequest. Creation works okay. Then I try to call the open() method and specify the local file I want to read. Bamm. Internet Explorer says that the access is denied.<br /><br />
I am running Internet Explorer 8. That is the version installed on my computer. First I try changing the security in Internet Explorer. No luck. then I try using XDomainRequest object instead of XMLHttpRequest. Also no luck. This is frustrating because this is supposed to be the easiest exercise.<br /><br />
When I get into situations like this, I try some other browsers. Chrome was no good. But Firefox magically worked using XMLHttpRequest. This really should not be that hard. Isn't AJAX one of those common things that everyone on the web uses? I guess I should try back again with IE when I upgrade to something like IE version 10.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-90470222901544321612012-10-23T23:07:00.001-04:002012-10-23T23:07:28.197-04:00DOM Inspector<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4GqMn4FMRYzA8hnYo5fZKhl35C1X_NiesI_nI98cSv7zqiU777RleMw7puEhNmz5EFD8-1cDxMik2ERelE1w2aa03Z3xXj7iHEFhrgODYHipyNgtDSfGrJEtPTWabHVYcmklfe9yW0IY/s1600/Inspector.jpg" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="196" width="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4GqMn4FMRYzA8hnYo5fZKhl35C1X_NiesI_nI98cSv7zqiU777RleMw7puEhNmz5EFD8-1cDxMik2ERelE1w2aa03Z3xXj7iHEFhrgODYHipyNgtDSfGrJEtPTWabHVYcmklfe9yW0IY/s200/Inspector.jpg" /></a></div>Right now I am reading up on how to manage the DOM using JavaScript. My textbook referred me to a site where I can get a DOM Inspector. That is a tool which shows my HTML in a DOM-like graphic tree. I was expecting something free. However the textbook steered me to a commercial site.<br /><br />
I downloaded a product called IE WebDeveloper. It was previously called the IE DOM Inspector. They have a free 15 day trial period. I am glad I did the trial first. The thing does integrate with Internet Explorer. You see the tree in a toolbar that takes up the bottom half of the browser screen. However I was disappointed with the tree layout. I did not see nodes for my text.<br /><br />
Turns out Internet Explorer version 8 has a built-in DOM Explorer of sorts. You can access it by choosing the Developer Tools submenu under the Tools menu. This brings up a separate window with a better tree that represents the DOM tree I was expecting from the book.<br /><br />
Time to uninstall the IE WebDeveloper trial software. The thing costs $119 for a license. I think I will stick with IE Developer Tools. That's too bad because I liked the integrated interface.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0tag:blogger.com,1999:blog-7651651367637180381.post-34980531468637072672012-10-09T17:16:00.000-04:002012-10-09T17:16:46.440-04:00Image Maps<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3QlvVLtG2W-x2lNeLqIMwwpnPzxULs5khGhjolfz12pFugh5nU3qnn0lHqWpNhyphenhyphenBc4SRxCzQAIvdn9BHyNudC8IaP3AiiaAIU820qOOjlHWI9a6xuVPbvLa9yRQbNybXa12zmZ3ToY38/s1600/ImageMap.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="106" width="96" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3QlvVLtG2W-x2lNeLqIMwwpnPzxULs5khGhjolfz12pFugh5nU3qnn0lHqWpNhyphenhyphenBc4SRxCzQAIvdn9BHyNudC8IaP3AiiaAIU820qOOjlHWI9a6xuVPbvLa9yRQbNybXa12zmZ3ToY38/s200/ImageMap.png" /></a></div>I was finishing up a chapter in my textbook about images. Last example problem in the back of the chapter had us dealing with a image of the solar system. Each planet was to be clickable, generating a pop-up with some words about the planet clicked. I got a nice image of the solar system. Now I needed to come up with the coordinates for the planet areas. What is a developer to do?<br /><br />
The book mentioned some free software that would do the dirty work of coordinate mapping for me. I went to <a href="http://www.image-maps.com/">Image Maps</a>. Uploaded my picture to their web site. Then it was time to get down to business. I had to define eight areas (we now only have eight planets in the solar system). I was a little disturbed when a warning came up that stated, "IE 7 will give a stack overflow error after 13 or 14 rectangle maps." I use Internet Explorer. Luckily I only had 8 areas to create.<br /><br />
I clicked a button and had the HTML generated for me. It was quite painless. Seems like the site is implemented using PHP. They ask for donations, links, or blog entries about them. Being a poor developer, I chose the latter. Thanks Image Maps.XML Homehttp://www.blogger.com/profile/12565590770940217795noreply@blogger.com0