Month: February 2017

Home / Month: February 2017

Going Evil

February 28, 2017 | Linux, Open Source, Web Development | No Comments

Spacemacs Startup

OSD600 Week Seven Deliverable

Introduction

I have been a vim user for about two years, most of that time dedicated to simply learning how to exit the application. But all jokes aside, I’ve been using this editor for 90% of my projects and can say with confidence that despite its perverse editing modes, my continuous failures to execute the correct command -by hitting the key right beside the desired target mind you, I am proficient enough to navigate a document and develop. This week, I decided I wanted to see what it was like on the other side of the editor war. This week, I went evil.

(Emacs + Vi) == Evil?

The reason why I had chosen an Emacs variant instead of a more modern text editor such as Atom, Sublime, Visual Studio Code, or even Notepad ++ for that matter was because I had developed a growing appreciation for keyboard-centric workflows. Though they above may be more inherently powerful and visually appealing, it was their reliance on a mouse for navigation which deterred my interests. Having used Atom in the past, I can say it’s a brilliant editor and capable of many feats which would suit many, I simply wanted something else.

Doing research for the next editor led me straight to the Emacs project called Spacemacs, which is regarded as the best combination of emacs and vim functionality under one roof. Magnificent. This allowed for VIM users to migrate over or experiment with the other side, without losing precious memorised shortcuts. The inclusion of a extensible vi layer resulted in the term ‘EVIL’ mode.

Space Macs Logo

Luckily, with my pride screaming ‘learn emacs’ editing patterns, the excellent vim-to-spacemacs documentation found here allowed an easier transition than many YouTube tutorials could ever. One of my ambitions had always been to move to a terminal-centric workstation entirely, and I felt that this unique change could bring me closer to evaluating how useful that type of workflow could be. Regardless, back to the topic at hand.

Common Commands

Thanks to the documentation referenced above, and this to-the-point command guide, the initial using of spacemacs wasn’t overly daunting. I promised myself that I would learn the Emacs way of editing, and that’s what I intend to do. Switching over the editing mode from hybrid to Emacs gave quite the nightmare of an experience, resulting in twenty minutes spent learning just how to exit the current file without saving so that I did not ruin the file itself. Needless to say, I will have to ease into an Emacs-only workflow.

Taken from the guide, here are some common commands that I found very useful and would help any newcomer to spacemacs / emacs to get off the ground. Note that SPC ‘leader’ key, and can be configured to your individual preferences, furthermore M-x is simply hitting the leader key twice, which prompts for a contextual command.

Description of Command Command
Access Documentation SPC h SPC
Access Configuration File SPC f e d
Fuzzy File Search SPC f f
Open Recent File SPC f r
Save Current File SPC f s
Open current directory in dired SPC f j
Git Staging Area M-x Magit-Staging
Git Status M-x Magit-Status
Buffer List SPC b b
Kill This Buffer SPC b d
Kill Other Buffers SPC b m

Week Impressions

Compared to Vim, Emacs and its variants load much slower, often exceeding 5 seconds in difference compared to Vim’s instantaneous startup. This though, is also to Spacemacs credit, due to the 205 extensions that are built into the application. I also learned very quickly that for my workflow, I had to open Spacemacs with the -nw argument to stop the opening of a separate window specifically for the Emacs instance. Once these two differences were adapted to, I realized how useful having a terminal instance of Emacs open at all times. Using it allowed for various functions common to a text editor, along with a well rounded plethora of non-editor centric possibilities including access to shell commands using SPC !, git commands using the Magit addon, and even a todo list using the org mode extension.

Git Status in Emacs

While working on my contribution to Thimble, I managed to do 90% of my average workflow without the leaving Spacemacs. Furthermore, the stock configuration for spacemacs is quite ergonomic for the home row enthusiasts and touch typists alike. Needless to say, I was impressed with this not-so little editor. While writing this post, the one wish I hoped to discover next from the Emacs strand was how to create temporary scratchpads for basic text input. This was easy to discover, with the shortcut being SPC TAB which would take me to an alternate buffer which was by default, a scratchpad. My only gripe, which I encountered while using the platform was that I could not copy any text to my clipboard from the terminal window. Emacs has supported copying to clipboard from it’s GUI application since the very start, but alas the terminal variant provided no such feature. Other shortcomings and victories are outlined below, so let us keep going through this adventure in the editor’s version of no man’s land.

