2 posts tagged “xml”
In the midst of programming there will come a time where a certain skill will be incredibly useful to know to solve either a quick problem or a large dawning task. With this are 7 very important skills that every programmer should either learn or already have. Here they are:
1. Regular Expressions (Regex)
2. Structured Query Language (SQL)In the realm of searching, text-parsing and iteration it is all too common for programmers to put together their own form of searching through unstructured data. (By all means, don't fall into this path) It's good that you can figure out how to parse unstructured to slightly uniform data, but there is an easier path. Learn Regular Expressions and your life will be a billion times easier (relatively speaking). Although regular expressions seem ridiculously ambiguous, they provide an important tool in your coding career. Learn it!
- (Here's a powertoy to help: RegWizard)
3 & 4. Extensible Markup Language (XML) and XML Schema Documents (XSD)Information, the very reason technology even exists, will always be as important as the people who are making the technology to use it. It is not only important to understand how to properly model information, but how to query it. Luckily, there is a standard query language that you can use to search for that information of yours. SQL provides the means for connecting information models with the all important people in information technology. Learn it!
- (Here's w3school's website to help: SQL Tutorial)
5. XML Path Language (XPath)Before this technology there was what I like to call: chaos. It was chaotic because the greatest uniform structured format was the dot-slash format. Data was just everywhere. Luckily, the industry finally adopted the XML standard which we all love and use today. XML is a tag < > based format where all data is structured using a tree-node and attribute like structure. With XML you can turn this:
John Doe
11-18-1987
Software Developerinto this:
<?xml version="1.0" encoding="UTF-8"?>
<Person FirstName="John" LastName="Doe">
<Birthdate>11-18-1987</Birthdate>
<JobTitle>Software Developer</JobTitle>
</Person>Giving back the meaning and well-deserved value in information. Not only that, but I and the rest of the developer audience can understand what it is your model is talking about. On top of XML is a schema that we can create for validation. This is called an XML Schema Document (XSD). XSD's are very useful for creating standards for your XML documents and it is definitely a standard that you should learn!
- (Thank you w3schools: XSD Tutorials)
6 & 7. Hypertext Markup Language (HTML) and Cascading Stylesheets (CSS)On top of the extensible tree is another key language in searching through XML-based documents. XPath provides programmers the ability to quickly sort through XML selecting, replacing and rearranging any trees, nodes and data. XPath is not nearly as complex as regular expressions and it looks as if you are searching for a folder on your hard drive. If it's easy, then why not learn it!
- (w3school's website provides an awesome tutorial set: XPath Tutorials)
There are of course other skills that do not involve much technical standards such as: understanding object-oriented programming and having problem solving skills. Most of these with and soft-skills are typically acquired over time with more and more experience in the computer science industry. Ask questions, think outside the box, research other ways, draw a picture, showcase your work, but most of all have fun with it: your brain will thank you for it :)We've come a long way since HTML, the foundation laid down by HTML and CSS has allowed millions of users to create their own websites. The web is a funny place. It can also be an ugly place if you're not careful to understand the proper uses of web markup tools like HTML and CSS. With HTML it's important to note that it is used to give usage with a visual understanding of XML based data. Whether the data involves an address to media or a texbox, the markup allows browsers to output that meaning visually to all the users. A common mistake with HTML is to use it in styles. While HTML does include a way for adding style to your webpage, it limits your ability to change those styles in an instant. That's why it's important to not only learn HTML properly but also learn CSS.
Hello fellow developers, I haven't made a mention of it before, but I've been working on an XNA network library for a little while now. I like XNA GS, but I don't have a subscription to the Creator's Club so I can't really test my projects on the Xbox 360. When the XNA Framework v1.0 came out I was incredibly excited. I had been developing in Managed DirectX up until then so having a framework that takes away all the complexity was really nice for me. The missing component with the XNA Framework v1.0 at the time was networking capabilities. The DirectX team was no longer supporting DirectPlay either so I wanted to make my own networking api for games.
C# TCP Networking
A year or two ago a friend of mine and I wrote a networking api for a load-balanced distributed helpdesk system. I found the api about a month ago under some old folders in a hard drive and decided to shine it up for XNA. Here we go.
XNANetwork handles a few things that you'd normally expect in a networking api. All networking is done through Asynchronous TCP sockets. The api already manages all the sockets for you in the SocketManager, complete with thread locking. Although the topology seems to be Client-Server bound, you can really use the api to create any type of networking system: P2P, Client-Server, or even Distributed Servers. I can vouch, my friend and I have used the api in all network topology scenarios.
There are a still a few things that I'd like to put into this api. One being UDP (or even a real-time protocol) socket connections instead of TCP. But I figured the effort in putting together the repackaging, the out-of-order transfers... it's just to much work right now. So, UDP aside, it works substantially well in managing most of everything you need in a networking api.
Because of my previous work, I had to have all my messages in XML form to ensure valid messages were being sent back and forth, not to mention the encryption layer. For the sake of this article I have left out the encryption layer. On top of the XML, there were many different triggers in the system that needed to occur, and I needed to find a way to add triggers without the hassle of changing components. So, I wrote a library called GSS.
GSS is a simple command messaging syndication that allows different commands to be event driven. Every command has it's name and an array of possible parameters. When you start your project, you can register commands into the GSSManager by the given name and a delegated callback method for that command. You can also use the GSSEnumerator to register an entire enumeration of commands. The Interpreter handles all the the conversion and delegated executions. Just create a new interpreter, and work from there. It's pretty straight forward.
But, in case you don't want to use XML, which in most cases you may not, you can transfer your items with straight byte conversions with in interface called ITransferable. This interface is in the XNANetwork which I'll discuss now.
Session
XNANetwork has a class called Session. Within this class you can make a call to Session.Create() to create a new local "server" connection on the default port 2093. When you want to join a network you simply have to make a call to the Session.Join method. The only downfall at this point is that I haven't implemented a simple registration service like Xbox Live has. So joining by nickname does not necessarily work at all at this point.
Because of this, in order to join networks you need to use the GameClient class instead. When you create a new game client you need to pass the server that you plan on joining and the port to connect on. Here is an example implementation of my networked game client.
There are plenty of improvements that could be made to this api. My largest concern with this api is dealing with three major networking issues: latency, packet loss, and bandwidth throttling. The networking api, GSS, XNANetwork, MasterServer and network client are all included in the download.
If you plan on using this library please let me know as I would love to give or get insights on this project's current state.