Over the past few weeks I’ve been working hard on several courseworks and revising for several exams. One of the modules I’ve enjoyed the most has been Networking and Web Technologies.
The coursework was split into two stages. The first of which was simply entitled Networking — in this section we produces a command line client which could interact with both our lecturers server as well as one we later made ourselves. The client could send information to the server about the whereabouts of a staff member using their username and a string of text explaining their location. Simple stuff, but very satisfying to implement from something as simple as a socket connection. The server we made, which ran on multiple threads to allow over 10,000 people to connect at once, then collected this data, stored it in an XML file and could send the data to any client that asked for it. All good stuff, as Rob Miles would say.
I received a grade of 80% for my implementation of the console based applications, which I was happy with.
Today I demonstrated part two of the coursework, entitled Web Technologies to my lecturer. In this second part we had to make an application, either in PHP or ASP.NET which handled all of the same things the command line server did in part one, but better. I chose to do it in PHP as I have years of experience with the language.
The final result was a website with the following features
- A Microsoft SQL Backend Database
- The ability to add, delete and edit entries from a form
- Validation of all inputs on server side
- Parameterized queries to stop SQL Injection attacks
- A responsive design so the site looks different, and better suited, on tablets and mobile phones
- An API which any client which can send HTTP formatted POST or GET requests can use to add edit or query a user’s location
In the end I was awarded a grade of 100% for part 2! I couldn’t be more over the moon.
I have an exam on Tuesday for networking, which will be the final of the 3 parts. Once I know my grade for that and the exam overall I will of course update the blog
On monday I took an exam for module 08227 – Advanced Programming.
Questions ranged from being about C++ Syntax, the different ways to traverse a binary search tree to the different uses of difference types of class inheritance.
I’d spent a long time revising before the exam and was confident I would do OK, however I was still pleasantly surprised when I found I achieved a grade of 90.85%. This is a stark improvement over the 75% I achieved in the last Advanced Programming exam, obviously my hard work is paying dividends!
I am still awaiting the mark for my Advanced Programming coursework, once I have that I will of course update the blog with both that mark and my mark for the module overall.
(For some reason the screen recording software I used has made it look like there are framerate issues, there aren’t!)
Last week I submitted and demonstrated my coursework for module 08214 – 3D Graphics and Simulation. You may have seen a very early version of my coursework in my previous post, but here I will explain what the coursework involved and how I achieved it.
The coursework brief was to make a tech demo in OpenGL 3.0 or above — showcasing lighting, 3D collision detection, texturing and our understanding of shaders and the OpenGL Pipeline to make an efficient simulation.
The tech demo had to include a column which was made up of 4 different boxes, optionally each with their own texture. In each cube was a different element of the simulation. In the top cube there were 3 “Emitters”, displayed as boxes made out of lava which emit balls made out of Gold, Aluminium or Copper at random intervals.
These balls, using the Fourth-Order Runge Kutta method, have the effects of gravity applied to them and fall into the cubes below, the first of which contains 4 Axis-aligned cylinders. Axis-aligned just means that one of the sides is in alignment with the plane in which it is on, for example the cylinders which go from the left to the right of the column are X-Axis aligned. The cylinders that go from the front to the back are Z-axis aligned. The balls collide with the cylinders and react in a semi-realistic way, bouncing off and seeing the effects of entropy on their acceleration.
As the balls move steadily down they enter the third cube which contains 2 non-axis aligned cylinders. These cylinders have no sides in alignment with any plane, this makes collision detection more challenging.
In the fourth and final cube there is a large pulsating sphere, known affectionately as the “Sphere of Doom”. If a ball collides with the sphere of doom it is slowly shrunk, losing mass and size, until it no longer exists or until it comes out the other side. However, all balls are disposed of if they hit the bottom of the column.
As well as colliding with the column itself, the obstructions within it and the sphere of doom the balls can collide against each other, when they do I work out their mass from their volume (which is randomized at emission time) and their density, which is based on their metal type. The mass is then used in the calculation to see where each ball should go.
As you can see from the video at the top of the blog post I also implemented special cameras which take you on a tour through the simulation, as well as both ambient and directional lighting with specular, diffuse and material-based effects added.
When I demonstrated this piece of work to my lecturer I received a grade of 90%, and as the module mark is 100% based off of this coursework that means that, subject to acceptance of marks from the exam board, I have achieved 90% in this module. I’m over the moon.
Obligatory xkcd Comic
Standards are one of the things which makes writing software a bit of a pain, but also allows the pleasure of writing a system which integrates, uses and enhances other systems. Indeed the Internet Browser you are reading this blog post on works using a multitude of standards, from the Internet Protocol and Transmission Control Protocol used to deliver the information to you, to the HTML and CSS used to render this web page on your screen.
For those people who are not entirely familiar with the term standards, a technical standard is — according to wikipedia — a “formal document that establishes uniform engineering or technical criteria, methods, processes and practices”. In laymans terms it’s a document that tells you how something works and how to implement it so that your implementation is compatible with other peoples. An example is RFC 2616, The W3C Standard for the HTTP/1.1 protocol.
Standards, in theory and most of the time in practice are fantastic, why invent a new way of guaranteeing the delivery of a packet over internet protocol if there’s already a standard written by a group of intelligent people who have tried to find and fix every edge case and is compatible with everyone elses system? There is no point.
The only time real issues do occur is when there is an edge case that hasn’t been thought of by the author of the RFC, or the standard is implemented incorrectly – either on purpose or by accident.
How strictly should we adhere to a standard?
The motivation behind for blog post was found when doing my coursework for the “Simulation and 3D Graphics” module in an API called OpenGL. I had written a program using OpenGL 3.0 on the computers in the Fenner Computer Laboratory in the University. However, when I went to the ITMB Computer Lab in the next building my code produced a completely different result. You can see the stark difference below.
The image on the left hand side is what I had been seeing as I engineered my code in the fenner laboratory. A column — textured with some “Epic Faces” — with a spotlight-lit sphere inside it. I’ll explain what the purpose of all this is in another blog post. On the right hand you can see what appeared using exactly the same code in the ITMB Lab, precisely nothing.
After many excruciating hours of searching — with some help from one of my housemates — I discovered the bug was being caused by me attempting to call the “glEnableVertexAttribArray()” method on a uniform member of a shader, something which you’re not meant to do, or indeed allowed to do in OpenGL. I had made a programming error, as every Software Engineer does many times a day. What is especially bad here however is that I wasn’t informed of my accident, either by error or by the thing simply not working.
Looking at the above image you may think that the Fenner Computer, using its Intel Graphics card, was “right” because it displayed the 3D objects I wanted it to. However, I would disagree. The AMD Graphics card on the ITMB Computer actually produced, according to the standard, the correct result. Nothing. Had I been working in ITMB when I produced the code I would have noticed that adding the glEnableVertexAttribArray() line broke everything, and would have immediately removed it, working in Fenner gave me a false sense of security that my code was in fact OK.
So, as far as I can tell this leaves us with a few options.
- We should say that in order to claim to implement the OpenGL standard, Graphics Card Manufacturers will have to write a, and work with a standard of how strict their implementations are, I would suggest that all graphics card manufacturers stick directly to the specification and throw exceptions or GL.ErrorCodes or display nothing on screen if there is an issue
- We write into the specification exactly what should happen in every possible edge case involved with the specification (this is obviously impossible)
- We don’t agree on a level of strictness and we waste countless hours of programming time, as we do at the moment
I sincerely hope that eventually number 1 happens, but I’m not sure how likely it is.
Should we ever add proprietary elements to a standard?
Another issue with standards its that sometimes they don’t fulfill everyone’s use cases, in other words they don’t allow everybody to do everything they would like. For example the body of standards used to make up web pages don’t allow websites to run executable code, such as c++ binaries, natively. This lead to things such as the much despised ActiveX control and the slightly less despised Java Web Applet.
The issues associated with this are many
- Users have to install an additional piece of software before they can enjoy certain functionality
- Users then have to ensure this software is up-to-date and manage it properly to avoid security failures
- The fact these downloads exist allow other people to fake them, allowing easier drive-by-download attacks.
I would argue that if we are ever using a standard, or claiming to use a standard we should endeavour to never add to it ourselves. Instead, the correct course of action would be to write a Request for Comment (RFC) and implement the feature in your browser or program, but have it turned off by default. This way develops can turn it on to test it and play around with it, but they won’t become reliant on a proprietary features to implement their solution. Everyone wins. Thankfully most of the browser makers are going this way, so the HTML5 and associated specifications shouldn’t be too fragmented.
Worried about the future
As mobile browsing is becoming more and more popular at a tremendous rate more and more websites are aiming to make mobile friendly sites, either by making completely separate sites such as http://m.bbc.co.uk/sport or by using responsive designs such as the brilliant one which is used at https://www.gov.uk/. Whilst I can do nothing but encourage the development of mobile sites, especially if they have feature parity with the desktop sites and have a great touch-centric UI, I am worried that history is repeating itself.
Sites famously used to have landing pages which said “Works best in Internet Explorer” or “Works best in Netscape”, this is because often those websites would use proprietary features from either browser, for example gradient backgrounds. Unfortunately, because the two major mobile operating systems, Android and iOS, both use WebKit rendering engines to render HTML, CSS etc content mobile website developers are not only utilizing proprietary features , but actually relying on them.
Though the sites don’t show annoying images that say “This site works best in webkit” the result is equally annoying — a substandard browsing experience for anyone who uses a browser which doesn’t use a WebKit rendering engine, examples include Opera Mobile and Internet Explorer.
Developers, learn from the past, and if you can at your organisation have a standard for implementing true standards!
You may remember a very similar Blog Title from a week ago, saying that version 2.0 of Hull CS Blogs had been released for Windows 8. After some feedback from Rob Crocombe and noticing a few things that irritated me I have made a few minor improvements and released version 2.1, which you can update to from the Windows 8 Store or download from here.
- Changed the name on the Start Tile from “Hull Computer Science Blogs” to “Hull CS Blogs” for Aesthetic Reasons
- Added the label “Latest Blog” above the latest blog on the home page, so now the blog title on the picture has more context
- Improved performance on caching, meaning the initial start up of the app is much faster
- Added “friendly dates” to each blog tile – e.g. “2 hours ago”, “3 Days ago” or “1 month ago” rather than “16/03/2012 16:45″
- Made it so you can see who Authored each blog post on the main page
- Improved UI for Split Views
- Fixed a bug where the Latest Blog sometimes wouldn’t appear
I hope you enjoy the application! Please rate and review, and don’t hesitate to get in contact if you have any bug reports, ideas or feedback!
Today I was looking at the newly revamped developer dashboard on www.dev.windows.com where you can see a lot of stats about the applications you have uploaded to the Windows 8 Store. Whilst I was having a look round I noticed that you could see which web pages linked to your application in the store. One of the websites which had given my app the most “hits” was one called Fractus Learning.
I thought I would head over to their website and have a look at what they had to say about my application and I was pleasantly surprised to see that they had written a list about the Top 10 application for Students and Teachers, and my app featured at number 8 — how apt.
In particular Fractus said the app is:
Ideal for older students, The Solar System Simulation allows users to explore the affects of gravity on land masses in space.
I was especially pleased with this after reading what Fractus are all about:
Fractus Learning is a growing team based in Dublin, Ireland working with educators around the globe to promote cutting edge technology skills and tools. We strive to build amazing learning environments where students are engaged and inspired and classrooms that are a joy to teach, work and learn in.
Our goal is to motivate, excite and enhance the teaching skill set with the use of technology, making sure educators are always on the cutting edge.
So you could say they know what they’re on about!
Thanks Fractus, look out for some excting updates to the simulation soon!
I was looking at the statistics for my Windows 8 Application, Solar System Simulation, the other day when I stumbled upon a review by someone who goes by the name of ”vikram” from the United States:
Review Title: I found it so useful
Helped me teach solar system concepts to my 5yr old
I must admit it made me smile thinking that I may have helped a father or mother teach their child about the vast expanses of space Even if the “simulation” isn’t incredibly accurate it’s nice to see its useful on some level.