Common Workflows and Features

Below, I discuss my findings which I did not cover previously. These are based on a preset list of ‘How do I do …’ styled questions. With that being said, keep in mind that with Spacemacs, there’s hundreds of different workflows for each task -each relying on different extensions, shortcuts and lots of lisp.

Language support

Spacemacs supports many languages out of the box, but can easily extended to provide support for newer languages including Swift 3, Go, and Scala. Extensions are the responsibility of the developers, meaning that not every language supporting add on is complete, correct, or even compliant with the coding standard of said language.

Linting

Though I was still learning the ins and outs of spacemacs, I did come across Flycheck, which is a linting extension that can support many languages natively, or through additional extensions such as jslint and pylint for JavaScript and Python support respectively.

Beautifiers

Again, another feature that I had yet to come across in my workflow which resulted in research. This time, one of the most popular Emacs plugins for this type of task was Web-Beautify. Fully customizable, this plugin supported HTML, CSS, JavaScript and JSON files with ease.

Themes

Without listing the dozens of weekly updated websites showcasing user themes, one which became very relevant to me when I wanted a change from the default spacemacs-dark was Theme Gallery, which showcased all of the included ‘Mega Pack’ themes that could be included in Spacemacs. The best part I’ve found so far, is that SPC T n command which, when configured properly, will cycle through your themes in a specified order. Some have even extended it to instantly cycle based on the time of day. As I write the blog, I’m currently a fan of the sanityinc-tomorrow-eighties theme, which I’ve substituted with the wombat theme since the theme mega pack addon include 103 extra files to download every time. Wombat has more contrast in my opinion, which makes readability much simpler. The default spacemacs-dark theme is great as well, so I’ve included below a picture describing the wombat theme.

Wombat Theme

Syntax Highlighting

Though not as impressive as modern IDEs, capable of highlighting variables and objects with ease, Emacs -similarly to Vim, instead highlights what many refer to as lexical highlighting, which catn be described much better by Wilfred Hughes. He then, goes on to explain other syntax highlighting styles all of which emacs is capable of, along with citing another article by Evan Brooks. I’m currently looking into adding a performant semantic highlighting package to my spacemacs configuration, with rainbow identifier being the first package to test. You can see below of my (badly coded) example show casing the default syntax highlight methods of Emacs.

Bad C Example

Spell checking

A feature which many editors struggle to utilize well, and more so a task which has escaped the radar of many programmers alike, you can bet there’s functionality for those who oppose such disregard for the essentials. Built right into the base of spacemacs, spell checking is only a few keystrokes away.

Feeling Sublime

An editor that I rarely used -simply because I seem to have the mindset which opposes the norm, was the Sublime 2 text editor which is regarded by many as the the modern day end-all, and be all of text editors. Former colleagues swore by Sublime 2 for diverse strands of Web Development, while others advocated the tool for languages such as C++, Python and even Swift. I felt, since I was already trying to shift my workflow to a different editor, I may as well experience what this editor has to offer as well.

Sublime 3 Configuration File

In comparison to spacemacs, Sublime’s defaults date it quite a bit in my opinion, which had me circling through the pre installed themes quickly. Luckily, the theming community is even stronger in contrast to Emacs, and so I found the best version of Tomorrow Night Eighties I could. Now I could actually use it. Restarting the application reopens your previous session, which is a great convenience compared to Vim’s lackthereof knowledge of your sessions and projects. The power to reopen dozens of files, an entire project folder, and even the kitchen sink, in a matter of seconds was a task I never thought possible while using Atom,  Vi, or Spacemacs for that matter.

Plugins, Plugins, Plugins.

Firstly, I cannot explain why I had avoided sublime for so long. The community, plugin support, and general atmosphere of Sublime is what I thought many editors should be like. Simplistic, and Inviting. Even for basic note taking, this editor is capable of providing quite the pleasant experience for the most mundane of tasks. That being said, this editor would also be nothing amazing had the developers turn the other way and not implemented thousands of plugins for your individual workflow. Instead, the plugin package-control is overflowing with potential listings which make or break your styling of working, improving productivity, reducing keystrokes and even a working snake game. To makes things simple, I’ve included after this part a nice table with ‘must have’ plugins and little oddities.

