Recently I decided to dive deep into REST services because of how prominent they are becoming in the industry. Nearly most of my coding time is spent figuring out how to take one piece of software or code and connect it with another piece of software or code to produce the expected result. RESTful web services are a great way to take a generic design such as Json or XML and come up with a standard library to talk to any system. If you aren’t familiar with REST services, they are a simple form of HTTP communication that takes basic HTTP commands: GET, PUSH, PUT and DELETE and translates them into CRUD operations.
What does this all mean? It means that you can call a website through a standard website client and treat it just as if you were hitting a data source. Pretty neat huh? A large chunk of the REST services out on the market now deal in Json with support for XML. Json is a nice language that allows for dynamic object design without having any formal definition. If you want to add a field, you add it. It is very extensible and light weight allowing for quick and scalable data operations.
So how does OAuth play into all of this? OAuth is a system that allows you to connect your application to another application in a secure fashion. To start out, you give your application an ID. This is sent to a service in the form of a request for access, and the user who is using your application grants what access they want to give. Once granted your application gets back an authorization key which it uses to make future calls. The beauty of this system is it puts the security and functionality of the application in the hands of the user and the end service. All you need to worry about is what your authorization key is and how what services you should be calling at a given time.
My goto library for this type of call currently is called RestSharp. This library is a REST service library built out for everything we are doing here. Here is an example of how to create a client and make a call:
Dim auth = New RestClient(SiteURL)
Dim rqst As New RestRequest("wc-api/v2/orders", Method.GET)
Dim rtn As RestResponse
rqst.RequestFormat = DataFormat.Json
auth.Authenticator = New HttpBasicAuthenticator(ConsumerKey, ConsumerSecret)
rtn = auth.Execute(rqst)
With this call, you are reaching out to a popular WordPress plugin called WooCommerce to get a list of orders and returning back the HTTP response. This response will be in a Json string that you can parse using the popular Newtonsoft library. The request has all of the standard CRUD operations as well as numerous authentication libraries on top of OAuth. For more details information about REST services or OAuth, check out the standards page here on W3C.
Microsoft Office to be given open source standards
Here’s some great news for Microsoft users: the next version of Office has been altered to include open source technologies. The company have opened up Microsoft Office 2013 to fully support the Open Document Format, for PDFs and variants of Open XML. According to Jim Thatcher, principle program manager lead for Office standards, the next version of Office “will support strict Open XML and Transitional Open XML, ISO 32000 (PDF) and OASIS ODF 1.2.” This move could have been due, in part, to the fact that both LibreOffice and OpenOffice have both been backed by ODF for a while, which may have put pressure on those in charge of Microsoft Office.
The movement towards open ODF has not been a fast process. It has been simmering along for around six or seven years, so the fact that it has now come to fruition is an exciting development.
Electronic paper archives have increasingly come into focus over the years and now it is very useful to be able to have access to them. As well as this, Thatcher has talked about Microsoft’s plans to make it so that PDF’s can be edited as though they are Office documents. This is being called the ‘PDF reflow’ and would mean a drastic change in the way people work with PDF documents and the features that they boast. Thatcher has made it clear that this is not designed as a replacement to Adobe Reader or Acrobat, however it will no doubt prove to be very useful.
Office 2013 is expected to be formally launched in early 2013, however a fixed date has not yet been set.
Well, what a touchy subject this might be to some people. I have always seen the battle go back and forth between Windows, Macintosh and Linux. Windows being a middle-tier price range which excellent performance, Macintosh being the high end simply from marketing and Linux being the low end cost point which the most potential. The problem I have always seen is that Microsoft holds the middle share which is always the most used share. I have been a Microsoft developer for my entire career and I love it to death, but the power behind a Linux machine is starting to become hard to ignore. Recently I ran into a project that was faced with spending 100 hours developing a communication platform for a piece of software or somehow getting .NET hooked into a Linux server.
Of course we went both routes as with any project whichever option is the best is the choice, but something has to work. I came across this plugin for Apache and Linux called Mono. Mono is a plugin/server application that lets you run ASP.NET applications on your Linux server native. You do not have to get pushed to another server or lose your performance, you simply install the package and configure it in Apache and you are up and running. To start, here is the mono website for you to check out and hopefully spread out through all of your Linux servers: http://www.mono-project.com/Main_Page
Hopefully you all install it and configure it so when I come through I can install my applications on your server and be just fine and dandy, if you don’t I will no doubt make you do it There is a set of install instructions for each server type including Mac servers as well as CentOS, Ubuntu, Debian, etc. Mostly it seems to just be a package installation through w-get or whatever your package flavor is. After configuration you can use this site to configure virtual directories: http://go-mono.com/config-mod-mono/Default.aspx
The nice thing about this configuration generator is that you can create a separate config file for each virtual directory and include them in your base httpd config file under each virtual host settings section. It is almost exactly like creating virtual applications in IIS and the performance is for the most part the same. From what I have seen this far, .NET 4.0 is supported as well as AJAX, and I am hoping to see some more stuff go into the project to make it a viable option for hosting .NET applications. Cheers!
When writing an Android game one of the first things I had to start looking at is the methods provided for drawing. Being that I had no real purpose for developing a 3D game, I decided to go 2D. There are many things that a bitmap can do for you in regards to saving you development time, but the game platform that I am pursuing next did much better with mathematical drawing.
This brought me to searching out the object that I would use to display colorful shapes that I chose at specific window positions. The first object I have come across to do this is the Canvas. A Canvas can be accessed by overriding the OnDraw method of the Android View object. A View is an object that you place in your layout to indicate UI functionality. While there are many methods in the Canvas that work well for drawing, I focused in on two of them which were drawLine and drawRectangle.
In my example I went through a few iterations to figure out screen width and what I should do with it, but ultimately I started focusing in on using a percentage of the screen with as opposed to using hard coded numbers, as it scales better on landscape mode if you go back and forth between portrait. Ultimately I came up with a method that looks like this to draw a block on my game:
This method draws a solid block of color at the position that I calculated. To get the m_Canvas instance I set it in my onDraw method and then call down to my game methods to draw the object on the canvas. The other method that I use is the drawLine method which looks like this: