Sunday, 31 January 2016

Assembly

During our Lab 3 in class we were assigned the task of learning more about how Assemblers work and what they are used for. First though we had to learn the differences between X86_64 Register and aarch64 Register. It's interesting to see and take away the different design philosophy that each platform decides on.

An important thing to note is the differences and the similarities. For example, ARM instructions are RISC (Reduced instruction set computer) like instructions. The benefit is that instructions are all very simple and fixed length. X86 has more complicated instructions as it is CISC (Complex instruction set computer).

For the lab itself, the task required building a simple program ran in x86_64 and aarch64. The program first had it looping from 0 to 9 but by then it had to be 0 to 30. I'm just going to focus on the x86_64 portion of the lab, as the logic for one, was same for the other, just with minor tweaks I'll elaborate later on.

The main differences between assembly and higher level languages for me are:
  1. Symbols
  2. Keeping Track of Registers
  3. A Different Way of Thinking

 

Symbols

Although the program is simple in nature, it still taught me the basic learning blocks for what more complicated programs will ask for. It is important to allocate memory without the need of moving it for later. Symbols make sure all of this corresponds to the correct memory addresses, registers or other values.


Keeping Track of Registers

I found it very unique how registers are handled. They help speed up the processor operations with internal memory storage locations. The only problem and challenge is that there are so few registers to use. I am assuming later on you will need to dynamically point to memory storage instead of just using registers but that is still yet to be seen. It will be interesting to compare these thoughts later down the road as I learn more in SPO600.


A Different Way of Thinking

If the task was asked for in a higher level language, it could be finished in a few lines like this psuedocode suggests:
for count in range(0,30):
        print "Loop:" + count

But this was a bit more complicated. For example, although counting out looud in your head pass 10 is simple, for assembly doing this in ASCII isn't simple. Instead we had to take the number, divide it by 10 using an instruction, taking that reminder and displaying it.


Sunday, 17 January 2016

Code Building

GNU Units

The first software I will be compiling is the GNU Units and it uses the GNU License. After I installed the file through FTP and unzipped and untar I found there was no makefile at all in the directory. I wasn't sure what the issue was:










I thought maybe I had to do ./install-sh but was perplexed why it wouldn't work(I assume that should have at least done something as it was an executable.) I had then noticed the INSTALL readme file and opened it up to see what to do.

After reading through the documentation everything had work and I was able to run units correctly. The configuration and make both took very quickly, less than a few seconds even though the documentation said otherwise.

LUA

The next software I installed and complied is Lua and it uses the MIT License. The installation method was easier as the make file was already inside the directory. The compiling had some issues.


After googling the fatal error issue I discovered the problem was that I had to install the readline development library. After doing so, the project was able to install correctly.


Open Source & Contributing To Software

This post will briefly speak of two open source software packages that anybody can contribute to and how it can be done.

parsedatetime Library

The parsedatetime library is an open source python library able to parse human-readable date/time strings  and can be obtained at https://github.com/bear/parsedatetime. It supports many different types of date formats. I've used the library before in the past for personal projects and I've always found no matter the string, it's able to come out ahead with the correct parse. The license for the project is the Apache License.
  1. Go to there issues tab on github to see any problems with ongoing development. https://github.com/bear/parsedatetime/issues
  2. To contribute a patch, make a "pull request" through git for the issue. 
  3. Wait for the author to comment and review your proposal.
  4. If thoroughly review and approved, the project author will merge the pull request.
The author will respond very quickly and the pull could be added quickly if he approves. Even in the same day sometimes. Other times, bugs or problems will be cataloged for others to go through to fix themselves. Although the project is very thorough throughout the years, there are still edge cases here and there that the author needs help fixing.

jQuery

jQuery is a JavaScript library designed to simplify the client-side scripting of HTML. jQuery is the most popular JavaScript library in use today. I have personally used it many times while working for clients who required intricate details for their web projects. It can be obtained at https://jquery.com/. It uses the MIT License. To contribute:
  1. Go to https://contribute.jquery.org/ 
  2. Through the side menu decide whether you want to contribute to:
    • Bug Triage
    • Code
    • Community
    • Documentation
    • Support
  3. You'll need to establish the need for a fix or feature.
  4. Discuss the ticket with the team
  5. Create a pull request
  6. Respond to code reviews and wait for it to be accepted.
When contributing, it's important to follow the style guide found here https://contribute.jquery.org/style-guide/ and to make sure unit tests are added. The community itself has many ways to support through forums or even Meetups. This is a quick and easy way to join an open source community.