Plugin URL Description
Sublime Snake https://github.com/jonfinerty/sublime-snake Snake for Sublime Text 2 & 3
Package Control https://packagecontrol.io/ A package manager, which many claim should be the defacto standard bundled with Sublime.
Git https://packagecontrol.io/packages/Git Git integration with the Sublime Terminal
SublimeLinter https://packagecontrol.io/packages/SublimeLinter Linting code is a way to ensure my code is cleaner and more bug-free.
Markdown Preview https://packagecontrol.io/packages/Markdown%20Preview Preview and build your markdown files quickly in your web browser from sublime text 2/3.
Anaconda https://packagecontrol.io/packages/Anaconda Anaconda turns your Sublime Text 3 into a full featured Python IDE.
PlainTasks https://packagecontrol.io/packages/PlainTasks An opinionated todo-list plugin for Sublime Text (2 & 3) editor
Jedi Python https://packagecontrol.io/packages/Jedi%20-%20Python%20autocompletion SublimeJEDI is a Sublime Text 2 and Sublime Text 3 plugin to the awesome autocomplete library Jedi

Snake Plugin 1

Snake Plugin 2

Snake Plugin 3

Conclusion

Without sounding like one obsessed with learning new tools, I can say that I have tried as many editors as I could. Regardless of the strengths or weaknesses, I flocked back to VIM within the weeks, updating my configuration file with new needs and lessons. It’s only been a week at the most, and I still have barely learnt enough to be confident enough to truly utilize Emacs platforms for my text editing. I think, this also lends itself to the fact that without the Evil layer, I’d be hopelessly lost with no safety nets. I’d love to continue using Spacemacs for my programming needs, but I certainly will have to learn a few shortcuts more and optimize the loading time which as of this moment, exceeds 5 seconds.

On the polar opposite of the speed spectrum, I found Sublime opens files and various instances within milliseconds of the enter key being hit. Even on an older Core 2 Duo machine, Sublime is very quick to launch. Having used Atom in the past, I could see similar shortcuts surfacing, and a package manager as robust too. One complaint that I had, was how quickly Sublime would begin to lag when working on thousand lined files. Though I rarely touch such large files, the requirement of having an editor which can navigate such large files becomes an must-have essential.

I’m at a standstill, caught between the platforms of the old monoliths, and the new modules. Between Spacemacs, and Sublime. Regardless of costs, feature sets, or ideologies, both editors provide everything you’d ever need. Having to choose one above the other, I’d have to go with Sublime if it were for quick edits. Every other task would benefit from Spacemacs once properly configured. Why? Because I believe that an Emacs platform with an open project is capable of much more in less time -using only a keyboard, than Sublime would be even with a mouse.

Part 2

Google Keep

Using Google Keep as my exclusive note keeping and organizational platform has been a mixed bag, one of which I had learned quite a bit of my own preference and annoyances when it comes to software. For one, Keep does not have a dark theme (this is easily remedied by changing css, or using a web wrapper with custom themes) nor does it encourage any developers to utilize it compared to Drive for example.

Google Keep

A bigger annoyance, one which swayed me away very quickly, is the official fact that there is no native application for MacOS or Linux, or even Windows 10 for that matter. Some third party applications do provide a native application experience, but majority are lacklustre due to the restricted Google API for keep, implying that 90% that I researched were strictly web wrappers. Having used it for all my note taking, todo lists, web clippings, and even typing of this document -which is then exported to Drive for more detail-oriented editing before posting. This inclines me prefer Keep for basic, rough note taking and link saving, before exporting a much more refined version to Drive for further use. This work flow utilizes both platforms nicely, but proves that Keep is not capable of being a bare bones replacement to EverNote.

Google Drive

Drive on the other hand, was a much more pleasant experience which I had already been used to for most activities. Being my default note storage medium, all of my notes from previous courses typically ended up in Google Drive while I migrated between many different services in attempts to find something better.  Though I understand that Keep and Drive are for two entirely different markets, I wanted to highlight the essential features which make Drive > Keep in every way:

  1. Drive supports version control, which as a programmer I can relate to the most satisfying safety blanket. Ever.
  2. Drive is supported on all major platforms, and also has unofficial applications for Linux which run through Nautilus, a terminal or their own sandbox.
  3. Drive’s ability to save entire web pages as PDFs and PNGs, which though not nearly as powerful as Pocket, is still a very welcoming feature.
  4. IFTT integrations make Drive a very useful for storing articles, clippings as well as augmenting it’s impressive suite of features.

Google’s Drive platform also is augmented by third party integrations, allowing for collaborative work on different applications including draw.io, stackedit, Gmail and a host of others. My only concern, is the privacy of my notes (even if I do not keep confidential items in my drive account), I still am cautious about using this medium as a primary note storage base.

Google Drive

A downside to Drive, simply put is that it functions more as a file system in contrast to a notebook / notes section. Obviously I can emulate this work flow with relative ease, which grants me the most flexibility when it comes to note locations, storage architecture and ease of use, but this comes at the cost of unnecessary complexity to the architecture. Another downside which may be easily overlooked is when syncing with a desktop using Google’s native application, opening files launches a browser instance of the file instead of a local version. Research into utilizing LibreOffice and Extensions to read / write to .gdoc files is being conducted now, which if possible, will improve my work flow tenfold on each machine.

To end this article, I’m including some of the other articles I read which provided me with ideas and workflows for both Keep and Drive, which perhaps you may be interested in as well. Stay tuned for my third entry, where I take a look at SimpleNote.

Brackets Enhancement Proposal

February 18, 2017 | Open Source, Web Development | No Comments

OSD600 Week Six Deliverable

When we were given the instructions to search, locate and eventually implement fixes or upgrades to Mozilla’s Thimble or Brackets, I found what perhaps was the most challenging enhancement I could possible implement. Suggested here by the professor, and assigned to myself at my own request, the user interface discussion can be found here. Like any good IDE, developers utilize space and workflows to be the most efficient they can, often relying on key mappings and high resolution monitors to provide the most content to their view with ease.

The desktop version of Adobe’s Brackets includes multiple toolbars, which are accessible to the left and right of the editing window -thus providing a simplistic way of accessing commonly used tools, setting configurations and relevant functions for your current project. This is not the case on the Web version, which does not sport said toolbar except for on top of the editor, limiting some of the settings and functional elements to be hidden behind menus. The proposal I agree is very useful for the development of Mozilla’s brackets fork, allowing it to become a much more utilitarian friendly online editor while also providing a smooth and clutter free experience for the beginner and hobbyist.

With this proposed enhancement to the interface, the question of what tools, functions or utilities would be placed in the empty space there. As you can see from the image below of the current Thimble editor, there’s quite a bit of space that we can augment to utilize a responsive toolbar. After doing research related to web development tools, including Adobe’s Brackets, JetBrains’ WebStorm, Microsoft’s Visual Studio Community, and Firefox’s developer tools.

Proposed Features

For my first proposal of features which may be added to that space without cluttering the user interface, I focused on augmenting Brimble (Brackets + Thimble) accessible features to be more advantageous to the developer’s requirements, thus allowing them to use utilize Thimble beyond the standard learning platform which is currently proposed. I’m aware that development of related features is also being in discussion now, which is why I claim this as my first set of proposed features for that space.

Quick Settings

Access to the Editor’s settings, including tab spacing, typeset, syntax highlighting styles, and plugin support. This would tie in with the originally implemented preferences manager, allowing the user to custom tailor their experience on their development machine.This would be responsive, my suggestion on how to best utilize the space is to have three different width classes which would display the settings in the following manners:

  1. Icon Text: Value
  2. Text: Value
  3. Icon: Value

Using three different display manners would allow the application to determine which is best to use for the space, thus introducing a dynamic display which could adapt to different widths without changing the familiarity of the layout and icons.

Code Snippets / Templates

Following similar to XCode’s UI Creator, this area could house drag-drop templates for basic HTML code, with the option to extend with framework classes and various other snippets that may be useful in the future. This would allow Thimble to be more accessible to newer developers, while also providing good web standards. Furthermore, it may benefit the average developer looking to utilize Thimble beyond just a learning environment, and instead use it as a basic test environment for their code.
Examples of this can be found in the following sites and applications:

Xcode

xcode 8 Interface Builder
Source: https://developer.apple.com/xcode/interface-builder

Bootstrap Studio

Bootstrap Studio Application
Source: https://bootstrapstudio.io/

Weebly

Weebly Interface Builder
Source: http://www.getspokal.com/

Algorithm Selection in C

February 17, 2017 | Open Source | No Comments

SPO600 Week Five Deliverables

During this lab, we were instructed to program two different implementations which attempted the same process; adjusting the volume of a sequence of samples. This program would be implemented in C, and benchmarked using the conventional time.h library available through the system.

Implementation One

This simple implementation utilized the following function, which I’ve included below this description.

This simple algorithm did all calculations, and assignments in a for statement which would loop the defined ‘SIZE’ amount of times. SIZE was defined at the time of this post as 500,000,000. The first issue we saw was multiple assignment operators during the loop, which would have an impact on performance that make up a second of the entire runtime.

Implementation Two

This implementation on the other hand utilized calculations outside of the for statement, effectively reducing the amount of multiplication calls to 65,335 in contrast to the original 500,000,000. This, along with the removal of a line used in the first implementation which negated the compiler from optimizing the entire loop ensured that our second implementation would be much more performant than the previous.

Observations and Analysis

On the AArch64 server, the following code functions each ran with the same input data, and reported the following data metric:

In contrast, to the x86_64 server the following data metrics were provided at the end of the application execution:

With the above results, upon investigating each executables machine code and attempting optimizations on that level, the AArch64 server was the one which benefited the most from the optimizations. This was discovered after using the -O3 GCC argument, which would create the most optimal executable it could. This in contrast, did not have too much benefit on the X86_64 server which by default optimized much more of the code logic from the very start, making only subtle changes to the runtime of the program.

Part 1

EverNote, a product regarded as the one of the most controversial productivity services of 2016 due to pricing scheme upgrade, feature restrictions on lower offerings, and a privacy policy update -which allowed developers decrypted access to the average user’s notes, have made many turn away in uproar, and even fewer advocate the upgrades. The later being updated as an ‘opt-in’ setting to alleviate much of the backlash response from the community. Before such times of outrage and a rising need for alternatives, I advocated EverNote for many solutions. Utilizing it for research, micromanagement, note taking and even wallpaper storing when I wanted to have a unified scheme among various devices. Taylor Martin’s video on EverNote provided many useful tips, some of which I regarded to others as the best solution to their needs.

Many of my technological issues all gravitate around a central theme, that being platform agnostic services which would allow me to utilize the software on Windows, Linux, and MacOS without jumping through hoops. Though this is an ever shrinking complaint with increasing support for native and web applications on the power user’s OS, many platforms are still stagnant to support the penguin. EverNote was an interesting case, because though no official client was developed, popular applications such as NixNote provided a native third party experience that could still access all of EverNote’s features and databases securely.

With the recent debacle related to the privacy policy, and also the limitations set on the different tiered plans, it was time to find an alternative note storage service which could be utilized from any platform, and provide me with the following featureset:

  • Markdown / Rich Text Support: So that I may integrate Code, Images and annotations into my notes. As a programmer, I rely on snippets quite a bit in my common projects to increase productivity.
  • Cloud Synchronization: I have no issues paying for the storage / synchronization, as long as it is a seamless experience.
  • Mobile Applications: While travelling, I often rely on mobile applications to interact with my notes, be-it for studious purposes, article reading and saving newly found content into. The platform must offer the following for a truly cross-platform experience.
  • Dark Mode: Because some cliches are really life changing.
  • Tag / Organizational Archiving: I like to create an unnecessary amount of notes on the same topic, or research a topic until I’ve hit the 10th page of a Google search. This implies that, I need a sane way of keeping everything organized so that the database does not look like my Pocket list which has articles sprawling between different topics without warning.

Doing research led me to the a few promising applications, each with their own strengths and weaknesses. The contenders which I will highlight my experiences with in the next instalment include:

  • Google Drive: Google’s storage and office suite, which is accessible through web applications, Windows and MacOS synchronizing applications, and Nautilus on Gnome 3.2. That last fact being both a godsend for Linux users (utilizing a network-mount filesystem), but also a frustration for the lack of other options.
  • Google Keep: Another offering from Google, this time focusing more on the stickynote, basic layout without the clutter of notebooks. Instead, relying solely on coloured ‘pages’ and tags, Keep allows for basic lists, Rich text notes and a useful web clipper. Though solely restricted to Web Applications and Mobile Applications, many third party applications allow for integration with the basic browser on any system.
  • SimpleNote: Created by Automattic, creators of WordPress. SimpleNote has supported Windows and Linux (utilizing Electron), MacOS, iOS, and Android, all of which being open sourced on August 16, 2016. With the open sourcing of each client, developer contributions have helped to shape the path of SimpleNote, including Markdown support for mobile applications and desktop clients. Though not citing the application as the most secure medium for note storage, SimpleNote does encrypt notes to the server, and are decrypted locally.  
  • OneNote: Created by Microsoft, and offered to all platforms except Linux, which may still utilize the program by using a windows binary emulator or the web client. The free-form canvas is quite the interesting take on notetaking, and has been cited by many as the goto alternative to EverNote. I’d happily choose this construct, had they provided a better web client or native Linux application. One caveat, is the dependant storage of the ‘notebooks’ in OneDrive, Microsoft’s cloud offerings.

The second instalment can be found here, which covers Google’s offerings. Granted that it will be revolving around my experiences, thoughts, and any notes or opinions I’ve gathered during that time.

OSD600 Assignment One Deliverable

In the last week of January I posted about setting up a local instance of Thimble, an online editor which supported the learning of HTML, CSS and JavaScript. This project allowed for educators and hobbyists alike to program, and demonstrate their code with live previews in the same window without ever having to leave the editor. Due to the learning nature of Thimble’s developers and maintainers ,who advocate allowing contributions from students as much as professionals alike, the project has also become an educational tool of it’s own for the open source developer.

My issue (which can be found here), made drop down links much more difficult to click than they should have been. This decreased usability and accessibility of the options menu, coincidentally also breaking WCAG 2.0 AA compliance, since the links provided no signs of interaction or feedback to the end user unless selected at just the right spot.

Styling Issue

After debating on two possible implementations, one being a CSS change and the other being a JavaScript listener for the <li>‘s <a> element, the former was decided upon. Fixing the CSS would involve modification of the userbar.less file, which would first imply I had to learn the Less syntax required for this project. Less is described by the official website as the following:

Less is a CSS pre-processor, meaning that it extends the CSS language, adding features that allow variables, mixins, functions and many other techniques that allow you to make CSS that is more maintainable, themable and extendable.

This technology allowed for a cleaner cascading style sheet, which I grew to appreciate as I looked through the file in attempts to learn the coding conventions and syntax required. After using Sass for over a year, I can see where Less had showcased advantages over its competitor, and unique disadvantages such as requiring NodeJS to be installed and functional on your workstation for compilation to .CSS. I much prefer having Ruby, Sass’s processing engine in contrast simply because  I found it be more programmable and resource efficient. My modification allowed for a much more accessible menu, which can be seen below – Note that the menu isn’t blue, this is simply a tool in my workstation for isolating and highlighting the style classes I’m working with now.

With a little testing on my local machine to ensure that this did not break other sections of the thimble’s interface, I proposed the following changes in the form of a pull request. This issue was a simple CSS change, with the final diff looking like the following:

At the time of writing this blog, my pull request was landed by a maintainer, who after a few requested changes to the syntax, was content with my small contribution. This introduction to bug fixing, along with code navigating and learning how thimble works was quite the adventure, and I know for certain that it will not be my last time visiting thimble’s repository for contributions and updates.

OSD600 Week Four Deliverable

Developers, programmers and even the occasional hobbyist are a hot topic this decade, knowing just their contributions alone can shape modern day enterprises and the technological stack of tomorrow’s gadgets. Google, a company familiar to anyone who’s rejected the living-under-rocks lifestyle is renown for providing their employees with perks that make even the most well-established yearn for. Perks so unique and sometimes life changing in fact, that they influence your reasons as to why you’d ever need anything else -or seek anything else.

It’s no secret that corporations attempt to entice as many developers as they can with perks, platforms and offerings that can sway even the hobbyist to their side. Github, the ‘go to standard’ of all forms of version control hosting has played their own moves in the same game, with the ever-so-popular Github Pages being their first means of developer seduction.

Created to ‘celebrate’ your projects, this platform allowed one to host a static website directly from their respective repository without too much work. These static websites allowed for elegant, simplistic means of conveying content, project details and relevant information for developers to pour their celebrations, contributions and modifications into with ease. Because they are legitimate, static web pages, even search engines provide promotion and easy discovery of your project at no extra cost.

For this week, our assignment was to go through a obstacle course of instructions, related to Git which would come to a closing Github Page being published under a forked Spoon-Knife repository. The first task was learn how to interact with branches, starting with commands such as:

After, we were granted the unfortunate opportunity to work with unfriendly git merges, all the while creating more branches to add to the chaos. By the end of the assignment, too many branches were created (a few on my part due to ‘experiments’) than should have existed. To remedy this issue, I quickly consulted Google’s wisdom which suggested:

Which would delete a local branch. Deleting from a remote branch it suggested, would look like the following:

Once the merging madness was complete, it was time to show off this item to the world. After converting the animals.txt file which we used above to HTML, the next step was to commit the file to this unique branch,

Once this was done, the page was accessible just like a standard web page using the following link: https://raygervais.github.io/Spoon-Knife/animals.html. I must promote this work of art here for I doubt Google’s web crawlers will value mine above the EXACT SAME FILE as my peers. Regardless, this introduction to Github’s Pages was an interesting lesson which I’m certain will be valuable for future projects.

Common Git Commands

Command Description
 

 
Creates a new local repository in the current directory
 

 
Create a working copy of a remote repository
 

 
List tracked changes in your files on the current branch
 

 
Create a new branch, then switch to it
 

 
Mark a release or changeset in the repository

For more commands, I’d recommend referencing Atlassian’s resources

Compiler Optimizations and Features

February 1, 2017 | Open Source | No Comments

An Intro, Deliverable Four for SPO600

When compiling projects, files and various utilities, the IDE you use takes care of quite a bit of background tasks, arguments and settings. Some of these settings and arguments can make quite the difference to the end product, relating to performance overhead, file size and included binaries which make up the final file. Exploring this topic, let’s examine some of these arguments and settings related to GCC, which are explained below, using a reference hello.c file which contains the following:

Arguments

Indicates that you’d like to name the output file as the argument provided, defaulting to a.out in most environments if this argument is not provided.

This enables debugging information

This indicates to the compiler that you do not want the program’s binary files to be optimized. There are a varying amount of optimizations that can occur to during the compilation of a program, and GCC allows for the a levelled approach to each optimization in the following way:

  • O1: This level compiles at a moderate pace, but reduces the code base to the smallest possible level. In doing so, a drawback is the lost of execution speed of the program.
  • O2: This level in contrast also compiles at a moderate pace, but only reduces the code footprint by so much, thus enabling a moderate rate of execution speed for the program.
  • O3: This level applies the most amount of optimizations to the source, making for slow compiler times but incredibly fast performance time in contrast. This, is due to a much larger file being created at the level which is highly optimized in contrast to the previous two options. This is the only tier which does not provide safety features.
  • Os: This level optimizes for code size only, without affecting the performance of the program.
  • Ofast: This follows the same optimizations as O3, with none accurate math calculations

This disables the builtin function optimizations found in various compilers. Doing so negates part of the compilers run time functions which would normally generate code to handle a subset of builtin functions more efficiently.

Effects on the Hello.c Program

The following results were recorded by using

which allows for recording the data into a text document for easier research.

Optimization Used File Size Notes
23.0KiB This was the original compilation to be used for the lab
9.8MiB The static argument option links a program statically to any dependencies, implying that the program does not require any dynamic libraries at run time to execute.
23.0KiB Removing the fno-builtin argument allows for the compiler to replace the print call with putchar instead, attempting to optimize the simply program this way.
15.3KiB Debugging information in the operating systems native format was not produced in this compilation. This reduces the size by 7.7KiB
16.0KiB Additional lines of code were added to the program, resulting in the the printf function being put inside a for loop, and displaying the current iteration of i.
17.0KiB Code is vastly more reliant on calls to memory locations in the file, with majority of the objects and variables being stored in registers